/* ----------------------------------------------------------------------
   DERECK — theme tokens
   Dark is the default (defined on :root). Light mode redefines the same
   tokens under :root[data-theme="light"]. Rules elsewhere in this file
   should reference var(--token), never raw hex/rgba — that's what makes
   the toggle work without per-rule overrides.
   ---------------------------------------------------------------------- */

:root {
  /* surfaces — pure black, near-black layers for depth */
  --bg-base:      #080808;
  --bg-surface:   #0d0d0d;
  --bg-surface-2: #141414;
  --bg-surface-3: #1a1a1a;
  --bg-deep:      #050505;  /* below-base wells (map containers, voids) */

  /* 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-dim and --text-secondary were both too low-contrast at their
     original alphas (0.32 / 0.58) — reviewers reported eye strain after
     an hour, and the source text on the alerts list (which uses
     --text-dim) was the worst offender. Lifted to 0.55 / 0.78 to
     restore legibility while keeping the hierarchy intact. */
  --text-primary:   #d8d2c4;
  --text-secondary: rgba(216, 210, 196, 0.78);
  --text-dim:       rgba(216, 210, 196, 0.55);
  --text-disabled:  rgba(216, 210, 196, 0.16);
  --text-strong:    #ffffff;     /* card titles that pop above primary */
  --text-on-accent: #0b0b0d;     /* text/icons on a gold accent backdrop */

  /* accent — the gold itself */
  --accent:        #E2C55C;
  --accent-hover:  #F5D870;
  --accent-dim:    rgba(226, 197, 92, 0.12);
  --accent-faint:  rgba(226, 197, 92, 0.03);   /* grid pattern, idle hover */
  --accent-soft:   rgba(226, 197, 92, 0.06);   /* card hover, on-route row */
  --accent-mid:    rgba(226, 197, 92, 0.10);   /* feed-card-watch hover */
  --accent-glow:   rgba(226, 197, 92, 0.35);   /* pulse highlight */
  --accent-dashed: rgba(226, 197, 92, 0.35);   /* underline links */

  /* severity — distinct from gold so they pop on alerts */
  --sev-high:        #FF4444;
  --sev-high-soft:   #FF6666;
  --sev-high-bg:     rgba(255, 68, 68, 0.08);
  --sev-high-bg-2:   rgba(255, 68, 68, 0.10);
  --sev-high-border: rgba(255, 68, 68, 0.35);
  --sev-medium:      #FF9944;
  --sev-medium-bg:   rgba(255, 153, 68, 0.10);
  --sev-low:         rgba(226, 197, 92, 0.40);

  /* Route line (route map): green where the way is clear, amber near a
     medium-severity threat, red near a high one; the map mixes between
     them (route_map.js). Casing is the dark edge that lets the line read
     on any basemap; quiet is the neutral for the corridor and cameras. */
  --route-clear:   #3fcf8e;
  --route-caution: #f5a623;
  --route-danger:  #ff4d4d;
  --route-casing:  #050d10;
  --route-quiet:   #d4e4e9;

  /* status */
  --status-healthy:       #6ABE44;
  --status-healthy-soft:  #7BD18C;
  --status-healthy-bg:    rgba(106, 190, 68, 0.10);
  --status-healthy-bg-2:  rgba(106, 190, 68, 0.15);
  --status-degraded:      #FFAA44;
  --status-degraded-bg:   rgba(255, 170, 68, 0.10);
  --status-degraded-bg-2: rgba(255, 170, 68, 0.15);
  --status-down:          #FF4444;

  /* categorical — distinct hues for category swatches; stable across
     themes so muscle memory holds. Light mode darkens them. */
  --cat-conflict:     #E07060;
  --cat-protest:      #E0A050;
  --cat-cyber:        #6BCFCF;
  --cat-political:    #A98AD8;
  --cat-health:       #6FCF8F;
  --cat-humanitarian: #6B9DD8;

  /* sev-Sn pills (notable / routine / elevated / critical) */

  /* band pills (low/medium/high/critical) — used on admin/scoring. Tinted
     blocks that lean on the existing severity hues so the colour reads
     the same as the rest of the alert UI. */
  --band-low-bg:      #1a2a1a;
  --band-low-fg:      #7fb37f;
  --band-low-bd:      #2b4a2b;
  --band-medium-bg:   #2a2a1a;
  --band-medium-fg:   #c9b97a;
  --band-medium-bd:   #4a4a2b;
  --band-high-bg:     #2a1f1a;
  --band-high-fg:     #d39a6f;
  --band-high-bd:     #4a3b2b;
  --band-critical-bg: #2a1a1a;
  --band-critical-fg: #d97373;
  --band-critical-bd: #4a2b2b;

  /* scrims & shadows — pure-black overlays in dark mode; light mode
     swaps to slate so they don't punch holes through a paper bg. */
  --scrim:        rgba(0, 0, 0, 0.60);
  --scrim-soft:   rgba(0, 0, 0, 0.55);
  --scrim-strong: rgba(0, 0, 0, 0.85);
  --shadow-sm:    0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-md:    0 6px 18px rgba(0, 0, 0, 0.5);
  --shadow-lg:    0 12px 48px rgba(0, 0, 0, 0.6);
  --shadow-card:  0 10px 30px rgba(0, 0, 0, 0.55);

  /* near-opaque variants of --bg-base for panels floating on top of
     a map or feed (theme picker, popup, attribution strip). Light
     mode redefines with the paper base color. */
  --overlay-bg:        rgba(8, 8, 8, 0.82);
  --overlay-bg-soft:   rgba(8, 8, 8, 0.70);
  --overlay-bg-strong: rgba(8, 8, 8, 0.94);

  /* type — Inter for reading; JetBrains Mono only where the eye scans or
     aligns data (times, counts, coordinates, handles, plates, code). */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", "Menlo", "Consolas", monospace;
  --font-serif: "Garamond", "Playfair Display", "Georgia", serif;
  /* Page titles: the brand's face (see _brand_lockup.html), so a title reads
     as part of the same family as the wordmark. Everything else is Inter. */
  --font-display: "Rethink Sans", "Inter", system-ui, sans-serif;

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

  /* shape — chips and inputs / cards, buttons and panels / sheets and modals */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  color-scheme: dark;
}

/* ----------------------------------------------------------------------
   Light theme — cool techy neutrals (think Linear / Vercel light), with
   the bronze accent kept warm so it pops against the cool surface tones
   rather than blending in. Severity hues are darkened for AA contrast.
   ---------------------------------------------------------------------- */
:root[data-theme="light"] {
  --bg-base:      #f6f7f9;    /* cool off-white */
  --bg-surface:   #ffffff;    /* card pops against base */
  --bg-surface-2: #eef0f3;    /* hover */
  --bg-surface-3: #e1e4ea;    /* pressed */
  --bg-deep:      #e8eaee;    /* below-base wells */

  --border-subtle: #e2e5ea;
  --border-mid:    #c2c7d0;
  --border-strong: #8b93a1;

  --text-primary:    #0c0d10;
  --text-secondary:  rgba(12, 13, 16, 0.72);
  --text-dim:        rgba(12, 13, 16, 0.55);
  --text-disabled:   rgba(12, 13, 16, 0.28);
  --text-strong:     #000000;
  --text-on-accent:  #ffffff;    /* white on bronze — high contrast */
  --route-clear:   #12995a;
  --route-caution: #d98200;
  --route-danger:  #d92f2f;
  --route-casing:  #ffffff;
  --route-quiet:   #3a3f47;

  --accent:        #8A6A1F;    /* bronze — same warm anchor across themes */
  --accent-hover:  #6E5418;
  --accent-dim:    rgba(138, 106, 31, 0.14);
  --accent-faint:  rgba(138, 106, 31, 0.05);
  --accent-soft:   rgba(138, 106, 31, 0.08);
  --accent-mid:    rgba(138, 106, 31, 0.14);
  --accent-glow:   rgba(138, 106, 31, 0.30);
  --accent-dashed: rgba(138, 106, 31, 0.45);

  --sev-high:        #C81E1E;
  --sev-high-soft:   #B83030;
  --sev-high-bg:     rgba(200, 30, 30, 0.07);
  --sev-high-bg-2:   rgba(200, 30, 30, 0.11);
  --sev-high-border: rgba(200, 30, 30, 0.35);
  --sev-medium:      #B65C0E;
  --sev-medium-bg:   rgba(182, 92, 14, 0.10);
  --sev-low:         rgba(110, 120, 135, 0.55);

  --status-healthy:       #2F7A20;
  --status-healthy-soft:  #3F8B2E;
  --status-healthy-bg:    rgba(47, 122, 32, 0.10);
  --status-healthy-bg-2:  rgba(47, 122, 32, 0.15);
  --status-degraded:      #B65C0E;
  --status-degraded-bg:   rgba(182, 92, 14, 0.10);
  --status-degraded-bg-2: rgba(182, 92, 14, 0.15);
  --status-down:          #C81E1E;

  --cat-conflict:     #B14A38;
  --cat-protest:      #8C6A2E;
  --cat-cyber:        #2E8A8A;
  --cat-political:    #6B4FA0;
  --cat-health:       #2F7A48;
  --cat-humanitarian: #355F9E;

  --band-low-bg:      #e6f1e6;
  --band-low-fg:      #2f6a2f;
  --band-low-bd:      #c4dec4;
  --band-medium-bg:   #f3edcf;
  --band-medium-fg:   #6f5a17;
  --band-medium-bd:   #dccf90;
  --band-high-bg:     #f4e3d2;
  --band-high-fg:     #8a4a16;
  --band-high-bd:     #e0c19a;
  --band-critical-bg: #f4d6d6;
  --band-critical-fg: #971b1b;
  --band-critical-bd: #e2a8a8;

  --scrim:        rgba(12, 18, 28, 0.32);
  --scrim-soft:   rgba(12, 18, 28, 0.22);
  --scrim-strong: rgba(12, 18, 28, 0.55);
  --shadow-sm:    0 1px 2px rgba(12, 18, 28, 0.05), 0 4px 12px rgba(12, 18, 28, 0.06);
  --shadow-md:    0 2px 4px rgba(12, 18, 28, 0.06), 0 8px 24px rgba(12, 18, 28, 0.08);
  --shadow-lg:    0 4px 8px rgba(12, 18, 28, 0.06), 0 16px 40px rgba(12, 18, 28, 0.10);
  --shadow-card:  0 2px 4px rgba(12, 18, 28, 0.06), 0 12px 28px rgba(12, 18, 28, 0.08);

  --overlay-bg:        rgba(246, 247, 249, 0.94);
  --overlay-bg-soft:   rgba(246, 247, 249, 0.86);
  --overlay-bg-strong: rgba(246, 247, 249, 0.98);

  color-scheme: light;
}

* { 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: var(--radius-sm);
}
::-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: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Form controls do not inherit type by default. */
button, input, select, textarea { font: inherit; }

/* The HTML5 hidden attribute always wins, whatever display a class sets. */
[hidden] { display: none !important; }

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

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

/* The DERECK mark lives in _brand_mark.html (an inline SVG in
   currentColor); these boxes size and colour it. */
.brand-mark,
.ob-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.brand-mark { width: 18px; height: 18px; }
.brand-mark-svg { display: block; width: 100%; height: 100%; }

.topbar-user-tag {
  display: inline-block;
  padding: 1px 5px;
  font-size: 11px;
  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; }

/* During the pre-first-paint state restore, suppress every transition so
   the sidebar (and anything else with a transition) doesn't animate from
   its HTML-default value to the restored value. Removed via rAF in the
   top-of-body init script. */
body.shell.sidebar-init,
body.shell.sidebar-init *,
body.shell.sidebar-init *::before,
body.shell.sidebar-init *::after {
  transition: none !important;
}

/* 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%;
}

/* The Obsidian Arc / DERECK lockup, as on the sign-in page, in the
   theme's strongest text colour (near-white on dark, black on light)
   rather than gold: gold is for what is selected or the main action. */
.sidebar-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  text-decoration: none;
  color: var(--text-strong);
}
.sidebar-brand:hover { color: var(--text-strong); }
.sidebar-brand .brand-lockup { display: block; width: 156px; height: auto; overflow: visible; }

.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-radius: var(--radius-md);
}
/* On the Workspaces page the heading is the current page: it takes the
   strongest text colour (white in the dark theme), not gold. */
.sidebar-section-header:hover { color: var(--text-strong); }
.sidebar-section-header.active { color: var(--text-strong); }

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

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

/* A row is icon, name, count. The name may take two lines so that two
   workspaces for the same principal ("... · Live Watch", "... · Commute")
   can be told apart; the icon and the count stay on its first line. */
.sidebar-ws-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 13px;   /* the size of the links at the foot of the sidebar */
  line-height: 20px;
  text-decoration: none;
  border-radius: var(--radius-md);
}
.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-glyph svg { width: 14px; height: 14px; }
.sidebar-ws-item:hover .sidebar-ws-glyph { color: var(--text-secondary); }
.sidebar-ws-item.active .sidebar-ws-glyph { color: var(--accent); }

.sidebar-ws-name {
  flex: 1;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-wrap: balance;   /* two even lines, not one long and one orphan word */
}

/* "New relevant items" count, right of the workspace name, and the
   total of them on the Workspaces heading. A quiet pill in the
   surface's own tone: with a row of them, solid gold shouted over the
   names, and gold is kept for the one thing that is selected. */
.sidebar-ws-unread,
.sidebar-section-unread {
  flex-shrink: 0;
  box-sizing: border-box;
  min-width: 32px;   /* fits three digits, so every row's name ends on the same line */
  padding: 0 8px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-primary);
  background: var(--bg-surface-3);
  border-radius: 999px;
}
.sidebar-ws-item:hover .sidebar-ws-unread,
.sidebar-ws-item.active .sidebar-ws-unread { color: var(--text-strong); }
.sidebar-section-unread { margin-left: auto; }

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

.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: 13px;
  white-space: nowrap;
  overflow: hidden;
  border-radius: var(--radius-md);
}
.sidebar-link:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.sidebar-link.active { background: var(--bg-surface-2); color: var(--accent); }
/* One drawn set (16px, the same line weight throughout) in place of
   the text symbols, which each came from a different font. */
.sidebar-link-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-dim);
}
.sidebar-link-icon svg { width: 16px; height: 16px; display: block; }
.sidebar-link:hover .sidebar-link-icon { color: var(--text-secondary); }
.sidebar-link.active .sidebar-link-icon { color: var(--accent); }

/* The signed-in account: who, their role, and the way out, in the same
   quiet language as the rows above it. A round initial in the surface's
   tone, the address in body text, the role as supporting text, and
   sign-out as a plain icon button that tints on hover. No gold here:
   gold marks what is selected. */
.sidebar-user {
  margin-top: 8px;
  padding: 12px 12px 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border-subtle);
}
.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-surface-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}
.sidebar-user-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-user-email {
  font-size: 13px;
  line-height: 18px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-tag {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dim);
}
.sidebar-user-logout { display: flex; flex-shrink: 0; }
.sidebar-user-logout button {
  background: transparent;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--text-dim);
  width: 32px; height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.175s ease, color 0.175s ease;
}
.sidebar-user-logout button svg { width: 16px; height: 16px; display: block; }
.sidebar-user-logout button:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.sidebar-user-logout button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Collapsed (icon-only) sidebar — hide labels, keep icons */
body.shell[data-sidebar="closed"] .sidebar-brand,
body.shell[data-sidebar="closed"] .sidebar-section-label,
body.shell[data-sidebar="closed"] .sidebar-ws-name,
body.shell[data-sidebar="closed"] .sidebar-ws-unread,
body.shell[data-sidebar="closed"] .sidebar-section-unread,
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;
  /* With its label hidden the heading is only a divider: a straight
     hairline, the same on every page. */
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
}
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: var(--scrim);
  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);
  /* Extra right padding reserves a 56px slot for the absolutely-pinned
     theme toggle so the status cluster never overflows under it. */
  padding: 0 76px 0 20px;
  background: var(--bg-base);   /* same plane as the sidebar and page; the hairline below does the separating */
  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-size: 11px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}
/* Inter like the rest of the chrome; the serif stays on the wordmark only. */
.ws-topbar-title {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 600;
  margin-top: 1px;
  color: var(--accent);   /* same gold as page headings and the active nav item, both themes */
  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: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}
.ws-topbar-nav a:hover { color: var(--text-primary); }
.ws-topbar-nav a.active {
  color: var(--accent);
  border-color: var(--border-mid);
}
.ws-topbar-nav .topbar-nav-count {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  margin-left: 4px;
  border: 1px solid var(--border-mid);
  color: var(--text-dim);
  font-size: 11px;
  text-align: center;
}
.ws-topbar-nav a.active .topbar-nav-count {
  border-color: var(--border-strong);
  color: var(--accent);
}

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

/* Desktop: the section links sit at the centre of the bar and stay there
   whatever the length of the title beside them. Three columns, the outer
   two equal, so the middle one is centred; as a flex row the links were
   centred in what the title left over, and moved from page to page. The
   bar's padding is made even for the same reason (the right side holds
   the theme toggle's slot) and the title pulled back out to the page's
   20px edge. When the bar is too narrow for all three, the title is cut
   short with an ellipsis first, and only then do the links scroll; the
   outer columns keep 96px each for the clock. Below 1024px the bar
   wraps to two rows (see the drawer rules further down). */
@media (min-width: 1024px) {
  .ws-topbar {
    display: grid;
    grid-template-columns: minmax(96px, 1fr) minmax(0, max-content) minmax(96px, 1fr);
    padding: 0 76px;
  }
  .ws-topbar-id { margin-left: -56px; }
  .ws-topbar-nav { justify-content: flex-start; }
  .ws-topbar-status { justify-self: end; }
}

/* Theme toggle — absolutely pinned to the top-right of whichever topbar
   is active. Sits in the slot reserved by each topbar's right padding
   (see .ws-topbar / .bare-topbar) so the button is always at the same
   screen coordinate regardless of what else is in the bar. Two icon
   spans (moon / sun) stack at the same position; CSS shows whichever
   matches the current mode. */
.theme-toggle {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: color 0.12s ease, border-color 0.12s ease;
  z-index: 1;
  border-radius: var(--radius-md);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle-icon { display: none; }
:root[data-theme="dark"]  .theme-toggle .theme-toggle-icon-dark  { display: inline; }
:root[data-theme="light"] .theme-toggle .theme-toggle-icon-light { display: inline; }
:root:not([data-theme]) .theme-toggle .theme-toggle-icon-dark    { display: inline; }

/* Bare topbar (no workspace context — just hamburger + status) */
.bare-topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  /* Right padding reserves space for the absolutely-pinned toggle (see
     .ws-topbar). Replaces the old justify-content: space-between — the
     status cluster now uses margin-left: auto to hug the toggle. */
  padding: 0 76px 0 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}
.bare-topbar .ws-topbar-status { margin-left: auto; }

/* Responsive — collapse sidebar to drawer below 768px
   ---------- */
/* Overlay sidebar for phones AND iPad portrait. iPads report ≥768px in
   portrait, so the old 767px cutoff left every iPad pinning the sidebar
   open and eating ~31% of the width. 1023px keeps iPad landscape (1024)
   and the 12.9" Pro portrait (1024) on the pinned desktop layout while
   giving 768–834px portrait the collapsible drawer + full content width.
   Paired with the (min-width: 1024px) checks in base.html. */
@media (max-width: 1023px) {
  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-section-label,
  .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;
  }
  .sidebar-user-meta { display: flex !important; }
  .sidebar-brand { display: inline-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 60px 8px 16px;  /* keep slot for pinned toggle */
    gap: 10px;
    row-gap: 6px;
  }
  .bare-topbar {
    padding: 0 60px 0 16px;
  }
  /* On the wrapped ws-topbar, "top: 50%" would sit between the two rows.
     Pin to the first row instead by anchoring to top. */
  .ws-topbar .theme-toggle {
    top: 8px;
    transform: none;
  }
  .theme-toggle { right: 14px; }
  .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 */
}

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

.btn {
  display: inline-block;   /* links styled as buttons honour margins and padding like real buttons */
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  padding: 6px 14px;
  font-size: 13px;
  line-height: 1.25;
  cursor: pointer;
  transition: all 0.12s ease;
  border-radius: var(--radius-md);
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--text-on-accent);
}

.btn-danger {
  background: var(--sev-high-soft);
  color: var(--text-on-accent);
  border-color: var(--sev-high-soft);
  font-weight: 600;
}
.btn-danger:hover {
  background: var(--sev-high);
  border-color: var(--sev-high);
  color: var(--text-on-accent);
}

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

input[type="text"], input[type="number"], input[type="email"],
select, textarea {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  padding: 6px 10px;
  font-size: 13px;
}
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-lead { font-size: 14px; color: var(--text-secondary); line-height: 1.5; max-width: 760px; }
.page-header h1 {
  margin: 0 0 4px 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
}
.page-header-actions { display: flex; gap: 8px; }

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

/* Type, spacing and shape here follow the conventions of Meta's Astryx
   design system (github.com/meta/astryx, Design Conventions): text has
   a role and adjacent roles differ clearly (title 18/600, body 14,
   supporting 12, the count 24/600); gaps sit on a 4px grid and grow
   with the level of grouping (4 inside a pair, 8 inside a block, 16-20
   between blocks); a card is a container (radius 12) with one edge
   language, a hairline and no shadow; hover is a tint over the surface,
   not a lift; a status colour always comes with words. */
.ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

/* Wraps each workspace card so the kebab can sit outside the link element
   (anchors can't legally contain buttons). The link still fills the card. */
.ws-card-wrap { position: relative; display: flex; }
.ws-card-wrap > .card-kebab-wrap { top: 12px; right: 12px; }
/* A name may run to two lines: cutting it short hid the part that tells
   two workspaces apart ("... · Live Watch" from "... · Commute"). */
.ws-card h3 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* Every card in a row is the same height: the wrap fills the grid row,
   the card fills the wrap, the digest takes the slack and the "edited"
   line sits on the bottom. The description is held to two lines so the
   digest starts at the same point on every card. */
.ws-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 20px;
  transition: border-color 0.175s ease, background-color 0.175s ease;
  cursor: pointer;
  position: relative;
  border-radius: 12px;
  color: var(--text-primary);
  text-decoration: none;
}
.ws-card:hover { border-color: var(--border-strong); color: var(--text-primary); }
.ws-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ws-card:active { transform: scale(0.995); }

/* What kind of workspace this is: a label, so small and medium weight. */
.ws-card-kind {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px;
  font-size: 12px; line-height: 16px; font-weight: 500;
  color: var(--text-secondary);
}
.ws-card-kind svg { width: 14px; height: 14px; flex: none; }

.ws-card h3 { margin: 0; font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-strong); }
.ws-card .desc {
  color: var(--text-secondary); font-size: 14px; line-height: 20px; margin: 4px 0 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 40px;   /* two lines, even when the description is short or empty */
}
.ws-card .ws-digest { margin-top: 16px; }

/* The number people open this page for, pinned to the same height on
   every card in a row. */
.ws-card-status { margin-top: auto; padding-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.ws-new { display: flex; align-items: baseline; gap: 8px; }
.ws-new-count {
  font-size: 24px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--text-strong); font-variant-numeric: tabular-nums;
}
.ws-new-label { font-size: 14px; line-height: 20px; color: var(--text-secondary); }
.ws-new-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ws-sev {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.ws-sev-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.ws-sev--high { background: var(--sev-high-bg-2); color: var(--sev-high-soft); }
.ws-sev--critical { background: var(--sev-high); color: #fff8f6; }
.ws-new-topics { font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.ws-quiet { display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; color: var(--text-secondary); }
.ws-quiet svg { width: 18px; height: 18px; flex: none; color: var(--status-healthy); }
.ws-card-meta { margin-top: 16px; font-size: 12px; line-height: 16px; color: var(--text-dim); }
/* A card with no status block still keeps "Edited" on its bottom edge. */
.ws-card > :not(.ws-card-status) + .ws-card-meta { margin-top: auto; padding-top: 16px; }

/* "Since you last looked" digest on each card. Severity is carried by the
   card border + a leading dot per line — the grid reads as a heat map. */
.ws-card--alert { border-color: var(--sev-high-border); }
.ws-card--alert:hover { border-color: var(--sev-high); }
.ws-card--elevated { border-color: var(--sev-medium); border-color: color-mix(in srgb, var(--sev-medium) 40%, transparent); }
.ws-card--elevated:hover { border-color: var(--sev-medium); }
.ws-digest { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.digest-line { font-size: 14px; line-height: 20px; color: var(--text-secondary); display: flex; gap: 8px; }
.digest-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; margin-top: 7px; }
.digest-alert { color: var(--text-primary); font-weight: 500; }
.digest-alert .digest-dot { background: var(--sev-high); }
.digest-ongoing .digest-dot { background: var(--sev-medium); }
.digest-more { font-size: 12px; padding-left: 14px; }
.digest-near { color: var(--text-secondary); font-weight: 400; }
.digest-alert--settled { color: var(--text-secondary); font-weight: 400; }
.digest-alert--settled .digest-dot { background: var(--text-secondary); opacity: 0.5; }
.digest-ack { font-size: 12px; font-weight: 600; white-space: nowrap;
  color: var(--text-secondary); margin-left: 4px;
}
.digest-ack--waiting { color: var(--sev-high); animation: digest-pulse 1.6s ease-in-out infinite; }
@keyframes digest-pulse { 50% { opacity: 0.45; } }

/* Live escalations pinned above the workspace grid until acknowledged. */
.pinned-alerts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.pinned-alert {
  display: flex; align-items: baseline; gap: 10px;
  padding: 9px 12px; font-size: 13px; text-decoration: none;
  background: var(--sev-high-bg);
  border: 1px solid var(--sev-high-border);
  color: var(--text-primary);
}
.pinned-alert:hover { border-color: var(--sev-high); }
.pinned-alert--settled {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}
.pinned-alert--settled:hover { border-color: var(--border-strong); }
.pinned-alert-sev { font-size: 11px; font-weight: 600;
  color: var(--sev-high); white-space: nowrap;
}
.pinned-alert--settled .pinned-alert-sev { color: var(--text-secondary); }
.pinned-alert-text { flex: 1; line-height: 1.5; }
.digest-volume { font-size: 12px; }

/* "New workspace" tile: a card-sized module at the end of the grid, an
   empty outline of a card (dashed edge, barely-there surface) asking to
   be filled. It is the page's one way to add a workspace. */
.ws-card-new {
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 176px;
  background: transparent;
  border: 1px dashed var(--border-mid);
  font: inherit;
  color: var(--text-secondary);
  text-align: center;
}
.ws-card-new-plus {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border-mid);
  transition: border-color 0.175s ease, background-color 0.175s ease, color 0.175s ease;
}
.ws-card-new-plus svg { width: 18px; height: 18px; }
.ws-card-new-label { font-size: 14px; line-height: 20px; font-weight: 500; }
.ws-card-new:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }
.ws-card-new:hover .ws-card-new-plus { border-color: var(--accent); background: var(--accent-dim); }

/* ----------------------------------------------------------------------
   Top bar title in the brand's capitals. A page adds "topbar-display" to
   the body (base.html body_class) and its title, under the "Operations"
   label in the top bar, is set the way the wordmark is: bold capitals in
   the display face, in the strongest text colour, not gold. The page
   then needs no heading of its own and starts at its content.
   ---------------------------------------------------------------------- */

body.topbar-display .ws-topbar-title {
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-strong);
  margin-top: 2px;
}

/* ----------------------------------------------------------------------
   Backdrop and glass (dark theme only). A page opts in with a
   "backdrop-…" body class; the light theme keeps its flat page.

   Three parts:
   1. The dusk palette: the app's own colour roles re-pointed at the
      sign-in picture's own dark, a petrol blue-green (hue about 199,
      measured from the picture: #081419, #0d1d25), for everything on
      the page: sidebar, topbar, cards, menus. Not navy: a bluer, more
      purple dark sat apart from the picture and from the sign-in page.
      Neutrals are tinted, never pure black or white; borders are a
      pale teal-white at low alpha so they sit on any surface.
   2. The backdrop: the dusk picture on its own fixed layer behind the
      shell (not background-attachment: fixed, which iPad Safari does
      not honour), under a heavy scrim of the same petrol dark. This is a working page, so
      the picture is kept to a faint glow: no texture strong enough to
      read through a card.
   3. Glass: panels are a mostly solid petrol dark with blur behind them, so
      text always has the same dark surface under it.

   Three levels of dark, so a page has a clear order:
     page    #03090c         close to black: what everything sits on
     panel   about #060f14   a card or widget, edged by its hairline
     map     #0d2029 land    (map_basemap.js) the lightest surface
   The first palette had page and panel only a few steps apart and a
   map a few steps above those; on a dashboard the three ran into one
   flat blue. Page and panel were taken down two steps and the map left
   alone. The same tones serve every page with a backdrop, so the top
   bar and sidebar do not change shade between pages.
   ---------------------------------------------------------------------- */

html:not([data-theme="light"]) body[class*="backdrop-"] {
  --bg-base: #03090c;
  --bg-surface: #060f14;
  --bg-surface-2: #0b1a20;
  --bg-surface-3: #12252c;
  --bg-deep: #020608;
  --border-subtle: rgba(150, 198, 214, 0.14);
  --border-mid: rgba(150, 198, 214, 0.22);
  --border-strong: rgba(150, 198, 214, 0.38);
  --text-primary: #dfe8eb;
  --text-secondary: rgba(212, 228, 233, 0.76);
  --text-dim: rgba(212, 228, 233, 0.60);
  --text-strong: #f3f8f9;
  --glass-line: var(--border-subtle);
  --glass-panel: rgba(6, 15, 20, 0.90);
  --glass-panel-hover: rgba(13, 28, 35, 0.94);
  /* Controls that float on a map or a picture. */
  --overlay-bg: rgba(3, 8, 11, 0.84);
  --overlay-bg-soft: rgba(3, 8, 11, 0.72);
  --overlay-bg-strong: rgba(3, 8, 11, 0.95);
  background: transparent;
  color: var(--text-primary);
}
html:not([data-theme="light"]) body.backdrop-horizon::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(3, 9, 12, 0.93) 0%, rgba(3, 9, 12, 0.90) 55%, rgba(3, 9, 12, 0.74) 100%),
    #020608 url("/static/img/backdrop-horizon.webp?v=3") center / cover no-repeat;
}
html:not([data-theme="light"]) body[class*="backdrop-"] .sidebar {
  background: rgba(3, 8, 11, 0.80);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
html:not([data-theme="light"]) body[class*="backdrop-"] .ws-topbar {
  background: rgba(3, 8, 11, 0.66);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
@media (max-width: 1023px) {
  /* As a drawer the sidebar slides over the page, so it needs more body. */
  html:not([data-theme="light"]) body[class*="backdrop-"] .sidebar { background: rgba(3, 8, 11, 0.94); }
}

/* Workspace cards on glass. A plain card has a hairline; alert and
   elevated cards keep their severity borders, at rest and on hover, so
   the grid still reads as a heat map. Hover tints the panel and firms
   up its edge; nothing moves and there is no glow. */
html:not([data-theme="light"]) body.backdrop-horizon .ws-card:not(.ws-card-new) {
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
}
html:not([data-theme="light"]) body.backdrop-horizon .ws-card-wrap:hover .ws-card:not(.ws-card-new) {
  background: var(--glass-panel-hover);
}
html:not([data-theme="light"]) body.backdrop-horizon .ws-card-wrap:hover .ws-card:not(.ws-card-new):not(.ws-card--alert):not(.ws-card--elevated) {
  border-color: var(--border-strong);
}
html:not([data-theme="light"]) body.backdrop-horizon .ws-card-new { background: rgba(6, 15, 20, 0.35); }
html:not([data-theme="light"]) body.backdrop-horizon .ws-card-new:hover { border-color: var(--accent); }
html:not([data-theme="light"]) body.backdrop-horizon .card-menu {
  background: var(--bg-surface-2);
  border-radius: 8px;
  overflow: hidden;
}

/* ----------------------------------------------------------------------
   Light theme backdrop: the characters the sign-in picture is built
   from, rising very faintly from the bottom edge over a trace of the
   horizon's warm glow. It is there to tie the light page to the dark
   one, not to be looked at.

   Same build as the dark backdrop: a fixed layer behind the shell, the
   body transparent over it. ::before carries the colour wash, ::after
   the characters on top of it. Cards stay solid white, and the sidebar
   and top bar stay solid, so text never sits on the backdrop itself.
   ---------------------------------------------------------------------- */

html[data-theme="light"] body[class*="backdrop-"] { background: transparent; }
html[data-theme="light"] body[class*="backdrop-"]::before,
html[data-theme="light"] body[class*="backdrop-"]::after {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: -1;
  pointer-events: none;
}
html[data-theme="light"] body[class*="backdrop-"]::before {
  background:
    radial-gradient(90% 50% at 55% 110%, rgba(226, 140, 84, 0.12) 0%, transparent 66%),
    #f6f7f9;
}
html[data-theme="light"] body[class*="backdrop-"]::after {
  background: url("/static/img/ascii-field-light.png") 0 0 / 448px 448px repeat;
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.4) 28%, transparent 60%);
  mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.4) 28%, transparent 60%);
  opacity: 0.30;
}

/* ----------------------------------------------------------------------
   People page
   ---------------------------------------------------------------------- */

.people-page-header {
  gap: 20px;
}

.people-page-copy {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
  max-width: 680px;
}

/* Real name shown beneath the codename in headings/cards. Lighter weight
   so the codename stays the dominant identifier. */
.people-page-realname {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 14px;
}

.people-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  gap: 8px;
  flex-shrink: 0;
}

.people-stat-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  min-width: 96px;
}

.people-stat-value {
  display: block;
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.people-stat-label {
  display: block;
  margin-top: 5px;
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.people-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.people-tool {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 18px;
}

.people-add-tool {
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
}

.people-directory {
  min-width: 0;
}

.people-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 18px;
  margin-bottom: 16px;
}

/* Inside a section card the head's bottom border just doubles up with
   the card border. Keep spacing, drop the line. */
.people-section .people-section-head {
  margin-bottom: 14px;
  padding-bottom: 0;
  border-bottom: 0;
}

/* Inline add-forms read as a sub-block within the card — step up the
   surface so they're distinct from the card body. */
.people-section .people-inline-form {
  background: var(--bg-surface-2);
  border-color: var(--border-mid);
}

/* Edge rows (each handle / location / relationship) sit inside the
   section card; lift them onto the next surface so they don't disappear
   against the card background. */
.people-section .people-edge-row {
  background: var(--bg-surface-2);
  border-color: var(--border-mid);
}

.people-section .people-edge-row:hover {
  background: var(--bg-surface-3);
}
.people-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.people-section-kicker {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.people-section-title {
  margin: 2px 0 0;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.people-section-count {
  min-width: 28px;
  padding: 2px 8px;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  font-size: 11px;
  text-align: center;
}

.people-form,
.people-inline-form {
  min-width: 0;
}

.people-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 640px;
}

/* Inline help icon used next to <label><span> field labels. Native CSS
   tooltip — no JS, content driven by the `data-tip` attribute. */
.field-hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  border: 1px solid var(--border-mid);
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  cursor: help;
  vertical-align: middle;
}

.field-hint:hover,
.field-hint:focus {
  color: var(--accent);
  border-color: var(--accent);
}

.field-hint[data-tip]:hover::after,
.field-hint[data-tip]:focus::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: -4px;
  padding: 7px 9px;
  width: max-content;
  max-width: 240px;
  background: var(--bg-surface-3);
  border: 1px solid var(--border-mid);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  z-index: 50;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.field-hint[data-tip]:hover::before,
.field-hint[data-tip]:focus::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 4px;
  border: 5px solid transparent;
  border-top-color: var(--border-mid);
  z-index: 50;
  pointer-events: none;
}

.field-required {
  margin-left: 4px;
  color: var(--accent);
  font-weight: 600;
}

.people-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.people-field > span {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.people-field input,
.people-field select,
.people-field textarea {
  width: 100%;
  min-width: 0;
}

.people-field textarea {
  min-height: 74px;
  resize: vertical;
}

.people-field-full {
  grid-column: 1 / -1;
}

.people-field-stretch {
  min-width: 220px;
}

.people-form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.person-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

.person-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 198px;
  padding: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.12s ease, background 0.12s ease;
}

.person-card:hover {
  background: var(--bg-surface-2);
  border-color: var(--border-mid);
}

.person-card-top {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.person-avatar {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-mid);
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.person-avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 20px;
}

.person-card-id {
  min-width: 0;
}

.person-name {
  display: block;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.person-card-codename {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.people-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.people-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 7px;
  border: 1px solid var(--border-mid);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.people-chip-accent {
  border-color: var(--border-strong);
  color: var(--accent);
  background: var(--accent-dim);
}

.people-chip-more {
  color: var(--accent);
  border-color: var(--border-strong);
}

.people-empty-inline {
  color: var(--text-dim);
  font-size: 12px;
}

.person-card-notes {
  flex: 1;
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.person-card-notes-empty {
  color: var(--text-dim);
}

.person-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.person-date {
  color: var(--text-dim);
  font-size: 11px;
  white-space: nowrap;
}

.person-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.people-danger-text {
  color: var(--sev-high-soft);
}

.people-danger-text:hover {
  color: var(--sev-high);
  border-color: var(--sev-high);
}

.people-empty-card {
  border: 1px dashed var(--border-mid);
  background: var(--bg-surface);
  padding: 28px;
  color: var(--text-secondary);
}

.people-empty-title {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.people-empty-card p {
  margin: 8px 0 0;
}

/* Combined person header — avatar + codename + real name + inline counts,
   with action buttons on the right. Replaces the old split profile-summary
   block which duplicated content from the Basics card. */
.people-profile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.people-profile-id {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.people-profile-meta {
  min-width: 0;
}

.people-profile-meta h1 {
  margin: 0;
  overflow-wrap: anywhere;
}

.people-profile-meta .people-page-realname {
  margin-top: 2px;
}

.people-profile-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 14px 18px;
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 11px;
}

.people-profile-stats strong {
  margin-right: 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.people-profile-aliases {
  color: var(--text-secondary);
  font-size: 12px;
}

.people-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.people-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.people-inline-form .people-field {
  flex: 1 1 150px;
}

.people-inline-form .people-field-stretch {
  flex: 2 1 260px;
}

.people-inline-form .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.people-item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.people-edge-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.12s ease, background 0.12s ease;
}

.people-edge-row:hover {
  background: var(--bg-surface-2);
  border-color: var(--border-mid);
}

.people-edge-main {
  min-width: 0;
}

.people-edge-kicker {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.people-edge-title {
  margin-top: 2px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.people-edge-title a {
  color: var(--accent);
}

.people-edge-title a:hover {
  color: var(--accent-hover);
}

.people-edge-meta,
.people-edge-note {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.people-edge-note {
  color: var(--text-dim);
}

.people-row-action {
  justify-self: end;
}

.people-empty-note {
  margin: 10px 0 0;
  padding: 12px;
  border: 1px dashed var(--border-mid);
  color: var(--text-secondary);
  font-size: 12px;
}

@media (max-width: 1180px) {
  .people-layout,
  .people-detail-grid {
    grid-template-columns: 1fr;
  }

  .people-add-tool {
    position: static;
  }
}

@media (max-width: 720px) {
  .people-page-header,
  .network-page-header,
  .people-profile-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .people-stats {
    width: 100%;
  }

  .people-form-grid {
    grid-template-columns: 1fr;
  }

  .people-inline-form {
    align-items: stretch;
    flex-direction: column;
  }

  .people-inline-form .people-field,
  .people-inline-form .people-field-stretch {
    flex-basis: auto;
    min-width: 0;
  }

  .people-inline-form .btn,
  .people-form-actions .btn {
    width: 100%;
  }.people-field-full {
    grid-column: auto;
  }

  .people-profile-id {
    flex-direction: column;
    align-items: flex-start;
  }

  .person-card-footer,
  .people-edge-row {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .person-card-footer {
    flex-direction: column;
  }

  .person-actions,
  .people-row-action,
  .person-card-footer .btn,
  .person-card-footer form {
    width: 100%;
  }

  .person-actions .btn,
  .person-actions form,
  .people-row-action .btn {
    width: 100%;
  }

  .people-row-action {
    justify-self: stretch;
  }
}

/* ----------------------------------------------------------------------
   Network page
   ---------------------------------------------------------------------- */

/* Four tiles (people, of concern, locations, keywords) in one row. */
.network-page-header .people-stats {
  grid-template-columns: repeat(4, minmax(92px, 1fr));
}

.network-graph-shell {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  min-height: 680px;
  display: flex;
  flex-direction: column;
}

.network-graph-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.network-type-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.network-type-toggle {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  padding: 5px 10px;
}

.network-type-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.network-type-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-base);
  font-weight: 700;
}

.network-graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  flex: 1;
  min-height: 0;
}

.network-graph-canvas {
  position: relative;
  min-height: 600px;
  overflow: hidden;
  background:
    linear-gradient(var(--accent-faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--accent-faint) 1px, transparent 1px);
  background-size: 28px 28px;
}

.network-graph-canvas svg {
  display: block;
  width: 100%;
  height: 100%;
}

.network-links line {
  stroke: var(--border-strong);
  stroke-opacity: 0.7;
}

.network-node {
  cursor: pointer;
}

.network-node circle {
  stroke: var(--bg-base);
  stroke-width: 2px;
  fill-opacity: 0.9;
  fill: var(--text-dim);  /* default for unknown types */
  transition: stroke-width 0.12s ease, fill-opacity 0.12s ease;
}

.network-node.node-person   circle { fill: var(--accent); }
.network-node.node-location circle { fill: var(--status-healthy); }
.network-node.node-keyword  circle { fill: var(--sev-medium); }
.network-node.node-handle   circle { fill: var(--cat-humanitarian); }

.network-node.selected circle {
  stroke: var(--text-strong);
  stroke-width: 3px;
}

.network-node:hover circle {
  fill-opacity: 1;
  stroke-width: 3px;
}

.network-node text {
  fill: var(--text-primary);
  font-size: 11px;
  paint-order: stroke;
  stroke: var(--bg-base);
  stroke-width: 4px;
  stroke-linejoin: round;
  pointer-events: none;
}

.network-inspector {
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  padding: 16px;
  min-width: 0;
}

.network-inspector-title {
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.network-inspector-meta {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.network-inspector-stats {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.network-inspector-stats span {
  display: block;
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.network-inspector-stats strong {
  display: block;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  margin-top: 6px;
  text-transform: uppercase;
}

.network-inspector-action {
  margin-top: 18px;
}

.network-graph-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 13px;
}

.network-record-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.network-record-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 14px;
}

.network-record-main {
  min-width: 0;
}

.network-record-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.network-record-top h3 {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.network-record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 10px 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.network-record-notes {
  margin: 10px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.network-global-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 6px 9px;
  border: 1px solid var(--border-mid);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
}

.network-global-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.network-global-link input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.network-multi-select {
  min-height: 118px;
}

.network-multi-select option {
  padding: 4px 6px;
}

.tag-input {
  position: relative;
  min-width: 0;
}

.tag-input-source {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
}

.tag-input-shell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 5px 6px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-mid);
  cursor: text;
}

.tag-input-shell.is-focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.tag-input-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 8px;
  background: var(--accent-dim);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  font-size: 11px;
  line-height: 1.4;
  max-width: 100%;
}

.tag-input-chip-label {
  overflow-wrap: anywhere;
}

.tag-input-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.tag-input-chip-remove:hover {
  color: var(--accent-hover);
}

.tag-input-field {
  flex: 1;
  min-width: 100px;
  padding: 2px 4px !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--text-primary);
  font-size: 13px;
}

.tag-input-field:focus {
  outline: none;
  border: 0 !important;
  box-shadow: none !important;
}

.tag-input-suggestions {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 2px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-mid);
  box-shadow: var(--shadow-md);
}

.tag-input-suggestion {
  display: block;
  width: 100%;
  padding: 6px 10px;
  background: transparent;
  border: 0;
  color: var(--text-primary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.tag-input-suggestion:hover,
.tag-input-suggestion.is-active {
  background: var(--bg-surface-3);
  color: var(--accent);
}

.tag-input-suggestion-empty {
  padding: 6px 10px;
  color: var(--text-dim);
  font-size: 12px;
}

.network-edit-details {
  min-width: 0;
}

.network-edit-details > summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 11px;
  list-style: none;
  padding: 5px 0 10px;
}

.network-edit-details > summary::-webkit-details-marker {
  display: none;
}

.network-edit-details > summary:hover,
.network-edit-details[open] > summary {
  color: var(--accent);
}

.network-edit-form {
  padding: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}

@media (max-width: 1080px) {
  .network-graph-layout,
  .network-record-card {
    grid-template-columns: 1fr;
  }

  .network-inspector {
    border-left: 0;
    border-top: 1px solid var(--border-subtle);
  }
}

@media (max-width: 720px) {
  .network-page-header .people-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .network-graph-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .network-type-toggles,
  .network-type-toggle {
    width: 100%;
  }

  .network-graph-canvas {
    min-height: 480px;
  }

  .network-record-top {
    flex-direction: column;
  }

  .network-record-top form,
  .network-record-top .btn {
    width: 100%;
  }
}

/* ----------------------------------------------------------------------
   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%;
  border-radius: var(--radius-md);
}

.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: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}
.widget-title .name { color: var(--accent); }
.widget-title .lozenge {
  font-size: 11px;
  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: 11px; border-color: transparent; color: var(--text-dim); }
.widget-actions .btn:hover { color: var(--accent); border-color: var(--border-mid); }
/* Header links open elsewhere — the external-link glyph is what makes
   them read as links rather than labels. */
.widget-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-secondary); }
.widget-link-glyph { width: 11px; height: 11px; flex: none; }

.widget-body {
  flex: 1;
  padding: 12px;
  overflow: auto;
  min-height: 0;
}
.widget-body.flush { padding: 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-size: 11px;
  font-weight: 600;
  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; }
/* "New since last viewed" — a soft white highlight washed across the whole
   row for items that became relevant since the workspace was last opened
   (baseline = prior viewed_at, threaded from the dashboard shell). A gentle
   left-to-right fade rather than a hard outline; clears on reopen. */
.alert-li { transition: background-color 0.35s ease, box-shadow 0.35s ease; }
.alert-li.is-new {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.5);
}
.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-size: 11px; color: var(--text-dim); display: block; text-align: center; }
/* min-width:0 lets the flex child actually shrink below its intrinsic
   width — without it a long unbreakable title forces horizontal
   overflow on the entire widget. */
.alert-text { flex: 1; min-width: 0; }
/* Two-line clamp with ellipsis. The drawer (click-anywhere-on-row)
   is the canonical "expand" — it shows the full title verbatim, so we
   don't need an inline toggle.
   overflow-wrap:anywhere ensures URL-like strings without spaces still
   break inside the clamp box rather than blowing it out. */
.alert-title {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.chip-ai {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 0 4px;
  margin-right: 6px;
  vertical-align: 1px;
  color: var(--status-healthy-soft);
  border: 1px solid var(--status-healthy-soft);
  background: var(--status-healthy-bg);
}
.chip-live {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 0 4px;
  margin-right: 6px;
  vertical-align: 1px;
  color: var(--status-healthy);
  border: 1px solid var(--status-healthy);
}
.chip-watch {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  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-size: 11px;
  padding: 1px 6px;
  margin: 0 4px 2px 0;
  border-radius: var(--radius-sm);
  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); }
.alert-title .hl { color: var(--accent); background: var(--accent-dim); padding: 0 2px; }
.alert-meta { font-size: 11px; 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-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.posture-cell .count {
  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-size: 11px;
  color: var(--text-dim);
}

/* ----------------------------------------------------------------------
   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: 13px;
}
.source-list li:last-child { border-bottom: 0; }
.source-list .label { color: var(--text-primary); }
.source-list .stat { font-size: 11px; color: var(--text-dim); }

/* ----------------------------------------------------------------------
   Widget — network snapshot
   ---------------------------------------------------------------------- */

.network-widget {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 0;
}
.network-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.network-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 8px 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  text-decoration: none;
}
.network-metric:hover {
  border-color: var(--border-mid);
  background: var(--bg-surface-3);
}
.network-metric-value {
  font-size: 20px;
  line-height: 1;
  color: var(--text-primary);
}
.network-metric-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.network-person-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 0;
  overflow: hidden;
}
.network-person-chip,
.network-empty-link {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-width: 0;
  padding: 2px 6px;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  background: var(--bg-surface-2);
  font-size: 11px;
  line-height: 1.4;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.network-person-chip:hover,
.network-empty-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.network-person-more {
  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: 12px; color: var(--text-secondary); }
.barchart .row .bar { background: var(--bg-surface-2); height: 8px; position: relative; }
.barchart .row .fill { background: var(--accent); height: 100%; }
.barchart .row .val { font-size: 11px; color: var(--text-primary); text-align: right; }

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

.trend svg { width: 100%; height: 100%; display: block; }
.trend .axis { font-size: 11px; 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-size: 11px; }
.trend .legend tspan { fill: var(--text-secondary); }

/* ----------------------------------------------------------------------
   Widget — pattern of life (day × hour heatmap)
   Cell fills are inline color-mix() against theme tokens, so they follow
   the theme; only layout and chrome live here.
   ---------------------------------------------------------------------- */

.pol { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.pol-controls { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pol-controls .btn { padding: 2px 8px; font-size: 11px; }
.pol-controls .btn.on { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.pol-sep { width: 1px; height: 14px; background: var(--border-mid); margin: 0 4px; }
.pol-grid {
  display: grid;
  grid-template-columns: 44px repeat(24, 1fr);
  grid-auto-rows: 1fr;
  gap: 2px;
  flex: 1;
  min-height: 0;
}
.pol-corner, .pol-hour, .pol-day { font-size: 11px; color: var(--text-dim); }
.pol-hour { text-align: left; align-self: end; }
.pol-day { align-self: center; white-space: nowrap; }
.pol-cell { border-radius: var(--radius-sm); min-height: 8px; }
.pol-cell.future { background: transparent; border: 1px dashed var(--border-subtle); }
.pol-cell.now { outline: 1px solid var(--text-strong); outline-offset: -1px; }

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

.map-container { width: 100%; height: 100%; min-height: 200px; background: var(--bg-deep); position: relative; }

/* Map theme picker overlay — temporary 4-option comparison chip.
   Once we pick the keeper variant the dropdown becomes a simple
   toggle again. */
.map-toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: flex;
  align-items: stretch;
  gap: 6px;
  /* Leaves the top-right corner (fit and pick buttons) alone. */
  max-width: calc(100% - 96px);
}
.map-toolbar:empty { display: none; }
.map-theme-select {
  min-height: 30px;   /* and as tall as the buttons beside it */
  padding: 0 8px;
  font-size: 12px;
  color: var(--accent);
  background: var(--overlay-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-appearance: menulist;
  appearance: menulist;
}
.map-theme-select:hover {
  background: var(--overlay-bg-strong);
  border-color: var(--accent);
}
.map-theme-select option {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}
/* "Fit to locations" — snaps the map back to the workspace's geofence
   extent (and re-saves that as the remembered view). Top-right so it
   doesn't collide with the theme picker top-left. */
.map-fit-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  color: var(--accent);
  background: var(--overlay-bg);
  border: 1px solid var(--border-strong);
  cursor: pointer;
}
.map-fit-btn:hover {
  background: var(--overlay-bg-strong);
  border-color: var(--accent);
}
/* Coordinate picker (shared coord_pick.js) — same chrome as the fit
   button; JS sets top/right inline per map so it slots under whatever
   already lives in that corner. Solid accent while armed. */
.coord-pick-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
}
/* Armed-mode banner. Bottom-centre: the only corner-free edge on all
   three maps (top is filter bar / theme select / fit territory, the
   legend sits bottom-left, attribution bottom-right). */
.coord-pick-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  padding: 6px 12px;
  font-size: 11px;
  white-space: nowrap;
  background: var(--accent);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}
/* Result popup: readonly value + re-copy button + status. Lifted above
   page overlays (the geoint feed panel clips it at the default level). */
.coord-pop-popup { z-index: 30; }
.coord-pop { display: flex; align-items: center; gap: 6px; }
.coord-pop-value {
  width: 164px;
  padding: 3px 6px;
  font-size: 12px;
  color: var(--text-primary);
  background: var(--bg-deep);
  border: 1px solid var(--border-mid);
}
.coord-pop-copy {
  padding: 3px 8px;
  font-size: 11px;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--border-strong);
  cursor: pointer;
  white-space: nowrap;
}
.coord-pop-copy:hover { border-color: var(--accent); }
.coord-pop-copy.copied {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
}
/* On /geoint the map theme picker is mounted INSIDE the filter bar
   (see .gf-theme-select below). The standalone .map-theme-select-geoint
   rule used to pin it to the bottom-left — kept here as a no-op alias
   in case another caller wires it the old way. */

/* 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: var(--radius-md) !important;
  padding: 8px 12px !important;
  font-size: 12px !important;
  box-shadow: var(--shadow-md) !important;
}
.maplibregl-popup-content strong {
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}
.maplibregl-popup-content small { color: var(--text-secondary); font-size: 11px; }

/* Click-into-drawer map popup — the whole card opens the full threat in the
   triage drawer, same as an Alert Feed row. The CTA + hover cue make the
   affordance obvious. */
.map-pop-card { cursor: pointer; display: block; }
.map-pop-meta { display: block; margin-top: 2px; }
.map-pop-cta {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}
.map-pop-card:hover strong,
.map-pop-card:focus-visible strong { text-decoration: underline; }
.map-pop-card:hover .map-pop-cta,
.map-pop-card:focus-visible .map-pop-cta { color: var(--accent); }

/* Threat-type legend — collapsible key, bottom-left of the map (clear of the
   theme picker top-left and the fit button top-right). */
.map-legend {
  position: absolute; bottom: 10px; left: 10px; z-index: 2;
  /* Bottom-anchored: column-reverse so the body opens UPWARD and the Key
     toggle stays put at the bottom instead of jumping above the list. */
  display: flex; flex-direction: column-reverse; align-items: flex-start;
}
.map-legend-toggle {
  list-style: none;
  cursor: pointer;
  display: inline-block;
  height: 24px;
  line-height: 22px;
  padding: 0 10px;
  background: var(--overlay-bg-soft);
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  font-size: 11px;
  user-select: none;
}
.map-legend-toggle::-webkit-details-marker { display: none; }
.map-legend-toggle:hover,
.map-legend[open] .map-legend-toggle { border-color: var(--accent); color: var(--accent); }
.map-legend-body {
  margin-bottom: 6px;   /* gap sits between the body (above) and the toggle (below) */
  padding: 7px 9px;
  background: var(--overlay-bg-strong);
  border: 1px solid var(--border-mid);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 12px;
  max-width: 300px;
  /* All 20 entries (10 rows) fit without a scrollbar; the cap is just a
     safety net for an unusually short map. */
  max-height: 260px;
  overflow-y: auto;
}
.map-legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.map-legend-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--border-strong);
  color: #fff;
}

/* Cluster list popup — the events inside a clicked bubble, each row opens
   the full item. */
.map-cl { min-width: 240px; }
.map-cl-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 6px;
}
.map-cl-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.map-cl-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 5px 4px;
  color: var(--text-secondary);
}
.map-cl-row:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.map-cl-sev {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  line-height: 15px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  color: var(--bg-base);
}
.map-cl-sev-high { background: var(--sev-high); }
.map-cl-sev-medium { background: var(--sev-medium); }
.map-cl-sev-low { background: var(--sev-low); }
.map-cl-text { display: flex; flex-direction: column; min-width: 0; }
.map-cl-title { font-size: 12px; line-height: 1.3; }
.map-cl-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
}
.map-cl-more { font-size: 11px; color: var(--text-dim); padding: 6px 4px 2px; font-style: italic; }

/* One line under a list's heading saying what the list holds. */
.map-cl-note { margin: -2px 0 6px; font-size: 11px; line-height: 1.4; color: var(--text-dim); }

/* "Wider area" — events that name a town or country rather than a street,
   or no place at all. A plain button with their count; on the workspace
   maps it sits in the map's toolbar (.map-toolbar, top-left). */
.map-tray-btn, .gf-noplace {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
}
.map-tray-btn {
  min-height: 30px;
  padding: 5px 8px 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--overlay-bg-strong);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
}
.map-tray-btn:hover, .gf-noplace:hover { color: var(--accent); border-color: var(--accent); }
.map-tray-n, .gf-noplace-n {
  min-width: 20px;
  padding: 1px 6px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  background: var(--bg-surface-3);
  border-radius: 999px;
}

/* The list that a chip or the button opens: over the map, inside it, and
   sized from the map so it fits a phone-width widget as well as Geo-Intel. */
.map-list-panel {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100% - 20px));
  /* A share of the map, not all of it: whatever else floats over the map
     (time bar, add-location button) keeps some room without this having to
     know how tall those are. */
  max-height: min(72%, 560px);
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
/* Opened from a button in the map's toolbar: under it, at the same left
   edge. threat_icons.js sets top and max-height from where the toolbar ends. */
.map-list-panel--drop { left: 10px; transform: none; }
.map-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 8px 4px 12px;
}
.map-list-head .map-cl-head { margin: 4px 0 0; }
.map-list-panel .map-cl-note { margin: 0; padding: 0 12px 8px; }
.map-list-rows.map-cl-list { max-height: none; }
.map-list-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin-top: -4px;
  font-size: 20px;
  line-height: 1;
  color: var(--text-dim);
  background: none;
  border: 0;
  cursor: pointer;
}
.map-list-close:hover { color: var(--accent); }
.map-list-rows {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 0;
  padding: 4px 8px 8px;
  overflow-y: auto;
  border-top: 1px solid var(--border-subtle);
}
.map-list-rows .map-cl-row { padding: 7px 4px; }
/* A section per place the events name ("London 5"), then "Not place-specific". */
.map-list-group {
  position: sticky;
  top: -4px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 4px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-surface);
}
.map-list-group-n { font-weight: 400; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* Location card: events that name the surrounding town, not a street. */
.gc-area-wide { margin-top: 4px; font-size: 11px; }
.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: var(--overlay-bg-soft) !important;
  color: var(--text-dim) !important;
  font-size: 11px !important;
}
.maplibregl-ctrl-attrib a { color: var(--text-secondary) !important; }

/* ----------------------------------------------------------------------
   Widget — static / notes
   ---------------------------------------------------------------------- */
/* Notes / SOPs widget — edge-to-edge editable textarea inside the
   widget chrome (which already provides the border + header + footer).
   The textarea is sized to fill via width/height: 100%; using flex on
   the form here would only stretch the cross axis, leaving the
   textarea at its default row-attribute height and creating a
   box-in-box. */
.notes-form {
  position: relative;
  height: 100%;
  width: 100%;
}
.notes-textarea {
  display: block;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: transparent;
  color: var(--text-primary);
  border: 0;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  outline: none;
}
.notes-textarea::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}
.notes-savedchip {
  position: absolute;
  right: 8px;
  top: 8px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 120ms, transform 120ms;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  color: var(--status-healthy);
  border: 1px solid var(--status-healthy);
  background: var(--status-healthy-bg-2);
  pointer-events: none;
}
.notes-savedchip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

.modal-backdrop {
  position: fixed; inset: 0;
  background: var(--scrim-strong);
  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;
  border-radius: var(--radius-md);
}
.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; }
.modal-body { padding: 20px; overflow: auto; }

.widget-picker-modal { width: 760px; }
.widget-picker-group {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.widget-picker-group + .widget-picker { margin-bottom: 22px; }
.widget-picker:last-child { margin-bottom: 0; }
.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: 12px 14px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.widget-picker .tile:hover {
  border-color: var(--accent);
  background: var(--bg-surface-3);
}
.widget-picker .tile-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.widget-picker .tile h4 { margin: 0; font-size: 14px; font-weight: 600; }
.widget-picker .tile p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }
/* Greyed out: the widget belongs to the other workspace mode. */
.widget-picker .tile-disabled { cursor: not-allowed; opacity: 0.45; }
.widget-picker .tile-disabled:hover { border-color: var(--border-subtle); background: var(--bg-surface-2); }
.widget-picker .tile-disabled .icon { color: var(--text-dim); }
.widget-picker .tile-note {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-dim);
}
.widget-picker .tile .icon {
  display: inline-block;
  width: 18px; height: 18px;
  flex: none;
  color: var(--accent);
  opacity: 0.85;
  transition: opacity 0.12s ease;
}
.widget-picker .tile .icon svg { display: block; width: 100%; height: 100%; }
.widget-picker .tile:hover .icon { opacity: 1; }

/* ----------------------------------------------------------------------
   Widget loading skeleton — placeholder shimmer shown until the widget's
   first HTMX body swap lands
   ---------------------------------------------------------------------- */

.widget-skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
}
.skeleton-line,
.skeleton-block {
  background: linear-gradient(
    90deg,
    var(--bg-surface-2) 25%,
    var(--bg-surface-3) 50%,
    var(--bg-surface-2) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
.skeleton-line { height: 10px; flex-shrink: 0; }
.skeleton-block { flex: 1; min-height: 24px; }

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line, .skeleton-block { animation: none; }
}

.widget-load-error {
  color: var(--text-dim);
  font-size: 11px;
  padding: 12px;
}

/* ----------------------------------------------------------------------
   Edit mode chrome — everything gated on #ws-page.editing (purely
   client-side state, toggled by app.js)
   ---------------------------------------------------------------------- */

/* Edit-only chrome is always in the markup (so 30s body re-swaps don't
   need to know the edit state) and hidden until .editing; view-only
   chrome does the inverse. display:contents keeps .page-header-actions
   flex gap on the buttons inside the action-set spans. */
.widget-remove { display: none; }
.editing .widget-remove { display: inline-block; }

.ws-actions-view { display: contents; }
.editing .ws-actions-view { display: none; }

.ws-actions-edit { display: none; }
.editing .ws-actions-edit { display: contents; }

/* Every widget gets a yellow edge while editing, so the mode is visible
   on the canvas itself and not only in the header buttons. Dragging /
   resizing brightens to the solid accent (rule in the Gridstack block). */
.editing .grid-stack > .grid-stack-item > .grid-stack-item-content {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
              0 0 14px color-mix(in srgb, var(--accent) 22%, transparent);
  cursor: move;
}
.editing .grid-stack > .grid-stack-item.ui-draggable-dragging > .grid-stack-item-content,
.editing .grid-stack > .grid-stack-item.ui-resizable-resizing > .grid-stack-item-content {
  box-shadow: 0 0 0 2px var(--accent);
}

.edit-banner {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  /* Purely an informational label — let drags/clicks pass through to the
     widget (and its resize handle) underneath, otherwise a widget in the
     bottom-right corner becomes un-resizable. */
  pointer-events: none;
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  padding: 10px 16px;
  font-size: 12px;
  color: var(--accent);
}
.editing .edit-banner { display: block; }

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

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

/* ----------------------------------------------------------------------
   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-size: 11px;
  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: 11px; color: var(--text-secondary); margin-top: 4px; }

/* 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 var(--accent-dashed);
  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: 11px; 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: 12px;
  font-weight: 600;
  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-size: 11px;
  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.not_configured .src-label { color: var(--text-secondary); }

.src-indicator { display: flex; align-items: center; }
/* Health dot is muted when a configured source is switched off — health
   is irrelevant for a non-pulling source, and a bright green dot on an
   off row mis-signals "this is on". */
.source-row:not(.enabled):not(.not_configured) .src-indicator .dot {
  background: var(--border-mid);
  box-shadow: none;
}
.src-meta { min-width: 0; }
.src-label {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}
.src-desc {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 4px;
}
.src-stats {
  font-size: 11px;
  color: var(--text-dim);
}

/* Source row on/off slider. The thumb position IS the state — clicking
   the switch flips it. Replaces the older ON/OFF pill where the label
   ambiguously named the current state rather than the action. */
.src-switch {
  background: transparent;
  border: 0;
  padding: 4px;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  line-height: 0;
}
.src-switch:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.src-switch-track {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-mid);
  transition: background 0.12s ease, border-color 0.12s ease;
}
.src-switch-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.12s ease, background 0.12s ease;
}
.src-switch[aria-checked="true"] .src-switch-track {
  background: var(--accent);
  border-color: var(--accent);
}
.src-switch[aria-checked="true"] .src-switch-thumb {
  transform: translateX(14px);
  background: var(--text-on-accent);
}
.src-switch:hover .src-switch-track { border-color: var(--accent); }

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

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

.section-heading {
  font-size: 12px;
  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-size: 12px;
  font-weight: 600;
  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);
}
.audience { font-size: 11px; color: var(--text-secondary); }
.card-desc { font-size: 13px; 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: 13px;
}
.reports-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  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;
  color: var(--accent);
}

/* --- Geoint floating filter bar -------------------------------------- */

/* Sits across the top of the map canvas. Search input on the left,
   facet dropdown buttons next to it, status text + clear on the right.
   Background blurs so the map stays visible behind it. */
.geoint-filterbar {
  position: absolute;
  top: 12px;
  left: 12px;
  /* Leave room for MapLibre's NavigationControl in the top-right. */
  right: 56px;
  z-index: 18;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--overlay-bg-soft);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(4px);
}
.gf-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 280px;
}
.gf-search-icon {
  position: absolute;
  left: 8px;
  font-size: 12px;
  color: var(--text-dim);
  pointer-events: none;
}
.gf-search input {
  width: 100%;
  padding: 6px 8px 6px 26px;
  font-size: 12px;
  color: var(--text-primary);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  outline: none;
}
.gf-search input:focus {
  border-color: var(--accent);
}
.gf-facets {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.gf-facet {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.12s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.gf-facet:hover { color: var(--accent); border-color: var(--accent); }
.gf-facet.active {
  color: var(--text-on-accent);
  background: var(--accent);
  border-color: var(--accent);
}
.gf-count:empty { display: none; }
.gf-count {
  padding: 0 4px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-3);
  color: var(--text-on-accent);
  font-size: 11px;
}
.gf-facet:not(.active) .gf-count {
  background: var(--text-dim);
  color: var(--bg-base);
}

/* TfL cameras toggle; the Watching button reopens the camera window */
.gf-cams.gf-cam-on {
  color: var(--text-on-accent);
  background: var(--accent);
  border-color: var(--accent);
}
.cam-watch-glyph { width: 11px; height: 11px; flex: none; }
.gf-cams-watching .cam-watch-glyph { width: 12px; height: 12px; }

/* Hover preview for a camera dot on any map (cam_peek.js): the still and
   the name, placed by script beside the dot inside its host. */
.cam-peek {
  position: absolute; z-index: 7; margin: 0; width: 180px; pointer-events: none;
  background: var(--bg-surface); border: 1px solid var(--border-mid); border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); overflow: hidden;
}
.cam-peek img { display: block; width: 100%; aspect-ratio: 352 / 288; object-fit: cover; background: #000; }
.cam-peek figcaption { padding: 5px 8px; font-size: 11px; line-height: 1.35; }
.cam-peek-name { display: block; font-weight: 600; color: var(--text-primary); }
.cam-peek-hint { display: block; color: var(--text-secondary); }
.cam-peek-hint.is-message { color: var(--accent); }

/* Area Cameras widget */
.area-cams { display: flex; flex-direction: column; height: 100%; }
.area-cams-grid {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}
.cam-tile {
  margin: 0; cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  transition: border-color 0.12s ease;
  border-radius: var(--radius-md);
}
.cam-tile:hover { border-color: var(--accent); }
.cam-tile-media { background: #000; aspect-ratio: 352 / 288; }
.cam-tile-media img, .cam-tile-media video {
  display: block; width: 100%; height: 100%; object-fit: cover;
}
.cam-tile figcaption { padding: 5px 7px; display: flex; align-items: center; gap: 6px; }
.cam-tile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
/* Watch: adds the camera to the user's camera window (cam_watch.js). */
.cam-tile-watch {
  flex: none; width: 24px; height: 24px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border-mid); border-radius: var(--radius-sm);
}
.cam-tile-watch:hover { color: var(--accent); border-color: var(--accent); }
.cam-tile-watch.is-on { color: var(--text-on-accent); background: var(--accent); border-color: var(--accent); }
.cam-tile-name { font-size: 11px; font-weight: 600;
  color: var(--text-primary); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.cam-tile-meta { font-size: 11px; color: var(--text-secondary); }
.cam-tile[data-playing] { border-color: var(--accent); }
.area-cams-attr { padding-top: 6px; font-size: 11px; color: var(--text-secondary); }
.area-cams-empty { color: var(--text-dim); padding: 8px; font-size: 13px; }
.gf-reset {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px dashed var(--border-subtle);
  cursor: pointer;
}
.gf-reset:hover { color: var(--accent); border-color: var(--accent); }
.gf-status {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-dim);
  min-width: 80px;
  text-align: right;
}

/* Map theme picker, in-bar variant: Geo-Intel's filter bar rather than a
   map's own toolbar. */
.gf-theme-select {
  position: static;
  height: 26px;
  padding: 0 6px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}
.gf-theme-select:hover { border-color: var(--accent); color: var(--accent); }

.gf-popover {
  position: absolute;
  z-index: 22;
  min-width: 240px;
  max-width: 320px;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
}
.gf-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.gf-popover-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.gf-popover-clear {
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}
.gf-popover-clear:hover { color: var(--accent); border-color: var(--accent); }
.gf-popover-body {
  overflow-y: auto;
  padding: 4px 0;
}
.gf-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}
.gf-opt:hover { background: var(--bg-surface-2); }
.gf-opt input[type=checkbox] { accent-color: var(--accent); }
.gf-empty {
  padding: 16px 14px;
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.45;
}
.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: var(--bg-deep); }

.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;
}

/* iPad portrait / phones (≤1023, matching the sidebar overlay breakpoint):
   the fixed-height 1fr/360px split squeezes the map column to ~400px, which
   overflows the floating filter bar + feed overlay (the +201px we measured).
   Stack instead — full-width map over the locations rail, page scrolls. */
@media (max-width: 1023px) {
  .geoint-page { height: auto; }
  .geoint-layout {
    grid-template-columns: 1fr;
    flex: none;
  }
  .geoint-map-wrap { height: 72vh; min-height: 380px; }
  .geoint-sidebar {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }
  /* Let the filter-bar controls wrap, and the search field flex, so the
     facets / status / theme select can't run off the right edge. */
  .geoint-filterbar { flex-wrap: wrap; row-gap: 6px; }
  .gf-search { flex: 1 1 160px; }
}

.section-heading-sm {
  font-size: 11px;
  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);
}

.geoint-section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.geoint-section-title-row .section-heading-sm {
  flex: 1;
  margin-bottom: 0;
  border-bottom: 0;
}

/* --- 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;
  border-radius: var(--radius-md);
}
.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: 11px; color: var(--text-dim); }

.role-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border: 1px solid currentColor;
  color: var(--text-secondary);
}
.role-principal { color: var(--accent); }
.role-school    { color: var(--sev-medium); }
.role-social    { color: var(--text-secondary); }
.role-office    { color: var(--text-secondary); }
.role-secondary { color: var(--text-secondary); }

/* Seeded example NAIs — muted card chrome + an EXAMPLE chip so users can
   tell sample data from their own entries at a glance. */
.geo-card-example { border-style: dashed; opacity: 0.78; }
.geo-card-example:hover { opacity: 1; }
.nai-example-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border: 1px dashed var(--text-dim);
  color: var(--text-dim);
  background: transparent;
}

/* Workspace provenance chip — small inline tag showing which workspace a
   card belongs to. Only rendered when the user has >1 workspace, so the
   single-workspace experience stays unchanged. */
.ws-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  background: var(--bg-surface-3);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Time scrubber --------------------------------------------------- */

/* Bottom strip across the map. The histogram bars sit above a thin axis
   row and the preset buttons. Sits above the basemap, below the map
   navigation control. */
.time-scrubber {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 15;
  padding: 8px 12px 10px;
  background: var(--overlay-bg-soft);
  border: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  grid-template-areas:
    "hist preset"
    "axis preset";
  column-gap: 14px;
  row-gap: 2px;
  backdrop-filter: blur(4px);
}
.ts-histogram {
  grid-area: hist;
  display: flex;
  align-items: flex-end;
  height: 36px;
  gap: 1px;
}
.ts-bar {
  flex: 1 1 0;
  min-width: 1px;
  background: var(--text-dim);
  opacity: 0.45;
  min-height: 1px;
  transition: background 0.2s ease, opacity 0.2s ease;
}
.ts-bar.in-window {
  background: var(--accent);
  opacity: 1;
}
.ts-axis {
  grid-area: axis;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.ts-presets {
  grid-area: preset;
  display: flex;
  gap: 4px;
  align-self: center;
}
.ts-preset {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.12s ease;
}
.ts-preset:hover { color: var(--accent); border-color: var(--accent); }
.ts-preset.active {
  color: var(--bg-base);
  background: var(--accent);
  border-color: var(--accent);
}

/* --- NAI Add / Delete UI --------------------------------------------- */

/* Floating "Add location" button — bottom-right corner of the map. Stays above
   the map canvas and the OSINT overlay so the user can reach it whatever
   else is open. */
.nai-add-fab {
  position: absolute;
  right: 12px;
  /* Above the time scrubber (~78px tall + 12px bottom margin) so the two
     don't fight for the same corner. */
  bottom: 96px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-on-accent);
  background: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: filter 0.12s ease;
  border-radius: var(--radius-md);
}
.nai-add-fab:hover { filter: brightness(1.1); }
.nai-add-fab-plus {
  font-size: 18px;
  font-weight: 400;
  line-height: 0.7;
  position: relative;
  top: -1px;
}

/* Hint banner shown while "pick on map" mode is active. */
.nai-pick-hint {
  position: absolute;
  /* Below the geoint filter bar (top: 12px + ~34px tall) */
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  padding: 8px 14px;
  font-size: 12px;
  background: var(--accent);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-sm);
}
.nai-pick-cancel {
  margin-left: 6px;
  padding: 2px 6px;
  font: inherit;
  background: transparent;
  border: 1px solid var(--text-on-accent);
  color: var(--text-on-accent);
  cursor: pointer;
}

/* Single kebab dropdown for any "card" surface (NAI cards, workspace cards).
   Always visible (faded) so the affordance is discoverable without hover;
   brightens on parent-card hover. */
.geo-card { position: relative; }
.card-kebab-wrap {
  position: absolute;
  top: 4px;
  right: 4px;
}
.card-kebab {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
}
.geo-card:hover .card-kebab,
.ws-card-wrap:hover .card-kebab { color: var(--text-primary); }
.card-kebab:hover {
  color: var(--accent);
  border-color: var(--border-subtle);
  background: var(--bg-surface-2);
}

.card-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 2px;
  z-index: 5;
  min-width: 110px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}
.card-menu-item {
  display: block;
  width: 100%;
  padding: 6px 12px;
  text-align: left;
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-decoration: none;
}
.card-menu-item:hover { background: var(--bg-surface-3); color: var(--accent); }
.card-menu-item.danger:hover { background: var(--bg-surface-3); color: var(--sev-high-soft); }

/* --- Modal --- */

.nai-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* `display: flex` above overrides the browser's default `hidden` styling,
   so we re-assert it here for the attribute-based hide. */
.nai-modal {
  width: min(520px, 92vw);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
}
.nai-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.nai-modal-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.nai-modal-close {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 18px;
  width: 24px;
  height: 24px;
  cursor: pointer;
}
.nai-modal-close:hover { color: var(--text-primary); border-color: var(--border-subtle); }

.nai-form { padding: 16px 18px 18px; }
.nai-row + .nai-row, .nai-row + .nai-row-split, .nai-row-split + .nai-row {
  margin-top: 12px;
}
.nai-row label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.nai-row input[type="text"],
.nai-row input[type="number"],
.nai-row select {
  width: 100%;
  padding: 7px 10px;
  font: inherit;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.nai-row input:focus, .nai-row select:focus {
  outline: none;
  border-color: var(--accent);
}
.nai-row-inline { display: flex; gap: 6px; }
.nai-row-inline input { flex: 1; }
.nai-row-inline button {
  padding: 7px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
}
.nai-row-inline button:hover { color: var(--accent); border-color: var(--accent); }

.nai-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}
.nai-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.nai-coords {
  padding: 7px 10px;
  background: var(--bg-surface-2);
  border: 1px dashed var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
}

.nai-row-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.nai-form-error {
  margin-top: 12px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--sev-high-soft);
  border: 1px solid var(--sev-high);
  background: var(--sev-high-bg);
}

.nai-form-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.nai-btn-secondary, .nai-btn-primary {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
}
.nai-btn-secondary {
  background: transparent;
  color: var(--text-secondary);
}
.nai-btn-secondary:hover { color: var(--accent); border-color: var(--accent); }
.nai-btn-primary {
  background: var(--accent);
  color: var(--bg-base);
  border-color: var(--accent);
}
.nai-btn-primary:hover { filter: brightness(1.1); }

.gc-name {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 8px;
}

.gc-posture { display: flex; gap: 4px; margin-bottom: 8px; }
.pc {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border: 1px solid currentColor;
}
.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: 12px;
  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: 11px; }
.cat-tag {
  color: var(--text-dim);
  background: var(--accent-soft);
  padding: 1px 5px;
  border: 1px solid var(--border-subtle);
}
.gc-quiet { font-size: 11px; }

.gc-warning {
  margin-top: 8px;
  padding: 4px 8px;
  background: var(--sev-medium-bg);
  border-left: 2px solid var(--sev-medium);
  font-size: 11px;
  color: var(--sev-medium);
  display: flex;
  align-items: center;
  gap: 6px;
}
.warn-icon {
  font-weight: 700;
  width: 12px; height: 12px;
  border: 1px solid currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  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-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border: 1px solid currentColor;
}
/* Triage band (protests.scale). Minor is deliberately quiet — routine
   daily demos should read as background next to the larger ones. */
.att-unknown  { color: var(--text-dim); }
.att-minor    { color: var(--text-secondary); }
.att-moderate { color: var(--sev-medium); }
.att-major    { color: var(--sev-high); }
.protest-card.scale-minor, .protest-card.scale-unknown { border-left-color: var(--border-mid); }
.protest-card.scale-minor .pc-title, .protest-card.scale-unknown .pc-title { color: var(--text-secondary); }
.protest-card.scale-major { border-left-color: var(--sev-high); }
.protest-card.is-unconfirmed { border-left-style: dashed; opacity: 0.85; }
.unconfirmed-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border: 1px dashed var(--text-secondary);
  color: var(--text-secondary);
}

/* --- Protest Calendar widget --- */
.pcal { display: flex; flex-direction: column; height: 100%; }
.pcal-days { flex: 1; overflow-y: auto; padding: 4px 10px 8px; }
.pcal-day {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--border-subtle);
}
.pcal-region {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 10px 0 2px;
}
.pcal-row {
  display: grid;
  grid-template-columns: 84px 76px 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.pcal-time { font-size: 11px; color: var(--text-secondary); }
.pcal-title { color: var(--text-primary); line-height: 1.35; }
.pcal-meta { font-size: 11px; color: var(--text-dim); line-height: 1.4; }
.pcal-near { color: var(--sev-high); }
.pcal-row.scale-minor .pcal-title, .pcal-row.scale-unknown .pcal-title { color: var(--text-secondary); }
.pcal-row.is-active .pcal-time { color: var(--sev-medium); }
.pcal-empty { color: var(--text-dim); padding: 12px; font-size: 13px; }

.pc-when { font-size: 11px; color: var(--text-dim); }

.pc-title {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  line-height: 1.3;
}
.pc-meta { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; line-height: 1.4; }

.src-chip {
  display: inline-block;
  font-size: 11px;
  padding: 1px 5px;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  margin-right: 3px;
  margin-bottom: 2px;
}
.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: var(--sev-high-bg-2);
  border-left: 2px solid var(--sev-high);
  font-size: 11px;
  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: 11px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.4;
}

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

.osint-overlay {
  position: absolute;
  /* Filter bar sits at top:12 and is ~34px tall (6+22+8) — overlay
     starts below it. Time scrubber sits at bottom:12 and is ~84px tall
     — overlay ends above it. */
  top: 56px;
  left: 12px;
  bottom: 108px;
  /* Width was 340px back when there were 4 tabs (FEED/TELEGRAM/X/NEWS
     + WATCH). Adding BLUESKY pushed the tab row past the panel edge.
     380px lets all 6 tabs + the count/collapse meta fit on one row
     without the watch tab being clipped. */
  width: 380px;
  background: var(--overlay-bg);
  border: 1px solid var(--border-mid);
  display: flex;
  flex-direction: column;
  z-index: 5;
  backdrop-filter: blur(2px);
}

.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-size: 11px;
  font-weight: 600;
  /* 6px a side: six tabs + watch badge + meta fit the 380px panel in
     Inter with room to spare. */
  padding: 0 6px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.osint-tab:hover { color: var(--text-primary); }
.osint-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--cat-conflict);
}
.osint-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  flex-shrink: 0;
}
.osint-collapse,
.osint-reopen {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  font-size: 13px;
  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;
  /* Aligned with the OSINT overlay's top edge (below filter bar). */
  top: 60px;
  left: 12px;
  z-index: 5;
  width: 24px;
  height: 24px;
  background: var(--overlay-bg);
}

.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;
  border-radius: var(--radius-md);
}
.feed-card:hover { background: var(--accent-faint); }
.feed-card:last-child { border-bottom: 0; }
@keyframes feed-flash {
  0%   { background: var(--accent-glow); }
  100% { background: transparent; }
}

.feed-empty {
  padding: 24px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}

/* 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: 11px;
  font-weight: 700;
  color: var(--bg-surface);
  background: var(--accent);
  border-radius: var(--radius-md);
}

/* 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: var(--accent-faint);
}
.feed-card-watch:hover { background: var(--accent-soft); }

/* --- Settings: per-source caps table ----------------------------------- */
.caps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.caps-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  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-size: 13px;
  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-size: 11px;
  color: var(--text-dim);
}

.cat-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border: 1px solid currentColor;
  background: transparent;
}
.cat-conflict     { color: var(--cat-conflict); }
.cat-protest      { color: var(--cat-protest); }
.cat-cyber        { color: var(--cat-cyber); }
.cat-political    { color: var(--cat-political); }
.cat-health       { color: var(--cat-health); }
.cat-humanitarian { color: var(--cat-humanitarian); }

.sev-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  color: var(--text-on-accent);
  background: var(--text-dim);
}
. /* notable, pink/magenta */
. /* routine watching, green */
. /* elevated, amber */
. /* critical, red */

.feed-headline {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 4px;
}
.feed-location {
  font-size: 11px;
  color: var(--text-dim);
}
.feed-location .pin {
  color: var(--text-secondary);
  margin-right: 4px;
  font-size: 11px;
}
.signal {
  background: var(--bg-surface-2);
  border-left: 2px solid var(--accent);
  padding: 8px 10px;
  margin-bottom: 8px;
}
.signal:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------------------
   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-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}
.kv .v { font-size: 14px; color: var(--text-primary); }

.reality-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border: 1px solid currentColor;
  margin-right: 6px;
}
.reality-chip.live          { color: var(--status-healthy); }
.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 var(--status-healthy);
  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: 14px; text-transform: uppercase; letter-spacing: 0.04em; }
.sd-stats { font-size: 11px; color: var(--text-secondary); }

.src-debug details summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--text-secondary);
  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: 12px;
  margin-top: 8px;
}
.feed-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  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; }

/* ----------------------------------------------------------------------
   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;
  border-radius: var(--radius-md);
}

.settings-card-label {
  font-size: 11px;
  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-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  align-self: center;
}
.settings-dl dd {
  margin: 0;
  font-size: 13px;
  color: var(--text-primary);
}

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

.chip {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  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-size: 11px;
  font-weight: 700;
  padding: 0 5px;
  margin-right: 6px;
  vertical-align: 1px;
  border-radius: var(--radius-sm);
}
.chip-status-active    { color: var(--status-degraded); border: 1px solid var(--status-degraded); background: var(--status-degraded-bg); }
.chip-status-relevant  { color: var(--status-healthy); border: 1px solid var(--status-healthy); background: var(--status-healthy-bg); }
.chip-status-dismissed { color: var(--text-dim); border: 1px solid var(--border-mid); background: var(--bg-surface-2); }

/* The bar sits on the li's edge, clear of the row's padding, so the
   severity pill and a wrapped headline never run into it. */
li.triage-active   { box-shadow: inset 2px 0 0 var(--status-degraded); }
li.triage-relevant { box-shadow: inset 2px 0 0 var(--status-healthy); }
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: 12px;
  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-size: 11px;
  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-size: 12px;
  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: var(--status-degraded-bg-2); border-color: var(--status-degraded); color: var(--status-degraded); }
.qa-btn.qa-relevant.is-current { background: var(--status-healthy-bg-2); border-color: var(--status-healthy); color: var(--status-healthy); }
.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: var(--shadow-md);
}
.qa-reasons-label {
  width: 100%;
  font-size: 11px;
  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-size: 11px;
  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-size: 11px;
  cursor: pointer;
  padding: 2px 0;
}
.dismissed-toggle:hover { color: var(--accent); }
.alert-list-wrap:not(.show-dismissed) li.triage-dismissed { display: none; }

/* ----------------------------------------------------------------------
   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);
  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 { width: 18px; height: 18px; }
.ob-brand-name {
  font-size: 13px;
  font-weight: 600;
  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-size: 12px;
  color: var(--text-dim);
}
.ob-skip-form { margin: 0; }
.ob-skip-btn {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 12px;
  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;
}
/* The principals row grid carries 5 fields per row and needs more
   horizontal space than the other steps to stop Address from being
   squeezed. Other steps stay at the narrower 760px reading width. */
.ob-step.ob-step-principals { max-width: 960px; }
.ob-eyebrow {
  font-size: 11px;
  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: 13px; }
.ob-footnote { margin-top: 32px; }
.ob-warn { color: var(--sev-medium); font-size: 12px; }
.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-size: 12px;
  color: var(--text-dim);
  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-size: 11px;
  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: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Step 2 — principals row grid */
.ob-add-row {
  background: transparent;
  border: 1px dashed var(--border-mid);
  color: var(--text-secondary);
  padding: 8px 14px;
  font-size: 12px;
  cursor: pointer;
  margin: 4px 0 18px;
  display: inline-block;
}
.ob-add-row:hover { color: var(--accent); border-color: var(--border-strong); }

/* Step 2 redesign — person cards matching the People component. */
.ob-person-card {
  border: 1px solid var(--border-mid);
  background: var(--bg-surface);
  padding: 16px 18px;
  margin: 0 0 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ob-person-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
}
.ob-field { display: flex; flex-direction: column; gap: 4px; }
.ob-field > .ob-inline-label { margin-bottom: 0; }
.ob-field input[type=text],
.ob-field input[type=number],
.ob-field textarea {
  width: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  padding: 6px 8px;
  font-size: 14px;
}
.ob-field textarea { resize: vertical; line-height: 1.5; }
.ob-field input:focus,
.ob-field textarea:focus { outline: none; border-color: var(--accent); }

.ob-person-loc {
  border-top: 1px dashed var(--border-subtle);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ob-loc-list { display: flex; flex-direction: column; gap: 6px; }
/* role | label | address | radius | remove */
.ob-loc-row,
.ob-loc-head {
  display: grid;
  grid-template-columns: 110px 0.8fr 1.5fr 64px 24px;
  gap: 6px;
  align-items: center;
}
.ob-loc-head {
  padding: 0 2px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.ob-loc-row select,
.ob-loc-row input {
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  padding: 6px 8px;
  font-size: 14px;
  width: 100%;
  min-width: 0;
}
.ob-loc-row select:focus,
.ob-loc-row input:focus { outline: none; border-color: var(--accent); }
.ob-loc-remove {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.ob-loc-remove:hover { color: var(--sev-medium); }
.ob-add-loc {
  align-self: flex-start;
  background: transparent;
  border: 1px dashed var(--border-mid);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
}
.ob-add-loc:hover { color: var(--accent); border-color: var(--border-strong); }

.ob-person-remove {
  align-self: flex-end;
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-dim);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
}
.ob-person-remove:hover { border-color: var(--sev-medium); color: var(--sev-medium); }

/* Inline submit-in-flight indicator (geocoding takes a few seconds per address) */
.ob-submit-busy {
  display: inline-flex;
  align-items: center;
}
.ob-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ob-spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes ob-spin { to { transform: rotate(360deg); } }

/* Step 3 — two-axis keyword grid */
.ob-twocol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* Four shared rows — label, hint, textarea, foot. Each axis is a subgrid
     spanning them, so every row takes the max height across both columns.
     That keeps the two textareas aligned no matter how long either hint
     paragraph runs. */
  grid-template-rows: auto auto auto auto;
  gap: 0 24px;
  margin-bottom: 12px;
}
.ob-axis {
  display: grid;
  grid-row: span 4;
  grid-template-rows: subgrid;
}
.ob-axis-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.ob-axis-hint {
  font-size: 13px;
  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-size: 13px;
  line-height: 1.5;
  resize: vertical;
}
.ob-axis textarea:focus { outline: none; border-color: var(--accent); }
.ob-axis-foot { font-size: 11px; margin-top: 6px; }

/* Step 4 — workspace organisation choices */
.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-tag {
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 1px 6px;
  background: var(--accent-dim);
}
.ob-choice-inputs {
  margin-top: 12px;
  padding-left: 28px;
}
.ob-inline-label {
  display: block;
  font-size: 11px;
  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-size: 14px;
}

/* Step 4 redesign — standard watch block + optional A→B travel block. */
.ob-wsblock {
  border: 1px solid var(--border-mid);
  background: var(--bg-surface);
  padding: 16px 18px;
  margin: 14px 0;
  transition: border-color 150ms, background 150ms;
}
.ob-wsblock.is-selected { border-color: var(--accent); background: var(--accent-dim); }
.ob-wsblock-disabled { opacity: 0.55; }
.ob-wsblock-head { display: flex; align-items: center; gap: 12px; }
.ob-wsblock-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.ob-wsblock-body { margin: 8px 0 0; color: var(--text-secondary); font-size: 14px; line-height: 1.55; }
.ob-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.ob-toggle input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.ob-travel-fields { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.ob-travel-row { display: flex; align-items: flex-end; gap: 12px; }
.ob-travel-field { flex: 1; display: flex; flex-direction: column; }
.ob-travel-field-narrow { flex: 0 0 160px; }
.ob-travel-arrow { color: var(--accent); font-size: 18px; padding-bottom: 6px; flex: 0 0 auto; }
.ob-travel-field select,
.ob-travel-field input[type=text],
.ob-travel-field input[type=number] {
  width: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  padding: 6px 8px;
  font-size: 14px;
}
/* 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: 14px;
  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: var(--shadow-card);
  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-size: 11px;
  font-weight: 700;
  color: var(--accent);
  padding: 1px 6px;
  border: 1px solid var(--accent);
}
.tour-step-label {
  flex: 1;
  font-size: 11px;
  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-size: 13px;
  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: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.tour-step-body b { color: var(--text-primary); }
.tour-step-body code {
  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: 13px;
}

/* 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: var(--radius-sm);
}
/* The workspace top-bar nav is a horizontal scroll container
   (overflow-x:auto), which clips a highlighted tab's outline so it looks
   half-drawn. While a tab inside is glowing, let the container overflow so
   the full outline renders — matching the sidebar links. */
.ws-topbar-nav:has(.tour-glow) { overflow: visible; }
@keyframes tour-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50%      { box-shadow: 0 0 0 8px transparent; }
}

/* Navigation nudge — shown in lieu of an auto-navigation button when
   the next step lives on a different page. The element is injected as
   a sibling of .tour-body, NOT inside it, so it needs its own
   horizontal padding to match the rest of the panel content. The
   dotted top border is replaced by a solid one that aligns with the
   border-top on .tour-actions below, keeping the panel rhythm clean. */
.tour-nav-hint {
  margin: 0 16px;
  padding: 10px 0 4px;
  border-top: 1px dotted var(--border-subtle);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  font-style: italic;
}

/* ----------------------------------------------------------------------
   Travel workspace (purpose='travel') — A → B route-shaped dashboard
   ---------------------------------------------------------------------- */
.travel-arrow { color: var(--accent); font-size: 16px; }
.travel-corridor-note { color: var(--text-dim); }
.travel-warn { color: var(--sev-medium); }
.travel-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border: 1px solid;
}
.travel-status-green { color: var(--status-healthy); border-color: var(--status-healthy); background: var(--status-healthy-bg); }
.travel-status-amber { color: var(--status-degraded); border-color: var(--status-degraded); background: var(--status-degraded-bg); }
.travel-status-red   { color: var(--sev-high); border-color: var(--sev-high); background: var(--sev-high-bg); }
/* Snapshot — KPI grid. */
/* Map. */
/* Event list rows. */
/* Placeholder block for v2 sections. */
/* Sidebar — each workspace has an icon for its kind (a route, or a
   live watch on places), the same pair the Workspaces cards use, so the
   two can be told apart at a glance. The kind is not also italicised. */
.sidebar-ws-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-top: 3px;   /* centres the 14px icon on the name's 20px first line */
  color: var(--text-dim);
  flex-shrink: 0;
}

/* "On-route" badge on Planned-on-route items where the post geocoded
   inside the corridor — strongest signal we can give without LLM
   extraction of the actual planned location/time. */
.travel-match-chip {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 0 4px;
  border: 1px solid var(--border-mid);
}

/* Travel banner — endpoint summary above the widget grid on travel-
   mode workspaces. Reuses the existing .travel-status pill styles. */
.travel-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  margin: 0 0 12px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
}
.travel-banner-route {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.travel-banner-route .travel-arrow { color: var(--accent); font-size: 14px; }
.travel-banner-route .travel-corridor-note { color: var(--text-dim); }

/* Travel banner — inline route editor with clickable waypoint chips
   and + buttons for inserting/appending stops. Companion script
   lives in workspace.html. */
.travel-wp {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease;
}
.travel-wp:hover { border-color: var(--accent); color: var(--accent); }
.travel-wp-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: transparent;
  border: 1px dashed var(--border-mid);
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: border-color 120ms ease, color 120ms ease;
}
.travel-wp-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  border-style: solid;
}
.travel-wp-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.travel-wp-input {
  padding: 4px 8px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-base);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  outline: none;
  min-width: 280px;
}
.travel-wp-input:disabled { color: var(--text-dim); border-color: var(--border-mid); }
.travel-wp-cancel {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
}
.travel-wp-cancel:hover { color: var(--accent); }

/* Match-phrase chips on planned_on_route rows. Rendered via
   render_row's title_prefix_html so they sit between the status chip
   and the title text. Compact pill style so a row of 3-5 chips
   doesn't overwhelm the title. */
.travel-match-row {
  margin: 2px 0 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Waypoint group: chip + remove button rendered together so they
   move as a unit when the user reorders / removes stops. */
.travel-wp-group {
  display: inline-flex;
  align-items: center;
}
.travel-wp-remove {
  background: transparent;
  border: 1px solid var(--border-mid);
  border-left: 0;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  align-self: stretch;
}
.travel-wp-remove:hover {
  color: var(--sev-high-soft);
  border-color: var(--sev-high-soft);
}
.travel-wp-group .travel-wp {
  border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* ----------------------------------------------------------------------
   Workspace settings modal (shared by + New workspace and per-WS edit)
   ---------------------------------------------------------------------- */
.ws-settings-modal { width: 680px; }

/* Settings tab — the same form inline, with notifications and sources
   below it. */
.ws-settings-page { max-width: 760px; display: flex; flex-direction: column; gap: 36px; }
.ws-settings-form { padding: 0; }
.ws-settings-block .section-heading { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin: 0 0 4px 0;
}

.ws-settings-grid > input { width: 100%; margin-bottom: 12px; }
.ws-settings-grid > .form-label { margin-top: 4px; }

.ws-settings-section-h {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin: 18px 0 6px 0;
  font-weight: 600;
}

.ws-settings-persons {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  max-height: 200px;
  overflow-y: auto;
  padding: 6px 8px;
}
.ws-person-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px;
  cursor: pointer;
  font-size: 14px;
}
.ws-person-row:hover { background: var(--bg-surface); }
.ws-person-row input[type=checkbox] { accent-color: var(--accent); }
.ws-person-name { color: var(--text-primary); }

/* A principal's linked locations, shown as opt-out checkboxes under them. */
.ws-person-locations {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 0 4px 26px;
}
.ws-person-locations.ws-dim { opacity: 0.4; pointer-events: none; }
.ws-person-location {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
}
.ws-person-location:hover { background: var(--bg-surface); }
.ws-person-location input[type=checkbox] { accent-color: var(--accent); }
.ws-person-location-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-settings-quickadd {
  margin-top: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}
.ws-settings-quickadd summary {
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
  user-select: none;
  list-style: none;
}
.ws-settings-quickadd summary::-webkit-details-marker { display: none; }

/* Labelled inline field inside a quick-add row. Used to give small
   inputs (like the place radius) the same .form-label treatment the
   mode/travel block uses. */
.ws-quickadd-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ws-quickadd-field .form-label { margin: 0; }
.ws-settings-quickadd[open] summary {
  border-bottom: 1px solid var(--border-subtle);
}
.ws-quickadd-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.ws-quickadd-row { display: flex; gap: 8px; align-items: center; }
.ws-quickadd-row input,
.ws-quickadd-row select { flex: 1; min-width: 0; }

.ws-mode-row { display: flex; gap: 12px; margin-bottom: 8px; }
.ws-mode-option {
  flex: 1;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  cursor: pointer;
  font-size: 14px;
}
.ws-mode-option input[type=radio] { accent-color: var(--accent); margin-top: 2px; }

.ws-travel-block {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ws-travel-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ws-travel-row .form-label { flex: 0 0 80px; }
.ws-travel-row > select,
.ws-travel-row > input { flex: 1; }

.ws-settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* ----------------------------------------------------------------------
   Touch ergonomics — bump small icon-only controls toward a ~40px tap
   target on touch devices (iPad). `pointer: coarse` matches only when the
   primary input is touch, so desktop mouse users keep the compact sizing.
   Appended last so these win source-order over the base sizes above.
   ---------------------------------------------------------------------- */
@media (pointer: coarse) {
  .sidebar-toggle,
  .ws-topbar-burger,
  .theme-toggle {
    width: 40px;
    height: 40px;
  }
  .card-kebab { width: 34px; height: 34px; }
  .osint-collapse,
  .osint-reopen { width: 34px; height: 34px; }
  .osint-tab { padding-top: 10px; padding-bottom: 10px; }
  .gf-facet { min-height: 36px; }
}

/* Notification review (/notifications) — funnel decisions + Y/N labeling. */
.notif-mode {
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 12px;
  border: 1px solid;
}
.notif-mode-shadow { color: var(--sev-medium); border-color: var(--sev-medium); background: color-mix(in srgb, var(--sev-medium) 8%, transparent); }
.notif-mode-live   { color: var(--status-healthy); border-color: var(--status-healthy); background: color-mix(in srgb, var(--status-healthy) 8%, transparent); }
.notif-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border-subtle); }
.notif-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.notif-row:last-child { border-bottom: 0; }
.notif-row-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.notif-outcome {
  font-size: 11px;
  padding: 1px 7px;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
}
.notif-outcome-sent       { color: var(--status-healthy); border-color: var(--status-healthy); }
.notif-outcome-queued     { color: var(--accent); border-color: var(--accent); }
.notif-outcome-shadow     { color: var(--sev-medium); border-color: var(--sev-medium); }
.notif-outcome-suppressed { color: var(--text-dim); }
.notif-outcome-failed     { color: var(--sev-high); border-color: var(--sev-high); }
.notif-ws { font-size: 12px; color: var(--text-secondary); }
.notif-time { font-size: 11px; color: var(--text-dim); }
.notif-headline { font-size: 14px; margin-top: 4px; }
.notif-headline a { color: inherit; }
.notif-meta { margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.notif-reason { font-size: 12px; color: var(--text-secondary); font-style: italic; }
.notif-sources { font-size: 11px; color: var(--text-dim); }
.notif-row-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.notif-btn { min-width: 30px; padding: 3px 8px; }
.notif-btn.is-current { border-color: var(--accent); color: var(--accent); }
.notif-label { font-size: 11px; }
.notif-label-useful { color: var(--status-healthy); }
.notif-label-not_useful { color: var(--sev-high); }
.notif-empty { padding: 30px; text-align: center; }

/* Ungated-candidate chips on /notifications (stopped-at column). */
.notif-outcome-uncorroborated { color: var(--text-dim); border-style: dashed; }
.notif-outcome-awaiting { color: var(--accent); border-color: var(--accent); border-style: dashed; }

/* ---------------------------------------------------------------------------
   Notification pipeline strip (/notifications). The funnel read left to
   right: stage counts joined by a √-scaled tapering band. Rejections are
   DELIBERATELY neutral gray — a reject is the system working; gold marks
   what flows on, --status-healthy marks what actually notified. */
.funnel-toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.funnel-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.funnel-chip {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--border-mid);
  background: none;
  color: var(--text-dim);
  cursor: pointer;
}
.funnel-chip:hover { border-color: var(--border-strong); color: var(--text-secondary); }
.funnel-chip.is-active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.funnel-heartbeat {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-dim);
  margin-left: auto;
}
.funnel-hb-ok { color: var(--status-healthy); }

.funnel-scroll { overflow-x: auto; }
.funnel-strip {
  display: flex;
  align-items: flex-start;
  min-width: 860px;
  padding: 10px 0 2px;
}
.funnel-node {
  flex: none;
  width: 108px;
  text-align: center;
  background: none;
  border: 1px solid transparent;
  padding: 8px 4px 6px;
  cursor: pointer;
}
.funnel-node:hover, .funnel-node:focus-visible { border-color: var(--border-mid); background: var(--accent-faint); }
.funnel-count {
  display: block;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}
.funnel-node.is-first .funnel-count { color: var(--text-secondary); }
.funnel-node.is-last .funnel-count { color: var(--status-healthy); }
.funnel-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 4px;
}
.funnel-unit { display: block; font-size: 11px; color: var(--text-dim); margin-top: 1px; }

.funnel-conn { flex: 1; min-width: 56px; }
.funnel-conn svg { display: block; width: 100%; height: 96px; }
.funnel-band { fill: var(--accent-dim); }
.funnel-band-edge { stroke: var(--accent-glow); stroke-width: 1; }
.funnel-drop {
  text-align: center;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-dim);
  padding: 2px 4px 0;
}
.funnel-drop-n { color: var(--text-secondary); font-weight: 600; font-variant-numeric: tabular-nums; }
.funnel-drop-why { display: block; }
.funnel-conn-note { display: block; font-style: italic; margin-top: 2px; }

.funnel-detail {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 12px 14px;
  margin: 14px 0 4px;
  min-height: 54px;
  font-size: 13px;
}
.funnel-stage-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.funnel-stage-title { color: var(--text-strong); font-weight: 600; }
.funnel-stage-crit { color: var(--text-dim); font-size: 12px; max-width: 78ch; }
.funnel-stage-caption {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 10px 0 2px;
}
.funnel-samples { list-style: none; margin: 0; padding: 0; }
.funnel-sample {
  display: flex;
  gap: 10px;
  padding: 5px 0;
  border-top: 1px dotted var(--border-subtle);
}
.funnel-sample:first-child { border-top: 0; }
.funnel-sample-verdict { flex: none; width: 14px; text-align: center; }
.funnel-sample-verdict.is-pass { color: var(--status-healthy); }
.funnel-sample-verdict.is-reject { color: var(--text-dim); }
.funnel-sample-verdict.is-deferred { color: var(--accent); }
.funnel-sample-title { color: var(--text-secondary); }
.funnel-sample-ws { font-size: 11px; color: var(--text-dim); margin-left: 8px; }
.funnel-sample-why { display: block; font-size: 12px; color: var(--text-dim); }
.funnel-samples-empty { padding: 8px 0; }

/* ---- Admin tables + tabs -------------------------------------------
   Shared by every /admin page. Cell dividers on all four edges so wide
   numeric tables (X spend) read as a grid rather than floating text. */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border: 1px solid var(--border-mid);
}
.admin-table th,
.admin-table td {
  padding: 7px 10px;
  border: 1px solid var(--border-subtle);
  vertical-align: middle;
  text-align: left;
}
.admin-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-base);
  white-space: nowrap;
}
.admin-table th.num,
.admin-table td.num {
  text-align: right;
  white-space: nowrap;
}
.admin-table tbody tr:hover td { background: var(--bg-base); }
.admin-table tfoot td {
  font-weight: 600;
  color: var(--text-primary);
  border-top: 1px solid var(--border-mid);
}
.admin-table .field-hint { margin-left: 5px; }
/* Row buttons stay on one line; the table scrolls if that is too wide. */
.admin-table-actions { white-space: nowrap; }

/* A wide table scrolls sideways inside its panel instead of pushing past
   it. Not for tables with ? tooltips: an overflow wrapper clips them. */
.table-scroll { overflow-x: auto; }

.admin-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-mid);
  margin-bottom: 20px;
}
.admin-tabs a {
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.admin-tabs a:hover { color: var(--text-primary); }
.admin-tabs a.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

/* ---------------------------------------------------------------------
   Calendar (app/routers/calendar.py, templates/calendar.html).
   Month grid / week columns / day list, full width, detail panel on the
   right. Sizes are deliberately a step larger than the rest of the app:
   this page is read at a glance by someone deciding what to tell people.
   ------------------------------------------------------------------- */
.calx {
  display: flex; flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 40px);
  height: calc(100dvh - var(--topbar-h) - 40px);
  margin: -20px; padding: 0; overflow: hidden;
  --calx-major: var(--sev-high);
  --calx-moderate: var(--sev-medium);
  --calx-unknown: var(--text-secondary);
  --calx-minor: var(--border-mid);
}
.calx-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 20px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.calx-nav { display: flex; align-items: center; gap: 6px; }
.calx-today { margin-right: 6px; }
.calx-label { margin: 0 0 0 12px; font-size: 18px; font-weight: 600; color: var(--text-primary); }
.calx-tools { display: flex; align-items: center; gap: 14px; }
.calx-views { display: inline-flex; border: 1px solid var(--border-mid); }
.calx-view {
  padding: 6px 14px; font-size: 13px; color: var(--text-secondary); text-decoration: none;
  border-right: 1px solid var(--border-mid);
}
.calx-view:last-child { border-right: 0; }
.calx-view:hover { color: var(--text-primary); }
.calx-view.active { background: var(--accent); color: var(--bg-base); }
.calx-filters { position: relative; }
.calx-filters > summary { list-style: none; cursor: pointer; }
.calx-filters > summary::-webkit-details-marker { display: none; }
.calx-filters > summary::after { content: " \25BE"; color: var(--text-dim); }
.calx-filters-body {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: max-content; gap: 0 32px;
  padding: 16px 20px 14px; background: var(--bg-surface); border: 1px solid var(--border-mid);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
}
.calx-filter-group { display: flex; flex-direction: column; gap: 1px; min-width: 150px; }
.calx-filter-name { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); margin: 0 0 8px 8px; }
.calx-option {
  display: flex; align-items: center; gap: 9px; padding: 6px 10px 6px 8px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.3; color: var(--text-secondary); text-decoration: none; white-space: nowrap;
}
.calx-option::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  border: 1px solid var(--border-mid); background: transparent;
}
.calx-option:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.calx-option.active { color: var(--text-primary); }
.calx-option.active::before { background: var(--accent); border-color: var(--accent); }
.calx-option-link { color: var(--accent); }
.calx-option-link::before { display: none; }

.calx-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.calx-main { min-width: 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.calx-month, .calx-week { overflow: hidden; }
.calx-empty { color: var(--text-dim); padding: 28px 20px; font-size: 14px; max-width: 760px; }

/* Month */
.calx-month { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.calx-weekdays {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
}
.calx-weekdays > div { padding: 8px 10px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
/* Rows share the height equally and never grow with content: the whole
   month is always on screen; cells fold what does not fit into "+N more". */
.calx-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 5), minmax(0, 1fr)); flex: 1; min-height: 0;
}
.calx-cell {
  position: relative; min-width: 0; min-height: 0; padding: 4px 5px 5px; overflow: hidden;
  border-right: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; gap: 3px;
}
.calx-cell:nth-child(7n) { border-right: 0; }
.calx-cell.is-outside { background: var(--bg-base); }
.calx-cell.is-outside .calx-cell-num, .calx-cell.is-past .calx-cell-num { color: var(--text-dim); }
.calx-cell.is-today { background: var(--accent-faint); }
.calx-cell-num {
  align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--text-primary);
  text-decoration: none; padding: 1px 5px; margin: 0; border-radius: var(--radius-sm); line-height: 1.3;
}
.calx-cell-num:hover { background: var(--bg-surface-2); }
.calx-cell.is-today .calx-cell-num { background: var(--accent); color: var(--bg-base); }
.calx-cell-events { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; min-height: 0; overflow: hidden; }
/* Month chips are one line each so a cell's capacity is predictable. */
.calx-month .ev-title { -webkit-line-clamp: 1; white-space: nowrap; display: block; text-overflow: ellipsis; }
.calx-month .ev { padding: 2px 6px 2px 6px; gap: 5px; }

/* Event chips: one size system for month, week and day */
.ev {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px; align-items: baseline;
  width: 100%; min-width: 0; padding: 4px 8px 4px 7px; text-align: left; cursor: pointer;
  font: inherit; font-size: 13px; line-height: 1.35; color: var(--text-primary);
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--calx-unknown); border-radius: var(--radius-sm);
}
.ev:hover { border-color: var(--accent); border-left-color: inherit; background: var(--bg-surface-2); }
.ev.is-selected { outline: 2px solid var(--accent); outline-offset: -1px; }
.ev.scale-major { border-left-color: var(--calx-major); }
.ev.scale-moderate { border-left-color: var(--calx-moderate); }
.ev.scale-unknown { border-left-color: var(--calx-unknown); }
.ev.scale-minor { border-left-color: var(--calx-minor); color: var(--text-secondary); }
.ev.is-unconfirmed { border-left-style: dashed; }
.ev.is-past { opacity: 0.55; }
.ev.kind-route .ev-title { color: var(--calx-major); }
.ev.scale-major .ev-title { font-weight: 600; }
.ev-time { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
/* Titles wrap to a couple of lines rather than vanishing into an ellipsis. */
.ev-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.ev-reason { grid-column: 2; font-size: 12px; color: var(--text-secondary); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.ev.kind-route .ev-reason { color: var(--calx-major); }
.ev-big { padding: 7px 10px 7px 9px; }
.ev-big .ev-title { -webkit-line-clamp: 3; }
/* Week columns are narrow: time sits above the title. */
.calx-week .ev-big { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.calx-week .ev-big .ev-reason { grid-column: 1; }
/* A week column has room: show the whole title and reason rather than clamping. */
.calx-week .ev-big .ev-title, .calx-week .ev-big .ev-reason { display: block; -webkit-line-clamp: unset; overflow: visible; }
.ev-more, .ev-minor {
  font-size: 12px; color: var(--text-secondary); text-decoration: none; padding: 2px 7px;
}
.ev-more:hover, .ev-minor:hover { color: var(--accent); }
.ev-minor { color: var(--text-dim); }

/* Week */
.calx-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); flex: 1; min-height: 0; }
.calx-col { min-width: 0; border-right: 1px solid var(--border-subtle); display: flex; flex-direction: column; }
.calx-col:last-child { border-right: 0; }
.calx-col.is-today { background: var(--accent-faint); }
.calx-col-head {
  display: flex; align-items: baseline; gap: 8px; padding: 10px 10px 8px; text-decoration: none;
  border-bottom: 1px solid var(--border-subtle);
}
.calx-col-dow { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.calx-col-num { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.calx-col.is-past .calx-col-num { color: var(--text-dim); }
.calx-col.is-today .calx-col-num { color: var(--accent); }
.calx-col-events { display: flex; flex-direction: column; gap: 4px; padding: 8px 6px; overflow: auto; }
.calx-col-none { color: var(--text-dim); padding: 8px; font-size: 13px; }

/* Day */
.calx-day { display: flex; flex-direction: column; gap: 6px; padding: 16px 20px; max-width: 860px; }
.calx-day .ev-big { font-size: 14px; }
.calx-minor { margin-top: 2px; }
.calx-minor > summary { cursor: pointer; font-size: 13px; color: var(--text-dim); padding: 6px 8px; list-style: none; }
.calx-minor > summary::-webkit-details-marker { display: none; }
.calx-minor > summary::before { content: "+ "; }
.calx-minor[open] > summary::before { content: "\2212 "; }
.calx-minor > summary:hover { color: var(--text-primary); }
.calx-minor .ev { margin-top: 4px; }

/* Calendar key (the toolbar's Key popover) */
.calx-legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-secondary); min-width: 300px; }
.calx-legend > div { display: flex; align-items: center; gap: 10px; }
.calx-key { display: inline-block; width: 14px; height: 14px; border-left: 4px solid var(--calx-unknown); background: var(--bg-base); border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); border-right: 1px solid var(--border-subtle); flex: 0 0 auto; }
.calx-key.scale-major { border-left-color: var(--calx-major); }
.calx-key.scale-moderate { border-left-color: var(--calx-moderate); }
.calx-key.scale-minor { border-left-color: var(--calx-minor); }
.calx-key.is-unconfirmed { border-left-style: dashed; }
.calx-legend-note { color: var(--calx-major); }

.gc-warning-link { cursor: pointer; }
.gc-warning-link:hover { text-decoration: underline; }

.calx-label, .calx-attn-text, .calx-attn-btn, .calx-add, .calx-filters > summary { white-space: nowrap; }

/* iPad and narrower: the header goes to two rows (navigation, then the
   actions). */
@media (max-width: 1180px) {
  .calx-head { flex-wrap: wrap; gap: 8px 16px; padding-bottom: 10px; }
  .calx-tools { flex: 1 1 100%; justify-content: flex-end; }
}
@media (max-width: 900px) {
  .calx-month .ev-time { display: none; }
  .calx-month .ev { grid-template-columns: minmax(0, 1fr); }
  .calx-week .ev-reason { display: none; }
}
@media (max-width: 760px) {
  .calx-head { flex-wrap: wrap; }
  .calx-tools { flex-wrap: wrap; }
  .calx-label { font-size: 15px; }
  .calx-filters-body { grid-auto-flow: row; max-width: calc(100vw - 48px); }
}

/* Review state: a dot on chips that are new or changed since the user
   last reviewed; a quiet count + "Mark all reviewed" in the header. */
.ev.is-new, .ev.is-changed { position: relative; padding-left: 16px; }
.ev.is-new::before, .ev.is-changed::before {
  content: ""; position: absolute; left: 5px; top: 50%; margin-top: -4px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.calx-key-dot { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin: 3px 0 0 2px; }
.calx-attn { display: flex; align-items: center; gap: 8px; margin-left: 18px; }
.calx-attn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.calx-attn-text { font-size: 13px; color: var(--text-primary); }
.calx-attn-btn {
  font: inherit; font-size: 12px; cursor: pointer; padding: 3px 9px;
  background: none; color: var(--text-secondary); border: 1px solid var(--border-mid); border-radius: var(--radius-sm);
}
.calx-attn-btn:hover { color: var(--text-primary); border-color: var(--accent); }

/* The user's own events: an Add button that reads as the primary action
   and tinted chips. The form itself lives in the sheet. */
.calx-add {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 7px 14px; min-height: 36px;
  background: var(--accent); color: var(--bg-base); border: 1px solid var(--accent); border-radius: var(--radius-sm);
}
.calx-add:hover { filter: brightness(1.08); }
.ev.is-manual { background: var(--accent-faint); border-left-style: double; border-left-width: 5px; }
.calx-key.is-manual { background: var(--accent-faint); border-left-style: double; border-left-width: 5px; }
.calx-danger { color: var(--sev-high); border-color: var(--sev-high-border); margin-left: auto; }
.calx-danger:hover { background: var(--sev-high-bg); color: var(--sev-high); }
.geocomplete-menu { z-index: 1300; }   /* above the sheet */

/* ---- The sheet: one way to open a data point ---------------------------
   Hosted by base.html (_sheet_host.html). Fragments: _event_sheet.html,
   _event_form.html, _item_sheet.html, _person_sheet.html, _watch_sheet.html.
   Docked right on desktop (the page stays live beside it), bottom sheet
   with a scrim below 760px. */
.sheet-backdrop { position: fixed; inset: 0; z-index: 95; pointer-events: none; }
.sheet {
  position: absolute; top: 0; right: 0; bottom: 0; width: 480px; max-width: 95vw;
  pointer-events: auto; overflow: auto;
  background: var(--bg-surface); border-left: 1px solid var(--border-strong);
  padding: 16px 18px 18px;
  transform: translateX(100%); transition: transform 220ms cubic-bezier(0.25, 0.8, 0.25, 1);
}
.sheet-backdrop:not([hidden]) .sheet { transform: none; }
@media (max-width: 759px) {
  .sheet-backdrop { pointer-events: auto; background: var(--scrim-strong); display: flex; align-items: flex-end; justify-content: center; }
  .sheet {
    position: relative; width: 100%; max-width: 100vw; max-height: 92vh;
    border: 1px solid var(--border-mid); border-bottom: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: none;
  }
}
.sheet-event { display: flex; flex-direction: column; gap: 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet-close {
  width: 36px; height: 36px; flex: none; cursor: pointer; font-size: 20px; line-height: 1;
  border: 1px solid var(--border-mid); background: var(--bg-surface-2); color: var(--text-secondary); border-radius: var(--radius-sm);
}
.sheet-close:hover { color: var(--text-primary); border-color: var(--accent); }
.sheet-when { font-size: 13px; color: var(--text-secondary); padding-top: 8px; }
.sheet-chip { font-size: 11px; margin-left: 6px; color: var(--accent); }
.sheet-chip.is-now { color: var(--sev-medium); }
.sheet-chip.is-past { color: var(--text-dim); }
.sheet-title { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.3; color: var(--text-primary); }
.sheet-title a { color: inherit; }
.sheet-title a:hover { color: var(--accent); }
.sheet-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.sheet-route { font-size: 13px; color: var(--text-secondary); }
.sheet-h { margin: 0 0 6px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.sheet-body-text { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-primary); overflow-wrap: anywhere; }
.sheet-image img { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--radius-sm); }
.sheet-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sheet-sources { display: flex; flex-direction: column; gap: 4px; }
.sheet-source {
  display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; font-size: 14px;
  background: var(--bg-base); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
}
.sheet-source a { color: var(--text-primary); }
.sheet-source a:hover { color: var(--accent); }
.sheet-source-seen { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.sheet-note { margin: 4px 0 0; font-size: 12px; color: var(--text-secondary); }
.sheet-facts { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.sheet-facts dt { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); padding-top: 2px; }
.sheet-facts dd { margin: 0; color: var(--text-primary); line-height: 1.5; }
.sheet-changes { margin: 0; padding: 0 0 0 14px; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.sheet-reaches > summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); padding: 6px 0; list-style: none; }
.sheet-reaches > summary::-webkit-details-marker { display: none; }
.sheet-reaches > summary::before { content: "+ "; }
.sheet-reaches[open] > summary::before { content: "\2212 "; }
.sheet-reaches > summary:hover { color: var(--text-primary); }
.sheet-reach {
  display: flex; flex-direction: column; gap: 3px; margin-top: 6px; padding: 10px 12px; text-decoration: none;
  background: var(--bg-base); border: 1px solid var(--border-subtle); border-left: 4px solid var(--border-mid);
  border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px; line-height: 1.4;
}
a.sheet-reach:hover { border-color: var(--accent); background: var(--accent-faint); color: var(--text-primary); }
.sheet-reach.kind-route { border-left-color: var(--calx-major); }
.sheet-reach.kind-near { border-left-color: var(--calx-moderate); }
.sheet-reach.kind-region, .sheet-reach.kind-none { color: var(--text-secondary); }
.sheet-reach-ws { font-size: 11px; color: var(--text-secondary); }
.sheet-reach-go { font-size: 12px; color: var(--text-secondary); text-decoration: underline; text-underline-offset: 3px; }
.sheet-review { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-review-state { font-size: 12px; color: var(--text-dim); }
.sheet-review-state.is-new, .sheet-review-state.is-changed { color: var(--accent); }
.sheet-review-state.is-new::before, .sheet-review-state.is-changed::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 6px;
}
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.sheet-actions .btn { min-height: 44px; padding: 0 18px; font-size: 14px; display: inline-flex; align-items: center; }
.sheet-actions form { margin-left: auto; }
.sheet-log { margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--text-secondary); }
.sheet-log li { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 6px 0; border-top: 1px solid var(--border-subtle); }
.sheet-log-time { color: var(--text-dim); }
.sheet-log-note { grid-column: 2; color: var(--text-dim); }
.sheet-error { padding: 12px; color: var(--text-secondary); }
/* Forms in the sheet */
.sheet-form { display: flex; flex-direction: column; gap: 12px; }
.sheet-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.sheet-field > span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.sheet-field input:not([type=radio]):not([type=checkbox]), .sheet-field textarea, .sheet-field select {
  width: 100%; box-sizing: border-box; min-height: 44px; padding: 10px 12px; font-size: 14px;
  color: var(--text-primary); background: var(--bg-base); border: 1px solid var(--border-mid); border-radius: var(--radius-sm);
}
.sheet-field textarea { min-height: 72px; resize: vertical; }
.sheet-field input:focus, .sheet-field textarea:focus, .sheet-field select:focus { outline: none; border-color: var(--accent); }
/* A row of chip toggles (radios): the reason picker */
.sheet-chip-opt { position: relative; }
.sheet-chip-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.sheet-chip-opt span {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; font-size: 13px; cursor: pointer;
  color: var(--text-secondary); background: var(--bg-base); border: 1px solid var(--border-mid); border-radius: var(--radius-sm);
}
.sheet-chip-opt span:hover { border-color: var(--accent); color: var(--text-primary); }
.sheet-chip-opt input:checked + span { background: var(--accent); color: var(--bg-base); border-color: var(--accent); font-weight: 600; }
.sheet-field input:disabled { opacity: 0.45; }
.sheet-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-secondary); min-height: 32px; }
.sheet-check input { width: 20px; height: 20px; accent-color: var(--accent); }
.sheet-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--border-mid); border-radius: var(--radius-sm); overflow: hidden; }
.sheet-seg-opt { position: relative; }
.sheet-seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.sheet-seg-opt span {
  display: flex; align-items: center; justify-content: center; min-height: 44px; font-size: 14px; cursor: pointer;
  color: var(--text-secondary); background: var(--bg-base); border-right: 1px solid var(--border-mid);
}
.sheet-seg-opt:last-child span { border-right: 0; }
.sheet-seg-opt input:checked + span { background: var(--accent); color: var(--bg-base); font-weight: 600; }
.sheet-quote {
  margin: 0; padding: 8px 12px; border-left: 3px solid var(--border-strong); background: var(--bg-surface-2);
  font-size: 14px; line-height: 1.45; color: var(--text-secondary); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.sheet-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1300;
  padding: 10px 16px; background: var(--bg-surface-2); border: 1px solid var(--border-mid); border-radius: var(--radius-md);
  font-size: 14px; color: var(--text-primary);
}
.sheet-toast a { color: var(--accent); margin-left: 6px; }
/* Brief rows that open the sheet */
.r-event-table tr[data-sheet] { cursor: pointer; }
.r-event-table tr[data-sheet]:hover td { color: var(--accent); }

/* ---- Accounts of concern (Network > Of concern) ------------------------ */
.person-avatar-subject {
  color: var(--sev-high);
  border-color: var(--sev-high-border);
  background: var(--sev-high-bg);
}
.subject-card { border-left: 2px solid var(--sev-high-border); }
.subject-badge,
.subject-mark {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--sev-high-border);
  background: var(--sev-high-bg);
  color: var(--sev-high);
  font-size: 11px;
  vertical-align: middle;
}
.subject-badge { margin-bottom: 6px; }
.subject-chip-plat {
  color: var(--text-dim);
  margin-right: 5px;
  font-size: 11px;
}
.subject-form { display: flex; flex-direction: column; gap: 14px; }
.subject-form .people-field > span { display: block; margin-bottom: 4px; }
.subject-handle-row,
.subject-link-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.subject-link-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.subject-handle-row select,
.subject-handle-row input,
.subject-link-row select {
  min-height: 44px;
  font-size: 14px;
}
.subject-add-handle { align-self: flex-start; }
.form-error {
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--sev-high-border);
  background: var(--sev-high-bg);
  color: var(--sev-high-soft);
  font-size: 13px;
}
.network-node.node-subject circle { fill: var(--sev-high); }
.network-links line.link-concern { stroke: var(--sev-high); stroke-opacity: 0.7; stroke-dasharray: 4 3; }

/* ---- Subject activity (posts + mentions, last 30 days) ----------------- */
.subject-activity { margin-bottom: 16px; }
.act-filter { display: flex; gap: 4px; }
.act-filter-btn {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-mid);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}
.act-filter-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.act-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.act-stat {
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.act-stat-value { font-size: 20px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.act-stat-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.act-strip {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 44px;
  padding: 0 0 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.act-bar {
  flex: 1 1 0;
  min-width: 0;
  height: max(2px, var(--h));
  background: var(--border-strong);
}
.act-bar.has-by { background: var(--sev-high); }
.act-list { display: flex; flex-direction: column; gap: 8px; }
.act-row {
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  border-left-width: 3px;
}
.act-row[data-kind="by"] { border-left-color: var(--sev-high); }
.act-row[data-kind="about"] { border-left-color: var(--border-strong); }
.act-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text-dim);
}
.act-kind-by { color: var(--sev-high); }
.act-when { margin-left: auto; }
.act-text { font-size: 14px; line-height: 1.45; color: var(--text-primary); overflow-wrap: anywhere; }
.act-open { display: inline-block; margin-top: 4px; font-size: 12px; text-decoration: underline; text-decoration-color: var(--accent-dashed); }
@media (max-width: 760px) {
  .act-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Subject indicators (warnings) ------------------------------------- */
.subject-indicators { margin-bottom: 16px; }
.ind-count {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-dim);
}
.ind-count.is-on { color: var(--sev-high); }
.ind-review { display: flex; align-items: center; gap: 10px; }
.ind-new-count { font-size: 12px; color: var(--sev-high); }
.ind-list { display: flex; flex-direction: column; gap: 6px; }
.ind-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}
.ind-row.is-on { border-color: var(--sev-high-border); background: var(--sev-high-bg); }
.ind-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--border-strong);
}
.ind-row.is-on .ind-dot { background: var(--sev-high); box-shadow: 0 0 0 3px var(--sev-high-bg-2); }
.ind-label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.ind-row:not(.is-on) .ind-label { color: var(--text-secondary); font-weight: 500; }
.ind-detail { font-size: 13px; color: var(--text-dim); margin-top: 2px; overflow-wrap: anywhere; }
.ind-row.is-on .ind-detail { color: var(--text-secondary); }
.ind-new, .ind-manual {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-size: 11px;
  vertical-align: middle;
  border: 1px solid var(--border-mid);
  color: var(--text-dim);
}
.ind-new { border-color: var(--sev-high-border); color: var(--sev-high); background: var(--bg-surface); }
.ind-since { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.ind-form { display: flex; gap: 6px; align-items: center; }
.ind-form input[type=text] { min-height: 40px; width: 180px; max-width: 40vw; font-size: 14px; }
.ind-form .btn { min-height: 40px; }
.subject-warnings {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 8px;
  border: 1px solid var(--sev-high-border);
  background: var(--sev-high-bg);
}
.subject-warnings-count { font-size: 11px; color: var(--sev-high); }
.subject-warnings-list { font-size: 13px; color: var(--text-secondary); }
@media (max-width: 760px) {
  .ind-row { grid-template-columns: 14px minmax(0, 1fr); }
  .ind-side { grid-column: 2; }
  .ind-form input[type=text] { max-width: none; width: 100%; }
}

/* ---- "Watch this account" sheet, chips and the sidebar badge ----------- */
.sidebar-link-badge {
  margin-left: auto;
  min-width: 16px;
  padding: 0 5px;
  height: 15px;
  line-height: 15px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--sev-high);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
@media (min-width: 760px) {
}

.watch-btn {
  padding: 0 7px;
  min-height: 22px;
  border: 1px solid var(--border-mid);
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.watch-btn:hover { color: var(--accent); border-color: var(--accent); }
.concern-chip {
  display: inline-flex; align-items: center;
  padding: 0 7px;
  min-height: 20px;
  border: 1px solid var(--sev-high-border);
  background: var(--sev-high-bg);
  color: var(--sev-high);
  font-size: 11px;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit; cursor: pointer;   /* also a <button> in the sheet */
}
.concern-chip:hover { color: var(--sev-high); border-color: var(--sev-high); }
.concern-chip.is-new::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--sev-high); margin-right: 5px;
}
.subject-prefill-note {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: var(--accent-dim);
  font-size: 14px;
}
.subject-prefill-note b { color: var(--text-primary); }
.td-card-head .watch-btn, .td-card-head .concern-chip { margin-left: 6px; }
.td-card-author-wrap { display: inline-flex; align-items: center; min-width: 0; }
.fc-head .concern-chip { margin-right: 4px; }
.act-row .watch-link { margin-left: 8px; color: var(--accent); text-decoration: underline; font-size: 11px; }
.subject-tabs { display: flex; gap: 4px; margin: 10px 0 0; }
.subject-tabs a {
  min-height: 36px; display: inline-flex; align-items: center;
  padding: 0 12px;
  border: 1px solid var(--border-mid); background: var(--bg-surface-2);
  color: var(--text-secondary); text-decoration: none; font-size: 12px;
}
.subject-tabs a:hover { color: var(--accent); border-color: var(--accent); }
.subject-tabs .count { margin-left: 6px; color: var(--sev-high); }
.subject-tabs a.is-current { color: var(--accent); border-color: var(--accent); background: var(--bg-surface); }
.subject-scroll-hint { margin: 10px 0 0; font-size: 12px; color: var(--text-dim); }

/* ---- Accounts of concern widget ---------------------------------------- */
.aoc-list { display: flex; flex-direction: column; }
.aoc-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  text-decoration: none;
}
.aoc-row:hover { background: var(--bg-surface-2); }
.aoc-row.is-on { background: var(--sev-high-bg); }
.aoc-row.is-on:hover { background: var(--sev-high-bg-2); }
.aoc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.aoc-row.is-on .aoc-dot { background: var(--sev-high); }
.aoc-main { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.aoc-name { font-size: 14px; font-weight: 600; }
.aoc-new {
  margin-left: 6px; padding: 0 5px; font-size: 11px;
  border: 1px solid var(--sev-high-border); color: var(--sev-high); background: var(--bg-surface);
  vertical-align: middle;
}
.aoc-detail { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aoc-since { font-size: 11px; color: var(--text-dim); white-space: nowrap; }

/* ---- Geo-Intel: filter bar in flow, map area below it -------------------
   The filter bar used to float over the map at a fixed height, and the
   feed overlay / pick hint / reopen handle assumed it was one row tall.
   At narrow widths it wrapped to several rows and covered the feed. Now
   the bar is a normal row above the map; everything that floats floats
   over .geoint-map-area, whose top is the bar's bottom whatever its
   height. */
.geoint-map-wrap { display: flex; flex-direction: column; }
.geoint-map-area { position: relative; flex: 1 1 auto; min-height: 0; }
.geoint-map { height: 100%; min-height: 0; }
.geoint-filterbar {
  position: static;
  top: auto; left: auto; right: auto;
  flex-wrap: wrap;
  row-gap: 6px;
  border-left: 0; border-right: 0; border-top: 0;
  backdrop-filter: none;
  background: var(--bg-surface);
}
.gf-search { flex: 1 1 240px; min-width: 160px; }
.gf-status { min-width: 0; }
.gf-popover { max-width: calc(100% - 16px); }
.osint-overlay {
  top: 12px;
  width: min(380px, calc(100% - 24px));
}
.osint-reopen { top: 16px; }
.nai-pick-hint { top: 16px; }
/* Scroll sideways if it must, but never show a bar: a horizontal bar
   takes its height out of the 34px strip and squashes the tabs. */
.osint-tabs { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.osint-tabs::-webkit-scrollbar { display: none; }

@media (max-width: 1023px) {
  .geoint-map-wrap { height: auto; min-height: 0; }
  .geoint-map-area { height: 72vh; min-height: 380px; }
}

/* Phones and narrow splits: facets become one scrollable row, the feed
   becomes a sheet over the lower part of the map so pins stay visible,
   and the add-location button moves to the top-left corner of the map
   where nothing else sits. */
@media (max-width: 640px) {
  .geoint-header { padding: 12px 16px; }
  .gf-facets {
    flex: 1 1 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .gf-facet { flex-shrink: 0; }
  .gf-status { display: none; }
  .geoint-map-area { height: calc(100vh - var(--topbar-h) - 140px); min-height: 420px; }
  .osint-overlay {
    top: 38%;
    left: 8px; right: 8px;
    width: auto;
    bottom: 100px;
  }
  .osint-reopen { top: calc(38% + 4px); left: 8px; }
  .nai-add-fab { top: 12px; left: 12px; right: auto; bottom: auto; padding: 6px 10px 6px 8px; }
  .nai-pick-hint { top: 52px; }
  .time-scrubber { left: 8px; right: 8px; bottom: 8px; padding: 6px 8px 8px; }
}

/* ---- Sidebar badge when the rail is collapsed --------------------------
   The red count sat beside the icon and spilled past the narrow rail.
   Collapsed, it becomes a small corner mark over the icon. */
body.shell[data-sidebar="closed"] .sidebar-link { position: relative; }
body.shell[data-sidebar="closed"] .sidebar-link-badge {
  position: absolute;
  top: 3px;
  right: 6px;
  margin: 0;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  padding: 0 4px;
  font-size: 11px;
}

/* ---- Subject page on phones ------------------------------------------- */
@media (max-width: 640px) {
  .subject-indicators .people-section-head { flex-wrap: wrap; gap: 10px; }
  .ind-review { flex-wrap: wrap; width: 100%; justify-content: space-between; }
  .ind-review .btn { white-space: nowrap; }
  .ind-new-count { flex: 1 1 100%; }
  .act-filter { flex-wrap: wrap; }
  .subject-tabs { flex-wrap: wrap; }
}

/* Below 1180 px (an iPad in landscape with the sidebar open, a laptop
   browser with the window split) the map column next to a 360 px
   locations rail is too narrow for the feed overlay and the map to share
   it. Stack the rail under the map from there, not only below 1024. */
@media (max-width: 1180px) {
  .geoint-page { height: auto; }
  .geoint-layout { grid-template-columns: 1fr; flex: none; }
  .geoint-map-wrap { height: auto; min-height: 0; }
  .geoint-map-area { height: 72vh; min-height: 380px; }
  .geoint-sidebar { border-left: none; border-top: 1px solid var(--border-subtle); }
}

/* ---- Geo-Intel locations panel: title row and hide / show ------------- */
.geoint-section-title-row { align-items: center; padding-bottom: 6px; }
.geoint-rail-hide { min-width: 28px; padding: 0 8px; font-size: 14px; line-height: 1; }
.geoint-page[data-rail="closed"] .geoint-layout { grid-template-columns: 1fr; }
.geoint-page[data-rail="closed"] .geoint-sidebar { display: none; }
.geoint-rail-show {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  writing-mode: vertical-rl;
  padding: 12px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--overlay-bg);
  border: 1px solid var(--border-mid);
  border-right: 0;
  cursor: pointer;
}
.geoint-rail-show:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 1180px) {
  /* The panel stacks under the map here; nothing to hide. */
  .geoint-rail-hide, .geoint-rail-show { display: none !important; }
  .geoint-page[data-rail="closed"] .geoint-sidebar { display: flex; }
}

/* The hide handle in the Locations header is a bare chevron, not a button box. */
.geoint-rail-hide { border: 0; background: transparent; color: var(--text-dim); box-shadow: none; }
.geoint-rail-hide:hover { color: var(--accent); background: transparent; }

/* ---- Investigate (accounts of concern) ---------------------------------
   Selectors on the left, tool cards on the right, the vehicle lookup and
   the record underneath. Cards are plain forms that open the tool in a
   new tab once the server has logged the run. Below 1024 the selectors
   stack on top; on phones the cards and the log go single column. */
.inv-lead { margin: 8px 0 0; font-size: 14px; color: var(--text-secondary); max-width: 640px; line-height: 1.5; }
.inv-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 0 20px; align-items: start; }
.inv-side { position: sticky; top: calc(var(--topbar-h) + 16px); }
.inv-dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; font-size: 14px; }
.inv-dl dt { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); padding-top: 3px; }
.inv-dl dd { margin: 0; overflow-wrap: anywhere; color: var(--text-primary); }
.inv-dl dd a { color: var(--accent); text-decoration: none; }
.inv-dl dd a:hover { text-decoration: underline; }
.inv-dd-list { display: flex; flex-direction: column; gap: 4px; }
.inv-platform { display: inline-block; min-width: 68px; font-size: 11px; color: var(--text-dim); }
.inv-ext { font-size: 12px; color: var(--text-dim); margin-left: 4px; }
.inv-side-actions { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.inv-edit-link { font-size: 13px; color: var(--text-secondary); }

.inv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.inv-card { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 14px; background: var(--bg-surface-2); border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
}
.inv-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; color: var(--text-primary); }
.inv-card-blurb { margin: 0; flex: 1; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.inv-card-action { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inv-card-action select,
.inv-card-action input[type=url] { flex: 1 1 140px; min-width: 0; min-height: 40px; font-size: 14px; }
/* Links styled as buttons do not centre their text the way <button> does,
   so centre it explicitly inside the 40px tap target. */
.inv-card-action .btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.inv-target { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
.inv-missing { flex: 1; font-size: 13px; color: var(--text-dim); }
.inv-image-form { grid-column: 1 / -1; max-width: 640px; }
.inv-image-form input[type=url] { flex: 1 1 260px; }

.inv-vrm-form { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.inv-plate { width: 150px; min-height: 44px; font-size: 16px; letter-spacing: 0.08em; text-transform: uppercase; }
.inv-vrm-cards .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.inv-note { margin: 0; font-size: 13px; color: var(--text-dim); }
.inv-vrm-form .inv-note { flex: 1 1 200px; }
.inv-thumb img { display: block; width: 100%; max-width: 240px; border: 1px solid var(--border-mid); background: var(--bg-surface); }
.inv-image-src { display: block; width: 100%; max-height: 220px; object-fit: contain; border: 1px solid var(--border-mid); background: var(--bg-surface); }
.inv-record-title { font-size: 20px; font-weight: 600; line-height: 1.3; max-width: 760px; }
.inv-record-actions { flex-shrink: 0; align-items: center; gap: 8px 14px; flex-wrap: wrap; justify-content: flex-end; }
.inv-record-actions .btn { white-space: nowrap; }
.inv-links { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.inv-links a { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.page-back { display: block; width: fit-content; margin-bottom: 10px; font-size: 13px; color: var(--text-dim); }
.page-back:hover { color: var(--text-primary); }
.inv-error { margin: 0 0 10px; font-size: 14px; color: var(--sev-high); }
.inv-log-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.inv-log-table th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border-subtle); font-size: 11px; color: var(--text-dim); font-weight: 500; }
.inv-log-table td { padding: 8px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; overflow-wrap: anywhere; color: var(--text-primary); }
.inv-log-table td:first-child { white-space: nowrap; font-size: 12px; color: var(--text-secondary); }
.inv-log-tool { font-weight: 600; }
.inv-log-target { font-size: 13px; }

@media (max-width: 1023px) {
  .inv-layout { grid-template-columns: 1fr; }
  .inv-side { position: static; }
}
@media (max-width: 640px) {
  .inv-cards { grid-template-columns: 1fr; }
  .inv-side-actions { flex-direction: column; align-items: stretch; }
  .inv-log-table thead { display: none; }
  .inv-log-table tr { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); }
  .inv-log-table td { padding: 0; border: 0; }
  .inv-log-table td:first-child { white-space: normal; }
}

/* ---- Subject photos (Investigate panel, brief editor) ------------------ */
.person-avatar.has-photo { padding: 0; overflow: hidden; }
.person-avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-wrap { display: flex; flex-direction: column; gap: 10px; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.sp-item { margin: 0; }
.sp-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; border: 1px solid var(--border-mid); background: var(--bg-surface-2); }
.sp-item figcaption { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; font-size: 12px; color: var(--text-secondary); }
.sp-source { font-size: 11px; color: var(--text-dim); }
.sp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-change { color: var(--sev-high); }
.sp-remove { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: var(--text-dim); cursor: pointer; text-align: left; }
.sp-remove:hover { color: var(--sev-high); text-decoration: underline; }
.sp-empty { margin: 0; }
.sp-notice { margin: 0; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--bg-surface-2); font-size: 13px; line-height: 1.45; color: var(--text-secondary); }
.sp-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sp-upload-label { cursor: pointer; position: relative; overflow: hidden; }
.sp-upload-label input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.inv-holdings .sp-wrap { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border-subtle); }

/* ---- Save a find --------------------------------------------------------- */
.inv-find-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(120px, 1fr) minmax(0, 1.4fr) auto; gap: 8px; align-items: end; }
.inv-find-form .people-field { margin: 0; }
.inv-find-form input, .inv-find-form select { min-height: 44px; width: 100%; }
.inv-find-form .btn { min-height: 44px; }
@media (max-width: 900px) { .inv-find-form { grid-template-columns: 1fr 1fr; } .inv-find-form .inv-find-value { grid-column: 1 / -1; } }
@media (max-width: 640px) { .inv-find-form { grid-template-columns: 1fr; } }

/* ---- Brief editor -------------------------------------------------------- */
.bf-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 0 20px; align-items: start; }
.bf-form { display: flex; flex-direction: column; gap: 12px; }
.bf-form .people-field { margin: 0; }
.bf-form textarea, .bf-form input[type=text] { width: 100%; font-size: 14px; }
.bf-form textarea { min-height: 72px; resize: vertical; }
.bf-form-actions { display: flex; gap: 12px; align-items: center; }
.bf-preview { position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: 10px; }
.bf-preview-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.bf-preview-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bf-frame { border: 10px solid #1b1b1b; border-radius: var(--radius-lg); background: #1b1b1b; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.25); }
.bf-frame iframe { display: block; width: 100%; height: min(72vh, 760px); border: 0; background: #fff; }
@media (max-width: 1100px) {
  .bf-layout { grid-template-columns: 1fr; }
  .bf-preview { position: static; }
  .bf-frame iframe { height: 70vh; }
}

/* ---- Reverse image: pick a stored photo, or drop one in ------------------ */
.inv-image-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.inv-photo-chip { position: relative; width: 96px; cursor: pointer; margin: 0; }
.inv-photo-chip input { position: absolute; opacity: 0; inset: 0; }
.inv-photo-chip img { width: 96px; height: 96px; object-fit: cover; display: block; border: 2px solid var(--border-mid); background: var(--bg-surface); }
.inv-photo-chip span { display: block; margin-top: 4px; font-size: 12px; line-height: 1.3; color: var(--text-secondary); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.inv-photo-chip:hover img { border-color: var(--text-dim); }
.inv-photo-chip input:checked + img { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.inv-photo-chip input:focus-visible + img { outline: 2px solid var(--accent); outline-offset: 2px; }
.inv-drop { position: relative; width: 132px; height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 2px dashed var(--border-mid); color: var(--text-dim); font-size: 12px; line-height: 1.3; text-align: center; cursor: pointer; margin: 0; }
.inv-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.inv-drop-icon { font-size: 22px; line-height: 1; color: var(--accent); }
.inv-drop:hover, .inv-image-form.is-dragging .inv-drop { border-color: var(--accent); color: var(--text-secondary); background: var(--bg-surface); }
.inv-image-form.is-dragging { outline: 2px dashed var(--accent); outline-offset: -6px; }
.inv-image-form .inv-card-action input[type=url] { flex: 1 1 100%; }

/* ---- Text the brief to the team ----------------------------------------- */
.bt-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.bt-form .people-field { margin: 0; }
.bt-form select, .bt-form input[type=tel] { width: 100%; min-height: 44px; }
.bt-form .btn { min-height: 44px; }
.bt-preview { margin: 12px 0 0; padding: 10px 12px; border-left: 3px solid var(--border-mid); background: var(--bg-surface-2); font-size: 14px; line-height: 1.5; color: var(--text-secondary); overflow-wrap: anywhere; }
.bt-preview b { color: var(--text-primary); }
.bt-sends { margin-top: 14px; width: 100%; border-collapse: collapse; font-size: 14px; }
.bt-sends th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border-subtle); font-size: 11px; color: var(--text-dim); font-weight: 500; }
.bt-sends td { padding: 8px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; color: var(--text-primary); }
.bt-sends td.bt-when { white-space: nowrap; font-size: 12px; color: var(--text-secondary); }
.bt-sends .bt-dead { color: var(--text-dim); text-decoration: line-through; }
.bt-sends form { display: inline; }
.bt-revoke { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.bt-revoke:hover { color: var(--sev-high); text-decoration: underline; }
@media (max-width: 640px) {
  .bt-form { grid-template-columns: 1fr; }
  .bt-sends thead { display: none; }
  .bt-sends tr { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); }
  .bt-sends td { padding: 0; border: 0; }
  .bt-sends td.bt-when { white-space: normal; }
}code,
pre,
kbd,
.text-mono,
.ws-topbar-status,
.ws-card .stat,
.digest-volume,
.person-date,
.alert-meta-col .time,
.posture-cell .count,
.posture-cell .delta,
.network-metric-value,
.barchart .row .val,
.trend .axis,
.trend .legend,
.pol-corner,
.pol-hour,
.pol-day,
.coord-pop-value,
.cam-tile-name,
.source-group h2 .count,
.ts-axis,
.pcal-time,
.ev-time,
.fc-age,
.funnel-chip,
.funnel-drop,
.admin-table th.num,
.admin-table td.num,
.act-stat-value,
.ind-count,
.ind-new-count,
.ind-since,
.aoc-since,
.inv-target,
.inv-plate,
.inv-log-table td:first-child,
.inv-log-target,
.bt-sends td.bt-when,
.people-chip {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------
   The camera window (camera_window.html): a chrome-free window of looping
   TfL clips with a minimap in the corner. Drawn by cam_window.js.
   Colours are the theme tokens, so it follows the app's light/dark pick.
   --------------------------------------------------------------------- */
html:has(> body.camwin), body.camwin { height: 100%; }
body.camwin {
  margin: 0; padding: 0; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--bg-base); color: var(--text-primary);
}
.camwin-head {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px;
  padding: 8px 12px; border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.camwin-head h1 { margin: 0; font-size: 13px; font-weight: 600; color: var(--accent); }
.camwin-sub { font-size: 11px; color: var(--text-secondary); }
.camwin-attr { margin-left: auto; font-size: 11px; color: var(--text-dim); }
.camwin-stage { position: relative; flex: 1; min-height: 0; display: flex; }

/* Columns and rows are set by CamWall's fit() so the tiles fill the whole
   window with every camera on screen; each picture is cropped a little to
   its tile. A wall too crowded for that (.scrolls) scrolls instead. */
.camwin .wall {
  flex: 1; min-height: 0; overflow: hidden;
  display: grid; gap: 8px; padding: 8px;
  justify-content: center; align-content: center;
}
.camwin .wall.scrolls { overflow: auto; align-content: start; }
.wtile {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; margin: 0;
  border: 1px solid var(--border-subtle); background: var(--bg-surface);
  user-select: none; -webkit-user-select: none;
}
/* Drag a tile to reorder (two or more cameras). The picture takes the
   touch itself so a finger drags the tile instead of scrolling. */
.wall.multi .wtile { cursor: grab; }
.wall.multi .wtile-media { touch-action: none; }
.wall.multi .wtile.dragging {
  cursor: grabbing; position: relative; z-index: 5; opacity: 0.94;
  border-color: var(--accent); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}
/* The picture fills whatever box the grid gives its tile. Anchored to the
   top left, where TfL burns in the timestamp, so a crop takes the name
   strip along the bottom (repeated in our caption) or the logo on the
   right instead. */
.wtile-media { flex: 1; min-height: 0; background: #000; position: relative; overflow: hidden; }
.wtile-media img, .wtile-media video {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: left top;
}
.wtile-off {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 12px; text-align: center; font-size: 12px; color: var(--text-secondary);
}
.wtile figcaption {
  flex: none; display: flex; align-items: center; gap: 2px;
  height: 30px; padding: 0 4px 0 9px; font-size: 12px;
}
.wtile .nm {
  flex: 1; min-width: 0; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wtile .nm .vw { font-weight: 400; color: var(--text-secondary); }
.wtile .tbtn {
  flex: none; width: 24px; height: 24px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-secondary); border: 0; border-radius: var(--radius-sm);
  font-size: 16px; line-height: 1;
}
.wtile .tbtn:hover { color: var(--accent); background: var(--bg-surface-3); }

/* The minimap: a thumbnail bottom-right over the tiles, every camera a
   dot. It grows while the pointer is on it (or after a tap: .big), and
   then pans and zooms like any map. Its expand button opens it out
   (.open) to fill the stage for picking; the tiles stay in the DOM,
   hidden, so their clips keep playing. */
.camwin-map {
  position: absolute; z-index: 6; right: 12px; bottom: 12px; touch-action: none;
  width: 96px; height: 72px; opacity: 0.85;
  border: 1px solid var(--border-mid); border-radius: var(--radius-md);
  overflow: hidden; background: var(--bg-deep);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: width 0.18s ease, height 0.18s ease, opacity 0.18s ease;
}
.camwin-map:hover, .camwin-map.big, .camwin-map.open {
  width: min(300px, 40%); height: min(220px, 40%); opacity: 1;
}
.camwin-map #minimap { position: absolute; inset: 0; }
.camwin-map:not(.open) .maplibregl-ctrl { display: none; }
/* Top-left of the map box: expand while it is the thumbnail, × while it
   is opened out (never when the window is empty: the map is all there is). */
.camwin-map-expand, .camwin-map-close {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  width: 24px; height: 24px; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  background: var(--bg-surface); color: var(--text-secondary);
  border: 1px solid var(--border-mid); border-radius: var(--radius-sm);
  font-size: 16px; line-height: 1;
}
.camwin-map-expand svg { width: 12px; height: 12px; }
.camwin-map:hover .camwin-map-expand, .camwin-map.big .camwin-map-expand { display: inline-flex; }
.camwin-map-expand:hover, .camwin-map-close:hover { color: var(--accent); border-color: var(--accent); }
.camwin-map.open {
  inset: 0; width: auto; height: auto; border: 0; border-radius: 0; box-shadow: none;
}
.camwin-map.open .camwin-map-expand { display: none; }
.camwin-map.open .camwin-map-close { display: inline-flex; top: 10px; left: 10px; width: 28px; height: 28px; }
.camwin.map-open .wall { visibility: hidden; }
.camwin.is-empty .camwin-map-close { display: none; }

/* ---- Customer limits, the one line a blocked customer sees above an add form ---- */
.limit-notice {
  padding: 10px 12px;
  margin: 0 0 14px;
  font-size: 13px;
  background: var(--sev-high-bg);
  border: 1px solid var(--sev-high-border);
  color: var(--sev-high-soft);
}

/* The Limits cell on /admin/users and its edit modal */
.limits-cell {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: inherit; font: inherit; white-space: nowrap;
}
.limits-cell:hover { text-decoration: underline; }
.limit-at { color: var(--sev-medium); font-weight: 600; }
.limit-over { color: var(--sev-high); font-weight: 600; }
.limit-mode {
  margin-left: 6px; padding: 1px 6px; font-size: 10px; text-transform: uppercase;
  border: 1px solid var(--border-mid); color: var(--text-secondary);
}
.limits-modal { width: 420px; }
.limits-form label { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.limits-form label > span:first-child { flex: 0 0 90px; }
.limits-form input[type="number"] { width: 90px; }
.limits-form select { flex: 1; }
.limits-actions { margin: 14px 0; }
.limits-history-h { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; color: var(--text-secondary); }
.limits-history { margin: 0; padding-left: 16px; font-size: 12px; }
.limits-history li { margin-bottom: 4px; }

/* ----------------------------------------------------------------------
   Workspace dashboard (body.ws-dash): the page shell and the widgets on
   it, drawn the way the Workspaces page is. Scoped to the dashboard so
   the shared pieces it restyles (severity badge, chips, triage buttons)
   stay as they are on pages that have not had their turn yet.

   Rules of the scheme, from the Workspaces page:
   - a widget is a panel: 12px radius, one hairline, no fill bands;
   - text roles: 12px labels, 14px body, nothing smaller than 12px;
   - colour means status and always comes with a word; gold means
     "selected" or "yours" (a watch-list hit), not decoration;
   - hover is a tint, never a glow or a lift.
   Saved grid positions are untouched: only what is inside a cell moves.
   ---------------------------------------------------------------------- */

/* Page header: what the workspace is for, and the layout buttons. The
   top bar already carries the name, so there is no rule under this. */
body.ws-dash .page-header {
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 0;
  border-bottom: 0;
}
body.ws-dash .page-lead { line-height: 20px; }

/* Each panel sits 6px inside its grid cell, so panels are 12px apart;
   the grid is pulled out by the same 6px so the outer panels line up
   with the page header. */
body.ws-dash .grid-stack { margin: 0 -6px; }
body.ws-dash .grid-stack > .grid-stack-item > .grid-stack-item-content {
  inset: 6px;
  border-radius: 12px;
  transition: border-color 0.175s ease;
}
html:not([data-theme="light"]) body.ws-dash .grid-stack > .grid-stack-item > .grid-stack-item-content {
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
}

/* Widget head: a label, not a banner. */
body.ws-dash .widget-header {
  min-height: 40px;
  padding: 0 10px 0 16px;
  background: transparent;
}
body.ws-dash .widget-title {
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}
body.ws-dash .widget-title .name { color: inherit; }
body.ws-dash .widget-title .dot { width: 6px; height: 6px; box-shadow: none; }
body.ws-dash .widget-title .lozenge {
  padding: 0;
  border: 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
body.ws-dash .widget-actions .btn {
  padding: 4px 8px;
  font-size: 12px;
  line-height: 16px;
  border-radius: 6px;
  color: var(--text-secondary);
}
body.ws-dash .widget-actions .btn:hover {
  color: var(--text-strong);
  border-color: transparent;
  background: var(--bg-surface-3);
}
body.ws-dash .widget-link-glyph { width: 12px; height: 12px; }
body.ws-dash .widget-body { padding: 12px 16px 14px; }
body.ws-dash .widget-body.flush { padding: 0; }

/* Severity: a tinted chip with the word in it, as on the workspace cards. */
body.ws-dash .sev {
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  line-height: 24px;
  font-weight: 500;
  text-transform: capitalize;
}
body.ws-dash .sev.high   { background: var(--sev-high-bg-2); color: var(--sev-high-soft); }
body.ws-dash .sev.medium { background: var(--sev-medium-bg); color: var(--sev-medium); }
body.ws-dash .sev.low    { background: var(--bg-surface-3); color: var(--text-secondary); }

/* Alert rows (Alert Feed, Active Investigations, Watchlist). */
body.ws-dash .alert-list li { padding: 12px 10px 12px 16px; }
body.ws-dash .alert-row { gap: 12px; }
body.ws-dash .alert-meta-col { min-width: 68px; }
body.ws-dash .alert-meta-col .sev { margin-bottom: 6px; }
body.ws-dash .alert-meta-col .time { font-family: inherit; font-size: 12px; line-height: 16px; font-variant-numeric: tabular-nums; }
body.ws-dash .alert-title { font-size: 14px; line-height: 20px; margin-bottom: 4px; }
body.ws-dash .alert-meta { font-size: 12px; line-height: 16px; }
body.ws-dash .alert-subtitle { font-size: 12px; line-height: 16px; font-style: normal; }
body.ws-dash .alert-meta .text-mono { font-family: inherit; }

/* In a narrow column (the feed beside a map) the row stacks: severity,
   age and the triage buttons on one line, then the headline across the
   full width. Side by side, the headline was left about 170px and most
   were cut off. The list measures itself, so the same widget dragged
   wider goes back to one line per row. */
body.ws-dash .alert-list { container-type: inline-size; }
@container (max-width: 520px) {
  body.ws-dash .alert-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "meta actions" "text text";
    gap: 8px 12px;
    align-items: center;
  }
  body.ws-dash .alert-meta-col { grid-area: meta; display: flex; align-items: center; gap: 8px; min-width: 0; }
  body.ws-dash .alert-meta-col .sev { display: inline-block; margin: 0; }
  body.ws-dash .alert-meta-col .time { display: inline; text-align: left; }
  body.ws-dash .alert-text { grid-area: text; }
  body.ws-dash .qa-bar { grid-area: actions; padding-left: 0; }
}
body.ws-dash .alert-list-toggle { padding: 6px 16px; }
body.ws-dash .dismissed-toggle { font-size: 12px; }
body.ws-dash .dismissed-toggle:hover { color: var(--text-strong); }

/* Row tags: tinted, no outline. Green says it is happening now, gold
   that it matched your watch list, grey that the wording is a summary. */
body.ws-dash .chip-ai,
body.ws-dash .chip-live,
body.ws-dash .chip-watch,
body.ws-dash .chip-status {
  padding: 1px 6px;
  border: 0;
  border-radius: 4px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  vertical-align: 1px;
}
body.ws-dash .chip-ai    { color: var(--text-secondary); background: var(--bg-surface-3); }
body.ws-dash .chip-live  { color: var(--status-healthy-soft); background: var(--status-healthy-bg-2); }
body.ws-dash .chip-watch { color: var(--accent); background: var(--accent-dim); }
body.ws-dash .chip-status-active    { color: var(--status-degraded); background: var(--status-degraded-bg-2); }
body.ws-dash .chip-status-relevant  { color: var(--status-healthy-soft); background: var(--status-healthy-bg-2); }
body.ws-dash .chip-status-dismissed { color: var(--text-dim); background: var(--bg-surface-3); }

/* Triage buttons: big enough for a finger, quiet until used. */
body.ws-dash .qa-bar { gap: 4px; padding-left: 4px; }
body.ws-dash .qa-btn {
  width: 28px;
  height: 28px;
  font-size: 13px;
  border-color: var(--border-subtle);
  border-radius: 6px;
}
body.ws-dash .qa-btn:hover {
  color: var(--text-strong);
  border-color: var(--border-mid);
  background: var(--bg-surface-3);
}
body.ws-dash .qa-reasons {
  top: 32px;
  padding: 10px;
  gap: 6px;
  width: 220px;
  background: var(--bg-surface-2);
  border-color: var(--border-mid);
  border-radius: 10px;
}
body.ws-dash .qa-reasons-label { font-size: 12px; letter-spacing: 0.06em; }
body.ws-dash .qa-reason { padding: 4px 8px; font-size: 12px; border-radius: 6px; }
body.ws-dash .qa-reason:hover { color: var(--text-strong); background: var(--bg-surface-3); }
body.ws-dash .triage-note { border-radius: 0 6px 6px 0; font-style: normal; }

/* Map widget: the controls that float on the map. */
body.ws-dash .map-toolbar { top: 12px; left: 12px; gap: 8px; }
body.ws-dash .map-theme-select,
body.ws-dash .map-tray-btn {
  min-height: 32px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--overlay-bg-strong);
  border-color: var(--border-mid);
  border-radius: 8px;
}
body.ws-dash .map-theme-select:hover,
body.ws-dash .map-tray-btn:hover { color: var(--text-strong); border-color: var(--border-strong); }
body.ws-dash .map-fit-btn,
body.ws-dash .coord-pick-btn {
  width: 32px;
  height: 32px;
  color: var(--text-primary);
  background: var(--overlay-bg-strong);
  border-color: var(--border-mid);
  border-radius: 8px;
}
body.ws-dash .map-fit-btn { top: 12px; right: 12px; }
body.ws-dash .map-fit-btn:hover { color: var(--text-strong); border-color: var(--border-strong); }
body.ws-dash .map-legend { bottom: 12px; left: 12px; }
body.ws-dash .map-legend-toggle {
  height: 28px;
  line-height: 26px;
  padding: 0 12px;
  font-size: 12px;
  background: var(--overlay-bg-strong);
  border-radius: 8px;
}
body.ws-dash .map-legend-toggle:hover,
body.ws-dash .map-legend[open] .map-legend-toggle { color: var(--text-strong); border-color: var(--border-strong); }
body.ws-dash .map-legend-body { padding: 10px 12px; gap: 4px 16px; border-radius: 10px; }
body.ws-dash .map-legend-row { font-size: 12px; }

/* Area cameras. */
body.ws-dash .area-cams-grid { gap: 12px; }
/* The picture is clipped to the tile's corners, not the tile itself: a
   clipped grid item may shrink below its content and lose its caption. */
body.ws-dash .cam-tile { border-radius: 10px; }
body.ws-dash .cam-tile-media { border-radius: 9px 9px 0 0; overflow: hidden; }
body.ws-dash .cam-tile:hover { border-color: var(--border-strong); }
body.ws-dash .cam-tile figcaption { padding: 8px 10px; gap: 2px; }
body.ws-dash .cam-tile-name { font-size: 13px; line-height: 16px; }
body.ws-dash .cam-tile-meta { font-size: 12px; line-height: 16px; }
body.ws-dash .area-cams-attr { padding-top: 10px; font-size: 12px; color: var(--text-dim); }

/* Protest calendar. */
body.ws-dash .pcal-days { padding: 4px 16px 12px; }
/* A day is a heading over its protests: bold, with the rule above it
   (between days) and none between the heading and its own rows. */
body.ws-dash .pcal-day {
  margin-top: 8px;
  padding: 14px 0 2px;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 0;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--text-strong);
}
body.ws-dash .pcal-day:first-child,
body.ws-dash .pcal-region + .pcal-day { margin-top: 0; padding-top: 10px; border-top: 0; }
body.ws-dash .pcal-region { font-size: 12px; color: var(--text-strong); }
body.ws-dash .pcal-row {
  grid-template-columns: 88px 84px 1fr;
  gap: 12px;
  padding: 8px 0;
  font-size: 14px;
  border-radius: 0;
  border-bottom: 0;
}
body.ws-dash .pcal-time { font-size: 12px; }
body.ws-dash .pcal-title { line-height: 20px; }
body.ws-dash .pcal-meta { font-size: 12px; line-height: 16px; }
body.ws-dash .pcal-near { color: var(--sev-high-soft); }
body.ws-dash .attendance {
  display: inline-block;
  height: 22px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  line-height: 22px;
  font-weight: 500;
  text-transform: capitalize;
  background: var(--bg-surface-3);
}
body.ws-dash .att-moderate { background: var(--sev-medium-bg); }
body.ws-dash .att-major    { background: var(--sev-high-bg-2); color: var(--sev-high-soft); }

/* Threat posture: three counts. The cells are tints inside the panel,
   with no edge of their own. */
body.ws-dash .posture-cell {
  padding: 8px 12px;
  gap: 2px;
  border: 0;
  border-radius: 8px;
}
body.ws-dash .posture-cell .label {
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0;
  text-transform: capitalize;
}
body.ws-dash .posture-cell .count {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 24px;
  line-height: 28px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
body.ws-dash .posture-cell .delta-n {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-secondary);
}
body.ws-dash .posture-cell .delta {
  font-family: inherit;
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Network snapshot. */
body.ws-dash .network-widget { gap: 6px; }
body.ws-dash .network-metrics { gap: 8px; }
body.ws-dash .network-metric {
  gap: 0;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
}
body.ws-dash .network-metric-value {
  font-family: var(--font-sans);
  font-size: 20px;
  line-height: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
body.ws-dash .network-metric-label {
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-secondary);
}
body.ws-dash .network-person-chip,
body.ws-dash .network-empty-link {
  padding: 2px 8px;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  line-height: 16px;
  background: var(--bg-surface-3);
}
body.ws-dash .network-person-chip:hover,
body.ws-dash .network-empty-link:hover { color: var(--text-strong); }

/* Notes. */
body.ws-dash .notes-textarea { padding: 14px 16px; font-size: 14px; line-height: 22px; }
body.ws-dash .notes-textarea::placeholder { opacity: 1; }
body.ws-dash .notes-savedchip {
  right: 12px;
  top: 10px;
  padding: 1px 8px;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--status-healthy-soft);
}

/* Route strip above a travel dashboard: the stops in order, then the
   route's status. A panel like the widgets under it. Arrows are quiet
   connectors; the status is a tinted chip with its words. */
body.ws-dash .travel-banner {
  padding: 10px 12px 10px 16px;
  border-radius: 12px;
  background: var(--bg-surface);
}
html:not([data-theme="light"]) body.ws-dash .travel-banner {
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
}
body.ws-dash .travel-banner-route { gap: 8px; font-size: 12px; }
body.ws-dash .travel-banner-route .travel-arrow { color: var(--text-dim); }
body.ws-dash .travel-wp {
  padding: 5px 10px;
  font-size: 14px;
  line-height: 20px;
  background: var(--bg-surface-2);
  border-color: var(--border-subtle);
  border-radius: 8px;
}
body.ws-dash .travel-wp:hover { color: var(--text-strong); border-color: var(--border-strong); }
body.ws-dash .travel-wp-group .travel-wp { border-radius: 8px 0 0 8px; }
body.ws-dash .travel-wp-remove {
  padding: 4px 8px;
  border-color: var(--border-subtle);
  border-radius: 0 8px 8px 0;
  background: var(--bg-surface-2);
}
body.ws-dash .travel-wp-add {
  min-width: 24px;
  height: 24px;
  border-radius: 6px;
}
body.ws-dash .travel-wp-add:hover { color: var(--text-strong); border-color: var(--border-strong); }
body.ws-dash .travel-wp-input { padding: 5px 10px; font-size: 14px; border-radius: 8px; }
body.ws-dash .travel-status {
  display: inline-block;
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  font-size: 12px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
body.ws-dash .travel-status-green { color: var(--status-healthy-soft); background: var(--status-healthy-bg-2); }
body.ws-dash .travel-status-amber { background: var(--status-degraded-bg-2); }
body.ws-dash .travel-status-red   { color: var(--sev-high-soft); background: var(--sev-high-bg-2); }
body.ws-dash .travel-match-chip {
  padding: 1px 6px;
  border: 0;
  border-radius: 4px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-secondary);
  background: var(--bg-surface-3);
}

/* Live escalations pinned above the grid. */
body.ws-dash .pinned-alerts { gap: 8px; margin-bottom: 12px; }
body.ws-dash .pinned-alert { border-radius: 12px; }
body.ws-dash .pinned-alert-sev { font-size: 12px; }

/* Route map: the stops and the key to the line's colours.

   A stop is a small numbered dot. Its name tag is hidden at the overview
   (three tags there covered half the route) and shows on hover, on tap
   (.is-open), or for every stop once the map is zoomed in close
   (.route-names on the map, set by route_map.js). The key says in words
   what each line colour means, since the line itself cannot. */
body.ws-dash .route-stop {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 2px solid var(--route-casing);
  border-radius: 50%;
  background: var(--text-strong);
  color: var(--route-casing);
  cursor: pointer;
}
body.ws-dash .route-stop-n {
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
body.ws-dash .route-stop-name {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: 200px;
  padding: 2px 8px;
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  background: var(--overlay-bg-strong);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
body.ws-dash .route-names .route-stop-name,
body.ws-dash .route-stop:hover .route-stop-name,
body.ws-dash .route-stop.is-open .route-stop-name { display: block; }
body.ws-dash .route-stop:hover,
body.ws-dash .route-stop.is-open { z-index: 3; }
body.ws-dash .route-key {
  position: absolute;
  bottom: 12px;
  left: 76px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  background: var(--overlay-bg-strong);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
}
body.ws-dash .route-key-item { display: inline-flex; align-items: center; gap: 6px; }
body.ws-dash .route-key-swatch { width: 18px; height: 4px; border-radius: 2px; flex: none; }
body.ws-dash .route-key-swatch--clear   { background: var(--route-clear); }
body.ws-dash .route-key-swatch--caution { background: var(--route-caution); }
body.ws-dash .route-key-swatch--danger  { background: var(--route-danger); }
@media (max-width: 560px) {
  /* On a phone the key keeps its colours and drops to short words. */
  body.ws-dash .route-key { gap: 10px; padding: 0 10px; }
  body.ws-dash .route-key-long { display: none; }
}

/* ----------------------------------------------------------------------
   Phone route view (templates/route_go.html, static/route_go.js): the
   page a route workspace shows on a phone. The body also has ws-dash,
   so the chips and stop dots above apply; the app's sidebar and top bar
   are hidden and the map takes the whole screen.

   Read at arm's length in a moving car, so body text is 14-17px and
   every control is at least 40px tall. Three fixed layers over the map:
   a slim bar on top, a warning banner under it (only while a threat is
   close ahead), and a sheet at the bottom that shows two lines closed
   and the list of threats open.
   ---------------------------------------------------------------------- */
body.ws-dash.route-go {
  display: block;
  position: fixed;
  inset: 0;
  overflow: hidden;
  /* No rubber-band scroll or pull-to-refresh under the map and sheet. */
  overscroll-behavior: none;
}
/* Taps act at once: no double-tap zoom on the controls, no grey flash. */
body.ws-dash.route-go .go button,
body.ws-dash.route-go .go a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
body.ws-dash.route-go .go button:active,
body.ws-dash.route-go .go-back:active { opacity: 0.7; }
body.ws-dash.route-go .sidebar,
body.ws-dash.route-go .sidebar-scrim,
body.ws-dash.route-go .ws-topbar { display: none; }
body.ws-dash.route-go main { padding: 0; }
body.ws-dash.route-go .go { position: fixed; inset: 0; height: 100vh; height: 100dvh; }
body.ws-dash.route-go .go-map { position: absolute; inset: 0; height: 100%; min-height: 0; }
body.ws-dash.route-go .go-map .maplibregl-ctrl-top-left { top: calc(env(safe-area-inset-top) + 60px); }

body.ws-dash.route-go .go-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 6px) 12px 6px 6px;
  background: var(--overlay-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}
body.ws-dash.route-go .go-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 40px;
  padding: 0 8px 0 4px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  text-decoration: none;
}
body.ws-dash.route-go .go-name {
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Warning banner: a tint of the severity colour on a solid surface, so
   it reads over any part of the map, with its words. */
body.ws-dash.route-go .go-warn {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 62px);
  left: 12px; right: 12px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border: 1px solid var(--sev-medium);
  border-radius: 12px;
  background: linear-gradient(var(--sev-medium-bg), var(--sev-medium-bg)), var(--bg-surface);
  color: var(--text-strong);
  text-align: left;
  font-size: 14px;
  line-height: 20px;
}
body.ws-dash.route-go .go-warn--high {
  border-color: var(--sev-high);
  background: linear-gradient(var(--sev-high-bg-2), var(--sev-high-bg-2)), var(--bg-surface);
}
body.ws-dash.route-go .go-warn strong { font-size: 16px; line-height: 22px; font-weight: 600; }
body.ws-dash.route-go .go-warn span {
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Map buttons, above the closed sheet. */
body.ws-dash.route-go .go-controls {
  position: absolute;
  right: 12px;
  bottom: calc(var(--go-peek, 100px) + 12px);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
body.ws-dash.route-go .go:has(.go-sheet[data-open="true"]) .go-controls { display: none; }
body.ws-dash.route-go .go-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-mid);
  border-radius: 12px;
  background: var(--overlay-bg-strong);
  color: var(--text-primary);
  cursor: pointer;
}
/* Blue is used for one thing only: you. */
body.ws-dash.route-go .go-btn.is-on { color: #4da3ff; }
body.ws-dash.route-go .go-btn[aria-pressed="true"] { border-color: #4da3ff; }
body.ws-dash.route-go .go-me-dot {
  width: 18px;
  height: 18px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #4da3ff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}

/* The sheet. */
body.ws-dash.route-go .go-sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  height: 72vh;
  height: 72dvh;
  border-top: 1px solid var(--border-mid);
  border-radius: 16px 16px 0 0;
  background: var(--bg-surface);
  /* One panel that slides: closed, it sits lower by all but its head
     (--go-closed, set by route_go.js from the head's real height). */
  transform: translateY(var(--go-closed, 100%));
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}
body.ws-dash.route-go .go-sheet[data-open="true"] { transform: translateY(0); }
/* While a finger is on it, it follows the finger with no easing. */
body.ws-dash.route-go .go-sheet.is-dragging { transition: none; }
@media (prefers-reduced-motion: reduce) {
  body.ws-dash.route-go .go-sheet { transition: none; }
}
body.ws-dash.route-go .go button.go-sheet-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: none;
  width: 100%;
  padding: 8px 16px calc(14px + env(safe-area-inset-bottom));
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: grab;
  /* The head is the handle: a swipe on it moves the sheet, not the page. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
body.ws-dash.route-go .go-grip {
  align-self: center;
  width: 36px;
  height: 4px;
  margin-bottom: 6px;
  border-radius: 2px;
  background: var(--border-strong);
}
body.ws-dash.route-go .go-summary { font-size: 17px; line-height: 22px; font-weight: 600; color: var(--text-strong); }
body.ws-dash.route-go .go-next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  font-size: 14px;
  line-height: 24px;
  color: var(--text-secondary);
}
body.ws-dash.route-go .go-sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* The list's own scroll never moves the page behind it. */
  overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--border-subtle);
}
/* Closed, the list is off-screen: keep it out of reach of taps and tabs. */
body.ws-dash.route-go .go-sheet[data-open="false"] .go-sheet-body {
  visibility: hidden;
  transition: visibility 0s linear 0.24s;   /* after the slide, not before it */
}
body.ws-dash.route-go .go-sheet.is-dragging .go-sheet-body { visibility: visible; transition: none; }
body.ws-dash.route-go .go-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 4px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-secondary);
}
body.ws-dash.route-go .go-swap {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}
body.ws-dash.route-go .go-note { margin: 4px 16px 8px; font-size: 13px; line-height: 18px; color: var(--text-dim); }
body.ws-dash.route-go .go-list { list-style: none; margin: 0; padding: 0; }
body.ws-dash.route-go .go-row { display: flex; align-items: stretch; border-top: 1px solid var(--border-subtle); }
body.ws-dash.route-go .go-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 8px 12px 16px;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
body.ws-dash.route-go .go-row-top { display: flex; align-items: center; gap: 10px; }
body.ws-dash.route-go .go-row-dist {
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}
body.ws-dash.route-go .go-row-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 15px;
  line-height: 20px;
  color: var(--text-primary);
}
body.ws-dash.route-go .go-row-meta { font-size: 13px; line-height: 18px; color: var(--text-secondary); }
body.ws-dash.route-go .go-row-more {
  flex: none;
  align-self: center;
  min-height: 40px;
  margin-right: 12px;
  padding: 0 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}
body.ws-dash.route-go .go-row--passed { opacity: 0.55; }
body.ws-dash.route-go .go-divider {
  padding: 12px 16px 6px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
/* Wider area: a section of its own, clearly apart from the route's
   threats above it. */
body.ws-dash.route-go .go-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
  padding: 16px 16px 10px;
  border-top: 6px solid var(--bg-base);
  background: var(--bg-surface-2);
}
body.ws-dash.route-go .go-section-title {
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  color: var(--text-strong);
}
body.ws-dash.route-go .go-section-sub { font-size: 13px; line-height: 18px; color: var(--text-secondary); }
body.ws-dash.route-go .go-row-where {
  min-width: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.ws-dash.route-go .go-wider-flag { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--sev-high-soft); }
body.ws-dash.route-go .go-empty { padding: 20px 16px; font-size: 14px; line-height: 20px; color: var(--text-secondary); }
body.ws-dash.route-go .go-key { position: static; display: inline-flex; margin: 12px 16px 16px; }

/* ----------------------------------------------------------------------
   Workspace tabs (body.ws-tab): Calendar, Share and Settings, on the
   same shell as the dashboard, in both themes. Same rules of the scheme:
   content sits in panels (12px radius, one hairline; glass in the dark
   theme, solid in the light one), inner pieces are tints with no edge of
   their own, nothing is set below 12px, and gold is kept for the one
   primary action and for what is selected.
   ---------------------------------------------------------------------- */

/* Shared pieces. */
body.ws-tab .page-header { margin-bottom: 16px; padding-bottom: 0; border-bottom: 0; }
body.ws-tab .page-lead { line-height: 20px; }
body.ws-tab .section-heading {
  margin: 0 0 12px;
  padding-bottom: 0;
  border-bottom: 0;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}
body.ws-tab main input[type="text"],
body.ws-tab main input[type="number"],
body.ws-tab main input[type="email"],
body.ws-tab main input[type="tel"],
body.ws-tab main select,
body.ws-tab main textarea {
  padding: 8px 12px;
  border-color: var(--border-subtle);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  line-height: 20px;
}
body.ws-tab main .btn { font-size: 14px; line-height: 20px; }
body.ws-tab main .btn:not(.btn-primary):not(.btn-danger):hover {
  color: var(--text-strong);
  border-color: var(--border-strong);
  background: var(--bg-surface-3);
}
/* A panel. */
body.ws-tab .ws-settings-block,
body.ws-tab .report-card,
body.ws-tab .calx-body {
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-surface);
}
html:not([data-theme="light"]) body.ws-tab .ws-settings-block,
html:not([data-theme="light"]) body.ws-tab .report-card,
html:not([data-theme="light"]) body.ws-tab .calx-body {
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
}

/* ---- Calendar: a toolbar, then the calendar in one panel. ---- */
body.ws-tab .calx { margin: 0; }
body.ws-tab .calx-head { padding: 0 0 12px; border-bottom: 0; }
body.ws-tab .calx-label {
  font-size: 20px;
  line-height: 24px;
  letter-spacing: -0.01em;
  color: var(--text-strong);
}
body.ws-tab .calx-body { overflow: hidden; }
/* The view switch is a segmented control: the chosen view is a strong
   neutral, so "Add event" stays the one gold thing in the toolbar. */
body.ws-tab .calx-views { border-color: var(--border-subtle); border-radius: 8px; overflow: hidden; }
body.ws-tab .calx-view { padding: 6px 14px; font-size: 14px; line-height: 20px; border-right-color: var(--border-subtle); }
body.ws-tab .calx-view.active { background: var(--bg-surface-3); color: var(--text-strong); font-weight: 600; }
body.ws-tab .calx-add { border-radius: 8px; font-size: 14px; line-height: 20px; }
body.ws-tab .calx-filters-body { padding: 16px 20px; border-color: var(--border-mid); border-radius: 12px; background: var(--bg-surface-2); }
body.ws-tab .calx-filter-name { margin-left: 8px; font-size: 12px; letter-spacing: 0.08em; }
body.ws-tab .calx-option { border-radius: 6px; font-size: 14px; }
body.ws-tab .calx-option:hover { background: var(--bg-surface-3); }
body.ws-tab .calx-option-link { color: var(--text-strong); text-decoration: underline; text-underline-offset: 3px; }
body.ws-tab .calx-weekdays > div { padding: 10px 12px; }
body.ws-tab .calx-cell { padding: 6px 6px 6px; gap: 4px; }
body.ws-tab .calx-cell.is-outside { background: transparent; }
body.ws-tab .calx-cell.is-outside .calx-cell-events { opacity: 0.7; }
body.ws-tab .calx-cell-num { border-radius: 6px; }
body.ws-tab .calx-cell-num:hover { background: var(--bg-surface-3); }
body.ws-tab .ev { border-radius: 6px; background: var(--bg-surface-2); }
body.ws-tab .ev:hover { border-color: var(--border-strong); background: var(--bg-surface-3); }
body.ws-tab .ev-more:hover,
body.ws-tab .ev-minor:hover { color: var(--text-strong); }
body.ws-tab .calx-col-head { padding: 12px 12px 10px; }
body.ws-tab .calx-col-events { padding: 8px; }
body.ws-tab .calx-day { padding: 20px; }
body.ws-tab .calx-attn-btn { border-radius: 8px; }

/* ---- Share: one card per kind of report. ---- */
body.ws-tab .reports-section { margin-bottom: 32px; }
body.ws-tab .report-cards { gap: 12px; }
body.ws-tab .report-card { padding: 20px; gap: 12px; }
body.ws-tab .report-card:hover { border-color: var(--border-strong); }
body.ws-tab .card-head { gap: 12px; align-items: center; }
/* The letter badge: a neutral tile, not a gold outline. */
body.ws-tab .card-icon {
  min-width: 36px;
  padding: 8px 0;
  border: 0;
  border-radius: 8px;
  background: var(--bg-surface-3);
  color: var(--text-strong);
  font-size: 14px;
  line-height: 20px;
}
body.ws-tab .card-head h3 { margin: 0 0 2px; font-size: 16px; line-height: 22px; color: var(--text-strong); }
body.ws-tab .audience { font-size: 12px; line-height: 16px; }
body.ws-tab .audience .text-mono { font-family: inherit; color: var(--text-primary); }
body.ws-tab .card-desc { font-size: 14px; line-height: 20px; }
body.ws-tab .card-action { justify-content: space-between; gap: 12px; margin-top: 4px; }
/* "For <workspace>" is set inline as tiny mono capitals; here it is a plain line. */
body.ws-tab .card-action .text-mono {
  font-family: inherit !important;
  font-size: 12px !important;
  line-height: 16px;
  letter-spacing: 0 !important;
  text-transform: none !important;
}
body.ws-tab .reports-table { font-size: 14px; }
body.ws-tab .reports-table th { padding: 10px 12px; font-size: 12px; letter-spacing: 0.04em; }
body.ws-tab .reports-table td { padding: 12px; }

/* ---- Settings: each block is a panel; its inner cards are tints. ---- */
body.ws-tab .ws-settings-page { max-width: 820px; gap: 16px; }
body.ws-tab .ws-settings-block { padding: 20px 24px 24px; }
body.ws-tab .ws-settings-block .section-heading { margin-bottom: 16px; }
body.ws-tab .ws-settings-grid > input { margin-bottom: 16px; }
body.ws-tab .form-label { margin-bottom: 6px; font-size: 12px; line-height: 16px; }
body.ws-tab .ws-settings-section-h { margin: 24px 0 6px; font-size: 12px; line-height: 16px; color: var(--text-primary); }
body.ws-tab .ws-settings-block .muted { font-size: 13px; line-height: 18px; }
body.ws-tab .ws-settings-persons,
body.ws-tab .ws-settings-quickadd,
body.ws-tab .ws-mode-option,
body.ws-tab .ws-travel-block {
  border: 0;
  border-radius: 8px;
  background: var(--bg-surface-2);
}
body.ws-tab .ws-settings-persons { max-height: 240px; padding: 8px; }
body.ws-tab .ws-person-row { padding: 6px 8px; border-radius: 6px; }
body.ws-tab .ws-person-row:hover,
body.ws-tab .ws-person-location:hover { background: var(--bg-surface-3); }
body.ws-tab .ws-person-location { padding: 4px 8px; border-radius: 6px; color: var(--text-secondary); }
body.ws-tab .ws-settings-quickadd summary { padding: 10px 12px; font-size: 14px; color: var(--text-primary); }
body.ws-tab .ws-settings-quickadd summary:hover { color: var(--text-strong); }
body.ws-tab .ws-quickadd-body { padding: 12px; gap: 10px; }
body.ws-tab .ws-mode-option { padding: 12px; }
body.ws-tab .ws-travel-block { padding: 12px 14px; }
body.ws-tab .ws-settings-actions { margin-top: 24px; padding-top: 16px; }

/* Notifications (their base rules are in the template). */
body.ws-tab .wsn-page { max-width: none; gap: 12px; }
body.ws-tab .wsn-card { padding: 16px; border: 0; border-radius: 8px; background: var(--bg-surface-2); }
body.ws-tab .wsn-card h2 { font-family: inherit; font-size: 14px; line-height: 20px; color: var(--text-strong); }
body.ws-tab .wsn-state,
body.ws-tab .wsn-band-current {
  padding: 2px 10px;
  border: 0;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  line-height: 20px;
  font-weight: 600;
  background: var(--bg-surface-3);
}
body.ws-tab .wsn-state-on,
body.ws-tab .wsn-band-current { color: var(--status-healthy-soft); background: var(--status-healthy-bg-2); }
body.ws-tab .wsn-band-opt { font-family: inherit; font-size: 13px; }
body.ws-tab .wsn-toggle-row .btn,
body.ws-tab .wsn-phone-form .btn { white-space: nowrap; }
body.ws-tab .wsn-band-blurb { font-size: 13px; line-height: 18px; }
body.ws-tab .wsn-hint { font-size: 13px; line-height: 18px; }
body.ws-tab .wsn-phone-form input { font-family: inherit; font-size: 14px; border-radius: 8px; background: var(--bg-surface); }
body.ws-tab .wsn-banner { border-radius: 8px; }

/* ---- Network, Of concern, Account, Notifications, TweetDeck, Admin ----
   These pages share one kit of parts (people-*, network-*, settings-*,
   admin-*, subject-*). Here the kit takes the scheme: boxes become
   panels, headings and figures are white (black in the light theme)
   where they were gold, small print comes up to 12px, and what is
   chosen in a switch is a strong neutral. */
body.ws-tab .page-header h1 { font-size: 20px; line-height: 24px; letter-spacing: -0.01em; color: var(--text-strong); }

/* Panels. */
body.ws-tab .people-tool,
body.ws-tab .people-section,
body.ws-tab .people-empty-card,
body.ws-tab .network-graph-shell,
body.ws-tab .network-record-card,
body.ws-tab .settings-card,
body.ws-tab .people-stat-block,
body.ws-tab .subject-warnings,
body.ws-tab .admin-table {
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-surface);
}
html:not([data-theme="light"]) body.ws-tab .people-tool,
html:not([data-theme="light"]) body.ws-tab .people-section,
html:not([data-theme="light"]) body.ws-tab .people-empty-card,
html:not([data-theme="light"]) body.ws-tab .network-graph-shell,
html:not([data-theme="light"]) body.ws-tab .network-record-card,
html:not([data-theme="light"]) body.ws-tab .settings-card,
html:not([data-theme="light"]) body.ws-tab .people-stat-block,
html:not([data-theme="light"]) body.ws-tab .subject-warnings,
html:not([data-theme="light"]) body.ws-tab .admin-table {
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
}
/* Pieces inside a panel are tints with no edge of their own. */
body.ws-tab .people-inline-form,
body.ws-tab .people-edge-row,
body.ws-tab .people-empty-note,
body.ws-tab .network-edit-form,
body.ws-tab .network-global-link,
body.ws-tab .network-metric {
  border: 0;
  border-radius: 8px;
  background: var(--bg-surface-2);
}

/* Figures and headings. */
body.ws-tab .people-stat-block { padding: 12px 16px; }
body.ws-tab .people-stat-value {
  font-family: var(--font-sans);
  font-size: 24px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}
body.ws-tab .people-stat-label,
body.ws-tab .people-section-kicker,
body.ws-tab .people-edge-kicker,
body.ws-tab .settings-card-label,
body.ws-tab .settings-dl dt,
body.ws-tab .network-metric-label,
body.ws-tab .td-label { font-size: 12px; line-height: 16px; letter-spacing: 0.06em; }
body.ws-tab .people-section-title,
body.ws-tab .people-empty-title,
body.ws-tab .network-inspector-title,
body.ws-tab .network-record-top h3,
body.ws-tab .people-profile-stats strong,
body.ws-tab .network-inspector-stats span { color: var(--text-strong); }
body.ws-tab .people-section-title { font-size: 16px; line-height: 22px; }
body.ws-tab .network-record-top h3 { font-size: 16px; line-height: 22px; }
body.ws-tab .people-edge-title a { color: var(--text-strong); text-decoration: underline; text-underline-offset: 3px; }
body.ws-tab .people-edge-title a:hover { color: var(--text-strong); }
body.ws-tab .people-profile-stats,
body.ws-tab .network-inspector-stats strong,
body.ws-tab .network-node text { font-size: 12px; }

/* Fields. */
body.ws-tab .people-field > span { font-size: 12px; line-height: 16px; }
body.ws-tab .field-hint { font-size: 12px; }
body.ws-tab .field-hint:hover,
body.ws-tab .field-hint:focus { color: var(--text-strong); border-color: var(--border-strong); }
body.ws-tab .field-required { color: var(--sev-medium); }
body.ws-tab .subject-prefill-note { color: var(--text-secondary); }

/* Chips and counts. */
body.ws-tab .people-chip,
body.ws-tab .people-section-count,
body.ws-tab .network-person-chip,
body.ws-tab .network-empty-link,
body.ws-tab .subject-badge,
body.ws-tab .subject-mark {
  border-radius: 6px;
  font-size: 12px;
  line-height: 16px;
}
body.ws-tab .people-chip,
body.ws-tab .people-section-count { padding: 2px 8px; border: 0; background: var(--bg-surface-3); color: var(--text-secondary); }
body.ws-tab .people-chip-accent { color: var(--text-strong); }
body.ws-tab .people-chip-more { color: var(--text-secondary); }
body.ws-tab .subject-chip-plat,
body.ws-tab .subject-warnings-count { font-size: 12px; }

/* Switches: the chosen one is a strong neutral, not a gold fill. */
body.ws-tab .network-type-toggle,
body.ws-tab .subject-tabs a {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 13px;
  line-height: 18px;
  color: var(--text-secondary);
  background: transparent;
}
body.ws-tab .network-type-toggle:hover,
body.ws-tab .subject-tabs a:hover { color: var(--text-strong); border-color: var(--border-strong); }
body.ws-tab .network-type-toggle.active,
body.ws-tab .subject-tabs a.is-current {
  color: var(--text-strong);
  border-color: var(--border-strong);
  background: var(--bg-surface-3);
  font-weight: 600;
}
body.ws-tab .network-edit-details > summary { font-size: 12px; }
body.ws-tab .network-edit-details > summary:hover,
body.ws-tab .network-edit-details[open] > summary { color: var(--text-strong); }
body.ws-tab .network-global-link:hover { color: var(--text-strong); background: var(--bg-surface-3); }
body.ws-tab .network-graph-canvas { border-radius: 8px; }

/* Admin: tabs and tables. */
body.ws-tab .admin-tabs a { font-size: 13px; line-height: 18px; }
body.ws-tab .admin-tabs a.active { color: var(--text-strong); }
body.ws-tab .admin-table { border-collapse: separate; border-spacing: 0; overflow: hidden; font-size: 14px; }
body.ws-tab .admin-table th,
body.ws-tab .admin-table td {
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
}
body.ws-tab .admin-table tr:last-child td { border-bottom: 0; }
body.ws-tab .admin-table th { font-size: 12px; letter-spacing: 0.04em; color: var(--text-secondary); }

/* Account. */
body.ws-tab .settings-card { padding: 20px; }

/* Settings / Debug: the figure tiles and source cards are panels too, and
   the smaller boxes inside them take the 8px and 4px corners. */
body.ws-tab .kv,
body.ws-tab .src-debug { border-radius: 12px; }
body.ws-tab .kv { padding: 12px 16px; }
body.ws-tab .duty-row,
body.ws-tab .poll-progress { border-radius: 8px; }
body.ws-tab .reality-chip { border-radius: 4px; }
body.ws-tab .settings-user-grid { margin-bottom: 24px; }
body.ws-tab .settings-dl dd { font-size: 14px; }
body.ws-tab .settings-dl .text-mono,
body.ws-tab .settings-card .text-mono { font-family: inherit; }

/* ---- TweetDeck: a deck of column panels, the last one a tile that adds
   a column (as "New workspace" does on the Workspaces page). The page
   has no heading of its own: the top bar names it. Base rules are in
   the template. ---- */
body.ws-tab .td-deck {
  gap: 12px;
  padding: 0;
  height: calc(100vh - var(--topbar-h) - 40px);
  height: calc(100dvh - var(--topbar-h) - 40px);
}
body.ws-tab .td-col {
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-surface);
  overflow: hidden;
}
html:not([data-theme="light"]) body.ws-tab .td-col:not(.td-col-new) {
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
}
body.ws-tab .td-col-head { padding: 12px 12px 12px 16px; background: transparent; }
body.ws-tab .td-col-title { font-size: 16px; line-height: 22px; margin-bottom: 6px; }
body.ws-tab .td-chip {
  padding: 2px 8px;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-secondary);
  background: var(--bg-surface-3);
}
body.ws-tab .td-chip-muted { color: var(--text-dim); background: transparent; padding-left: 0; }
body.ws-tab .td-col-actions .btn-icon { width: 32px; height: 32px; padding: 0; font-size: 14px; border-radius: 8px; }
body.ws-tab .td-col-empty { font-size: 14px; line-height: 20px; }
body.ws-tab .td-flash { margin: 0 0 12px; padding: 10px 14px; border-left: 0; border-radius: 8px; font-size: 14px; }
/* The tile: column-sized, dashed, quiet until hovered. */
body.ws-tab .td-col-new {
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px dashed var(--border-mid);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.175s ease, color 0.175s ease, background-color 0.175s ease;
}
html:not([data-theme="light"]) body.ws-tab .td-col-new { background: rgba(6, 15, 20, 0.35); }
body.ws-tab .td-col-new:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }
body.ws-tab .td-col-new-plus {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-mid);
  border-radius: 50%;
}
body.ws-tab .td-col-new:hover .td-col-new-plus { border-color: var(--accent); background: var(--accent-dim); }
body.ws-tab .td-col-new-label { font-size: 14px; line-height: 20px; font-weight: 600; }
/* With no columns yet: the tile, and beside it what a column is. */
body.ws-tab .td-empty {
  flex: 0 1 520px;
  align-self: flex-start;
  margin: 0;
  padding: 24px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  text-align: left;
}
body.ws-tab .td-empty p { margin: 0 0 8px; font-size: 14px; line-height: 20px; }
body.ws-tab .td-empty p:last-child { margin-bottom: 0; }
body.ws-tab .td-deck-note { align-self: center; margin: 0 8px; font-size: 13px; line-height: 18px; color: var(--text-dim); white-space: nowrap; }

/* ---- Geo-Intel: the map page. The map and its own colours are left
   alone; the parts around it take the scheme. Gold stays where it means
   "chosen": an active filter, the selected time window, the one "add a
   location" button. ---- */
body.ws-tab .geoint-count { font-size: 13px; line-height: 18px; color: var(--text-secondary); }
body.ws-tab .geoint-filterbar { border-color: var(--border-subtle); border-radius: 12px; }
/* The search field keeps room for its magnifier (the shared field rule resets padding). */
body.ws-tab main .gf-search input { padding-left: 34px; }
html:not([data-theme="light"]) body.ws-tab .geoint-filterbar {
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
}
body.ws-tab .gf-facet,
body.ws-tab .gf-reset,
body.ws-tab .gf-theme-select,
body.ws-tab .gf-popover-clear,
body.ws-tab .ts-preset,
body.ws-tab .geoint-rail-show,
body.ws-tab .gf-noplace {
  border-radius: 8px;
  font-size: 12px;
  line-height: 16px;
}
body.ws-tab .gf-facet:not(.active):hover,
body.ws-tab .gf-reset:hover,
body.ws-tab .gf-theme-select:hover,
body.ws-tab .gf-popover-clear:hover,
body.ws-tab .ts-preset:not(.active):hover,
body.ws-tab .geoint-rail-show:hover,
body.ws-tab .geoint-rail-hide:hover,
body.ws-tab .gf-noplace:hover,
body.ws-tab .card-kebab:hover,
body.ws-tab .osint-collapse:hover,
body.ws-tab .osint-reopen:hover { color: var(--text-strong); border-color: var(--border-strong); }
body.ws-tab .gf-count,
body.ws-tab .gf-status,
body.ws-tab .gf-popover-title,
body.ws-tab .section-heading-sm,
body.ws-tab .gc-loc,
body.ws-tab .gc-cats,
body.ws-tab .gc-quiet,
body.ws-tab .gc-warning,
body.ws-tab .gc-area-wide,
body.ws-tab .ts-axis,
body.ws-tab .osint-tab,
body.ws-tab .osint-tab-badge,
body.ws-tab .fc-age,
body.ws-tab .sev-chip,
body.ws-tab .cat-chip,
body.ws-tab .role-chip,
body.ws-tab .ws-chip,
body.ws-tab .nai-example-chip,
body.ws-tab .feed-location,
body.ws-tab .feed-table th,
body.ws-tab .nai-row label { font-size: 12px; }
body.ws-tab .cat-chip,
body.ws-tab .sev-chip,
body.ws-tab .role-chip,
body.ws-tab .ws-chip,
body.ws-tab .nai-example-chip { border-radius: 6px; }
/* Location cards. */
body.ws-tab .geo-card { border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-surface); }
html:not([data-theme="light"]) body.ws-tab .geo-card {
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
}
body.ws-tab .geo-card:hover { border-color: var(--border-strong); }
body.ws-tab .gc-name { color: var(--text-strong); }
body.ws-tab .card-kebab,
body.ws-tab .osint-collapse,
body.ws-tab .osint-reopen { border-radius: 6px; }
body.ws-tab .card-menu { border-radius: 8px; overflow: hidden; }
body.ws-tab .card-menu-item:hover { color: var(--text-strong); background: var(--bg-surface-3); }
/* The feed that floats on the map. */
body.ws-tab .osint-overlay { border-color: var(--border-mid); border-radius: 12px; overflow: hidden; }
body.ws-tab .feed-card:hover { border-color: var(--border-strong); }
/* Add / edit a location. */
body.ws-tab .nai-modal-head h3 { color: var(--text-strong); }
body.ws-tab .nai-row input[type="text"],
body.ws-tab .nai-row input[type="number"],
body.ws-tab .nai-row select,
body.ws-tab .nai-row-inline button,
body.ws-tab .nai-coords,
body.ws-tab .nai-form-error,
body.ws-tab .nai-btn-secondary,
body.ws-tab .nai-btn-primary,
body.ws-tab .nai-modal-close,
body.ws-tab .nai-pick-cancel { border-radius: 8px; }
body.ws-tab .nai-row-inline button:hover,
body.ws-tab .nai-btn-secondary:hover { color: var(--text-strong); border-color: var(--border-strong); }
body.ws-tab .nai-link { color: var(--text-strong); text-decoration: underline; text-underline-offset: 3px; }

/* ---- Notifications: the review page. The mode banner, the filter
   chips and each decision row were still outlined boxes in mono type.
   Here the banner is a tinted strip, the filters are rounded with the
   chosen one a strong neutral, the lists are panels, and a row's badges
   are tinted chips with their words, as on the dashboard. ---- */
body.ws-tab .sev {
  display: inline-block;
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  line-height: 24px;
  font-weight: 500;
  text-transform: lowercase;
}
body.ws-tab .sev::first-letter { text-transform: uppercase; }
body.ws-tab .sev.critical { background: var(--sev-high); color: #fff8f6; }
body.ws-tab .sev.high     { background: var(--sev-high-bg-2); color: var(--sev-high-soft); }
body.ws-tab .sev.medium   { background: var(--sev-medium-bg); color: var(--sev-medium); }
body.ws-tab .sev.low      { background: var(--bg-surface-3); color: var(--text-secondary); }

body.ws-tab .notif-mode {
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  font-size: 14px;
  line-height: 20px;
}
body.ws-tab .notif-mode-shadow { background: var(--sev-medium-bg); }
body.ws-tab .notif-mode-live { color: var(--status-healthy-soft); background: var(--status-healthy-bg-2); }

/* Filters. */
body.ws-tab .funnel-toolbar { gap: 12px; margin-bottom: 8px; }
body.ws-tab .funnel-chips { gap: 6px; }
body.ws-tab .funnel-chip {
  padding: 4px 10px;
  border-color: var(--border-subtle);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  line-height: 18px;
  color: var(--text-secondary);
}
body.ws-tab .funnel-chip:hover { color: var(--text-strong); border-color: var(--border-strong); }
body.ws-tab .funnel-chip.is-active {
  color: var(--text-strong);
  border-color: var(--border-strong);
  background: var(--bg-surface-3);
  font-weight: 600;
}
body.ws-tab .funnel-heartbeat { font-family: inherit; font-size: 12px; line-height: 16px; }

/* The pipeline strip and the stage it opens. */
body.ws-tab .funnel-node { border-radius: 8px; }
body.ws-tab .funnel-node:hover,
body.ws-tab .funnel-node:focus-visible { border-color: var(--border-mid); background: var(--bg-surface-3); }
body.ws-tab .funnel-unit,
body.ws-tab .funnel-drop,
body.ws-tab .funnel-label,
body.ws-tab .funnel-sample-ws,
body.ws-tab .funnel-stage-caption { font-size: 12px; }
body.ws-tab .funnel-detail,
body.ws-tab .notif-list {
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-surface);
}
html:not([data-theme="light"]) body.ws-tab .funnel-detail,
html:not([data-theme="light"]) body.ws-tab .notif-list {
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
}
body.ws-tab .funnel-detail { padding: 14px 16px; font-size: 14px; line-height: 20px; }

/* Decision rows. */
body.ws-tab .notif-list { overflow: hidden; }
body.ws-tab .notif-row { gap: 16px; padding: 14px 16px; }
body.ws-tab .notif-row-head { gap: 8px 10px; }
body.ws-tab .notif-outcome {
  padding: 2px 8px;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  line-height: 20px;
  color: var(--text-secondary);
  background: var(--bg-surface-3);
}
body.ws-tab .notif-outcome-sent   { color: var(--status-healthy-soft); background: var(--status-healthy-bg-2); }
body.ws-tab .notif-outcome-queued,
body.ws-tab .notif-outcome-awaiting { color: var(--text-strong); }
body.ws-tab .notif-outcome-shadow { color: var(--sev-medium); background: var(--sev-medium-bg); }
body.ws-tab .notif-outcome-failed { color: var(--sev-high-soft); background: var(--sev-high-bg-2); }
body.ws-tab .notif-outcome-suppressed,
body.ws-tab .notif-outcome-uncorroborated { color: var(--text-dim); }
body.ws-tab .notif-ws { font-size: 13px; line-height: 18px; color: var(--text-primary); }
body.ws-tab .notif-time,
body.ws-tab .notif-sources {
  font-family: inherit;
  font-size: 12px;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}
body.ws-tab .notif-headline { margin-top: 6px; font-size: 15px; line-height: 22px; color: var(--text-strong); }
body.ws-tab .notif-meta { gap: 4px 12px; align-items: baseline; }
body.ws-tab .notif-reason { font-size: 13px; line-height: 18px; font-style: normal; }
body.ws-tab .notif-label { font-size: 12px; }
body.ws-tab .notif-label-useful { color: var(--status-healthy-soft); }
body.ws-tab .notif-label-not_useful { color: var(--sev-high-soft); }
body.ws-tab .notif-row-actions form { display: inline-flex !important; gap: 6px; }
body.ws-tab main .notif-btn {
  min-width: 36px;
  height: 32px;
  padding: 0;
  border-color: var(--border-subtle);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
body.ws-tab main .notif-btn.is-current {
  color: var(--text-strong);
  border-color: var(--border-strong);
  background: var(--bg-surface-3);
}
body.ws-tab .notif-empty { border: 1px dashed var(--border-mid); border-radius: 12px; font-size: 14px; line-height: 20px; }

/* The dashboard's backdrop (dark): the page is the plain petrol dark,
   with two pictures along the top edge, seen through the glass of the
   top bar and running on behind the first row of widgets. Top left, the
   sign-in picture's cloud drawn in its own characters; top right, the
   lower sweep of the Obsidian Arc ring in the same characters.

   Both are shown at their natural size, not stretched to the window, so
   the arc keeps its shape and its place under the top bar at any width
   (background-design/dash_backdrops.py renders them). A fixed layer
   behind the shell, like the Workspaces backdrop. */
html:not([data-theme="light"]) body.backdrop-crest::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: -1;
  pointer-events: none;
  background:
    url("/static/img/dash-top-arc.webp?v=4") top right / 900px 380px no-repeat,
    url("/static/img/dash-top-cloud.webp?v=3") top left / 1400px 300px no-repeat,
    #03090c;
}

/* The same backdrop in the light theme: the cloud is a soft grey shading
   and the characters a dark grey ink, on the light page colour: neutral
   tones only, no blue, like the Workspaces page's light backdrop. The
   field of characters that rises from the bottom on the Workspaces page
   is not used here; the top bar becomes glass so the pictures show
   through it, as in the dark theme. Widgets stay solid white. */
html[data-theme="light"] body.backdrop-crest::before {
  background:
    url("/static/img/dash-top-arc-light.webp?v=3") top right / 900px 380px no-repeat,
    url("/static/img/dash-top-cloud-light.webp?v=2") top left / 1400px 300px no-repeat,
    #f6f7f9;
}
html[data-theme="light"] body.backdrop-crest::after { content: none; }
html[data-theme="light"] body.backdrop-crest .ws-topbar {
  background: rgba(246, 247, 249, 0.55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
