/* «Муҳр» base: the elements and components every workspace screen shares.

   Restyles the existing selectors — the screens and their tests address them
   by these names — so nothing has to be renamed to change how it looks.
   Surfaces, tables and panels keep square corners (the ledger look);
   controls take 4px; only the avatar and the seal are round. */

/* ═══ elements ═══════════════════════════════════════════════════ */
body{background:var(--bg);color:var(--ink);font-family:var(--body)}
select option{background:var(--surface);color:var(--ink)}
:focus-visible{outline:none;box-shadow:var(--focus)}
td.l{font-family:var(--body)}
td,.mono,code,kbd{font-variant-numeric:tabular-nums}

/* ═══ buttons ═══════════════════════════════════════════════════ */
.b{min-height:34px;padding:7px 14px;border-radius:4px;border-color:var(--rule-2);
  background:var(--surface);font-weight:500;transition:background .12s,border-color .12s}
.b:hover:not(:disabled){background:var(--hover);border-color:var(--rule-2);color:var(--ink)}
.b:disabled{opacity:1;background:var(--sunk);color:var(--ink-4);border-color:var(--rule)}
.b.pri{background:var(--primary);border-color:var(--primary);color:var(--on-primary)}
.b.pri:hover:not(:disabled){background:var(--primary-hover);border-color:var(--primary-hover);
  color:var(--on-primary);filter:none}
.b.pri:active:not(:disabled){background:var(--primary-press)}
.b.br{background:var(--accent);border-color:var(--accent-line);color:var(--on-accent)}
.b.br:hover:not(:disabled){background:var(--accent);filter:brightness(1.05);color:var(--on-accent)}
.b.dng{color:var(--danger)}
.b.dng:hover:not(:disabled){background:var(--danger-bg);border-color:var(--danger);color:var(--danger)}
.b.sm{min-height:30px;padding:5px 10px}
.tbtn{border-radius:4px}

/* ═══ fields ════════════════════════════════════════════════════ */
.fld input,.fld select,.fld textarea,.srch{border-radius:4px;border-color:var(--rule-2);
  background:var(--surface)}
.fld input:hover,.fld select:hover,.fld textarea:hover{border-color:var(--ink-4)}
.fld input:focus,.fld select:focus,.fld textarea:focus,.srch:focus-within{
  border-color:var(--primary);box-shadow:var(--focus);outline:none}
.fld.bad input,.fld.bad select,.fld.bad textarea{border-color:var(--danger)}
/* One select everywhere: the browser's own, our chevron; the open list stays the system's. */
select:not([multiple]):not([size]){appearance:none;-webkit-appearance:none;padding-right:32px;text-overflow:ellipsis;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%238A93A1' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 10px center;background-size:12px}
select:disabled{background-color:var(--sunk);color:var(--ink-3);cursor:not-allowed}
.fld.bad select,.fld.bad input{border-width:2px}
optgroup{font-weight:600;color:var(--ink-3)}

/* ═══ segmented control and tabs ════════════════════════════════ */
.seg3{border-radius:4px;overflow:hidden}
.seg3 button.on{background:var(--primary);color:var(--on-primary)}

/* ═══ status chips: a glyph beside the colour, so no state is told by colour
   alone ═══ */
.chip,.badge{font-family:var(--body);font-size:11px;font-weight:500;border-radius:4px;
  padding:1px 7px;line-height:18px;display:inline-flex;align-items:center;gap:5px}
.chip::before,.badge::before{font-family:var(--body);font-size:10px;line-height:1}
.chip.ok,.badge.ok{border-color:color-mix(in srgb,var(--ok) 35%,transparent);background:var(--ok-bg);color:var(--ok)}
.chip.ok::before,.badge.ok::before{content:"✓"}
.chip.wait,.badge.warn{border-color:var(--warn-line);background:var(--warn-bg);color:var(--warn)}
.chip.wait::before,.badge.warn::before{content:"◔"}
.chip.no{border-color:color-mix(in srgb,var(--reject) 35%,transparent);background:var(--reject-bg);color:var(--reject)}
.chip.no::before{content:"✕"}
.chip.mut{border-style:dashed;color:var(--draft);background:var(--draft-bg)}
.chip.mut::before{content:"○"}
.chip.sign::before{content:"✒"}
.chip.late{border-color:var(--danger);background:var(--danger);color:var(--on-danger)}
.chip.late::before{content:"!"}
.chip.reg,.badge.mod{border-color:var(--info-line);background:var(--info-bg);color:var(--info)}
.chip.reg::before,.badge.mod::before{content:"▣"}
.chip.br,.badge.br{border-color:var(--accent-line);background:var(--accent-soft);color:var(--accent-deep)}

/* Type chips: the kind of document, in the document's own colour. */
.tchip{font-family:var(--mono);font-size:11px;font-weight:600;letter-spacing:.04em;
  padding:0 6px;line-height:18px;border:1px solid;border-radius:2px;display:inline-block}
.tchip.jr{color:var(--type-jr)} .tchip.sp{color:var(--type-sp)} .tchip.ot{color:var(--type-ot)}
.tchip.zd{color:var(--type-zd)} .tchip.ns{color:var(--type-ns)}
.tchip{border-color:color-mix(in srgb,currentColor 40%,transparent)}

/* ═══ notes ═════════════════════════════════════════════════════ */
.note{border-radius:0}
.note.brand{border-color:var(--accent-line);background:var(--accent-soft);color:var(--ink)}
.note.warn{border-color:var(--warn-line);background:var(--warn-bg)}

/* ═══ seal ══════════════════════════════════════════════════════ */
.seal{display:inline-block;flex:0 0 auto}
.seal-ring{fill:none;stroke:var(--seal);stroke-width:1.5}
.seal-text{fill:var(--seal-ink);font-family:var(--mono);font-size:8px;letter-spacing:.08em}
.seal-star{fill:none;stroke:var(--seal);stroke-width:1.5}
.seal-core{fill:var(--accent)}
.seal--revoked{filter:grayscale(1);opacity:.7}
@media (prefers-reduced-motion:no-preference){
  .seal--fresh{animation:seal-in .22s ease-out both}
  @keyframes seal-in{from{transform:scale(1.12);opacity:0}to{transform:scale(1);opacity:.86}}
}

/* ═══ shell ═════════════════════════════════════════════════════ */
.top{border-bottom-color:var(--rule)}
.t1{min-height:48px;padding:6px 16px}
.secs{background:var(--bg);border-top:1px solid var(--rule);min-height:40px;padding:0 8px}
.sec{padding:10px 14px 9px;font-size:14px;font-weight:500;border-bottom:3px solid transparent}
.sec.on{border-bottom-color:var(--accent)}
.sec .n{border-radius:999px;padding:0 6px;font-size:11px}
.main{grid-template-columns:260px 1fr}
.ng{font-family:var(--body);font-size:11px;font-weight:600;letter-spacing:.06em;padding:14px 16px 6px}
.nl{min-height:36px;padding:6px 12px 6px 16px;font-size:13.5px;border-left-width:3px}
.nl:hover{background:var(--hover);border-left-color:transparent}
.nl.on{background:var(--sel);border-left-color:var(--primary)}
.nl .nb{font-size:12px}
.nl .nb.hot{border-radius:999px;padding:0 6px}
.tab.on{box-shadow:inset 0 -2px 0 var(--accent)}
/* Navigation icons: one stroke set from /static/icons/nav.svg, the colour of
   the text beside them; a wrapped label keeps its icon on the first line. */
.ni{width:16px;height:16px;flex:0 0 16px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.sec{display:inline-flex;align-items:center;gap:7px}
.nl{gap:9px;align-items:flex-start;line-height:1.35}
.nl .ni{color:var(--ink-3);margin-top:1px}
.nl:hover .ni,.nl.on .ni{color:var(--ink)}
.ng{display:flex;align-items:center;gap:8px;padding:16px 15px 6px}
.ng::after{content:"";flex:1;height:1px;background:var(--rule)}
.ng:first-child{padding-top:8px}
.ava{border-radius:999px}

/* ═══ theme switch (user menu) ═══════════════════════════════════ */
.theme-switch{padding:0 0 8px}
.theme-switch .seg3{display:flex;margin:0 10px}
.theme-switch .seg3 label{flex:1;text-align:center;padding:5px 8px;font-size:12px;cursor:pointer;
  border:1px solid var(--rule-2);margin-left:-1px}
.theme-switch .seg3 label.on{background:var(--primary);border-color:var(--primary);color:var(--on-primary)}
.theme-switch .seg3 input{position:absolute;opacity:0;pointer-events:none}
.theme-switch .seg3 label:has(input:focus-visible){box-shadow:var(--focus)}
.theme-switch noscript .b{margin:8px 10px 0}
