/* ============================================================
   Secure Delivery Hub — Design System
   Version 0.3 | See docs/ui-style-guide.md for full guide
   ============================================================ */

/* --- Design Tokens ----------------------------------------- */
:root {
  /* Surfaces */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-hover: #f0f4f8;

  /* Text */
  --text: #111827;
  --text-secondary: #4b5563;
  --muted: #6b7280;
  --muted-light: #9ca3af;

  /* Borders */
  --line: #e5e7eb;
  --line-strong: #d1d5db;

  /* Navigation */
  --nav: #111827;
  --nav-hover: #1f2937;
  --nav-active: #1d4ed8;
  --nav-active-bg: rgba(59, 130, 246, 0.12);
  --nav-text: #d1d5db;
  --nav-text-muted: #9ca3af;

  /* Brand accent */
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #eff6ff;
  --accent-text: #1e40af;

  /* Status: ok / green */
  --ok-bg: #dcfce7;
  --ok-text: #14532d;
  --ok-border: #86efac;

  /* Status: warn / amber */
  --warn-bg: #fef3c7;
  --warn-text: #78350f;
  --warn-border: #fcd34d;

  /* Status: bad / red */
  --bad-bg: #fee2e2;
  --bad-text: #7f1d1d;
  --bad-border: #fca5a5;

  /* Status: info / blue */
  --info-bg: #eff6ff;
  --info-text: #1e3a8a;
  --info-border: #93c5fd;

  /* Status: purple */
  --purple-bg: #f3e8ff;
  --purple-text: #581c87;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.12);

  /* Border radius */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Sidebar */
  --sidebar-w: 252px;
  --topbar-h: 64px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 150ms;
}

/* --- Reset & Base ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* --- Layout Shell ------------------------------------------ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* --- Sidebar ----------------------------------------------- */
.sidebar {
  background: var(--nav);
  color: var(--nav-text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  padding: 16px 12px;
  gap: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 8px;
}

.brand-mark {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-name { font-size: 13px; font-weight: 700; line-height: 1.3; }
.brand-sub { font-size: 11px; color: var(--nav-text-muted); margin-top: 1px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nav-text-muted);
  padding: 12px 10px 4px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--nav-text-muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  text-align: left;
}
.nav-btn:hover { background: var(--nav-hover); color: #f9fafb; }
.nav-btn.active { background: var(--nav-active-bg); color: #93c5fd; }
.nav-btn svg { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.sidebar-user {
  margin-top: auto;
  padding: 12px 10px 4px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: var(--nav-text-muted);
}
.sidebar-user strong { display: block; color: var(--nav-text); font-size: 13px; margin-bottom: 2px; }

/* --- Main -------------------------------------------------- */
.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
}

/* --- Topbar ------------------------------------------------ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 0 20px;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.topbar-title-group { min-width: 0; }
.page-title {
  font-size: 16px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin: 0;
}
.page-breadcrumb {
  font-size: 11px; color: var(--muted); margin-top: 1px;
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.breadcrumb-sep { color: var(--line); }
.topbar-gate-pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 8px; border-radius: 20px; font-size: 10px; font-weight: 700;
  letter-spacing: .04em;
}
.topbar-gate-pill.ok  { background: #dcfce7; color: #166534; }
.topbar-gate-pill.bad { background: #fee2e2; color: #991b1b; }

/* Gate Status Button in Toolbar */
.topbar-gate-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  border: 1px solid transparent; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
  transition: opacity .15s, box-shadow .15s;
}
.topbar-gate-btn:hover { opacity: .85; box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
.topbar-gate-btn.ok  { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.topbar-gate-btn.bad { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.topbar-gate-btn:not(.ok):not(.bad) { background: var(--surface-alt,#f3f4f6); color: var(--muted); border-color: var(--line); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.topbar-scope {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface-alt, #f3f4f6); border: 1px solid var(--line);
  border-radius: 8px; padding: 2px 6px;
}
.scope-sep { color: var(--muted); font-size: 12px; }
.select-compact {
  border: none !important; background: transparent !important;
  padding: 4px 6px !important; font-size: 13px !important;
  box-shadow: none !important;
}
.select-compact:focus { outline: 1px solid var(--accent); border-radius: 4px; }
.toolbar-divider { width: 1px; height: 24px; background: var(--line); margin: 0 2px; }
.topbar-icon-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-alt, #f3f4f6); cursor: pointer;
  font-size: 12px; color: var(--muted); transition: all .15s;
}
.topbar-icon-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.topbar-icon-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.topbar-icon-btn kbd { background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; font-size: 10px; }

/* --- Content Area ------------------------------------------ */
.content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  overflow-y: auto;
}

/* --- Panels ------------------------------------------------ */
.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-title { font-size: 14px; font-weight: 700; }
.panel-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }

.panel-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.panel-body { padding: 16px 20px; }
.panel-body + .panel-body { border-top: 1px solid var(--line); }

/* --- Metrics Grid ------------------------------------------ */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metrics.col-3 { grid-template-columns: repeat(3, 1fr); }
.metrics.col-2 { grid-template-columns: repeat(2, 1fr); }

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.metric-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.metric-value { font-size: 26px; font-weight: 800; line-height: 1.1; color: var(--text); }
.metric-detail { font-size: 12px; color: var(--muted); }

/* --- Badges ------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.ok    { background: var(--ok-bg);    color: var(--ok-text);    border-color: var(--ok-border); }
.badge.warn  { background: var(--warn-bg);  color: var(--warn-text);  border-color: var(--warn-border); }
.badge.bad   { background: var(--bad-bg);   color: var(--bad-text);   border-color: var(--bad-border); }
.badge.info  { background: var(--info-bg);  color: var(--info-text);  border-color: var(--info-border); }
.badge.muted { background: #f3f4f6; color: var(--muted); border-color: var(--line); }
.badge.purple{ background: var(--purple-bg); color: var(--purple-text); }

/* --- Buttons ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), opacity var(--dur);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:not(:disabled):hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}
.btn-secondary:not(:disabled):hover { background: var(--surface-hover); border-color: #adb5c4; }

.btn-danger {
  background: var(--bad-bg);
  color: var(--bad-text);
  border-color: var(--bad-border);
}
.btn-danger:not(:disabled):hover { background: #fca5a5; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:not(:disabled):hover { background: var(--surface-hover); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-xs { padding: 2px 7px; font-size: 11px; }
.btn-icon { padding: 6px; border-radius: var(--radius); }

/* Loading spinner inside button */
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  color: inherit;
}
.btn-primary.loading::after { color: #fff; }

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Selects & Inputs -------------------------------------- */
.select, .input, .textarea {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  width: 100%;
}
.select:focus, .input:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29,78,216,0.1);
}
.textarea { resize: vertical; min-height: 80px; }
.select { cursor: pointer; }

/* Topbar compact selects */
.topbar .select { width: auto; min-width: 140px; font-size: 13px; padding: 6px 10px; }

/* --- Forms ------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.field-hint { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* --- Tables ------------------------------------------------ */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--surface-soft);
}
.table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--surface-soft); }
.table .muted { color: var(--muted); font-size: 12px; display: block; margin-top: 2px; }

/* --- List -------------------------------------------------- */
.list { display: flex; flex-direction: column; }

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  transition: background var(--dur) var(--ease);
}
.item:last-child { border-bottom: none; }
.item:hover { background: var(--surface-soft); }
.item-body { flex: 1; min-width: 0; }
.item-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.item-meta { font-size: 12px; color: var(--muted); }
.item-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* --- Task Board -------------------------------------------- */
.task-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px 20px;
}

.task-col { display: flex; flex-direction: column; gap: 8px; min-height: 120px; }

.task-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 4px 8px;
  border-bottom: 2px solid var(--line);
}
.task-col-header.col-open   { border-color: var(--warn-border); color: var(--warn-text); }
.task-col-header.col-doing  { border-color: var(--accent); color: var(--accent-text); }
.task-col-header.col-waiting{ border-color: var(--muted-light); }
.task-col-header.col-done   { border-color: var(--ok-border); color: var(--ok-text); }

.task-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.task-card:hover { box-shadow: var(--shadow); border-color: #adb5c4; }
.task-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(29,78,216,0.12); }
.task-card.dragging { opacity: 0.55; border-style: dashed; }
.task-card-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.inline-select {
  width: auto;
  min-width: 140px;
  padding: 4px 8px;
  font-size: 11px;
}
.task-card-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.task-card-title { font-size: 13px; font-weight: 600; line-height: 1.4; }
.task-card-meta { font-size: 11px; color: var(--muted); }
.task-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; }
.task-card-actions { display: flex; gap: 4px; }

/* --- Workflow Rail ----------------------------------------- */
.workflow-rail {
  display: flex;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.wf-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  font-size: 13px;
  transition: background var(--dur);
}
.wf-step:last-child { border-right: none; }
.wf-step.done { background: #f0fdf4; }
.wf-step.doing { background: var(--accent-soft); }
.wf-step.blocked { background: var(--bad-bg); }
.wf-step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  background: var(--line);
  color: var(--muted);
}
.wf-step.done .wf-step-num   { background: #86efac; color: var(--ok-text); }
.wf-step.doing .wf-step-num  { background: var(--accent); color: #fff; }
.wf-step.blocked .wf-step-num{ background: #fca5a5; color: var(--bad-text); }
.wf-step-text { min-width: 0; }
.wf-step-label { font-weight: 700; font-size: 12px; }
.wf-step-detail { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* --- Hero / Workbench -------------------------------------- */
.workbench {
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  padding: 28px 32px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
}
.workbench-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent-text); margin-bottom: 6px; display: block; }
.workbench-title { font-size: 24px; font-weight: 800; line-height: 1.2; margin-bottom: 8px; }
.workbench-body { font-size: 13px; color: var(--text-secondary); line-height: 1.6; max-width: 520px; }

.workbench-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.workbench-actions .btn-primary { background: rgba(59,130,246,0.9); border-color: rgba(99,155,255,0.6); }
.workbench-actions .btn-primary:hover { background: var(--accent); }
.workbench-actions .btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.workbench-actions .btn-secondary:hover { background: var(--surface-hover); }

.workbench-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 200px;
}
.wbstat {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.wbstat-val { font-size: 18px; font-weight: 800; color: var(--text); }

/* --- Narrative Card ---------------------------------------- */
.narrative-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  overflow: hidden;
}
.narrative-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.narrative-headline { font-size: 14px; font-weight: 600; line-height: 1.5; flex: 1; }
.narrative-actions-list { list-style: none; }
.narrative-action-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
}
.narrative-action-item:last-child { border-bottom: none; }
.narrative-action-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warn-border);
  flex-shrink: 0;
  margin-top: 4px;
}
.narrative-action-dot.blocker { background: var(--bad-border); }
.narrative-action-dot.ok { background: var(--ok-border); }

/* --- Two-column grid --------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* --- Drawer ------------------------------------------------ */
.drawer-backdrop,
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.15s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } }

.drawer {
  background: var(--surface);
  width: min(540px, 92vw);
  height: 100%;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideIn 0.2s var(--ease);
}
@keyframes slideIn { from { transform: translateX(100%); } }

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  flex-shrink: 0;
}
.drawer-title { font-size: 16px; font-weight: 700; }
.drawer-subtitle { font-size: 12px; color: var(--muted); margin-top: 3px; }
.drawer-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; flex: 1; }

.detail-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.detail-section-header {
  padding: 10px 16px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.detail-section-body { padding: 14px 16px; font-size: 13px; }

/* --- Toast ------------------------------------------------- */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: #1f2937;
  color: #f9fafb;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastIn 0.2s var(--ease);
  max-width: 380px;
}
.toast.ok    { background: #166534; }
.toast.error { background: #991b1b; }
.toast.info  { background: #1e3a8a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }

/* --- Progress bar ------------------------------------------ */
.progress-bar {
  height: 6px;
  background: var(--line);
  border-radius: 100px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--accent);
  transition: width 0.4s var(--ease);
}
.progress-bar-fill.ok   { background: #22c55e; }
.progress-bar-fill.warn { background: #f59e0b; }
.progress-bar-fill.bad  { background: #ef4444; }

/* --- Status pill ------------------------------------------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
}
.status-pill::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
  flex-shrink: 0;
}

/* --- Chips ------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* --- Empty state ------------------------------------------- */
.empty {
  text-align: center;
  padding: 40px 24px;
  color: var(--muted);
  font-size: 13px;
}
.empty-icon { font-size: 32px; margin-bottom: 10px; opacity: 0.4; }
.empty strong { display: block; font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }

/* --- Code / JSON view -------------------------------------- */
.json-view {
  background: #0f172a;
  color: #94a3b8;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
  font-size: 11.5px;
  overflow-x: auto;
  white-space: pre-wrap;
  max-height: 360px;
  overflow-y: auto;
}

/* --- Tabs -------------------------------------------------- */
.tabs {
  display: flex;
  gap: 2px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 5px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
}
.tab-btn:hover { background: var(--surface-hover); color: var(--text); }
.tab-btn.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }

/* --- Exception Status Flow --------------------------------- */
.exception-flow {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 0;
}
.exc-status {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-soft);
  border: 2px solid var(--line);
  color: var(--muted);
}
.exc-status.current { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.exc-arrow { color: var(--muted-light); font-size: 14px; }

/* --- Heatmap ----------------------------------------------- */
.heatmap-grid { overflow-x: auto; }
.heatmap-table { border-collapse: collapse; font-size: 11px; width: max-content; }
.heatmap-table th { padding: 6px 10px; text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); white-space: nowrap; }
.heatmap-table td { padding: 6px 10px; border: 1px solid var(--line); white-space: nowrap; }
.hm-cell { width: 36px; height: 26px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.hm-ok   { background: var(--ok-bg);   color: var(--ok-text); }
.hm-warn { background: var(--warn-bg); color: var(--warn-text); }
.hm-bad  { background: var(--bad-bg);  color: var(--bad-text); }
.hm-na   { background: var(--surface-soft); color: var(--muted-light); }

/* --- Training cards --------------------------------------- */
.training-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: box-shadow var(--dur);
}
.training-card:hover { box-shadow: var(--shadow); }
.training-card-title { font-size: 13px; font-weight: 700; }
.training-card-meta { font-size: 12px; color: var(--muted); }
.training-card-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.training-card a { color: var(--accent-text); font-weight: 600; font-size: 12px; }
.training-card a:hover { text-decoration: underline; }

/* --- Settings ---------------------------------------------- */
.settings-section { display: flex; flex-direction: column; gap: 20px; }

/* --- Product UI Compatibility & Execution Patterns --------- */
.brand-title { font-size: 13px; font-weight: 700; line-height: 1.3; }
.brand-subtitle { display: block; font-size: 11px; color: var(--nav-text-muted); margin-top: 1px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--nav-text-muted);
  text-align: left;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-button:hover { background: var(--nav-hover); color: #f9fafb; }
.nav-button.active { background: var(--nav-active-bg); color: #93c5fd; }
.nav-icon, .nav-btn svg, .nav-button svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-panel {
  margin-top: auto;
  padding: 12px 10px 4px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: var(--nav-text-muted);
}
.page-subtitle { font-size: 12px; color: var(--muted); margin-top: 1px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  position: relative;
}
.button:hover  { background: var(--surface-hover); border-color: #adb5c4; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.button:active { transform: translateY(1px); box-shadow: none; }
.button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.button:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* Primary — Hauptaktion */
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 3px rgba(59,130,246,.3); }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 2px 6px rgba(59,130,246,.4); }

/* Danger — Destruktive Aktionen (z.B. Löschen) */
.button.danger  { background: transparent; border-color: #fca5a5; color: #dc2626; font-size: 12px; padding: 5px 10px; }
.button.danger:hover { background: #fee2e2; border-color: #dc2626; }

/* Ghost — Sekundäre, dezente Aktionen */
.button.ghost   { background: transparent; border-color: transparent; color: var(--muted); }
.button.ghost:hover  { background: var(--surface-alt, #f3f4f6); color: var(--text); border-color: var(--line); }

/* Small variant */
.button.sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

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

.icon-button {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-secondary);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-button:hover { background: var(--surface-hover); border-color: var(--line-strong); color: var(--text); }
.icon-button.danger { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad-text); }
.icon-button svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Task Status Badge ────────────────────────────────────────────────────── */
.task-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.task-status-badge.status-open    { background: var(--info-bg,#e8f4fd); color: var(--info-text,#0369a1); }
.task-status-badge.status-doing   { background: var(--warn-bg); color: var(--warn-text); }
.task-status-badge.status-waiting { background: #fef3c7; color: #92400e; }
.task-status-badge.status-done    { background: var(--ok-bg); color: var(--ok-text); }

/* ── Task Status Row (detail drawer) ─────────────────────────────────────── */
.task-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.task-status-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 2px;
  white-space: nowrap;
}

.panel-kicker { font-size: 12px; color: var(--muted); margin-top: 2px; }
.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.metric .badge { width: fit-content; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.progress {
  height: 7px;
  background: var(--line);
  border-radius: 100px;
  overflow: hidden;
  min-width: 96px;
}
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

.eyebrow, .workbench-eyebrow {
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-text);
  margin-bottom: 6px;
  display: block;
}
.workbench-copy { font-size: 13px; color: var(--text-secondary); line-height: 1.6; max-width: 640px; }
.command-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.command-row .button:not(.primary), .workbench .button:not(.primary) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}
.command-row .button:not(.primary):hover, .workbench .button:not(.primary):hover { background: var(--surface-hover); }
.focus-stack { display: grid; gap: 10px; min-width: 240px; }
.focus-step {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.focus-step strong { display: block; color: var(--text); font-size: 12px; }
.focus-step span:last-child { display: block; color: var(--text-secondary); font-size: 12px; }

.grid-command { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr); gap: 16px; }
.role-model { display: grid; gap: 12px; padding: 16px 20px; }
.role-model > div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-soft);
}
.role-model strong { display: block; font-size: 13px; line-height: 1.45; margin-top: 3px; }

.workflow-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  font-size: 13px;
  min-width: 180px;
}
.workflow-step:last-child { border-right: none; }
.workflow-step > span {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  background: var(--line);
  color: var(--muted);
}
.workflow-step.done { background: #f0fdf4; }
.workflow-step.doing { background: var(--accent-soft); }
.workflow-step.blocked { background: var(--bad-bg); }
.workflow-step.done > span { background: #86efac; color: var(--ok-text); }
.workflow-step.doing > span { background: var(--accent); color: #fff; }
.workflow-step.blocked > span { background: #fca5a5; color: var(--bad-text); }
.workflow-step strong { display: block; font-size: 12px; }
.workflow-step small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }

.task-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
}
.task-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.task-column-header h3 { font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.task-column-list { display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.task-column-list.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  background: var(--accent-soft);
  border-radius: var(--radius);
}
.task-card-main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  text-align: left;
  color: inherit;
}
.task-card-main strong { font-size: 13px; line-height: 1.35; }
.task-card-main span:last-child { font-size: 12px; color: var(--muted); line-height: 1.4; }
.task-control {
  width: fit-content;
  color: var(--accent-text);
  background: var(--accent-soft);
  border: 1px solid var(--info-border);
  border-radius: 100px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 750;
}

.control-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.filter-panel .panel-body { padding: 14px 20px; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}
.compact-field { gap: 5px; }
.compact-field span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.select-all-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.role-work-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.compact-list { gap: 8px; }
.mini-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.mini-item strong { font-size: 12px; line-height: 1.35; }
.mini-item span {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.mini-item .button { grid-column: 2; grid-row: 1; padding: 4px 8px; font-size: 11px; }
.phase-next-action {
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  font-size: 12px;
  color: var(--text-secondary);
}
.control-mini-playbook {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.control-card-footer, .split-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.control-card-footer { margin-top: auto; color: var(--muted); font-size: 12px; }
.mini-empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}
.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  background: var(--surface);
}
.settings-card strong { display: block; margin: 4px 0; font-size: 14px; }
.settings-card p { color: var(--muted); font-size: 12px; line-height: 1.45; }

.wizard-step {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: start;
}
.wizard-step p {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}

/* ── P1.1 Onboarding Wizard Progress Bar ────────────────────────── */
.wizard-progress {
  display: flex;
  align-items: center;
  padding: 12px 0 20px;
  gap: 0;
}
.wizard-step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.wizard-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-soft);
  border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: var(--muted);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.wizard-step-dot.active .wizard-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.wizard-step-dot.done .wizard-dot {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-text);
}
.wizard-dot-label {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.wizard-step-dot.active .wizard-dot-label { color: var(--accent); font-weight: 600; }
.wizard-connector {
  flex: 1;
  height: 2px;
  background: var(--line);
  margin-bottom: 20px;
  min-width: 16px;
}

.lifecycle-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(180px, 1fr));
  gap: 10px;
  padding: 16px 20px 20px;
  overflow-x: auto;
}
.lifecycle-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  padding: 14px;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lifecycle-card.done { border-color: var(--ok-border); background: var(--ok-bg); }
.lifecycle-card.doing { border-color: var(--info-border); background: var(--info-bg); }
.lifecycle-card.blocked { border-color: var(--bad-border); background: var(--bad-bg); }

.settings-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.settings-grid, .profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 16px 20px; }
.profile-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.compact-table th, .compact-table td { padding: 8px 10px; }

.operations-panel { overflow: visible; }
.operation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 20px 20px;
}
.operation-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  padding: 15px;
}
.operation-card.highlight {
  background: var(--accent-soft);
  border-color: var(--info-border);
  box-shadow: inset 4px 0 0 var(--accent);
}
.operation-card .item-title { margin-top: 4px; margin-bottom: 5px; }
.operation-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin-top: auto;
}
.operation-actions .button { width: 100%; justify-content: flex-start; }

.tab {
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
  white-space: nowrap;
}
.tab:hover { background: var(--surface-hover); color: var(--text); }
.tab.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 750; }

/* --- Misc helpers ------------------------------------------ */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-bold { font-weight: 700; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }

/* --- Responsive -------------------------------------------- */
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .operation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-board { grid-template-columns: repeat(2, 1fr); }
  .grid-command { grid-template-columns: 1fr; }
  .lifecycle-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
  .workflow-rail { overflow-x: auto; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 56px; }
  .brand-name, .brand-sub, .nav-btn span:not(svg), .nav-section-label, .sidebar-user { display: none; }
  .nav-btn { justify-content: center; padding: 10px; }
  .workbench { grid-template-columns: 1fr; }
  .workbench-stats { flex-direction: row; flex-wrap: wrap; min-width: unset; }
  .wbstat { flex: 1; min-width: 140px; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; flex-direction: row; padding: 8px 12px; z-index: 50; width: 100%; overflow-x: auto; }
  .brand { display: none; }
  .nav { flex: 1; flex-direction: row; min-width: 560px; }
  .nav-section-label { display: none; }
  .nav-btn { flex: 1; flex-direction: column; gap: 2px; font-size: 10px; padding: 6px; }
  .nav-btn span:not(svg) { display: block !important; font-size: 9px; }
  .main { padding-bottom: 64px; }
  .content { padding: 16px; }
  .topbar { align-items: flex-start; height: auto; min-height: var(--topbar-h); padding: 12px 16px; flex-direction: column; }
  .toolbar { width: 100%; }
  .topbar .select { flex: 1 1 160px; min-width: 0; }
  .toolbar .button { flex: 1 1 150px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .operation-grid { grid-template-columns: 1fr; padding: 14px; }
  .settings-hero { flex-direction: column; padding: 20px; }
  .settings-grid, .profile-grid { grid-template-columns: 1fr; padding: 14px; }
  .task-board { grid-template-columns: 1fr; }
  .lifecycle-grid { grid-template-columns: 1fr; padding: 14px; }
  .workbench { padding: 22px 20px; }
  .focus-stack { min-width: 0; }
  .item { align-items: flex-start; flex-direction: column; }
  .item-actions { width: 100%; flex-wrap: wrap; }
  .item-actions .button { flex: 1 1 auto; }
}

/* ── Guided Inbox ──────────────────────────────────────────── */
.inbox-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.85fr);
  gap: 20px;
  align-items: start;
}
.inbox-col { display: flex; flex-direction: column; gap: 0; }
.inbox-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-muted, #6b7280);
  padding: 0 0 6px 0;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
  margin-bottom: 8px;
}

/* ── Detail stack (SAMM / Narrative / Insight drawer) ──────── */
.detail-stack { display: flex; flex-direction: column; gap: 16px; padding: 16px 0 0; }
.detail-card {
  background: var(--color-surface-2, #f9fafb);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.detail-card h3 { margin: 0; font-size: 15px; }
.detail-card p  { margin: 0; color: var(--color-muted, #6b7280); font-size: 13px; }
.detail-card pre.json-view {
  font-size: 12px;
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── Heatmap table ─────────────────────────────────────────── */
.table th[title] { cursor: help; }

/* --- Dark mode (future) ------------------------------------ */
@media (prefers-color-scheme: dark) {
  /* Intentionally minimal — full dark mode in future phases */
}

@media (max-width: 1100px) {
  .inbox-grid { grid-template-columns: 1fr 1fr; }
  .inbox-grid .inbox-col:last-child { grid-column: 1 / -1; }
  .filter-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}
@media (max-width: 700px) {
  .inbox-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr; }
  .mini-item { grid-template-columns: 1fr; }
  .mini-item .button { grid-column: 1; grid-row: auto; width: fit-content; }
}

/* ── P3.4 — Global Search Modal ─────────────────────────────────────────────── */
.search-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 80px;
}
.search-modal {
  background: var(--color-surface, #fff);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.28);
  width: min(640px, 92vw);
  max-height: 70vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line, #e5e7eb);
}
.search-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}
.search-icon { font-size: 16px; opacity: 0.5; flex-shrink: 0; }
.search-input {
  flex: 1; border: none; outline: none;
  font-size: 16px; background: transparent;
  color: var(--color-text, #111827);
}
.search-esc {
  background: var(--color-bg, #f3f4f6);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 4px; padding: 2px 6px;
  font-size: 11px; cursor: pointer; flex-shrink: 0;
  color: var(--color-muted, #6b7280);
}
.search-esc:hover { background: var(--accent, #4f46e5); color: #fff; border-color: var(--accent, #4f46e5); }
.search-results {
  overflow-y: auto; max-height: 400px;
}
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; cursor: pointer;
  border-bottom: 1px solid var(--line, #e5e7eb);
  transition: background 0.1s;
}
.search-result-item:hover,
.search-result-item.selected { background: var(--color-bg, #f3f4f6); }
.search-result-icon { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; }
.search-result-title { font-size: 14px; font-weight: 600; color: var(--color-text, #111827); }
.search-result-sub { font-size: 12px; color: var(--color-muted, #6b7280); margin-top: 1px; }
.search-hint, .search-empty {
  padding: 14px 16px;
  font-size: 13px; color: var(--color-muted, #6b7280);
  text-align: center;
}
.search-empty { color: var(--color-bad, #c53030); }

/* ── P3.5 — Bulk Toolbar ────────────────────────────────────────────────────── */
.bulk-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--accent, #4f46e5); color: #fff;
  padding: 10px 16px; border-radius: 8px; margin-bottom: 12px;
}
.bulk-count {
  font-size: 13px; font-weight: 600; margin-right: 4px;
}
.bulk-toolbar .button { background: rgba(255,255,255,0.15); color: #fff; border-color: rgba(255,255,255,0.3); }
.bulk-toolbar .button:hover { background: rgba(255,255,255,0.3); }
.bulk-toolbar .button.danger { background: rgba(220,38,38,0.75); border-color: rgba(220,38,38,0.9); }

/* ── Selected table rows ─────────────────────────────────────────────────────── */
tr.row-selected td { background: rgba(79,70,229,0.07); }

/* ── F1 — Security Sprint Planner ───────────────────────────────────────────── */
.sprint-urgency-banner {
  padding: 12px 20px; border-radius: 8px; margin-bottom: 16px;
  font-size: 14px; font-weight: 500;
}
.urgency-critical {
  background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b;
}
.urgency-high {
  background: #fffbeb; border: 1px solid #fcd34d; color: #92400e;
}
.urgency-low {
  background: #f0fdf4; border: 1px solid #86efac; color: #166534;
}

.sprint-items-list {
  display: flex; flex-direction: column; gap: 8px; padding: 4px 0;
}
.sprint-items-secondary { opacity: 0.8; }

.sprint-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-radius: 8px;
  background: var(--color-surface, #fff);
  border: 1px solid var(--line, #e5e7eb);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sprint-item:hover { border-color: var(--accent, #4f46e5); box-shadow: 0 0 0 3px rgba(79,70,229,0.08); }
.sprint-item-confirmed {
  border-color: #86efac; background: #f0fdf4;
}
.sprint-item-blocker { border-left: 3px solid var(--color-bad, #dc2626); }

.sprint-item-check { padding-top: 2px; flex-shrink: 0; }
.sprint-item-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent, #4f46e5); }

.sprint-item-body { flex: 1; min-width: 0; }
.sprint-item-header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px;
}
.sprint-item-title { font-size: 14px; font-weight: 600; color: var(--color-text, #111827); }
.sprint-item-hours {
  font-size: 12px; font-weight: 700; color: var(--accent, #4f46e5);
  background: rgba(79,70,229,0.08); padding: 1px 8px; border-radius: 12px; white-space: nowrap;
}
.sprint-item-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.sprint-item-reason { font-size: 12px; color: var(--color-muted, #6b7280); margin: 2px 0 0; }

.role-chips-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 8px 0 16px;
}
.role-chip {
  background: rgba(79,70,229,0.1); color: var(--accent, #4f46e5);
  border-radius: 20px; padding: 4px 12px; font-size: 12px; font-weight: 600;
}

/* ── F2 — Security Acceptance Criteria Engine ────────────────────────────────── */
.ac-form .form-row { display: flex; gap: 12px; align-items: flex-start; }
.ac-form .form-group { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.label-hint { font-size: 11px; color: var(--color-muted, #6b7280); font-weight: 400; margin-left: 4px; }
.required { color: var(--color-bad, #dc2626); }

.ac-detail-panel { border-top: 3px solid var(--accent, #4f46e5); }

.ac-control-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }

.ac-detail-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px; margin-bottom: 20px;
}

.ac-section { display: flex; flex-direction: column; gap: 10px; }
.ac-section-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 700; color: var(--color-text, #111827);
  margin-bottom: 4px;
}
.ac-section-title svg { flex-shrink: 0; stroke: var(--accent, #4f46e5); }

.ac-list { display: flex; flex-direction: column; gap: 8px; padding-left: 0; list-style: none; margin: 0; }
.ac-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; border-radius: 8px;
  background: var(--color-surface, #fff);
  border: 1px solid var(--line, #e5e7eb);
}
.ac-num {
  font-size: 11px; font-weight: 700; color: var(--accent, #4f46e5);
  background: rgba(79,70,229,0.1); border-radius: 4px; padding: 2px 6px;
  white-space: nowrap; flex-shrink: 0; margin-top: 1px;
}
.ac-text { font-size: 13px; color: var(--color-text, #111827); line-height: 1.5; }

.ac-scenario {
  background: var(--color-surface, #fff); border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.ac-scenario-header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ac-scenario-title { font-size: 13px; font-weight: 600; color: var(--color-text, #111827); flex: 1; }
.ac-scenario-result { font-size: 12px; color: var(--color-muted, #6b7280); margin: 0; }
.ac-steps { font-size: 12px; color: var(--color-muted, #6b7280); margin: 4px 0 0 16px; padding: 0; }
.ac-steps li { margin-bottom: 2px; }

.ac-hint {
  background: var(--color-surface, #fff); border: 1px solid var(--line, #e5e7eb);
  border-left: 3px solid var(--accent, #4f46e5);
  border-radius: 8px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.ac-hint-header { margin-bottom: 4px; }
.ac-hint-avoid  { font-size: 12px; margin: 0; color: var(--color-bad, #dc2626); }
.ac-hint-better { font-size: 12px; margin: 0; color: #166534; }
.ac-hint-pattern { font-size: 12px; margin: 0; color: var(--color-muted, #6b7280); font-family: monospace; }

.ac-export-block { margin-top: 16px; }
.ac-export-text {
  background: #1e1e2e; color: #cdd6f4;
  border-radius: 8px; padding: 16px;
  font-family: "JetBrains Mono", "Fira Code", monospace; font-size: 12px;
  line-height: 1.6; overflow-x: auto; white-space: pre-wrap;
  border: 1px solid var(--line, #e5e7eb);
  max-height: 320px; overflow-y: auto;
}

.button.danger { color: var(--color-bad, #dc2626); border-color: var(--color-bad, #dc2626); }
.button.danger:hover { background: var(--color-bad, #dc2626); color: #fff; }

/* ── F3 — Champion Center ─────────────────────────────────────────────── */
.champion-impact-banner {
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
  color: #fff; border-radius: 12px; padding: 20px 24px;
  display: flex; align-items: center; gap: 20px; margin-bottom: 20px;
}
.champion-impact-icon { font-size: 2.5rem; }
.champion-impact-body h3 { margin: 0 0 4px; font-size: 1.1rem; }
.champion-impact-body p { margin: 0; opacity: 0.9; font-size: 0.875rem; }

.briefing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.briefing-card {
  border: 1px solid var(--line, #e5e7eb); border-radius: 10px;
  padding: 14px 16px; background: var(--surface, #fff);
}
.briefing-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.briefing-card-title { font-weight: 600; font-size: 0.9rem; }
.briefing-card-sub { font-size: 0.78rem; color: var(--color-muted, #6b7280); margin: 0; }
.briefing-card-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.briefing-card-item { font-size: 0.82rem; display: flex; align-items: center; gap: 6px; }
.briefing-card-item::before { content: "›"; color: var(--color-primary, #3b82f6); font-weight: 700; }

.coaching-card {
  border-left: 4px solid var(--color-primary, #3b82f6);
  background: var(--surface, #fff); border-radius: 0 10px 10px 0;
  padding: 14px 16px; margin-bottom: 12px;
}
.coaching-card-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.coaching-card-body { font-size: 0.85rem; color: var(--fg, #111827); }
.coaching-card-action { margin-top: 8px; font-size: 0.8rem; background: #eff6ff; border-radius: 6px; padding: 6px 10px; color: #1d4ed8; }

.pattern-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--line, #e5e7eb);
}
.pattern-row:last-child { border-bottom: none; }
.pattern-count { font-size: 1.25rem; font-weight: 700; color: var(--color-bad, #dc2626); min-width: 32px; }
.pattern-label { font-size: 0.875rem; font-weight: 500; flex: 1; }
.pattern-badge { font-size: 0.75rem; }

.weekly-stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.weekly-stat { text-align: center; background: var(--surface, #fff); border-radius: 8px; padding: 10px 16px; border: 1px solid var(--line, #e5e7eb); }
.weekly-stat-num { font-size: 1.5rem; font-weight: 700; color: var(--color-primary, #3b82f6); }
.weekly-stat-lbl { font-size: 0.75rem; color: var(--color-muted, #6b7280); }

/* ── F4 — Retro Engine ────────────────────────────────────────────────── */
.retro-pattern-card {
  border: 1px solid var(--line, #e5e7eb); border-radius: 10px;
  padding: 14px 16px; background: var(--surface, #fff); margin-bottom: 12px;
}
.retro-pattern-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.retro-pattern-title { font-weight: 600; font-size: 0.9rem; }
.retro-pattern-count { font-size: 0.78rem; color: var(--color-muted, #6b7280); }

.retro-framework {
  background: #f0f9ff; border-radius: 10px; padding: 16px 18px; margin-top: 16px;
  border: 1px solid #bae6fd;
}
.retro-framework-title { font-weight: 600; margin-bottom: 10px; color: #0369a1; }
.retro-questions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.retro-question { display: flex; gap: 10px; align-items: flex-start; }
.retro-q-num { background: #0284c7; color: #fff; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; flex-shrink: 0; }
.retro-q-text { font-size: 0.875rem; padding-top: 2px; }
.retro-tips { margin-top: 10px; font-size: 0.8rem; color: var(--color-muted, #6b7280); }
.retro-tip { margin: 2px 0; }

.retro-tasks-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.retro-task-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface, #fff); border-radius: 8px; border: 1px solid var(--line, #e5e7eb); font-size: 0.85rem; }
.retro-task-role { font-size: 0.75rem; background: #f3f4f6; padding: 2px 7px; border-radius: 4px; }

.retro-history-list { display: flex; flex-direction: column; gap: 10px; }
.retro-history-card { border: 1px solid var(--line, #e5e7eb); border-radius: 8px; padding: 12px 14px; font-size: 0.85rem; }
.retro-history-meta { font-size: 0.78rem; color: var(--color-muted, #6b7280); margin-top: 4px; }

/* ── F5 — Release Type Gate ───────────────────────────────────────────── */
.type-gate-placeholder { padding: 20px 0; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.type-gate-result { display: flex; flex-direction: column; gap: 12px; }
.type-gate-status {
  display: flex; align-items: center; gap: 12px;
  border-radius: 8px; padding: 12px 16px;
}
.type-gate-status.ok { background: #f0fdf4; border: 1px solid #bbf7d0; }
.type-gate-status.bad { background: #fef2f2; border: 1px solid #fecaca; }
.gate-status-icon { font-size: 1.5rem; }
.type-gate-controls { display: flex; flex-direction: column; gap: 6px; }
.type-gate-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-radius: 6px; font-size: 0.85rem;
}
.gate-row-ok { background: #f0fdf4; }
.gate-row-fail { background: #fef2f2; }
.gate-row-warn { background: #fefce8; }
.gate-row-icon { font-size: 1rem; min-width: 18px; }
.gate-row-control { font-family: monospace; font-size: 0.78rem; min-width: 80px; }
.gate-row-title { flex: 1; }
.type-gate-preview { margin-top: 8px; padding: 10px 14px; background: #f8fafc; border-radius: 6px; }
.type-gate-actions { margin-top: 8px; }

/* ── F6 — Security Debt Board ─────────────────────────────────────────── */
.debt-board-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.debt-board-summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.debt-summary-chip {
  background: var(--surface, #fff); border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px; padding: 10px 14px; text-align: center; min-width: 90px;
}
.debt-summary-num { font-size: 1.5rem; font-weight: 700; }
.debt-summary-lbl { font-size: 0.75rem; color: var(--color-muted, #6b7280); }
.debt-summary-num.critical { color: var(--color-bad, #dc2626); }
.debt-summary-num.high { color: #ea580c; }
.debt-summary-num.medium { color: #ca8a04; }

.debt-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px;
  padding: 14px 16px; border-radius: 10px; margin-bottom: 10px;
  background: var(--surface, #fff); border: 1px solid var(--line, #e5e7eb);
}

.debt-item.debt-item-urgent {
  border-left: 4px solid var(--color-bad, #dc2626);
}
.debt-item.urgency-critical { border-left: 4px solid var(--color-bad, #dc2626); }
.debt-item.urgency-high     { border-left: 4px solid #ea580c; }
.debt-item.urgency-medium   { border-left: 4px solid #ca8a04; }
.debt-item.urgency-low      { border-left: 4px solid #94a3b8; }
.debt-item-effort { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 48px; }
.debt-effort-size { font-size: 1rem; font-weight: 700; }
.debt-effort-hours { font-size: 0.72rem; color: var(--color-muted, #6b7280); }
.debt-item-body { display: flex; flex-direction: column; gap: 4px; }
.debt-item-title { font-weight: 600; font-size: 0.9rem; }
.debt-item-impact { font-size: 0.82rem; color: var(--color-muted, #6b7280); }
.debt-item-risk { font-size: 0.8rem; color: var(--color-bad, #dc2626); }
.debt-item-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.debt-item-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; justify-content: center; }

.debt-section-label {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--color-muted, #6b7280); margin: 20px 0 10px; padding-bottom: 4px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}

.burndown-wrap { margin-top: 16px; }
.burndown-bars { display: flex; gap: 12px; align-items: flex-end; height: 80px; }
.burndown-bar-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.burndown-bar { width: 100%; background: var(--color-primary, #3b82f6); border-radius: 4px 4px 0 0; min-height: 4px; }
.burndown-label { font-size: 0.72rem; color: var(--color-muted, #6b7280); text-align: center; }
.burndown-count { font-size: 0.75rem; font-weight: 600; }

.portfolio-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line, #e5e7eb);
}
.portfolio-row:last-child { border-bottom: none; }
.portfolio-product { font-weight: 600; font-size: 0.875rem; min-width: 120px; }
.portfolio-bar-wrap { flex: 1; background: #f1f5f9; border-radius: 4px; height: 10px; overflow: hidden; }
.portfolio-bar-fill { height: 100%; border-radius: 4px; }
.portfolio-bar-fill.critical { background: var(--color-bad, #dc2626); }
.portfolio-bar-fill.high     { background: #ea580c; }
.portfolio-bar-fill.medium   { background: #ca8a04; }
.portfolio-bar-fill.low      { background: #22c55e; }
.portfolio-pct { font-size: 0.8rem; font-weight: 600; min-width: 36px; text-align: right; }

/* ── F7 — Quick Win Coach ─────────────────────────────────────────────── */
.quick-win-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.progress-bar-wrap { flex: 1; background: #f1f5f9; border-radius: 6px; height: 10px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 6px; transition: width 0.3s; }
.progress-bar-fill.ok   { background: #22c55e; }
.progress-bar-fill.warn { background: #eab308; }
.progress-bar-fill.info { background: var(--color-primary, #3b82f6); }
.progress-label { font-size: 0.8rem; font-weight: 600; min-width: 100px; text-align: right; }
.quick-win-progress-msg { font-size: 0.85rem; color: var(--color-muted, #6b7280); margin: 0 0 20px; }

.quick-win-sprint-label { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.quick-win-list { display: flex; flex-direction: column; gap: 10px; }
.quick-win-item {
  display: flex; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--line, #e5e7eb); border-radius: 10px;
  background: var(--surface, #fff); align-items: flex-start;
}
.quick-win-rank {
  background: var(--color-primary, #3b82f6); color: #fff;
  border-radius: 50%; width: 28px; height: 28px; min-width: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem; font-weight: 700;
}
.quick-win-body { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.quick-win-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.quick-win-title { font-weight: 600; font-size: 0.9rem; }
.quick-win-why { font-size: 0.85rem; color: var(--fg, #111827); margin: 0; }
.quick-win-howto { font-size: 0.82rem; color: var(--color-muted, #6b7280); margin: 0; }

.quick-win-coach-card {
  padding: 20px 22px;
}
.quick-win-coach-card .panel-header {
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line, #e5e7eb);
  margin-bottom: 16px;
}
.quick-win-loading,
.loading-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
}
.quick-win-loading p,
.loading-panel p {
  margin: 4px 0 0;
  line-height: 1.45;
}
.quick-win-coach-card .quick-win-progress {
  padding: 2px 0 8px;
}
.quick-win-coach-card .quick-win-item {
  border-radius: 8px;
  padding: 16px 18px;
}
.quick-win-coach-card .quick-win-title {
  font-size: 0.94rem;
}
.quick-win-coach-card .quick-win-why,
.quick-win-coach-card .quick-win-howto {
  line-height: 1.5;
}

.starter-reason-card {
  background: #fff;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.starter-reason-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.starter-reason-head > div {
  min-width: 0;
  flex: 1;
}
.starter-reason-head strong {
  display: block;
  font-size: 0.88rem;
  color: var(--fg, #111827);
}
.starter-reason-head p {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--muted, #64748b);
}
.starter-reason-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent, #2563eb);
  box-shadow: 0 0 0 4px #dbeafe;
  flex-shrink: 0;
}
.starter-reason-card details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line, #e5e7eb);
}
.starter-reason-card summary {
  cursor: pointer;
  color: var(--muted, #64748b);
  font-size: 0.78rem;
  font-weight: 700;
}
.starter-reason-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-secondary, #475569);
  font-size: 0.8rem;
  line-height: 1.55;
}
.starter-step-action {
  align-self: flex-start;
  flex-shrink: 0;
  margin-top: 2px;
}

.role-workflow-skeleton {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.role-workflow-skeleton span {
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f1f5f9, #e2e8f0, #f1f5f9);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.catalog-control-drawer {
  width: min(720px, calc(100vw - 32px));
}
.catalog-drawer-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 26px 30px;
}
.catalog-drawer-section {
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  background: var(--surface, #fff);
  padding: 16px;
}
.catalog-drawer-section-title {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
  margin-bottom: 12px;
}
.catalog-control-drawer .ctrl-id {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.9rem;
}
.catalog-control-drawer .catalog-profile-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.drawer-footer-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 0 0;
  background: var(--surface, #fff);
}

/* ── Control Catalog Editor ───────────────────────────────────────────────── */
.catalog-header-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
}
.catalog-filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 12px 16px;
  background: var(--surface, #fff); border-radius: 10px;
  border: 1px solid var(--line, #e5e7eb);
}
.catalog-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.catalog-table thead th {
  background: #f8fafc; padding: 10px 14px; text-align: left;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--color-muted, #6b7280);
  border-bottom: 2px solid var(--line, #e5e7eb);
}
.catalog-table tbody tr { border-bottom: 1px solid var(--line, #e5e7eb); }
.catalog-table tbody tr:last-child { border-bottom: none; }
.catalog-table td { padding: 10px 14px; vertical-align: middle; }
.catalog-row-custom { background: #f0fdf4; }
.catalog-row:hover { background: #f8fafc; }
.catalog-row-actions { display: flex; gap: 6px; white-space: nowrap; }
.ctrl-id {
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.82rem; background: #f1f5f9; padding: 2px 6px;
  border-radius: 4px; color: var(--fg, #111827);
}
.catalog-profile-checks {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px;
}
.checkbox-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.875rem; cursor: pointer; padding: 4px 8px;
  border-radius: 6px; border: 1px solid var(--line, #e5e7eb);
  background: var(--surface, #fff);
}
.checkbox-label:hover { background: #f0f9ff; border-color: #bae6fd; }
.checkbox-label input[type="checkbox"] { accent-color: var(--color-primary, #3b82f6); }
.textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px; font-size: 0.875rem; resize: vertical;
  font-family: inherit; color: var(--fg, #111827);
  background: var(--surface, #fff);
}
.textarea:focus { outline: none; border-color: var(--color-primary, #3b82f6); }

/* ══════════════════════════════════════════════════════════════════
   Guided UX — Sidebar enhancements
══════════════════════════════════════════════════════════════════ */
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px;
  background: var(--color-bad, #dc2626); color: #fff;
  border-radius: 9px; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.sidebar-footer {
  padding: 12px; border-top: 1px solid var(--nav-border, rgba(255,255,255,.08));
  margin-top: auto; display: flex; flex-direction: column; gap: 6px;
}
/* Adaptive mode badge in sidebar */
.sidebar-mode-badge {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 100%;
  font-size: 0.65rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 6px 10px; border-radius: 12px; border: 1px solid; text-align: center;
  opacity: 0.92; cursor: pointer; background: rgba(255,255,255,.03);
  transition: background .15s, transform .15s, border-color .15s;
}
.sidebar-mode-badge:hover {
  background: rgba(255,255,255,.09);
  transform: translateY(-1px);
}
.sidebar-mode-name { white-space: nowrap; }
.sidebar-mode-note {
  font-size: 0.58rem; letter-spacing: .03em; color: rgba(255,255,255,.58);
  text-transform: none; font-weight: 600;
}
/* Override state: dashed border + lock icon indicates manual control */
.sidebar-mode-override {
  border-style: dashed;
  opacity: 1;
}
/* Show all views toggle */
.sidebar-show-all-btn {
  font-size: 0.7rem; color: rgba(255,255,255,.5); background: none; border: none;
  cursor: pointer; text-align: left; padding: 2px 4px; border-radius: 4px;
  transition: color .15s;
}
.sidebar-show-all-btn:hover { color: rgba(255,255,255,.85); }
.sidebar-show-all-active { color: var(--accent, #3b82f6) !important; }
.sidebar-role-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; padding: 10px 12px; cursor: pointer;
  color: var(--nav-text, #e2e8f0); text-align: left;
  transition: background .15s, border-color .15s;
}
.sidebar-role-btn:hover { background: rgba(255,255,255,.13); border-color: rgba(255,255,255,.25); }
.sidebar-role-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent, #3b82f6); color: #fff;
  font-size: 11px; font-weight: 800; display: grid; place-items: center;
  flex-shrink: 0; text-transform: uppercase;
}
.sidebar-role-info { flex: 1; min-width: 0; }
.sidebar-role-name { display: block; font-size: 12px; font-weight: 600; color: #f9fafb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-role-hint { display: block; font-size: 10px; color: var(--nav-text-muted, #94a3b8); margin-top: 1px; }
/* Hide text when collapsed */
.app-shell.sidebar-collapsed .sidebar-role-avatar { margin: 0 auto; }

/* ══════════════════════════════════════════════════════════════════
   Guided UX — First-Run Wizard
══════════════════════════════════════════════════════════════════ */
.wizard-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; padding: 24px;
  backdrop-filter: blur(4px);
}
.wizard-card {
  background: var(--surface, #fff); border-radius: 20px;
  padding: 40px 48px; width: 100%; max-width: 680px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
}
.wizard-logo {
  display: flex; align-items: center; gap: 12px; margin-bottom: 28px;
}
.wizard-title { font-size: 1.5rem; font-weight: 700; color: var(--fg, #111827); margin: 0 0 8px; }
.wizard-sub { font-size: 0.9375rem; color: var(--text-muted, #6b7280); margin: 0 0 24px; }
.wizard-hint { font-size: 0.875rem; color: var(--text-muted); text-align: center; margin-top: 16px; }

/* Wizard steps indicator */
.wizard-steps {
  display: flex; align-items: center; margin-bottom: 28px;
}
.wizard-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.875rem; color: var(--text-muted, #9ca3af);
}
.wizard-step.active { color: var(--color-primary, #3b82f6); font-weight: 600; }
.wizard-step.done { color: var(--color-ok, #16a34a); }
.wizard-step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-alt, #f3f4f6); border: 2px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.wizard-step.active .wizard-step-dot { background: var(--color-primary, #3b82f6); color: #fff; border-color: transparent; }
.wizard-step.done .wizard-step-dot { background: var(--color-ok, #16a34a); color: #fff; border-color: transparent; }
.wizard-step-line { flex: 1; height: 2px; background: var(--line, #e5e7eb); margin: 0 8px; }
.wizard-step-line.done { background: var(--color-ok, #16a34a); }

/* Role grid */
.wizard-role-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px;
  margin-bottom: 24px;
}
.wizard-role-card {
  text-align: left; padding: 14px 16px; border: 2px solid var(--line, #e5e7eb);
  border-radius: 12px; background: var(--surface, #fff); cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.wizard-role-card:hover { border-color: var(--color-primary, #3b82f6); }
.wizard-role-card.selected { border-color: var(--color-primary, #3b82f6); background: #eff6ff; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.wizard-role-card strong { display: block; font-size: 0.875rem; font-weight: 700; margin-bottom: 4px; color: var(--fg, #111827); }
.wizard-role-card span { font-size: 0.75rem; color: var(--text-muted, #6b7280); line-height: 1.4; }

/* Product list */
.wizard-product-list {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px;
}
.wizard-product-card {
  text-align: left; padding: 14px 16px; border: 2px solid var(--line, #e5e7eb);
  border-radius: 12px; background: var(--surface, #fff); cursor: pointer;
  transition: border-color .15s;
}
.wizard-product-card:hover { border-color: var(--color-primary, #3b82f6); }
.wizard-product-card.selected { border-color: var(--color-primary, #3b82f6); background: #eff6ff; }
.wizard-product-card strong { display: block; font-size: 0.9375rem; font-weight: 700; margin-bottom: 2px; }
.wizard-product-card span { font-size: 0.8125rem; color: var(--text-muted); }
.wizard-no-products { padding: 20px; background: var(--surface-alt, #f3f4f6); border-radius: 12px; text-align: center; margin-bottom: 24px; }

/* Goal grid */
.wizard-goal-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px;
  margin-bottom: 24px;
}
.wizard-goal-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 20px 14px; border: 2px solid var(--line, #e5e7eb);
  border-radius: 14px; background: var(--surface, #fff); cursor: pointer;
  text-align: center; font-size: 0.8125rem; font-weight: 500;
  color: var(--fg, #111827); transition: border-color .15s, background .15s;
}
.wizard-goal-card:hover { border-color: var(--color-primary, #3b82f6); background: #eff6ff; }
.wizard-goal-card.wizard-goal-home { border-style: dashed; }
.wizard-goal-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }
.wizard-goal-icon svg { width: 28px; height: 28px; stroke: var(--color-primary, #3b82f6); fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Wizard actions */
.wizard-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  border-top: 1px solid var(--line, #e5e7eb); padding-top: 20px; margin-top: 8px;
}

/* ══════════════════════════════════════════════════════════════════
   Guided UX — Role Home Dashboard
══════════════════════════════════════════════════════════════════ */
.role-home-hero {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 16px; padding: 28px 32px;
  display: flex; align-items: center; gap: 32px;
  margin-bottom: 20px; color: #f9fafb;
}
.role-home-greeting { flex: 1; }
.role-home-salute { font-size: 0.875rem; color: #94a3b8; margin-bottom: 4px; }
.role-home-title { font-size: 1.75rem; font-weight: 800; margin: 0 0 6px; color: #f9fafb; }
.role-home-context { font-size: 0.875rem; color: #94a3b8; }
.role-home-stats {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.role-home-stat {
  display: flex; flex-direction: column; align-items: center;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; padding: 14px 18px; min-width: 90px;
  cursor: pointer; transition: background .15s; color: inherit;
  text-decoration: none;
}
.role-home-stat:hover { background: rgba(255,255,255,.14); }
.role-home-stat-icon { margin-bottom: 6px; }
.role-home-stat-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.role-home-stat-icon.ok svg { stroke: #4ade80; }
.role-home-stat-icon.bad svg { stroke: #f87171; }
.role-home-stat-icon.warn svg { stroke: #fbbf24; }
.role-home-stat-value { font-size: 1.25rem; font-weight: 700; margin-bottom: 2px; }
.role-home-stat-label { font-size: 0.6875rem; color: #94a3b8; text-align: center; }

/* Next step banner */
.role-home-next {
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px;
  padding: 16px 20px; display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px;
}
.role-home-next-icon { width: 36px; height: 36px; background: #16a34a; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.role-home-next-icon svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.role-home-next-label { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #16a34a; margin-bottom: 2px; }
.role-home-next-text { font-size: 0.9375rem; font-weight: 500; color: #166534; }

/* Goal grid */
.role-home-goals { margin-bottom: 24px; }
.role-home-section-title { font-size: 0.875rem; font-weight: 600; color: var(--text-muted, #6b7280); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 12px; }
.role-home-goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.role-home-goal-card {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px; background: var(--surface, #fff);
  cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s;
  color: var(--fg, #111827);
}
.role-home-goal-card:hover { border-color: var(--color-primary, #3b82f6); box-shadow: 0 2px 8px rgba(59,130,246,.12); }
.role-home-goal-icon { width: 32px; height: 32px; background: #eff6ff; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.role-home-goal-icon svg { width: 16px; height: 16px; stroke: var(--color-primary, #3b82f6); fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.role-home-goal-label { font-size: 0.875rem; font-weight: 500; flex: 1; }
.role-home-goal-arrow { font-size: 1rem; color: var(--text-muted, #9ca3af); }
.role-home-goal-desc {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted, #64748b);
  margin-top: 2px;
}

/* Inbox */
.inbox-list { display: flex; flex-direction: column; gap: 8px; }
.inbox-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--surface-alt, #f9fafb); border-radius: 8px;
  font-size: 0.875rem;
}
.inbox-item-text { flex: 1; color: var(--fg, #111827); }

/* Switch role hint */
.role-home-switch-hint {
  display: flex; align-items: center; gap: 12px; justify-content: center;
  padding: 16px; color: var(--text-muted, #9ca3af); font-size: 0.875rem;
}

/* Role focus line (subtitle below role title in hero) */
.role-home-focus {
  font-size: 0.8125rem; color: #94a3b8; margin-top: 8px;
  max-width: 380px; line-height: 1.5;
}

.role-workflow-card {
  border-color: var(--line, #e5e7eb) !important;
  padding: 18px 20px;
}
.role-workflow-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 12px;
}
.role-workflow-copy {
  margin: 6px 0 0; font-size: 0.82rem; color: var(--muted, #64748b); line-height: 1.45;
}
.role-workflow-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.role-workflow-progress {
  position: relative; height: 12px; background: var(--line, #e5e7eb);
  border-radius: 999px; overflow: hidden; margin: 10px 0 14px;
}
.role-workflow-progress > div {
  height: 100%; background: linear-gradient(90deg, #2563eb, #3b82f6);
  border-radius: inherit; transition: width .4s;
}
.role-workflow-progress > span {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 0.62rem; font-weight: 800; color: #0f172a;
}
.role-workflow-step-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}
.role-workflow-step {
  min-height: 44px; border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px; background: #f8fafc;
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
}
.role-workflow-step strong { font-size: 0.78rem; line-height: 1.25; color: var(--fg, #111827); }
.role-workflow-step-index {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; background: #e2e8f0; color: #334155;
  font-size: 0.72rem; font-weight: 800;
}
.role-workflow-step-index svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.role-workflow-step.ok { background: #f0fdf4; border-color: #bbf7d0; }
.role-workflow-step.ok .role-workflow-step-index { background: #16a34a; color: #fff; }
.role-workflow-step.info { background: #eff6ff; border-color: #bfdbfe; }
.role-workflow-step.info .role-workflow-step-index { background: #2563eb; color: #fff; }
.role-workflow-step.bad { background: #fff1f2; border-color: #fecdd3; }
.role-workflow-step.bad .role-workflow-step-index { background: #dc2626; color: #fff; }
.role-workflow-step.muted { background: #fff; color: var(--muted, #64748b); }

/* Urgent next-step variant */
.role-home-next-urgent {
  background: #fff1f2; border-color: #fecdd3;
}
.role-home-next-urgent .role-home-next-icon { background: #dc2626; }
.role-home-next-urgent .role-home-next-label { color: #dc2626; }
.role-home-next-urgent .role-home-next-text { color: #991b1b; }

/* Next step CTA button */
.role-home-next-cta { flex-shrink: 0; }

/* Goal card body + badge */
.role-home-goal-body { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.role-home-goal-badge { font-size: 0.65rem; align-self: flex-start; }

/* Improved inbox items */
.inbox-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 8px; }
.inbox-item-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.inbox-item-dot.ok { background: #22c55e; }
.inbox-item-dot.warn { background: #f59e0b; }
.inbox-item-dot.bad { background: #ef4444; }
.inbox-item-dot.info { background: #6b7280; }
.inbox-item-main { flex: 1; min-width: 0; }
.inbox-item-title { display: block; font-size: 0.875rem; font-weight: 500; color: var(--fg, #111827); }
.inbox-item-sub { display: block; font-size: 0.75rem; color: var(--muted, #6b7280); margin-top: 2px; }
.inbox-item-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════════
   View Context Banner — Dismissible per-view guidance
══════════════════════════════════════════════════════════════════ */
.view-context-banner {
  display: flex; align-items: flex-start; gap: 14px;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 12px;
  padding: 16px 18px; margin-bottom: 18px;
}
.view-context-icon { font-size: 1.5rem; flex-shrink: 0; line-height: 1; margin-top: 2px; }
.view-context-body { flex: 1; }
.view-context-title { font-size: 0.875rem; font-weight: 700; color: #1e40af; display: block; margin-bottom: 6px; }
.view-context-text { font-size: 0.8125rem; color: #1e3a8a; line-height: 1.55; margin: 0 0 6px; }
.view-context-tip { font-size: 0.75rem; color: #3b82f6; margin: 0; }
.view-context-dismiss {
  flex-shrink: 0; background: none; border: none; cursor: pointer;
  color: #60a5fa; font-size: 1rem; padding: 2px 6px; border-radius: 4px;
  line-height: 1; align-self: flex-start;
  transition: background .15s;
}
.view-context-dismiss:hover { background: rgba(59,130,246,.1); }

/* Inline action hint bar (urgent/warning) */
.view-action-hint {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px; font-size: 0.875rem;
  margin-bottom: 16px;
}
.view-action-hint svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.view-action-hint.bad { background: #fff1f2; border: 1px solid #fecdd3; color: #991b1b; }
.view-action-hint.warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.view-action-hint.bad svg { stroke: #ef4444; }
.view-action-hint.warn svg { stroke: #f59e0b; }

/* ══════════════════════════════════════════════════════════════════
   Guided UX — Workflow Strip (Level 3)
══════════════════════════════════════════════════════════════════ */
.workflow-strip {
  display: flex; align-items: center;
  background: var(--surface, #fff); border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px; padding: 14px 20px; margin-bottom: 20px;
  overflow-x: auto; gap: 0;
}
.workflow-strip-step {
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  font-size: 0.8125rem; color: var(--text-muted, #9ca3af);
  flex-shrink: 0;
}
.workflow-strip-step.done { color: var(--color-ok, #16a34a); }
.workflow-strip-step.current { color: var(--color-primary, #3b82f6); font-weight: 600; }
.workflow-strip-step.upcoming { color: var(--text-muted, #9ca3af); }
.workflow-strip-dot {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
  background: var(--surface-alt, #f3f4f6); border: 2px solid currentColor;
}
.workflow-strip-step.done .workflow-strip-dot { background: var(--color-ok, #16a34a); color: #fff; border-color: transparent; }
.workflow-strip-step.current .workflow-strip-dot { background: var(--color-primary, #3b82f6); color: #fff; border-color: transparent; }
.workflow-strip-status {
  font-size: 12px; font-weight: 700; width: 20px; height: 20px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.workflow-strip-status.ok { background: #dcfce7; color: #16a34a; }
.workflow-strip-status.warn { background: #fef9c3; color: #ca8a04; }
.workflow-strip-status.bad { background: #fee2e2; color: #dc2626; }
.workflow-strip-line { flex: 1; height: 2px; background: var(--line, #e5e7eb); min-width: 20px; max-width: 60px; margin: 0 4px; }
.workflow-strip-line.done { background: var(--color-ok, #16a34a); }

/* ══════════════════════════════════════════════════════════════════
   Role Switcher — Full-Screen Modal
══════════════════════════════════════════════════════════════════ */
.role-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 24px;
  backdrop-filter: blur(4px);
}
.role-modal {
  background: var(--surface, #fff); border-radius: 20px;
  width: 100%; max-width: 860px; max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,.45);
  display: flex; flex-direction: column;
}
.role-modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 28px 32px 20px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}
.role-modal-title { font-size: 1.25rem; font-weight: 800; color: var(--fg, #111827); margin: 0 0 6px; }
.role-modal-sub { font-size: 0.875rem; color: var(--text-muted, #6b7280); margin: 0; }
.role-modal-close {
  background: none; border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px;
  font-size: 16px; color: var(--text-muted); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.role-modal-close:hover { background: var(--surface-alt, #f3f4f6); color: var(--fg); }
.role-modal-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px; padding: 24px 32px;
}
.role-modal-card {
  text-align: left; padding: 16px 18px; border: 2px solid var(--line, #e5e7eb);
  border-radius: 14px; background: var(--surface, #fff); cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
  display: flex; flex-direction: column; gap: 8px;
}
.role-modal-card:hover { border-color: var(--accent, #3b82f6); box-shadow: 0 2px 12px rgba(59,130,246,.12); }
.role-modal-card.active { border-color: var(--accent, #3b82f6); background: #eff6ff; }
.role-modal-card-top { display: flex; align-items: center; gap: 10px; }
.role-modal-icon { font-size: 1.375rem; line-height: 1; flex-shrink: 0; }
.role-modal-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role-modal-card-title strong { font-size: 0.9375rem; font-weight: 700; color: var(--fg, #111827); }
.role-modal-active-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  background: var(--accent, #3b82f6); color: #fff;
  padding: 2px 7px; border-radius: 20px; letter-spacing: .04em;
}
.role-modal-card-desc { font-size: 0.8125rem; color: var(--text-muted, #6b7280); line-height: 1.5; margin: 0; }
.role-modal-card-focus {
  font-size: 0.75rem; color: var(--accent, #3b82f6);
  background: #eff6ff; border-radius: 6px; padding: 4px 8px;
}
.role-modal-focus-label { font-weight: 700; margin-right: 4px; }
.role-modal-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 32px; border-top: 1px solid var(--line, #e5e7eb);
  font-size: 0.8125rem; color: var(--text-muted, #6b7280);
}

/* ══════════════════════════════════════════════════════════════════
   Level 1 — Sidebar Fokus-Modus (collapsed)
══════════════════════════════════════════════════════════════════ */
.sidebar-toggle {
  background: none; border: none; cursor: pointer; padding: 6px 8px;
  color: var(--text-muted, #6b7280); border-radius: 6px;
  display: flex; align-items: center;
}
.sidebar-toggle:hover { background: var(--surface-alt, #f3f4f6); color: var(--fg); }
.sidebar-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

.app-shell.sidebar-collapsed .sidebar {
  width: 60px; min-width: 60px;
}
.app-shell.sidebar-collapsed .brand-name,
.app-shell.sidebar-collapsed .brand-sub,
.app-shell.sidebar-collapsed .nav-btn span,
.app-shell.sidebar-collapsed .nav-section-label,
.app-shell.sidebar-collapsed .sidebar-role-info,
.app-shell.sidebar-collapsed .sidebar-role-name,
.app-shell.sidebar-collapsed .sidebar-role-hint,
.app-shell.sidebar-collapsed .nav-badge {
  display: none;
}
.app-shell.sidebar-collapsed .nav-btn { justify-content: center; padding: 10px; }
.app-shell.sidebar-collapsed .sidebar-role-btn { justify-content: center; }
.app-shell.sidebar-collapsed .brand { justify-content: center; }
.app-shell.sidebar-collapsed .brand-mark { margin: 0; }
.app-shell:not(.sidebar-collapsed) .sidebar { transition: width .2s ease; }

/* ══════════════════════════════════════════════════════════════════
   Level 1 — ⌘K Command Palette button in topbar
══════════════════════════════════════════════════════════════════ */
.cmd-palette-btn {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px;
  background: var(--surface-alt, #f3f4f6); border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px; cursor: pointer; font-size: 0.8125rem; color: var(--text-muted, #6b7280);
  transition: border-color .15s;
}
.cmd-palette-btn:hover { border-color: var(--color-primary, #3b82f6); color: var(--fg); }
.cmd-palette-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.cmd-palette-btn kbd { background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 11px; }

/* ══════════════════════════════════════════════════════════════════
   Level 1 — ⌘K Command Palette overlay
══════════════════════════════════════════════════════════════════ */
.cmd-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.6);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 15vh; z-index: 9998; backdrop-filter: blur(3px);
}
.cmd-palette {
  background: var(--surface, #fff); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); width: 100%; max-width: 560px;
  overflow: hidden;
}
.cmd-search-row {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line, #e5e7eb);
}
.cmd-search-row svg { width: 18px; height: 18px; stroke: var(--text-muted); fill: none; stroke-width: 2; flex-shrink: 0; }
.cmd-input {
  flex: 1; border: none; outline: none; font-size: 1rem;
  color: var(--fg, #111827); background: transparent; padding: 0;
}
.cmd-input::placeholder { color: var(--text-muted, #9ca3af); }
.cmd-search-row kbd { background: var(--surface-alt); border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; font-size: 11px; color: var(--text-muted); }
.cmd-results { max-height: 360px; overflow-y: auto; padding: 8px 0; }
.cmd-group-label { padding: 8px 18px 4px; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted, #9ca3af); }
.cmd-result-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 18px; text-align: left; background: none; border: none;
  cursor: pointer; font-size: 0.875rem; color: var(--fg, #111827);
  transition: background .1s;
}
.cmd-result-item:hover, .cmd-result-item:focus { background: var(--surface-alt, #f3f4f6); outline: none; }
.cmd-result-item svg { width: 16px; height: 16px; stroke: var(--text-muted); fill: none; stroke-width: 1.75; flex-shrink: 0; }
.cmd-empty { padding: 24px 18px; text-align: center; color: var(--text-muted); font-size: 0.875rem; }
.cmd-footer {
  display: flex; gap: 16px; padding: 10px 18px;
  border-top: 1px solid var(--line, #e5e7eb); font-size: 0.75rem; color: var(--text-muted);
}
.cmd-footer kbd { background: var(--surface-alt); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; }

/* ══════════════════════════════════════════════════════════════════
   Level 1 — Nudge Strip
══════════════════════════════════════════════════════════════════ */
.nudge-strip {
  display: flex; flex-direction: column; gap: 0;
}
.nudge {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; font-size: 0.8125rem; font-weight: 500;
}
.nudge svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.nudge-bad  { background: #fef2f2; color: #991b1b; border-bottom: 1px solid #fecaca; }
.nudge-warn { background: #fffbeb; color: #92400e; border-bottom: 1px solid #fde68a; }
.nudge-link { margin-left: auto; background: none; border: none; font-weight: 700; cursor: pointer; color: inherit; padding: 2px 8px; border-radius: 4px; }
.nudge-link:hover { text-decoration: underline; }
.nudge-dismiss { background: none; border: none; cursor: pointer; color: inherit; opacity: .6; font-size: 14px; padding: 2px 6px; border-radius: 4px; }
.nudge-dismiss:hover { opacity: 1; background: rgba(0,0,0,.08); }

/* ══════════════════════════════════════════════════════════════════
   Level 2 — Audit Package
══════════════════════════════════════════════════════════════════ */
.audit-summary-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 4px;
  font-size: 0.9375rem; color: var(--text-muted);
}
.audit-risk-badge {
  padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase;
}
.audit-risk-badge.high   { background: #fee2e2; color: #991b1b; }
.audit-risk-badge.medium { background: #fef9c3; color: #92400e; }
.audit-risk-badge.low    { background: #dcfce7; color: #166534; }
.audit-narrative {
  background: var(--surface-alt, #f9fafb); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px; max-height: 320px; overflow-y: auto;
}
.audit-narrative pre { white-space: pre-wrap; font-size: 0.8125rem; font-family: "SF Mono", "Fira Code", monospace; color: var(--fg); margin: 0; line-height: 1.6; }

/* ══════════════════════════════════════════════════════════════════
   Level 2 — Micro-Learning
══════════════════════════════════════════════════════════════════ */
.learning-time-badge {
  display: inline-block; background: #eff6ff; color: var(--color-primary, #3b82f6);
  border-radius: 20px; padding: 3px 12px; font-size: 0.75rem; font-weight: 600;
  margin-bottom: 12px;
}
.learning-summary { font-size: 0.9375rem; color: var(--fg); line-height: 1.6; margin-bottom: 20px; }
.learning-section-title { font-size: 0.8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin: 0 0 10px; }
.learning-bullets { padding-left: 20px; margin: 0 0 20px; }
.learning-bullets li { font-size: 0.9rem; line-height: 1.6; margin-bottom: 6px; color: var(--fg); }
.learning-resources { display: flex; flex-direction: column; gap: 8px; }
.learning-resource-link {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--surface-alt, #f9fafb); border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.875rem; color: var(--color-primary, #3b82f6); text-decoration: none;
}
.learning-resource-link:hover { background: #eff6ff; border-color: #bfdbfe; }
.learning-resource-link svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ══════════════════════════════════════════════════════════════════
   Level 2 — STRIDE Threat Model
══════════════════════════════════════════════════════════════════ */
.stride-header { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 0.875rem; color: var(--text-muted); }
.stride-product { font-weight: 600; color: var(--fg); }
.stride-summary { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.stride-threats { display: flex; flex-direction: column; gap: 10px; }
.stride-threat-card {
  border: 1px solid var(--line, #e5e7eb); border-radius: 10px; padding: 14px 16px;
}
.stride-threat-card.high   { border-left: 4px solid #dc2626; }
.stride-threat-card.medium { border-left: 4px solid #d97706; }
.stride-threat-card.low    { border-left: 4px solid #16a34a; }
.stride-threat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.stride-category { font-size: 0.875rem; font-weight: 700; color: var(--fg); }
.stride-question { font-size: 0.8125rem; color: var(--text-muted); margin: 0 0 8px; }
.stride-examples { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 6px; }
.stride-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.75rem; color: var(--text-muted); }
.stride-gap { font-size: 0.8125rem; color: #d97706; font-weight: 500; }

/* ══════════════════════════════════════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════════════════════════════════════ */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  padding: 24px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.login-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1d4ed8, #6366f1);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.login-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.login-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 2px 0 0;
}
.login-demo-banner {
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  border: 1px solid #fbbf24;
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 16px;
}
.login-demo-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #92400e;
}
.login-demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}
.login-demo-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  position: relative;
}
.login-demo-user:hover {
  border-color: var(--accent);
  background: #eff6ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59,130,246,0.15);
}
.login-demo-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.login-demo-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.login-demo-info strong {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.login-demo-info span {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.login-demo-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 0.58rem;
  font-weight: 700;
  background: #dc2626;
  color: #fff;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 0.75rem;
}
.login-divider::before, .login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.8125rem;
  color: #dc2626;
  font-weight: 500;
}
.login-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════════════
   TOPBAR USER SECTION
══════════════════════════════════════════════════════════════════ */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  position: relative;
}
.topbar-user:hover, .topbar-user.open {
  background: var(--surface-hover);
  border-color: var(--line);
}
.topbar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}
.topbar-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.topbar-user-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.topbar-user-role {
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
}
.topbar-user-caret {
  width: 14px;
  height: 14px;
  color: var(--muted);
  stroke-width: 2;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.15s;
}
.topbar-user.open .topbar-user-caret { transform: rotate(180deg); }

/* ── User Dropdown Menu ─────────────────────────────────────────── */
.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  z-index: 9999;
  overflow: hidden;
  animation: userMenuIn 0.15s ease;
}
@keyframes userMenuIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.user-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}
.user-menu-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.user-menu-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}
.user-menu-email {
  font-size: 0.7rem;
  color: var(--muted);
  word-break: break-all;
}
.user-menu-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.user-menu-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text);
  text-align: left;
  transition: background 0.1s;
  border-radius: 0;
}
.user-menu-item:hover { background: var(--surface-hover); }
.user-menu-item.danger { color: #dc2626; }
.user-menu-item.danger:hover { background: #fef2f2; }
.user-menu-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

/* ══════════════════════════════════════════════════════════════════
   ADMIN TAB NAVIGATION
══════════════════════════════════════════════════════════════════ */
.admin-tab-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 24px;
  overflow-x: auto;
  flex-wrap: wrap;
}
.admin-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.admin-tab-btn:hover { background: var(--surface-hover); color: var(--text); }
.admin-tab-btn.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.admin-tab-btn span { font-size: 0.9em; }

/* ── Role Modal — user's own role highlight ─────────────────────── */
.role-modal-mine-badge {
  font-size: 0.6rem;
  font-weight: 700;
  background: #d1fae5;
  color: #065f46;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.role-modal-card-dim { opacity: 0.6; }
.role-modal-card-dim:hover { opacity: 1; }

/* ══════════════════════════════════════════════════════════════════
   P-NEW: Connectors, Notifications, MFA, Exports, Trend Charts
══════════════════════════════════════════════════════════════════ */

/* Connector Grid */
.connector-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 16px; }
.connector-card { background: var(--card, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.connector-card-header { display: flex; align-items: center; gap: 10px; }
.connector-card-icon { font-size: 24px; width: 36px; text-align: center; }
.connector-card-name { font-weight: 600; font-size: 14px; }
.connector-card-desc { font-size: 12px; color: var(--muted, #6b7280); line-height: 1.4; }
.connector-card-meta { font-size: 11px; color: var(--muted, #6b7280); }
.connector-card-actions { display: flex; gap: 8px; margin-top: 4px; }
.connector-status-connected { color: #16a34a; font-weight: 600; font-size: 11px; }
.connector-status-error { color: #dc2626; font-weight: 600; font-size: 11px; }
.connector-status-none { color: #9ca3af; font-size: 11px; }
.connector-test-result { padding: 8px 12px; border-radius: 6px; font-size: 12px; margin-top: 8px; }
.connector-test-result.ok { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.connector-test-result.error { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }

/* Notification Bell */
.notification-bell { position: relative; background: none; border: none; cursor: pointer; font-size: 18px; padding: 6px 8px; border-radius: 6px; color: var(--text, #111); display: inline-flex; align-items: center; }
.notification-bell:hover { background: rgba(0,0,0,0.06); }
.notification-bell-badge { position: absolute; top: 2px; right: 2px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }
.notification-dropdown { position: absolute; top: 100%; right: 0; width: 360px; max-height: 480px; background: var(--surface, #fff); border: 1px solid var(--line-strong, #e5e7eb); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 500; display: flex; flex-direction: column; overflow: hidden; }
.notification-dropdown-header { padding: 12px 16px; border-bottom: 1px solid var(--line, #e5e7eb); display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; }
.notification-list { overflow-y: auto; flex: 1; }
.notification-item { padding: 12px 16px; border-bottom: 1px solid var(--line, #f3f4f6); cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.notification-item:hover { background: var(--surface-hover, #f9fafb); }
.notification-item.unread { background: #eff6ff; }
.notification-item.unread:hover { background: #dbeafe; }
.notification-item-icon { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.notification-item-body { flex: 1; min-width: 0; }
.notification-item-title { font-size: 13px; font-weight: 500; line-height: 1.3; }
.notification-item-text { font-size: 12px; color: var(--muted, #6b7280); margin-top: 2px; }
.notification-item-time { font-size: 11px; color: var(--muted, #9ca3af); margin-top: 3px; }
.notification-dropdown-empty { padding: 32px 16px; text-align: center; color: var(--muted, #9ca3af); font-size: 13px; }

/* MFA Setup */
.mfa-setup-container { padding: 16px; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px; margin: 12px 0; }
.mfa-qr-area { background: #fff; padding: 16px; border-radius: 6px; margin: 8px 0; font-family: monospace; font-size: 11px; word-break: break-all; line-height: 1.5; }
.mfa-secret-display { background: #1e293b; color: #a5f3fc; padding: 8px 12px; border-radius: 4px; font-family: monospace; font-size: 13px; letter-spacing: 2px; margin: 8px 0; }

/* Export Actions */
.export-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }

/* Trend Charts */
.trend-chart-container { background: var(--card, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 16px 18px; margin: 16px 0; }
.trend-chart-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 10px; }
.trend-chart-title { font-size: 14px; font-weight: 700; color: var(--text, #111); margin-bottom: 4px; }
.trend-chart-subtitle { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; max-width: 620px; }
.trend-kpis { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.trend-kpis span { border: 1px solid var(--line); background: var(--surface-soft); border-radius: 8px; padding: 6px 8px; color: var(--muted); font-size: 11px; min-width: 64px; text-align: center; }
.trend-kpis strong { display: block; color: var(--text); font-size: 16px; line-height: 1; margin-bottom: 3px; }
.trend-chart-svg { width: 100%; height: auto; }

/* ============================================================
   UI Polish Pass — Responsive shell, cards, forms, drawers
   ============================================================ */

.app-shell.sidebar-collapsed {
  grid-template-columns: 60px minmax(0, 1fr);
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 14px 8px;
  align-items: center;
  overflow-x: hidden;
}

.app-shell.sidebar-collapsed .brand {
  width: 100%;
  justify-content: center;
  padding: 0 0 14px;
  margin-bottom: 8px;
}

.app-shell.sidebar-collapsed .brand-mark,
.app-shell.sidebar-collapsed .sidebar-role-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.app-shell.sidebar-collapsed .nav-btn,
.app-shell.sidebar-collapsed .nav-button,
.app-shell.sidebar-collapsed .sidebar-role-btn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
}

.app-shell.sidebar-collapsed .sidebar-footer,
.app-shell.sidebar-collapsed .sidebar-panel {
  width: 100%;
  padding: 12px 0 0;
}

.topbar {
  min-width: 0;
}

.topbar-left,
.toolbar,
.topbar-scope,
.topbar-user-info {
  min-width: 0;
}

.topbar-title-group {
  max-width: 280px;
  min-width: 0;
}

.topbar .select-compact {
  max-width: 170px;
  text-overflow: ellipsis;
}

.topbar-user-info {
  max-width: 96px;
}

.topbar-user-name,
.topbar-user-role {
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-bell {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 8px;
  justify-content: center;
}

.notification-bell:hover {
  color: var(--accent);
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.notification-bell svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notification-bell-badge {
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  border: 2px solid var(--surface);
}

.role-home-goal-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.role-home-goal-card {
  align-items: flex-start;
  min-height: 112px;
  padding: 16px;
}

.role-home-goal-label {
  font-weight: 700;
}

.role-home-goal-desc {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.role-home-goal-arrow {
  margin-top: 3px;
}

.content .grid-2 > .panel:not(:has(> .panel-header)),
.content .grid-2 > article.panel:not(:has(> .panel-header)),
.content .grid-3 > .panel:not(:has(> .panel-header)),
.content .grid-3 > article.panel:not(:has(> .panel-header)),
.content .grid-4 > .panel:not(:has(> .panel-header)),
.content .grid-4 > article.panel:not(:has(> .panel-header)) {
  padding: 16px;
}

.content .grid-2 > .panel:not(:has(> .panel-header)) .item-meta,
.content .grid-3 > .panel:not(:has(> .panel-header)) .item-meta,
.content .grid-4 > .panel:not(:has(> .panel-header)) .item-meta {
  line-height: 1.45;
}

.panel > form.form-grid,
.panel > .form-grid {
  padding: 16px 20px 20px;
}

.panel-form-section {
  margin: 16px 20px 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

.panel-form-section h3 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

.field-help {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.table th:last-child,
.table td:last-child {
  text-align: right;
}

.table td .item-actions,
.table td:last-child .item-actions {
  justify-content: flex-end;
}

.table td:last-child .button,
.item-actions .button {
  min-height: 30px;
}

.item {
  align-items: center;
}

.item > div:first-child {
  flex: 1;
  min-width: 0;
}

.item-title {
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.item-meta {
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.item-actions {
  justify-content: flex-end;
  max-width: 48%;
  flex-wrap: wrap;
}

.drawer {
  width: min(620px, 94vw);
}

.drawer-header {
  padding: 18px 24px;
}

.drawer-body {
  padding: 22px 24px 28px;
}

.drawer .form-grid {
  gap: 16px;
}

.drawer .field.full,
.drawer .form-grid .full {
  min-width: 0;
}

.drawer textarea,
.drawer .textarea {
  min-height: 96px;
}

.mfa-setup-container {
  background: var(--surface-soft);
  border-color: var(--line);
}

.mfa-open-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.mfa-open-row strong,
.mfa-open-row span {
  display: block;
}

.mfa-open-row span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.mfa-uri-box {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   UI Polish Pass 2 — Productive work surfaces
   ============================================================ */

.nudge-link {
  white-space: nowrap;
  min-height: 28px;
}

.exception-action-cell {
  width: 220px;
  min-width: 200px;
  vertical-align: middle;
  text-align: center;
}

.exception-status-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.exception-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: min(100%, 190px);
}

.exception-actions .button {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
  justify-content: center;
  white-space: nowrap;
}

.table-action-cell {
  text-align: right;
  vertical-align: middle;
  width: 1%;
  white-space: nowrap;
}
.product-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 250px;
}
.icon-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--fg, #111827);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.icon-action-btn:hover { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); background: #eff6ff; }
.icon-action-btn.primary { background: var(--accent, #2563eb); border-color: var(--accent, #2563eb); color: #fff; }
.icon-action-btn.primary:hover { background: var(--accent-hover, #1e40af); color: #fff; }
.icon-action-btn.danger { color: #dc2626; border-color: #fecaca; }
.icon-action-btn.danger:hover { background: #fff1f2; border-color: #fca5a5; color: #b91c1c; }
.icon-action-btn svg {
  width: 14px; height: 14px; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.finding-action-cell {
  width: 230px;
  min-width: 210px;
}

.row-action-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.row-action-stack .button {
  min-height: 30px;
  justify-content: center;
  white-space: nowrap;
}

.row-action-stack .button:first-child {
  grid-column: 1 / -1;
}

.drawer > form.form-grid,
.drawer > .form-grid,
.drawer > .drawer-body {
  padding: 22px 26px 30px;
}

.drawer-header > div {
  min-width: 0;
}

.drawer-title {
  line-height: 1.25;
}

.drawer .field,
.drawer .form-group {
  min-width: 0;
}

.drawer .input,
.drawer select,
.drawer textarea {
  border-radius: 8px;
}

.drawer .button {
  min-height: 34px;
}

.mode-manager {
  display: grid;
  gap: 16px;
}
.mode-manager-current,
.mode-manager-audit,
.mode-manager-denied {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--surface);
}
.mode-manager-current {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface-soft);
}
.mode-manager-current h3 {
  margin: 4px 0;
  font-size: 18px;
}
.mode-manager-current p,
.mode-manager-audit p,
.mode-manager-denied p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.mode-manager-audit {
  background: #fffbeb;
  border-color: #fde68a;
}
.mode-manager-audit.is-auto {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.mode-manager-audit strong,
.mode-manager-denied strong {
  display: block;
  margin-bottom: 4px;
}
.mode-manager-form {
  display: grid;
  gap: 14px;
}
.mode-manager-form .input,
.mode-manager-form .textarea {
  width: 100%;
}
.mode-manager-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mode-manager-denied code {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 4px;
}

.mfa-qr-panel {
  display: grid;
  grid-template-columns: 164px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  margin-bottom: 12px;
}

.mfa-qr-svg {
  width: 164px;
  height: 164px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  fill: #0f172a;
}

.mfa-qr-panel strong,
.mfa-qr-panel span {
  display: block;
}

.mfa-qr-panel span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.briefing-grid {
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 14px;
  padding: 0 18px 18px;
}

.briefing-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  min-height: 210px;
}

.briefing-card-header {
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
}

.briefing-card-header strong {
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.briefing-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.briefing-card-stats span,
.champion-pattern,
.champion-action {
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 5px 7px;
  font-size: 12px;
  line-height: 1.35;
}

.champion-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.champion-action {
  margin: 0;
  overflow-wrap: anywhere;
}

.champion-pattern {
  margin-top: auto;
  overflow-wrap: anywhere;
}

.coaching-card {
  margin: 0 18px 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.coaching-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.coaching-pattern,
.coaching-details p {
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.coaching-details {
  display: grid;
  gap: 6px;
  color: var(--text);
}

.debt-items-list {
  display: grid;
  gap: 10px;
  padding: 0 18px 18px;
}

.debt-item {
  display: block;
  padding: 16px 18px;
  margin: 0;
  border-radius: 12px;
}

.debt-item-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.debt-title {
  min-width: 220px;
  flex: 1;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.debt-impact {
  margin: 10px 0 4px;
  line-height: 1.45;
}

.debt-risk {
  margin: 0;
  max-width: 920px;
}

.debt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ac-form {
  padding: 18px 20px 20px;
}

.ac-form .form-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.ac-form .form-group {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ac-form textarea.input {
  min-height: 132px;
  resize: vertical;
  line-height: 1.5;
}

.ac-form .command-row {
  margin-top: 14px;
}

.panel > form:not(.form-grid),
form.panel-form,
#catalog-import-form {
  padding: 16px 20px 20px;
}

#catalog-import-form .textarea {
  display: block;
  width: 100%;
  min-height: 180px;
  border-radius: 10px;
  line-height: 1.5;
  padding: 12px 14px;
}

.form-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.integration-snippet-grid {
  padding: 0 20px 20px;
}

.integration-snippet-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  padding: 16px;
  min-width: 0;
}

.code-block {
  display: block;
  background: var(--bg-code, #172554);
  color: #dbeafe;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 12px;
  margin: 8px 0;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code-block-pre {
  font-size: 11px;
  line-height: 1.55;
  max-height: 240px;
}

.standards-cell {
  width: 260px;
  max-width: 280px;
}

.standards-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.standards-compact .badge {
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-permission-list {
  display: grid;
  gap: 10px;
  padding: 16px 20px 20px;
}

.role-permission-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 14px 16px;
}

.role-permission-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
}

.role-permission-chips {
  gap: 5px;
}

.permission-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

.permission-toggle,
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.35;
}

.role-permission-form {
  display: grid;
  gap: 16px;
}
.role-permission-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface);
}
.super-admin-toggle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fff1f2;
}
.super-admin-toggle input { margin-top: 3px; }
.super-admin-toggle strong { display: block; color: #991b1b; }
.super-admin-toggle small {
  display: block;
  color: #7f1d1d;
  margin-top: 2px;
  line-height: 1.4;
}
.permission-editor-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.permission-editor-header span {
  color: var(--muted);
  font-size: 12px;
}
.role-permission-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.login-demo-banner {
  align-items: flex-start;
  gap: 8px;
}

.login-demo-help {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.login-demo-help code {
  background: rgba(15, 23, 42, 0.08);
  border-radius: 4px;
  padding: 1px 4px;
}

@media (max-width: 760px) {
  .exception-status-wrap,
  .exception-actions {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .mfa-qr-panel,
  .ac-form .form-row {
    grid-template-columns: 1fr;
  }

  .mfa-qr-svg {
    width: 180px;
    height: 180px;
    margin: 0 auto;
  }

  .briefing-grid,
  .debt-items-list {
    padding-inline: 12px;
  }
}

@media (max-width: 1280px) {
  .page-breadcrumb {
    display: none;
  }

  .topbar-title-group {
    max-width: 180px;
  }

  .topbar .select-compact {
    max-width: 150px;
  }

  .toolbar {
    gap: 5px;
  }

  .topbar-user-info {
    display: none;
  }
}

/* Reset Password */
.auth-subform { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line, #e5e7eb); text-align: center; }
.auth-back-link { font-size: 12px; color: var(--accent, #2563eb); cursor: pointer; text-decoration: underline; }

/* Notification Preferences */
.notif-prefs-section { padding: 16px 0; border-bottom: 1px solid var(--line, #e5e7eb); }
.notif-prefs-section:last-child { border-bottom: none; }
.notif-prefs-title { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.notif-prefs-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }

/* ── SSDLC Journey ─────────────────────────────────────────────────────────── */
/* BEM aliases for journey hero */
.maturity-journey-hero { background: linear-gradient(135deg, var(--accent, #2563eb) 0%, #7c3aed 100%); border-radius: 14px; padding: 28px 32px; color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.maturity-journey-hero-text { flex: 1; min-width: 0; }
.maturity-journey-progress-ring { flex-shrink: 0; }
.journey-phase-meta { flex: 1; min-width: 0; }
.journey-phase-label { font-weight: 600; font-size: 14px; }
.journey-phase-progress { flex-shrink: 0; }
.journey-milestone-content { flex: 1; min-width: 0; }
.journey-milestone-action { font-size: 11px; color: var(--muted); margin-top: 2px; font-style: italic; }
.level-up-progress-pill { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.level-up-progress-bar { height: 6px; border-radius: 3px; background: var(--line); margin-bottom: 14px; overflow: hidden; }
.level-up-progress-fill { height: 100%; border-radius: 3px; background: var(--accent, #2563eb); transition: width .4s; }
.level-up-action-num { width: 22px; height: 22px; border-radius: 50%; background: var(--accent, #2563eb); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.level-up-action-title { font-weight: 600; font-size: 13px; }
.level-up-action-meta { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.decision-node-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.decision-node-icon { font-size: 26px; flex-shrink: 0; }
.decision-node-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.decision-option-arrow { margin-left: auto; flex-shrink: 0; opacity: .5; }
.decision-rationale { font-size: 13px; color: var(--muted); background: var(--bg); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; border-left: 3px solid var(--accent, #2563eb); }
.decision-code-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .55; margin-bottom: 6px; }
.decision-code pre { margin: 0; white-space: pre-wrap; word-break: break-word; }
.decision-antipatterns-label { font-size: 11px; font-weight: 700; color: #dc2626; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.decision-antipattern { font-size: 12px; display: flex; align-items: flex-start; gap: 6px; margin-bottom: 3px; color: #7f1d1d; }
.decision-antipattern::before { content: "✗"; flex-shrink: 0; }
.decision-references-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; margin-top: 12px; }
.decision-reference-link { display: inline-block; font-size: 12px; color: var(--accent, #2563eb); text-decoration: none; margin-right: 10px; }
.decision-reference-link:hover { text-decoration: underline; }
.decision-answer-content { margin-top: 12px; }
.maturity-tier-card .panel-header { margin-bottom: 8px; }
.maturity-tier-context { display: flex; align-items: center; gap: 8px; margin-top: 10px; }

.journey-hero {
  background: linear-gradient(135deg, var(--accent, #2563eb) 0%, #7c3aed 100%);
  border-radius: 14px;
  padding: 28px 32px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}
.journey-hero-text { flex: 1; min-width: 0; }
.journey-hero-title { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.journey-hero-sub { font-size: 14px; opacity: .85; margin: 0; }
.journey-hero-actions { display: flex; gap: 8px; flex-shrink: 0; margin-top: 14px; }
.journey-hero-actions .button { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); color: #fff; }
.journey-hero-actions .button:hover { background: rgba(255,255,255,.28); }
.journey-hero-ring { flex-shrink: 0; }

.progress-ring-wrap { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.progress-ring-label { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.85); letter-spacing: .03em; }

.journey-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.journey-phase {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.journey-phase.active,
.journey-phase--active { border-color: var(--accent, #2563eb); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.journey-phase.done,
.journey-phase--done { border-color: #10b981; }
.journey-phase--locked { opacity: .7; }
.journey-phase-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: default;
}
.journey-phase-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}
.journey-phase-info { flex: 1; min-width: 0; }
.journey-phase-name { font-weight: 600; font-size: 14px; }
.journey-phase-days { font-size: 12px; color: var(--muted); margin-top: 2px; }
.journey-phase-badge { flex-shrink: 0; }
.journey-phase-prog {
  height: 4px;
  background: var(--line);
  border-radius: 0 0 12px 12px;
}
.journey-phase-prog-fill {
  height: 4px;
  border-radius: 0 0 12px 12px;
  transition: width .4s;
}
.journey-phase.done .journey-phase-prog-fill { background: #10b981; }
.journey-phase.active .journey-phase-prog-fill { background: var(--accent, #2563eb); }
.journey-phase.pending .journey-phase-prog-fill { background: var(--muted); }

.journey-milestones { padding: 4px 18px 14px 66px; display: flex; flex-direction: column; gap: 5px; }
.journey-milestone {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 7px;
  background: var(--bg);
}
.journey-milestone.done,
.journey-milestone--done { color: #059669; }
.journey-milestone.pending { color: var(--muted); }
.journey-milestone-icon { font-size: 14px; flex-shrink: 0; }
.journey-milestone-label { flex: 1; }

.maturity-journey-hero {
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-left: 4px solid var(--accent, #2563eb) !important;
  box-shadow: var(--shadow-sm);
  color: var(--text) !important;
}
.maturity-journey-hero .workbench-eyebrow { color: var(--accent, #2563eb); }
.maturity-journey-hero .workbench-title { color: var(--text); }
.maturity-journey-hero .workbench-copy { color: var(--muted); max-width: 780px; }
.maturity-journey-hero .journey-hero-actions .button {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}
.maturity-journey-hero .journey-hero-actions .button.primary {
  background: var(--accent, #2563eb);
  color: #fff;
  border-color: var(--accent, #2563eb);
}
.journey-loading-ring {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 10px solid var(--line);
  border-top-color: var(--accent, #2563eb);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.journey-phase-icon {
  color: #475569;
  background: #e2e8f0 !important;
}
.journey-phase-icon.is-active {
  background: color-mix(in srgb, var(--phase-color, #2563eb) 16%, white) !important;
  color: var(--phase-color, #2563eb);
  border: 1px solid color-mix(in srgb, var(--phase-color, #2563eb) 35%, white);
}
.journey-phase-icon.is-done {
  background: #dcfce7 !important;
  color: #15803d;
  border: 1px solid #86efac;
}
.journey-phase-icon svg,
.journey-milestone-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.journey-milestone-icon {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--line);
  display: inline-grid;
  place-items: center;
  background: #fff;
}
.journey-milestone-icon.is-done {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}

/* ── Level-Up Card ─────────────────────────────────────────────────────────── */
.level-up-card {
  border: 1.5px solid var(--accent, #2563eb);
  background: color-mix(in srgb, var(--accent, #2563eb) 5%, var(--surface));
}
.level-up-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.level-up-title { font-weight: 700; font-size: 15px; flex: 1; }
.level-up-badge { font-size: 12px; font-weight: 600; color: var(--accent); background: rgba(37,99,235,.1); border-radius: 20px; padding: 3px 10px; }
.level-up-progress { height: 6px; border-radius: 3px; background: var(--line); margin-bottom: 14px; overflow: hidden; }
.level-up-progress-fill { height: 100%; border-radius: 3px; background: var(--accent, #2563eb); transition: width .4s; }
.level-up-actions { display: flex; flex-direction: column; gap: 7px; }
.level-up-action {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.level-up-action.done { opacity: .6; }
.level-up-action-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.level-up-action-body { flex: 1; min-width: 0; }
.level-up-action-label { font-weight: 600; }
.level-up-action-hint { font-size: 11px; color: var(--muted); margin-top: 2px; }
.level-up-sprint { margin-top: 12px; font-size: 12px; color: var(--muted); text-align: right; }

/* ── Maturity Tier Banner ──────────────────────────────────────────────────── */
.maturity-tier-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent, #2563eb) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent, #2563eb) 25%, transparent);
  margin-bottom: 16px;
  font-size: 13px;
}
.maturity-tier-emoji { font-size: 24px; }
.maturity-tier-info { flex: 1; }
.maturity-tier-name { font-weight: 700; font-size: 14px; }
.maturity-tier-desc { color: var(--muted); margin-top: 2px; }
.maturity-tier-actions { display: flex; gap: 8px; }

/* ── Decision Trees ────────────────────────────────────────────────────────── */
.decision-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) {
  .decision-layout { grid-template-columns: 1fr; }
}
.decision-tree-list { display: flex; flex-direction: column; gap: 8px; }
.decision-tree-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.decision-tree-item:hover { border-color: var(--accent, #2563eb); }
.decision-tree-item.active { border-color: var(--accent, #2563eb); background: color-mix(in srgb, var(--accent, #2563eb) 6%, var(--surface)); box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.decision-tree-icon { font-size: 22px; flex-shrink: 0; }
.decision-tree-meta { flex: 1; min-width: 0; }
.decision-tree-name { font-weight: 600; font-size: 13px; }
.decision-tree-desc { font-size: 12px; color: var(--muted); margin-top: 3px; }

.decision-navigator { min-height: 300px; }
.decision-node { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.decision-breadcrumb { font-size: 12px; color: var(--muted); margin-bottom: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.decision-breadcrumb-sep { opacity: .5; }
.decision-question { font-size: 17px; font-weight: 700; margin-bottom: 18px; line-height: 1.45; }
.decision-options { display: flex; flex-direction: column; gap: 10px; }
.decision-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color .15s, background .15s;
  width: 100%;
}
.decision-option:hover { border-color: var(--accent, #2563eb); background: color-mix(in srgb, var(--accent, #2563eb) 4%, var(--bg)); }
.decision-option-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.decision-option-body { flex: 1; min-width: 0; }
.decision-option-label { font-weight: 600; font-size: 14px; }
.decision-option-desc { font-size: 12px; color: var(--muted); margin-top: 3px; }

.decision-answer { }
.decision-answer-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.decision-answer-recommendation { font-size: 14px; color: var(--muted); margin-bottom: 18px; line-height: 1.55; }
.decision-code-block {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 16px 20px;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 12.5px;
  line-height: 1.65;
  overflow-x: auto;
  margin-bottom: 16px;
}
.decision-code-block-label { font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; opacity: .6; margin-bottom: 8px; }
.decision-refs { margin-top: 16px; }
.decision-refs-title { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.decision-ref-link { display: inline-block; font-size: 12px; color: var(--accent, #2563eb); text-decoration: none; margin-right: 10px; }
.decision-ref-link:hover { text-decoration: underline; }
.decision-antipatterns { margin-top: 16px; padding: 12px 16px; background: rgba(239,68,68,.06); border: 1px solid rgba(239,68,68,.2); border-radius: 9px; }
.decision-antipatterns-title { font-size: 12px; font-weight: 700; color: #dc2626; margin-bottom: 6px; }
.decision-antipattern { font-size: 12px; display: flex; align-items: flex-start; gap: 6px; margin-bottom: 3px; }

/* ── Program Health Report ─────────────────────────────────────────────────── */
.health-score-ring {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.health-score-number { font-size: 48px; font-weight: 800; line-height: 1; }
.health-score-number.ok { color: #10b981; }
.health-score-number.warn { color: #f59e0b; }
.health-score-number.bad { color: #ef4444; }
.health-score-info { flex: 1; }
.health-score-label { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.health-score-month { font-size: 13px; color: var(--muted); }
.health-patterns { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.health-pattern-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.health-pattern-count { font-weight: 700; font-size: 15px; color: #dc2626; flex-shrink: 0; width: 24px; text-align: center; }
.health-pattern-meta { flex: 1; min-width: 0; }
.health-pattern-id { font-weight: 600; }
.health-pattern-area { font-size: 11px; color: var(--muted); }
.health-rec {
  padding: 10px 14px;
  border-radius: 9px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  margin-bottom: 8px;
  font-size: 13px;
}
.health-rec.high { border-color: #ef4444; background: rgba(239,68,68,.04); }
.health-rec.medium { border-color: #f59e0b; background: rgba(245,158,11,.04); }
.health-rec-title { font-weight: 600; margin-bottom: 3px; }
.health-rec-action { color: var(--muted); }
.health-rec-cat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; opacity: .65; margin-bottom: 2px; }

/* ── Guided Workflow View ──────────────────────────────────────────────── */
.wf-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: start;
  margin-top: 12px;
}
@media (max-width: 700px) { .wf-layout { grid-template-columns: 1fr; } }

/* Step list (left column) */
.wf-step-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wf-step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s;
  width: 100%;
}
.wf-step-item:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.wf-step-item--active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.wf-step-item--done { opacity: .75; }
.wf-step-item-status { flex-shrink: 0; margin-top: 1px; }
.wf-step-item-body { flex: 1; min-width: 0; }
.wf-step-item-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-step-item-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Step status badges */
.wf-step-status { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; font-weight: 700; }
.wf-step-status.done    { background: #d1fae5; color: #059669; }
.wf-step-status.active  { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.wf-step-status.blocked { background: rgba(239,68,68,.15); color: #dc2626; }
.wf-step-status.pending { background: var(--bg); color: var(--muted); border: 1.5px solid var(--line); }

/* Step detail panel (right column) */
.wf-step-detail-panel {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  min-height: 300px;
}
.wf-step-detail {
  padding: 20px 22px;
}
.wf-step-detail--urgent { border-left: 4px solid #ef4444; }
.wf-step-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.wf-step-detail-meta { flex: 1; }
.wf-step-detail-phase { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 3px; }
.wf-step-detail-title { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.wf-step-desc { font-size: 14px; color: var(--muted); margin: 0 0 14px; line-height: 1.55; }

/* Sections inside step */
.wf-step-section { margin-bottom: 14px; }
.wf-step-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.wf-step-section-body { margin: 0; font-size: 13.5px; line-height: 1.55; }

/* Decision point */
.wf-decision-point {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border: 1.5px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.wf-decision-question { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.wf-decision-options { display: flex; flex-wrap: wrap; gap: 8px; }
.wf-decision-option {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.wf-decision-option:hover { background: var(--accent); color: #fff; }
.wf-decision-option--info { border-color: var(--line); color: var(--fg); }
.wf-decision-option--info:hover { background: var(--line); color: var(--fg); }

/* Handover */
.wf-handover {
  background: rgba(245,158,11,.08);
  border: 1.5px solid rgba(245,158,11,.35);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.wf-handover-label { font-weight: 700; margin-bottom: 4px; }
.wf-handover-reason { color: var(--muted); margin-bottom: 8px; }

/* Step actions row */
.wf-step-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

/* Audit note */
.wf-audit-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 8px;
}
.wf-audit-icon { font-size: 14px; }

/* Empty state inside wf panel */
.wf-empty { display: flex; align-items: center; justify-content: center; min-height: 200px; }

/* ── Control Guide inline panel ────────────────────────────────────── */
.guide-section { margin-bottom: 16px; }
.guide-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 5px; }
.guide-section-body { margin: 0; font-size: 13.5px; line-height: 1.55; }
.guide-section--role { background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 8px; padding: 10px 12px; }
.guide-steps { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.7; }
.guide-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
@media (max-width: 600px) { .guide-cols { grid-template-columns: 1fr; } }
.guide-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.7; }
.guide-list--warn li { color: #b45309; }
.guide-gate-block {
  display: flex; align-items: center; gap: 8px;
  background: rgba(239,68,68,.07);
  border: 1.5px solid rgba(239,68,68,.3);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 14px;
  font-size: 13px;
}
.guide-gate-icon { font-size: 16px; flex-shrink: 0; }
.guide-refs { display: flex; flex-wrap: wrap; gap: 6px; }
.guide-ref-badge {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 9px; font-size: 11.5px; font-weight: 600;
}
.guide-ref-badge a { color: var(--accent); text-decoration: none; }
.guide-ref-badge a:hover { text-decoration: underline; }

/* workbench-stat aliases (used by workflow view) */
.workbench-stat {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  text-align: center;
}
.workbench-stat-val { font-size: 22px; font-weight: 800; }
.workbench-stat-val.ok   { color: #10b981; }
.workbench-stat-val.bad  { color: #ef4444; }
.workbench-stat-val.warn { color: #f59e0b; }
.workbench-stat-val.info { color: var(--accent); }
.workbench-stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Journey context strip inside Workflow view */
.wf-journey-ctx {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 8px;
  background: color-mix(in srgb, #6366f1 8%, var(--surface));
  border: 1px solid color-mix(in srgb, #6366f1 25%, var(--line));
  font-size: 13px;
  margin-bottom: 14px;
}
.wf-journey-ctx-icon { font-size: 15px; flex-shrink: 0; }
.wf-journey-ctx-text { flex: 1; min-width: 0; }

/* ── Journey ↔ Workflow bridge UI ─────────────────────────────────────── */

/* Journey milestone → Workflow links */
.journey-milestone-wf-links { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.journey-milestone-wf-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 6px; padding: 4px 10px; cursor: pointer;
  transition: background .15s;
  text-align: left;
}
.journey-milestone-wf-btn:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* Level-Up action → Workflow link */
.level-up-action--linked { background: color-mix(in srgb, var(--accent) 4%, transparent); border-radius: 8px; }
.level-up-action-wf { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.level-up-action-wf-btn {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
  border-radius: 7px; padding: 5px 10px; cursor: pointer; text-align: left;
  transition: background .15s;
}
.level-up-action-wf-btn:hover { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.level-up-action-wf-status { font-size: 11px; margin-left: auto; flex-shrink: 0; font-weight: 700; }
.level-up-action-wf-status--done    { color: #10b981; }
.level-up-action-wf-status--active  { color: var(--accent); }
.level-up-action-wf-status--blocked { color: #ef4444; }
.level-up-action-wf-status--pending { color: var(--muted); }

/* Workflow step → Journey contribution box */
.wf-journey-contribution {
  background: color-mix(in srgb, #6366f1 6%, var(--surface));
  border: 1px solid color-mix(in srgb, #6366f1 20%, var(--line));
  border-radius: 9px; padding: 10px 14px; margin-bottom: 14px;
}
.wf-journey-contribution-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #6366f1; margin-bottom: 7px; }
.wf-journey-contribution-section { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 5px; }
.wf-journey-contribution-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.wf-journey-contribution-badge { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 5px; }
.wf-journey-contribution-badge--levelup  { background: rgba(99,102,241,.12); color: #6366f1; border: 1px solid rgba(99,102,241,.25); }
.wf-journey-contribution-badge--milestone { background: rgba(16,185,129,.10); color: #059669; border: 1px solid rgba(16,185,129,.25); }

/* Journey context strip enhanced */
.wf-journey-ctx { flex-wrap: wrap; }
.wf-journey-ctx-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wf-journey-ctx-main { font-size: 13px; }
.wf-journey-ctx-coverage { display: flex; flex-wrap: wrap; gap: 6px; }
.wf-journey-ctx-pill { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 5px; }
.wf-journey-ctx-pill--levelup { background: rgba(99,102,241,.12); color: #6366f1; border: 1px solid rgba(99,102,241,.22); }

/* ── Login Welcome Panel (Demo Mode) ─────────────────────────────────────── */
.login-screen-demo {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: center;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px;
  min-height: 100vh;
  box-sizing: border-box;
}
.login-welcome-panel {
  color: #fff;
  max-width: 520px;
}
.lwp-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.lwp-logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.lwp-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
  letter-spacing: -0.5px;
}
.lwp-sub {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  margin: 3px 0 0;
}
.lwp-lead {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.82);
  line-height: 1.65;
  margin-bottom: 24px;
}
.lwp-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-bottom: 12px;
}
.lwp-roles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.lwp-role-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
}
.lwp-role-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.lwp-role-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.lwp-role-info strong {
  font-size: 0.85rem;
  color: #fff;
}
.lwp-role-title {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.55);
}
.lwp-role-desc {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
}
.lwp-tip {
  background: rgba(99,102,241,0.18);
  border: 1px solid rgba(99,102,241,0.35);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  line-height: 1.6;
}
.lwp-tip strong { color: #a5b4fc; }
.lwp-tip em     { color: #c4b5fd; font-style: normal; }
@media (max-width: 860px) {
  .login-screen-demo { grid-template-columns: 1fr; justify-items: center; gap: 24px; }
  .login-welcome-panel { max-width: 480px; }
}

/* ── Sidebar Help Button ──────────────────────────────────────────────────── */
.sidebar-help-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.55);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 6px;
  text-align: left;
}
.sidebar-help-btn:hover,
.sidebar-help-btn.active {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.4);
  color: #a5b4fc;
}

/* ── Help / Guide View ────────────────────────────────────────────────────── */
.help-view { max-width: 900px; margin: 0 auto; padding-bottom: 60px; }
.help-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}
.help-hero-logo { width: 48px; height: 48px; flex-shrink: 0; }
.help-hero-title { font-size: 1.4rem; font-weight: 800; color: var(--text); margin: 0; }
.help-hero-sub { font-size: 0.8rem; color: var(--muted); margin: 4px 0 0; }
.help-section { margin-bottom: 44px; }
.help-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}
.help-intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.help-intro-text { font-size: 0.9rem; color: var(--text); line-height: 1.7; }
.help-quickstart {
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 18px 20px;
}
.help-qs-title { font-size: 0.85rem; font-weight: 700; color: #1e40af; margin-bottom: 10px; }
.help-qs-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.help-qs-list li { font-size: 0.85rem; color: var(--text); line-height: 1.5; }
.help-qs-list strong { color: #1e40af; }
.help-roles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.help-role-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface-soft);
}
.help-role-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.help-role-icon { font-size: 1.2rem; }
.help-role-name { font-size: 0.85rem; color: var(--text); }
.help-role-desc { font-size: 0.78rem; color: var(--muted); margin: 0 0 8px; line-height: 1.5; }
.help-role-views { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 3px; }
.help-role-views li { font-size: 0.75rem; color: var(--text); }
.help-features-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.help-feature-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  align-items: flex-start;
}
.help-feature-icon { font-size: 1.4rem; flex-shrink: 0; }
.help-feature-title { font-size: 0.88rem; font-weight: 700; color: var(--text); display: block; margin-bottom: 4px; }
.help-feature-desc { font-size: 0.78rem; color: var(--muted); margin: 0; line-height: 1.55; }
.help-text { font-size: 0.9rem; color: var(--text); line-height: 1.7; margin: 0; }
.help-code-block {
  background: #1e293b;
  border-radius: 10px;
  padding: 16px 20px;
  margin-top: 12px;
  overflow-x: auto;
}
.help-code-block pre { margin: 0; }
.help-code-block code { font-family: monospace; font-size: 0.82rem; color: #94a3b8; }
@media (max-width: 720px) {
  .help-intro-grid  { grid-template-columns: 1fr; }
  .help-roles-grid  { grid-template-columns: 1fr 1fr; }
  .help-features-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .help-roles-grid { grid-template-columns: 1fr; }
}
