/* De Lune IT Helpdesk — night rail, moonlight accent, status shown as moon phases */
:root {
  --night: #2a3577;
  --night-2: #36438f;
  --night-deep: #222b63;
  --night-ink: #d3d7ea;
  --paper: #f3f4f7;
  --surface: #ffffff;
  --ink: #1d2433;
  --muted: #646c82;
  --line: #dfe2ea;
  --moon: #fccd0d;
  --moon-soft: #fff6d2;
  --focus: #fccd0d;
  --urgent: #b8432f;
  --high: #b9761c;
  --normal: #3f6aa6;
  --low: #7d859a;
  --note: #fff7e3;
  --radius-s: 6px;
  --radius-m: 10px;
  --font: "Barlow", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Barlow Semi Condensed", "Barlow", "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --night: #222b63;
    --night-2: #2f3a80;
    --paper: #12163a;
    --surface: #1b2050;
    --ink: #e7e9f0;
    --muted: #9aa1b5;
    --line: #2e3670;
    --moon-soft: #3a3622;
    --note: #2f2a1b;
    --normal: #8fb0ec;
    --low: #a3abbf;
    --urgent: #ff8f7a;
    --high: #f5b54a;
    color-scheme: dark; }
}
:root[data-theme="dark"] { --night: #222b63;
    --night-2: #2f3a80;
    --paper: #12163a;
    --surface: #1b2050;
    --ink: #e7e9f0;
    --muted: #9aa1b5;
    --line: #2e3670;
    --moon-soft: #3a3622;
    --note: #2f2a1b;
    --normal: #8fb0ec;
    --low: #a3abbf;
    --urgent: #ff8f7a;
    --high: #f5b54a;
    color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 700; letter-spacing: -0.005em; }
h2 { font-size: 1.05rem; font-weight: 600; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.rail {
  background: var(--night);
  color: var(--night-ink);
  padding: 22px 14px;
  display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: block; text-decoration: none; padding: 2px 8px 0; }
.brand img { display: block; width: 100%; max-width: 190px; height: auto; }
.brand small { display: block; color: var(--night-ink); font-size: .82rem; letter-spacing: .02em; margin-top: 8px; padding-left: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: var(--radius-s); text-decoration: none; color: var(--night-ink);
}
.nav a:hover { background: var(--night-2); color: #fff; }
.nav a[aria-current="page"] { background: var(--night-2); color: #fff; box-shadow: inset 3px 0 0 var(--focus); }
.nav .count { font-size: .78rem; color: var(--focus); }
.nav-sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px 4px; }
.nav-head { font-size: .78rem; color: #8790b0; padding: 0 10px 4px; }
.rail .new-btn {
  display: block; text-align: center; text-decoration: none; font-weight: 600;
  background: var(--moon); color: #2a3577; border-radius: var(--radius-s); padding: 9px 12px;
}
.rail .new-btn:hover { background: #ffd93d; }
.who { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: .85rem; }
.who b { display: block; color: #fff; font-weight: 500; }
.who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who a { display: inline-block; margin-top: 8px; color: var(--focus); }

.view { padding: 40px clamp(18px, 4vw, 56px) 80px; max-width: 1120px; width: 100%; }
.view:focus { outline: none; }
.loading { color: var(--muted); padding: 40px 0; }

/* ---------- moon phase status ---------- */
.moon { width: 16px; height: 16px; flex: none; }
.moon .ring { fill: none; stroke: var(--night); stroke-width: 1.4; }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .moon .ring { stroke: var(--night-ink); }
}
:where(:root[data-theme="dark"]) .moon .ring { stroke: var(--night-ink); }
.moon .lit { fill: var(--moon); }
.moon.closed .lit { fill: var(--low); }
.moon.closed .ring { stroke: var(--low); }
.moon.new .ring { stroke-width: 1.8; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); white-space: nowrap; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--radius-s); padding: 8px 14px; cursor: pointer; text-decoration: none; font-weight: 500;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--night); border-color: var(--night); color: #fff; }
.btn-primary:hover { background: var(--night-2); border-color: var(--night-2); }
.btn[disabled] { opacity: .55; cursor: progress; }
.field { display: grid; gap: 6px; margin-bottom: 22px; }
.field > label, .field > legend { font-weight: 600; }
.hint { color: var(--muted); font-size: .86rem; margin: 0; }
input[type="text"], input[type="search"], input[type="number"], input[type="time"], input[type="date"], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); padding: 9px 11px;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: var(--night-2); }
fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend { padding: 0; margin-bottom: 8px; font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input, .impact input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); cursor: pointer;
}
.chip input:checked + span { background: var(--night); border-color: var(--night); color: #fff; }
.chip input:focus-visible + span, .impact input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.impact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.impact { --pc: var(--night); }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .impact { --pc: var(--moon); }
}
:where(:root[data-theme="dark"]) .impact { --pc: var(--moon); }
.impact.p-low { --pc: var(--low); }
.impact.p-normal { --pc: var(--normal); }
.impact.p-high { --pc: var(--high); }
.impact.p-urgent { --pc: var(--urgent); }
.impact span {
  display: block; height: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-s); background: var(--surface); cursor: pointer;
}
.impact b { display: block; font-weight: 600; }
.impact small { color: var(--muted); }
.impact span { position: relative; padding-right: 40px; transition: border-color .12s, background-color .12s; }
.impact span::after {
  content: ""; position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line); box-sizing: border-box; background: var(--surface);
}
.impact span:hover { border-color: var(--pc); }
.impact input:checked + span {
  border-color: var(--pc); box-shadow: inset 0 0 0 2px var(--pc);
  background: color-mix(in srgb, var(--pc) 9%, var(--surface));
}
.impact input:checked + span::after { border-color: var(--pc); background: var(--pc); box-shadow: inset 0 0 0 3px var(--surface); }
.prio-card span { border-left: 5px solid var(--pc); }
.impact .urg { font-style: normal; font-weight: 700; color: var(--pc); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .impact span { transition: none; } }

.form-narrow { max-width: 720px; }
.page-head { margin-bottom: 28px; }
.page-head p { color: var(--muted); margin: 8px 0 0; max-width: 60ch; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- home ---------- */
.hello { margin-bottom: 36px; display: flex; gap: 24px; align-items: end; justify-content: space-between; flex-wrap: wrap; }
.hello h1 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); max-width: 22ch; }
.hello p { color: var(--muted); margin: 10px 0 0; max-width: 52ch; }
.block { margin-bottom: 34px; }
.block > h2 { margin-bottom: 10px; }
.quiet { color: var(--muted); }

/* ---------- ticket list ---------- */
.tlist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.tlist li + li { border-top: 1px solid var(--line); }
.trow { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: center; padding: 13px 16px; text-decoration: none; }
.trow:hover { background: color-mix(in srgb, var(--paper) 60%, var(--surface)); }
.tsub { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmeta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .84rem; margin-top: 2px; }
.tright { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .84rem; white-space: nowrap; }
.prio { font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; }
.prio.urgent { color: var(--urgent); }
.prio.high { color: var(--high); }
.prio.normal { color: var(--normal); }
.prio.low { color: var(--low); }

/* ---------- queue ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 3px; }
.tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; color: var(--muted); }
.tabs button[aria-pressed="true"] { background: var(--night); color: #fff; }
.filters { display: flex; gap: 8px; flex: 1 1 420px; justify-content: flex-end; flex-wrap: wrap; }
.filters input { flex: 1 1 220px; max-width: 320px; }
.filters select { width: auto; }

/* ---------- ticket detail ---------- */
.crumb { display: inline-block; color: var(--muted); font-size: .9rem; margin-bottom: 14px; }
.t-head { margin-bottom: 26px; }
.t-head h1 { font-size: 1.6rem; max-width: 40ch; }
.t-num { color: var(--muted); font-size: .9rem; margin-bottom: 6px; display: flex; gap: 12px; align-items: center; }
.t-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 28px; align-items: start; }
.thread { display: flex; flex-direction: column; gap: 14px; }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px; }
.msg.mine { border-left: 3px solid var(--normal); }
.msg.it { border-left: 3px solid var(--moon); }
.msg.note { background: var(--note); border-style: dashed; border-left: 3px solid var(--high); }
.msg-head { display: flex; justify-content: space-between; gap: 10px; font-size: .86rem; color: var(--muted); margin-bottom: 6px; }
.msg-head b { color: var(--ink); font-weight: 600; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.file { font-size: .84rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); text-decoration: none; background: var(--paper); }
.file:hover { border-color: var(--muted); }
.event { display: flex; gap: 8px; align-items: center; font-size: .84rem; color: var(--muted); padding: 0 16px; }
.event::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line); flex: none; }

.composer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px; margin-top: 6px; }
.composer textarea { min-height: 110px; margin: 8px 0 10px; }
.composer.is-note { background: var(--note); }
.kind-switch { display: flex; gap: 4px; }
.kind-switch button { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-s); padding: 5px 11px; cursor: pointer; font-size: .88rem; }
.kind-switch button[aria-pressed="true"] { background: var(--night); color: #fff; border-color: var(--night); }
.composer-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: .9rem; }
.file-input { font-size: .85rem; color: var(--muted); max-width: 100%; }

.callout { border-radius: var(--radius-m); padding: 14px 16px; margin-bottom: 14px; background: var(--moon-soft); border: 1px solid var(--moon); }
.callout p { margin: 0 0 10px; }

.side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; position: sticky; top: 20px; }
.side h2 { font-size: .95rem; margin-bottom: 12px; }
.side dl { margin: 0; display: grid; gap: 12px; }
.side dt { font-size: .8rem; color: var(--muted); }
.side dd { margin: 2px 0 0; }
.side .field { margin-bottom: 12px; gap: 4px; }
.side .field > label { font-weight: 500; font-size: .84rem; color: var(--muted); }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- overview ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; margin-bottom: 30px; }
.stat { background: var(--surface); padding: 16px 18px; text-decoration: none; display: block; }
.stat b { display: block; font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; line-height: 1.1; color: var(--night); }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .stat b { color: var(--ink); }
}
:where(:root[data-theme="dark"]) .stat b { color: var(--ink); }
.stat span { color: var(--muted); font-size: .86rem; }
a.stat:hover { background: var(--paper); }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.trow > span { min-width: 0; }
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: 150px 1fr 32px; gap: 10px; align-items: center; font-size: .9rem; }
/* bars and charts are SVG so they work under the strict CSP (no inline styles) */
.hbar { width: 100%; height: 8px; display: block; }
.hbar-track { fill: var(--line); }
.hbar-fill { fill: var(--night-2); }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .hbar-fill { fill: var(--moon); }
}
:where(:root[data-theme="dark"]) .hbar-fill { fill: var(--moon); }
.mb { margin-bottom: 12px; }

.empty { text-align: left; padding: 30px 0; }
.empty p { color: var(--muted); }

/* ---------- SLA ---------- */
.sla { font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--paper); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.sla-risk { background: #fff3c4; color: #7a5a00; border-color: #f2d36b; }
.sla-breached { background: #fbe4df; color: #9a2f1d; border-color: #eab3a8; }
.side dd.warn { color: #8a6500; font-weight: 600; }
.side dd.bad { color: var(--urgent); font-weight: 600; }
.stat-bad b { color: var(--urgent) !important; }
.stat-warn b { color: #a87800 !important; }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .sla-risk { background: #3d3412; color: #ffd75a; border-color: #6b5a1c; }
  :where(:root:not([data-theme="light"])) .sla-breached { background: #3f1f1a; color: #ff9f8c; border-color: #6e3329; }
  :where(:root:not([data-theme="light"])) .side dd.warn, :where(:root:not([data-theme="light"])) .stat-warn b { color: #ffd75a !important; }
  :where(:root:not([data-theme="light"])) .side dd.bad, :where(:root:not([data-theme="light"])) .stat-bad b { color: #ff9f8c !important; }
}
:where(:root[data-theme="dark"]) .sla-risk { background: #3d3412; color: #ffd75a; border-color: #6b5a1c; }
:where(:root[data-theme="dark"]) .sla-breached { background: #3f1f1a; color: #ff9f8c; border-color: #6e3329; }
:where(:root[data-theme="dark"]) .side dd.warn, :where(:root[data-theme="dark"]) .stat-warn b { color: #ffd75a !important; }
:where(:root[data-theme="dark"]) .side dd.bad, :where(:root[data-theme="dark"]) .stat-bad b { color: #ff9f8c !important; }

/* ---------- admin center ---------- */
.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -8px 0 24px; overflow-x: auto; }
.subnav a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--moon); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px 20px; margin-bottom: 24px; }
.panel h2 { margin-bottom: 12px; }
.panel > .hint { margin-bottom: 14px; }
.panel h2:not(:first-child) { margin-top: 26px; }
.two-col .panel { margin-bottom: 0; }
.two-col { margin-bottom: 24px; }
.toolbar > .quiet { margin: 0; max-width: 60ch; font-size: .9rem; }
.stats + .stats { margin-top: -18px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .84rem; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.muted-row td { color: var(--muted); }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .b-created { fill: var(--night); }
.chart .b-resolved { fill: var(--moon); }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .chart .b-created { fill: #8c9be0; }
}
:where(:root[data-theme="dark"]) .chart .b-created { fill: #8c9be0; }
.legend { display: flex; gap: 18px; font-size: .86rem; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.lg-created { background: var(--night); }
.lg-resolved { background: var(--moon); }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .lg-created { background: #8c9be0; }
}
:where(:root[data-theme="dark"]) .lg-created { background: #8c9be0; }
.dur { display: flex; align-items: center; gap: 6px; }
.dur input { width: 72px; padding: 7px 8px; }
.dur span { color: var(--muted); font-size: .88rem; }
.sla-table select { width: auto; }
.narrow-field { max-width: 420px; margin-top: 20px; }
.time-row { display: flex; gap: 16px; flex-wrap: wrap; }
.time-row .field { width: 170px; }
.holiday-add { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.holiday-add input { width: auto; }
.holidays { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 6px; max-width: 420px; }
.holidays li { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); }
.btn-small { padding: 3px 10px; font-size: .84rem; }
#hol-list { margin-bottom: 20px; }

/* ---------- request types ---------- */
.type-pick { display: grid; gap: 14px; }
.type-card {
  display: grid; grid-template-columns: 44px 1fr; gap: 16px; align-items: start; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px 22px;
}
.type-card:hover { border-color: var(--night); box-shadow: inset 4px 0 0 var(--moon); }
.type-card svg { width: 44px; height: 44px; }
.type-card .tc-ring { fill: none; stroke: var(--night); stroke-width: 2.2; }
.type-card .tc-mark { fill: none; stroke: var(--night); stroke-width: 2.6; stroke-linecap: round; }
.type-card .tc-dot { fill: var(--night); }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .type-card .tc-ring, :where(:root:not([data-theme="light"])) .type-card .tc-mark { stroke: var(--moon); }
  :where(:root:not([data-theme="light"])) .type-card .tc-dot { fill: var(--moon); }
}
:where(:root[data-theme="dark"]) .type-card .tc-ring, :where(:root[data-theme="dark"]) .type-card .tc-mark { stroke: var(--moon); }
:where(:root[data-theme="dark"]) .type-card .tc-dot { fill: var(--moon); }
.type-card b { display: block; font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--ink); }
.type-card small { display: block; color: var(--muted); font-size: .95rem; margin-top: 4px; max-width: 56ch; }
.type-card em { display: inline-block; font-style: normal; font-size: .8rem; font-weight: 600; color: var(--night); background: var(--moon-soft); border-radius: 999px; padding: 2px 9px; margin-top: 10px; }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .type-card em { color: var(--moon); }
}
:where(:root[data-theme="dark"]) .type-card em { color: var(--moon); }
.type-tag { font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.type-incident { background: #e6e9f6; color: var(--night); }
.type-service { background: var(--moon-soft); color: #6b5300; border: 1px solid var(--moon); }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .type-incident { background: var(--night-2); color: #fff; }
  :where(:root:not([data-theme="light"])) .type-service { color: var(--moon); }
}
:where(:root[data-theme="dark"]) .type-incident { background: var(--night-2); color: #fff; }
:where(:root[data-theme="dark"]) .type-service { color: var(--moon); }
.hw-hint { margin: -6px 0 20px; }
.impact-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.field-row .field { min-width: 150px; }
.field-row .grow { flex: 1 1 220px; }
.field-row .qty { width: 110px; min-width: 0; }
.opt { font-weight: 400; color: var(--muted); font-size: .86rem; }
textarea.short { min-height: 80px; }
.hw-details { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--moon); border-radius: var(--radius-m); padding: 12px 16px; margin-bottom: 14px; }
.hw-details dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px; }
.hw-details dt { font-size: .8rem; color: var(--muted); }
.hw-details dd { margin: 2px 0 0; font-weight: 500; }
.linkbar { background: #e9ecf8; border: 1px solid #c7cdea; border-radius: var(--radius-m); padding: 12px 16px; margin-bottom: 14px; }
.linkbar p { margin: 0; }
.linkbar a { font-weight: 600; }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .linkbar { background: var(--night-2); border-color: var(--line); }
}
:where(:root[data-theme="dark"]) .linkbar { background: var(--night-2); border-color: var(--line); }
.convert-form { border-color: var(--night); margin-bottom: 14px; }
.convert-form h2 { margin-bottom: 4px; }
.convert-form > .hint { margin-bottom: 16px; }
.dash-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.mix { color: var(--muted); margin: -4px 0 14px; font-size: .92rem; }
.mix b { color: var(--ink); }
@media (max-width: 760px) { .impact-grid.three { grid-template-columns: 1fr; } }

/* ---------- roles, view switch, IT options ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.view-switch {
  display: block; width: 100%; margin: 0 0 12px; padding: 7px 10px; border-radius: var(--radius-s);
  border: 1px solid rgba(255,255,255,.25); background: transparent; color: #fff; cursor: pointer; font-size: .86rem; text-align: center;
}
.view-switch:hover { background: var(--night-2); }
.view-switch.on { background: var(--moon); color: #2a3577; border-color: var(--moon); font-weight: 600; }
.view-note { font-size: .8rem; color: var(--night-ink); margin-bottom: 6px; }
.role-pill { display: inline-block !important; margin-top: 6px; font-size: .74rem; padding: 1px 8px; border-radius: 999px; border: 1px solid rgba(255,255,255,.3); color: var(--night-ink); }
.who .role-pill + a { display: block; }
.it-options { border-left: 3px solid var(--moon); }
.it-options h2 { margin-bottom: 10px; }
.it-options .field { margin-bottom: 8px; }
.picked { margin: 0; padding: 8px 10px; background: var(--moon-soft); border-radius: var(--radius-s); line-height: 1.6; }
.picked .btn { margin-left: 6px; }
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); box-shadow: 0 6px 18px rgba(20,28,70,.14); max-height: 260px; overflow: auto;
}
.combo-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 9px; border-radius: 4px; cursor: pointer; }
.combo-list button:hover, .combo-list button:focus-visible { background: var(--paper); }
.combo-list small { display: block; color: var(--muted); }
.combo-list .none { padding: 8px 9px; color: var(--muted); font-size: .9rem; }
.team-table select { width: auto; min-width: 190px; }
.team-table .hint { margin-top: 4px; }
.count-n { opacity: .7; font-size: .85em; }

/* ---------- notifications page ---------- */
.kv th { width: 220px; color: var(--muted); font-weight: 500; text-align: left; vertical-align: top; }
.state { display: inline-block; font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; margin-right: 6px; }
.state-ok { background: #e3f4e8; color: #1d6b3a; }
.state-bad { background: #fbe4df; color: #9a2f1d; }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .state-ok { background: #1d3a28; color: #8fe0aa; }
  :where(:root:not([data-theme="light"])) .state-bad { background: #3f1f1a; color: #ff9f8c; }
}
:where(:root[data-theme="dark"]) .state-ok { background: #1d3a28; color: #8fe0aa; }
:where(:root[data-theme="dark"]) .state-bad { background: #3f1f1a; color: #ff9f8c; }
.result { padding: 12px 14px; border-radius: var(--radius-s); margin: 4px 0 20px; max-width: 70ch; }
.result-ok { background: #e3f4e8; color: #1d4d2e; }
.result-bad { background: #fbe4df; color: #6e2416; }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .result-ok { background: #1d3a28; color: #c7f0d4; }
  :where(:root:not([data-theme="light"])) .result-bad { background: #3f1f1a; color: #ffd2c8; }
}
:where(:root[data-theme="dark"]) .result-ok { background: #1d3a28; color: #c7f0d4; }
:where(:root[data-theme="dark"]) .result-bad { background: #3f1f1a; color: #ffd2c8; }
.result details { margin-top: 6px; font-size: .86rem; }
.result code, .kv code { font-size: .86rem; }
.plain { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
#test-to { width: min(340px, 100%); }

/* ---------- reopen ---------- */
.tag-reopen {
  display: inline-block; vertical-align: 1px; margin-left: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .01em;
  padding: 1px 8px; border-radius: 999px; background: #fdecc8; color: #7a4b00; border: 1px solid #f0c060; white-space: nowrap;
}
.t-num .tag-reopen, .tright .tag-reopen { margin-left: 0; }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .tag-reopen { background: #3d3212; color: #ffd36b; border-color: #6b5a1c; }
}
:where(:root[data-theme="dark"]) .tag-reopen { background: #3d3212; color: #ffd36b; border-color: #6b5a1c; }
.callout-quiet { background: var(--surface); border-color: var(--line); }
.reopen-form { margin-top: 14px; display: grid; gap: 8px; }
.reopen-form label { font-weight: 600; }

/* ---------- theme switch (top right) ---------- */
.theme-toggle {
  position: fixed; top: 14px; right: 18px; z-index: 30;
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: .84rem; font-weight: 500; cursor: pointer; box-shadow: 0 2px 10px rgba(20, 28, 70, .10);
}
.theme-toggle:hover { border-color: var(--muted); }
.tt-track { position: relative; width: 40px; height: 22px; border-radius: 999px; background: #d9dcea; transition: background-color .18s; flex: none; }
.tt-knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; display: grid; place-items: center; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.tt-knob svg { width: 12px; height: 12px; fill: none; stroke: #b98a00; stroke-width: 1.6; stroke-linecap: round; }
.theme-toggle[aria-checked="true"] .tt-track { background: var(--night-2); }
.theme-toggle[aria-checked="true"] .tt-knob { transform: translateX(18px); background: var(--moon); }
.theme-toggle[aria-checked="true"] .tt-knob svg { fill: #2a3577; stroke: none; }
@media (prefers-reduced-motion: reduce) { .tt-track, .tt-knob { transition: none; } }
@media (max-width: 760px) {
  .theme-toggle { position: static; box-shadow: none; order: 2; margin-left: auto; padding: 4px; border-color: rgba(255,255,255,.25); background: transparent; color: #fff; }
  .rail .new-btn { order: 3; margin-left: 0 !important; padding: 8px 12px; }
  .rail .nav { order: 4; }
  .rail .who { order: 5; }
  .brand img { max-width: 132px !important; }
  .tt-label { display: none; }
}

/* ---------- icons ---------- */
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nav a { justify-content: flex-start; gap: 10px; }
.nav a .ico { opacity: .85; }
.with-ico { display: inline-flex; align-items: center; gap: 6px; }
.chip span { display: inline-flex; align-items: center; gap: 7px; }
.chip .ico { opacity: .8; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tile {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: end; column-gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px 16px 14px;
  text-decoration: none; color: var(--ink); overflow: hidden;
}
.tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--night-2); }
.tile.good::before { background: #2e8b57; }
.tile.warn::before { background: var(--high); }
.tile.bad::before { background: var(--urgent); }
.tile b { grid-column: 1; font-family: var(--font-display); font-size: clamp(1.45rem, 2.2vw, 2rem); font-weight: 700; line-height: 1.05; white-space: nowrap; }
.tile span { grid-column: 1; color: var(--muted); font-size: .86rem; }
.tile.bad b { color: var(--urgent); }
.tile.warn b { color: var(--high); }
.tile .tile-icon, .tile .tile-ring, .tile > .moon { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.tile .tile-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--paper); color: var(--night-2); }
.tile .tile-icon .ico { width: 20px; height: 20px; }
.tile .tile-ring svg { width: 58px; height: 58px; display: block; }
.tile > .moon { width: 34px; height: 34px; }
a.tile:hover { border-color: var(--muted); }
:where(:root[data-theme="dark"]) .tile .tile-icon { color: var(--moon); }
@media (prefers-color-scheme: dark) { :where(:root:not([data-theme="light"])) .tile .tile-icon { color: var(--moon); } }
.home-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------- dashboard grid ---------- */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.dash-head p { margin: 6px 0 0; max-width: 70ch; }
.dash-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.dash-filters-bar { margin: -6px 0 20px; }
.dash-actions .btn .ico, .btn svg { width: 16px; height: 16px; }
.btn svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.dash-grid .panel { margin: 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; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.panel-head h2 { margin: 0 !important; }
.panel-head .hint { margin: 4px 0 0; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-box .tlist { border-radius: var(--radius-s); }
.icon-btn {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--muted); }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn[disabled] { opacity: .5; cursor: progress; }
.table.compact td, .table.compact th { padding: 6px 8px; }
.table.compact { margin-top: 10px; }
.good-note { color: #2e8b57; }

/* compact list for narrow panels */
.mini-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.mini-list li + li { border-top: 1px solid var(--line); }
.mini-list a { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 10px 12px 10px 16px; text-decoration: none; }
.mini-top .sla { flex: none; }
.mini-list a:hover { background: var(--paper); }
.mini-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mini-top b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mini-list li.pe { box-shadow: inset 4px 0 0 var(--pe, transparent); }
.mini-list .tmeta .prio { padding: 0 6px; font-size: .74rem; }

/* refresh */
.updated { white-space: nowrap; opacity: .85; }
#refresh-btn svg { transition: transform .5s; }
#refresh-btn.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #refresh-btn.spinning svg { animation: none; } }

/* engineer filter */
.eng-filter { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px 0 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); color: var(--muted); }
.eng-filter select { border: 0; background: transparent; padding: 8px 6px; width: auto; min-width: 150px; max-width: 220px; color: var(--ink); }
.eng-filter:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.eng-filter select:focus-visible { outline: none; }

/* ---------- export dialog ---------- */
.export-dlg {
  width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(10, 14, 40, .35);
}
.export-dlg::backdrop { background: rgba(14, 18, 45, .55); }
.export-dlg > .loading { padding: 30px; }
.dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 8px; }
.dlg-head h2 { margin: 0; }
.dlg-head .hint { margin: 4px 0 0; }
.slide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; padding: 12px 22px; overflow: auto; max-height: calc(100vh - 230px); }
.slide-card { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--paper); }
.slide-thumb { aspect-ratio: 16 / 9; background: #fff; }
.slide-thumb svg { width: 100%; height: 100%; display: block; }
.slide-card figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; font-weight: 600; font-size: .9rem; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- ticket progress tracker ---------- */
.stepper { list-style: none; margin: 16px 0 0; padding: 0; display: flex; max-width: 620px; }
.stepper li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; font-size: .82rem; color: var(--muted); text-align: center; }
.stepper li::before { content: ""; position: absolute; top: 8px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.stepper li:first-child::before { display: none; }
.stepper li.done::before, .stepper li.current::before { background: var(--moon); }
.stepper .moon { width: 18px; height: 18px; position: relative; z-index: 1; background: var(--paper); border-radius: 50%; }
.stepper li.current { color: var(--ink); font-weight: 700; }
.stepper li.current .moon { box-shadow: 0 0 0 4px color-mix(in srgb, var(--moon) 30%, transparent); }

/* ---------- priority edges in IT lists ---------- */
.tlist li.pe { box-shadow: inset 4px 0 0 var(--pe, transparent); }
.tlist li.pe-urgent { --pe: var(--urgent); }
.tlist li.pe-high { --pe: var(--high); }
.tlist li.pe-normal { --pe: var(--normal); }
.tlist li.pe-low { --pe: var(--low); }

@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-grid > .panel { grid-column: 1 / -1; }
  .home-tiles { grid-template-columns: 1fr; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--night); color: #fff; padding: 10px 16px; border-radius: var(--radius-s);
  transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--urgent); }

/* ---------- login ---------- */
.login-body { background: var(--night); min-height: 100vh; }
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-brand {
  background: #2a3577; color: #fff; display: flex; flex-direction: column; justify-content: center;
  padding: clamp(32px, 7vw, 96px);
}
.tagline {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(2rem, 4.4vw, 3.6rem); line-height: 1.08; letter-spacing: .01em;
  max-width: 16ch; margin: 0;
}
.login-arc { width: min(420px, 90%); height: 46px; margin-top: 28px; }
.login-card { background: #fff; color: #1d2433; padding: clamp(32px, 7vw, 96px); display: flex; flex-direction: column; justify-content: center; }
.login-logo { width: min(380px, 100%); height: auto; margin-bottom: 40px; }
.login-card h1 { font-size: clamp(2rem, 4vw, 2.8rem); color: #2a3577; }
.login-lead { font-size: 1.08rem; color: #5b6380; max-width: 40ch; margin: 12px 0 28px; }
.ms-btn {
  display: inline-flex; align-items: center; gap: 12px; align-self: flex-start;
  background: #2a3577; color: #fff; text-decoration: none; font-weight: 600; font-size: 1.02rem;
  padding: 12px 20px; border-radius: var(--radius-s); border-bottom: 3px solid #fccd0d;
}
.ms-btn:hover { background: #36438f; }
.ms-btn svg { width: 20px; height: 20px; }
.login-help { color: #5b6380; font-size: .9rem; max-width: 44ch; margin-top: 24px; }
.login-error { background: #fbe9e5; color: #7a2617; padding: 10px 14px; border-radius: var(--radius-s); max-width: 48ch; margin: 0 0 18px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .t-grid, .two-col { grid-template-columns: 1fr; }
  .side { position: static; order: -1; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; order: 3; }
  .nav-sep, .nav-head { display: none; }
  .rail .new-btn { margin-left: auto; }
  .brand img { max-width: 150px; }
  .brand small { display: none; }
  .who { margin: 0; padding: 0; border: 0; order: 4; flex: 1 1 100%; display: flex; gap: 12px; align-items: baseline; }
  .who span { display: none; }
  .who a { margin: 0; }
  .view { padding-top: 24px; }
  .trow { grid-template-columns: 22px 1fr; }
  .tright { grid-column: 2; }
  .filters { justify-content: stretch; }
  .filters input { max-width: none; }
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 28px 24px; }
  .tagline { font-size: 1.6rem; }
  .login-arc { height: 28px; margin-top: 14px; }
  .login-logo { margin-bottom: 28px; }
  .bars li { grid-template-columns: 110px 1fr 28px; }
  .impact-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
