/* ============================================================
   DMS — Design System  "Ledger"
   One system. Every screen derives from these tokens.
   ============================================================ */

:root{
  /* Rail — deep ink, near-black with blue undertone */
  --ink-900:#0B0F17;
  --ink-850:#111722;
  --ink-800:#171F2B;
  --ink-700:#232C3B;
  --ink-txt:#8A94A6;
  --ink-txt-hi:#E7EAF0;

  /* Canvas */
  --canvas:#F5F6F8;
  --surface:#FFFFFF;
  --surface-2:#FAFBFC;
  --line:#E4E7EC;
  --line-soft:#F0F2F5;

  /* Text */
  --text:#101828;
  --text-2:#667085;
  --text-3:#98A2B3;

  /* Brand — violet. Deliberately not blue/green so it never
     collides with status meaning. */
  --accent:#5B4BD6;
  --accent-hi:#4C3DC4;
  --accent-soft:#EEEBFB;
  --accent-line:#D6CFF7;

  /* Status */
  --ok:#067647;      --ok-bg:#ECFDF3;   --ok-line:#ABEFC6;
  --warn:#B54708;    --warn-bg:#FFFAEB; --warn-line:#FEDF89;
  --bad:#B42318;     --bad-bg:#FEF3F2;  --bad-line:#FECDCA;
  --info:#175CD3;    --info-bg:#EFF8FF; --info-line:#B2DDFF;
  --mute:#475467;    --mute-bg:#F2F4F7; --mute-line:#E4E7EC;

  --radius:10px;
  --radius-sm:7px;
  --radius-lg:14px;

  --shadow-xs:0 1px 2px rgba(16,24,40,.05);
  --shadow-sm:0 1px 3px rgba(16,24,40,.08),0 1px 2px rgba(16,24,40,.04);
  --shadow-md:0 4px 8px -2px rgba(16,24,40,.08),0 2px 4px -2px rgba(16,24,40,.04);
  --shadow-lg:0 12px 16px -4px rgba(16,24,40,.08),0 4px 6px -2px rgba(16,24,40,.03);
  --shadow-pop:0 20px 24px -4px rgba(16,24,40,.10),0 8px 8px -4px rgba(16,24,40,.04);

  --rail-w:236px;
  --bar-h:56px;

  --font:"Segoe UI Variable Display","Segoe UI Variable","Segoe UI",-apple-system,
         BlinkMacSystemFont,"Inter",system-ui,sans-serif;
  --font-mono:"Cascadia Code","Cascadia Mono",Consolas,"SF Mono",
              "Roboto Mono",ui-monospace,monospace;

  --ease:cubic-bezier(.22,.61,.36,1);
}

*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

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

body{
  font-family:var(--font);
  font-size:13.5px;
  line-height:1.5;
  color:var(--text);
  background:var(--canvas);
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  font-feature-settings:"cv05" 1,"ss01" 1;
}

a{color:inherit;text-decoration:none}
button,input,select,textarea{font:inherit;color:inherit}
button{background:none;border:none;cursor:pointer}

::selection{background:var(--accent-soft);color:var(--accent-hi)}

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

/* ── Scrollbars ─────────────────────────────────────────── */
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:#D0D5DD;border-radius:8px;border:3px solid var(--canvas)}
::-webkit-scrollbar-thumb:hover{background:#98A2B3}
.rail ::-webkit-scrollbar-thumb{background:var(--ink-700);border-color:var(--ink-900)}

/* ============================================================
   SHELL
   ============================================================ */
.shell{display:flex;min-height:100vh}

/* ── Left rail ──────────────────────────────────────────── */
.rail{
  width:var(--rail-w);
  flex:0 0 var(--rail-w);
  background:var(--ink-900);
  position:fixed;inset:0 auto 0 0;
  display:flex;flex-direction:column;
  z-index:60;
  border-right:1px solid var(--ink-800);
}

.rail-brand{
  padding:16px 16px 14px;
  display:flex;align-items:center;gap:10px;
  border-bottom:1px solid var(--ink-800);
}
.rail-mark{
  width:30px;height:30px;flex:0 0 30px;border-radius:8px;
  background:linear-gradient(140deg,var(--accent) 0%,#7C6BE8 100%);
  display:grid;place-items:center;
  box-shadow:0 2px 8px rgba(91,75,214,.35);
}
.rail-mark svg{width:16px;height:16px;fill:none;stroke:#fff;stroke-width:2;
  stroke-linecap:round;stroke-linejoin:round}
.rail-name{font-size:13px;font-weight:650;color:var(--ink-txt-hi);letter-spacing:-.01em;line-height:1.25}
.rail-sub{font-size:10.5px;color:#5B6577;letter-spacing:.01em;margin-top:1px}

/* Company switcher */
.switcher{padding:12px 12px 8px}
.switcher-btn{
  width:100%;display:flex;align-items:center;gap:9px;
  padding:9px 10px;border-radius:var(--radius-sm);
  background:var(--ink-850);border:1px solid var(--ink-700);
  text-align:left;transition:background .14s var(--ease),border-color .14s var(--ease);
}
.switcher-btn:hover{background:var(--ink-800);border-color:#2E3949}
.switcher-avatar{
  width:24px;height:24px;flex:0 0 24px;border-radius:6px;
  background:var(--accent-soft);color:var(--accent-hi);
  display:grid;place-items:center;
  font-size:10px;font-weight:700;letter-spacing:-.02em;
}
.switcher-text{flex:1;min-width:0}
.switcher-label{font-size:9.5px;color:#5B6577;text-transform:uppercase;letter-spacing:.07em;font-weight:600}
.switcher-value{font-size:12px;color:var(--ink-txt-hi);font-weight:550;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:1px}
.switcher-caret{width:12px;height:12px;flex:0 0 12px;fill:none;stroke:#5B6577;stroke-width:2;
  stroke-linecap:round;stroke-linejoin:round;transition:transform .18s var(--ease)}
.switcher.open .switcher-caret{transform:rotate(180deg)}

.switcher-menu{
  display:none;margin-top:5px;padding:5px;
  background:var(--ink-850);border:1px solid var(--ink-700);
  border-radius:var(--radius-sm);max-height:260px;overflow-y:auto;
}
.switcher.open .switcher-menu{display:block;animation:dropIn .16s var(--ease)}
@keyframes dropIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
.switcher-item{
  display:flex;align-items:center;gap:8px;padding:7px 8px;border-radius:5px;
  font-size:12px;color:var(--ink-txt);transition:background .12s
}
.switcher-item:hover{background:var(--ink-800);color:var(--ink-txt-hi)}
.switcher-item.on{background:var(--ink-800);color:#fff}
.switcher-item .dot{width:5px;height:5px;border-radius:50%;background:var(--accent);flex:0 0 5px;opacity:0}
.switcher-item.on .dot{opacity:1}
.switcher-item code{font-family:var(--font-mono);font-size:10px;color:#5B6577;margin-left:auto}

/* Nav */
.rail-nav{flex:1;overflow-y:auto;padding:4px 8px 12px}
.nav-group{margin-top:14px}
.nav-group:first-child{margin-top:2px}
.nav-legend{
  font-size:9.5px;font-weight:700;color:#4A5361;
  text-transform:uppercase;letter-spacing:.09em;
  padding:0 8px 6px;
}
.nav-item{
  display:flex;align-items:center;gap:10px;
  padding:7.5px 8px;border-radius:var(--radius-sm);
  font-size:12.5px;font-weight:500;color:var(--ink-txt);
  position:relative;
  transition:background .13s var(--ease),color .13s var(--ease);
}
.nav-item:hover{background:var(--ink-800);color:var(--ink-txt-hi)}
.nav-item.on{background:var(--ink-800);color:#fff;font-weight:600}
.nav-item.on::before{
  content:"";position:absolute;left:-8px;top:50%;transform:translateY(-50%);
  width:3px;height:17px;border-radius:0 3px 3px 0;background:var(--accent);
}
.nav-item svg{width:15px;height:15px;flex:0 0 15px;fill:none;stroke:currentColor;
  stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;opacity:.75}
.nav-item.on svg{opacity:1;stroke:#B9AFF5}
.nav-count{
  margin-left:auto;font-size:10px;font-weight:700;font-family:var(--font-mono);
  padding:1px 6px;border-radius:20px;background:var(--bad);color:#fff;line-height:1.6;
}
.nav-count.q{background:var(--ink-700);color:var(--ink-txt)}

/* Rail footer */
.rail-foot{border-top:1px solid var(--ink-800);padding:10px 12px}
.rail-user{display:flex;align-items:center;gap:9px}
.rail-avatar{
  width:28px;height:28px;flex:0 0 28px;border-radius:50%;
  background:linear-gradient(140deg,#3D4A5C,#2A3442);
  display:grid;place-items:center;
  font-size:11px;font-weight:650;color:var(--ink-txt-hi);
}
.rail-user-text{flex:1;min-width:0}
.rail-user-name{font-size:12px;font-weight:550;color:var(--ink-txt-hi);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rail-user-role{font-size:10px;color:#5B6577;margin-top:-1px}
.rail-out{width:15px;height:15px;fill:none;stroke:#5B6577;stroke-width:1.8;
  stroke-linecap:round;stroke-linejoin:round;transition:stroke .13s}
.rail-out:hover{stroke:var(--ink-txt-hi)}

/* ── Main ───────────────────────────────────────────────── */
.main{margin-left:var(--rail-w);flex:1;min-width:0;display:flex;flex-direction:column}

.topbar{
  height:var(--bar-h);flex:0 0 var(--bar-h);
  background:rgba(255,255,255,.82);
  backdrop-filter:saturate(180%) blur(12px);
  -webkit-backdrop-filter:saturate(180%) blur(12px);
  border-bottom:1px solid var(--line);
  display:flex;align-items:center;gap:12px;
  padding:0 24px;position:sticky;top:0;z-index:50;
}
.crumbs{display:flex;align-items:center;gap:7px;font-size:12.5px;color:var(--text-3);min-width:0}
.crumbs a{color:var(--text-2);transition:color .12s}
.crumbs a:hover{color:var(--accent)}
.crumbs .sep{opacity:.45}
.crumbs .here{color:var(--text);font-weight:600;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:420px}
.topbar-fill{flex:1}

.page{padding:22px 24px 40px;flex:1;animation:pageIn .28s var(--ease)}
@keyframes pageIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.page-wide{max-width:none}
.page-narrow{max-width:720px;margin:0 auto}

.page-head{display:flex;align-items:flex-start;gap:16px;margin-bottom:20px}
.page-title{font-size:21px;font-weight:680;letter-spacing:-.022em;line-height:1.25}
.page-lede{font-size:13px;color:var(--text-2);margin-top:3px}
.page-actions{margin-left:auto;display:flex;gap:8px;flex-shrink:0}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  height:34px;padding:0 13px;border-radius:var(--radius-sm);
  font-size:12.5px;font-weight:600;letter-spacing:-.005em;
  border:1px solid transparent;white-space:nowrap;
  transition:background .14s var(--ease),border-color .14s var(--ease),
             box-shadow .14s var(--ease),transform .08s var(--ease);
}
.btn:active{transform:translateY(.5px)}
.btn svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.9;
  stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}

.btn-primary{background:var(--accent);color:#fff;box-shadow:var(--shadow-xs)}
.btn-primary:hover{background:var(--accent-hi);box-shadow:var(--shadow-sm)}

.btn-default{background:var(--surface);color:var(--text);border-color:#D0D5DD;box-shadow:var(--shadow-xs)}
.btn-default:hover{background:var(--surface-2);border-color:#98A2B3}

.btn-ghost{background:transparent;color:var(--text-2)}
.btn-ghost:hover{background:var(--mute-bg);color:var(--text)}

.btn-ok{background:var(--ok);color:#fff}
.btn-ok:hover{background:#055C37}
.btn-bad{background:var(--surface);color:var(--bad);border-color:var(--bad-line)}
.btn-bad:hover{background:var(--bad-bg)}

.btn-sm{height:28px;padding:0 10px;font-size:11.5px;border-radius:6px}
.btn-sm svg{width:12.5px;height:12.5px}
.btn-lg{height:40px;padding:0 18px;font-size:13.5px}
.btn-icon{width:30px;height:30px;padding:0;flex:0 0 30px}
.btn-icon svg{width:15px;height:15px}
.btn-block{width:100%}
.btn:disabled{opacity:.5;pointer-events:none}

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.card{
  background:var(--surface);border:1px solid var(--line);
  border-radius:var(--radius);box-shadow:var(--shadow-xs);
  overflow:hidden;
}
.card + .card{margin-top:16px}

.card-head{
  padding:13px 16px;border-bottom:1px solid var(--line-soft);
  display:flex;align-items:center;gap:12px;
}
.card-title{font-size:13.5px;font-weight:650;letter-spacing:-.01em}
.card-note{font-size:12px;color:var(--text-2);margin-top:1px}
.card-head .spacer{flex:1}
.card-body{padding:16px}
.card-foot{padding:11px 16px;border-top:1px solid var(--line-soft);background:var(--surface-2)}

.grid{display:grid;gap:16px}
.g2{grid-template-columns:repeat(2,minmax(0,1fr))}
.g3{grid-template-columns:repeat(3,minmax(0,1fr))}
.g4{grid-template-columns:repeat(4,minmax(0,1fr))}
.split{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px;align-items:start}

/* ============================================================
   METRICS
   ============================================================ */
.metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(0,1fr));gap:12px;margin-bottom:18px}
.metric{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  padding:14px 15px;position:relative;overflow:hidden;
  transition:border-color .15s var(--ease),box-shadow .15s var(--ease);
}
a.metric:hover{border-color:#C8CDD6;box-shadow:var(--shadow-sm)}
.metric::after{
  content:"";position:absolute;inset:auto 0 0 0;height:2px;
  background:var(--tone,var(--accent));opacity:.85;
}
.metric-k{
  font-size:10px;font-weight:700;color:var(--text-3);
  text-transform:uppercase;letter-spacing:.07em;
}
.metric-v{
  font-size:27px;font-weight:700;letter-spacing:-.03em;line-height:1.1;
  margin-top:7px;font-variant-numeric:tabular-nums;color:var(--tone,var(--text));
}
.metric-n{font-size:11.5px;color:var(--text-3);margin-top:3px}
.m-accent{--tone:var(--accent)}
.m-ok{--tone:var(--ok)}
.m-warn{--tone:var(--warn)}
.m-bad{--tone:var(--bad)}
.m-info{--tone:var(--info)}

/* ============================================================
   LAUNCHER TILES
   ============================================================ */
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(196px,1fr));gap:12px;margin-bottom:22px}
.tile{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  padding:15px;display:flex;flex-direction:column;gap:9px;position:relative;
  transition:border-color .16s var(--ease),box-shadow .16s var(--ease),transform .16s var(--ease);
}
.tile:hover{border-color:var(--accent-line);box-shadow:var(--shadow-md);transform:translateY(-2px)}
.tile-ico{
  width:32px;height:32px;border-radius:8px;display:grid;place-items:center;
  background:var(--mute-bg);color:var(--text-2);
}
.tile-ico svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.75;
  stroke-linecap:round;stroke-linejoin:round}
.tile:hover .tile-ico{background:var(--accent-soft);color:var(--accent)}
.tile-t{font-size:13px;font-weight:640;letter-spacing:-.012em}
.tile-d{font-size:11.5px;color:var(--text-2);line-height:1.45}
.tile-pill{
  position:absolute;top:12px;right:12px;
  font-family:var(--font-mono);font-size:10px;font-weight:700;
  padding:1.5px 6px;border-radius:20px;background:var(--bad);color:#fff;
}
.tile-pill.w{background:var(--warn)}
.tile.feature{
  background:linear-gradient(145deg,var(--accent) 0%,#6E5BE0 55%,#7C6BE8 100%);
  border-color:transparent;color:#fff;
  box-shadow:0 4px 14px -3px rgba(91,75,214,.4);
}
.tile.feature:hover{box-shadow:0 10px 22px -5px rgba(91,75,214,.5)}
.tile.feature .tile-ico{background:rgba(255,255,255,.18);color:#fff}
.tile.feature .tile-d{color:rgba(255,255,255,.82)}
.tile.dark{background:var(--ink-900);border-color:transparent;color:#fff}
.tile.dark .tile-ico{background:var(--ink-800);color:#B9AFF5}
.tile.dark .tile-d{color:var(--ink-txt)}
.tile.dark:hover{box-shadow:0 10px 22px -6px rgba(11,15,23,.45)}

/* ============================================================
   TABLE
   ============================================================ */
.tbl-wrap{overflow-x:auto}
.tbl{width:100%;border-collapse:separate;border-spacing:0;font-size:12.5px}
.tbl thead th{
  text-align:left;padding:9px 14px;background:var(--surface-2);
  font-size:10px;font-weight:700;color:var(--text-3);
  text-transform:uppercase;letter-spacing:.07em;white-space:nowrap;
  border-bottom:1px solid var(--line);
  position:sticky;top:0;z-index:2;
}
.tbl tbody td{padding:11px 14px;border-bottom:1px solid var(--line-soft);vertical-align:middle}
.tbl tbody tr:last-child td{border-bottom:none}
.tbl tbody tr{transition:background .1s}
.tbl tbody tr:hover{background:var(--surface-2)}
.tbl td.num,.tbl th.num{text-align:right;font-variant-numeric:tabular-nums}
.tbl td.tight{width:1%;white-space:nowrap}

/* status edge bar — scan a table by colour alone */
.tbl tbody tr.edge td:first-child{position:relative;padding-left:16px}
.tbl tbody tr.edge td:first-child::before{
  content:"";position:absolute;left:0;top:6px;bottom:6px;width:3px;border-radius:0 3px 3px 0;
  background:var(--edge,transparent);
}
tr.e-ok{--edge:var(--ok)}
tr.e-warn{--edge:var(--warn)}
tr.e-bad{--edge:var(--bad)}
tr.e-info{--edge:var(--info)}
tr.e-mute{--edge:#D0D5DD}

.row-actions{display:flex;gap:4px;opacity:0;transition:opacity .13s}
tr:hover .row-actions{opacity:1}

.lnk{color:var(--accent);font-weight:600;transition:color .12s}
.lnk:hover{color:var(--accent-hi);text-decoration:underline;text-underline-offset:2px}
.docref{font-family:var(--font-mono);font-size:10.5px;color:var(--text-3);letter-spacing:-.01em}
.subtle{color:var(--text-2)}
.faint{color:var(--text-3)}
.mono{font-family:var(--font-mono);font-size:11px}
.nowrap{white-space:nowrap}
.ttl{font-weight:600;letter-spacing:-.008em}

/* File type glyph */
.ftype{
  width:28px;height:28px;flex:0 0 28px;border-radius:6px;
  display:grid;place-items:center;font-family:var(--font-mono);
  font-size:8.5px;font-weight:700;letter-spacing:-.02em;text-transform:uppercase;
}
.ft-pdf{background:#FEF3F2;color:#B42318}
.ft-doc{background:#EFF8FF;color:#175CD3}
.ft-xls{background:#ECFDF3;color:#067647}
.ft-ppt{background:#FFF4ED;color:#B93815}
.ft-img{background:#FDF2FA;color:#C11574}
.ft-eml{background:#FFFAEB;color:#B54708}
.ft-any{background:var(--mute-bg);color:var(--mute)}

.cellstack{display:flex;align-items:center;gap:10px;min-width:0}
.cellstack .txt{min-width:0}

/* ============================================================
   CHIPS / TAGS
   ============================================================ */
.chip{
  display:inline-flex;align-items:center;gap:4px;
  padding:2px 8px;border-radius:20px;
  font-size:11px;font-weight:600;letter-spacing:-.005em;
  border:1px solid transparent;white-space:nowrap;
}
.chip .bullet{width:5px;height:5px;border-radius:50%;background:currentColor;flex-shrink:0}
.c-ok{background:var(--ok-bg);color:var(--ok);border-color:var(--ok-line)}
.c-warn{background:var(--warn-bg);color:var(--warn);border-color:var(--warn-line)}
.c-bad{background:var(--bad-bg);color:var(--bad);border-color:var(--bad-line)}
.c-info{background:var(--info-bg);color:var(--info);border-color:var(--info-line)}
.c-mute{background:var(--mute-bg);color:var(--mute);border-color:var(--mute-line)}
.c-accent{background:var(--accent-soft);color:var(--accent-hi);border-color:var(--accent-line)}

.tagpill{
  display:inline-flex;align-items:center;padding:1.5px 7px;border-radius:5px;
  font-size:10.5px;font-weight:600;background:var(--mute-bg);color:var(--mute);
  border:1px solid var(--line);
}

/* ============================================================
   FORMS
   ============================================================ */
.field{margin-bottom:15px}
.label{
  display:block;font-size:11.5px;font-weight:650;color:var(--text);
  margin-bottom:6px;letter-spacing:-.005em;
}
.label .opt{color:var(--text-3);font-weight:450;margin-left:3px}
.hint{font-size:11.5px;color:var(--text-3);margin-top:5px;line-height:1.45}

.input,.select,.textarea{
  width:100%;height:36px;padding:0 11px;
  background:var(--surface);border:1px solid #D0D5DD;border-radius:var(--radius-sm);
  font-size:13px;color:var(--text);box-shadow:var(--shadow-xs);
  transition:border-color .14s var(--ease),box-shadow .14s var(--ease);
}
.textarea{height:auto;padding:9px 11px;resize:vertical;min-height:72px;line-height:1.5}
.input::placeholder,.textarea::placeholder{color:var(--text-3)}
.input:hover,.select:hover,.textarea:hover{border-color:#98A2B3}
.input:focus,.select:focus,.textarea:focus{
  outline:none;border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accent-soft);
}
.select{
  appearance:none;cursor:pointer;padding-right:32px;
  background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 10px center;
}
.row{display:grid;gap:14px}
.row-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.row-3{grid-template-columns:repeat(3,minmax(0,1fr))}

/* Search input with leading glyph */
.searchbox{position:relative;flex:1;min-width:0}
.searchbox svg{
  position:absolute;left:11px;top:50%;transform:translateY(-50%);
  width:15px;height:15px;fill:none;stroke:var(--text-3);stroke-width:2;
  stroke-linecap:round;stroke-linejoin:round;pointer-events:none;
}
.searchbox .input{padding-left:34px}

/* Dropzone */
.drop{
  border:1.5px dashed #CDD3DE;border-radius:var(--radius);
  background:var(--surface-2);padding:30px 20px;text-align:center;cursor:pointer;
  transition:border-color .16s var(--ease),background .16s var(--ease);
}
.drop:hover,.drop.hot{border-color:var(--accent);background:var(--accent-soft)}
.drop-ico{
  width:42px;height:42px;margin:0 auto 11px;border-radius:11px;
  background:var(--surface);border:1px solid var(--line);
  display:grid;place-items:center;box-shadow:var(--shadow-sm);
}
.drop-ico svg{width:20px;height:20px;fill:none;stroke:var(--accent);stroke-width:1.8;
  stroke-linecap:round;stroke-linejoin:round}
.drop-t{font-size:13.5px;font-weight:600}
.drop-t em{color:var(--accent);font-style:normal;text-decoration:underline;text-underline-offset:2px}
.drop-d{font-size:11.5px;color:var(--text-3);margin-top:4px}

.filelist{margin-top:11px;display:flex;flex-direction:column;gap:6px}
.fileitem{
  display:flex;align-items:center;gap:10px;padding:8px 11px;
  background:var(--surface-2);border:1px solid var(--line);border-radius:7px;
  font-size:12px;animation:pageIn .2s var(--ease);
}
.fileitem .nm{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:550}
.fileitem .sz{font-family:var(--font-mono);font-size:10.5px;color:var(--text-3)}

/* ============================================================
   NOTICES
   ============================================================ */
.notice{
  display:flex;gap:10px;padding:12px 14px;border-radius:var(--radius-sm);
  font-size:12.5px;margin-bottom:16px;border:1px solid;line-height:1.5;
  animation:pageIn .22s var(--ease);
}
.notice svg{width:16px;height:16px;flex:0 0 16px;margin-top:1px;fill:none;
  stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.notice a{font-weight:650;text-decoration:underline;text-underline-offset:2px}
.n-ok,.notice.success{background:var(--ok-bg);color:var(--ok);border-color:var(--ok-line)}
.n-warn,.notice.warning{background:var(--warn-bg);color:var(--warn);border-color:var(--warn-line)}
.n-bad,.notice.error{background:var(--bad-bg);color:var(--bad);border-color:var(--bad-line)}
.n-info,.notice.info{background:var(--info-bg);color:var(--info);border-color:var(--info-line)}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.blank{padding:44px 24px;text-align:center}
.blank-ico{
  width:46px;height:46px;margin:0 auto 13px;border-radius:12px;
  background:var(--mute-bg);display:grid;place-items:center;
}
.blank-ico svg{width:21px;height:21px;fill:none;stroke:var(--text-3);stroke-width:1.6;
  stroke-linecap:round;stroke-linejoin:round}
.blank-t{font-size:14px;font-weight:640;letter-spacing:-.01em}
.blank-d{font-size:12.5px;color:var(--text-2);margin-top:4px;max-width:340px;
  margin-left:auto;margin-right:auto;line-height:1.5}
.blank .btn{margin-top:15px}

/* ============================================================
   SIGNATURE — Custody ribbon
   The document's life as a connected chain. This is the one
   element the system is remembered by.
   ============================================================ */
.custody{
  display:flex;align-items:flex-start;gap:0;padding:18px 16px 14px;
  overflow-x:auto;
}
.cstep{display:flex;flex-direction:column;align-items:center;gap:7px;
  min-width:88px;flex-shrink:0;position:relative}
.cnode{
  width:30px;height:30px;border-radius:50%;display:grid;place-items:center;
  border:2px solid var(--line);background:var(--surface);
  font-size:11px;font-weight:700;color:var(--text-3);z-index:2;
  transition:transform .2s var(--ease);
}
.cnode svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2.2;
  stroke-linecap:round;stroke-linejoin:round}
.cstep.done .cnode{background:var(--ok-bg);border-color:var(--ok);color:var(--ok)}
.cstep.live .cnode{
  background:var(--accent-soft);border-color:var(--accent);color:var(--accent);
  box-shadow:0 0 0 4px var(--accent-soft);
}
.cstep.live .cnode{animation:pulseNode 2.4s var(--ease) infinite}
@keyframes pulseNode{
  0%,100%{box-shadow:0 0 0 4px var(--accent-soft)}
  50%{box-shadow:0 0 0 7px rgba(91,75,214,.10)}
}
.cstep.stop .cnode{background:var(--bad-bg);border-color:var(--bad);color:var(--bad)}
.clabel{font-size:11px;font-weight:600;text-align:center;letter-spacing:-.005em}
.cmeta{font-size:10px;color:var(--text-3);text-align:center;line-height:1.35}
.cwire{flex:1;height:2px;background:var(--line);margin-top:14px;min-width:22px;border-radius:2px}
.cwire.lit{background:var(--ok)}

/* ============================================================
   ACTIVITY FEED
   ============================================================ */
.feed{padding:4px 16px 6px}
.fitem{display:flex;gap:11px;padding:9px 0;border-bottom:1px solid var(--line-soft)}
.fitem:last-child{border-bottom:none}
.fdot{
  width:26px;height:26px;flex:0 0 26px;border-radius:7px;display:grid;place-items:center;
  background:var(--mute-bg);color:var(--mute);margin-top:1px;
}
.fdot svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.9;
  stroke-linecap:round;stroke-linejoin:round}
.fdot.ok{background:var(--ok-bg);color:var(--ok)}
.fdot.bad{background:var(--bad-bg);color:var(--bad)}
.fdot.info{background:var(--info-bg);color:var(--info)}
.fdot.warn{background:var(--warn-bg);color:var(--warn)}
.fdot.accent{background:var(--accent-soft);color:var(--accent)}
.fbody{flex:1;min-width:0}
.ftext{font-size:12.5px;line-height:1.4}
.fmeta{font-size:11px;color:var(--text-3);margin-top:1px}
.ftime{font-size:10.5px;color:var(--text-3);white-space:nowrap;flex-shrink:0;
  font-variant-numeric:tabular-nums}

/* ============================================================
   DEFINITION LIST (detail panes)
   ============================================================ */
.dl{display:grid;grid-template-columns:118px minmax(0,1fr);gap:0}
.dl dt{
  font-size:11.5px;color:var(--text-3);font-weight:600;
  padding:8px 0;border-bottom:1px solid var(--line-soft);
}
.dl dd{
  font-size:12.5px;padding:8px 0;border-bottom:1px solid var(--line-soft);
  min-width:0;word-break:break-word;
}
.dl dt:last-of-type,.dl dd:last-of-type{border-bottom:none}

/* Comments */
.note{padding:11px 16px;border-bottom:1px solid var(--line-soft)}
.note:last-child{border-bottom:none}
.note-head{display:flex;align-items:center;gap:8px;margin-bottom:5px}
.note-av{
  width:22px;height:22px;flex:0 0 22px;border-radius:50%;
  background:var(--accent-soft);color:var(--accent-hi);
  display:grid;place-items:center;font-size:9.5px;font-weight:700;
}
.note-who{font-size:12px;font-weight:640}
.note-when{font-size:10.5px;color:var(--text-3);margin-left:auto}
.note-text{font-size:12.5px;color:var(--text);line-height:1.5;padding-left:30px}

/* Filter bar */
.filters{display:flex;gap:8px;flex-wrap:wrap;align-items:flex-end}
.filters .field{margin-bottom:0}
.filters .input,.filters .select{height:34px;font-size:12.5px}

/* Segmented control */
.seg{display:inline-flex;background:var(--mute-bg);border-radius:8px;padding:2.5px;gap:2px}
.seg a{
  padding:5px 12px;border-radius:6px;font-size:12px;font-weight:600;color:var(--text-2);
  transition:background .14s var(--ease),color .14s var(--ease);
}
.seg a:hover{color:var(--text)}
.seg a.on{background:var(--surface);color:var(--text);box-shadow:var(--shadow-xs)}

/* Progress meter */
.meter{height:5px;border-radius:3px;background:var(--mute-bg);overflow:hidden;min-width:70px}
.meter i{display:block;height:100%;border-radius:3px;background:var(--tone,var(--accent));
  transition:width .5s var(--ease)}

.sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;
  clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media(max-width:1180px){
  .split{grid-template-columns:1fr}
  .g4{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:920px){
  .rail{transform:translateX(-100%);transition:transform .24s var(--ease)}
  .rail.show{transform:none;box-shadow:var(--shadow-pop)}
  .main{margin-left:0}
  .g2,.g3,.row-2,.row-3{grid-template-columns:1fr}
  .page{padding:16px 14px 32px}
  .topbar{padding:0 14px}
  .railtoggle{display:inline-flex !important}
}
.railtoggle{display:none}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;
    transition-duration:.01ms !important}
}

@media print{
  .rail,.topbar,.page-actions,.row-actions{display:none !important}
  .main{margin-left:0}
  .card{border-color:#ccc;box-shadow:none}
}
