/* Layout: a service-desk tool. Header with tabs; one working column for
   self-help, a wide table for the queue, a readable column for "How it works". */
:root {
  --bg: #f4f6f5;
  --panel: #ffffff;
  --ink: #142019;
  --ink-2: #44524a;
  --ink-3: #6f7d75;
  --rule: #dfe5e1;
  --soft: #eef2ef;
  --accent: #0f6e5c;
  --accent-ink: #ffffff;
  --accent-soft: #dcefe9;
  --p1: #c0392b; --p1-bg: #fbe5e2;
  --p2: #b5560f; --p2-bg: #fcebdc;
  --p3: #8a6d00; --p3-bg: #f8f0d2;
  --p4: #4b5a63; --p4-bg: #e8edf0;
  --ok: #1d7a35; --ok-bg: #e1f3e5;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101513; --panel: #18201c; --ink: #e8efeb; --ink-2: #b2bfb8; --ink-3: #87958d;
    --rule: #2a352f; --soft: #1f2924; --accent: #3fb59b; --accent-ink: #0b1411; --accent-soft: #173b32;
    --p1: #f07a6c; --p1-bg: #3d1d19; --p2: #f0a060; --p2-bg: #3a2614; --p3: #e3c45a; --p3-bg: #352d10;
    --p4: #a8b6bf; --p4-bg: #232c31; --ok: #5fcf7d; --ok-bg: #173320;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101513; --panel: #18201c; --ink: #e8efeb; --ink-2: #b2bfb8; --ink-3: #87958d;
  --rule: #2a352f; --soft: #1f2924; --accent: #3fb59b; --accent-ink: #0b1411; --accent-soft: #173b32;
  --p1: #f07a6c; --p1-bg: #3d1d19; --p2: #f0a060; --p2-bg: #3a2614; --p3: #e3c45a; --p3-bg: #352d10;
  --p4: #a8b6bf; --p4-bg: #232c31; --ok: #5fcf7d; --ok-bg: #173320;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font-body); }
a { color: var(--accent); }
h2 { font-size: 20px; margin: 0; line-height: 1.25; text-wrap: balance; }
h3 { font-size: 17px; margin: 28px 0 8px; }
.muted { color: var(--ink-2); margin: 4px 0 0; }
.small { font-size: 13.5px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.topbar {
  background: var(--panel); border-bottom: 1px solid var(--rule);
  padding-inline: 16px; padding-block: 14px 0;
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px;
}
.brand { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; }
.brand-mark { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 20px; }
.brand-name { font-weight: 700; font-size: 18px; }
.brand-sub { font-size: 13px; color: var(--ink-3); }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px 11px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }
.count { font: 500 12px var(--font-data); background: var(--soft); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }

.wrap { max-width: 980px; margin: 0 auto; padding-inline: 16px; padding-block: 28px 40px; }
.view { display: grid; gap: 20px; }

.ask { display: grid; gap: 10px; }
.ask-label { font-weight: 700; font-size: 18px; }
.ask-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ask-row textarea { flex: 1 1 320px; min-width: 0; resize: vertical; border: 1.5px solid var(--rule); background: var(--panel); border-radius: 10px; padding: 12px 14px; font-size: 17px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--panel); border: 1px solid var(--rule); border-radius: 999px; padding: 5px 12px; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.chip:hover { border-color: var(--accent); color: var(--ink); }

.btn { border: 1.5px solid var(--rule); background: var(--panel); border-radius: 9px; padding: 10px 16px; cursor: pointer; font-weight: 700; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }

.result { display: grid; gap: 14px; }
.triage { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; background: var(--soft); border-radius: 10px; padding: 12px 14px; font-size: 14.5px; }
.triage b { font-weight: 700; }
.triage .why { color: var(--ink-2); }
.fix { background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; padding: 20px; display: grid; gap: 14px; }
.fix-head { display: grid; gap: 4px; }
.kb-id { font: 500 12.5px var(--font-data); color: var(--ink-3); letter-spacing: .04em; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; max-width: 70ch; }
.escalate { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--p3-bg); color: var(--ink); font-size: 14.5px; }
.escalate::before { content: "Log a ticket if: "; font-weight: 700; }
.others { font-size: 14px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.others button { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; }
.decision { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border-top: 1px solid var(--rule); padding-top: 14px; }
.decision span { font-weight: 700; margin-right: auto; }
.none { background: var(--panel); border: 1px dashed var(--rule); border-radius: 12px; padding: 18px; }

.pill { display: inline-flex; align-items: center; gap: 5px; font: 500 12.5px/1.5 var(--font-data); padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill.P1 { background: var(--p1-bg); color: var(--p1); }
.pill.P2 { background: var(--p2-bg); color: var(--p2); }
.pill.P3 { background: var(--p3-bg); color: var(--p3); }
.pill.P4 { background: var(--p4-bg); color: var(--p4); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--p2-bg); color: var(--p2); }
.pill.late { background: var(--p1-bg); color: var(--p1); }
.pill.ok::before { content: "✓"; font-family: var(--font-body); }
.pill.warn::before { content: "!"; font-family: var(--font-body); font-weight: 700; }
.pill.late::before { content: "✕"; font-family: var(--font-body); }
.conf { font: 500 12.5px var(--font-data); color: var(--ink-2); }
.flag { color: var(--p2); font-weight: 700; }

.ticket-form { background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; padding: 20px; display: grid; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.form-grid label { display: grid; gap: 4px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.form-grid .full { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea { border: 1.5px solid var(--rule); background: var(--bg); border-radius: 8px; padding: 9px 10px; font-weight: 400; color: var(--ink); min-width: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.toast { background: var(--ok-bg); color: var(--ok); border-radius: 10px; padding: 12px 14px; font-weight: 700; }

.queue-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; }
.queue-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-2); }
.inline select { border: 1.5px solid var(--rule); background: var(--panel); border-radius: 8px; padding: 8px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; }
.kpi .v { font: 500 26px/1.1 var(--font-data); font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 13.5px; color: var(--ink-2); }

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--font-data); font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--font-data); font-size: 13px; white-space: nowrap; }
td .desc { max-width: 42ch; }
td .meta { font-size: 12.5px; color: var(--ink-3); }
.sample { font: 500 11px var(--font-data); color: var(--ink-3); border: 1px solid var(--rule); border-radius: 4px; padding: 0 5px; margin-left: 6px; }
.row-actions select { border: 1px solid var(--rule); background: var(--panel); border-radius: 6px; padding: 4px 6px; font-size: 13.5px; }
.bar { height: 6px; background: var(--soft); border-radius: 3px; min-width: 80px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

.how { max-width: 760px; }
.how .lede { color: var(--ink-2); margin: 6px 0 16px; }
.pipeline { padding-left: 22px; display: grid; gap: 10px; margin: 0; }
.matrix td, .matrix th { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }

.foot { max-width: 980px; margin: 0 auto; padding-inline: 16px; padding-block: 0 32px; font-size: 13px; color: var(--ink-3); }

@media (prefers-reduced-motion: no-preference) {
  .result:not([hidden]), .ticket-form:not([hidden]) { animation: rise .18s ease-out; }
  @keyframes rise { from { transform: translateY(4px); opacity: .6; } to { transform: none; opacity: 1; } }
}
@media (max-width: 560px) {
  .topbar { align-items: stretch; }
  .decision span { flex-basis: 100%; }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#queueTable { min-width: 760px; }
td .desc { min-width: 24ch; }
