:root {
  --bg: #0b1020;
  --panel: #161c2e;
  --ink: #e8ecf5;
  --muted: #93a0bd;
  --line: #28324b;
  --brand: #2d8cff;
  --ok: #2fbf71;
  --warn: #e0a82e;
  --err: #e0564a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
header h1 { font-size: 16px; margin: 0; }

.status {
  margin: 8px 12px; padding: 8px 12px; border-radius: 8px;
  background: #15203a; border: 1px solid var(--line); font-size: 13px; word-break: break-all;
}
.status.ok { border-color: var(--ok); color: var(--ok); }
.status.warn { border-color: var(--warn); color: var(--warn); }
.status.err { border-color: var(--err); color: #ffd9d4; background: #2a1414; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  margin: 12px; padding: 12px 14px;
}
.panel h2 { font-size: 13px; margin: 0 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.row.spread { justify-content: space-between; }
.action-row { margin-bottom: 10px; }
label { color: var(--muted); }
.muted { color: var(--muted); }

select, input, textarea {
  background: #0e1424; color: var(--ink); border: 1px solid var(--line);
  border-radius: 7px; padding: 6px 8px; font: inherit;
}
input[type="number"] { width: 72px; }
button {
  background: #1f2840; color: var(--ink); border: 1px solid var(--line);
  border-radius: 7px; padding: 7px 12px; cursor: pointer; font: inherit;
}
button:hover { border-color: var(--brand); }
button.primary { background: var(--brand); border-color: var(--brand); }
button.danger { background: #3a1d1d; border-color: var(--err); color: #ffd9d4; }
button.ghost { background: transparent; }
button.small { padding: 4px 8px; font-size: 12px; }
button.big { font-size: 15px; font-weight: 700; padding: 12px 18px; flex: 1; }
.danger-text { color: #ffb3ad; }

/* 割当方式 / オプション */
.method-group { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.opt, .chk { display: flex; align-items: center; gap: 8px; color: var(--ink); cursor: pointer; }
.opt input, .chk input { width: auto; }
.options { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.opt-head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--line); }
.options .chk { align-items: flex-start; }

/* 未割当プール */
.unassigned { background: #0e1424; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.unassigned .count { color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #20294233; border: 1px solid var(--line); border-radius: 20px;
  padding: 2px 10px; font-size: 12px;
}
.chip .x { background: transparent; border: none; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 13px; line-height: 1; }
.chip .x:hover { color: var(--err); }

/* 部屋グリッド */
.rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.room { background: #0e1424; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.room-head { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.room-name { flex: 1; font-weight: 600; }
.room-head .count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.members { display: flex; flex-wrap: wrap; gap: 4px; min-height: 24px; margin-bottom: 8px; }
.add-to-room { width: 100%; }

/* 保存済みパターンカード */
.pattern-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pcard { background: #0e1424; border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.pcard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard-name { font-size: 15px; font-weight: 700; }
.pcard-badge { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ログ */
.log { max-height: 200px; overflow: auto; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.logline { padding: 2px 0; border-bottom: 1px solid #1b2233; }
.logline.ok { color: var(--ok); }
.logline.warn { color: var(--warn); }
.logline.err { color: var(--err); }
details summary { cursor: pointer; color: var(--muted); }

/* 自前モーダル（Zoom組み込みブラウザは prompt/confirm 不可） */
.modal-ov {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px;
}
.modal {
  background: var(--panel); border: 1px solid var(--brand); border-radius: 12px;
  padding: 16px; width: 100%; max-width: 340px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.modal-msg { margin-bottom: 12px; }
.modal-input { width: 100%; margin-bottom: 12px; }
.modal-btns { display: flex; justify-content: flex-end; gap: 8px; }
