/* MDT LSPD | Give Me 5. Dark police terminal theme. */
:root {
  --bg: #070d19;
  --bg-2: #0b1324;
  --panel: #0f1a2e;
  --panel-2: #14213a;
  --line: #1f2f4d;
  --line-2: #2a3d60;
  --text: #e6ecf7;
  --muted: #8c9bb8;
  --dim: #5f6f8f;
  --gold: #d4a933;
  --gold-2: #f0c75a;
  --blue: #3b82f6;
  --blue-soft: rgba(59, 130, 246, .14);
  --green: #22c55e;
  --amber: #f59e0b;
  --orange: #f97316;
  --red: #ef4444;
  --purple: #a855f7;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12.5px; }
.pad { padding: 14px 16px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.ico { width: 18px; height: 18px; flex: none; }
.boot, .loading { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 60px 20px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font: inherit; font-weight: 550; cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: #1b2b4a; border-color: #36507d; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--gold); border-color: var(--gold); color: #1a1405; }
.btn-primary:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn-danger { background: rgba(239, 68, 68, .15); border-color: rgba(239, 68, 68, .5); color: #fca5a5; }
.btn-danger:hover { background: rgba(239, 68, 68, .28); border-color: var(--red); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-discord { background: #5865f2; border-color: #5865f2; color: #fff; padding: 11px 16px; }
.btn-discord:hover { background: #6d78f5; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); background: transparent;
  border: 1px solid transparent; color: var(--muted); cursor: pointer; font-size: 20px; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------ badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid; white-space: nowrap; letter-spacing: .01em; }
.badge-gray { color: #b4c0d6; border-color: #34466a; background: rgba(140, 155, 184, .1); }
.badge-blue { color: #93c5fd; border-color: rgba(59, 130, 246, .45); background: var(--blue-soft); }
.badge-green { color: #86efac; border-color: rgba(34, 197, 94, .45); background: rgba(34, 197, 94, .12); }
.badge-amber { color: #fcd34d; border-color: rgba(245, 158, 11, .45); background: rgba(245, 158, 11, .12); }
.badge-orange { color: #fdba74; border-color: rgba(249, 115, 22, .45); background: rgba(249, 115, 22, .12); }
.badge-red { color: #fca5a5; border-color: rgba(239, 68, 68, .5); background: rgba(239, 68, 68, .14); }
.badge-purple { color: #d8b4fe; border-color: rgba(168, 85, 247, .45); background: rgba(168, 85, 247, .12); }
.badge-gold { color: var(--gold-2); border-color: rgba(212, 169, 51, .5); background: rgba(212, 169, 51, .12); }

/* ------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 50% -10%, #142850 0%, transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px;
  box-shadow: var(--shadow); text-align: center; }
.login-badge { width: 76px; height: 76px; margin-bottom: 12px; filter: drop-shadow(0 6px 18px rgba(212, 169, 51, .3)); }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .btn-discord { margin-top: 18px; }
.login-sep { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.login-sep::before, .login-sep::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.demo-agents { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; max-height: 340px; overflow: auto; padding: 2px; }
.demo-agent { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font: inherit; cursor: pointer; text-align: left; min-width: 0; }
.demo-agent:hover { border-color: var(--gold); }
.demo-agent span { display: flex; flex-direction: column; min-width: 0; }
.demo-agent strong, .demo-agent small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-agent small { color: var(--muted); font-size: 11.5px; }
.alert { padding: 10px 12px; border-radius: var(--radius-sm); margin-top: 14px; font-size: 13px; text-align: left; }
.alert-error { background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .4); color: #fecaca; }
.alert-info { background: var(--blue-soft); border: 1px solid rgba(59, 130, 246, .4); color: #bfdbfe; }
.alert-warn { background: rgba(245, 158, 11, .1); border: 1px solid rgba(245, 158, 11, .4); color: #fde68a; }

/* ------------------------------------------------------------ shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex: none; background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.brand img { width: 38px; height: 38px; }
.brand strong { display: block; font-size: 16px; letter-spacing: .06em; color: var(--gold-2); }
.brand small { color: var(--muted); font-size: 12px; }
.nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }
.nav-group { margin-top: 10px; }
.nav-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); padding: 6px 8px; font-weight: 700; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; }
.nav-link:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav-link.active { background: rgba(212, 169, 51, .12); color: var(--gold-2); box-shadow: inset 2px 0 0 var(--gold); }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--line); }
.source-pill { font-size: 11.5px; color: var(--muted); border: 1px dashed var(--line-2); padding: 3px 8px; border-radius: 999px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: rgba(7, 13, 25, .92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.search-trigger { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel); color: var(--dim); font: inherit; cursor: pointer; text-align: left; min-width: 0; }
.search-trigger span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-trigger:hover { border-color: var(--line-2); }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 4px; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.alert-pill { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; letter-spacing: .04em; text-transform: uppercase; border: 1px solid; }
.alert-green { color: #86efac; border-color: rgba(34, 197, 94, .5); background: rgba(34, 197, 94, .1); }
.alert-amber { color: #fde047; border-color: rgba(234, 179, 8, .5); background: rgba(234, 179, 8, .1); }
.alert-orange { color: #fdba74; border-color: rgba(249, 115, 22, .55); background: rgba(249, 115, 22, .12); }
.alert-red { color: #fecaca; border-color: var(--red); background: rgba(239, 68, 68, .2); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, .15); } }
.duty-btn { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font: inherit; font-size: 12px;
  font-weight: 700; letter-spacing: .05em; cursor: pointer; border: 1px solid; }
.duty-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.duty-btn.on { color: #86efac; border-color: rgba(34, 197, 94, .55); background: rgba(34, 197, 94, .1); }
.duty-btn.off { color: #fca5a5; border-color: rgba(239, 68, 68, .45); background: rgba(239, 68, 68, .08); }
.profile { position: relative; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px; border-radius: var(--radius-sm); }
.profile:hover { background: var(--panel); }
.profile-txt { display: flex; flex-direction: column; line-height: 1.25; }
.profile-txt strong { font-size: 13px; }
.profile-txt small { color: var(--muted); font-size: 11.5px; }
.profile-menu { position: absolute; right: 0; top: calc(100% + 6px); width: 250px; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 30; }
.profile-menu a, .profile-menu button { display: flex; gap: 8px; align-items: center; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.profile-menu a:hover, .profile-menu button:hover { background: var(--panel-2); text-decoration: none; }
.profile-mail { font-family: var(--mono); font-size: 11.5px; color: var(--muted); padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; word-break: break-all; }
.mobile-only { display: none; }
.page { padding: 22px 24px 48px; }
.page-inner { max-width: 1400px; margin: 0 auto; }

.avatar { display: inline-grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, #1d3a6e, #12264a); color: var(--gold-2);
  font-weight: 700; flex: none; object-fit: cover; border: 1px solid var(--line-2); }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 44px; height: 44px; font-size: 15px; }
.avatar-lg { width: 112px; height: 112px; font-size: 34px; border-radius: 14px; }

/* ------------------------------------------------------------ page parts */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-value.red { color: #fca5a5; } .stat-value.amber { color: #fcd34d; } .stat-value.green { color: #86efac; } .stat-value.gold { color: var(--gold-2); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-body { padding: 14px 16px; }
.card-body.flush { padding: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2 > .card + .card, .grid-3 > .card + .card, .grid-main > .card + .card, .stack > .card + .card { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { max-width: 340px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); font: inherit;
  font-size: 12.5px; font-weight: 550; cursor: pointer; }
.chip:hover { color: var(--text); }
.chip.active { background: rgba(212, 169, 51, .14); border-color: var(--gold); color: var(--gold-2); }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); font-weight: 700;
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover td { background: rgba(255, 255, 255, .025); }
.tbl .sub { display: block; color: var(--muted); font-size: 12px; }

.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.list-item { color: inherit; }
a.list-item:hover { background: rgba(255, 255, 255, .025); text-decoration: none; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; font-weight: 550; min-width: 0; overflow-wrap: anywhere; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty-icon { font-size: 26px; opacity: .6; margin-bottom: 6px; }
.empty h2 { color: var(--text); margin-bottom: 6px; }
.error-state { text-align: center; padding: 30px 16px; color: #fca5a5; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------ forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.input, select.input, textarea.input { width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--bg-2);
  color: var(--text); font: inherit; outline: none; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 169, 51, .15); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.5; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--gold); }
fieldset.section { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; min-width: 0; }
fieldset.section legend { padding: 0 6px; font-weight: 650; color: var(--gold-2); font-size: 13px; }

.picker { position: relative; }
.picker-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 260px; overflow: auto; }
.picker-item { display: flex; flex-direction: column; width: 100%; padding: 8px 10px; background: none; border: 0; border-bottom: 1px solid var(--line);
  color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.picker-item:hover { background: var(--panel-2); }
.picker-item small { color: var(--muted); }
.picker-empty { padding: 10px; color: var(--muted); }

/* ------------------------------------------------------------ modal */
dialog.modal { border: 1px solid var(--line-2); border-radius: 14px; padding: 0; background: var(--panel); color: var(--text); width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 40px); box-shadow: var(--shadow); }
dialog.modal-wide { width: min(860px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(2, 6, 14, .7); backdrop-filter: blur(2px); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 42px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-error { margin: 0 18px 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .4); color: #fecaca; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.search-modal { width: min(640px, calc(100vw - 32px)); margin-top: 10vh; }
.search-box { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.search-box input { flex: 1; background: none; border: 0; outline: none; color: var(--text); font: inherit; font-size: 16px; }
.search-results { max-height: 60vh; overflow-y: auto; padding-bottom: 6px; }
.search-sec-title { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); padding: 10px 16px 4px; font-weight: 700; }
.search-item { display: flex; gap: 12px; padding: 8px 16px; color: var(--text); }
.search-item span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item:hover { background: var(--panel-2); text-decoration: none; }

/* ------------------------------------------------------------ toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  animation: slidein .2s ease-out; transition: opacity .3s, transform .3s; }
.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-info { border-left: 3px solid var(--blue); }
.toast.out { opacity: 0; transform: translateX(20px); }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------ domain */
.flag-row { display: flex; gap: 8px; flex-wrap: wrap; }
.flag { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: transparent; color: var(--muted); font: inherit; font-weight: 650; cursor: pointer; }
.flag[aria-pressed="true"].flag-red { color: #fecaca; border-color: var(--red); background: rgba(239, 68, 68, .16); }
.flag[aria-pressed="true"].flag-amber { color: #fde68a; border-color: var(--amber); background: rgba(245, 158, 11, .14); }
.flag[aria-pressed="true"].flag-blue { color: #bfdbfe; border-color: var(--blue); background: var(--blue-soft); }
.flag:disabled { cursor: default; }
.counter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.counter { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.counter b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.counter span { font-size: 11.5px; color: var(--muted); }
.profile-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.profile-head .grow { flex: 1; min-width: 240px; }
.plate { display: inline-block; font-family: var(--mono); font-weight: 700; letter-spacing: .08em; padding: 2px 8px; border-radius: 4px; background: #e8edf5;
  color: #10213f; border: 2px solid #9fb0cc; font-size: 12.5px; }
.prose { line-height: 1.65; overflow-wrap: anywhere; }
.prose p { margin: 0 0 10px; }
.prose ul { margin: 0 0 10px; padding-left: 20px; }
.prose blockquote { margin: 0 0 10px; padding: 6px 12px; border-left: 3px solid var(--gold); background: rgba(212, 169, 51, .06); color: var(--muted); }
.prose h3, .prose h4, .prose h5 { margin: 14px 0 6px; color: var(--gold-2); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* calls */
.call-row { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; border-left: 3px solid transparent; }
.call-row:hover { background: rgba(255, 255, 255, .02); }
.call-row.selected { background: rgba(212, 169, 51, .07); border-left-color: var(--gold); }
.call-row.prio-critical { border-left-color: var(--red); }
.call-row.prio-high:not(.selected) { border-left-color: var(--amber); }
.call-row .grow { flex: 1; min-width: 0; }
.call-code { font-family: var(--mono); font-weight: 700; color: var(--gold-2); font-size: 12.5px; }
.call-meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* dispatch */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.sector { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); min-height: 130px; display: flex; flex-direction: column; }
.sector.drop { border-color: var(--gold); background: rgba(212, 169, 51, .05); }
.sector-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 650; font-size: 13px; }
.sector-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.unit { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 8px 10px; cursor: grab; }
.unit.mine { border-color: var(--gold); }
.unit[draggable="false"] { cursor: default; }
.unit-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.unit-callsign { font-family: var(--mono); font-weight: 700; letter-spacing: .04em; }
.unit-members { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.unit-member { font-size: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.unit-calls { font-size: 12px; color: #fcd34d; }
.unit-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.unit-actions select { padding: 3px 6px; font-size: 12px; width: auto; }
.free-agents { display: flex; flex-wrap: wrap; gap: 6px; }
.free-agent { display: inline-flex; gap: 6px; align-items: center; padding: 4px 8px; border: 1px dashed var(--line-2); border-radius: 999px; font-size: 12.5px; }

/* radio */
.radio-log { height: 260px; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.radio-msg { line-height: 1.4; }
.radio-msg .who { color: var(--gold-2); font-weight: 650; }
.radio-msg .when { color: var(--dim); font-size: 11.5px; margin-right: 6px; font-family: var(--mono); }
.radio-form { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }

/* reports */
.charge-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.charge-row:last-child { border-bottom: 0; }
.suspect-block { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--bg-2); }
.suspect-block + .suspect-block { margin-top: 10px; }
.sentence { display: flex; gap: 14px; flex-wrap: wrap; font-weight: 650; }
.sentence .money { color: #86efac; }
.sentence .jail { color: #fca5a5; }
.link-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.link-row .grow { flex: 1; min-width: 0; }

/* hours */
.hours-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; min-width: 40px; }
.hours-bar span { display: block; height: 100%; background: var(--gold); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .grid-main, .grid-3 { grid-template-columns: 1fr; }
  .profile-txt { display: none; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 50; left: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .mobile-only { display: inline-grid; }
  .grid-2 { grid-template-columns: 1fr; }
  .search-trigger kbd { display: none; }
}
@media (max-width: 600px) {
  .page { padding: 16px 16px 40px; }
  .topbar { padding: 8px 16px; gap: 8px; }
  .search-trigger span { display: none; }
  .search-trigger { flex: none; }
  .alert-pill { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .demo-agents { grid-template-columns: 1fr; }
  .counter-grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 22px; }
  h1 { font-size: 19px; }
  .tbl .hide-sm { display: none; }
}

/* ------------------------------------------------------------ page parts used by the pages */
.timeline { list-style: none; margin: 0; padding: 4px 0 0 6px; }
.tl-item { position: relative; display: flex; gap: 12px; padding: 0 0 18px 18px; border-left: 2px solid var(--line-2); margin-left: 5px; }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-item .grow { flex: 1; min-width: 0; }
.tl-dot { position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); border: 2px solid var(--panel); }
.tl-promotion .tl-dot, .tl-reinstatement .tl-dot, .tl-medal .tl-dot { background: var(--green); }
.tl-demotion .tl-dot, .tl-termination .tl-dot { background: var(--red); }
.tl-assignment .tl-dot, .tl-role .tl-dot { background: var(--purple); }
.tl-status .tl-dot { background: var(--amber); }
.eval { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); }
.eval-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.eval-scores { display: flex; gap: 6px 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin: 8px 0; }
.eval-scores b { color: var(--text); }
.stars { color: var(--gold); letter-spacing: 1px; }
.score-grid { display: grid; gap: 4px; }
.score-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.score-pick { display: flex; gap: 4px; }
.score-pick label { cursor: pointer; position: relative; }
.score-pick input { position: absolute; opacity: 0; pointer-events: none; }
.score-pick span { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); color: var(--muted); }
.score-pick input:checked + span { background: rgba(212, 169, 51, .18); border-color: var(--gold); color: var(--gold-2); font-weight: 700; }
.elig-box { margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); }
.elig-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 8px; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 10px; }
.progress span { display: block; height: 100%; background: var(--green); }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: flex; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
.check-list .tick { width: 18px; text-align: center; font-weight: 700; }
.check-list .ok .tick { color: var(--green); }
.check-list .ko .tick { color: var(--red); }
.check-list .grow { flex: 1; min-width: 0; }
.todo { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 14px 16px; }
.todo-item { display: flex; flex-direction: column; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text); background: var(--bg-2); }
.todo-item b { font-size: 22px; font-variant-numeric: tabular-nums; }
.todo-item.hot { border-color: rgba(212, 169, 51, .6); }
.todo-item:hover { text-decoration: none; border-color: var(--gold); }
.ann { border-bottom: 1px solid var(--line); }
.ann:last-child { border-bottom: 0; }
.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.org-unit + .org-unit { margin-top: 12px; }
.org-unit-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.org-list { display: flex; flex-direction: column; gap: 4px; }
.org-agent { display: flex; gap: 8px; align-items: center; padding: 4px 8px; border-radius: var(--radius-sm); color: var(--text); }
.org-agent:hover { background: var(--panel-2); text-decoration: none; }
.org-agent .grow { flex: 1; min-width: 0; }
.org-agent small { display: block; color: var(--muted); font-size: 12px; }
.group-check { align-items: flex-start; }
.rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.bar-label { width: 150px; color: var(--muted); font-size: 12.5px; flex: none; }
.bar-row .hours-bar { flex: 1; }
.bar-val { min-width: 60px; text-align: right; font-variant-numeric: tabular-nums; }
.hp { position: absolute; left: -9999px; }
.agent-actions { justify-content: flex-end; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }

/* ------------------------------------------------------------ v2: logos, divisions, org chart */
.logo { border-radius: 50%; object-fit: cover; background: #0b1324; border: 1px solid var(--line-2); flex: none; }
.logo-sm { width: 28px; height: 28px; }
.logo-md { width: 44px; height: 44px; }
.logo-lg { width: 72px; height: 72px; }
.logo-xl { width: 128px; height: 128px; }
.logo-default { opacity: .85; padding: 3px; }
.brand .logo { width: 38px; height: 38px; }
.division-card { overflow: hidden; }
.division-head { display: flex; gap: 14px; align-items: center; width: 100%; padding: 14px 16px; background: none; border: 0; color: var(--text);
  font: inherit; text-align: left; cursor: pointer; }
.division-head:hover { background: rgba(255, 255, 255, .025); }
.division-head .grow { flex: 1; min-width: 0; }
.division-head .chev { transition: transform .15s; color: var(--muted); }
.division-card.open .division-head .chev { transform: rotate(90deg); }
.division-body { border-top: 1px solid var(--line); padding: 14px 16px 16px; }
.unit-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); }
.unit-card + .unit-card { margin-top: 10px; }
.unit-card .grow { flex: 1; min-width: 0; }
.roles-line { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.roles-line b { color: var(--text); font-weight: 600; }
.org-tree { display: flex; flex-direction: column; align-items: center; }
.org-level { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; padding-top: 28px; }
.org-level::before { content: ''; position: absolute; top: 0; left: 50%; height: 28px; border-left: 2px solid var(--line-2); }
.org-level:first-child { padding-top: 0; }
.org-level:first-child::before { display: none; }
.org-level-title { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); margin-bottom: 8px; font-weight: 700; }
.org-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.org-node { width: 148px; text-align: center; padding: 10px 8px; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--text); }
.org-node:hover { border-color: var(--gold); text-decoration: none; }
.org-node .avatar { width: 64px; height: 64px; margin: 0 auto 6px; font-size: 20px; }
.org-node strong { display: block; font-size: 13px; letter-spacing: .02em; }
.org-node small { display: block; color: var(--gold-2); font-size: 11.5px; }
.org-node em { display: block; color: var(--muted); font-size: 11px; font-style: normal; }
.org-empty { opacity: .5; border-style: dashed; padding: 10px 18px; color: var(--muted); font-size: 12.5px; }
.err-red { color: #fca5a5; font-weight: 600; }
.input-locked { background: rgba(239, 68, 68, .06); border-color: rgba(239, 68, 68, .45); }
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.module { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); }
.module.ok { border-color: rgba(34, 197, 94, .5); background: rgba(34, 197, 94, .08); }
.motive-row { display: grid; grid-template-columns: minmax(0, 2fr) 140px minmax(0, 1.4fr) auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.motive-row:last-child { border-bottom: 0; }
.bar-split { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line); min-width: 80px; }
.bar-split span { display: block; height: 100%; }
.c-resignation { background: var(--blue); } .c-dismissal { background: var(--red); } .c-absence { background: var(--amber); } .c-other { background: var(--dim); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.tl-days { color: var(--muted); font-size: 12px; }
.alert-card { border-color: rgba(239, 68, 68, .5); background: rgba(239, 68, 68, .08); }
.setup-card { max-width: 640px; margin: 0 auto; }
.pdf-links { display: flex; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------------------ print (report PDF) */
@media print {
  body { background: #fff; color: #000; }
  .sidebar, .topbar, .btn, .btn-row select, #toasts { display: none !important; }
  .page { padding: 0; }
  .card { border-color: #bbb; background: #fff; break-inside: avoid; }
  .grid-main { grid-template-columns: 1fr; }
  .muted, .dim, .tbl th { color: #444; }
  a { color: #000; }
  .badge { border-color: #888; color: #000; background: none; }
}
