body.staff { background: var(--paper); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 400px; padding: 32px; }
.login h1 { font-family: var(--serif); font-size: 24px; margin: 14px 0 4px; }

.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--brand-2); color: #cfe3df; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .side { background: #0b1312; } }
.side .brand-s { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; color: #fff; }
.side .brand-s .mk { width: 36px; height: 36px; border-radius: 9px; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; }
.side .brand-s b { font-size: 14px; display: block; line-height: 1.2; }
.side .brand-s span { font-size: 11.5px; opacity: .7; }
.side .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 14px 10px 6px; }
.side a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #cfe3df; text-decoration: none; font-size: 14px; font-weight: 500; }
.side a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side a[aria-current="page"] { background: rgba(255,255,255,.13); color: #fff; }
.side a .badge { margin-left: auto; background: rgba(255,255,255,.16); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.side a .badge.bad { background: #c2402f; color: #fff; }
.side .me { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 14px 10px 4px; font-size: 13px; }
.side .me b { color: #fff; display: block; }
.side .me button { background: none; border: 0; color: #cfe3df; padding: 6px 0; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.side .me button:hover { color: #fff; }
.topbar { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; gap: 10px; background: var(--brand-2); color: #fff; padding: 10px 14px; position: sticky; top: 0; z-index: 30; }
  .topbar button { background: none; border: 0; color: #fff; padding: 6px; cursor: pointer; }
}

.main { padding: 24px 28px 48px; min-width: 0; }
@media (max-width: 640px) { .main { padding: 16px 14px 40px; } }
.ph { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.ph h1 { font-family: var(--serif); font-size: 26px; }
.ph p { margin: 4px 0 0; color: var(--ink-3); font-size: 14px; }
.ph .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Inbox */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 12px; cursor: pointer; font-weight: 500; color: var(--ink-3); white-space: nowrap; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tabs .c { background: var(--surface-2); border-radius: 999px; font-size: 12px; padding: 0 7px; color: var(--ink-2); }
.tabs .c.bad { background: var(--bad-tint); color: var(--bad); }
.tabs .c.warn { background: var(--warn-tint); color: var(--warn); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters .input { width: auto; min-height: 38px; padding: 7px 10px; font-size: 14px; }
.filters .search { flex: 1 1 240px; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--surface-2); }
.tbl .subj { font-weight: 600; color: var(--ink); max-width: 360px; }
.tbl .sub2 { font-size: 12.5px; color: var(--ink-3); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--ink-3); margin-left: 4px; vertical-align: 1px; }
.tag.conf { background: var(--accent-tint); color: var(--accent); }
.tag.reo { background: var(--bad-tint); color: var(--bad); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }

/* Ticket */
.tk { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .tk { grid-template-columns: 1fr; } }
.tk-head .ref { font-size: 13px; color: var(--ink-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tk-head h1 { font-size: 22px; margin: 6px 0 10px; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; } }
.desc { white-space: pre-wrap; background: var(--surface-2); border-radius: 10px; padding: 14px; margin-top: 16px; color: var(--ink-2); overflow-wrap: anywhere; }
.panel { padding: 18px; }
.panel h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 12px; }
.panel + .panel { margin-top: 16px; }
.big-sla { display: flex; align-items: baseline; gap: 8px; }
.big-sla b { font-size: 28px; font-family: var(--serif); }
.act-grid { display: grid; gap: 8px; }
.composer { border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: var(--surface); }
.composer .seg { display: flex; border-bottom: 1px solid var(--line); }
.composer .seg button { flex: 1; background: none; border: 0; padding: 10px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-3); }
.composer .seg button[aria-pressed="true"] { color: var(--brand); box-shadow: inset 0 -2px 0 var(--brand); }
.composer .seg button.int[aria-pressed="true"] { color: var(--ink-2); box-shadow: inset 0 -2px 0 var(--ink-3); }
.composer textarea { border: 0; width: 100%; min-height: 100px; padding: 12px 14px; resize: vertical; background: transparent; }
.composer textarea:focus { outline: none; }
.composer .bar { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.composer.internal { background: var(--surface-2); }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100% - 24px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10, 20, 20, .45); }
dialog .dh { padding: 18px 20px 0; }
dialog .dh h2 { font-size: 18px; }
dialog .db { padding: 16px 20px; }
dialog .df { padding: 0 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }

/* Dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { padding: 16px 18px; text-decoration: none; color: inherit; display: block; }
a.kpi:hover { border-color: var(--line-2); }
.kpi .l { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.kpi .n { font-family: var(--serif); font-size: 32px; font-weight: 700; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12.5px; color: var(--ink-3); }
.kpi.bad .n { color: var(--bad); }
.kpi.warn .n { color: var(--warn); }
.kpi.good .n { color: var(--ok); }
.dgrid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.dgrid > * { min-width: 0; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
@media (max-width: 1100px) { .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; } }
.dcard { padding: 18px; }
.dcard h3 { font-size: 15px; margin-bottom: 4px; }
.dcard .cap { font-size: 12.5px; color: var(--ink-3); margin-bottom: 14px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 40px; gap: 10px; align-items: center; font-size: 13.5px; margin-bottom: 9px; }
.hbar .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hbar .track { height: 10px; background: var(--surface-2); border-radius: 0 4px 4px 0; }
.hbar .fill { height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.hbar.b4 .fill { background: var(--bad); } .hbar.b3 .fill { background: var(--warn); }
.legend-row { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 8px; }
.legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.chart-svg text { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.bar-a { fill: var(--brand); } .bar-b { fill: color-mix(in srgb, var(--accent) 80%, transparent); }
.att-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; font-size: 14px; }
.att-row:last-child { border-bottom: 0; }
.att-row:hover .s1 { color: var(--brand); }
.att-row .s1 { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-row .s2 { font-size: 12.5px; color: var(--ink-3); }
.banner { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.switch input { width: 18px; height: 18px; accent-color: var(--brand); }
iframe.preview { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
