html { --ui-zoom: 1; }
:root,
[data-theme="light"] {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --text: #111827;
  --muted: #6B7280;
  --muted-2: #9CA3AF;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-soft: #EFF6FF;
  --brand: #2563EB;
  --danger: #DC2626;
  --danger-soft: #FEF2F2;
  --danger-border: #FECACA;
  --danger-hover: #FEE2E2;
  --ok: #059669;
  --ok-soft: #ECFDF5;
  --ok-border: #A7F3D0;
  --warn: #D97706;
  --warn-soft: #FFFBEB;
  --warn-border: #FDE68A;
  --purple: #7C3AED;
  --purple-soft: #F5F3FF;
  --purple-border: #DDD6FE;
  --pink: #DB2777;
  --pink-soft: #FDF2F8;
  --pink-border: #FBCFE8;
  --blue: #1D4ED8;
  --blue-soft: #EFF6FF;
  --blue-border: #BFDBFE;
  --row-hover: #F9FAFB;
  --row-selected: #EFF6FF;
  --th-bg: #FAFBFC;
  --chip-bg: #F3F4F6;
  --focus-ring: rgba(37, 99, 235, 0.12);
  --backdrop: rgba(17, 24, 39, 0.28);
  --nav-shadow: rgba(17, 24, 39, 0.08);
  --nav-w: 232px;
  --radius: 10px;
  --radius-sm: 8px;
}

[data-theme="dark"] {
  --bg: #0f1419;
  --surface: #171d25;
  --border: #2a3441;
  --border-strong: #3a4656;
  --text: #e8eef5;
  --muted: #8b9aab;
  --muted-2: #6b7a8d;
  --accent: #3d8bfd;
  --accent-hover: #5a9dff;
  --accent-soft: #1a2740;
  --brand: #5eead4;
  --danger: #f87171;
  --danger-soft: #2a1518;
  --danger-border: #5c2a2e;
  --danger-hover: #3a1c20;
  --ok: #34d399;
  --ok-soft: #132821;
  --ok-border: #1f4a3a;
  --warn: #fbbf24;
  --warn-soft: #2a2310;
  --warn-border: #5a4a18;
  --purple: #c4b5fd;
  --purple-soft: #221c36;
  --purple-border: #3d3460;
  --pink: #f9a8d4;
  --pink-soft: #2a1824;
  --pink-border: #5a2e45;
  --blue: #93c5fd;
  --blue-soft: #152033;
  --blue-border: #2a4060;
  --row-hover: #1c2430;
  --row-selected: #1a2740;
  --th-bg: #121820;
  --chip-bg: #1c2430;
  --focus-ring: rgba(61, 139, 253, 0.22);
  --backdrop: rgba(0, 0, 0, 0.55);
  --nav-shadow: rgba(0, 0, 0, 0.45);
  --nav-w: 232px;
  --radius: 10px;
  --radius-sm: 8px;
}

/* —— Accent themes (data-accent on <html>) ——
   Colored left-nav chrome + accent for active/buttons/links/focus.
   Content surfaces stay from data-theme light/dark. Default: blue. */
:root,
[data-accent="blue"] {
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-soft: #EFF6FF;
  --brand: #2563EB;
  --focus-ring: rgba(37, 99, 235, 0.14);
  --row-selected: #EFF6FF;
  --nav-bg: #1e3a8a;
  --nav-fg: #e8eefc;
  --nav-muted: #a8b8e0;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(255, 255, 255, 0.16);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.12);
  --nav-shadow: rgba(30, 58, 138, 0.35);
}

[data-theme="dark"][data-accent="blue"],
[data-accent="blue"][data-theme="dark"] {
  --accent: #3d8bfd;
  --accent-hover: #5a9dff;
  --accent-soft: #1a2740;
  --brand: #5eead4;
  --focus-ring: rgba(61, 139, 253, 0.22);
  --row-selected: #1a2740;
  --nav-bg: #152a5c;
  --nav-fg: #e8eefc;
  --nav-muted: #93a4c9;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(61, 139, 253, 0.28);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.10);
  --nav-shadow: rgba(0, 0, 0, 0.45);
}

[data-accent="teal"] {
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-soft: #f0fdfa;
  --brand: #0d9488;
  --focus-ring: rgba(13, 148, 136, 0.14);
  --row-selected: #f0fdfa;
  --nav-bg: #115e59;
  --nav-fg: #e6fffa;
  --nav-muted: #99d5cb;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(255, 255, 255, 0.16);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.12);
  --nav-shadow: rgba(17, 94, 89, 0.35);
}

[data-theme="dark"][data-accent="teal"],
[data-accent="teal"][data-theme="dark"] {
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-soft: #12302c;
  --brand: #5eead4;
  --focus-ring: rgba(45, 212, 191, 0.22);
  --row-selected: #12302c;
  --nav-bg: #0d3f3b;
  --nav-fg: #e6fffa;
  --nav-muted: #7ebdb3;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(45, 212, 191, 0.24);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.10);
  --nav-shadow: rgba(0, 0, 0, 0.45);
}

[data-accent="indigo"] {
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --brand: #4f46e5;
  --focus-ring: rgba(79, 70, 229, 0.14);
  --row-selected: #eef2ff;
  --nav-bg: #3730a3;
  --nav-fg: #eef2ff;
  --nav-muted: #b4b0e0;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(255, 255, 255, 0.16);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.12);
  --nav-shadow: rgba(55, 48, 163, 0.35);
}

[data-theme="dark"][data-accent="indigo"],
[data-accent="indigo"][data-theme="dark"] {
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: #1e1b3a;
  --brand: #a5b4fc;
  --focus-ring: rgba(129, 140, 248, 0.22);
  --row-selected: #1e1b3a;
  --nav-bg: #2a2670;
  --nav-fg: #eef2ff;
  --nav-muted: #a09cd0;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(129, 140, 248, 0.28);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.10);
  --nav-shadow: rgba(0, 0, 0, 0.45);
}

[data-accent="emerald"] {
  --accent: #059669;
  --accent-hover: #047857;
  --accent-soft: #ecfdf5;
  --brand: #059669;
  --focus-ring: rgba(5, 150, 105, 0.14);
  --row-selected: #ecfdf5;
  --nav-bg: #065f46;
  --nav-fg: #ecfdf5;
  --nav-muted: #8fc9b3;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(255, 255, 255, 0.16);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.12);
  --nav-shadow: rgba(6, 95, 70, 0.35);
}

[data-theme="dark"][data-accent="emerald"],
[data-accent="emerald"][data-theme="dark"] {
  --accent: #34d399;
  --accent-hover: #6ee7b7;
  --accent-soft: #132821;
  --brand: #34d399;
  --focus-ring: rgba(52, 211, 153, 0.22);
  --row-selected: #132821;
  --nav-bg: #044433;
  --nav-fg: #ecfdf5;
  --nav-muted: #7ab89c;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(52, 211, 153, 0.24);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.10);
  --nav-shadow: rgba(0, 0, 0, 0.45);
}

[data-accent="slate"] {
  --accent: #475569;
  --accent-hover: #334155;
  --accent-soft: #f1f5f9;
  --brand: #475569;
  --focus-ring: rgba(71, 85, 105, 0.14);
  --row-selected: #f1f5f9;
  --nav-bg: #334155;
  --nav-fg: #f1f5f9;
  --nav-muted: #a8b4c4;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(255, 255, 255, 0.14);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.12);
  --nav-shadow: rgba(51, 65, 85, 0.35);
}

[data-theme="dark"][data-accent="slate"],
[data-accent="slate"][data-theme="dark"] {
  --accent: #94a3b8;
  --accent-hover: #cbd5e1;
  --accent-soft: #1c2430;
  --brand: #94a3b8;
  --focus-ring: rgba(148, 163, 184, 0.22);
  --row-selected: #1c2430;
  --nav-bg: #1e293b;
  --nav-fg: #f1f5f9;
  --nav-muted: #8b9aab;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(148, 163, 184, 0.22);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.10);
  --nav-shadow: rgba(0, 0, 0, 0.45);
}

[data-accent="violet"] {
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: #f5f3ff;
  --brand: #7c3aed;
  --focus-ring: rgba(124, 58, 237, 0.14);
  --row-selected: #f5f3ff;
  --nav-bg: #5b21b6;
  --nav-fg: #f5f3ff;
  --nav-muted: #c4b5fd;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(255, 255, 255, 0.16);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.12);
  --nav-shadow: rgba(91, 33, 182, 0.35);
}
[data-theme="dark"][data-accent="violet"],
[data-accent="violet"][data-theme="dark"] {
  --accent: #a78bfa;
  --accent-hover: #c4b5fd;
  --accent-soft: #2e1065;
  --brand: #a78bfa;
  --focus-ring: rgba(167, 139, 250, 0.22);
  --row-selected: #2e1065;
  --nav-bg: #4c1d95;
  --nav-fg: #f5f3ff;
  --nav-muted: #c4b5fd;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(167, 139, 250, 0.28);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.10);
  --nav-shadow: rgba(0, 0, 0, 0.45);
}

[data-accent="rose"] {
  --accent: #e11d48;
  --accent-hover: #be123c;
  --accent-soft: #fff1f2;
  --brand: #e11d48;
  --focus-ring: rgba(225, 29, 72, 0.14);
  --row-selected: #fff1f2;
  --nav-bg: #9f1239;
  --nav-fg: #fff1f2;
  --nav-muted: #fda4af;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(255, 255, 255, 0.16);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.12);
  --nav-shadow: rgba(159, 18, 57, 0.35);
}
[data-theme="dark"][data-accent="rose"],
[data-accent="rose"][data-theme="dark"] {
  --accent: #fb7185;
  --accent-hover: #fda4af;
  --accent-soft: #4c0519;
  --brand: #fb7185;
  --focus-ring: rgba(251, 113, 133, 0.22);
  --row-selected: #4c0519;
  --nav-bg: #881337;
  --nav-fg: #fff1f2;
  --nav-muted: #fda4af;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(251, 113, 133, 0.28);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.10);
  --nav-shadow: rgba(0, 0, 0, 0.45);
}

[data-accent="amber"] {
  --accent: #d97706;
  --accent-hover: #b45309;
  --accent-soft: #fffbeb;
  --brand: #d97706;
  --focus-ring: rgba(217, 119, 6, 0.14);
  --row-selected: #fffbeb;
  --nav-bg: #92400e;
  --nav-fg: #fffbeb;
  --nav-muted: #fcd34d;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(255, 255, 255, 0.16);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.12);
  --nav-shadow: rgba(146, 64, 14, 0.35);
}
[data-theme="dark"][data-accent="amber"],
[data-accent="amber"][data-theme="dark"] {
  --accent: #fbbf24;
  --accent-hover: #fcd34d;
  --accent-soft: #451a03;
  --brand: #fbbf24;
  --focus-ring: rgba(251, 191, 36, 0.22);
  --row-selected: #451a03;
  --nav-bg: #78350f;
  --nav-fg: #fffbeb;
  --nav-muted: #fcd34d;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(251, 191, 36, 0.24);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.10);
  --nav-shadow: rgba(0, 0, 0, 0.45);
}

[data-accent="cyan"] {
  --accent: #0891b2;
  --accent-hover: #0e7490;
  --accent-soft: #ecfeff;
  --brand: #0891b2;
  --focus-ring: rgba(8, 145, 178, 0.14);
  --row-selected: #ecfeff;
  --nav-bg: #155e75;
  --nav-fg: #ecfeff;
  --nav-muted: #67e8f9;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(255, 255, 255, 0.16);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.12);
  --nav-shadow: rgba(21, 94, 117, 0.35);
}
[data-theme="dark"][data-accent="cyan"],
[data-accent="cyan"][data-theme="dark"] {
  --accent: #22d3ee;
  --accent-hover: #67e8f9;
  --accent-soft: #083344;
  --brand: #22d3ee;
  --focus-ring: rgba(34, 211, 238, 0.22);
  --row-selected: #083344;
  --nav-bg: #164e63;
  --nav-fg: #ecfeff;
  --nav-muted: #67e8f9;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(34, 211, 238, 0.24);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.10);
  --nav-shadow: rgba(0, 0, 0, 0.45);
}

[data-accent="fuchsia"] {
  --accent: #c026d3;
  --accent-hover: #a21caf;
  --accent-soft: #fdf4ff;
  --brand: #c026d3;
  --focus-ring: rgba(192, 38, 211, 0.14);
  --row-selected: #fdf4ff;
  --nav-bg: #86198f;
  --nav-fg: #fdf4ff;
  --nav-muted: #f0abfc;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(255, 255, 255, 0.16);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.12);
  --nav-shadow: rgba(134, 25, 143, 0.35);
}
[data-theme="dark"][data-accent="fuchsia"],
[data-accent="fuchsia"][data-theme="dark"] {
  --accent: #e879f9;
  --accent-hover: #f0abfc;
  --accent-soft: #4a044e;
  --brand: #e879f9;
  --focus-ring: rgba(232, 121, 249, 0.22);
  --row-selected: #4a044e;
  --nav-bg: #701a75;
  --nav-fg: #fdf4ff;
  --nav-muted: #f0abfc;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active-bg: rgba(232, 121, 249, 0.28);
  --nav-active-fg: #ffffff;
  --nav-border: rgba(255, 255, 255, 0.10);
  --nav-shadow: rgba(0, 0, 0, 0.45);
}



* { box-sizing: border-box; }

html, body {
  min-height: 100%;
}
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 12.25px;
  line-height: 1.38;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

.app {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  /* html { zoom } shrinks 100vh visually — stretch so the rail still fills the viewport */
  min-height: calc(100vh / var(--ui-zoom, 1));
}

/* —— Nav —— */
.nav {
  background: var(--nav-bg, #1e3a8a);
  border-right: 1px solid var(--nav-border);
  box-shadow: 2px 0 12px var(--nav-shadow);
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: calc(100vh / var(--ui-zoom, 1));
  min-height: calc(100vh / var(--ui-zoom, 1));
  overflow-y: auto;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--nav-fg, #e8eefc);
}

a.logo { text-decoration: none; color: inherit; display: block; }
.logo {
  margin: 4px 8px 18px;
  line-height: 0;
}

.logo img {
  display: block;
  max-height: 36px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
.logo img.logo-light,
.logo img.logo-dark {
  height: 28px;
  width: auto;
  display: block;
}
/* Colored nav chrome: always Remy on-navy / inverse for contrast */
.logo img.logo-light { display: none; }
.logo img.logo-dark { display: block; }


.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--nav-muted, #a8b8e0);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav a:hover { color: var(--nav-fg); background: var(--nav-hover); }
.nav a.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-fg);
  font-weight: 600;
}

.nav-footer {
  margin-top: auto;
  padding: 12px 8px 4px;
  border-top: 1px solid var(--nav-border);
  color: var(--nav-muted);
  font-size: 12px;
}


.logo img.logo-mark { display: none; }

/* —— Desktop nav collapse (icons-only rail) —— */
html.nav-collapsed,
html.nav-collapsed[data-theme="light"],
html.nav-collapsed[data-theme="dark"],
body.nav-collapsed {
  --nav-w: 72px;
}

@media (min-width: 861px) {
  .app { transition: grid-template-columns .18s ease; }

  body.nav-collapsed .nav,
  html.nav-collapsed body .nav {
    padding: 18px 8px;
    overflow-x: hidden;
  }

  body.nav-collapsed .logo,
  html.nav-collapsed body .logo {
    margin: 4px auto 14px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  body.nav-collapsed .logo img.logo-full,
  html.nav-collapsed body .logo img.logo-full {
    display: none !important;
  }

  /* Colored chrome: always inverse mark for contrast on navy/teal/etc. */
  body.nav-collapsed .logo img.logo-mark-light,
  html.nav-collapsed body .logo img.logo-mark-light {
    display: none !important;
  }

  body.nav-collapsed .logo img.logo-mark-dark,
  html.nav-collapsed body .logo img.logo-mark-dark {
    display: block;
    width: 28px;
    height: 28px;
    max-height: 28px;
  }

  body.nav-collapsed .nav a:not(.logo),
  html.nav-collapsed body .nav a:not(.logo) {
    justify-content: center;
    gap: 0;
    padding: 10px 0;
    font-size: 0;
    line-height: 0;
  }

  body.nav-collapsed .nav-divider,
  html.nav-collapsed body .nav-divider {
    margin: 10px 4px 12px;
  }

  body.nav-collapsed .nav-footer,
  html.nav-collapsed body .nav-footer {
    font-size: 0;
    line-height: 0;
    color: transparent;
    padding: 10px 0 0;
    overflow: hidden;
    white-space: nowrap;
  }
}

/* —— Main —— */
.main { display: flex; flex-direction: column; min-width: 0; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 30;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.hamburger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
  padding: 0;
  flex-shrink: 0;
}

.hamburger svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; }

.crumb { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb strong { color: var(--text); font-weight: 600; }

.tenant-pill {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border));
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--accent);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
  padding: 0;
  flex-shrink: 0;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}

.theme-toggle:hover { background: var(--row-hover); }

.theme-toggle svg {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }


/* —— Accent theme dropdown (compact) —— */
.accent-picker {
  position: relative;
  flex-shrink: 0;
}

.accent-picker-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
  transition: background .12s ease, border-color .12s ease;
}

.accent-picker-trigger:hover {
  background: var(--row-hover);
}

.accent-picker-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
  border-color: var(--accent);
}

.accent-picker-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--row-hover);
}

.accent-picker-chevron {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform .12s ease;
}

.accent-picker-trigger[aria-expanded="true"] .accent-picker-chevron {
  transform: rotate(180deg);
}

.accent-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: var(--swatch, #2563EB);
  padding: 0;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.14);
  display: inline-block;
}

.accent-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 156px;
  max-height: min(70vh, 380px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);
  z-index: 50;
}

.accent-menu[hidden] {
  display: none !important;
}

.accent-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}

.accent-menu-item:hover {
  background: var(--row-hover);
}

.accent-menu-item[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.accent-menu-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.accent-menu-label {
  flex: 1;
  min-width: 0;
}


.content {
  padding: 22px 24px 48px;
}

.content.cols-2,
.workspace.cols-2 {
  display: grid;
  grid-template-columns: minmax(340px, 1.05fr) minmax(380px, 1fr);
  gap: 20px;
  align-items: start;
}


/* Page title row + note pull-down (page-sub always visible) */
.page-intro-compact { margin-bottom: 10px; }
.page-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-intro-compact .page-title { margin: 0; }
.page-intro-compact .page-sub {
  margin-top: 8px;
  margin-bottom: 0;
}
.page-note-toggle {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}
.page-note-toggle svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.page-note-toggle.is-open {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Collapsed = zero-height; expanded = pull-down (max-height/opacity) */
.note-banner.note-collapsible {
  display: none; /* out of flow when collapsed — no stack gap */
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding: 0;
  margin: 0;
  border-width: 0;
  pointer-events: none;
}
.note-banner.note-collapsible:not(.is-collapsed) {
  display: block;
  max-height: 640px;
  opacity: 1;
  padding: 12px 14px;
  margin: 0 0 10px;
  border-width: 1px;
  pointer-events: auto;
}
.note-banner.note-collapsible .note-banner-inner {
  min-width: 0;
  font-size: 13px;
  line-height: 1.45;
}
.note-banner.note-collapsible .note-label,
.note-banner.note-collapsible .page-note-toggle,
.note-banner.note-collapsible .note-help-toggle,
.note-banner.note-collapsible .note-help-collapse {
  display: none !important;
}



.page-intro {
  width: 100%;
  max-width: none;
  margin-bottom: 18px;
  flex: 1 1 240px;
  min-width: 0;
}

.page-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.page-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.38;
  max-width: none;
  width: 100%;
}

/* —— Cards (reserve for complex widgets: editors, file panes, primary tables) —— */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.card-head {
  margin: 0;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Open page sections — title + content on page background (no outer card) */
.section {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.section-heading {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.section-head .muted,
.section-head .hint {
  font-size: 12.5px;
}

/* Single surface for a table (prefer this over card-wrapping a bordered grid) */
.table-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.table-panel .card-head,
.table-panel .section-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.card-head .title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.card-head .title-row svg {
  width: 16px; height: 16px;
  stroke: var(--muted); fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

.list-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  width: 15px; height: 15px;
  stroke: var(--muted-2); fill: none; stroke-width: 1.75; stroke-linecap: round;
  pointer-events: none;
}

.search-wrap input {
  padding-left: 32px;
  width: 200px;
}

.filter-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.filter-wrap svg {
  position: absolute;
  left: 10px;
  width: 14px; height: 14px;
  stroke: var(--muted-2); fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}

.filter-wrap select {
  padding-left: 30px;
  width: 128px;
}

/* —— Form controls —— */
input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  width: 100%;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

textarea { min-height: 72px; resize: vertical; }

/* —— Table —— */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 550;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--th-bg);
}

tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--row-hover); }
tbody tr.selected td { background: var(--row-selected); }
tbody tr:last-child td { border-bottom: none; }

.num { font-variant-numeric: tabular-nums; font-weight: 550; color: var(--text); }

/* —— Badges —— */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge svg {
  width: 12px; height: 12px;
  stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.badge.draft { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border); }
.badge.locked { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
.badge.review { color: var(--purple); background: var(--purple-soft); border-color: var(--purple-border); }
.badge.not-started { color: var(--muted); background: var(--chip-bg); border-color: var(--border); }
.badge.table { color: var(--blue); background: var(--blue-soft); border-color: var(--blue-border); }
.badge.listing { color: var(--purple); background: var(--purple-soft); border-color: var(--purple-border); }
.badge.figure { color: var(--pink); background: var(--pink-soft); border-color: var(--pink-border); }

/* —— Buttons —— */
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 13.5px;
  transition: background .12s ease, border-color .12s ease;
}

.btn svg {
  width: 15px; height: 15px;
  stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

.btn:hover { background: var(--row-hover); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--row-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }
.btn.danger:hover { background: var(--danger-hover); }
.btn.icon-only {
  width: 34px; height: 34px; padding: 0;
  justify-content: center;
  color: var(--muted);
}

.btn.icon-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  justify-content: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  flex-shrink: 0;
}
.btn.icon-btn:hover {
  color: var(--accent-hover);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft);
}
.btn.icon-btn.row-edit {
  color: var(--accent);
}
.btn.icon-btn.row-edit svg { width: 14px; height: 14px; color: inherit; fill: currentColor; }
.btn.sm.icon-btn { width: 26px; height: 26px; }

/* —— Form —— */
.form { padding: 16px; display: grid; gap: 14px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  letter-spacing: 0.01em;
}

label .req::after { content: " *"; color: var(--danger); }

.hint {
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 400;
  margin-top: -2px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 2px 0 0;
}

.section-title svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

.mode-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--blue-border);
  padding: 3px 9px;
  border-radius: 999px;
}

.cols, .footnotes { display: grid; gap: 8px; }

.col-row {
  display: grid;
  grid-template-columns: 44px 1.3fr 1fr 1fr 34px;
  gap: 8px;
  align-items: center;
}

.fn-row {
  display: grid;
  grid-template-columns: 56px 1fr 34px;
  gap: 8px;
  align-items: start;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
  flex-wrap: wrap;
}

.left-actions, .right-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  z-index: 35;
}

/* —— Responsive —— */
@media (max-width: 1100px) {
  .content.cols-2,
  .workspace.cols-2 { grid-template-columns: 1fr; }
  .col-row { grid-template-columns: 44px 1fr 1fr 34px; }
  .col-row input:nth-child(4) { display: none; }
}

@media (max-width: 860px) {

  /* Collapsed rail is desktop-only; mobile keeps full-width drawer labels */
  html.nav-collapsed,
  html.nav-collapsed[data-theme="light"],
  html.nav-collapsed[data-theme="dark"],
  body.nav-collapsed {
    --nav-w: 232px;
  }

  .app { grid-template-columns: 1fr; }
  .hamburger { display: inline-flex; }

  .nav {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: min(var(--nav-w), 86vw);
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: none;
  }

  body.nav-open .nav {
    transform: translateX(0);
    box-shadow: 8px 0 24px var(--nav-shadow);
  }

  body.nav-open .nav-backdrop { display: block; }

  .top { padding: 10px 14px; }
  .content { padding: 16px 14px 40px; }
  .tenant-pill { display: none; }
  .grid3 { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .search-wrap input { width: 150px; }
  .form-actions { flex-direction: column-reverse; }
  .left-actions, .right-actions { width: 100%; }
  .right-actions { justify-content: flex-end; }
  .col-row { grid-template-columns: 40px 1fr 34px; }
  .col-row input:nth-child(3),
  .col-row input:nth-child(4) { display: none; }
}


/* —— Module layout helpers —— */
.content.stack { display: grid; gap: 18px; }
.stack { display: grid; gap: 18px; }
.split {
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(300px, 1fr);
  gap: 20px;
  align-items: start;
}
.muted { color: var(--muted); }
.stat-pills { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card-body { padding: 16px; }

/* Legacy card h2 → same look as card-head when used */
.card > h2 {
  margin: 0;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Extra badges used across modules */
.badge.ok, .badge.mapped, .badge.complete { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
.badge.running { color: var(--accent); background: var(--accent-soft); border-color: var(--blue-border); }
.badge.qc { color: var(--purple); background: var(--purple-soft); border-color: var(--purple-border); }
.badge.warn, .badge.pending { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border); }
.badge.danger, .badge.failed, .badge.rejected { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-border); }
.badge.info { color: var(--blue); background: var(--blue-soft); border-color: var(--blue-border); }
.badge.dataset { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
.badge.in-dev { color: var(--accent); background: var(--accent-soft); border-color: var(--blue-border); }
.badge.approved { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
.badge.frozen { color: var(--muted); background: var(--chip-bg); border-color: var(--border); }
.badge.editable { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
.badge.uneditable { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border); }
.badge.shell-locked { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
.badge.shell-draft { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border); }
.badge.shell-na { color: var(--muted); background: var(--chip-bg); border-color: var(--border); }

.btn.sm { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; }

.note-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--blue-border);
  background: var(--blue-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}
.note-banner strong { font-weight: 600; }
.note-banner .note-label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue);
  padding-top: 1px;
}
.cell-stack { display: grid; gap: 2px; }
.cell-stack .sub { color: var(--muted); font-size: 11.5px; }


.btn.ok { color: var(--ok); border-color: var(--ok-border); background: var(--ok-soft); }
.btn.ok:hover { background: var(--ok-soft); filter: brightness(0.97); }
.btn:disabled, .btn.disabled { opacity: 0.45; cursor: not-allowed; }

.search { width: 180px; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px 28px;
}
.meta-item {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  min-width: 0;
}
.meta-item .k {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  font-weight: 550;
}
.meta-item .v { font-size: 14.5px; font-weight: 600; line-height: 1.35; }

/* Library shortcuts — soft chips, not mini-cards */
.lib-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lib-card {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: var(--chip-bg);
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
  flex: 1 1 140px;
  max-width: 220px;
}
.lib-card .name {
  font-weight: 600;
  margin-bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lib-card .hint { margin-top: 0 !important; font-size: 11.5px; line-height: 1.35; }

.module-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.module-card {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.module-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
}
.module-card .title { font-weight: 600; margin-bottom: 6px; }
.module-card .desc { color: var(--muted); font-size: 12px; line-height: 1.4; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li {
  display: grid; grid-template-columns: 140px 1fr auto;
  gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.activity li:first-child { padding-top: 2px; }
.activity li:last-child { border-bottom: none; padding-bottom: 0; }
.card .activity li { padding-left: 16px; padding-right: 16px; }
.card .activity li:first-child { padding-top: 10px; }
.card .activity li:last-child { padding-bottom: 10px; }
.activity .when { color: var(--muted); font-size: 12px; }
.activity .who { color: var(--muted); font-size: 12px; }

.check-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.check-row:last-child { border-bottom: none; }
.check-row input[type="checkbox"] { width: auto; accent-color: var(--accent); }

.log-panel {
  background: var(--th-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
}
[data-theme="dark"] .log-panel {
  background: #0a0e13;
  color: #a8b8c8;
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 160px 14px 1fr;
  gap: 14px;
  padding: 0 16px 18px;
  position: relative;
}
.timeline .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  margin-top: 4px;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.timeline .line {
  position: absolute;
  left: calc(160px + 18px);
  top: 16px; bottom: 0;
  width: 1px; background: var(--border);
}
.timeline li:last-child .line { display: none; }
.timeline .when { color: var(--muted); font-size: 12px; }
.timeline .evt { font-weight: 600; margin-bottom: 4px; }
.timeline .detail { color: var(--muted); line-height: 1.45; }

.suggestion {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface);
  display: grid; gap: 10px;
}
.suggestion .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.suggestion .body { color: var(--muted); line-height: 1.45; }
.suggestion .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--row-hover);
}
.dropzone strong { color: var(--text); display: block; margin-bottom: 6px; }

@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .lib-card { flex: 1 1 160px; max-width: none; }
  .module-grid { grid-template-columns: repeat(2, 1fr); }
  .meta-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .lib-card { flex: 1 1 140px; }
  .module-grid { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr; }
  .activity li { grid-template-columns: 1fr; gap: 4px; }
  .timeline li { grid-template-columns: 100px 14px 1fr; }
  .timeline .line { left: calc(100px + 18px); }
  .search { width: 140px; }
}

/* —— Tracker: SAP groups, title bands, soft meta, bulk bar, modal —— */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 550;
  border: 1px solid var(--purple-border);
  background: var(--purple-soft);
  color: var(--purple);
  white-space: nowrap;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; }

/* Plain text meta (Type / Status) — not pills */
.meta-plain {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.meta-k {
  display: block;
  font-size: 10.5px;
  font-weight: 550;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 2px;
}
.meta-v {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.meta-v.muted { color: var(--muted); font-weight: 450; }

.badge.queued { color: var(--muted); background: var(--chip-bg); border-color: var(--border); }
.badge.done, .badge.complete { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }

.col-check { width: 36px; text-align: center; }
.col-check input[type="checkbox"] { width: auto; accent-color: var(--accent); cursor: pointer; }

.btn.icon-btn.head-delete {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  color: var(--muted);
  border-radius: 6px;
}
.btn.icon-btn.head-delete:hover {
  color: #b91c1c;
  background: rgba(185, 28, 28, 0.08);
}
.btn.icon-btn.head-delete svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn.icon-btn.head-pdf {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  color: var(--accent);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.btn.icon-btn.head-pdf:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.btn.icon-btn.head-pdf svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn.icon-btn.head-delete:disabled,
.btn.icon-btn.head-pdf.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  color: var(--muted);
  background: transparent;
}
.btn.icon-btn.head-delete:disabled:hover {
  color: var(--muted);
  background: transparent;
}
.btn.icon-btn.head-pdf.is-disabled:hover {
  color: var(--muted);
  background: transparent;
}

.tracker-page-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 0;
}
.tracker-page-head .page-intro {
  flex: 0 0 auto;
  width: 100%;
  max-width: none;
  min-width: 0;
}
.tracker-meta-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  width: 100%;
}
.tracker-meta-row .stat-pills {
  justify-content: flex-start;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.tracker-meta-row .tracker-actions {
  margin: 0 0 0 auto;
  justify-content: flex-end;
}
.tracker-toolbar-check { display: none; }
.check-all-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.check-all-label input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
  cursor: pointer;
}
.check-all-in-head {
  margin: 0;
  font-size: 0;
  gap: 0;
  justify-content: center;
  width: 100%;
}
.tracker-tools-only {
  margin-top: 0;
  margin-bottom: 4px;
  padding: 0;
}
.tracker-tools-only .list-tools {
  width: 100%;
}
.tracker-section > .section-head.tracker-tools-only {
  align-items: center;
}
.tracker-section .tracker-col-head {
  margin-top: 0;
}
.tracker-section .bulk-bar {
  margin-top: 0;
  margin-bottom: 6px;
}
.tracker-section .sap-section-head {
  padding: 6px 4px 4px;
}
.tracker-section .artifact-row {
  padding: 5px 8px 5px 4px;
}


/* Tracker column header — once at top, light accent */
.tracker-col-head {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 0 8px;
  padding: 9px 8px 9px 4px;
  margin: 0 0 2px;
  min-height: 40px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: var(--radius);
}
.tracker-col-head .artifact-main { gap: 0; }
.tracker-col-head .artifact-title-band,
.tracker-col-head .col-head-title-spacer {
  display: none; /* title/tags headers removed — don't reserve empty band height */
}
.col-head-label {
  font-size: 10.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  line-height: 1.2;
}
.tracker-col-head .artifact-meta .meta-cell {
  display: flex;
  align-items: center;
  min-height: 0;
  padding: 0;
}
.tracker-col-head .artifact-meta .row-actions,
.tracker-col-head .meta-cell:last-child {
  justify-content: flex-end;
}

/* Rows: values only (labels live in .tracker-col-head) */
.artifact-row .artifact-meta {
  align-items: center;
}
.artifact-row {
  padding: 10px 8px 12px 4px;
}

.tracker-board {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.sap-section {
  min-width: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.sap-section:last-child { border-bottom: none; padding-bottom: 0; }

.sap-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%; /* overridden inside .sap-section-bar */
  padding: 10px 4px 8px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  border-radius: var(--radius-sm);
}
.sap-section-head:hover { background: var(--row-hover); }
.sap-section-head:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.sap-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: var(--muted);
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .15s ease;
}
.sap-section.collapsed .sap-chevron { transform: rotate(-90deg); }

.sap-section-title {
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}
.sap-section-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}
.sap-section-count::before { content: "· "; }

.sap-section-body {
  display: grid;
  gap: 0;
  padding: 0 0 8px;
}
.sap-section.collapsed > .sap-section-body,
.sap-section.collapsed .sap-section-body,
.sap-section-body[hidden] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
}
.sap-section.is-empty { display: none; }

.artifact-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 0 8px;
  padding: 6px 8px 6px 4px;
  border-top: 1px solid var(--border);
  align-items: start;
  cursor: default;
}
/* Alternate rows: white / very light theme tint (per SAP section) */
.sap-section-body > .artifact-row:nth-child(odd) {
  background: var(--surface);
}
.sap-section-body > .artifact-row:nth-child(even) {
  background: color-mix(in srgb, var(--accent) 2%, var(--surface));
}
.sap-section-body > .artifact-row:hover { background: var(--row-hover); }
.sap-section-body > .artifact-row.row-selected {
  background: var(--row-selected);
}
.artifact-row:hover { background: var(--row-hover); }
.artifact-row.row-selected { background: var(--row-selected); }
.artifact-row[hidden],
.artifact-row.is-filtered-out { display: none; }

.artifact-row .col-check {
  padding-top: 2px;
  width: auto;
}

.artifact-main { min-width: 0; display: grid; gap: 2px; }

.artifact-title-band {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: nowrap;
}
.artifact-title {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  min-width: 0;
  flex: 0 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.artifact-title-band .artifact-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-start;
}
.artifact-title-band .chip-row { flex-wrap: nowrap; }
.artifact-title-band .title-tags-empty { font-size: 12px; }
.program-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  font-weight: 500;
}
.tracker-col-head .col-head-tags { margin-left: 0; }
.tracker-col-head .col-head-program-spacer {
  min-height: 0;
}

.artifact-path,
.artifact-note { display: none; }

.artifact-meta {
  display: grid;
  /* Fixed middle + actions tracks so columns align across rows */
  grid-template-columns: minmax(120px, 1.2fr) 70px 86px 120px 70px 128px 84px 152px;
  gap: 8px 12px;
  align-items: center;
  width: 100%;
}
.artifact-meta .meta-cell { min-width: 0; }
.artifact-meta .row-actions {
  justify-content: flex-end;
  align-self: center;
}

@media (max-width: 1200px) {
  /* Keep all 8 Tracker columns; scroll horizontally instead of crushing Actions */
  .artifact-meta {
    grid-template-columns: minmax(110px, 1.1fr) 66px 80px 110px 66px 122px 80px 152px;
    min-width: 876px;
  }
  .artifact-meta .meta-cell.actions-cell .row-actions,
  .artifact-meta .meta-cell:has(.row-actions) .row-actions {
    justify-content: flex-end;
  }
}
@media (max-width: 720px) {
  .artifact-meta {
    grid-template-columns: minmax(100px, 1fr) 60px 72px 96px 60px 116px 72px 152px;
    min-width: 816px;
  }
}

/* Soft status cue without full pill — Frozen only when needed */
.files-frozen-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 550;
  color: var(--muted);
  background: var(--chip-bg);
  border: 1px solid var(--border);
}

.bulk-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  box-shadow: 0 4px 24px color-mix(in srgb, var(--accent) 14%, transparent);
}
.bulk-bar.visible { display: flex; }
.bulk-bar .bulk-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bulk-bar .bulk-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bulk-bar .sel-count { font-weight: 600; font-size: 13px; color: var(--accent); }

.job-panel-wrap { margin-top: 4px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none !important; }
.modal {
  width: min(560px, 100%);
  max-height: min(80vh, 640px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.modal-head .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; line-height: 1.4; }
.modal-body { padding: 14px 18px; flex: 1; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
}
.folder-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  background: var(--row-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 12px;
}
.folder-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.folder-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.folder-list li:last-child { border-bottom: none; }
.folder-list li.dir { color: var(--muted); background: var(--th-bg); font-weight: 550; }
.folder-list li .fname { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.folder-list li input[type="checkbox"] { width: auto; accent-color: var(--accent); }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--surface);
  font-size: 13px;
  font-weight: 550;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 40px));
}
.toast.show { opacity: 1; transform: translateY(0); }
[data-theme="dark"] .toast { background: #e8eef5; color: #0f1419; }

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.filter-chips button.chip-filter {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.filter-chips button.chip-filter.active {
  color: var(--accent);
  border-color: var(--blue-border);
  background: var(--accent-soft);
  font-weight: 600;
}

.redirect-card {
  max-width: 560px;
  margin: 40px auto;
  text-align: left;
}
.redirect-card h1 { margin: 0 0 8px; font-size: 22px; }
.redirect-card p { color: var(--muted); margin: 0 0 16px; line-height: 1.5; }

/* —— Studies selection —— */
.nav-divider {
  height: 1px;
  background: var(--nav-border);
  margin: 10px 8px 12px;
}

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

.studies-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.study-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .12s ease, background .12s ease;
}
.study-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
}
.study-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.study-id {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.study-title {
  color: var(--muted);
  margin-top: 2px;
  font-size: 13.5px;
}
.study-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 12.5px;
  color: var(--text);
}
.study-meta-row .k {
  display: block;
  color: var(--muted-2);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.study-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.study-card-foot .open-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
}

.studies-table tbody tr.row-link { cursor: pointer; }

/* Layout aliases + overflow hardening */
.cols-3,
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.workspace { min-width: 0; }
.suggestion { min-width: 0; }
.suggestion .body { overflow-wrap: anywhere; }
.content { overflow-x: clip; }

/* Default badge chip (untyped) */
.badge {
  color: var(--muted);
  background: var(--chip-bg);
  border-color: var(--border);
}

@media (max-width: 1100px) {
  .studies-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .cols-3, .grid3 { grid-template-columns: 1fr; }
}

/* —— Admin —— */
.admin-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
  align-items: start;
}
.admin-subnav {
  position: sticky;
  top: 72px;
  display: grid;
  gap: 2px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.admin-subnav button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  font-size: 13.5px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.admin-subnav button:hover { color: var(--text); background: var(--row-hover); }
.admin-subnav button.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.admin-panel { display: none; }
.admin-panel.active { display: grid; gap: 18px; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .toggle-meta { min-width: 0; }
.toggle-row .toggle-meta strong { display: block; font-weight: 600; margin-bottom: 2px; }
.toggle-row .toggle-meta .hint { margin-top: 2px; }

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.switch .track {
  position: absolute;
  inset: 0;
  background: var(--chip-bg);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition: background .15s ease, border-color .15s ease;
  cursor: pointer;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform .15s ease;
}
.switch input:checked + .track {
  background: var(--accent);
  border-color: var(--accent);
}
.switch input:checked + .track::after {
  transform: translateX(18px);
  border-color: transparent;
}
.switch input:disabled + .track {
  opacity: 0.7;
  cursor: not-allowed;
}
.switch input:focus-visible + .track {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.logo-placeholder {
  width: 72px;
  height: 72px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--row-hover);
  display: grid;
  place-items: center;
  color: var(--muted-2);
  font-size: 11px;
  text-align: center;
  padding: 8px;
}
.color-swatch {
  display: flex;
  align-items: center;
  gap: 10px;
}
.color-swatch input[type="color"] {
  width: 40px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}
.path-chip {
  display: inline-flex;
  align-items: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  padding: 6px 10px;
  background: var(--chip-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
}
.path-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-subnav {
    position: static;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }
}

/* —— Files browser —— */
.files-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 14px;
  align-items: stretch;
  min-height: 480px;
}
.files-tree {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px;
  overflow: auto;
}
.files-tree .tree-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px 10px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.tree-item:hover { background: var(--row-hover); }
.tree-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.tree-item .ico { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tree-item .count { margin-left: auto; color: var(--muted-2); font-size: 11.5px; font-weight: 500; }
.tree-item.active .count { color: var(--accent); }
.files-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.files-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.files-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.files-breadcrumb button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}
.files-breadcrumb button:hover { text-decoration: underline; }
.files-breadcrumb .sep { color: var(--muted-2); }
.files-breadcrumb .here { color: var(--text); font-weight: 600; }
.files-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.files-table-wrap { overflow: auto; flex: 1; }
.files-table-wrap table { width: 100%; border-collapse: collapse; }
.files-table-wrap th, .files-table-wrap td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.files-table-wrap th {
  background: var(--th-bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.files-table-wrap tr:hover td { background: var(--row-hover); }
.files-table-wrap tr.dir-row { cursor: pointer; }
.fname-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.fname-cell .ico { width: 15px; height: 15px; stroke: var(--muted); fill: none; stroke-width: 1.7; flex-shrink: 0; }
.type-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.type-pill.r { color: var(--blue); background: var(--blue-soft); border-color: var(--blue-border); }
.type-pill.sas { color: var(--purple); background: var(--purple-soft); border-color: var(--purple-border); }
.type-pill.sas7bdat { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
.type-pill.rtf { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border); }
.type-pill.dir { color: var(--accent); background: var(--accent-soft); border-color: var(--blue-border); }

/* —— Layout template editor (Admin) —— */
.layout-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.layout-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.layout-list li:last-child { border-bottom: none; }
.layout-list li.dragging { opacity: 0.55; }
.layout-list .grip {
  color: var(--muted-2);
  cursor: grab;
  user-select: none;
  font-size: 14px;
  letter-spacing: 1px;
}
.layout-list .folder-name {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 550;
}
.layout-list .folder-name input {
  width: 100%;
  font: inherit;
  font-family: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--bg);
}
.layout-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.layout-preview .path-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.success-banner {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ok-border);
  background: var(--ok-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 14px;
}
.success-banner.show { display: flex; }
.success-banner strong { font-weight: 600; }

@media (max-width: 900px) {
  .files-layout { grid-template-columns: 1fr; }
}

/* —— Files: Manage access, context menu, QC freeze on share —— */
.tree-item-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  position: relative;
}
.tree-item-wrap .tree-item { flex: 1; min-width: 0; }
.tree-item-wrap .tree-more {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}
.tree-item-wrap .tree-more:hover,
.tree-item-wrap .tree-more[aria-expanded="true"] {
  background: var(--row-hover);
  color: var(--text);
}
.tree-item .frozen-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  margin-left: 2px;
  box-shadow: 0 0 0 2px var(--chip-bg);
}
.files-table-wrap th.col-access,
.files-table-wrap td.col-access { width: 160px; }
.files-table-wrap th.col-more,
.files-table-wrap td.col-more { width: 44px; text-align: right; }
.row-more {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.row-more:hover { background: var(--row-hover); color: var(--text); }
.files-table-wrap tr.frozen-row td { background: color-mix(in srgb, var(--chip-bg) 65%, transparent); }
.badge.share-frozen {
  color: var(--muted);
  background: var(--chip-bg);
  border-color: var(--border);
  font-weight: 600;
}
.badge.share-view {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: var(--blue-border);
}
.badge.share-edit {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: var(--ok-border);
}
.ctx-menu {
  position: fixed;
  z-index: 90;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.16);
  padding: 6px;
  display: none;
}
.ctx-menu.open { display: block; }
.ctx-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.ctx-menu button:hover { background: var(--row-hover); }
.ctx-menu button:disabled { opacity: 0.45; cursor: not-allowed; }
.ctx-menu .ctx-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}
.modal.access-modal { width: min(640px, 100%); max-height: min(86vh, 720px); }
.access-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
}
.access-inherit {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--row-hover);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 12px;
}
.access-freeze-banner {
  display: none;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  font-size: 12.5px;
  line-height: 1.45;
  margin-bottom: 12px;
}
.access-freeze-banner.show { display: flex; }
.access-freeze-banner strong { font-weight: 650; }
.access-add {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  align-items: center;
}
.access-add select,
.access-add input {
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
.access-add select { min-width: 160px; }
.access-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.access-table th, .access-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.access-table th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 650;
}
.access-table .who {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.access-table .who strong { font-weight: 600; }
.access-table .who .meta { color: var(--muted); font-size: 12px; }
.access-table .kind-pill {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 550;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--muted);
}
.access-table .kind-pill.team {
  color: var(--purple);
  background: var(--purple-soft);
  border-color: var(--purple-border);
}
.access-role select {
  font: inherit;
  font-size: 12.5px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
.access-role select:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  background: var(--row-hover);
}
.folder-share-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* —— Mock Shells: spreadsheet editor —— */
.shell-workspace {
  --shell-toc-width: 280px;
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 520px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.shell-workspace > .shell-catalog,
.shell-workspace > .shell-editor {
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: var(--surface);
}
.shell-catalog {
  flex: 0 0 var(--shell-toc-width);
  width: var(--shell-toc-width);
  min-width: 160px;
  max-width: 50%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid transparent;
  font-size: 12px;
}
.shell-split-handle {
  flex: 0 0 6px;
  width: 6px;
  cursor: col-resize;
  align-self: stretch;
  background: var(--border);
  position: relative;
  z-index: 2;
  touch-action: none;
  user-select: none;
}
.shell-split-handle::after {
  content: "";
  position: absolute;
  inset: 0 -3px;
}
.shell-split-handle:hover,
.shell-split-handle:focus-visible,
.shell-workspace.is-resizing .shell-split-handle {
  background: var(--accent);
  outline: none;
}
.shell-workspace.is-resizing {
  cursor: col-resize;
  user-select: none;
}
.shell-workspace.is-resizing * {
  cursor: col-resize !important;
}
.shell-catalog .table-wrap {
  flex: 1 1 auto;
  max-height: calc(100vh - 260px);
  overflow: auto;
  min-height: 0;
}
.shell-catalog-tools {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.shell-catalog-tools .search-wrap input { width: 120px; font-size: 12px; padding: 5px 8px 5px 28px; }
.shell-catalog-tools .filter-wrap select { font-size: 12px; padding: 5px 8px 5px 28px; }
.shell-catalog .card-head {
  padding: 10px 12px;
  font-size: 13px;
}
.shell-catalog #catalogTable,
.shell-catalog .catalog-section-table {
  font-size: 11.5px;
  table-layout: fixed;
}
.shell-catalog #catalogTable th {
  padding: 6px 8px;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  z-index: 1;
}
.shell-catalog #catalogTable th:first-child,
.shell-catalog .catalog-section-table td.num {
  width: 5.5rem;
}
.shell-catalog .catalog-section-table td {
  padding: 5px 8px;
  line-height: 1.35;
  font-size: 11.5px;
}
.shell-catalog .catalog-section-table td.num {
  white-space: nowrap;
  font-size: 11.5px;
}
.shell-catalog .catalog-section-table .sub { font-size: 10.5px; }
.shell-catalog .catalog-board {
  display: grid;
  gap: 0;
  min-width: 0;
}
.shell-catalog .catalog-empty {
  margin: 0;
  padding: 12px 8px;
  color: var(--muted);
  font-size: 12px;
}
.shell-catalog .sap-section-head {
  padding: 8px 8px 6px;
  gap: 8px;
}
.shell-catalog .sap-section-body {
  padding: 0 0 4px;
}
.shell-catalog .sap-section:last-child { border-bottom: none; }
.shell-catalog .catalog-grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  margin-right: 5px;
  color: var(--muted);
  vertical-align: -2px;
  cursor: grab;
  opacity: 0.5;
}
.shell-catalog tr[data-id]:hover .catalog-grip { opacity: 1; }
.shell-catalog .catalog-grip svg {
  width: 10px;
  height: 14px;
  fill: currentColor;
}
.shell-catalog tr[data-id] { cursor: grab; user-select: none; }
.shell-catalog tr[data-id].is-dragging { cursor: grabbing; }
.shell-catalog tr.is-dragging {
  opacity: 0.35;
  pointer-events: none;
}
.shell-catalog tr.is-filtered-out { display: none; }
.shell-catalog tr.drop-before td {
  box-shadow: inset 0 2px 0 0 var(--accent);
}
.shell-catalog tr.drop-after td {
  box-shadow: inset 0 -2px 0 0 var(--accent);
}
.shell-catalog .sap-section.drop-target > .sap-section-head {
  background: var(--accent-soft);
}
.shell-catalog tr.catalog-drop-pad { cursor: default; }
.shell-catalog tr.catalog-drop-pad td {
  padding: 10px 8px;
  border-bottom: none;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
  gap: 4px;
}
.btn-sm svg { width: 14px; height: 14px; }

.shell-editor {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 520px;
  background: var(--surface);
}

.shell-action-bar { display: none; }
.shell-meta-strip,
.shell-props {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.shell-props {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 8px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--border);
}
.shell-props-fields {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.shell-actions-icons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.btn.icon-btn.accent-icon {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  width: 32px;
  height: 30px;
}
.btn.icon-btn.accent-icon:hover {
  color: var(--accent-hover);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.btn.icon-btn.accent-icon-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.btn.icon-btn.accent-icon-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}
.btn.icon-btn.accent-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.meta-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  font-weight: 550;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.meta-field input,
.meta-field select {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  min-width: 88px;
  height: 30px;
}
.meta-field input { width: 88px; }
.shell-props .meta-field {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  text-transform: none;
  letter-spacing: normal;
}
.shell-props .meta-field input,
.shell-props .meta-field select {
  height: 28px;
  font-size: 12.5px;
  min-width: 0;
}
.shell-props .meta-field input { width: 72px; }
.shell-props .meta-field select { width: auto; }
.shell-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.shell-actions .btn svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

.sheet-canvas {
  padding: 12px 16px 20px;
  background: var(--surface);
}

.sheet-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}
.sheet-titles { min-width: 0; flex: 1; }
.sheet-title {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
  padding: 1px 2px;
  border-radius: 4px;
  cursor: default;
  outline: none;
}
.sheet-title.empty { color: var(--muted); }
.sheet-subtitle {
  margin-top: 2px;
  font-size: 12.5px;
  font-style: italic;
  color: var(--text);
  padding: 1px 2px;
  border-radius: 4px;
  min-height: 1.2em;
}
.sheet-subtitle.empty { color: var(--muted-2); }
.sheet-title:hover,
.sheet-subtitle:hover { background: var(--row-hover); }

.sheet-type-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.sheet-type-btn[hidden],
#typeMenuBtn[hidden] { display: none !important; }
.sheet-type-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.sheet-type-btn svg {
  width: 14px; height: 14px;
  stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.sheet-type-btn:hover { background: var(--row-hover); }
.sheet-custom-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  color: #9a6b00;
  background: #fff3d6;
  border: 1px solid #f0d48a;
}
[data-theme="dark"] .sheet-custom-pill {
  color: #f0c674;
  background: rgba(240, 198, 116, 0.15);
  border-color: rgba(240, 198, 116, 0.35);
}

.sheet-grid-wrap {
  position: relative;
  overflow: auto;
  margin-left: 0;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
}

.sheet-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
  min-width: 640px;
}
.sheet-grid th,
.sheet-grid td {
  border: 1px solid var(--border);
  padding: 0;
  vertical-align: middle;
  background: var(--surface);
  height: 34px;
}
.sheet-grid thead th {
  background: var(--bg);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text);
  text-align: left;
}
.sheet-grid thead th.col-group {
  text-align: center;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
  border-bottom: 2px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  font-weight: 700;
  letter-spacing: 0.01em;
}
.sheet-grid thead th.col-group.level-2 {
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  border-bottom-width: 1px;
  font-weight: 600;
}
.sheet-grid thead th.col-data.selected,
.sheet-grid thead th.col-group.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--accent) 14%, var(--bg));
}
.sheet-grid thead th.col-data {
  cursor: pointer;
  user-select: none;
}
.sheet-grid thead th.col-group {
  cursor: pointer;
  user-select: none;
}
.col-select-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 8px;
  margin: 0 0 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.col-select-toolbar[hidden] { display: none !important; }
.col-select-toolbar .col-sel-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-right: 4px;
}
.col-select-toolbar .btn.sm {
  font-size: 12px;
  padding: 4px 10px;
  height: auto;
}
.sheet-grid .col-idx {
  width: 40px;
  min-width: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  background: var(--bg);
  user-select: none;
}
.sheet-grid .col-label {
  width: 220px;
  min-width: 160px;
}
.sheet-grid .col-data {
  min-width: 110px;
}
.sheet-grid .col-add {
  width: 36px;
  min-width: 36px;
  text-align: center;
  background: var(--bg);
  border-left: 1px solid var(--border);
}
.col-add-btn {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.col-add-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.sheet-grid .cell-text,
.sheet-grid .th-text {
  display: block;
  padding: 6px 10px;
  min-height: 34px;
  line-height: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}
.sheet-grid td.col-label {
  position: relative;
}
.sheet-grid td.col-label .cell-text {
  padding-left: calc(10px + var(--indent, 0) * 18px);
}
.sheet-grid td.indent-0 { --indent: 0; }
.sheet-grid td.indent-1 { --indent: 1; }
.sheet-grid td.indent-2 { --indent: 2; }
.sheet-grid td.indent-3 { --indent: 3; }
.sheet-grid td.indent-4 { --indent: 4; }
.sheet-grid td.indent-5 { --indent: 5; }
.sheet-grid td.indent-6 { --indent: 6; }

.sheet-grid tbody tr.selected td {
  background: rgba(59, 130, 246, 0.04);
}
.sheet-grid tbody tr:hover td {
  background: var(--row-hover);
}
.sheet-grid tbody tr.selected:hover td {
  background: rgba(59, 130, 246, 0.06);
}

.cell-badges {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  gap: 4px;
}
.cell-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}
.cell-badge.comment { background: #3b82f6; border-radius: 4px; }
.cell-badge.note { background: #22c55e; }

.cell-input,
.inline-edit {
  width: 100%;
  height: 100%;
  min-height: 34px;
  box-sizing: border-box;
  border: 2px solid var(--accent, #3b82f6);
  border-radius: 0;
  padding: 4px 8px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  resize: vertical;
}
.sheet-title .inline-edit {
  font-size: 22px;
  font-weight: 650;
  min-height: 32px;
  border-radius: 4px;
  padding: 2px 4px;
}
.sheet-subtitle .inline-edit {
  font-size: 13.5px;
  font-style: italic;
  min-height: 24px;
  border-radius: 4px;
}
.sheet-block .inline-edit {
  display: block;
  width: 100%;
  margin-top: 4px;
  min-height: 48px;
  border-radius: 4px;
  font-size: 13px;
}

.row-float-toolbar {
  position: absolute;
  left: 4px;
  z-index: 5;
  display: flex;
  flex-direction: row;
  gap: 1px;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}
.row-float-toolbar button {
  width: 28px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
}
.row-float-toolbar button:hover {
  background: var(--row-hover);
  color: var(--text);
}
.row-float-toolbar button.danger:hover {
  background: var(--danger-soft, #fee2e2);
  color: var(--danger, #dc2626);
}
.row-float-toolbar svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

.sheet-add-row {
  margin: 10px 0 0 0;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.sheet-add-row:hover {
  background: var(--row-hover);
  border-color: var(--muted-2);
}

.sheet-blocks {
  margin: 20px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sheet-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  cursor: default;
  min-height: 44px;
}
.sheet-block:hover { border-color: var(--muted-2); }
.block-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  margin-right: 6px;
}
.block-value {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
}
.block-value.empty {
  color: var(--muted-2);
  font-style: normal;
}

.sheet-ctx {
  position: fixed;
  z-index: 1000;
  min-width: 200px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
}
.sheet-ctx[hidden] { display: none !important; }
.sheet-ctx button {
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 7px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 5px;
  cursor: pointer;
}
.sheet-ctx button:hover { background: var(--row-hover); }
.sheet-ctx .ctx-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}


/* —— Mock Shells: Copy to study —— */
.warn-banner {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warn-border);
  background: var(--warn-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 14px;
}
.warn-banner.show { display: flex; }
.warn-banner strong { font-weight: 650; }
.copy-success-banner {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ok-border);
  background: var(--ok-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 14px;
}
.copy-success-banner.show { display: flex; }
.copy-success-banner strong { font-weight: 650; }
.copy-success-banner .banner-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.modal.copy-modal { width: min(520px, 100%); max-height: min(88vh, 720px); }
.copy-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 550;
  color: var(--muted);
}
.copy-field input[type="text"] {
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.copy-field .field-hint {
  font-size: 11.5px;
  font-weight: 450;
  color: var(--muted);
  line-height: 1.4;
}
.study-pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.study-pick-list li {
  border-bottom: 1px solid var(--border);
}
.study-pick-list li:last-child { border-bottom: none; }
.study-pick-list label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
  font-size: 13.5px;
}
.study-pick-list label:hover { background: var(--row-hover); }
.study-pick-list input[type="radio"] {
  width: auto;
  margin-top: 3px;
  accent-color: var(--accent);
}
.study-pick-list .study-pick-meta {
  display: grid;
  gap: 2px;
}
.study-pick-list .study-pick-id { font-weight: 650; }
.study-pick-list .study-pick-title { color: var(--muted); font-size: 12px; font-weight: 450; }
.study-pick-list .study-pick-perm {
  color: var(--muted);
  font-size: 11px;
  font-weight: 450;
}
.copy-rules {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--row-hover);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
}
.copy-rules ul { margin: 6px 0 0; padding-left: 18px; }
.copy-rules li { margin: 3px 0; }
.copy-rules .muted { color: var(--muted); }
.modal-inline-warn {
  display: none;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--warn-border);
  background: var(--warn-soft);
  font-size: 12.5px;
  line-height: 1.45;
}
.modal-inline-warn.show { display: block; }
.shell-catalog-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ref-cleared {
  color: var(--muted);
  font-style: italic;
  font-size: 12.5px;
}

@media (max-width: 1100px) {
  .shell-workspace {
    flex-direction: column;
  }
  .shell-catalog {
    flex: 0 0 auto;
    width: 100% !important;
    max-width: none;
    min-width: 0;
  }
  .shell-split-handle { display: none; }
  .shell-catalog .table-wrap { max-height: 240px; }
}
@media (max-width: 720px) {
  .sheet-canvas { padding: 16px 14px 24px; }
  .sheet-grid-wrap { margin-left: 36px; }
  .sheet-add-row,
  .sheet-blocks { margin-left: 36px; }
  .row-float-toolbar { left: -34px; }
}


/* Tracker floating row editor */
.float-editor {
  position: fixed;
  z-index: 80;
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  color: var(--text);
}
.float-editor[hidden] { display: none !important; }
.float-editor.is-dragging { user-select: none; cursor: grabbing; }
.float-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-soft);
  cursor: grab;
  position: sticky;
  top: 0;
  z-index: 1;
  border-radius: 12px 12px 0 0;
}
.float-editor-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.float-editor.is-dragging .float-editor-head { cursor: grabbing; }
.float-editor-body {
  padding: 14px;
  display: grid;
  gap: 12px;
}
.float-editor-body label {
  display: grid;
  gap: 6px;
}
.float-editor-body input,
.float-editor-body select {
  width: 100%;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.float-editor-body input:focus,
.float-editor-body select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.float-editor-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  bottom: 0;
}

/* Mock Shells catalog: Add only, no title row */
.shell-catalog-head {
  justify-content: flex-start;
}

.connector-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface));
}
/* Mock Shells catalog: larger + on Add */
.btn.icon-btn.btn-add-shell.btn.icon-text-btn,
.btn.icon-text-btn.btn-add-shell {
  height: 32px;
  min-height: 32px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.btn-add-shell.btn.icon-text-btn:hover,
.btn.icon-text-btn.btn-add-shell:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}
.btn.icon-text-btn.btn-add-shell svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
}

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

/* Mock Shells: metadata spreadsheet modal */
.modal.metadata-modal {
  width: min(780px, 100%);
  max-height: min(88vh, 760px);
}
.metadata-grid-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  max-height: min(52vh, 420px);
}
.metadata-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
  min-width: 560px;
}
.metadata-grid th,
.metadata-grid td {
  border: 1px solid var(--border);
  padding: 0;
  vertical-align: middle;
  background: var(--surface);
}
.metadata-grid thead th {
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
  font-weight: 650;
  font-size: 12px;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.metadata-grid .meta-col-param { width: 28%; }
.metadata-grid .meta-col-value { width: 36%; }
.metadata-grid .meta-col-notes { width: auto; }
.metadata-grid .meta-col-act {
  width: 40px;
  text-align: center;
  padding: 0;
}
.metadata-grid td.meta-cell {
  padding: 7px 10px;
  min-height: 34px;
  outline: none;
  color: var(--text);
  word-break: break-word;
}
.metadata-grid td.meta-cell:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.metadata-grid-actions {
  margin-top: 10px;
}
.btn.metadata-del-row {
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}
.btn.metadata-del-row:hover {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}
.btn.icon-btn.accent-icon:disabled,
.btn.icon-btn.accent-icon[aria-disabled="true"] {
  opacity: 0.42;
  cursor: not-allowed;
  color: var(--muted);
}

/* Nested File Explorer / Extract data */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-group > a.nav-sub {
  margin-left: 18px;
  font-size: 12.5px;
  padding-top: 6px;
  padding-bottom: 6px;
  opacity: 0.92;
}
.nav.collapsed .nav-group > a.nav-sub {
  margin-left: 0;
}
html.nav-collapsed .nav-group > a.nav-sub span,
.nav.collapsed .nav-group .nav-sub {
  /* keep icon-only collapse behavior via existing nav rules */
}

/* Studies view toggle (icon) */
.studies-view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.studies-view-toggle button {
  border: 0;
  background: transparent;
  width: 34px;
  height: 32px;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.studies-view-toggle button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.studies-view-toggle button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}
.studies-view-toggle button + button {
  border-left: 1px solid var(--border);
}
body.studies-view-cards .studies-list-panel { display: none; }
body.studies-view-list .studies-grid { display: none; }
body.studies-view-list .studies-list-panel { display: block; }
body.studies-view-cards .studies-grid { display: grid; }

/* In-screen icon + label actions (Extract data, Publisher) */
a.btn.icon-text-btn,
.btn.icon-text-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}
a.btn.icon-text-btn svg,
.btn.icon-text-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
a.btn.icon-text-btn.accent-icon,
.btn.icon-text-btn.accent-icon {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
}
a.btn.icon-text-btn.accent-icon:hover,
.btn.icon-text-btn.accent-icon:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
a.btn.icon-text-btn.accent-icon-primary,
.btn.icon-text-btn.accent-icon-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
a.btn.icon-text-btn.accent-icon-primary:hover,
.btn.icon-text-btn.accent-icon-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

/* Study home modules collapse */
.modules-block .modules-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.modules-block .modules-toggle .sap-chevron {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  transition: transform .15s ease;
}
.modules-block.is-collapsed .modules-toggle .sap-chevron {
  transform: rotate(-90deg);
}
.modules-block.is-collapsed .module-grid {
  display: none;
}


/* Tracker custom lists */
.tracker-lists-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.list-modal { max-width: 520px; width: min(520px, 94vw); }
.list-order {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 280px;
  overflow: auto;
  background: var(--surface);
}
.list-order-item {
  display: grid;
  grid-template-columns: 20px 1fr auto 28px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  font-size: 13px;
}
.list-order-item:last-child { border-bottom: 0; }
.list-order-item.dragging { opacity: 0.55; background: var(--accent-soft); }
.list-order-item .drag-handle {
  color: var(--muted);
  letter-spacing: -2px;
  font-size: 12px;
  user-select: none;
}
.list-order-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-order-prog { font-size: 11px; font-family: ui-monospace, monospace; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* In-context Copilot panel */
.copilot-launch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
}
.copilot-launch svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.copilot-launch:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.copilot-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  z-index: 80;
}
.copilot-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(380px, 94vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.12);
  z-index: 81;
  display: flex;
  flex-direction: column;
}
.copilot-panel[hidden],
.copilot-backdrop[hidden] { display: none !important; }
.copilot-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.copilot-panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.copilot-panel-head .hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.copilot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.copilot-chip {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
}
.copilot-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.copilot-thread {
  flex: 1;
  overflow: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.copilot-msg {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}
.copilot-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  max-width: 90%;
}
.copilot-msg.bot {
  align-self: stretch;
  background: var(--bg);
  border: 1px solid var(--border);
}
.copilot-msg .badge {
  margin-bottom: 6px;
}
.copilot-compose {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.copilot-compose input {
  flex: 1;
  min-width: 0;
}
.copilot-panel-foot {
  padding: 8px 16px 14px;
  font-size: 11px;
  color: var(--muted);
}
.copilot-panel-foot a { color: var(--accent); }

.list-tools { flex-wrap: wrap; }


/* Tracker toolbar: one row — actions left, filters right */
.tracker-section > .section-head.tracker-tools-only {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 0;
  margin-bottom: 0;
  padding: 0;
}
.tracker-toolbar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  width: 100%;
  min-width: 100%;
  margin: 0;
  box-sizing: border-box;
}
.tracker-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.tracker-section .tracker-filters.list-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: auto;
  max-width: 100%;
  margin: 0 0 0 auto;
  justify-content: flex-end;
}
#trackerListsBar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0;
}
#trackerListsBar .actions-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 4px;
}
.action-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  min-width: 34px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  overflow: hidden;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.action-icon-btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.action-icon-btn .label {
  display: inline-block;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  margin-left: 0;
  transform: translateX(-4px);
  transition: max-width 0.28s ease, opacity 0.2s ease, margin-left 0.28s ease, transform 0.28s ease;
}
.action-icon-btn:hover:not(:disabled),
.action-icon-btn:focus-visible:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}
.action-icon-btn:hover:not(:disabled) .label,
.action-icon-btn:focus-visible:not(:disabled) .label {
  max-width: 200px;
  opacity: 1;
  margin-left: 8px;
  transform: translateX(0);
}
.action-icon-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.action-icon-btn.primary:hover:not(:disabled),
.action-icon-btn.primary:focus-visible:not(:disabled) {
  background: var(--accent-hover, var(--accent));
  border-color: var(--accent-hover, var(--accent));
  color: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.action-icon-btn.danger-quiet:hover:not(:disabled),
.action-icon-btn.danger-quiet:focus-visible:not(:disabled) {
  background: color-mix(in srgb, #dc2626 12%, var(--surface));
  border-color: color-mix(in srgb, #dc2626 35%, var(--border));
  color: #dc2626;
}
.action-icon-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}


/* Tracker: pull main grid up */
.tracker-section {
  margin-top: 0;
  gap: 4px;
}
.tracker-section > .section-head.tracker-tools-only {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.stack > .note-banner.note-collapsible.is-collapsed {
  margin-top: 0;
  margin-bottom: 4px;
}
.tracker-page-head + .note-banner {
  margin-top: 2px;
}
.tracker-page-head .stat-pills {
  margin: 0;
}


/* Tracker: kill header whitespace */
.stack.tracker-stack {
  gap: 6px;
}
.stack.tracker-stack > .note-banner.note-collapsible.is-collapsed {
  display: none;
}
.stack.tracker-stack > .tracker-page-head {
  margin-bottom: 0;
}
.stack.tracker-stack > .tracker-section {
  margin-top: 0;
}

/* Large custom-list detail modal */
.list-modal-lg {
  max-width: min(960px, 96vw);
  width: min(960px, 96vw);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
}
.list-modal-lg .modal-body {
  overflow: auto;
  flex: 1 1 auto;
}
.list-modal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.list-name-field {
  flex: 1 1 240px;
  min-width: 200px;
}
.list-name-field input {
  width: 100%;
}
.list-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.list-table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
  max-height: min(52vh, 480px);
  background: var(--surface);
}
.list-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.list-detail-table th,
.list-detail-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.list-detail-table th {
  position: sticky;
  top: 0;
  background: var(--bg);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  z-index: 1;
}
.list-detail-table tr.list-order-row {
  cursor: grab;
}
.list-detail-table tr.list-order-row.dragging {
  opacity: 0.55;
  background: var(--accent-soft);
}
.list-detail-table .col-drag {
  width: 28px;
  color: var(--muted);
}
.list-detail-table .col-ord {
  width: 44px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.list-detail-table .col-title {
  font-weight: 600;
  min-width: 160px;
}
.list-detail-table .col-prog code {
  font-size: 12px;
}
.list-detail-table .col-more {
  width: 40px;
}


/* Tracker workflow preview (Admin) + strip (Tracker) */
.wf-preview, .tracker-flow-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.wf-chip, .tracker-flow-strip .wf-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.wf-arrow {
  color: var(--muted);
  font-size: 12px;
}
.tracker-flow-strip .wf-step .wf-role {
  font-weight: 500;
  color: var(--muted);
  font-size: 11px;
}
.tracker-flow-strip .wf-step.is-active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  color: var(--accent);
}
.badge.file-ro {
  background: color-mix(in srgb, #64748b 14%, var(--surface));
  color: #475569;
}
.badge.file-rw {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
}
.artifact-row.is-readonly {
  /* subtle; handoff still allowed */
}


.radio-cards {
  display: grid;
  gap: 8px;
}
.radio-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.radio-card:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: var(--accent-soft);
}
.radio-card input {
  margin-top: 3px;
  accent-color: var(--accent);
}
.radio-card .hint {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}


.bulk-handoffs {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.bulk-handoffs:empty {
  display: none;
}
.bulk-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}


/* Custom Lists — large popup (not fullscreen) */
.setlist-backdrop {
  padding: 16px !important;
  align-items: center !important;
  justify-content: center !important;
}
.setlist-screen {
  width: min(1100px, 96vw);
  max-width: 96vw;
  height: min(86vh, 800px);
  max-height: min(86vh, 800px);
  margin: 0;
  border-radius: 14px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: 0 20px 50px rgba(0,0,0,0.18);
  overflow: hidden;
}
.setlist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex: 0 0 auto;
}
.setlist-head h2 { margin: 0; font-size: 16px; line-height: 1.2; }
.setlist-head .hint {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.3;
}
.setlist-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}
.setlist-sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.setlist-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.setlist-nav {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow: auto;
  flex: 1;
}
.setlist-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 7px 9px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.setlist-nav-item:hover { background: var(--surface); }
.setlist-nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.setlist-nav-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setlist-main {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.setlist-empty {
  display: grid;
  place-content: start;
  min-height: 0;
  text-align: left;
  gap: 4px;
  padding-top: 4px;
}
.setlist-empty p { margin: 0; }
.setlist-editor {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  gap: 8px;
}
.setlist-editor .list-modal-toolbar {
  margin-bottom: 0;
  flex: 0 0 auto;
}
.setlist-table-wrap {
  flex: 1 1 auto;
  min-height: 120px;
  max-height: none;
  height: auto;
  overflow: auto;
}
.setlist-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
}
.setlist-foot-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}
.list-detail-table .col-check { width: 36px; }
.list-detail-table tr.list-order-row.is-selected {
  background: var(--accent-soft);
}
.list-detail-table tr.list-order-row.drag-over {
  box-shadow: inset 0 2px 0 var(--accent);
}
.list-detail-table tr.list-order-row.dragging {
  opacity: 0.45;
}
@media (max-width: 860px) {
  .setlist-body { grid-template-columns: 1fr; }
  .setlist-sidebar {
    max-height: 140px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .setlist-screen {
    height: min(92vh, 900px);
    max-height: min(92vh, 900px);
  }
}


.btn.icon-btn.row-history,
.btn.icon-btn.row-people,
.btn.icon-btn.row-exec,
.btn.icon-btn.row-edit {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  box-sizing: border-box;
  flex: 0 0 auto;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  visibility: visible !important;
  opacity: 1 !important;
}
.btn.icon-btn.row-history,
.btn.icon-btn.row-people,
.btn.icon-btn.row-exec {
  color: var(--muted);
}
.btn.icon-btn.row-history:hover,
.btn.icon-btn.row-people:hover,
.btn.icon-btn.row-exec:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
.btn.icon-btn.row-history svg,
.btn.icon-btn.row-people svg,
.btn.icon-btn.row-exec svg,
.btn.icon-btn.row-edit svg {
  width: 14px !important;
  height: 14px !important;
  color: inherit;
  fill: currentColor;
  display: block;
  flex-shrink: 0;
}
.history-modal {
  width: min(1280px, 98vw);
  max-width: 98vw;
  height: min(94vh, 960px);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.history-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
}
.txn-timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 4px;
}
.txn-item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 10px;
  position: relative;
  padding: 0 0 14px 0;
}
.txn-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 14px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.txn-dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  z-index: 1;
}
.txn-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}
.txn-status {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 1px 8px;
}
.txn-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.txn-note {
  font-size: 12.5px;
  margin-top: 4px;
  color: var(--text);
}


.history-tabs {
  display: flex;
  gap: 0;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.history-tab {
  border: 0;
  background: transparent;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.history-tab:hover { color: var(--text); }
.history-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.history-modal {
  width: min(1280px, 98vw);
  max-width: 98vw;
  height: min(94vh, 960px);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.history-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ver-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.ver-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.ver-item.is-current {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: var(--accent-soft);
}
.ver-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.ver-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--surface);
  border-radius: 999px;
  padding: 1px 8px;
}
.ver-trigger {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.ver-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.ver-note { font-size: 12.5px; margin-top: 4px; }
.ver-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}
.ver-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.ver-preview-code {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  line-height: 1.45;
  overflow: auto;
  max-height: 36vh;
  white-space: pre-wrap;
}
.ver-preview-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}


.ver-diff {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  overflow: auto;
  max-height: none;
  font-size: 12.5px;
  line-height: 1.45;
}
.diff-line {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  padding: 1px 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.diff-line code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: transparent;
  padding: 0;
}
.diff-pref {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  user-select: none;
}
.diff-same { background: transparent; }
.diff-del {
  background: color-mix(in srgb, #dc2626 12%, var(--surface));
}
.diff-del .diff-pref { color: #b91c1c; }
.diff-add {
  background: color-mix(in srgb, #16a34a 12%, var(--surface));
}
.diff-add .diff-pref { color: #15803d; }
.diff-leg-del { color: #b91c1c; font-weight: 600; }
.diff-leg-add { color: #15803d; font-weight: 600; }
.ver-preview-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}



button.badge.file-edit-link {
  cursor: pointer;
  appearance: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: inherit;
  padding: 2px 9px;
  text-decoration: none;
  border: 1px solid transparent;
  vertical-align: baseline;
}
button.badge.file-edit-link:hover,
button.badge.file-edit-link:focus-visible {
  filter: brightness(0.97);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.program-edit-modal {
  width: min(960px, 96vw);
  max-width: 96vw;
  height: min(88vh, 860px);
  max-height: min(88vh, 860px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.program-edit-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 18px 12px;
}
.program-edit-code {
  flex: 1 1 auto;
  width: 100%;
  min-height: 320px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
}
.program-edit-code:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px;
}
.program-edit-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
}
.program-edit-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}



.history-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.history-panel[hidden] { display: none !important; }
#histPanelLog {
  overflow: auto;
}
#histPanelVersions {
  overflow: hidden;
}
.versions-split {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 34%) minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}
.versions-list-col,
.versions-detail-col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#historyVersionList {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.ver-item.is-selected {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.ver-item {
  padding: 8px 10px;
  gap: 8px;
}
.ver-preview {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px;
}
.ver-empty {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 24px;
}
.ver-empty[hidden],
.ver-preview-filled[hidden] { display: none !important; }
.ver-preview-filled {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
@media (max-width: 900px) {
  .versions-split { grid-template-columns: 1fr; }
  .versions-list-col { max-height: 38%; }
}
.ver-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
}
.ver-preview-head-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.ver-split {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  overflow: hidden;
}
.ver-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
}
.ver-pane-head {
  flex: 0 0 auto;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.ver-code,
.ver-diff {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  max-height: none;
  font-size: 12.5px;
  line-height: 1.45;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.ver-code {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (max-width: 900px) {
  .ver-split { grid-template-columns: 1fr; }
}



/* —— Accessibility dropdown —— */
.a11y-picker {
  position: relative;
  flex-shrink: 0;
}
.a11y-picker-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
  transition: background .12s ease, border-color .12s ease;
}
.a11y-picker-trigger:hover { background: var(--row-hover); }
.a11y-picker-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
  border-color: var(--accent);
}
.a11y-picker-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--row-hover);
}
.a11y-trigger-mark {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.a11y-trigger-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a11y-picker-chevron {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform .12s ease;
}
.a11y-picker-trigger[aria-expanded="true"] .a11y-picker-chevron {
  transform: rotate(180deg);
}
.a11y-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 168px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);
  z-index: 60;
  display: grid;
  gap: 6px;
}
.a11y-menu[hidden] { display: none !important; }
.a11y-menu-heading {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 4px;
}
.a11y-zoom-row {
  display: grid;
  grid-template-columns: 28px 40px 28px;
  justify-content: space-between;
  gap: 4px;
}
.a11y-menu-btn {
  height: 26px;
  border: 0;
  border-radius: 5px;
  background: var(--chip-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  padding: 0;
}
.a11y-menu-btn:hover:not(:disabled) { background: var(--row-hover); }
.a11y-menu-btn:disabled { opacity: 0.35; cursor: default; }
.a11y-menu-btn-reset {
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.a11y-menu-item {
  height: 26px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.a11y-menu-item-row {
  width: 100%;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
}
.a11y-menu-item:hover { background: var(--row-hover); }
.a11y-menu-item.is-active,
.a11y-menu-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}
.a11y-menu-section + .a11y-menu-section {
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

/* High contrast: sharper text/colors only — keep normal border weight */
html[data-contrast="high"][data-theme="light"] {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #000000;
  --muted: #111827;
  --row-hover: #eef2ff;
  --chip-bg: #f3f4f6;
}
html[data-contrast="high"][data-theme="dark"] {
  --bg: #000000;
  --surface: #050505;
  --text: #ffffff;
  --muted: #f3f4f6;
  --row-hover: #1e293b;
  --chip-bg: #0f172a;
}
html[data-contrast="low"][data-theme="light"] {
  --bg: #f3f4f6;
  --surface: #f9fafb;
  --text: #4b5563;
  --muted: #9ca3af;
  --row-hover: #eef2f7;
  --chip-bg: #eef2f7;
}
html[data-contrast="low"][data-theme="dark"] {
  --bg: #111827;
  --surface: #1f2937;
  --text: #d1d5db;
  --muted: #9ca3af;
  --row-hover: #273449;
  --chip-bg: #273449;
}


/* SAP section Select control — kept next to title/count (not far-right) */
.sap-section-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}
.sap-section-bar .sap-section-head {
  flex: 0 1 auto;
  width: auto;
  max-width: calc(100% - 88px);
  min-width: 0;
}
.sap-section-select-btn {
  flex: 0 0 auto;
  height: 20px;
  padding: 0 7px;
  margin-left: 2px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.sap-section-select-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.sap-section-select-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.sap-section-select-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}


/* Mock Shells TOC multi-select + catalog context */
.shell-catalog .catalog-section-table tr.is-multi td {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.shell-catalog .catalog-section-table tr.selected td,
.shell-catalog .catalog-section-table tr.selected.is-multi td {
  background: var(--row-selected);
}
.shell-catalog .catalog-section-table tr.is-multi {
  box-shadow: inset 3px 0 0 var(--accent);
}
.sheet-ctx button.danger {
  color: var(--danger);
}


/* Signed-in user + logout */
.user-chrome {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  max-width: min(240px, 40vw);
}
.user-chrome-who {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 34px;
  padding: 0 4px 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}
.user-chrome-avatar {
  display: inline-flex;
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}
.user-chrome-avatar svg { width: 18px; height: 18px; }
.user-chrome-name {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.user-chrome-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}
.user-chrome-logout svg {
  width: 15px;
  height: 15px;
  display: block;
}
.user-chrome-logout:hover {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}


/* Tracker row roles (hover tip) */
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.artifact-meta .meta-cell:has(.row-actions),
.artifact-meta .meta-cell.actions-cell {
  display: flex;
  width: 100%;
  min-width: 152px;
  overflow: visible;
  justify-content: flex-end;
  align-items: center;
}
.artifact-meta .meta-cell.actions-cell .row-actions,
.artifact-meta .meta-cell:has(.row-actions) .row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}
.tracker-col-head .artifact-meta .meta-cell:last-child {
  justify-content: flex-end;
  text-align: right;
}
.tracker-col-head .artifact-meta .meta-cell:last-child .col-head-label {
  width: 100%;
  text-align: right;
}
.row-people-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}
.row-people-tip {
  display: none;
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 80;
  width: 260px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
  pointer-events: none;
  white-space: normal;
}
.row-people-wrap:hover .row-people-tip,
.row-people-wrap:focus-within .row-people-tip,
.row-people-wrap.is-open .row-people-tip {
  display: block;
  pointer-events: auto;
}
.btn.icon-btn.row-people {
  color: var(--accent);
}
.row-people-tip-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 8px;
}
.row-people-role + .row-people-role {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.row-people-role-label {
  font-size: 11px;
  font-weight: 650;
  color: var(--accent);
  margin-bottom: 2px;
}
.row-people-role-names {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.35;
}


/* Admin subnav: Audit opens audit.html */
.admin-subnav a.admin-nav-ext {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  font-size: 13.5px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}
.admin-subnav a.admin-nav-ext:hover {
  color: var(--text);
  background: var(--row-hover);
}

.admin-subnav a.admin-nav-ext.active,
.admin-subnav a.admin-nav-ext[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}


/* Studies — wide table + new study form */
.studies-table-wide {
  min-width: 1080px;
}
.studies-table-wide th,
.studies-table-wide td {
  font-size: 12.5px;
  vertical-align: middle;
}
.study-name-cell {
  font-weight: 600;
  color: var(--text);
}
.study-sub {
  font-size: 11.5px;
  margin-top: 2px;
}
.modal.modal-lg {
  width: min(720px, 96vw);
  max-width: 96vw;
}
.new-study-form {
  display: grid;
  gap: 16px;
}
.new-study-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.new-study-grid .field-span-2 {
  grid-column: 1 / -1;
}
.new-study-form .field {
  display: grid;
  gap: 5px;
  margin: 0;
}
.new-study-form .field-label {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.new-study-form .field-hint {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
}
.new-study-form .field-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
}
.new-study-form textarea.field-input {
  min-height: 64px;
  resize: vertical;
}
.new-study-form .field-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.new-study-preview {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--row-hover);
}
@media (max-width: 720px) {
  .new-study-grid { grid-template-columns: 1fr; }
  .new-study-grid .field-span-2 { grid-column: auto; }
}


/* File Explorer: pull tree/list up under intro + programs hint */
.page-intro-compact + .note-banner.note-collapsible.is-collapsed + .files-layout,
.page-intro-compact + .files-layout {
  margin-top: 0;
}
.content.stack.files-stack,
.stack.files-stack {
  gap: 10px;
}
#programsFolderHint.note-banner {
  margin: 8px 0 0 !important;
  padding: 8px 12px;
}
.page-intro-compact:has(#programsFolderHint) {
  margin-bottom: 0;
}


/* Tracker row execute menu */
.row-exec-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
}
.row-exec-wrap.is-open .row-exec {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.row-exec-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 80;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
  display: grid;
  gap: 2px;
}
.row-exec-menu[hidden] {
  display: none !important;
}
.row-exec-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.row-exec-menu button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}


/* Keep Tracker Actions on-screen — parent .content uses overflow-x: clip */
.content:has(.tracker-board) {
  overflow-x: auto;
}
.tracker-board {
  overflow-x: auto;
  padding-bottom: 4px;
  min-width: 0;
}
.tracker-col-head .artifact-meta,
.artifact-row .artifact-meta {
  min-width: 876px;
}

/* Bulk run split control */
.bulk-run-wrap {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
}
.bulk-run-wrap .btn#btnRun {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-right: 10px;
}
.bulk-run-caret {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 1px solid color-mix(in srgb, #fff 35%, var(--accent));
  padding: 0 8px;
  min-width: 28px;
}
.bulk-run-wrap.is-open .bulk-run-caret {
  filter: brightness(0.95);
}
.bulk-run-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 210px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
  display: grid;
  gap: 2px;
}
.bulk-run-menu[hidden] { display: none !important; }
.bulk-run-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.bulk-run-menu button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}


/* Study home — darker accordion card for label + meta (Feedback #12) */
.study-hero {
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 12%, transparent);
  overflow: hidden;
}
html[data-theme="dark"] .study-hero {
  background: color-mix(in srgb, var(--accent) 18%, #0f172a);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.study-hero-toggle {
  display: flex;
  width: 100%;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.study-hero-toggle:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.study-hero-heading { min-width: 0; flex: 1 1 auto; }
.study-hero-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.study-hero-title {
  margin: 0;
  font-size: 1.35rem;
}
.study-hero-sub {
  margin: 6px 0 0;
  color: var(--muted);
}
.study-hero-chevron {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  transition: transform .18s ease;
}
.study-hero-chevron svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.study-hero.is-open .study-hero-chevron {
  transform: rotate(180deg);
}
.study-hero-body {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border));
}
.study-hero.is-open .study-hero-body {
  display: block;
}
.study-hero-meta {
  margin-top: 12px;
}
.study-hero-meta .meta-item {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 2px 0;
  box-shadow: none;
}

/* New study form: keep fields top-aligned; hints must not stretch sibling inputs */
.new-study-grid { align-items: start; }
.new-study-form .field { align-content: start; grid-auto-rows: max-content; }
.new-study-form input.field-input,
.new-study-form select.field-input { height: 38px; }


/* ===== Tracker: simulated SAS / R run engine (demo) ===== */
.job-cell { overflow: visible; }
.run-st {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  max-width: 100%;
  padding: 2px 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--text);
  text-align: left;
  line-height: 1.25;
}
button.run-st { cursor: pointer; border-radius: 6px; padding: 2px 4px; margin: 0 -4px; }
button.run-st:hover { background: var(--row-hover); }
button.run-st:hover .run-st-txt { text-decoration: underline; text-underline-offset: 2px; }
button.run-st:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.run-st-line { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; max-width: 100%; }
.run-st-txt { overflow: hidden; text-overflow: ellipsis; }
.run-st-sub { font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 17px; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.run-ic { position: relative; flex: 0 0 12px; width: 12px; height: 12px; display: inline-block; }
.run-ic svg { width: 12px; height: 12px; display: block; }
.run-st.is-queued { color: var(--muted); }
.run-st.is-queued .run-st-line { font-weight: 550; }
.run-st.is-running .run-st-line { color: var(--accent); }
.run-st.is-done .run-st-line { color: var(--ok); }
.run-st.is-warn .run-st-line { color: var(--warn); }
.run-st.is-none { color: var(--muted-2); font-size: 12.5px; }
.run-spin {
  display: block;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-top-color: var(--accent);
  animation: run-spin .8s linear infinite;
  box-sizing: border-box;
}
@keyframes run-spin { to { transform: rotate(360deg); } }
.run-bar {
  display: block;
  width: 88px;
  max-width: 100%;
  height: 3px;
  margin: 3px 0 0 17px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  overflow: hidden;
}
.run-bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .25s linear; }
.run-lang {
  display: inline-block;
  padding: 0 4px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 14px;
  background: var(--chip-bg);
  color: var(--muted);
  vertical-align: 1px;
}
.run-lang.sas { background: var(--blue-soft); color: var(--blue); }
.run-lang.r { background: var(--purple-soft); color: var(--purple); }
.artifact-row.run-flash { animation: run-flash 1.2s ease; }
@keyframes run-flash { 0%, 40% { box-shadow: inset 3px 0 0 var(--accent); background-color: var(--row-selected); } 100% { box-shadow: inset 0 0 0 transparent; } }

/* Background jobs panel (bottom-right, non-blocking) */
.bgjobs {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 70;
  width: min(380px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.14), 0 2px 6px rgba(0,0,0,0.06);
  overflow: hidden;
  font-size: 13px;
}
.bgjobs[hidden] { display: none !important; }
.bgjobs-head {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: var(--th-bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.bgjobs-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.bgjobs-title { font-weight: 650; white-space: nowrap; }
.bgjobs-counts { flex: 1; min-width: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.bgjobs-head .run-ic { flex: 0 0 14px; width: 14px; height: 14px; }
.bgjobs-head .run-spin { width: 14px; height: 14px; }
.bgjobs-chev { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform .15s ease; }
.bgjobs.is-collapsed .bgjobs-chev { transform: rotate(180deg); }
.bgjobs.is-collapsed .bgjobs-body { display: none; }
.bgjobs-body { border-top: 1px solid var(--border); }
.bgjobs-list { list-style: none; margin: 0; padding: 4px 0; max-height: 260px; overflow-y: auto; }
.bgjobs-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
}
.bgjobs-item:hover { background: var(--row-hover); }
.bgjobs-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.bgjobs-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.bgjobs-state { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bgjobs-item .run-ic { color: var(--muted); }
.bgjobs-item.is-running .run-ic, .bgjobs-item.is-running .bgjobs-state { color: var(--accent); }
.bgjobs-item.is-done .run-ic { color: var(--ok); }
.bgjobs-item.is-warn .run-ic { color: var(--warn); }
.bgjobs-item.is-done .bgjobs-state { color: var(--ok); }
.bgjobs-item.is-warn .bgjobs-state { color: var(--warn); }
.bgjobs-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 12px 8px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); }
.bgjobs-foot .btn { padding: 3px 8px; font-size: 12px; min-height: 0; height: auto; }
body.has-bgjobs .toast { bottom: calc(var(--bgjobs-h, 48px) + 32px); }

/* Simulated run log modal */
.modal.run-log-modal { width: min(860px, 100%); max-height: min(86vh, 760px); overflow: hidden; }
.run-log-modal .modal-body { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: hidden; }
.run-log-tabs { display: flex; gap: 4px; }
.run-log-tabs[hidden] { display: none; }
.run-log-tab {
  padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer;
}
.run-log-tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); font-weight: 600; }
.run-log-sum { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.run-log-sum span { padding: 2px 8px; border-radius: 999px; background: var(--chip-bg); color: var(--muted); }
.run-log-sum .is-ok { background: var(--ok-soft); color: var(--ok); }
.run-log-sum .is-warn { background: var(--warn-soft); color: var(--warn); }
.run-log-pre {
  margin: 0;
  flex: 1;
  min-height: 200px;
  max-height: 52vh;
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--th-bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
  tab-size: 4;
}
.run-log-pre .ln-note { color: var(--blue); }
.run-log-pre .ln-warn { color: var(--warn); font-weight: 600; background: var(--warn-soft); }
.run-log-pre .ln-dim { color: var(--muted); }
.run-log-pre .ln-src { color: var(--text); }
.run-log-foot { justify-content: space-between; align-items: center; }
.run-log-sim { font-size: 11.5px; color: var(--muted-2); font-style: italic; }
@media (prefers-reduced-motion: reduce) {
  .run-spin { animation-duration: 2.4s; }
  .artifact-row.run-flash { animation: none; }
}


/* Long program names: ellipsis instead of spilling into the Type column (visible at larger UI zoom) */
.artifact-row .artifact-meta .program-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Largest UI zoom: tighter Tracker tracks so Actions stay on screen */
html[data-ui-zoom="125"] .tracker-col-head .artifact-meta,
html[data-ui-zoom="125"] .artifact-row .artifact-meta {
  grid-template-columns: minmax(96px, 1fr) 62px 78px 98px 56px 116px 76px 152px;
  column-gap: 10px;
  min-width: 800px;
}

/* Tracker bulk bar: pinned under the app header while rows are selected and the page is scrolled */
.bulk-bar-spacer { height: 0; }
.bulk-bar.is-pinned {
  position: fixed;
  z-index: 25; /* above rows/table; below the app header (30) and its menus, bg jobs, modals */
  margin: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.08);
}
[data-theme="dark"] .bulk-bar.is-pinned { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3); }

/* ===== Demo flow (flow1): Mock Shells finalize + Send to Tracker, workflow pills, SAS header ===== */
.toast.show.has-link { pointer-events: auto; max-width: min(460px, calc(100vw - 40px)); }
.toast .toast-link { color: #93C5FD; font-weight: 650; text-decoration: underline; margin-left: 4px; white-space: nowrap; }
[data-theme="dark"] .toast .toast-link { color: var(--blue); }

.shell-status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 650; line-height: 1;
  padding: 4px 9px; border-radius: 999px; border: 1px solid var(--warn-border);
  color: var(--warn); background: var(--warn-soft); white-space: nowrap;
}
.shell-status-badge.is-in-review { color: var(--purple); background: var(--purple-soft); border-color: var(--purple-border); }
.shell-status-badge.is-final, .shell-status-badge.is-locked { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
.shell-status-badge.is-synced::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.shell-actions .btn-finalize {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px;
  font-size: 12px; font-weight: 600; color: var(--ok); border-color: var(--ok-border); background: var(--surface);
}
.shell-actions .btn-finalize svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shell-actions .btn-finalize:hover:not(:disabled) { background: var(--ok-soft); }
.shell-actions .btn-finalize.is-done, .shell-actions .btn-finalize:disabled { opacity: 1; cursor: default; background: var(--ok-soft); }

.shell-catalog .catalog-section-table td.sync-cell { width: 30px; padding: 2px 6px 2px 0; text-align: right; vertical-align: middle; }
.shell-catalog .toc-final { font-size: 9.5px; font-weight: 650; color: var(--ok); background: var(--ok-soft); border: 1px solid var(--ok-border); border-radius: 999px; padding: 0 5px; margin-left: 2px; white-space: nowrap; }
.toc-sync {
  appearance: none; display: inline-grid; place-items: center;
  width: 22px; height: 22px; padding: 0; border-radius: 6px;
  border: 1px solid transparent; background: transparent; color: var(--muted-2); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.toc-sync svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.toc-sync[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.toc-sync.is-ready { color: var(--accent); border-color: var(--blue-border); background: var(--accent-soft); }
.toc-sync.is-ready:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.toc-sync.is-synced { color: var(--accent); }
.toc-sync.is-synced.is-linked { color: var(--muted); }
.toc-sync.is-synced:hover { background: var(--accent-soft); color: var(--accent); }
.toc-sync.just-synced { animation: tocPop .6s ease; }
@keyframes tocPop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.toc-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--blue-border); border-top-color: var(--accent); animation: tocSpin .7s linear infinite; }
@keyframes tocSpin { to { transform: rotate(360deg); } }
.toc-sync:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Tracker: QC program line */
.artifact-row .artifact-meta .qc-program-name {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 10.5px; color: var(--muted); margin-top: 1px; font-family: inherit;
}
.artifact-row .artifact-meta .qc-program-name b { font-weight: 650; color: var(--muted-2); margin-right: 3px; font-size: 9.5px; letter-spacing: .03em; }
.artifact-row .artifact-meta .program-open-link { color: var(--accent); text-decoration: none; cursor: pointer; }
.artifact-row .artifact-meta .program-open-link:hover { text-decoration: underline; }

/* Tracker: status pill + mini stepper */
.wf-pill {
  appearance: none; display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 3px 7px 4px; font: inherit; font-size: 11.5px; font-weight: 600; line-height: 1.15;
  cursor: pointer; max-width: 100%; text-align: left;
}
.wf-pill:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.wf-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.wf-pill .wf-pill-label { white-space: normal; max-width: 100%; }
.wf-pill .wf-mini { display: inline-flex; gap: 2px; }
.wf-pill .wf-mini i { width: 9px; height: 3px; border-radius: 2px; background: var(--border-strong); display: block; }
.wf-pill .wf-mini i.on { background: currentColor; }
.wf-pill.st-dev { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border); }
.wf-pill.st-revise { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-border); }
.wf-pill.st-qc { color: var(--purple); background: var(--purple-soft); border-color: var(--purple-border); }
.wf-pill.st-stats { color: var(--pink); background: var(--pink-soft); border-color: var(--pink-border); }
.wf-pill.st-mw { color: var(--blue); background: var(--blue-soft); border-color: var(--blue-border); }
.wf-pill.st-done { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
.wf-pill.st-none { color: var(--muted); }

.new-chip {
  display: inline-block; vertical-align: 1px; margin-left: 6px; padding: 1px 6px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .03em; color: #fff; background: var(--accent);
}
.artifact-row.flow-flash { animation: flowFlash 2.4s ease; }
@keyframes flowFlash { 0%, 40% { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); } 100% { background: transparent; box-shadow: none; } }
.artifact-row.is-flow-new { box-shadow: inset 3px 0 0 var(--accent); }

/* Workflow popover */
.wf-pop {
  position: fixed; z-index: 80; width: 340px; max-width: calc(100vw - 24px);
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(17,24,39,.18); padding: 14px; font-size: 12.5px;
}
.wf-pop[hidden] { display: none; }
.wf-pop-title { font-weight: 700; font-size: 13px; margin: 0 22px 2px 0; line-height: 1.3; }
.wf-pop-sub { color: var(--muted); font-size: 11.5px; margin-bottom: 10px; }
.wf-pop-close { position: absolute; top: 8px; right: 8px; appearance: none; border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 4px; }
.wf-pop-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.wf-pop-actions .btn { font-size: 12px; }
.wf-pop-confirm { margin-top: 10px; padding: 9px 10px; border-radius: 8px; background: var(--accent-soft); border: 1px solid var(--blue-border); font-size: 12px; }
.wf-pop-confirm .wf-pop-actions { margin-top: 8px; }
.wf-pop-owner { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.wf-pop-owner strong { color: var(--text); font-weight: 600; }

.wf-stepper { display: flex; align-items: flex-start; gap: 0; margin: 4px 0 2px; list-style: none; padding: 0; }
.wf-stepper li { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; min-width: 0; }
.wf-stepper li::before { content: ''; position: absolute; top: 10px; left: -50%; right: 50%; height: 2px; background: var(--border-strong); z-index: 0; }
.wf-stepper li:first-child::before { display: none; }
.wf-stepper li.is-done::before, .wf-stepper li.is-current::before { background: var(--accent); }
.wf-stepper .wf-dot { position: relative; z-index: 1; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; background: var(--surface); border: 2px solid var(--border-strong); color: var(--muted); }
.wf-stepper li.is-done .wf-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.wf-stepper li.is-current .wf-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--focus-ring); }
.wf-stepper .wf-lbl { margin-top: 4px; font-size: 10.5px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.wf-stepper li.is-done .wf-lbl, .wf-stepper li.is-current .wf-lbl { color: var(--text); }
.wf-stepper .wf-when { font-size: 9.5px; color: var(--muted-2); margin-top: 1px; }
.history-stepper { padding: 4px 0 12px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }

/* Program editor: Production / QC tabs */
.prog-tabs { display: flex; gap: 4px; margin: 0 0 8px; border-bottom: 1px solid var(--border); }
.prog-tab { appearance: none; border: 0; background: transparent; padding: 6px 10px; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.prog-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.prog-tab .prog-tab-file { font-weight: 500; color: var(--muted-2); margin-left: 4px; font-size: 11px; }
.prog-ro-note { font-size: 11.5px; color: var(--muted); margin: 0 0 6px; }

/* Tracker toolbar: labels always visible (flow1) */
#trackerListsBar .action-icon-btn .label { max-width: none; opacity: 1; margin-left: 7px; transform: none; }
#trackerListsBar .action-icon-btn { padding: 0 11px; }
.my-assign-wrap { display: inline-flex; align-items: center; gap: 4px; }
.my-assign-count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 7px;
  border-radius: 999px; font-size: 10.5px; font-weight: 700; background: var(--chip-bg); color: var(--muted);
}
.action-icon-btn.my-assign-btn.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.action-icon-btn.my-assign-btn.is-active .my-assign-count { background: var(--accent); color: #fff; }
.my-assign-clear {
  appearance: none; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; display: inline-grid; place-items: center; padding: 0;
}
.my-assign-clear:hover { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }
.my-assign-clear[hidden] { display: none; }

/* Inline roles on every tracker row (flow1) */
.artifact-title-band .row-roles-inline { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-left: auto; flex: 0 1 auto; min-width: 0; }
.role-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px 0 2px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: 10.5px; color: var(--text); white-space: nowrap; cursor: default;
}
.role-chip b { font-size: 9px; font-weight: 700; letter-spacing: .03em; color: var(--muted); padding-left: 4px; }
.role-chip .role-av { width: 16px; height: 16px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 8.5px; font-weight: 700; background: var(--chip-bg); color: var(--muted); }
.role-chip .role-nm { color: var(--text); }
.role-chip.is-me { border-color: var(--blue-border); background: var(--accent-soft); }
.role-chip.is-me .role-av { background: var(--accent); color: #fff; }
.role-chip.is-me b { color: var(--accent); }
html[data-ui-zoom="125"] .role-chip .role-nm, html[data-ui-zoom="150"] .role-chip .role-nm { display: none; }
@media (max-width: 1280px) { .role-chip .role-nm { display: none; } }

/* Mock Shells: output ID line, figure preview, metadata form (flow1) */
.sheet-outid { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.fig-preview { margin: 8px 0 10px; border: 1px dashed var(--border-strong); border-radius: 10px; padding: 8px; background: var(--surface); max-width: 620px; }
.fig-preview[hidden] { display: none; }
.fig-preview svg { width: 100%; height: auto; display: block; }
.fig-preview .fp-axis { stroke: var(--muted); stroke-width: 1.2; }
.fig-preview .fp-tick { fill: var(--muted); font-size: 10px; }
.fig-preview .fp-lbl { fill: var(--text); font-size: 11px; font-weight: 600; }
.fig-preview .fp-c1 { fill: none; stroke: var(--accent); stroke-width: 2; }
.fig-preview .fp-c2 { fill: none; stroke: var(--pink); stroke-width: 2; stroke-dasharray: 6 4; }
.fig-preview .fp-leg { fill: var(--surface); stroke: var(--border); }
.shell-meta-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; margin-bottom: 14px; }
.shell-meta-form .smf-field { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); min-width: 0; }
.shell-meta-form .smf-field.is-wide { grid-column: span 2; }
.shell-meta-form input, .shell-meta-form select, .shell-meta-form textarea {
  font: inherit; font-size: 12.5px; font-weight: 500; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; min-width: 0; width: 100%; box-sizing: border-box;
}
.shell-meta-form textarea { resize: vertical; }
.shell-meta-form input[readonly] { background: var(--th-bg); color: var(--muted); }
.shell-meta-form input:focus, .shell-meta-form select:focus, .shell-meta-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.shell-meta-sub { font-size: 12px; font-weight: 700; margin: 4px 0 6px; }
@media (max-width: 900px) { .shell-meta-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.admin-subnav .admin-reset-demo { display: block; margin-top: 14px; padding: 6px 10px; font-size: 11px; color: var(--muted-2); text-decoration: none; }
.admin-subnav .admin-reset-demo:hover { color: var(--danger); text-decoration: underline; }
/* Shell grid: let long column headers wrap instead of truncating (listings) */
.sheet-grid thead th.col-data, .sheet-grid thead th.col-data .th-text { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: normal; word-break: normal; line-height: 1.25; vertical-align: bottom; }
/* Released to MW = final stage (flow2) */
.wf-pill.is-released { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); cursor: pointer; }
.wf-pill.is-released .wf-mini i.on { background: var(--ok); }
.wf-pill .wf-rel-check { font-weight: 700; margin-right: 3px; }
.wf-released-note { font-size: 12px; font-weight: 600; color: var(--ok); background: var(--ok-soft); border: 1px solid var(--ok-border); border-radius: 8px; padding: 5px 9px; }
.artifact-row.is-released .artifact-title { color: var(--text); }

/* Study layout trees (flow3) */
.lt-tree { list-style: none; margin: 0; padding: 0 0 0 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; line-height: 1.55; }
.lt-tree.lt-root { padding-left: 0; }
.lt-node { position: relative; padding-left: 12px; color: var(--text); }
.lt-node::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1px solid var(--border-strong); }
.lt-node::after { content: ''; position: absolute; left: 0; top: .78em; width: 8px; border-top: 1px solid var(--border-strong); }
.lt-node:last-child::before { bottom: auto; height: .78em; }
.lt-root > .lt-node { padding-left: 0; }
.lt-root > .lt-node::before, .lt-root > .lt-node::after { display: none; }
.lt-dir { font-weight: 600; }
.lt-sub > .lt-dir { font-weight: 400; color: var(--muted); }
.lt-more { color: var(--muted-2); }
.lt-node.is-new > .lt-dir { color: var(--ok); }
.lt-node.is-path > .lt-dir { color: var(--accent); }
.lt-node.is-current > .lt-dir { color: var(--accent); }
.lt-badge { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; font-family: inherit; font-size: 9.5px; font-weight: 700; color: #fff; background: var(--ok); vertical-align: 1px; }
.lt-badge.cur { background: var(--accent); }

.layout-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 8px 0 4px; }
.layout-card { position: relative; display: flex; flex-direction: column; gap: 8px; border: 1.5px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.layout-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.layout-card input { position: absolute; opacity: 0; pointer-events: none; }
.layout-card.is-selected, .layout-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.layout-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.layout-card-head { display: flex; align-items: center; gap: 8px; }
.layout-card-radio { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); flex: 0 0 auto; display: grid; place-items: center; }
.layout-card:has(input:checked) .layout-card-radio { border-color: var(--accent); }
.layout-card:has(input:checked) .layout-card-radio::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.layout-card-title { font-size: 13px; font-weight: 700; color: var(--text); }
.layout-card-path { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 3px 6px; }
.layout-card-tree { background: var(--th-bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-height: 120px; }
.layout-card-hint { font-size: 11.5px; color: var(--muted); font-weight: 400; }
@media (max-width: 1100px) { .layout-cards { grid-template-columns: 1fr; } }

.ns-location { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--th-bg); }
.ns-location-head { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.ns-location-head strong { font-size: 12.5px; }
.ns-layout-hint { font-size: 11.5px; color: var(--muted); }
.ns-layout-hint a { color: var(--accent); }
.ns-pick { display: flex; flex-direction: column; gap: 6px; }
.ns-pick .field-input[hidden] { display: none; }
.ns-exists { grid-column: 1 / -1; font-size: 12px; color: var(--danger); }
.ns-exists[hidden] { display: none; }
.new-study-preview .lt-tree { font-size: 12px; }
.ns-path-chip { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--blue-border); border-radius: 8px; padding: 6px 10px; word-break: break-all; }

.files-studies { border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 8px; }
.files-studies .lt-tree { font-size: 12px; }
.files-studies a.lt-dir { color: inherit; text-decoration: none; }
.files-studies a.lt-dir:hover { text-decoration: underline; color: var(--accent); }
.files-studies .lt-node.is-active > .lt-dir { color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 4px; }

/* Mock Shells: TOC fills viewport height, sticky while editor scrolls (flow3) */
@media (min-width: 1101px) {
  .shell-workspace { overflow: clip; align-items: flex-start; }
  .shell-workspace > .shell-catalog {
    position: sticky;
    top: var(--toc-top, 0px);
    align-self: flex-start;
    height: var(--toc-h, calc(100vh - 80px));
    max-height: none;
  }
  .shell-workspace > .shell-split-handle { align-self: stretch; }
  .shell-catalog .table-wrap { max-height: none; flex: 1 1 0; min-height: 0; }
  .shell-workspace > .shell-editor { min-height: var(--toc-h-min, 520px); align-self: stretch; }
}
.study-path-line { margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: var(--accent); opacity: .85; }
.study-card .study-path-line { margin: 6px 0 0; }
.new-study-form .field[hidden], .new-study-form .ns-pick[hidden] { display: none !important; }
.layout-card-path { overflow-wrap: anywhere; white-space: normal; }
.new-study-grid .new-study-preview { display: grid; grid-template-columns: minmax(0, 1fr); }

/* Tracker row layout v2 (flow3): [title + tags / roles] | Type Status Assigned Shell Job Programs Files Actions */
.artifact-row .artifact-main,
.tracker-col-head .artifact-main {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto;
  column-gap: 14px;
  align-items: center;
}
.artifact-row .artifact-title-band {
  grid-column: 1;
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(60px, 1fr);
  column-gap: 8px;
  row-gap: 5px;
  align-items: center;
  container-type: inline-size;
}
.artifact-row .artifact-title-band .artifact-title { grid-column: 1; }
.artifact-row .artifact-title-band .artifact-tags { grid-column: 2; flex: none; min-width: 0; overflow: hidden; }
.artifact-row .artifact-title-band .row-roles-inline { grid-column: 1 / -1; justify-content: flex-start; margin-left: 0; gap: 4px; flex-wrap: nowrap; overflow: hidden; }
.artifact-row .artifact-meta, .tracker-col-head .artifact-meta { grid-column: 2; }
.tracker-col-head .col-head-output { grid-column: 1; display: flex; align-items: baseline; gap: 6px; }
.col-head-sub { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.col-head-sub::before { content: '· '; }

.tracker-col-head .artifact-meta,
.artifact-row .artifact-meta {
  grid-template-columns: 54px 112px 96px 54px 112px minmax(130px, 160px) 76px 136px;
  column-gap: 10px;
  min-width: 0;
}
html[data-ui-zoom="125"] .tracker-col-head .artifact-meta,
html[data-ui-zoom="125"] .artifact-row .artifact-meta,
html[data-ui-zoom="150"] .tracker-col-head .artifact-meta,
html[data-ui-zoom="150"] .artifact-row .artifact-meta {
  grid-template-columns: 50px 108px 88px 50px 106px minmax(124px, 150px) 72px 136px;
  column-gap: 8px;
  min-width: 0;
}
html[data-ui-zoom="125"] .artifact-row .artifact-main, html[data-ui-zoom="125"] .tracker-col-head .artifact-main { grid-template-columns: minmax(180px, 1fr) auto; }
.artifact-meta > .meta-cell:first-child { order: 1; }
.artifact-meta > .meta-cell:nth-child(7), .artifact-meta > .meta-cell:nth-child(8) { order: 2; }
.artifact-row .artifact-meta .program-name { font-size: 11px; line-height: 1.35; }
.artifact-row .artifact-meta .qc-program-name { margin-top: 2px; }
.artifact-row { padding-top: 11px; padding-bottom: 11px; }
.artifact-row .wf-pill .wf-pill-label { white-space: nowrap; }

/* Actions stay visible when the board scrolls horizontally (large zoom / narrow screens) */
.artifact-row .artifact-meta > .actions-cell,
.tracker-col-head .artifact-meta > .meta-cell:last-child {
  position: sticky; right: 0;
}
.artifact-row .artifact-meta > .actions-cell:has(.row-exec-menu:not([hidden])),
.artifact-row .artifact-meta > .actions-cell:has(.row-people-wrap:hover),
.artifact-row .artifact-meta > .actions-cell:focus-within { z-index: 30; }
.tracker-col-head .artifact-meta > .meta-cell:last-child { background: linear-gradient(90deg, transparent, var(--accent-soft) 10px); padding-left: 10px; margin-left: -10px; align-self: stretch; }
.artifact-row .artifact-meta > .actions-cell { background: linear-gradient(90deg, transparent, var(--surface) 10px); padding-left: 10px; margin-left: -10px; }

/* Roles line: compact + muted */
.artifact-row .role-chip { height: 18px; border-color: transparent; background: var(--row-hover); color: var(--muted); padding: 0 6px 0 1px; }
.artifact-row .role-chip .role-av { width: 15px; height: 15px; font-size: 8px; }
.artifact-row .role-chip .role-nm { color: var(--muted); display: none; }
.artifact-row .role-chip.is-me { background: var(--accent-soft); border-color: transparent; }
@container (min-width: 330px) { .artifact-row .role-chip .role-nm { display: inline; } }
/* Tags: hide whole chips that don't fit on line 1 (never half-clipped) */
.artifact-row .artifact-title-band .chip-row { flex-wrap: wrap; overflow: hidden; max-height: 22px; row-gap: 8px; align-items: center; min-width: 0; flex: 1 1 auto; }
/* TOC + (Send to Tracker): comfortable hit area, always clickable (flow3) */
.shell-catalog .catalog-section-table td.sync-cell { width: 34px; padding: 2px 4px 2px 0; position: relative; z-index: 3; }
.toc-sync { width: 26px; height: 26px; position: relative; z-index: 3; pointer-events: auto; touch-action: manipulation; }
.toc-sync::after { content: ''; position: absolute; inset: -4px; border-radius: 8px; }
.toc-sync svg { width: 15px; height: 15px; pointer-events: none; }
.toc-sync .toc-spin { pointer-events: none; }
.shell-status-badge.is-version { color: var(--muted); background: var(--chip-bg); border-color: var(--border); }
.shell-status-badge.is-version.is-synced { color: var(--accent); background: var(--accent-soft); border-color: var(--blue-border); }
.toc-sync.is-disabled { color: var(--muted-2); border-color: var(--border); background: transparent; opacity: .55; cursor: not-allowed; }
.toc-sync.is-disabled:hover { opacity: .75; }
/* Shell Status dropdown: clearly visible, colour-coded */
#metaStatus { font-weight: 650; border-radius: 999px; padding-left: 10px; border: 1px solid var(--border-strong); }
#metaStatus[data-status="draft"] { color: var(--muted); background: var(--chip-bg); }
#metaStatus[data-status="in-review"] { color: var(--warn, #b45309); background: var(--warn-soft, #fff7e6); border-color: var(--warn-border, #f5d49a); }
#metaStatus[data-status="final"] { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
#metaStatus[data-status="locked"] { color: var(--accent); background: var(--accent-soft); border-color: var(--blue-border); }

/* Shared SAP sections (flow3) */
.shell-catalog .sap-section { position: relative; }
.sap-section-ref { margin-left: auto; font-size: 10px; font-weight: 600; color: var(--muted-2); letter-spacing: .02em; white-space: nowrap; }
.shell-catalog .sap-section-head { padding-right: 30px; width: 100%; }
.sap-section-edit { position: absolute; right: 4px; top: 6px; width: 24px; height: 24px; border: none; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer; font-size: 15px; line-height: 1; opacity: .55; }
.shell-catalog .sap-section:hover .sap-section-edit, .sap-section-edit:focus-visible { opacity: 1; }
.sap-section-edit:hover { background: var(--row-hover); color: var(--accent); }
.catalog-empty-hint { display: block; padding: 8px 10px; font-size: 11px; color: var(--muted-2); font-style: italic; }
.shell-catalog tr.catalog-drop-pad { cursor: pointer; }
.catalog-new-section { display: flex; align-items: center; gap: 6px; width: calc(100% - 16px); margin: 10px 8px 12px; padding: 8px 10px; border: 1.5px dashed var(--border-strong); border-radius: 8px; background: transparent; color: var(--accent); font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
.catalog-new-section:hover { background: var(--accent-soft); border-color: var(--accent); }
.catalog-new-section svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.section-modal { max-width: 460px; }
.section-form { display: grid; gap: 12px; }
.section-form .meta-field { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.section-form input, .section-form select { font: inherit; font-size: 13.5px; font-weight: 400; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px; }
.section-form .hint { font-weight: 400; font-size: 11.5px; }
.section-form-err { margin: 0; color: var(--danger); font-size: 12px; }
.sap-section.flow-flash > .sap-section-head, .sap-section.flow-flash > .sap-section-bar { animation: secFlash 1.6s ease; }
@keyframes secFlash { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
.sap-empty-note { padding: 10px 12px 12px 44px; font-size: 12px; color: var(--muted); font-style: italic; }
.tracker-board .sap-section.is-vacant .sap-section-count { opacity: .6; }
.sap-section-bar .sap-section-ref { margin-left: 8px; }
.tracker-add-section { margin: 6px 0 4px; }
/* Role chips: label + name only (no initials), names always shown; wrap/ellipsis instead of initials (flow3) */
.artifact-row .artifact-title-band .row-roles-inline { flex-wrap: wrap; overflow: visible; row-gap: 3px; column-gap: 4px; }
.artifact-row .role-chip { padding: 0 7px 0 2px; max-width: 100%; min-width: 0; }
.artifact-row .role-chip .role-nm,
html[data-ui-zoom="125"] .artifact-row .role-chip .role-nm,
html[data-ui-zoom="150"] .artifact-row .role-chip .role-nm { display: inline-block; max-width: 11ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
@media (max-width: 1280px) { .artifact-row .role-chip .role-nm { display: inline-block; } }
.artifact-row .role-chip b { padding-left: 4px; }
/* File Explorer: one compact info bar (study + programs layout) (flow3) */
.files-infobar { display: flex; flex-direction: column; gap: 3px; padding: 7px 12px; margin: 0; border: 1px solid var(--blue-border); border-radius: var(--radius-sm); background: var(--accent-soft); font-size: 12px; line-height: 1.45; color: var(--text); }
.files-infobar-line { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.files-infobar-k { flex: 0 0 64px; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.files-infobar code { font-size: 11px; }
.files-infobar a { color: var(--accent); }
.files-stack:has(.files-infobar) .page-intro { margin-bottom: 0; }
.layout-save-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.layout-dirty { color: var(--warn, #b45309); font-weight: 650; }
.layout-saved-ok { color: var(--ok); font-weight: 650; }
.layout-save-row a, #layoutLevelSaved a { color: var(--accent); font-weight: 600; }
.btn.is-dirty { box-shadow: 0 0 0 3px var(--focus-ring); }
.layout-card-default { margin-left: auto; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--chip-bg); border-radius: 999px; padding: 1px 7px; }
.layout-card.is-saved .layout-card-title::after { content: ' · saved'; font-weight: 500; color: var(--ok); font-size: 11px; }
/* Locked shell: muted, read-only editor (flow3) */
.shell-lock-banner { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--chip-bg); color: var(--text); font-size: 12.5px; }
.shell-lock-banner svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.shell-lock-banner .btn { margin-left: auto; }
.shell-editor.is-locked .sheet-titles,
.shell-editor.is-locked .sheet-grid-wrap,
.shell-editor.is-locked .sheet-blocks,
.shell-editor.is-locked .fig-preview { opacity: .6; filter: grayscale(.35); pointer-events: none; user-select: none; }
.shell-editor.is-locked .sheet-grid-wrap { background: color-mix(in srgb, var(--chip-bg) 60%, transparent); border-radius: 8px; }
.shell-editor.is-locked #btnAddRow,
.shell-editor.is-locked .row-float-toolbar,
.shell-editor.is-locked .col-select-toolbar { display: none !important; }
.shell-editor.is-locked .shell-props select:not(#metaStatus) { opacity: .6; pointer-events: none; }
#btnLock.is-active { color: var(--accent); background: var(--accent-soft); border-color: var(--blue-border); }
/* Tracker toolbar tidy (flow3e): no separators, uniform buttons; blue = toggle ON / view active only */
#trackerListsBar { gap: 8px; align-items: center; }
#trackerListsBar .actions-sep { display: none; }
#trackerListsBar .my-assign-wrap { display: inline-flex; align-items: center; gap: 6px; }
#trackerListsBar .action-icon-btn { display: inline-flex; align-items: center; height: 34px; min-height: 34px; padding: 0 12px; gap: 8px; font-size: 13px; font-weight: 600; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: none; }
#trackerListsBar .action-icon-btn .label { margin-left: 0 !important; font-weight: 600; }
#trackerListsBar .action-icon-btn svg { width: 16px; height: 16px; flex: none; }
#trackerListsBar .action-icon-btn:hover:not(:disabled) { background: var(--row-hover); border-color: var(--border-strong); color: var(--text); box-shadow: none; }
#trackerListsBar .action-icon-btn.is-active,
#trackerListsBar .action-icon-btn.is-active:hover:not(:disabled),
#trackerListsBar .action-icon-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: none; }
#trackerListsBar .action-icon-btn .my-assign-count { font-weight: 650; }
#trackerListsBar .action-icon-btn.is-active .my-assign-count { background: #fff; color: var(--accent); }
/* Tracker Status column: pill only, no mini progress bar (flow3f) */
.wf-pill { flex-direction: row; align-items: center; padding: 3px 8px; }
.wf-pill .wf-mini { display: none; }
/* Roles editor popover (body-level, fixed; flow3g) */
.row-people-wrap .row-people-tip { display: none !important; }
.roles-pop { position: fixed; z-index: 4000; width: 340px; max-width: calc(100vw - 16px); overflow: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 18px 48px rgba(15, 23, 42, .22), 0 2px 8px rgba(15, 23, 42, .08); font-size: 13px; }
.roles-pop[hidden] { display: none; }
.roles-pop-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 12px 14px 8px; border-bottom: 1px solid var(--border); }
.roles-pop-title { font-weight: 700; font-size: 14px; }
.roles-pop-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.roles-pop-x { appearance: none; border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.roles-pop-x:hover { background: var(--row-hover); color: var(--text); }
.roles-pop-body { padding: 10px 14px 4px; display: grid; gap: 10px; }
.roles-field { position: relative; }
.roles-field-label { display: block; font-size: 11.5px; font-weight: 650; color: var(--muted); margin-bottom: 4px; text-transform: none; }
.roles-combo { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 34px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.roles-combo:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.roles-chips { display: contents; }
.roles-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: 12px; font-weight: 600; }
.roles-chip.is-me { box-shadow: inset 0 0 0 1px var(--accent); }
.roles-chip-x { appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 3px; border-radius: 50%; }
.roles-chip-x:hover { color: var(--text); background: var(--row-hover); }
.roles-input { flex: 1 1 90px; min-width: 80px; border: 0 !important; outline: none; box-shadow: none !important; background: transparent; color: var(--text); font: inherit; font-size: 13px; padding: 4px 2px; height: auto; }
.roles-list { position: absolute; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 24px rgba(15, 23, 42, .16); max-height: 180px; overflow: auto; z-index: 2; }
.roles-list li { padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.roles-list li[data-name]:hover { background: var(--row-hover); }
.roles-list li.roles-empty { cursor: default; }
.roles-pop-foot { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 14px 12px; border-top: 1px solid var(--border); margin-top: 8px; }
.roles-pop-hint { margin-right: auto; font-size: 11.5px; }
.roles-pop { display: flex; flex-direction: column; overflow: hidden; }
.roles-pop-head, .roles-pop-foot { flex: none; }
.roles-pop-head > div { min-width: 0; }
.roles-pop-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.roles-pop-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding-bottom: 10px; }
.roles-pop-foot { margin-top: 0; }
/* Role chips: highlight the chip for the current workflow stage only (flow3i) */
.artifact-row .role-chip.is-me { background: var(--row-hover); }
.role-chip.is-me .role-av { background: var(--chip-bg); color: var(--muted); }
.artifact-row .role-chip.is-me b { color: var(--muted); }
.artifact-row .role-chip.is-stage { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--blue-border); }
.artifact-row .role-chip.is-stage b { color: var(--accent); }
.artifact-row .role-chip.is-stage .role-nm { color: var(--text); font-weight: 600; }
/* SAP section modal: full-width fields (flow3j) */
#sectionModal .section-form .meta-field { display: flex; flex-direction: column; align-items: stretch; width: 100%; }
#sectionModal .section-form .meta-field > input,
#sectionModal .section-form .meta-field > select { display: block; width: 100%; max-width: none; min-width: 0; height: 38px; box-sizing: border-box; flex: none; }
#sectionModal .section-field-label { display: block; }
