/* =============================================================================
   Audit Safe Vault — Design System
   Tokens · Base Resets · Primitives · Utilities
   =============================================================================
   Usage: import this file before layout.css in every HTML file.
   This file defines the "what" (visual language), not the "where" (layout).
   ============================================================================= */

/* ============================================================
   1. DESIGN TOKENS — CSS custom properties
   ============================================================ */
:root {
  /* Surfaces */
  --bg:       #fafafa;
  --panel:    #ffffff;
  --panel-2:  #f4f4f5;
  --panel-3:  #fcfcfd;

  /* Borders */
  --line:   #e4e4e7;
  --line-2: #d4d4d8;

  /* Ink / text */
  --ink:    #18181b;
  --ink-2:  #3f3f46;
  --muted:  #71717a;
  --muted-2:#a1a1aa;

  /* Accent — blue (oklch hue 250) */
  --accent:     oklch(0.55 0.14 250);
  --accent-soft:oklch(0.96 0.03 250);
  --accent-ink: oklch(0.35 0.14 250);

  /* Warning — amber */
  --warn:     oklch(0.70 0.14 75);
  --warn-soft:oklch(0.96 0.04 85);
  --warn-ink: oklch(0.42 0.14 75);

  /* Danger — red */
  --danger:     oklch(0.60 0.18 25);
  --danger-soft:oklch(0.96 0.04 25);
  --danger-ink: oklch(0.40 0.18 25);

  /* OK — green */
  --ok:     oklch(0.62 0.13 155);
  --ok-soft:oklch(0.96 0.04 155);
  --ok-ink: oklch(0.36 0.13 155);

  /* Neutral grey (for draft status) */
  --gray-soft:#f1f1f3;
  --gray-ink: #52525b;

  /* Archive state */
  --archive:     oklch(0.45 0.02 250);
  --archive-soft:oklch(0.94 0.01 250);
  --archive-ink: oklch(0.30 0.02 250);

  /* Categorical palette — segmented usage bars / breakdown legends.
     Calm, similar lightness/chroma so no single segment shouts. */
  --seg-1: oklch(0.55 0.12 255);
  --seg-2: oklch(0.62 0.13 155);
  --seg-3: oklch(0.70 0.13 75);
  --seg-4: oklch(0.58 0.14 320);
  --seg-5: oklch(0.64 0.11 195);
  --seg-6: oklch(0.60 0.13 30);
  --seg-7: oklch(0.50 0.04 270);

  /* Border radius */
  --radius-sm:4px;
  --radius:   6px;
  --radius-lg:10px;

  /* Typography */
  --sans:"Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ============================================================
   2. BASE RESETS
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ============================================================
   3. TYPOGRAPHY UTILITIES
   ============================================================ */
.mono      { font-family: var(--mono); }
.muted     { color: var(--muted); }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}
.hr { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* ============================================================
   4. LAYOUT UTILITIES
   ============================================================ */
.grow     { flex: 1; min-width: 0; }
.row      { display: flex; align-items: center; gap: 8px; }
.col      { display: flex; flex-direction: column; gap: 8px; }
.spread   { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.stack-md { display: flex; flex-direction: column; gap: 14px; }

/* ============================================================
   5. AVATAR
   ============================================================ */
.avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 9.5px; font-weight: 600;
  color: var(--ink-2);
  flex-shrink: 0;
}
.avatar.sm { width: 20px; height: 20px; font-size: 9px; }
.avatar.md { width: 28px; height: 28px; font-size: 10.5px; }
.avatar.lg { width: 36px; height: 36px; font-size: 12px; }
/* Avatar color palette (hashed from user id) */
.avatar.a0 { background: oklch(0.62 0.14 250); color: #fff; border-color: transparent; }
.avatar.a1 { background: oklch(0.65 0.15 25);  color: #fff; border-color: transparent; }
.avatar.a2 { background: oklch(0.55 0.12 180); color: #fff; border-color: transparent; }
.avatar.a3 { background: oklch(0.55 0.16 290); color: #fff; border-color: transparent; }
.avatar.a4 { background: oklch(0.58 0.14 145); color: #fff; border-color: transparent; }
.avatar.a5 { background: oklch(0.55 0.15 50);  color: #fff; border-color: transparent; }
.avatar.a6 { background: oklch(0.52 0.14 320); color: #fff; border-color: transparent; }
.avatar-stack { display: flex; }
.avatar-stack > * { margin-left: -6px; box-shadow: 0 0 0 2px #fff; }
.avatar-stack > *:first-child { margin-left: 0; }

/* ============================================================
   6. ENTITY MARK
   ============================================================ */
.ent-mark {
  width: 36px; height: 36px;
  border-radius: 7px;
  display: grid; place-items: center;
  font-family: var(--mono);
  font-weight: 700; font-size: 11px;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: .02em;
}
.ent-mark.lg { width: 48px; height: 48px; font-size: 14px; border-radius: 9px; }

/* ============================================================
   7. BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-2); border-color: var(--line-2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { background: oklch(0.55 0.13 155); }
.btn.danger { background: #fff; border-color: var(--danger-soft); color: var(--danger-ink); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.solid:hover { background: oklch(0.54 0.18 25); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); }
.btn.warn { background: var(--warn-soft); border-color: var(--warn-soft); color: var(--warn-ink); }
.btn.warn:hover { background: oklch(0.92 0.07 80); border-color: oklch(0.92 0.07 80); }
.btn.sm  { padding: 5px 9px;   font-size: 11.5px; gap: 5px; }
.btn.lg  { padding: 9px 16px;  font-size: 13.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  display: grid; place-items: center;
  color: var(--ink-2);
  cursor: pointer;
  position: relative; flex-shrink: 0;
}
.icon-btn:hover { background: var(--panel-2); }
.icon-btn .pin {
  position: absolute; top: 6px; right: 7px;
  min-width: 14px; height: 14px; padding: 0 3px;
  border-radius: 8px;
  background: var(--danger); color: #fff;
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  display: grid; place-items: center; line-height: 1;
}
.icon-btn-xs {
  width: 22px; height: 22px;
  border-radius: 4px; border: 0;
  background: transparent;
  display: grid; place-items: center;
  color: var(--muted); cursor: pointer;
}
.icon-btn-xs:hover { background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.icon-btn-xs.danger:hover { color: var(--danger-ink); }

/* ============================================================
   8. INPUTS & FORM FIELDS
   ============================================================ */
.input {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 220px;
}
.input input {
  border: 0; outline: 0;
  background: transparent;
  flex: 1; font-size: 12.5px; padding: 0; width: 100%;
}
.input:focus-within { border-color: var(--ink); }
.input.full { width: 100%; }

.kbd {
  display: inline-block;
  padding: 1px 5px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  font-family: var(--mono); font-size: 10px;
  color: var(--muted);
}

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field label .req { color: var(--danger-ink); margin-left: 3px; }
.field .help { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.field .err { font-size: 11.5px; color: var(--danger-ink); margin-top: 5px; display: flex; align-items: center; gap: 5px; }
.field input[type=text],
.field input[type=password],
.field input[type=email],
.field input[type=number],
.field textarea,
.field select {
  width: 100%; padding: 8px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0; font-size: 13px; color: var(--ink);
}
.field input[type=text]:focus,
.field input[type=password]:focus,
.field input[type=email]:focus,
.field textarea:focus,
.field select:focus { border-color: var(--ink); }

/* Password field with show/hide toggle */
.field .pw-wrap { position: relative; }
.field .pw-wrap input[type=text],
.field .pw-wrap input[type=password] { padding-right: 38px; }
.field .pw-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  background: none; border: 0; border-radius: 6px;
  color: var(--muted); cursor: pointer;
}
.field .pw-toggle:hover { background: var(--panel-2); color: var(--ink-2); }
.field textarea { min-height: 80px; resize: vertical; font-family: inherit; line-height: 1.5; }
.field .input-row { display: flex; gap: 8px; }

/* ============================================================
   9. CHIPS & TOGGLES
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12px; color: var(--ink-2);
  cursor: pointer;
}
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip:hover:not(.active) { background: var(--panel-2); }

.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--ink-2);
}
.toggle .knob {
  width: 30px; height: 18px;
  border-radius: 999px;
  background: var(--panel-2);
  position: relative; transition: background .15s;
}
.toggle .knob::after {
  content: ""; position: absolute;
  left: 2px; top: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform .15s;
}
.toggle.bare { padding: 0; gap: 0; border: none; background: transparent; }   /* knob only — no pill frame */
.toggle.on { border-color: var(--ink); }
.toggle.on .knob { background: var(--ink); }
.toggle.on .knob::after { transform: translateX(12px); }

/* ============================================================
   10. STATUS BADGES
   ============================================================ */
/* Large status badge (icon + label) */
.sbadge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 1.3;
}
.sbadge.draft    { background: var(--gray-soft);    color: var(--gray-ink); }
.sbadge.pending  { background: var(--warn-soft);    color: var(--warn-ink); }
.sbadge.active   { background: var(--ok-soft);      color: var(--ok-ink); }
.sbadge.rejected,
.sbadge.rejected-soft { background: var(--danger-soft); color: var(--danger-ink); }
.sbadge.archived { background: var(--archive-soft); color: var(--archive-ink); }
/* Tone variants used by WPID status + RiskBadge — these were missing entirely,
   which left those badges colourless. Hairline border in the full-strength tone
   keeps them clearly readable against white rows. */
.sbadge.ok     { background: var(--ok-soft);     color: var(--ok-ink);     border: 1px solid var(--ok); }
.sbadge.warn   { background: var(--warn-soft);   color: var(--warn-ink);   border: 1px solid var(--warn); }
.sbadge.accent { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent); }
.sbadge.danger { background: var(--danger-soft); color: var(--danger-ink); border: 1px solid var(--danger); }
.sbadge.lg { padding: 5px 12px 5px 10px; font-size: 12.5px; }
.sbadge svg { flex-shrink: 0; }

/* Small badge (label only) */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px; font-weight: 500;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.solid  { background: var(--ink);          color: #fff;             border-color: var(--ink); }
.badge.accent { background: var(--accent-soft);  color: var(--accent-ink);border-color: transparent; }
.badge.ok     { background: var(--ok-soft);      color: var(--ok-ink);    border-color: transparent; }
.badge.warn   { background: var(--warn-soft);    color: var(--warn-ink);  border-color: transparent; }
.badge.danger { background: var(--danger-soft);  color: var(--danger-ink);border-color: transparent; }
.badge .dot   { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* declined badge variant for access requests */
.badge.declined { background: var(--danger-soft); color: var(--danger-ink); border-color: transparent; }

/* ============================================================
   11. CARDS
   ============================================================ */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-title { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-sub   { font-size: 12px; color: var(--muted); margin-top: 3px; }
.card-body  { padding: 18px; }
.card-body.flush { padding: 0; }

/* Usage meter — thin progress bar (read-only usage display) */
.meter { height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; display: flex; }
.meter-fill { height: 100%; background: var(--ink); transition: width .3s ease; }
.meter-fill.ok     { background: var(--ok); }
.meter-fill.warn   { background: var(--warn); }
.meter-fill.danger { background: var(--danger); }
.meter-fill.unlim  { background: var(--accent); }
/* Segmented meter — each piece a category; hairline separator between them */
.meter-seg { height: 100%; transition: width .3s ease; box-shadow: 1px 0 0 #fff; }
.meter-seg:last-child { box-shadow: none; }
/* Breakdown legend */
.seg-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.seg-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-2); }
.seg-dot  { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.seg-item .seg-n { font-family: var(--mono); color: var(--muted); }

/* ============================================================
   12. TABLES
   ============================================================ */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
/* Scroll container for wide tables — stops action buttons / last columns
   being clipped at narrower viewports */
.tbl-wrap { overflow-x: auto; }
.tbl th {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 500; font-size: 10.5px; color: var(--muted);
  background: var(--panel-3);
  text-transform: uppercase; letter-spacing: .05em;
  font-family: var(--mono);
}
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover { background: var(--panel-3); }

/* ============================================================
   13. MODAL & DRAWER
   ============================================================ */
.modal-veil {
  position: fixed; inset: 0;
  background: rgba(15,15,17,.36);
  z-index: 200;
  display: grid; place-items: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%; max-width: 480px;
  box-shadow: 0 24px 60px rgba(0,0,0,.18);
  overflow: hidden;
  animation: ds-pop .15s ease-out;
}
.modal.lg { max-width: 560px; }
.modal-head {
  padding: 18px 22px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; }
.modal-body {
  padding: 20px 22px;
  font-size: 13px; line-height: 1.55; color: var(--ink-2);
}
.modal-foot {
  padding: 14px 22px;
  display: flex; justify-content: flex-end; gap: 8px;
  border-top: 1px solid var(--line);
  background: var(--panel-3);
}
@keyframes ds-pop {
  from { opacity: 0; transform: translateY(6px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.drawer-veil { position: fixed; inset: 0; background: rgba(15,15,17,.32); z-index: 180; }
.drawer {
  position: fixed; top: 0; right: 0;
  height: 100vh; width: 440px;
  background: #fff;
  border-left: 1px solid var(--line);
  z-index: 181;
  display: flex; flex-direction: column;
  animation: ds-slide .18s ease-out;
  box-shadow: -16px 0 40px rgba(0,0,0,.06);
}
.drawer.wide { width: 640px; }
.drawer-head {
  padding: 16px 22px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h3 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; }
.drawer-body  { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-foot {
  padding: 14px 22px;
  display: flex; justify-content: space-between; gap: 8px;
  border-top: 1px solid var(--line);
  background: var(--panel-3);
}
@keyframes ds-slide {
  from { transform: translateX(20px); opacity: .4; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ============================================================
   14. TOAST
   ============================================================ */
.toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translateX(-50%);
  z-index: 300;
  background: var(--ink); color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  display: flex; align-items: center; gap: 9px;
  box-shadow: 0 12px 30px rgba(0,0,0,.2);
  animation: ds-fade .2s;
}
.toast.ok   { background: var(--ok-ink); }
.toast.warn { background: var(--warn-ink); }
@keyframes ds-fade {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============================================================
   15. TIMELINE (entity edit history)
   ============================================================ */
/* Timeline — icon indicator + connecting separator + date / title / description
   (modeled on the Nuxt UI Timeline component). */
.tl { display: flex; flex-direction: column; }
.tl-ev { display: flex; gap: 12px; }
/* Indicator column — circular icon node with a connecting line below it */
.tl-node { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.tl-ind {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.tl-ev.ok     .tl-ind { background: var(--ok);     color: #fff; border-color: var(--ok); }
.tl-ev.warn   .tl-ind { background: var(--warn);   color: #fff; border-color: var(--warn); }
.tl-ev.danger .tl-ind { background: var(--danger); color: #fff; border-color: var(--danger); }
.tl-ev.draft  .tl-ind { background: var(--ink);    color: #fff; border-color: var(--ink); }
.tl-ev:not(:last-child) .tl-node::after {
  content: ""; width: 2px; flex: 1; min-height: 14px;
  background: var(--line); border-radius: 999px; margin: 4px 0;
}
/* Content column */
.tl-content { min-width: 0; padding-bottom: 18px; }
.tl-ev:last-child .tl-content { padding-bottom: 2px; }
.tl-date  { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); }
.tl-title { font-weight: 600; font-size: 12.5px; color: var(--ink); margin-top: 1px; }
.tl-title .tl-act { font-weight: 400; color: var(--muted); }
.tl-desc  { color: var(--ink-2); font-size: 12px; margin-top: 3px; line-height: 1.5; }

/* ============================================================
   16. BANNER
   ============================================================ */
.banner {
  display: flex; gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: #fff;
  align-items: flex-start;
  margin-bottom: 16px;
}
.banner .b-ico {
  flex-shrink: 0; width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
}
.banner .b-body   { flex: 1; font-size: 12.5px; line-height: 1.5; }
.banner .b-title  { font-weight: 600; color: var(--ink); font-size: 13px; display: block; margin-bottom: 2px; }
.banner.warn      { background: var(--warn-soft);   border-color: transparent; }
.banner.warn .b-ico { background: rgba(255,255,255,.5);  color: var(--warn-ink); }
.banner.danger    { background: var(--danger-soft); border-color: transparent; }
.banner.danger .b-ico { background: rgba(255,255,255,.55); color: var(--danger-ink); }
.banner.danger .b-title { color: var(--danger-ink); }
.banner.info      { background: var(--accent-soft); border-color: transparent; }
.banner.info .b-ico { background: rgba(255,255,255,.55); color: var(--accent-ink); }
.banner.muted     { background: var(--panel-2); }
.banner.muted .b-ico { background: #fff; color: var(--muted); }

/* ============================================================
   17. EMPTY STATE
   ============================================================ */
.empty { padding: 64px 24px; text-align: center; color: var(--muted); }
.empty .em-illu {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--panel-2);
  display: grid; place-items: center;
  margin: 0 auto 14px;
  color: var(--muted-2);
}
.empty .em-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.empty .em-sub   { font-size: 12.5px; color: var(--muted); max-width: 380px; margin: 0 auto 16px; }

/* ============================================================
   18. KV (key-value detail pairs)
   ============================================================ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
  align-items: start;
}
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 12px 16px; font-size: 13px; }
.kv dt {
  color: var(--muted); font-weight: 500;
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .04em;
  padding-top: 2px;
}
.kv dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }

/* ============================================================
   19. USER PICKER (member chips in form)
   ============================================================ */
.usr-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 50px;
}
.usr-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 3px;
  background: var(--panel-2);
  border-radius: 999px;
  font-size: 12px;
}
.usr-chip .x {
  cursor: pointer; color: var(--muted);
  width: 16px; height: 16px;
  display: grid; place-items: center;
  border-radius: 50%;
}
.usr-chip .x:hover { background: #fff; color: var(--ink); }
.usr-chip .avatar { width: 20px; height: 20px; font-size: 9px; }
.usr-picker-add {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  background: #fff;
  border: 1px dashed var(--line-2);
  border-radius: 999px;
  font-size: 11.5px; color: var(--muted);
  cursor: pointer;
}
.usr-picker-add:hover { border-color: var(--ink); color: var(--ink); }

/* ============================================================
   20. TREE (folder structure)
   ============================================================ */
.tree { padding: 4px 0; font-size: 12.5px; }
.tree-node { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: var(--radius-sm); color: var(--ink-2); }
.tree-node:hover { background: var(--panel-2); }
.tree-node .chev { color: var(--muted-2); width: 14px; display: inline-flex; }
.tree-kids { margin-left: 18px; border-left: 1px dashed var(--line); padding-left: 8px; }
.tree-meta { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

/* ============================================================
   21. FILE PREVIEW (renderers)
   ============================================================ */
.fp-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 200px; color: var(--muted); font-size: 13px;
}
.fp-spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: fp-spin .6s linear infinite;
}
@keyframes fp-spin { to { transform: rotate(360deg); } }

.fp-pre {
  background: #1e293b; color: #e2e8f0;
  padding: 18px 20px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12.5px; line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 460px; overflow: auto;
}

.fp-warning {
  background: var(--warn-soft); color: var(--warn-ink);
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 12px; line-height: 1.5;
}
.fp-error {
  background: var(--danger-soft); color: var(--danger-ink);
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13px;
}

.fp-sheet-tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.fp-sheet-tab {
  padding: 5px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 11.5px; cursor: pointer;
  background: #fff; color: var(--ink-2);
  transition: all .15s;
}
.fp-sheet-tab:hover { background: var(--panel-2); }
.fp-sheet-tab.active {
  background: var(--ink); color: #fff; border-color: var(--ink);
}

.fp-cdg-container { width: 100%; height: 420px; position: relative; }

.pdf-pages canvas { display: block; margin: 0 auto 14px; max-width: 100%; }

.fp-download-only {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 220px; padding: 24px;
}
.fp-dl-icon { font-size: 44px; margin-bottom: 12px; opacity: .5; }
.fp-dl-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  background: var(--ink); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: background .2s;
}
.fp-dl-btn:hover { background: var(--ink-2); }

/* canvas-datagrid scrollbar tweak */
.fp-cdg-container canvas-datagrid { font-family: var(--mono); font-size: 12px; }

/* ============================================================
   22. BULK ACTION BAR (Approval Center)
   ============================================================ */
.bulk-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  margin-bottom: 14px;
  color: var(--accent-ink);
}
.bulk-bar .btn.ghost { color: var(--accent-ink); }
tr.row-selected { background: var(--accent-soft) !important; }
tr.row-selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* Checkbox sizing inside tables */
.tbl input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; }

/* ============================================================
   23. KANBAN BOARD (Task View)
   ============================================================ */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
  align-items: flex-start;
}
.kanban-col {
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 280px;
}
.kanban-col-head {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.kanban-col-head.accent { background: var(--accent-soft); color: var(--accent-ink); }
.kanban-col-head.warn   { background: var(--warn-soft);   color: var(--warn-ink); }
.kanban-col-head.ok     { background: var(--ok-soft);     color: var(--ok-ink); }
.kanban-col-body {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px;
  flex: 1; overflow-y: auto;
  max-height: calc(100vh - 320px);
}
.kanban-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
  display: flex; flex-direction: column; gap: 5px;
}
.kanban-card:hover {
  border-color: var(--ink);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transform: translateY(-1px);
}
.kanban-card-head { display: flex; align-items: center; gap: 5px; }
.kanban-card-name { font-size: 12.5px; font-weight: 500; line-height: 1.35; }
.kanban-card-meta { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.kanban-folder {
  font-family: var(--mono); font-size: 10px;
  padding: 1px 6px;
  background: var(--panel-2);
  border-radius: 3px;
  color: var(--muted);
  max-width: 100%;
}
.kanban-card-foot { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.kanban-owner {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 9px; font-weight: 600;
  color: var(--ink-2);
}
.kanban-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px; font-weight: 600;
}
.kanban-chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.kanban-empty {
  text-align: center; color: var(--muted-2);
  font-size: 11.5px; padding: 24px 8px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fff;
}

@media (max-width: 1100px) {
  .kanban { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   24. DIFF MODAL (Side-by-side version compare)
   ============================================================ */
.diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.diff-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.diff-panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.diff-panel-body {
  padding: 12px;
  min-height: 360px;
  max-height: 60vh;
  overflow: auto;
}
@media (max-width: 900px) {
  .diff-grid { grid-template-columns: 1fr; }
}
