:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #1b1f24; --muted: #5d6673; --line: #dde1e6;
  --accent: #1f5fbf; --accent-ink: #ffffff; --danger: #b42318; --hover: #eef3fb; --code: #f2f4f7;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111418; --panel: #191d23; --ink: #e6e9ed; --muted: #9aa4b1; --line: #2b313a;
          --accent: #5b9bff; --accent-ink: #0b1220; --danger: #ff7a6b; --hover: #1f2733; --code: #141820; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; } .brand span { color: var(--accent); font-weight: 600; }
.who { color: var(--muted); font-size: 13px; }
button { font: inherit; padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); cursor: pointer; }
button:hover:not(:disabled) { background: var(--hover); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; color: var(--accent); padding: 0 4px; }
input, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; width: 100%; }
textarea.mono, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
label { display: block; margin: 8px 0; }
label.check { display: inline-flex; gap: 6px; align-items: center; margin: 0; width: auto; }
label.check input { width: auto; }
.muted { color: var(--muted); }
.msg { color: var(--muted); }
.msg.err { color: var(--danger); }
.signin { max-width: 380px; margin: 60px auto; background: var(--panel); padding: 24px; border: 1px solid var(--line); border-radius: 10px; }
.signin h1 { margin-top: 0; font-size: 20px; }
.layout { display: grid; grid-template-columns: 280px 1fr; min-height: calc(100vh - 46px); }
.side { border-right: 1px solid var(--line); background: var(--panel); padding: 12px; overflow: auto; }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.tab { flex: 1; } .tab.on { background: var(--hover); font-weight: 600; }
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li { padding: 8px; border-radius: 6px; cursor: pointer; border-bottom: 1px solid var(--line); }
.list li:hover { background: var(--hover); }
.list .t { font-weight: 600; } .list .s { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work { padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; }
.lbl { font-weight: 600; margin: 0 0 6px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.row.between { justify-content: space-between; margin-top: 0; }
.answer { margin-top: 10px; padding: 10px 12px; background: var(--code); border-radius: 8px; }
.answer p { margin: 0 0 6px; } .answer ul { margin: 0; padding-left: 18px; }
.pager { display: flex; gap: 6px; align-items: center; }
.tablewrap { overflow: auto; max-height: 60vh; margin-top: 10px; border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 13px; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--code); font-weight: 600; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.null { color: var(--muted); }
dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h2 { margin-top: 0; font-size: 18px; }
fieldset { border: 1px solid var(--line); border-radius: 6px; }
.people { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .work { padding: 12px 16px; }
  .people { grid-template-columns: 1fr; }
}

dialog h3 { font-size: 15px; margin: 18px 0 4px; }
.replist { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.replist .t { font-weight: 600; margin-bottom: 4px; }
.team { border-top: 1px solid var(--line); padding: 6px 0; }
.team .rms { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
#repDlg { width: min(640px, calc(100vw - 32px)); }
select { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
label > select { width: 100%; margin-top: 4px; }
label.check > select { width: auto; margin: 0 0 0 6px; }
.warn { color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.chip { font-size: 12px; padding: 3px 8px; border-radius: 999px; }
.list .q { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sRollSql { margin-top: 6px; }
dialog { max-height: calc(100vh - 32px); overflow: auto; }
