/* Centris · Administration. One token set; state colours carry meaning, the accent is for actions only. */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --line: #e3e6eb; --line-strong: #cfd4dc;
  --text: #1b1f27; --muted: #5b6472; --faint: #6b7280;
  --accent: #1f47c7; --accent-strong: #17379c; --accent-soft: #e9eefc;
  --ok: #0f7a3d; --ok-soft: #e4f4ea; --warn: #8a5a00; --warn-soft: #fdf1d8;
  --bad: #b42318; --bad-soft: #fde7e5; --idle: #4b5563; --idle-soft: #eef0f3;
  --radius: 8px; --shadow: 0 10px 30px rgba(16, 24, 40, .14);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --side: 13.5rem; --frame: 120rem;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0; line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
h3 { font-size: .9rem; margin: 1.1rem 0 .4rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* shell */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: #111827; color: #d1d5db; padding: 1rem .75rem; display: flex; flex-direction: column; gap: .15rem; position: sticky; top: 0; height: 100vh; }
.side .brand { color: #fff; font-weight: 700; font-size: 1.05rem; padding: .25rem .5rem 1rem; display: flex; flex-direction: column; }
.side .brand span { font-weight: 400; font-size: .8rem; color: #9ca3af; }
.side a { color: #d1d5db; padding: .45rem .6rem; border-radius: 6px; }
.side a:hover { background: #1f2937; text-decoration: none; }
.side a.on { background: #374151; color: #fff; }
.side .who { margin-top: auto; font-size: .8rem; color: #9ca3af; display: flex; flex-direction: column; gap: .25rem; padding: .5rem; word-break: break-all; }
.side .who .link { color: #cbd5e1; text-align: left; }
.main { display: flex; flex-direction: column; min-width: 0; }
.band { background: var(--surface); border-bottom: 1px solid var(--line); padding: .9rem 1.5rem 1rem; }
.band-row, .frame, .foot { max-width: var(--frame); }
.crumbs { font-size: .8rem; color: var(--faint); margin-bottom: .25rem; min-height: 1em; }
.band-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.desc { margin: .3rem 0 0; color: var(--muted); max-width: 52rem; }
.actions { display: flex; gap: .5rem; }
.frame { padding: 1.25rem 1.5rem 2rem; flex: 1; width: 100%; outline: none; }
.foot { padding: .75rem 1.5rem; color: var(--faint); font-size: .8rem; border-top: 1px solid var(--line); }
@media (min-width: 1700px) { .band-row, .frame, .foot { margin-inline: auto; } }

/* controls */
.btn { font: inherit; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 6px; padding: .42rem .8rem; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: .35rem; }
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { color: var(--bad); border-color: #f1b8b2; }
.btn.small { padding: .2rem .5rem; font-size: .85rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
input[type=text], input[type=url], input[type=search], input[type=number], select { font: inherit; border: 1px solid var(--line-strong); border-radius: 6px; padding: .42rem .6rem; background: #fff; color: var(--text); width: 100%; }
input:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible, button:focus-visible, tr:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; font-weight: 600; margin: .8rem 0 .25rem; }
.hint { color: var(--muted); font-size: .85rem; margin: .25rem 0 0; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: .9rem; }
.toolbar input[type=search] { max-width: 26rem; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.seg button { font: inherit; border: 0; background: #fff; padding: .4rem .75rem; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }

.stack { margin-bottom: 1rem; }
label.inline { margin: 0; font-weight: 400; }
select.narrow { max-width: 14rem; }

/* strip */
.strip { display: flex; gap: 1.5rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem; }
.strip div { display: flex; flex-direction: column; }
.strip b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.strip span { color: var(--muted); font-size: .8rem; }

/* tables */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; color: var(--muted); font-weight: 600; background: #fafbfc; position: sticky; top: 0; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: #f8f9fb; }
tr.group td { background: #f3f4f6; font-weight: 600; color: var(--muted); font-size: .85rem; }
td .sub, li .sub { display: block; color: var(--muted); font-size: .82rem; }
.dim { opacity: .72; }
.nowrap { white-space: nowrap; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

/* pills */
.pill { display: inline-block; border-radius: 999px; padding: .08rem .55rem; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.idle { background: var(--idle-soft); color: var(--idle); }
.tag { display: inline-block; border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 .35rem; font-size: .75rem; color: var(--muted); margin-left: .35rem; }

/* side panel */
.scrim { position: fixed; inset: 0; background: rgba(17, 24, 39, .28); z-index: 20; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(44rem, 100vw); background: var(--surface); box-shadow: var(--shadow); z-index: 21; display: flex; flex-direction: column; }
.panel header { padding: 1rem 1.25rem .75rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.panel header h2 { margin: 0; font-size: 1.15rem; word-break: break-all; }
.panel .body { padding: .5rem 1.25rem 1.25rem; overflow-y: auto; flex: 1; }
.panel footer { padding: .75rem 1.25rem; border-top: 1px solid var(--line); display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.kv { display: grid; grid-template-columns: 11rem 1fr; gap: .3rem .75rem; margin: .5rem 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: .25rem 0; border-bottom: 1px dashed var(--line); }
ul.plain li:last-child { border-bottom: 0; }
.secret { font-family: var(--mono); background: #0f172a; color: #e2e8f0; padding: .6rem .75rem; border-radius: 6px; word-break: break-all; margin: .5rem 0; }
.callout { border-radius: 6px; padding: .6rem .75rem; margin: .6rem 0; font-size: .9rem; }
.callout.warn { background: var(--warn-soft); color: #5c3c00; }
.callout.info { background: var(--accent-soft); color: #1e2f6b; }
pre.snippet { background: #f3f4f6; border-radius: 6px; padding: .6rem; overflow-x: auto; font-size: .8rem; }
details summary { cursor: pointer; color: var(--accent); margin: .75rem 0 .25rem; }

/* picker */
.picker { border: 1px solid var(--line); border-radius: 6px; max-height: 24rem; overflow-y: auto; margin-top: .4rem; }
.picker .firm { border-bottom: 1px solid var(--line); }
.picker .firm:last-child { border-bottom: 0; }
.picker .line { display: flex; align-items: center; gap: .45rem; padding: .3rem .6rem; font-weight: 400; margin: 0; cursor: pointer; }
.picker .line:hover { background: #f8f9fb; }
.picker .firm > .line { font-weight: 600; background: #fafbfc; }
.picker .office > .line { padding-left: 1.6rem; font-weight: 600; }
.picker .broker { padding-left: 2.9rem; }
.picker .count { margin-left: auto; color: var(--faint); font-size: .8rem; font-variant-numeric: tabular-nums; }
.picker input:disabled + span { color: var(--muted); }
.cover { position: sticky; bottom: 0; background: var(--surface); padding: .5rem 0; font-weight: 600; }

/* toasts, dialog, sign-in */
.toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; z-index: 40; }
.toast { background: #111827; color: #fff; padding: .6rem .9rem; border-radius: 6px; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); }
dialog.confirm { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; max-width: 30rem; }
dialog.confirm::backdrop { background: rgba(17, 24, 39, .35); }
.signin, body.bare { display: grid; place-items: center; min-height: 100vh; }
.notice { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; max-width: 30rem; }
.notice h1 { margin-bottom: .75rem; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side .brand { padding: .25rem .5rem; flex-direction: row; gap: .4rem; align-items: baseline; }
  .side .who { margin: 0 0 0 auto; flex-direction: row; }
  .band, .frame, .foot { padding-inline: 1rem; }
  .kv { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}
