@import url("fonts.css");

/* ===========================================================================
   Compliance — Endpoint Compliance Management

   The interface is a queue, not a report. Everything serves one motion: scan a
   table, spot the machines that still need work, open one, decide.

   The single loud element is the health rail — the bar on the left edge of
   every endpoint row, coloured by the worst open issue and muted to slate when
   an exception already covers the machine. Down fifty rows it reads as a
   barcode: red is work, slate is handled. Everything else stays quiet so the
   rail keeps its meaning.
   =========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  --ground:        #f4f6f8;
  --surface:       #ffffff;
  --surface-sunk:  #f8f9fb;
  --surface-hover: #f1f5f9;
  --frame:         #151b24;
  --frame-hover:   #1f2833;
  --frame-line:    #29323f;

  --ink:    #101720;
  --ink-2:  #55606e;
  --ink-3:  #8993a2;
  --ink-on-frame:     #e8ebef;
  --ink-on-frame-dim: #8b95a3;

  --line:        #e1e6ec;
  --line-strong: #ccd4de;
  --accent:      #2f4e7a;
  --accent-soft: #eaeff6;
  --accent-ink:  #23406b;
  --focus:       #4a7fc4;

  /* Each tone carries a text colour, a chip fill and a hairline, so chips stay
     legible on both the plain surface and the hover tint. */
  --tone-red:     #b3261e; --tone-red-fill:     #fdeceb; --tone-red-line:     #f3c8c5;
  --tone-amber:   #96590a; --tone-amber-fill:   #fcf2e3; --tone-amber-line:   #eed9b2;
  --tone-green:   #10693f; --tone-green-fill:   #e6f4ec; --tone-green-line:   #bfe0cd;
  --tone-blue:    #1a5296; --tone-blue-fill:    #e9f0fa; --tone-blue-line:    #c3d6ee;
  --tone-violet:  #5f3dae; --tone-violet-fill:  #f0ebfb; --tone-violet-line:  #d6c9f0;
  --tone-teal:    #0d6a63; --tone-teal-fill:    #e4f2f1; --tone-teal-line:    #b7dbd8;
  --tone-cyan:    #0f6289; --tone-cyan-fill:    #e6f2f8; --tone-cyan-line:    #bcd9e8;
  --tone-crimson: #9c1750; --tone-crimson-fill: #fbe9f0; --tone-crimson-line: #f0c4d6;
  --tone-slate:   #4c5766; --tone-slate-fill:   #eef1f4; --tone-slate-line:   #d3dae2;

  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --rail-w:  220px;
  --r-chip:  3px;
  --r-ctl:   5px;
  --r-panel: 7px;
  --shadow-pop: 0 10px 30px rgba(16, 23, 32, .18), 0 1px 2px rgba(16, 23, 32, .1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground:        #0f141b;
    --surface:       #161c25;
    --surface-sunk:  #1a212b;
    --surface-hover: #1e2732;
    --frame:         #0b0f14;
    --frame-hover:   #1a222d;
    --frame-line:    #212a36;

    --ink:    #e6eaef;
    --ink-2:  #a3adba;
    --ink-3:  #7b8593;
    --ink-on-frame:     #dfe4ea;
    --ink-on-frame-dim: #7b8592;

    --line:        #262f3b;
    --line-strong: #354050;
    --accent:      #7aa5dd;
    --accent-soft: #1c2938;
    --accent-ink:  #a5c3e9;
    --focus:       #7aa5dd;

    --tone-red:     #f0938b; --tone-red-fill:     #2b1a19; --tone-red-line:     #482724;
    --tone-amber:   #e0b070; --tone-amber-fill:   #291f12; --tone-amber-line:   #46341c;
    --tone-green:   #6bc294; --tone-green-fill:   #12261c; --tone-green-line:   #1f4230;
    --tone-blue:    #83b0e6; --tone-blue-fill:    #16212f; --tone-blue-line:    #23384f;
    --tone-violet:  #b299e8; --tone-violet-fill:  #1f1a2e; --tone-violet-line:  #362c4d;
    --tone-teal:    #64c0b8; --tone-teal-fill:    #102624; --tone-teal-line:    #1c423e;
    --tone-cyan:    #6fb6d8; --tone-cyan-fill:    #10222b; --tone-cyan-line:    #1c3b49;
    --tone-crimson: #ea88ac; --tone-crimson-fill: #2a1520; --tone-crimson-line: #4a2438;
    --tone-slate:   #9aa5b3; --tone-slate-fill:   #1d242e; --tone-slate-line:   #303a47;

    --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .4);
  }
}

/* --------------------------------------------------------------------------
   2. Reset and base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.011em; }
p { margin: 0 0 .75em; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

code, .mono, kbd { font-family: var(--mono); font-size: .92em; font-variant-ligatures: none; }

.muted     { color: var(--ink-2); }
.dim       { color: var(--ink-3); }
.nowrap    { white-space: nowrap; }
.right     { text-align: right; }
.center    { text-align: center; }
.tabular   { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------------------
   3. Shell — dark frame around a light workspace
   -------------------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail-w);
  flex: 0 0 var(--rail-w);
  background: var(--frame);
  color: var(--ink-on-frame);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.rail__brand {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--frame-line);
}
.rail__name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: #fff;
  display: block;
}
.rail__name:hover { text-decoration: none; }
.rail__tagline {
  display: block;
  font-size: 11.5px;
  color: var(--ink-on-frame-dim);
  margin-top: 2px;
}

.rail__nav { padding: 10px 8px; flex: 1; overflow-y: auto; }

.rail__link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  margin-bottom: 1px;
  border-radius: var(--r-ctl);
  color: var(--ink-on-frame-dim);
  font-size: 13px;
  position: relative;
}
.rail__link:hover { background: var(--frame-hover); color: var(--ink-on-frame); text-decoration: none; }
.rail__link.is-active { background: var(--frame-hover); color: #fff; font-weight: 500; }
.rail__link.is-active::before {
  content: "";
  position: absolute;
  left: -8px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--focus);
  border-radius: 0 2px 2px 0;
}
.rail__link svg { width: 15px; height: 15px; flex: 0 0 15px; opacity: .85; }
.rail__count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-on-frame-dim);
  font-variant-numeric: tabular-nums;
}
.rail__link.is-active .rail__count { color: #fff; }

.rail__foot {
  border-top: 1px solid var(--frame-line);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  color: var(--ink-on-frame-dim);
}
.rail__avatar {
  width: 25px; height: 25px;
  flex: 0 0 25px;
  border-radius: 50%;
  background: var(--frame-hover);
  border: 1px solid var(--frame-line);
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-on-frame);
  letter-spacing: .02em;
}
.rail__signout {
  margin-left: auto;
  background: none; border: 0; padding: 4px;
  color: var(--ink-on-frame-dim);
  cursor: pointer;
  border-radius: 4px;
  display: grid; place-items: center;
}
.rail__signout:hover { color: #fff; background: var(--frame-hover); }
.rail__signout svg { width: 15px; height: 15px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 22px;
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar h1 { font-size: 18px; }
.topbar__sub { color: var(--ink-3); font-size: 12.5px; margin-top: 1px; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.canvas { padding: 20px 22px 48px; flex: 1; }
.canvas--wide { max-width: none; }

.rail__toggle { display: none; }

/* --------------------------------------------------------------------------
   4. Controls
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 31px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
@media (prefers-color-scheme: dark) {
  .btn--primary { color: #0f141b; }
}

.btn--danger { color: var(--tone-red); border-color: var(--tone-red-line); background: var(--tone-red-fill); }
.btn--danger:hover { background: var(--tone-red-fill); border-color: var(--tone-red); }

.btn--quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn--quiet:hover { background: var(--surface-hover); color: var(--ink); }

.btn--sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn--block { width: 100%; }

.field { display: block; margin-bottom: 13px; }
.field:last-child { margin-bottom: 0; }
.field__label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 4px;
}
.field__hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.field__error { font-size: 11.5px; color: var(--tone-red); margin-top: 4px; }

.input, .select, .textarea {
  width: 100%;
  min-height: 31px;
  padding: 5px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.textarea { min-height: 72px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(74, 127, 196, .22);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:disabled, .select:disabled { background: var(--surface-sunk); color: var(--ink-3); }

.select {
  appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 8l3-3.5' fill='none' stroke='%238993a2' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
}

.check { display: inline-flex; align-items: flex-start; gap: 7px; font-size: 12.5px; cursor: pointer; }
.check input { margin: 2px 0 0; accent-color: var(--accent); flex: 0 0 auto; }

.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; min-width: 0; }

/* --------------------------------------------------------------------------
   5. Badges and rails
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 19px;
  padding: 0 6px;
  border-radius: var(--r-chip);
  border: 1px solid transparent;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
}
.badge--red     { color: var(--tone-red);     background: var(--tone-red-fill);     border-color: var(--tone-red-line); }
.badge--amber   { color: var(--tone-amber);   background: var(--tone-amber-fill);   border-color: var(--tone-amber-line); }
.badge--green   { color: var(--tone-green);   background: var(--tone-green-fill);   border-color: var(--tone-green-line); }
.badge--blue    { color: var(--tone-blue);    background: var(--tone-blue-fill);    border-color: var(--tone-blue-line); }
.badge--violet  { color: var(--tone-violet);  background: var(--tone-violet-fill);  border-color: var(--tone-violet-line); }
.badge--teal    { color: var(--tone-teal);    background: var(--tone-teal-fill);    border-color: var(--tone-teal-line); }
.badge--cyan    { color: var(--tone-cyan);    background: var(--tone-cyan-fill);    border-color: var(--tone-cyan-line); }
.badge--crimson { color: var(--tone-crimson); background: var(--tone-crimson-fill); border-color: var(--tone-crimson-line); }
.badge--slate   { color: var(--tone-slate);   background: var(--tone-slate-fill);   border-color: var(--tone-slate-line); }

/* Muted variant: an issue covered by an active exception is still shown, but it
   is not asking for attention today. */
.badge--excused { opacity: .55; }

.badge-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

.dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px; background: currentColor; }

/* --------------------------------------------------------------------------
   6. Panels
   -------------------------------------------------------------------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  overflow: hidden;
}
.panel + .panel { margin-top: 16px; }

.panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.panel__title { font-size: 13px; font-weight: 600; }
.panel__count { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.panel__actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.panel__body { padding: 14px; }
.panel__body--flush { padding: 0; }

.empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--ink-3);
}
.empty strong { display: block; color: var(--ink-2); font-weight: 500; margin-bottom: 3px; font-size: 13px; }
.empty p { font-size: 12.5px; max-width: 46ch; margin: 0 auto; }
.empty .btn { margin-top: 12px; }

/* --------------------------------------------------------------------------
   7. Stat strip — a measured row, not a deck of cards
   -------------------------------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  overflow: hidden;
  margin-bottom: 16px;
}
.stat {
  padding: 13px 16px 14px;
  border-left: 1px solid var(--line);
  min-width: 0;
}
.stat:first-child { border-left: 0; }
.stat__value {
  font-family: var(--mono);
  font-size: 25px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  display: block;
}
.stat__label { font-size: 12px; color: var(--ink-2); margin-top: 3px; display: block; }
.stat__note  { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; display: block; }
.stat a.stat__label:hover { color: var(--accent); }
.stat--alert .stat__value { color: var(--tone-red); }
.stat--warn  .stat__value { color: var(--tone-amber); }
.stat--calm  .stat__value { color: var(--tone-slate); }
.stat--good  .stat__value { color: var(--tone-green); }

/* --------------------------------------------------------------------------
   8. Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }

.table thead th {
  position: sticky;
  top: 54px;
  z-index: 10;
  background: var(--surface-sunk);
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
}
.table--static thead th { position: static; }

.table thead th a { color: inherit; display: inline-flex; align-items: center; gap: 3px; }
.table thead th a:hover { color: var(--ink); text-decoration: none; }
.table thead th.is-sorted a { color: var(--ink); font-weight: 600; }
.sort-caret { width: 9px; height: 9px; opacity: .8; }

.table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-hover); }

.table td.shrink, .table th.shrink { width: 1%; white-space: nowrap; }

/* The health rail. First cell of every endpoint row carries it. */
.table--railed tbody td:first-child { position: relative; padding-left: 15px; }
.table--railed tbody td:first-child::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
tr.rail-red     td:first-child::before { background: var(--tone-red); }
tr.rail-amber   td:first-child::before { background: var(--tone-amber); }
tr.rail-blue    td:first-child::before { background: var(--tone-blue); }
tr.rail-violet  td:first-child::before { background: var(--tone-violet); }
tr.rail-slate   td:first-child::before { background: var(--tone-slate); opacity: .55; }
tr.rail-green   td:first-child::before { background: var(--tone-green); }
tr.rail-none    td:first-child::before { background: var(--line-strong); }

.host {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -.01em;
}
a.host:hover { color: var(--accent); }

.cell-stack { display: flex; flex-direction: column; line-height: 1.35; }
.cell-stack small { color: var(--ink-3); font-size: 11.5px; }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .1s ease; }
tr:hover .row-actions, tr:focus-within .row-actions { opacity: 1; }
@media (hover: none) { .row-actions { opacity: 1; } }

/* --------------------------------------------------------------------------
   9. Filter bar
   -------------------------------------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.filters .input, .filters .select { height: 30px; width: auto; min-width: 128px; }
.filters .search { min-width: 230px; flex: 1 1 230px; max-width: 340px; }
.filters__spacer { flex: 1; }
.filters__meta { font-size: 12px; color: var(--ink-3); white-space: nowrap; }

.chip-clear {
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 9px;
  border-radius: var(--r-ctl);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px; font-weight: 500;
}
.chip-clear:hover { text-decoration: none; background: var(--accent-soft); filter: brightness(.97); }

/* --------------------------------------------------------------------------
   10. Pagination
   -------------------------------------------------------------------------- */
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
}
.pager__links { margin-left: auto; display: flex; gap: 4px; }
.pager__link {
  min-width: 28px; height: 28px;
  padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.pager__link:hover { background: var(--surface-hover); text-decoration: none; }
.pager__link.is-current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager__link.is-disabled { opacity: .4; pointer-events: none; }
.pager__gap { display: inline-flex; align-items: center; padding: 0 2px; color: var(--ink-3); }

/* --------------------------------------------------------------------------
   11. Flash banners
   -------------------------------------------------------------------------- */
.flashes { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--r-ctl);
  background: var(--surface);
  font-size: 12.5px;
}
.flash--success { border-left-color: var(--tone-green); background: var(--tone-green-fill); color: var(--tone-green); }
.flash--error   { border-left-color: var(--tone-red);   background: var(--tone-red-fill);   color: var(--tone-red); }
.flash--info    { border-left-color: var(--tone-blue);  background: var(--tone-blue-fill);  color: var(--tone-blue); }
.flash svg { width: 15px; height: 15px; flex: 0 0 15px; margin-top: 1px; }
.flash__close { margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit; opacity: .6; padding: 0 2px; }
.flash__close:hover { opacity: 1; }

/* --------------------------------------------------------------------------
   12. Endpoint detail
   -------------------------------------------------------------------------- */
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.identity {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.identity__host {
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -.02em;
}

/* Exception banner — the whole reason the tool exists, so it sits above the
   issues and is impossible to miss without shouting. */
.exception-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--tone-slate-line);
  border-left: 3px solid var(--tone-slate);
  border-radius: var(--r-panel);
  background: var(--tone-slate-fill);
  margin-bottom: 16px;
}
.exception-banner--expiring { border-color: var(--tone-amber-line); border-left-color: var(--tone-amber); background: var(--tone-amber-fill); }
.exception-banner__icon { flex: 0 0 17px; margin-top: 1px; color: var(--tone-slate); }
.exception-banner--expiring .exception-banner__icon { color: var(--tone-amber); }
.exception-banner__icon svg { width: 17px; height: 17px; }
.exception-banner__body { min-width: 0; flex: 1; }
.exception-banner__title { font-weight: 600; font-size: 13px; }
.exception-banner__meta { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.exception-banner__reason { font-size: 12.5px; color: var(--ink-2); margin-top: 5px; }

/* Issue stack. Each issue keeps its category rail, echoing the table. */
.issue {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px 12px 17px;
  position: relative;
}
.issue:last-child { border-bottom: 0; }
.issue::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--line-strong);
}
.issue--red::before     { background: var(--tone-red); }
.issue--amber::before   { background: var(--tone-amber); }
.issue--blue::before    { background: var(--tone-blue); }
.issue--violet::before  { background: var(--tone-violet); }
.issue--teal::before    { background: var(--tone-teal); }
.issue--cyan::before    { background: var(--tone-cyan); }
.issue--crimson::before { background: var(--tone-crimson); }
.issue--slate::before   { background: var(--tone-slate); }
.issue--green::before   { background: var(--tone-green); }
.issue.is-closed { background: var(--surface-sunk); }
.issue.is-closed .issue__title { color: var(--ink-2); }

.issue__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.issue__title { font-size: 13.5px; font-weight: 600; }
.issue__spacer { flex: 1; }
.issue__desc { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.issue__meta {
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.issue__meta b { font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12.5px; }
.kv dt { color: var(--ink-3); white-space: nowrap; }
.kv dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }

.detail-list { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 11.5px; }
.detail-list__item { color: var(--ink-3); }
.detail-list__item b { font-weight: 500; color: var(--ink-2); font-family: var(--mono); font-size: 11px; }

/* Timeline */
.timeline { position: relative; padding: 4px 0 0; }
.timeline::before {
  content: "";
  position: absolute;
  left: 4px; top: 10px; bottom: 6px;
  width: 1px;
  background: var(--line);
}
.tl-item { position: relative; padding: 0 0 13px 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: 1px; top: 5px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
}
.tl-item--accent::before { border-color: var(--accent); }
.tl-item--red::before    { border-color: var(--tone-red); }
.tl-item--green::before  { border-color: var(--tone-green); }
.tl-item--slate::before  { border-color: var(--tone-slate); }
.tl-item__text { font-size: 12.5px; line-height: 1.45; }
.tl-item__time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 1px;
  display: block;
}

/* Notes */
.note { padding: 10px 0; border-bottom: 1px solid var(--line); }
.note:last-child { border-bottom: 0; padding-bottom: 0; }
.note:first-child { padding-top: 0; }
.note__body { font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note__meta { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.note__meta form { margin-left: auto; }

/* --------------------------------------------------------------------------
   13. Import wizard
   -------------------------------------------------------------------------- */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 18px;
  font-size: 12.5px;
  flex-wrap: wrap;
}
.step { display: flex; align-items: center; gap: 7px; color: var(--ink-3); }
.step__num {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid; place-items: center;
  font-size: 11px;
  font-family: var(--mono);
  background: var(--surface);
}
.step.is-current { color: var(--ink); font-weight: 500; }
.step.is-current .step__num { border-color: var(--accent); background: var(--accent); color: #fff; }
.step.is-done .step__num { border-color: var(--tone-green); color: var(--tone-green); background: var(--tone-green-fill); }
.step__line { width: 34px; height: 1px; background: var(--line-strong); margin: 0 11px; }

.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-panel);
  padding: 34px 20px;
  text-align: center;
  background: var(--surface-sunk);
  transition: border-color .15s ease, background-color .15s ease;
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone__icon { color: var(--ink-3); margin-bottom: 8px; }
.dropzone__icon svg { width: 26px; height: 26px; }
.dropzone__title { font-size: 13.5px; font-weight: 500; }
.dropzone__hint { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.dropzone__file { font-family: var(--mono); font-size: 12.5px; color: var(--accent); margin-top: 9px; }

.preview-table { font-size: 12px; }
.preview-table th, .preview-table td {
  padding: 5px 9px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-table th:last-child, .preview-table td:last-child { border-right: 0; }
.preview-table thead th { background: var(--surface-sunk); color: var(--ink-2); font-weight: 500; }
.preview-table td { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
.preview-table .is-mapped { background: var(--accent-soft); }
.preview-table thead th.is-mapped { color: var(--accent-ink); font-weight: 600; }

.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.map-row {
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 9px 11px;
  background: var(--surface);
}
.map-row__field { font-size: 12.5px; font-weight: 500; }
.map-row__req { color: var(--tone-red); margin-left: 3px; }
.map-row__hint { font-size: 11.5px; color: var(--ink-3); margin: 2px 0 6px; }

.extras { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.extras label { font-family: var(--mono); font-size: 12px; }

/* --------------------------------------------------------------------------
   14. Modals
   -------------------------------------------------------------------------- */
.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 23, 32, .45);
  display: grid;
  place-items: start center;
  padding: 8vh 16px 16px;
  overflow-y: auto;
}
.modal__panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-pop);
  width: 100%;
  max-width: 480px;
  animation: modal-in .14s ease-out;
}
.modal__panel--wide { max-width: 640px; }
@keyframes modal-in { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal__panel { animation: none; } }

.modal__head { display: flex; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.modal__title { font-size: 14px; font-weight: 600; }
.modal__close { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--ink-3); padding: 3px; border-radius: 4px; }
.modal__close:hover { color: var(--ink); background: var(--surface-hover); }
.modal__close svg { width: 16px; height: 16px; display: block; }
.modal__body { padding: 16px; }
.modal__foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-sunk); }

/* --------------------------------------------------------------------------
   15. Sign-in
   -------------------------------------------------------------------------- */
.signin {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--frame);
}
.signin__card {
  width: 100%;
  max-width: 340px;
}
.signin__brand { margin-bottom: 22px; }
.signin__name { font-size: 21px; font-weight: 600; color: #fff; letter-spacing: -.015em; }
.signin__tagline { font-size: 13px; color: var(--ink-on-frame-dim); margin-top: 2px; }
.signin__box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 20px;
}
.signin__note { font-size: 11.5px; color: var(--ink-on-frame-dim); margin-top: 16px; text-align: center; }

/* --------------------------------------------------------------------------
   16. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .rail {
    position: static;
    width: 100%;
    flex: none;
    height: auto;
  }
  .rail__nav { display: none; padding: 6px 8px 10px; }
  .rail.is-open .rail__nav { display: block; }
  .rail__brand { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 0; }
  .rail__foot { display: none; }
  .rail.is-open .rail__foot { display: flex; }
  .rail__toggle {
    display: grid; place-items: center;
    width: 32px; height: 32px;
    background: var(--frame-hover);
    border: 1px solid var(--frame-line);
    border-radius: var(--r-ctl);
    color: var(--ink-on-frame);
    cursor: pointer;
  }
  .rail__toggle svg { width: 16px; height: 16px; }
  .topbar { position: static; padding: 0 14px; }
  .table thead th { position: static; }
  .canvas { padding: 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .stat:nth-child(-n+2) { border-top: 0; }
  .stat:nth-child(odd) { border-left: 0; }
  .filters .search { max-width: none; }
}

@media print {
  .rail, .topbar__actions, .row-actions, .filters, .pager { display: none !important; }
  body { background: #fff; }
}

/* --------------------------------------------------------------------------
   17. Layout utilities

   Small, named jobs rather than inline style attributes. The Content-Security-
   Policy on this site is style-src 'self', which blocks inline styles outright,
   so every layout nudge has to live here.
   -------------------------------------------------------------------------- */
.inline-row       { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-row--tight{ gap: 6px; flex-wrap: nowrap; }
.inline-row--wide { gap: 18px; }
.inline-row--form { gap: 12px; }
.push-right       { margin-left: auto; }
.gap-top          { margin-top: 10px; }
.gap-top-sm       { margin-top: 4px; }
.gap-top-form     { margin-top: 12px; }
.w-order          { width: 74px; flex: 0 0 74px; }
.w-code           { flex: 0 0 150px; }
.w-tone           { flex: 0 0 100px; }
.divided-top      { border-top: 1px solid var(--line); }
.text-sm          { font-size: 12.5px; }
.disclosure       { padding: 11px 14px; cursor: pointer; font-size: 12.5px; }
.disclosure::marker { color: var(--ink-3); }
.page-note        { max-width: 520px; margin: 48px auto; }
