@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ground: #f3f5f8;
  --surface: #ffffff;
  --raised: #f7f9fb;
  --active: #e9edf2;
  --border: #e2e7ed;
  --rule: #edf1f5;
  --control: #ccd4de;
  --text: #111820;
  --muted: #5b6673;
  --faint: #606b78;
  --accent: #1d5fbf;
  --accent-soft: #eef4fd;
  --positive: #2f7a4d;
  --positive-bg: #e8f6ee;
  --negative: #b4232b;
  --negative-bg: #fdeeef;
  --warning: #8a5a00;
  --warning-bg: #fff8e6;
  --warning-border: #efd9a3;
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar: 240px;
  --font: "Geist", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --shadow: 0 18px 48px rgba(17, 24, 32, 0.14);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, dl, dd, dt { margin: 0; }
ul, ol { margin: 0; padding: 0; }
li { list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: var(--mono); }
svg { flex: none; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.app { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  background: var(--ground);
  border-right: 1px solid var(--border);
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; flex: none; color: var(--text); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.brand-text span { font-size: 11px; color: var(--muted); margin-top: 1px; }
.brand-lg { padding: 0 0 24px; }
.brand-lg .brand-mark { width: 38px; height: 38px; }
.brand-lg .brand-text strong { font-size: 17px; }
.brand-lg .brand-text span { font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px; line-height: 1;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.nav-link svg { color: var(--faint); }
.nav-link:hover { background: rgba(17, 24, 32, 0.045); color: var(--text); }
.nav-link:hover svg { color: var(--muted); }
.nav-link.active { background: var(--active); color: var(--text); font-weight: 500; }
.nav-link.active svg { color: var(--text); }
.sidebar-foot { margin-top: auto; padding-top: 16px; }
.user-row { display: flex; align-items: center; gap: 9px; padding: 8px 8px 4px 10px; }
.avatar {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: 50%; background: #e4e9ef; color: #394450;
  font-size: 12px; font-weight: 600;
}
.user-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-text strong { font-size: 13px; font-weight: 500; }
.user-text span { font-size: 11px; color: var(--muted); margin-top: 1px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted);
  transition: background-color 0.12s ease, color 0.12s ease;
}
.icon-btn:hover { background: var(--active); color: var(--text); }

.mobilebar { display: none; }
.scrim { display: none; }
.canvas { margin-left: var(--sidebar); padding: 30px 34px 48px; }
.page { max-width: 1380px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -0.015em; }
.page-head .sub { margin-top: 6px; font-size: 14px; color: var(--muted); max-width: 78ch; }
.page-head .sub strong { color: var(--text); font-weight: 500; }
.head-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; row-gap: 6px; flex: none; padding-bottom: 3px; font-size: 12px; color: var(--muted); }
.live { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: #9aa4b1; display: inline-block; }
.dot-ok { background: var(--positive); }
.dot-warn { background: #b7791f; }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); font-size: 14px; font-weight: 500;
  line-height: 1; white-space: nowrap;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }
.btn-primary { background: #14181d; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #252c34; box-shadow: 0 4px 12px rgba(17, 24, 32, 0.2); transform: translateY(-1px); }
.btn-primary:active:not(:disabled) { background: #14181d; box-shadow: none; transform: translateY(0); }
.btn-outline { background: var(--surface); border-color: var(--control); }
.btn-outline:hover:not(:disabled) { background: var(--raised); }
.btn-quiet { color: var(--muted); padding: 0 10px; }
.btn-quiet:hover:not(:disabled) { background: var(--active); color: var(--text); }
.btn-danger { background: var(--negative); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #971c23; }
.btn-danger-quiet { color: var(--muted); padding: 0 10px; }
.btn-danger-quiet:hover:not(:disabled) { background: var(--negative-bg); color: var(--negative); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 15px; }
.btn-block { width: 100%; }

.chip {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 4px; background: var(--active); color: #3d4854;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.status i { width: 6px; height: 6px; border-radius: 50%; background: #9aa4b1; display: inline-block; }
.status-online { color: var(--positive); }
.status-online i { background: var(--positive); }
.status-offline { color: var(--warning); }
.status-offline i { background: #b7791f; }
.meta { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.dash { color: #98a2af; }
.text-warn { color: var(--warning); }

.panel, .board, .stats, .dept-panel, .empty-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.notice {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-bottom: 18px; padding: 10px 14px;
  background: var(--warning-bg); border: 1px solid var(--warning-border); border-radius: var(--radius-sm);
  color: #6d4a00; font-size: 13px;
}
.notice a { color: #6d4a00; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; font-weight: 500; }

.empty-panel { padding: 32px 34px; }
.empty-panel h2 { font-size: 18px; font-weight: 600; }
.empty-panel > p { margin-top: 8px; font-size: 13px; color: var(--muted); max-width: 62ch; }
.setup-steps { margin: 18px 0 22px; padding-left: 20px; display: grid; gap: 8px; }
.setup-steps li { list-style: decimal; font-size: 13px; color: var(--muted); padding-left: 4px; }
.setup-steps b { color: var(--text); font-weight: 500; }

.boot { min-height: 100vh; display: grid; place-items: center; font-size: 13px; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  max-width: calc(100vw - 32px); z-index: 60;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: #14181d; color: #fff; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.toast.is-error { background: #7f1d24; }

.desk { display: grid; grid-template-columns: minmax(0, 1fr) 350px; grid-template-areas: "main rail" "stats rail"; gap: var(--gap); align-items: start; }
.desk-main { grid-area: main; }
.rail { grid-area: rail; }
.desk > .stats { grid-area: stats; margin-top: 0; }
.desk-main { min-width: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-head h2 { font-size: 16px; font-weight: 600; }
.boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.boards > .board:last-child:nth-child(odd) { grid-column: 1 / -1; }
.rail { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }

.board { padding: 18px; display: flex; flex-direction: column; gap: 13px; }
.board-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.board-id { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.board-id h3 { font-size: 16px; font-weight: 600; line-height: 1.3; }
.board-now { display: flex; flex-direction: column; align-items: flex-start; }
.value-label { display: block; margin-bottom: 5px; font-size: 12px; color: var(--muted); }
.ticket {
  font-size: 40px; font-weight: 500; line-height: 1;
  letter-spacing: 0.01em; color: var(--accent);
  font-variant-numeric: tabular-nums; min-height: 40px;
}
.ticket.is-idle { color: #98a2af; font-weight: 400; }
.board-note { margin-top: 9px; font-size: 13px; color: var(--muted); min-height: 17px; display: flex; align-items: center; }
.board-note.warn { color: var(--warning); }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 7px; flex: none; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.board-meta {
  display: flex; align-items: center; gap: 9px;
  padding-top: 12px; border-top: 1px solid var(--rule);
  font-size: 13px; color: var(--muted);
}
.board-meta b { color: var(--text); font-weight: 600; }
.board-meta .sep { width: 1px; height: 11px; background: var(--border); }
.board-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.board-actions .btn-primary { flex: 1; min-width: 138px; }
.offline-note {
  padding: 7px 10px; border-radius: var(--radius-sm);
  background: var(--warning-bg); border: 1px solid var(--warning-border);
  color: #6d4a00; font-size: 12px;
}

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 15px 18px 9px; }
.panel-head h2 { font-size: 14px; font-weight: 600; }
.dept-list { padding: 0 0 2px; }
.dept-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 58px; padding: 9px 18px; border-top: 1px solid var(--rule);
}
.dept-row:first-child { border-top: 1px solid var(--rule); }
.dept-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dept-info strong { font-size: 14px; font-weight: 500; }
.dept-info span { font-size: 13px; color: var(--muted); }
.dept-info b { color: var(--text); font-weight: 500; }
.panel-note { padding: 11px 18px 15px; border-top: 1px solid var(--rule); font-size: 12px; color: var(--muted); }
.rail-empty { margin: 12px 18px 16px; padding: 14px; border: 1px dashed var(--control); border-radius: var(--radius-sm); font-size: 12px; color: var(--muted); }

.waitlist { padding: 2px 0 4px; }
.wait-row {
  display: grid; grid-template-columns: 66px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  min-height: 40px; padding: 0 18px; border-top: 1px solid var(--rule);
}
.wait-row:first-child { border-top: 0; }
.wait-num { font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.wait-dept { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wait-time { font-size: 13px; color: var(--muted); white-space: nowrap; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: var(--gap); padding: 16px 0; }
.stats > div { padding: 0 18px; border-left: 1px solid var(--rule); min-width: 0; }
.stats > div:first-child { border-left: 0; }
.stats > div > span { display: block; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.stats strong { display: block; font-size: 24px; font-weight: 500; line-height: 1.12; }
.stats strong.warn { color: var(--warning); }
.stats strong .unit { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 2px; }

.dept-panel { margin-bottom: var(--gap); overflow: hidden; }
.dept-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 17px 20px 15px; }
.dept-title { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.dept-title h2 { font-size: 16px; font-weight: 600; }
.dept-head .meta { margin-top: 5px; }
.row-actions { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; flex: none; }
.win-head, .win-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 120px auto;
  gap: 12px; align-items: center; padding: 0 20px;
}
.win-head {
  height: 34px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.win-row { min-height: 54px; border-bottom: 1px solid var(--rule); }
.win-row:last-child { border-bottom: 0; }
.win-name { font-size: 14px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-actions { display: flex; justify-content: flex-end; gap: 2px; flex-wrap: wrap; }
.dept-foot { padding: 11px 20px; border-top: 1px solid var(--rule); display: flex; }
.win-empty { margin: 14px 20px; padding: 14px; border: 1px dashed var(--control); border-radius: var(--radius-sm); font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.tabs { display: flex; gap: 22px; margin: 0 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: transparent; padding: 0 0 10px; margin-bottom: -1px;
  color: var(--muted); font-size: 14px; white-space: nowrap; position: relative;
}
.tab span { color: var(--faint); font-size: 12px; margin-left: 4px; }
.tab[aria-pressed="true"] { color: var(--text); font-weight: 500; }
.tab[aria-pressed="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--text); }
.tab:hover { color: var(--text); }
.records { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.rec-head, .rec-row {
  display: grid; grid-template-columns: 136px 76px minmax(96px, 1fr) minmax(96px, 1fr) 64px 96px;
  gap: 12px; align-items: center; padding: 0 18px;
}
.rec-head { height: 36px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--rule); }
.rec-row { min-height: 48px; font-size: 13px; border-bottom: 1px solid var(--rule); }
.rec-row:last-child { border-bottom: 0; }
.rec-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.rec-num { font-weight: 500; font-variant-numeric: tabular-nums; }
.rec-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 4px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.pill-ok { background: var(--positive-bg); color: #1f5a39; }
.pill-wait { background: var(--active); color: #404b58; }
.pill-fail { background: var(--negative-bg); color: #8e1c23; }
.rec-empty { padding: 28px 20px; font-size: 13px; color: var(--muted); }

.settings { max-width: 1120px; }
.set-row { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 32px; padding: 28px 0; border-top: 1px solid var(--border); }
.set-row:first-child { border-top: 0; padding-top: 4px; }
.set-label h2 { font-size: 16px; font-weight: 600; }
.set-label p { margin-top: 6px; font-size: 13px; color: var(--muted); max-width: 30ch; }
.set-panel { background: var(--raised); border-radius: var(--radius); padding: 18px; min-width: 0; }

.field { display: block; }
.field > span, .field-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; }
input[type="text"], input[type="password"], select {
  width: 100%; height: 40px; padding: 0 12px;
  background: #fff; border: 1px solid #dfe5ec; border-radius: var(--radius-sm);
  font-size: 14px;
}
input[type="text"]:focus, input[type="password"]:focus, select:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
.field-hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.stack > * + * { margin-top: 14px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-error { margin-top: 12px; font-size: 13px; color: var(--negative); }
.form-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.preview { margin-top: 14px; padding: 12px 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.preview span { display: block; margin-bottom: 5px; font-size: 11px; color: var(--muted); }
.preview p { font-size: 14px; color: var(--text); }
.info-list > div { display: flex; justify-content: space-between; gap: 18px; padding: 10px 0; border-top: 1px solid var(--rule); font-size: 13px; }
.info-list > div:first-child { border-top: 0; padding-top: 0; }
.info-list > div:last-child { padding-bottom: 0; }
.info-list dt { flex: none; color: var(--muted); }
.info-list dd { display: flex; align-items: center; justify-content: flex-end; gap: 5px; min-width: 0; margin: 0; }
.info-list dd code { font-size: 12px; color: var(--text); overflow-wrap: anywhere; }
.info-list .icon-btn { width: 26px; height: 26px; }
.info-note { margin-top: 12px; font-size: 12px; color: var(--muted); }
.set-panel form { max-width: 460px; }
.set-panel form.wide { max-width: none; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 392px; padding: 30px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px;
}
.login-title { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.login-sub { margin: 6px 0 22px; font-size: 13px; color: var(--muted); }
.login form .field + .field { margin-top: 14px; }
.login form .btn { margin-top: 20px; }
.login-foot { margin-top: 20px; text-align: center; font-size: 11px; color: var(--faint); }

.dialog {
  width: calc(100% - 32px); max-width: 452px; padding: 0;
  border: 0; border-radius: 10px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(17, 24, 32, 0.38); }
.dialog-inner { padding: 22px 24px 24px; }
.dialog h2 { font-size: 18px; font-weight: 600; line-height: 1.35; }
.dialog > .dialog-inner > p, .dialog .dialog-copy { margin-top: 8px; font-size: 13px; color: var(--muted); }
.dialog .field { margin-top: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }.dialog .form-error { margin-top: 12px; }

@media (max-width: 1259px) {
  .desk { grid-template-columns: 1fr; grid-template-areas: "main" "stats" "rail"; }
  .rail { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
}
@media (max-width: 1100px) {
  .set-row { grid-template-columns: 260px minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .nav-link { height: 44px; }
  .sidebar.open { display: flex; width: 280px; padding-top: 72px; background: var(--surface); box-shadow: var(--shadow); }
  .mobilebar {
    display: flex; align-items: center; gap: 8px;
    position: sticky; top: 0; z-index: 25; height: 56px; padding: 0 12px;
    background: var(--ground); border-bottom: 1px solid var(--border);
  }
  .mobilebar-title { font-size: 15px; font-weight: 600; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 15; background: rgba(17, 24, 32, 0.38); }
  .canvas { margin-left: 0; padding: 20px 20px 40px; }
  .desk { grid-template-columns: 1fr; grid-template-areas: "main" "rail" "stats"; }
  .rail { grid-template-columns: 1fr; }
  .set-row { grid-template-columns: 1fr; gap: 14px; padding: 24px 0; }
  .set-label p { max-width: 60ch; }
  .settings { max-width: none; }
  .page-head { align-items: flex-start; }
}
@media (max-width: 760px) {
  .boards { grid-template-columns: 1fr; }
  .boards > .board:last-child:nth-child(odd) { grid-column: auto; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
  .head-meta { width: 100%; justify-content: space-between; padding-bottom: 0; }
  .page-head h1 { font-size: 22px; }
  .board-actions .btn { height: 42px; }
  .board-actions .btn-primary { flex: 1 1 100%; }
  .btn-sm { height: 34px; }

  .dept-head { flex-direction: column; padding: 16px; }
  .row-actions { width: 100%; }
  .win-head { display: none; }
  .win-row { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 16px; gap: 7px 12px; min-height: 0; }
  .win-name { grid-column: 1; }
  .win-row > .status { grid-column: 2; grid-row: 1; justify-self: end; }
  .win-actions { grid-column: 1 / -1; justify-content: flex-start; margin-top: 2px; }
  .dept-foot { padding: 10px 16px; }

  .rec-head { display: none; }
  .records { background: transparent; border: 0; border-radius: 0; overflow: visible; display: grid; gap: 10px; }
  .rec-row {
    grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; min-height: 0;
    padding: 12px 14px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
  }
  .rec-row:last-child { border-bottom: 1px solid var(--border); }
  .rec-time { grid-column: 1; grid-row: 1; }
  .rec-num { grid-column: 2; grid-row: 1; justify-self: end; font-size: 15px; }
  .rec-win { grid-column: 1; grid-row: 2; }
  .rec-dept { grid-column: 2; grid-row: 2; justify-self: end; text-align: right; }
  .rec-action { grid-column: 1; grid-row: 3; }
  .rec-status { grid-column: 2; grid-row: 3; justify-self: end; }

  .stats { grid-template-columns: 1fr 1fr; padding: 6px 0; }
  .stats > div { padding: 12px 16px; border-left: 0; }
  .stats > div:nth-child(even) { border-left: 1px solid var(--rule); }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .stats strong { font-size: 22px; }
}
@media (max-width: 560px) {
  .canvas { padding: 16px 16px 36px; }
  .page-head h1 { font-size: 21px; }
  .board { padding: 16px; min-height: 0; }
  .ticket { font-size: 38px; }
  .board-actions .btn-quiet, .board-actions .btn-outline { flex: 1; }
  .field-grid { grid-template-columns: 1fr; }
  .set-panel { padding: 15px; }
  .login-card { padding: 24px 20px; }
  .dept-row { align-items: flex-start; }
  .dept-row .btn { height: 36px; }
  .notice { align-items: flex-start; flex-direction: column; gap: 6px; }
  .selection-names { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
.static-value { font-size: 14px; padding-top: 2px; }
.empty-actions { margin-top: 20px; }
.win-head .align-right { text-align: right; }
.dialog-actions.is-start { justify-content: flex-start; margin-top: 14px; }
.panel-link { font-size: 12px; color: var(--muted); }
.panel-link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.recent-list { padding: 2px 0 4px; }
.recent-row {
  display: grid; grid-template-columns: 38px 52px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  min-height: 38px; padding: 0 18px; border-top: 1px solid var(--rule);
}
.recent-row:first-child { border-top: 0; }
.recent-time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.recent-num { font-size: 13px; font-weight: 500; }
.recent-win { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-status { font-size: 12px; white-space: nowrap; }
.recent-status.ok { color: var(--positive); }
.recent-status.fail { color: var(--warning); }
.recent-status.pending { color: var(--muted); }
.recent-panel .recent-recall { height: 26px; padding: 0 7px; font-size: 12px; justify-self: end; color: var(--accent); }
@media (min-width: 761px) {
  .board.is-wide {
    display: grid; grid-template-columns: minmax(0, 1fr) 200px;
    grid-template-rows: auto auto auto; column-gap: 24px; row-gap: 13px;
  }
  .board.is-wide .board-head { grid-column: 1 / -1; }
  .board.is-wide .board-now { grid-column: 1; }
  .board.is-wide .board-meta { grid-column: 1; }
  .board.is-wide .board-actions {
    grid-column: 2; grid-row: 2 / span 2; flex-direction: column;
    align-items: stretch; margin-top: 0; padding-top: 2px;
  }
  .board.is-wide .board-actions .btn { width: 100%; flex: none; }
}
@media (max-width: 760px) {
  .win-actions .btn-sm, .row-actions .btn-sm { height: 40px; }
  .tab { min-height: 40px; padding-top: 4px; display: inline-flex; align-items: center; }
}
.var-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.var-chip {
  height: 26px; padding: 0 9px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--raised); color: var(--muted); font-size: 12px; line-height: 1;
}
.var-chip:hover { background: var(--active); color: var(--text); }
.board-name { margin-top: 4px; font-size: 17px; font-weight: 500; color: var(--text); }
.brand-mark img { display: block; border-radius: 6px; }
.call-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; gap: var(--gap); align-items: start; }
.tree-panel { min-width: 0; }
.tree { padding: 0 0 10px; }
.tree-row {
  display: flex; align-items: center; gap: 4px; width: 100%; min-height: 34px;
  padding: 0 18px 0 calc(8px + var(--depth, 0) * 14px);
  border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  font-size: 14px; text-align: left; line-height: 1.3;
}
.tree-row:hover { background: #f1f4f7; color: var(--text); }
.tree-row.active { background: var(--active); color: var(--text); font-weight: 500; }
.tree-row.all { margin-bottom: 2px; }
.tree-toggle {
  width: 20px; height: 26px; flex: none; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--faint); padding: 0; border-radius: 3px;
}
.tree-toggle:hover { background: rgba(17, 24, 32, 0.06); color: var(--text); }
.tree-toggle svg { transition: transform 0.12s ease; }
.tree-toggle.open svg { transform: rotate(90deg); }
.tree-toggle.empty { pointer-events: none; }
.tree-name {
  flex: 1; min-width: 0; border: 0; background: transparent; padding: 0;
  color: inherit; font-size: 14px; text-align: left; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.tree-count { flex: none; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.tree-children { display: block; }

.people-panel { min-width: 0; }
.people-toolbar { padding: 16px 18px 12px; border-bottom: 1px solid var(--rule); }
.people-heading { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.people-heading h2 { font-size: 16px; font-weight: 600; }
.people-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px;
  flex: 1; min-width: 180px; max-width: 360px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--faint);
}
.search-box:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; height: 100%; }
.toggle-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.toggle-inline input { accent-color: var(--text); }
.select-all { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.select-all input { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.people-groups { padding-bottom: 6px; }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 18px 7px; }
.group-head h3 { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-head span { flex: none; font-size: 11px; color: var(--muted); }
.dept-call { margin-left: 2px; }
.person-row {
  display: flex; align-items: center; gap: 12px; min-height: 60px;
  padding: 9px 18px; border-top: 1px solid var(--rule);
  cursor: pointer;
}
.person-row:first-child { border-top: 0; }
.person-row:hover { background: var(--raised); }
.person-row.is-latest { background: #f5f8fd; }
.person-row.is-selected, .person-row.is-selected:hover { background: var(--accent-soft); }
.person-check { flex: none; display: flex; align-items: center; justify-content: center; width: 16px; height: 32px; cursor: pointer; }
.person-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.person-avatar {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: #e8edf3; color: #394450; font-size: 13px; font-weight: 600;
}
.person-row.is-latest .person-avatar { background: var(--accent-soft); color: var(--accent); }
.person-identity { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.person-identity strong { font-size: 14px; font-weight: 500; }
.person-identity span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-latest { font-size: 11px; white-space: nowrap; color: var(--muted); flex: none; }
.person-latest.spoken { color: var(--positive); }
.person-latest.failed { color: var(--warning); }
.person-call { flex: none; width: 70px; height: 32px; padding: 0; font-size: 13px; }
/* Call buttons answer the pointer plainly: colour, lift and a speaker that
   steps forward, so hovering the row and reaching the button read differently. */
.person-call, .dept-call, .tag-call, .selection-call { box-shadow: 0 1px 2px rgba(17, 24, 32, 0.16); }
.person-call svg, .dept-call svg, .tag-call svg, .selection-call svg { transition: transform 0.16s ease; }
.person-call:hover:not(:disabled), .dept-call:hover:not(:disabled),
.tag-call:hover:not(:disabled), .selection-call:hover:not(:disabled) {
  background: var(--accent);
  box-shadow: 0 6px 16px rgba(29, 95, 191, 0.34);
  transform: translateY(-1px);
}
.person-call:hover:not(:disabled) svg, .dept-call:hover:not(:disabled) svg,
.tag-call:hover:not(:disabled) svg, .selection-call:hover:not(:disabled) svg { transform: scale(1.18); }
.person-call:active:not(:disabled), .dept-call:active:not(:disabled),
.tag-call:active:not(:disabled), .selection-call:active:not(:disabled) {
  background: #164a96;
  box-shadow: 0 2px 6px rgba(29, 95, 191, 0.3);
  transform: translateY(0);
}
.selection-bar {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
}
.selection-count { flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; }
.selection-count strong { color: var(--accent); font-weight: 600; }
.selection-names { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.selection-bar .btn { flex: none; }
.selection-call { height: 32px; padding: 0 12px; margin-left: auto; }
.panel-empty { padding: 26px 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.panel-empty p { font-size: 13px; color: var(--muted); }

.call-side { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.side-panel { min-width: 0; }
.client-line { display: flex; align-items: center; gap: 8px; padding: 4px 18px 6px; font-size: 14px; }
.client-line i { width: 7px; height: 7px; border-radius: 50%; background: #9aa4b1; display: inline-block; }
.client-line.ok { color: var(--positive); }
.client-line.ok i { background: var(--positive); }
.client-line.warn { color: var(--warning); }
.client-line.warn i { background: #b7791f; }
.recent-panel .recent-row { grid-template-columns: 42px minmax(0, 1fr) auto; min-height: 42px; gap: 8px; }
.recent-person { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-dept { display: none; }
.recent-status { justify-self: end; }
.recent-status .pill { height: 19px; padding: 0 7px; }
.org-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.dept-detail { min-width: 0; }
.dept-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 18px 20px 14px; }
.dept-detail .dept-title h2 { font-size: 18px; font-weight: 600; }
.dept-detail .dept-title { margin-bottom: 4px; }
.dept-detail-sub { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 11px 20px 7px; border-top: 1px solid var(--rule); }
.dept-detail-sub h3 { font-size: 13px; font-weight: 600; }
.dept-detail-sub span { font-size: 11px; color: var(--muted); }
.manage-people { padding-bottom: 4px; }
.manage-person-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 20px; border-top: 1px solid var(--rule); }
.manage-person-row:first-child { border-top: 0; }
.manage-person-row:hover { background: var(--raised); }
.manage-actions { display: flex; gap: 2px; flex: none; }
.dept-detail-foot { padding: 11px 20px; border-top: 1px solid var(--rule); }

.records .rec-head, .records .rec-row {
  grid-template-columns: 132px minmax(80px, 120px) minmax(80px, 140px) minmax(0, 1fr) 92px;
}
.rec-person { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-speech { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-actions { gap: 8px; }

@media (max-width: 1320px) {
  .call-layout { grid-template-columns: 300px minmax(0, 1fr); }
  .call-side { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
}
@media (max-width: 900px) {
  .call-layout { grid-template-columns: 1fr; }
  .call-side { grid-column: auto; grid-template-columns: 1fr; }
  .org-layout { grid-template-columns: 1fr; }
  .tree { max-height: 320px; overflow: auto; }
}
@media (max-width: 760px) {
  .people-toolbar { padding: 14px 16px 10px; }
  .people-tools { gap: 10px; }
  .search-box { max-width: none; flex-basis: 100%; }
  .toggle-inline { font-size: 12px; }
  .person-row { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .person-latest { display: none; }
  .person-call { height: 38px; }
  .selection-bar { top: 56px; padding: 10px 16px; gap: 8px; }
  .selection-call { height: 38px; }
  .recent-panel .recent-recall { height: 30px; padding: 0 9px; }
  .group-head { padding: 11px 16px 6px; }
  .tree-row { min-height: 40px; }
  .dept-detail-head { flex-direction: column; padding: 16px; }
  .dept-detail-sub { padding: 10px 16px 6px; }
  .manage-person-row { padding: 9px 16px; }
  .dept-detail-foot { padding: 10px 16px; }
  .records .rec-head { display: none; }
  .records .rec-row {
    grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px;
    padding: 12px 14px; min-height: 0;
  }
  .records .rec-time { grid-column: 1; grid-row: 1; }
  .records .rec-person { grid-column: 2; grid-row: 1; justify-self: end; font-size: 15px; }
  .records .rec-dept { grid-column: 1; grid-row: 2; }
  .records .rec-speech { grid-column: 1 / -1; grid-row: 3; white-space: normal; line-height: 1.5; }
  .records .rec-status { grid-column: 2; grid-row: 2; justify-self: end; }
  .set-panel form { max-width: none; }
  .head-meta { flex-wrap: wrap; row-gap: 6px; }
}
.tag-call-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 12px 18px 6px; border-top: 1px solid var(--rule);
}
.tag-call-head h3 { font-size: 13px; font-weight: 600; }
.tag-call-head span { font-size: 11px; color: var(--muted); }
.tag-call-list { max-height: 380px; overflow: auto; }
.tag-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; border-top: 1px solid var(--rule);
}
.tag-row:first-child { border-top: 0; }
.tag-row:hover { background: var(--raised); }
.tag-info { flex: 1; min-width: 0; }
.tag-line { display: flex; align-items: baseline; gap: 7px; }
.tag-line strong { font-size: 13px; font-weight: 500; }
.tag-line span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.tag-people { margin-top: 1px; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-call { flex: none; width: 70px; height: 32px; padding: 0; font-size: 13px; }
.tag-empty { padding: 10px 18px 16px; font-size: 12px; color: var(--muted); }
.title-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-pick {
  height: 26px; padding: 0 9px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--raised); color: var(--muted); font-size: 12px; line-height: 1;
}
.tag-pick:hover { background: var(--active); color: var(--text); }

/* Keep the group-call panel reachable before the long people list on narrower screens. */
@media (max-width: 1320px) and (min-width: 901px) {
  .tree-panel { grid-column: 1; grid-row: 1 / span 2; }
  .call-side { grid-column: 2; grid-row: 1; }
  .people-panel { grid-column: 2; grid-row: 2; }
}
@media (max-width: 900px) {
  .tree-panel { grid-column: auto; grid-row: 1; }
  .call-side { grid-column: auto; grid-row: 2; grid-template-columns: 1fr; }
  .people-panel { grid-column: auto; grid-row: 3; }
}


@media (max-width: 760px) {
  .tag-call { height: 38px; }
}

@media (max-width: 760px) {
  .tag-row { padding-left: 16px; padding-right: 16px; }
}

.field textarea {
  width: 100%; min-height: 168px; padding: 10px 12px;
  background: #fff; border: 1px solid #dfe5ec; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.6; resize: vertical;
}
.field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field input[type="file"] { width: 100%; padding: 7px 0; font-size: 13px; color: var(--muted); }
.check-inline { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.check-inline input { accent-color: var(--text); }
