/* ----------------------------------------------------------------------
   DERECK — dark theme
   DERECK inspired: deep blacks, restrained accents, premium-intel vibe.
   ---------------------------------------------------------------------- */

:root {
  /* surfaces — pure black, near-black layers for depth */
  --bg-base: #080808;
  --bg-surface: #0d0d0d;
  --bg-surface-2: #141414;
  --bg-surface-3: #1a1a1a;

  /* borders — gold-tinted, very subtle */
  --border-subtle: #1c1810;
  --border-mid:    #2d2616;
  --border-strong: #4a3f22;

  /* text — warm off-white for body, gold reserved for headers + key data */
  --text-primary:   #d8d2c4;
  --text-secondary: rgba(216, 210, 196, 0.58);
  --text-dim:       rgba(216, 210, 196, 0.32);
  --text-disabled:  rgba(216, 210, 196, 0.16);

  /* accent — the gold itself */
  --accent:       #E2C55C;
  --accent-hover: #F5D870;
  --accent-dim:   rgba(226, 197, 92, 0.12);

  /* severity — distinct from gold so they pop on alerts */
  --sev-high:   #FF4444;
  --sev-medium: #FF9944;
  --sev-low:    rgba(226, 197, 92, 0.40);

  /* status */
  --status-healthy:  #6ABE44;
  --status-degraded: #FFAA44;
  --status-down:     #FF4444;

  /* type — JetBrains Mono throughout for terminal feel */
  --font-sans: "JetBrains Mono", "IBM Plex Mono", "Menlo", "Consolas", monospace;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", "Menlo", "Consolas", monospace;
  --font-serif: "Garamond", "Playfair Display", "Georgia", serif;

  /* shell dimensions */
  --sidebar-w-open: 240px;
  --sidebar-w-closed: 56px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }

/* Dark-theme scrollbars — both modern (Firefox + Chromium 121+) and the
   legacy webkit pseudo-elements (older Chrome / Safari / Edge) so the
   bars don't render as bright OS-default white against our near-black
   surfaces. Track is invisible, thumb picks up the muted gold border
   tint, hover brightens to the accent. */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
::-webkit-scrollbar-corner { background: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0;
}

a { color: var(--text-primary); text-decoration: none; }
a:hover { color: var(--accent); }

/* ----------------------------------------------------------------------
   Generic utility marks (used by report_view + admin tables)
   ---------------------------------------------------------------------- */

.brand-mark {
  display: inline-block;
  width: 18px; height: 18px;
  background: var(--accent);
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}

.topbar-user-tag {
  display: inline-block;
  padding: 1px 5px;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* ----------------------------------------------------------------------
   App shell — sidebar + workspace topbar
   ---------------------------------------------------------------------- */

body.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w-open) 1fr;
  grid-template-rows: 1fr;
  transition: grid-template-columns 0.2s ease;
}
body.shell[data-sidebar="closed"] { grid-template-columns: var(--sidebar-w-closed) 1fr; }

/* Sidebar
   ---------- */
.sidebar {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  border-right: 1px solid var(--border-subtle);
  overflow: hidden;
  z-index: 200;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  height: var(--topbar-h);
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-toggle {
  background: transparent;
  border: 1px solid var(--border-mid);
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-secondary);
  padding: 0;
}
.sidebar-toggle:hover { border-color: var(--accent); color: var(--accent); }

.hamburger-icon {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  width: 14px; height: 10px;
}
.hamburger-icon span {
  display: block;
  height: 1px;
  background: currentColor;
  width: 100%;
}

.sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--accent);
  overflow: hidden;
  white-space: nowrap;
}
.sidebar-brand-mark {
  width: 16px; height: 16px;
  background: var(--accent);
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 400;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0 8px;
}

.sidebar-section { padding: 0 8px; }

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  margin-bottom: 4px;
  text-decoration: none;
  color: var(--text-dim);
  border-left: 2px solid transparent;
}
.sidebar-section-header:hover { color: var(--accent); }
.sidebar-section-header.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.sidebar-section-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  padding: 1px 6px;
  border: 1px solid var(--border-mid);
  min-width: 18px;
  text-align: center;
}
.sidebar-section-header.active .sidebar-section-count,
.sidebar-section-header:hover .sidebar-section-count {
  color: var(--accent);
  border-color: var(--accent);
}

.sidebar-ws-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-ws-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-ws-item:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.sidebar-ws-item.active { background: var(--bg-surface-2); color: var(--text-primary); }
.sidebar-ws-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
}

.sidebar-ws-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
}
.sidebar-ws-item.active .sidebar-ws-dot { background: var(--accent); }

.sidebar-ws-name {
  flex: 1;
  text-overflow: ellipsis;
  overflow: hidden;
}

.sidebar-ws-empty {
  padding: 8px 12px;
  color: var(--text-dim);
  font-size: 11px;
  font-style: italic;
}

.sidebar-foot {
  flex-shrink: 0;
  padding: 8px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-link:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.sidebar-link.active { background: var(--bg-surface-2); color: var(--accent); }
.sidebar-link-icon {
  width: 16px;
  display: inline-flex;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-dim);
}
.sidebar-link.active .sidebar-link-icon { color: var(--accent); }

.sidebar-user {
  margin-top: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border-subtle);
}
.sidebar-user-avatar {
  width: 28px; height: 28px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-mid);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}
.sidebar-user-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-user-email {
  font-size: 11px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-top: 2px;
}
.sidebar-user-logout button {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  width: 28px; height: 28px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}
.sidebar-user-logout button:hover { border-color: var(--accent); color: var(--accent); }

/* Collapsed (icon-only) sidebar — hide labels, keep icons */
body.shell[data-sidebar="closed"] .sidebar-brand-name,
body.shell[data-sidebar="closed"] .sidebar-section-label,
body.shell[data-sidebar="closed"] .sidebar-section-count,
body.shell[data-sidebar="closed"] .sidebar-ws-name,
body.shell[data-sidebar="closed"] .sidebar-link-label,
body.shell[data-sidebar="closed"] .sidebar-user-meta {
  display: none;
}
body.shell[data-sidebar="closed"] .sidebar-section-header {
  justify-content: center;
  padding: 4px;
  margin-bottom: 0;
  border-left: 0;
  border-bottom: 1px solid var(--border-subtle);
}
body.shell[data-sidebar="closed"] .sidebar-section-header.active {
  border-bottom-color: var(--accent);
}
body.shell[data-sidebar="closed"] .sidebar-user {
  justify-content: center;
}
body.shell[data-sidebar="closed"] .sidebar-user-logout { display: none; }
body.shell[data-sidebar="closed"] .sidebar-ws-item,
body.shell[data-sidebar="closed"] .sidebar-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

/* Scrim — only visible when sidebar is open over content on mobile */
.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  border: 0;
  padding: 0;
  cursor: pointer;
  z-index: 150;
}

/* Main area
   ---------- */
.main-area {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Workspace topbar (only inside /w/{id}/...) */
.ws-topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(10px);
}

.ws-topbar-burger {
  display: none;
  background: transparent;
  border: 1px solid var(--border-mid);
  width: 32px; height: 32px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  flex-shrink: 0;
}
.ws-topbar-burger:hover { border-color: var(--accent); color: var(--accent); }

.ws-topbar-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ws-topbar-eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-dim);
}
.ws-topbar-title {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-topbar-nav {
  display: flex;
  gap: 4px;
  align-items: center;
  flex: 1;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.ws-topbar-nav::-webkit-scrollbar { display: none; }
.ws-topbar-nav a {
  padding: 6px 12px;
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.ws-topbar-nav a:hover { color: var(--text-primary); }
.ws-topbar-nav a.active {
  color: var(--accent);
  border-color: var(--border-mid);
}

.ws-topbar-status {
  display: flex;
  gap: 16px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.ws-topbar-status-item { display: inline-flex; align-items: center; gap: 6px; }
.ws-topbar-clock { color: var(--text-primary); }

/* Bare topbar (no workspace context — just hamburger + status) */
.bare-topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

/* Responsive — collapse sidebar to drawer below 768px
   ---------- */
@media (max-width: 767px) {
  body.shell,
  body.shell[data-sidebar="closed"],
  body.shell[data-sidebar="open"] {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w-open);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    border-right: 1px solid var(--border-mid);
  }
  body.shell[data-sidebar="open"] .sidebar { transform: translateX(0); }
  body.shell[data-sidebar="open"] .sidebar-scrim { display: block; }

  /* On mobile we always show full labels when the drawer is open. */
  .sidebar-brand-name,
  .sidebar-section-label,
  .sidebar-section-count,
  .sidebar-ws-name,
  .sidebar-link-label,
  .sidebar-user-meta {
    display: initial !important;
  }
  .sidebar-section-header {
    justify-content: space-between !important;
    padding: 6px 12px !important;
    margin-bottom: 4px !important;
    border-bottom: 0 !important;
    border-left: 2px solid transparent !important;
  }
  .sidebar-section-header.active {
    border-left-color: var(--accent) !important;
  }
  .sidebar-user-meta { display: flex !important; }
  .sidebar-user-logout { display: initial !important; }
  .sidebar-ws-item,
  .sidebar-link {
    justify-content: flex-start !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* Mobile shows the hamburger inside the topbar itself */
  .ws-topbar-burger { display: inline-flex; }

  /* Ws-topbar: keep burger + id + status on one row; section nav wraps below */
  .ws-topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 16px;
    gap: 10px;
    row-gap: 6px;
  }
  .ws-topbar-id { flex: 1; min-width: 0; }
  .ws-topbar-status {
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
  }
  .ws-topbar-nav {
    order: 99;
    width: 100%;
    flex-basis: 100%;
    justify-content: flex-start;
    padding-bottom: 2px;
  }
  .ws-topbar-title { font-size: 14px; }

  /* Trim the status pieces a bit so they fit on narrow screens */
  .ws-topbar-status .ws-topbar-status-item,
  .bare-topbar .ws-topbar-status-item { font-size: 10px; letter-spacing: 0.06em; }
}

/* ----------------------------------------------------------------------
   Buttons / forms
   ---------------------------------------------------------------------- */

.btn {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  padding: 6px 14px;
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.12s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: #0b0b0d;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #0b0b0d;
}

.btn-icon {
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

input[type="text"], select, textarea {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  padding: 6px 10px;
  font-family: var(--font-sans);
  font-size: 12px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

/* ----------------------------------------------------------------------
   Layout
   ---------------------------------------------------------------------- */

main { padding: 20px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.page-header h1 {
  margin: 0 0 4px 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--accent);
}
.page-header .breadcrumb {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.page-header-actions { display: flex; gap: 8px; }

/* ----------------------------------------------------------------------
   Workspace list cards
   ---------------------------------------------------------------------- */

.ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.ws-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 18px 20px;
  transition: border-color 0.12s ease;
  cursor: pointer;
  position: relative;
}
.ws-card:hover { border-color: var(--border-strong); }
.ws-card h3 { margin: 0 0 6px 0; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); }
.ws-card .meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.ws-card .desc { color: var(--text-secondary); font-size: 12px; margin: 12px 0 0 0; }
.ws-card .stats { display: flex; gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-subtle); }
.ws-card .stat { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); }
.ws-card .stat strong { color: var(--text-primary); font-weight: 600; }

/* "new workspace" tile */
.ws-card-new {
  border: 1px dashed var(--border-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  color: var(--text-secondary);
}
.ws-card-new:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }

/* ----------------------------------------------------------------------
   Gridstack overrides — workspace canvas
   ---------------------------------------------------------------------- */

.grid-stack { background: transparent; }

.grid-stack > .grid-stack-item > .grid-stack-item-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  inset: 4px;
}

.grid-stack > .grid-stack-item.ui-draggable-dragging > .grid-stack-item-content,
.grid-stack > .grid-stack-item.ui-resizable-resizing > .grid-stack-item-content {
  border-color: var(--accent);
}

/* ----------------------------------------------------------------------
   Widget chrome
   ---------------------------------------------------------------------- */

.widget {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.widget-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}
.widget-title .name { color: var(--accent); }
.widget-title .lozenge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  color: var(--text-dim);
  padding: 1px 5px;
  border: 1px solid var(--border-mid);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.widget-actions { display: flex; gap: 4px; align-items: center; }
.widget-actions .btn { padding: 2px 6px; font-size: 10px; border-color: transparent; color: var(--text-dim); }
.widget-actions .btn:hover { color: var(--accent); border-color: var(--border-mid); }

.widget-body {
  flex: 1;
  padding: 12px;
  overflow: auto;
  min-height: 0;
}
.widget-body.flush { padding: 0; }

.widget-footer {
  padding: 6px 12px;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
}

/* status dots */
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}
.dot.healthy  { background: var(--status-healthy); box-shadow: 0 0 6px var(--status-healthy); }
.dot.degraded { background: var(--status-degraded); box-shadow: 0 0 6px var(--status-degraded); }
.dot.down     { background: var(--status-down); box-shadow: 0 0 6px var(--status-down); }
.dot.high     { background: var(--sev-high); }
.dot.medium   { background: var(--sev-medium); }
.dot.low      { background: var(--sev-low); }

/* severity badge */
.sev {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 1px 6px;
  border: 1px solid currentColor;
}
.sev.high   { color: var(--sev-high); }
.sev.medium { color: var(--sev-medium); }
.sev.low    { color: var(--sev-low); }

/* ----------------------------------------------------------------------
   Widget — alert feed
   ---------------------------------------------------------------------- */

.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.alert-list li:last-child { border-bottom: 0; }
.alert-row { display: flex; gap: 10px; align-items: flex-start; }
.alert-meta-col { min-width: 72px; flex-shrink: 0; }
.alert-meta-col .sev { display: block; text-align: center; margin-bottom: 4px; }
.alert-meta-col .time { font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); display: block; text-align: center; }
.alert-text { flex: 1; }
.alert-title { font-size: 12px; color: var(--text-primary); margin-bottom: 4px; }
.chip-ai {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0 4px;
  margin-right: 6px;
  vertical-align: 1px;
  color: #7BD18C;
  border: 1px solid #7BD18C;
  background: rgba(123, 209, 140, 0.10);
}
.chip-live {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0 4px;
  margin-right: 6px;
  vertical-align: 1px;
  color: #6ABE44;
  border: 1px solid #6ABE44;
}
.chip-watch {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0 4px;
  margin-right: 6px;
  vertical-align: 1px;
  color: var(--accent);
  border: 1px solid var(--accent);
  background: var(--accent-dim);
}
.chip-sm {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  margin: 0 4px 2px 0;
  border-radius: 2px;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  background: var(--bg-surface-2);
}
.chip-sm.chip-subject { border-color: var(--border-strong); color: var(--text-primary); }
.chip-sm.chip-negative { border-color: var(--sev-medium); color: var(--sev-medium); }
.watch-matched { margin-top: 4px; }
.alert-title .hl { color: var(--accent); background: var(--accent-dim); padding: 0 2px; }
.alert-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); }

/* ----------------------------------------------------------------------
   Widget — posture cards (counts)
   ---------------------------------------------------------------------- */

.posture { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; height: 100%; }
.posture-cell {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.posture-cell .label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.posture-cell .count {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  margin: 2px 0;
}
.posture-cell.high .count   { color: var(--sev-high); }
.posture-cell.medium .count { color: var(--sev-medium); }
.posture-cell.low .count    { color: var(--text-primary); }
.posture-cell .delta {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

/* ----------------------------------------------------------------------
   Widget — source health
   ---------------------------------------------------------------------- */

.source-list { list-style: none; margin: 0; padding: 0; }
.source-list li {
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}
.source-list li:last-child { border-bottom: 0; }
.source-list .label { color: var(--text-primary); }
.source-list .stat { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); }

/* ----------------------------------------------------------------------
   Widget — bar chart (top categories)
   ---------------------------------------------------------------------- */

.barchart { display: flex; flex-direction: column; gap: 8px; }
.barchart .row { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; }
.barchart .row .name { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.barchart .row .bar { background: var(--bg-surface-2); height: 8px; position: relative; }
.barchart .row .fill { background: var(--accent); height: 100%; }
.barchart .row .val { font-family: var(--font-mono); font-size: 10px; color: var(--text-primary); text-align: right; }

/* ----------------------------------------------------------------------
   Widget — severity trend (svg sparkline)
   ---------------------------------------------------------------------- */

.trend svg { width: 100%; height: 100%; display: block; }
.trend .axis { font-family: var(--font-mono); font-size: 9px; fill: var(--text-dim); }
.trend .line-high   { stroke: var(--sev-high);   fill: none; stroke-width: 1.5; }
.trend .line-medium { stroke: var(--sev-medium); fill: none; stroke-width: 1.5; }
.trend .line-low    { stroke: var(--sev-low);    fill: none; stroke-width: 1.5; }
.trend .legend { font-family: var(--font-mono); font-size: 10px; }
.trend .legend tspan { fill: var(--text-secondary); }

/* ----------------------------------------------------------------------
   Widget — map
   ---------------------------------------------------------------------- */

.map-container { width: 100%; height: 100%; min-height: 200px; background: #050505; }

/* MapLibre popup — match terminal theme */
.maplibregl-popup-content {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-mid) !important;
  border-radius: 0 !important;
  padding: 8px 12px !important;
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6) !important;
}
.maplibregl-popup-content strong {
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}
.maplibregl-popup-content small { color: var(--text-secondary); font-size: 10px; }
.maplibregl-popup-tip { border-top-color: var(--bg-surface) !important; border-bottom-color: var(--bg-surface) !important; }
.maplibregl-popup-close-button { color: var(--text-dim) !important; }
.maplibregl-ctrl-attrib {
  background: rgba(8,8,8,0.7) !important;
  color: var(--text-dim) !important;
  font-family: var(--font-mono) !important;
  font-size: 9px !important;
}
.maplibregl-ctrl-attrib a { color: var(--text-secondary) !important; }

/* ----------------------------------------------------------------------
   Widget — static / notes
   ---------------------------------------------------------------------- */

.static-content { font-size: 12px; line-height: 1.6; color: var(--text-secondary); }
.static-content h4 { color: var(--accent); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 8px 0; }
.static-content code { font-family: var(--font-mono); font-size: 11px; background: var(--bg-surface-2); padding: 1px 4px; color: var(--text-primary); }
.static-content a { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent-dim); }

/* ----------------------------------------------------------------------
   Add-widget modal
   ---------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  width: 640px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { margin: 0; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.modal-body { padding: 20px; overflow: auto; }

.widget-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.widget-picker .tile {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  padding: 14px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.widget-picker .tile:hover {
  border-color: var(--accent);
  background: var(--bg-surface-3);
}
.widget-picker .tile h4 { margin: 0 0 4px 0; font-size: 12px; font-weight: 600; }
.widget-picker .tile p { margin: 0; font-size: 11px; color: var(--text-secondary); }
.widget-picker .tile .icon {
  display: inline-block;
  width: 14px; height: 14px;
  background: var(--accent);
  margin-bottom: 8px;
  opacity: 0.7;
}

/* ----------------------------------------------------------------------
   Edit mode banner
   ---------------------------------------------------------------------- */

.edit-banner {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

/* ----------------------------------------------------------------------
   Refresh pulse
   ---------------------------------------------------------------------- */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.refresh-pulse { animation: pulse 2s ease-in-out infinite; }

/* misc */
.text-mono { font-family: var(--font-mono); }
.muted     { color: var(--text-secondary); }
.dim       { color: var(--text-dim); }
.right     { text-align: right; }

.btn-xs { padding: 3px 10px; font-size: 10px; }

/* ----------------------------------------------------------------------
   Workspace tabs (used on Sources, future shared)
   ---------------------------------------------------------------------- */

.ws-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
  overflow-x: auto;
}
.ws-tab {
  padding: 10px 16px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  text-decoration: none;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.ws-tab:hover { color: var(--text-primary); }
.ws-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ----------------------------------------------------------------------
   Sources page
   ---------------------------------------------------------------------- */

.sources-page {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}

.sources-summary { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 64px; }
.summary-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 14px 16px;
}
.summary-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}
.summary-value { color: var(--accent); font-size: 14px; font-weight: 600; }
.summary-meta { font-size: 10px; color: var(--text-secondary); margin-top: 4px; font-family: var(--font-mono); }

/* Workspace switcher on the Sources page summary block.
   Visually mirrors .summary-value (gold accent, bold) but is an interactive
   <select>. Caret is drawn via an inline SVG background; default OS chevron
   is suppressed via appearance: none. */
.summary-ws-switch {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
  color: var(--accent);
  font: 600 14px/1.3 var(--font-sans, inherit);
  border: 1px solid transparent;
  border-bottom: 1px dashed rgba(226, 197, 92, 0.35);
  padding: 2px 22px 4px 0;
  margin: 0;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path fill='%23E2C55C' d='M0 0l5 6 5-6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 2px center;
  background-size: 8px 5px;
}
.summary-ws-switch:hover,
.summary-ws-switch:focus {
  color: var(--accent-hover);
  border-bottom-color: var(--accent);
  outline: none;
}
.summary-ws-switch option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.legend-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.legend-row { font-size: 10px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }

.sources-list { display: flex; flex-direction: column; gap: 24px; }

.source-group h2 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin: 0 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}
.source-group h2 .count {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  background: var(--bg-surface-2);
  padding: 2px 6px;
}

.source-rows { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.source-rows > li { padding: 0; margin: 0; }

.source-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.12s ease;
}
.source-row:hover { border-color: var(--border-mid); }
.source-row.enabled { border-left: 2px solid var(--accent); }
.source-row.not_configured { opacity: 0.55; }

.src-indicator { display: flex; align-items: center; }
.src-meta { min-width: 0; }
.src-label {
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 2px;
}
.src-desc {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
  margin-bottom: 4px;
}
.src-stats {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.toggle {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 4px 14px;
  border: 1px solid var(--border-mid);
  background: transparent;
  cursor: pointer;
  transition: all 0.12s ease;
  min-width: 50px;
}
.toggle.on {
  background: var(--accent);
  color: #0b0b0d;
  border-color: var(--accent);
}
.toggle.on:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.toggle.off { color: var(--text-dim); }
.toggle.off:hover { color: var(--accent); border-color: var(--accent); }

/* ----------------------------------------------------------------------
   Reports page
   ---------------------------------------------------------------------- */

.reports-section { margin-bottom: 32px; }

.section-heading {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  margin: 0 0 14px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.report-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.12s ease;
}
.report-card:hover { border-color: var(--border-mid); }

.card-head { display: flex; gap: 14px; align-items: flex-start; }
.card-icon {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 6px 8px;
  border: 1px solid var(--accent);
  color: var(--accent);
  min-width: 38px;
  text-align: center;
}
.card-head h3 {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.audience { font-size: 10px; color: var(--text-secondary); }
.card-desc { font-size: 12px; color: var(--text-secondary); margin: 0; line-height: 1.5; flex: 1; }
.card-action { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-action select { flex: 1; min-width: 0; }

.reports-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.reports-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.reports-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.reports-table tr:hover td { background: var(--bg-surface); }

/* ----------------------------------------------------------------------
   Geospatial Intelligence page — full-bleed map + sidebar
   ---------------------------------------------------------------------- */

.geoint-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 40px); /* topbar + main padding */
  margin: -20px; /* break out of main padding for full bleed */
  padding: 0;
}

.geoint-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.geoint-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--accent);
}

.geoint-filters { display: flex; gap: 0; border: 1px solid var(--border-mid); }
.filter-btn {
  padding: 6px 14px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  border-right: 1px solid var(--border-mid);
  background: transparent;
  text-decoration: none;
}
.filter-btn:last-child { border-right: 0; }
.filter-btn.active { background: var(--accent); color: #0b0b0d; font-weight: 600; }
.filter-btn:not(.active):hover { color: var(--accent); }

.geoint-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  flex: 1;
  min-height: 0;
}

.geoint-map-wrap { position: relative; width: 100%; height: 100%; min-height: 400px; }
.geoint-map { width: 100%; height: 100%; min-height: 400px; background: #050505; }

.geoint-sidebar {
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.section-heading-sm {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

/* --- Geofence cards in sidebar --- */

.geo-cards { display: flex; flex-direction: column; gap: 8px; }

.geo-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.geo-card:hover { border-color: var(--accent); background: var(--bg-surface-3); }

.gc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.gc-loc { font-size: 9px; color: var(--text-dim); letter-spacing: 0.05em; }

.role-chip {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 1px 6px;
  border: 1px solid currentColor;
  color: var(--text-secondary);
}
.role-principal { color: var(--accent); }
.role-school    { color: #FF9944; }
.role-social    { color: var(--text-secondary); }
.role-office    { color: var(--text-secondary); }
.role-secondary { color: var(--text-secondary); }

.gc-name {
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.gc-posture { display: flex; gap: 4px; margin-bottom: 8px; font-family: var(--font-mono); }
.pc {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border: 1px solid currentColor;
  letter-spacing: 0.08em;
}
.pc.high    { color: var(--sev-high); }
.pc.medium  { color: var(--sev-medium); }
.pc.low     { color: var(--text-secondary); }
.pc.zero    { opacity: 0.25; }

.gc-headline {
  font-size: 11px;
  color: var(--text-primary);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 4px;
  line-height: 1.4;
}
.gc-cats { display: flex; flex-wrap: wrap; gap: 4px; font-size: 9px; }
.cat-tag {
  color: var(--text-dim);
  background: rgba(226, 197, 92, 0.06);
  padding: 1px 5px;
  border: 1px solid var(--border-subtle);
}
.gc-quiet { font-size: 10px; }

.gc-warning {
  margin-top: 8px;
  padding: 4px 8px;
  background: rgba(255, 153, 68, 0.10);
  border-left: 2px solid var(--sev-medium);
  font-size: 10px;
  color: var(--sev-medium);
  display: flex;
  align-items: center;
  gap: 6px;
}
.warn-icon {
  font-family: var(--font-mono);
  font-weight: 700;
  width: 12px; height: 12px;
  border: 1px solid currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}

/* --- Protest cards --- */

.protest-cards { display: flex; flex-direction: column; gap: 8px; }

.protest-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-left: 2px solid var(--sev-medium);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.protest-card:hover { border-color: var(--accent); border-left-color: var(--sev-medium); background: var(--bg-surface-3); }

.pc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.attendance {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 1px 6px;
  border: 1px solid currentColor;
}
.att-small  { color: var(--text-secondary); }
.att-medium { color: var(--sev-medium); }
.att-large  { color: var(--sev-high); }

.pc-when { font-size: 9px; color: var(--text-dim); letter-spacing: 0.04em; }

.pc-title {
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.3;
}
.pc-meta { font-size: 10px; color: var(--text-secondary); margin-bottom: 4px; line-height: 1.4; }

.src-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 8px;
  padding: 1px 5px;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  margin-right: 3px;
  margin-bottom: 2px;
  letter-spacing: 0.04em;
}
.src-chip.healthy   { border-color: var(--status-healthy); color: var(--status-healthy); }
.src-chip.degraded  { border-color: var(--status-degraded); color: var(--status-degraded); }
.src-chip.down      { border-color: var(--status-down); color: var(--status-down); }
.src-chip.not_configured { opacity: 0.5; }

.pc-warning {
  margin-top: 6px;
  padding: 4px 8px;
  background: rgba(255, 68, 68, 0.10);
  border-left: 2px solid var(--sev-high);
  font-size: 10px;
  color: var(--sev-high);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.4;
}
.pc-warning .warn-icon { color: var(--sev-high); }

.pc-notes {
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.4;
}

/* --- OSINT social feed overlay on the map ------------------------------ */

/* HTML5 [hidden] doesn't beat our display:flex rules below — force it. */
.osint-overlay[hidden],
.osint-detail[hidden],
.osint-reopen[hidden] { display: none !important; }

.osint-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  bottom: 12px;
  width: 340px;
  background: rgba(8, 8, 8, 0.92);
  border: 1px solid var(--border-mid);
  display: flex;
  flex-direction: column;
  z-index: 5;
  backdrop-filter: blur(2px);
  font-family: var(--font-mono);
}

.osint-tabs {
  display: flex;
  align-items: stretch;
  height: 34px;
  border-bottom: 1px solid var(--border-mid);
  flex-shrink: 0;
}
.osint-tab {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.osint-tab:hover { color: var(--text-primary); }
.osint-tab.active {
  color: var(--text-primary);
  border-bottom-color: #C8533D; /* muted red to match reference */
}
.osint-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
}
.osint-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}
.osint-collapse,
.osint-reopen {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  font-size: 12px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.osint-collapse:hover,
.osint-reopen:hover { color: var(--accent); border-color: var(--accent); }

.osint-reopen {
  position: absolute;
  top: 16px;
  left: 12px;
  z-index: 5;
  width: 24px;
  height: 24px;
  background: rgba(8, 8, 8, 0.92);
}

.osint-feed {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.feed-card {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.1s ease;
}
.feed-card:hover { background: rgba(226, 197, 92, 0.04); }
.feed-card:last-child { border-bottom: 0; }

.feed-empty {
  padding: 24px 12px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

/* WATCH tab — gold accent so it reads as the "high-priority filter",
   distinct from source-based tabs. Active state uses the gold underline
   instead of the muted red the source tabs use. */
.osint-tab-watch {
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.osint-tab-watch.dim { color: var(--text-dim); }
.osint-tab-watch.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.osint-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 14px;
  padding: 0 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--bg-surface);
  background: var(--accent);
  border-radius: 7px;
}

/* Feed card highlight when item is a personal watchlist hit. Gold
   left-edge accent + a faint warm background, in line with the rest of
   the terminal aesthetic. */
.feed-card-watch {
  border-left: 2px solid var(--accent);
  background: rgba(226, 197, 92, 0.04);
}
.feed-card-watch:hover { background: rgba(226, 197, 92, 0.08); }

/* Detail-panel "Why this matched" section — slightly inset accent block
   so the matched terms read as the reason this item is being surfaced. */
.od-watch {
  border-left: 2px solid var(--accent);
  padding-left: 10px;
  background: rgba(226, 197, 92, 0.03);
}
.od-watch h4 { color: var(--accent); }

/* --- Settings: per-source caps table ----------------------------------- */
.caps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.caps-table th {
  text-align: left;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.caps-table th.num,
.caps-table td.num {
  text-align: right;
  width: 90px;
}
.caps-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.caps-table tr:last-child td { border-bottom: 0; }
.cap-input {
  width: 70px;
  background: var(--bg-base);
  border: 1px solid var(--border-mid);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 8px;
  text-align: right;
}
.cap-input:focus {
  outline: 0;
  border-color: var(--accent);
}

.fc-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.fc-age {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.cat-chip {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid currentColor;
  background: transparent;
}
.cat-conflict     { color: #E07060; }
.cat-protest      { color: #E0A050; }
.cat-cyber        { color: #6BCFCF; }
.cat-political    { color: #A98AD8; }
.cat-health       { color: #6FCF8F; }
.cat-humanitarian { color: #6B9DD8; }

.sev-chip {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  color: #0b0b0d;
  background: var(--text-dim);
}
.sev-s1 { background: #E04E8B; } /* notable, pink/magenta */
.sev-s2 { background: #6FCF8F; } /* routine watching, green */
.sev-s3 { background: #E0A050; } /* elevated, amber */
.sev-s4 { background: #E0473A; } /* critical, red */

.feed-headline {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 4px;
}
.feed-location {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.feed-location .pin {
  color: var(--text-secondary);
  margin-right: 4px;
  font-size: 9px;
}

/* --- OSINT detail panel (slides in over feed) ------------------------- */

.osint-detail {
  position: absolute;
  top: 12px;
  left: 12px;
  bottom: 12px;
  width: 360px;
  background: rgba(8, 8, 8, 0.96);
  border: 1px solid var(--border-mid);
  border-top: 2px solid var(--accent);
  display: flex;
  flex-direction: column;
  z-index: 10;
  backdrop-filter: blur(2px);
}

.od-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-mid);
  flex-shrink: 0;
}
.od-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--text-primary);
  font-weight: 700;
}
.od-close {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  font-size: 14px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.od-close:hover { color: var(--accent); border-color: var(--accent); }

.od-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  font-family: var(--font-mono);
}

.od-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.od-chips a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  margin-left: 2px;
}
.od-chips a:hover { color: var(--accent); }

.od-headline {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 12px 0;
}

.od-image-wrap {
  display: block;
  margin: 12px 0;
  border: 1px solid var(--border-mid);
  background: var(--bg-surface-2);
}
.od-image-wrap:hover { border-color: var(--accent); }
.od-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: cover;
}

.od-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 2px 8px;
  border: 1px solid var(--border-mid);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  text-decoration: none;
  text-transform: uppercase;
}
.od-source-pill:hover { color: var(--accent); border-color: var(--accent); }

.od-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.od-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.od-section h4 {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
  margin: 0 0 10px 0;
}

.od-summary {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
}

.od-forecast-q {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.45;
}

.fc-outcome { margin-bottom: 10px; }
.fc-outcome-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 4px;
  gap: 8px;
}
.fc-outcome-label { flex: 1; }
.fc-outcome-pct {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  flex-shrink: 0;
}
.fc-bar {
  height: 3px;
  background: var(--bg-surface-3);
}
.fc-bar-fill {
  height: 100%;
  background: var(--accent);
}
.fc-outcome.dim .fc-outcome-pct,
.fc-outcome.dim .fc-outcome-label { color: var(--text-secondary); }
.fc-outcome.dim .fc-bar-fill { background: var(--text-dim); }

.fc-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 12px;
  letter-spacing: 0.04em;
}
.fc-why { cursor: pointer; }
.fc-why:hover { color: var(--accent); }

.signal {
  background: var(--bg-surface-2);
  border-left: 2px solid var(--accent);
  padding: 8px 10px;
  margin-bottom: 8px;
}
.signal:last-child { margin-bottom: 0; }
.signal-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}
.signal-handle { color: var(--accent); font-weight: 700; }
.signal-time { color: var(--text-dim); }
.signal-body {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
}
.signal-link {
  display: inline-block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-decoration: none;
}
.signal-link:hover { color: var(--accent); }

/* ----------------------------------------------------------------------
   Settings / Debug page
   ---------------------------------------------------------------------- */

.settings-section { margin-bottom: 32px; }

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}
.kv {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 10px 14px;
}
.kv .k {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}
.kv .v { font-size: 13px; color: var(--text-primary); }

.reality-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 2px 8px;
  border: 1px solid currentColor;
  margin-right: 6px;
}
.reality-chip.live          { color: #6ABE44; }
.reality-chip.mock          { color: var(--accent); }
.reality-chip.unconfigured  { color: var(--text-dim); }

.src-debug-list { display: flex; flex-direction: column; gap: 12px; }
.src-debug {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 2px solid #6ABE44;
  padding: 12px 16px;
}
.sd-head {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.sd-id { display: flex; flex-direction: column; gap: 2px; }
.sd-label { color: var(--accent); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
.sd-stats { font-size: 10px; color: var(--text-secondary); }

.src-debug details summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 0;
  border-top: 1px solid var(--border-subtle);
  outline: none;
}
.src-debug details summary:hover { color: var(--accent); }
.src-debug details[open] summary { color: var(--accent); }

.feed-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: 8px;
}
.feed-table th {
  text-align: left;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.feed-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.feed-table tr:last-child td { border-bottom: 0; }
.feed-row.feed-fail { color: var(--sev-high); }
.feed-row.feed-fail .dim { color: var(--sev-high); opacity: 0.8; }

/* ----------------------------------------------------------------------
   Settings — non-admin placeholder
   ---------------------------------------------------------------------- */

.settings-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 20px;
}

.settings-card-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.settings-dl {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 16px;
  row-gap: 8px;
}
.settings-dl dt {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  align-self: center;
}
.settings-dl dd {
  margin: 0;
  font-size: 12px;
  color: var(--text-primary);
}

.settings-todo {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
.settings-todo li {
  padding: 6px 0;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-secondary);
  position: relative;
  padding-left: 16px;
}
.settings-todo li:first-child { border-top: 0; }
.settings-todo li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ----------------------------------------------------------------------
   Watchlist editor (settings_user.html)
   ---------------------------------------------------------------------- */

.settings-card-wide { grid-column: 1 / -1; }

.settings-flash {
  margin: 0 0 16px;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.watchlist-form { display: grid; gap: 16px; margin-top: 8px; }
.watchlist-axis { display: grid; gap: 6px; }
.watchlist-axis label { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.watchlist-axis-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
}
.watchlist-axis-hint { font-size: 11px; color: var(--text-dim); }
.watchlist-axis-foot { font-size: 10px; }
.watchlist-axis textarea {
  width: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}
.watchlist-axis textarea:focus { outline: none; border-color: var(--accent); }
.watchlist-actions { display: flex; justify-content: flex-end; }

.chip-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 4px; }
.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 2px;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  background: var(--bg-surface-2);
}
.chip.chip-subject { border-color: var(--border-strong); color: var(--accent); }
.chip.chip-negative { border-color: var(--sev-medium); color: var(--sev-medium); }

/* ----------------------------------------------------------------------
   Triage — inline status chip, action bar, dismissed toggle, drawer
   ---------------------------------------------------------------------- */

.chip-status {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0 5px;
  margin-right: 6px;
  vertical-align: 1px;
  border-radius: 1px;
}
.chip-status-active    { color: #FFAA44; border: 1px solid #FFAA44; background: rgba(255, 170, 68, 0.10); }
.chip-status-relevant  { color: #6ABE44; border: 1px solid #6ABE44; background: rgba(106, 190, 68, 0.10); }
.chip-status-dismissed { color: var(--text-dim); border: 1px solid var(--border-mid); background: var(--bg-surface-2); }

li.triage-active   .alert-row { box-shadow: inset 2px 0 0 #FFAA44; }
li.triage-relevant .alert-row { box-shadow: inset 2px 0 0 #6ABE44; }
li.triage-dismissed { opacity: 0.55; }

.triage-note {
  margin-top: 6px;
  padding: 6px 8px;
  border-left: 2px solid var(--border-strong);
  background: var(--bg-surface-2);
  font-size: 11px;
  color: var(--text-secondary);
  font-style: italic;
}

/* Provenance subtitle — shown when the LLM summary has replaced the raw
   RSS title in the main slot. Quietly dimmed so it doesn't compete. */
.alert-subtitle {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qa-bar {
  display: flex;
  gap: 2px;
  align-items: flex-start;
  padding-left: 6px;
}
.qa-btn {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  width: 26px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 80ms, color 80ms, border-color 80ms;
}
.qa-btn:hover { color: var(--accent); border-color: var(--border-strong); }
.qa-btn:focus { outline: 1px solid var(--accent); outline-offset: -1px; }
.qa-btn.qa-active.is-current   { background: rgba(255, 170, 68, 0.15); border-color: #FFAA44; color: #FFAA44; }
.qa-btn.qa-relevant.is-current { background: rgba(106, 190, 68, 0.15); border-color: #6ABE44; color: #6ABE44; }
.qa-dismiss-summary.is-current { background: var(--bg-surface-3); border-color: var(--border-strong); color: var(--text-secondary); }

.qa-dismiss { position: relative; list-style: none; }
.qa-dismiss > summary { list-style: none; }
.qa-dismiss > summary::-webkit-details-marker { display: none; }
.qa-reasons {
  position: absolute;
  right: 0;
  top: 26px;
  z-index: 5;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 200px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.6);
}
.qa-reasons-label {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 2px;
  text-transform: uppercase;
}
.qa-reason {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  cursor: pointer;
}
.qa-reason:hover { color: var(--accent); border-color: var(--border-strong); }
.qa-reason-other { border-color: var(--border-strong); color: var(--accent); }

.alert-list-toggle { padding: 4px 10px; border-bottom: 1px solid var(--border-subtle); }
.dismissed-toggle {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 2px 0;
}
.dismissed-toggle:hover { color: var(--accent); }
.alert-list-wrap:not(.show-dismissed) li.triage-dismissed { display: none; }

.triage-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  pointer-events: none;
  z-index: 50;
}
body[data-drawer="open"] .triage-drawer { pointer-events: auto; }
.triage-drawer-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  opacity: 0;
  transition: opacity 180ms ease;
  border: 0;
  cursor: pointer;
}
body[data-drawer="open"] .triage-drawer-scrim { opacity: 1; }
.triage-drawer-panel {
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 480px;
  max-width: 95vw;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-strong);
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
}
body[data-drawer="open"] .triage-drawer-panel { transform: translateX(0); }
.triage-drawer-body { padding: 16px 20px; overflow-y: auto; flex: 1; }

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.drawer-eyebrow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}
.drawer-cat, .drawer-source { color: var(--text-secondary); }
.drawer-close-btn {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.drawer-close-btn:hover { color: var(--accent); }
.drawer-title { font-size: 16px; color: var(--accent); margin: 0 0 8px; line-height: 1.35; }
.drawer-summary { font-size: 12px; color: var(--text-secondary); margin: 0 0 12px; line-height: 1.55; }
.drawer-link a { color: var(--accent); font-size: 11px; font-family: var(--font-mono); }

.drawer-form { display: grid; gap: 14px; margin-top: 16px; }
.drawer-fieldset {
  border: 1px solid var(--border-subtle);
  padding: 8px 10px 10px;
  margin: 0;
}
.drawer-fieldset legend {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 0 6px;
  text-transform: uppercase;
}
.status-picker, .reason-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.status-radio, .reason-radio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--border-mid);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.status-radio input, .reason-radio input { display: none; }
.status-radio.is-selected,
.status-radio:has(input:checked),
.reason-radio:has(input:checked) {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}
.drawer-fieldset textarea {
  width: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
}
.drawer-fieldset textarea:focus { outline: none; border-color: var(--accent); }
.drawer-actions { display: flex; justify-content: flex-end; gap: 8px; }

.drawer-log { margin-top: 24px; border-top: 1px solid var(--border-subtle); padding-top: 12px; }
.drawer-log h3 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin: 0 0 8px;
}
.drawer-log ol { list-style: none; padding: 0; margin: 0; }
.drawer-log li {
  padding: 6px 0;
  border-bottom: 1px dotted var(--border-subtle);
  font-size: 11px;
  display: grid;
  grid-template-columns: 56px 1fr;
  column-gap: 10px;
  row-gap: 2px;
}
.drawer-log-time { color: var(--text-dim); grid-row: 1; }
.drawer-log-actor { color: var(--text-secondary); grid-row: 1; }
.drawer-log-action { grid-column: 2; color: var(--text-secondary); }
.drawer-log-note { grid-column: 2; color: var(--text-dim); font-style: italic; }

/* ----------------------------------------------------------------------
   Onboarding wizard
   Full-screen, no-chrome shell with brand + progress strip at top, content
   centred, skip exit at corner. Uses the standard app palette but with a
   wider gutter and slightly larger type so the experience feels distinct
   from the app proper.
   ---------------------------------------------------------------------- */

body.ob-body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ob-topstrip {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.ob-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
}
.ob-brand-mark {
  display: inline-block;
  width: 18px; height: 18px;
  background: var(--accent);
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}
.ob-brand-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--accent);
}
.ob-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}
.ob-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-mid);
  transition: background 200ms;
}
.ob-dot.active { background: var(--accent); }
.ob-dot.done   { background: var(--border-strong); }
.ob-progress-text {
  margin-left: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}
.ob-skip-form { margin: 0; }
.ob-skip-btn {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 2px 8px;
}
.ob-skip-btn:hover { color: var(--accent); }

.ob-main {
  flex: 1;
  padding: 48px 24px 60px;
  display: flex;
  justify-content: center;
}
.ob-step {
  width: 100%;
  max-width: 760px;
}
.ob-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.ob-title {
  font-family: "Cormorant Garamond", "Garamond", serif;
  font-size: 36px;
  color: var(--accent);
  margin: 0 0 12px;
  font-weight: 500;
  line-height: 1.15;
}
.ob-lede {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 28px;
  line-height: 1.65;
  max-width: 620px;
}
.ob-muted { color: var(--text-dim); font-size: 12px; }
.ob-footnote { margin-top: 32px; }
.ob-warn { color: var(--sev-medium); font-size: 11px; }
.ob-callout {
  padding: 10px 14px;
  border-left: 2px solid var(--border-strong);
  background: var(--bg-surface-2);
  margin: 12px 0 0;
}

.ob-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 28px;
  align-items: center;
}
/* "Back" lives in the same row as Skip/Continue but anchors to the left
   so the forward affordances stay grouped on the right. */
.ob-actions .ob-back { margin-right: auto; }
.ob-actions-stacked {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.ob-back-row { margin-top: 16px; }
.ob-back-link {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-decoration: none;
}
.ob-back-link:hover { color: var(--accent); }
.ob-btn-big {
  padding: 10px 22px;
  font-size: 14px;
}

/* Welcome — three-card preview */
.ob-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 28px 0;
}
.ob-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 16px 18px;
}
.ob-card-glyph {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 8px;
}
.ob-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}
.ob-card p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Step 2 — principals row grid */
.ob-row-grid {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}
.ob-row-header, .ob-row {
  display: grid;
  grid-template-columns: 1fr 2.4fr 110px 28px;
  gap: 8px;
  align-items: center;
}
.ob-row-header {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
  padding: 0 4px 4px;
  border-bottom: 1px solid var(--border-subtle);
}
.ob-row input {
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  padding: 8px 10px;
  font-family: var(--font-sans);
  font-size: 13px;
}
.ob-row input:focus { outline: none; border-color: var(--accent); }
.ob-row-remove {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ob-row-remove:hover { border-color: var(--sev-medium); color: var(--sev-medium); }
.ob-add-row {
  background: transparent;
  border: 1px dashed var(--border-mid);
  color: var(--text-secondary);
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  margin: 4px 0 18px;
  display: inline-block;
}
.ob-add-row:hover { color: var(--accent); border-color: var(--border-strong); }

/* Step 3 — two-axis keyword grid */
.ob-twocol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 12px;
}
.ob-axis { display: flex; flex-direction: column; }
.ob-axis-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.ob-axis-hint {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0 0 8px;
}
.ob-axis textarea {
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}
.ob-axis textarea:focus { outline: none; border-color: var(--accent); }
.ob-axis-foot { font-size: 10px; margin-top: 6px; }

/* Step 4 — workspace organisation choices */
.ob-choice-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 16px 0;
}
.ob-choice {
  border: 1px solid var(--border-mid);
  background: var(--bg-surface);
  padding: 16px 18px;
  cursor: pointer;
  display: block;
  transition: border-color 150ms, background 150ms;
}
.ob-choice:hover { border-color: var(--border-strong); }
.ob-choice.is-selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.ob-choice input[type=radio] { margin-right: 10px; vertical-align: middle; }
.ob-choice-head { display: flex; align-items: center; gap: 12px; }
.ob-choice-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.ob-choice-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 1px 6px;
  background: var(--accent-dim);
}
.ob-choice-body {
  margin: 8px 0 0;
  padding-left: 28px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}
.ob-choice-inputs {
  margin-top: 12px;
  padding-left: 28px;
}
.ob-inline-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.ob-choice-inputs input[type=text] {
  width: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  padding: 6px 8px;
  font-family: var(--font-sans);
  font-size: 13px;
}
.ob-perloc-list { display: flex; flex-direction: column; gap: 8px; }
.ob-perloc-row { display: flex; flex-direction: column; gap: 2px; }
.ob-perloc-meta { font-size: 10px; padding-left: 2px; }
.ob-pin {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  padding: 0 6px;
  margin-left: 4px;
  color: var(--status-healthy);
  border: 1px solid var(--status-healthy);
}
.ob-pin-fail {
  color: var(--sev-medium);
  border-color: var(--sev-medium);
}

/* Step 5 — done summary list */
.ob-summary {
  list-style: none;
  padding: 0;
  margin: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ob-summary li {
  padding: 10px 14px;
  background: var(--bg-surface);
  border-left: 2px solid var(--accent);
  font-size: 13px;
  color: var(--text-primary);
}
.ob-ckm {
  display: inline-block;
  color: var(--status-healthy);
  margin-right: 8px;
  font-weight: 700;
}

/* ----------------------------------------------------------------------
   Action-driven product tour — corner panel + element glow
   ---------------------------------------------------------------------- */

.tour-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  box-shadow: 0 10px 30px rgba(0,0,0,0.55);
  font-family: var(--font-sans);
  color: var(--text-primary);
}
.tour-collapsed {
  width: 180px;
  border-color: var(--border-strong);
}

.tour-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--accent-dim);
  border-bottom: 1px solid var(--border-strong);
}
.tour-mark {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
  padding: 1px 6px;
  border: 1px solid var(--accent);
}
.tour-step-label {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tour-head-right { display: flex; gap: 2px; }
.tour-mini {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  width: 22px; height: 22px;
  cursor: pointer;
  line-height: 1;
}
.tour-mini:hover { color: var(--accent); }

.tour-body { padding: 14px 16px; }
.tour-title {
  font-family: "Cormorant Garamond", "Garamond", serif;
  font-size: 18px;
  color: var(--accent);
  margin-bottom: 8px;
}
.tour-step-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.tour-step-body b { color: var(--text-primary); }
.tour-step-body code {
  font-family: var(--font-mono);
  background: var(--bg-surface-2);
  padding: 1px 4px;
}

.tour-actions {
  padding: 10px 16px 14px;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.tour-actions .btn {
  padding: 6px 12px;
  font-size: 12px;
}

/* Target highlight — soft outer glow with a steady pulse so the eye
   catches it without it screaming for attention. */
.tour-glow {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--accent) !important;
  outline-offset: 4px;
  animation: tour-pulse 1.6s ease-in-out infinite;
  border-radius: 2px;
}
@keyframes tour-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(226, 197, 92, 0.55); }
  50%      { box-shadow: 0 0 0 8px rgba(226, 197, 92, 0); }
}

/* Navigation nudge — shown in lieu of an auto-navigation button when
   the next step lives on a different page. Quieter than the title +
   body block above it, sits just above the Skip-step row. */
.tour-nav-hint {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dotted var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}
