/* LastHour Admin -- base stylesheet.
   Dark navy "control center" theme (docs/admin/UI_VISUAL_CONTRACT.md).
   Every color routes through admin/static/tokens.css custom properties --
   no raw hex values here on purpose; a design-regression test guards this
   permanently. Overrides Bootstrap's default light-theme visuals wherever
   Bootstrap's own classes are used in a template (buttons, tables, forms,
   badges) so nothing falls back to stock Bootstrap appearance. */

* { box-sizing: border-box; }

html, body { background: var(--color-canvas); }

body {
  background: var(--color-canvas);
  color: var(--color-text-primary);
  font-family: Inter, "Segoe UI", system-ui, Arial, sans-serif;
  font-size: 14px;
}

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

/* ---- app shell ---- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--color-bg-deep);
  border-right: 1px solid var(--color-border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  margin-bottom: 22px;
  padding: 0 8px;
  color: var(--color-text-primary);
}

.brand .brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--color-accent-hover);
  flex: 0 0 auto;
}

.nav-group { margin-bottom: 16px; }

.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-icon { flex: 0 0 auto; opacity: 0.75; }
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { opacity: 1; }

.nav-item:hover { background: var(--color-surface-muted); color: var(--color-text-primary); }

.nav-item.active {
  background: var(--color-surface-raised);
  color: var(--color-text-primary);
  font-weight: 600;
}

.nav-item.disabled {
  color: var(--color-text-tertiary);
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-secondary);
}

.sidebar-footer a { color: var(--color-text-secondary); }
.sidebar-footer a:hover { color: var(--color-text-primary); }

.content-area { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* ---- top status bar ---- */

.top-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-height);
  padding: 12px 28px;
  background: var(--color-canvas);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.top-status-title h1 { font-size: 22px; margin: 0; font-weight: 700; }
.top-status-title p { margin: 2px 0 0; color: var(--color-text-secondary); font-size: 12.5px; }

.status-pills { display: flex; gap: 8px; flex-wrap: wrap; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: 11.5px;
  line-height: 1.3;
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-secondary);
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px transparent;
}

.status-pill.ok .dot { background: var(--color-success); box-shadow: 0 0 0 3px var(--color-success-soft); }
.status-pill.degraded .dot { background: var(--color-danger); box-shadow: 0 0 0 3px var(--color-danger-soft); }
.status-pill.active-amber .dot { background: var(--color-warning); box-shadow: 0 0 0 3px var(--color-warning-soft); }
.status-pill .pill-label { font-weight: 700; display: block; color: var(--color-text-primary); letter-spacing: 0.02em; }
.status-pill .pill-value { color: var(--color-text-secondary); display: block; margin-top: 1px; }

.main-content { padding: 24px 28px; }

/* ---- generic content ---- */

h1 { font-size: 26px; margin-bottom: 4px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 22px 0 12px; color: var(--color-text-primary); font-weight: 700; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--color-text-primary); font-weight: 700; }
p { color: var(--color-text-secondary); }

.page-subtitle { color: var(--color-text-secondary); font-size: 13px; margin: 0 0 20px; }

.grid { display: grid; gap: 12px; }
.cards { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 22px; }
.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.card, .panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  color: var(--color-text-primary);
  box-shadow: var(--shadow-card);
}

.card span { color: var(--color-text-secondary); display: block; font-size: 12.5px; }
.card strong { font-size: 24px; font-weight: 700; }
.metric-card { position: relative; }
.metric-delta { display: block; margin-top: 4px; font-size: 11.5px; color: var(--color-text-tertiary); }
.metric-delta.positive { color: var(--color-success); }
.metric-delta.negative { color: var(--color-danger); }

/* ---- tables ---- */

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--color-text-primary);
  --bs-table-border-color: var(--color-border);
  --bs-table-hover-bg: var(--color-surface-muted);
  --bs-table-hover-color: var(--color-text-primary);
  --bs-table-striped-bg: var(--color-surface-muted);
  vertical-align: middle;
  color: var(--color-text-primary);
  font-size: 13px;
}

.table > :not(caption) > * > * {
  background: transparent;
  color: inherit;
  border-bottom-color: var(--color-border);
  padding: 10px 12px;
}

.table thead th {
  color: var(--color-text-secondary);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--color-border-strong);
  background: transparent;
}

.table tbody tr:hover > * { background: var(--color-surface-muted); }
.table-warning, .table-warning > * { --bs-table-bg: var(--color-warning-soft) !important; background: var(--color-warning-soft) !important; }

.table-responsive-x { overflow-x: auto; }

/* filters / forms / buttons */

.filters, .action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.filters .form-control, .filters .form-select { width: 190px; }

.form-control, .form-select, textarea,
input[type="text"], input[type="password"], input[type="search"],
input[type="number"], input[type="date"], input[type="email"], select {
  background: var(--color-surface-inset) !important;
  color: var(--color-text-primary) !important;
  border: 1px solid var(--color-border-strong) !important;
  border-radius: var(--radius-sm) !important;
  height: var(--control-height);
  font-size: 13px !important;
  padding: 6px 12px !important;
}

textarea { height: auto; }

.form-control::placeholder, textarea::placeholder, input::placeholder {
  color: var(--color-text-tertiary);
  opacity: 1;
}

.form-control:focus, .form-select:focus, textarea:focus, input:focus, select:focus {
  background: var(--color-surface-inset) !important;
  color: var(--color-text-primary) !important;
  border-color: var(--color-accent-hover) !important;
  box-shadow: 0 0 0 3px var(--color-accent-soft) !important;
  outline: none;
}

.form-select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%237d90a3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 13px !important;
  padding-right: 34px !important;
}

label { color: var(--color-text-secondary); font-size: 12.5px; font-weight: 600; }

.btn {
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  height: var(--control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.btn-sm { height: 30px; padding: 5px 11px; font-size: 12.5px; }

.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-text-primary);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: var(--color-text-primary);
}
.btn-primary:active { background: var(--color-accent-active); border-color: var(--color-accent-active); }

/* Secondary/outline button -- dark surface, cold border, muted text, a
   soft blue highlight on hover. Also the fallback for Bootstrap's
   btn-outline-light (white-on-white, meant for a light background,
   invisible here) wherever a page needs a non-primary action or an
   inactive state (e.g. a pagination link that isn't the current page). */
.btn-outline, .btn-secondary, .btn-outline-light, .btn-outline-secondary {
  background: var(--color-surface-muted);
  border-color: var(--color-border-strong);
  color: var(--color-text-secondary);
}
.btn-outline:hover, .btn-outline:focus,
.btn-secondary:hover, .btn-secondary:focus,
.btn-outline-light:hover, .btn-outline-light:focus,
.btn-outline-secondary:hover, .btn-outline-secondary:focus {
  background: var(--color-surface-raised);
  border-color: var(--color-accent-hover);
  color: var(--color-text-primary);
}

.btn-danger {
  background: var(--color-danger-soft);
  border-color: var(--color-danger);
  color: var(--color-danger);
}
.btn-danger:hover, .btn-danger:focus {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
}

.btn-icon {
  width: var(--control-height);
  padding: 0;
  flex: 0 0 auto;
}

/* Plan 6 Task 4 accessibility pass: an explicit, on-brand keyboard-focus
   ring for every focusable element (links, buttons, inputs, nav items) --
   reasonable baseline per spec (no formal WCAG target set), rather than
   relying only on each browser's own default outline. */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, .nav-item:focus-visible {
  outline: 2px solid var(--color-accent-hover);
  outline-offset: 2px;
}

pre {
  white-space: pre-wrap;
  color: var(--color-text-primary);
  background: var(--color-surface-inset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12.5px;
}

.text-muted { color: var(--color-text-secondary) !important; }
.muted { color: var(--color-text-secondary); font-size: 12.5px; }

.prompt-editor { min-height: 260px; font-family: Consolas, monospace; }

/* ---- status badges ---- */

.badge-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--color-surface-raised);
  color: var(--color-text-secondary);
  border: 1px solid transparent;
}

.badge-status.success { background: var(--color-success-soft); color: var(--color-success); }
.badge-status.danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-status.accent { background: var(--color-accent-soft); color: var(--color-text-primary); }
.badge-status.warning { background: var(--color-warning-soft); color: var(--color-warning); }

/* ---- empty / insufficient-data state ---- */

.empty-state {
  padding: 34px 16px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.empty-state .empty-state-icon {
  width: 34px;
  height: 34px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border-strong);
  display: grid;
  place-items: center;
  color: var(--color-text-tertiary);
  font-size: 16px;
}

.empty-state .empty-state-title {
  color: var(--color-text-primary);
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 4px;
}

.empty-state .empty-state-body { color: var(--color-text-secondary); }

/* ---- chart container ---- */

.chart-container {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.chart-container .chart-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; color: var(--color-text-primary); }

/* ---- tabs ---- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin-bottom: 16px; }
.tab-item {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--color-text-secondary);
  border: none;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  background: none;
  appearance: none;
  font-family: inherit;
  cursor: pointer;
}
.tab-item:hover { color: var(--color-text-primary); }
.tab-item.active { color: var(--color-text-primary); border-bottom-color: var(--color-accent-hover); font-weight: 600; }

/* ---- timeline ---- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item {
  position: relative;
  padding: 0 0 16px 20px;
  border-left: 2px solid var(--color-border);
}
.timeline-item:last-child { border-color: transparent; padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent-hover);
}
.timeline-item .timeline-time { font-size: 11px; color: var(--color-text-tertiary); }

/* ---- dashboard chart metric switcher / pagination (Plan 2) ---- */

.chart-metric-switch { display: flex; gap: 6px; margin-bottom: 10px; }
.pagination-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 12px; align-items: center; }

/* ---- incident card ---- */

.incident-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}
.incident-card:last-child { border-bottom: none; }

/* ---- secret / config row ---- */

.secret-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 13px; border-bottom: 1px solid var(--color-border); }
.secret-row:last-child { border-bottom: none; }
.secret-row .secret-key { color: var(--color-text-secondary); }
.secret-row .secret-value { font-family: Consolas, monospace; color: var(--color-text-primary); }

/* ---- confirm dialog ---- */

.confirm-dialog {
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

/* ---- alerts ---- */

.alert-danger {
  background: var(--color-danger-soft);
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
}
.alert-success {
  background: var(--color-success-soft);
  border: 1px solid var(--color-success);
  color: var(--color-success);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
}

/* ---- login page ---- */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: var(--color-bg-deep);
  position: relative;
  overflow: hidden;
  padding: 0 8vw;
}

/* Cinematic night-city atmosphere, built entirely from CSS/SVG (not a
   photo of the LastHour avatar -- the avatar is source of art direction
   only, per the approved reference; no person is shown here). Layered:
   deep gradient sky, a faint giant clock face, a soft street-lamp glow,
   a skyline silhouette, and a reflective "wet asphalt" ground band. */
.login-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 800px 560px at 20% 24%, rgba(255, 255, 255, 0.035), transparent 62%),
    radial-gradient(circle 280px at 12% 34%, rgba(210, 230, 245, 0.10), rgba(210, 230, 245, 0) 72%),
    linear-gradient(115deg, rgba(6, 20, 34, 0.35) 0%, transparent 40%),
    linear-gradient(180deg, #020a14 0%, #031220 40%, #051a2c 66%, #02080f 100%);
}

/* second, softer depth layer beneath the skyline/clock for parallax feel */
.login-atmosphere::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 1000px 500px at 8% 60%, rgba(10, 30, 48, 0.5), transparent 65%);
}

.login-atmosphere .clock-face {
  position: absolute;
  top: 5%;
  left: 3%;
  width: 48vw;
  max-width: 640px;
  opacity: 0.13;
  stroke: #b8cee2;
}

.login-atmosphere .skyline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46%;
  opacity: 0.92;
}

.login-atmosphere .ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 32%;
  background: linear-gradient(180deg, rgba(2, 8, 15, 0) 0%, rgba(3, 13, 23, 0.82) 55%, #010509 100%);
}

/* faint reflected-light streaks near the ground, evoking wet asphalt
   without any literal photo -- thin blurred vertical gradients */
.login-atmosphere .reflections {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22%;
  overflow: hidden;
  opacity: 0.5;
}
.login-atmosphere .reflections span {
  position: absolute;
  bottom: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, rgba(190, 215, 235, 0.16), transparent);
  filter: blur(2px);
}
.login-atmosphere .reflections span:nth-child(1) { left: 14%; height: 70%; }
.login-atmosphere .reflections span:nth-child(2) { left: 27%; height: 45%; width: 3px; }
.login-atmosphere .reflections span:nth-child(3) { left: 41%; height: 85%; }
.login-atmosphere .reflections span:nth-child(4) { left: 58%; height: 55%; width: 3px; }

.login-atmosphere .fog {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 950px 420px at 28% 82%, rgba(180, 205, 225, 0.07), transparent 72%),
    radial-gradient(ellipse 700px 380px at 6% 40%, rgba(170, 195, 218, 0.05), transparent 68%);
}

/* soft street-lamp bloom, low and to the left, part of the atmosphere
   rather than an infographic element */
.login-atmosphere .bloom {
  position: absolute;
  left: 9%;
  bottom: 30%;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(210, 230, 248, 0.14), transparent 70%);
  filter: blur(6px);
}

.login-atmosphere .vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 1200px 900px at 78% 50%, rgba(1, 6, 12, 0) 25%, rgba(1, 6, 12, 0.6) 100%);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(400px, 92vw);
  background: rgba(9, 24, 38, 0.92);
  border: 1px solid var(--color-border-strong);
  border-radius: 14px;
  padding: 30px 30px 26px;
  display: grid;
  gap: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}
.login-card .login-title { margin: 0; color: var(--color-text-primary); font-size: 26px; font-weight: 700; text-align: center; }
.login-card .login-subtitle { color: var(--color-text-secondary); margin: -10px 0 6px; text-align: center; font-size: 13px; }
.login-card label { display: block; margin-bottom: 6px; }
.login-card .field { display: grid; gap: 0; }
.login-card .password-field { position: relative; }
.login-card .password-field input { width: 100%; padding-right: 40px !important; }
.login-card .password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  height: auto;
  padding: 4px;
}
.login-card .login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--color-text-secondary);
}
.login-card .login-row a,
.login-card .login-row .login-link-inert { color: var(--color-text-secondary); cursor: default; }
.login-card .login-row a:hover { color: var(--color-text-primary); }
.login-card .remember-me { display: flex; align-items: center; gap: 6px; }
.login-card .btn-primary { width: 100%; font-size: 14px; }
.login-card .login-footnote {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.login-copyright {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  text-align: center;
  z-index: 1;
  font-size: 11.5px;
  color: var(--color-text-tertiary);
}

/* ---- second polish pass: toolbar / segmented control ---- */

.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.toolbar h1 { margin-bottom: 2px; }
.toolbar form { margin: 2px 0 0; }

.segmented {
  display: inline-flex;
  background: var(--color-surface-inset);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.segmented button {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 5px;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.segmented button:hover { color: var(--color-text-primary); }
.segmented button.active { background: var(--color-surface-raised); color: var(--color-text-primary); }

/* ---- stat list / stat row (compact label-value list, replaces
   long "Label: value · Label: value" text lines and bare <table>
   key/value dumps on the weaker pages) ---- */

.stat-list { display: flex; flex-direction: column; }
.stat-list-columns { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }
.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}
.stat-row:last-child { border-bottom: none; }
.stat-row .stat-label { color: var(--color-text-primary); font-weight: 600; }
.stat-row .stat-sub { color: var(--color-text-tertiary); font-size: 11.5px; font-weight: 400; }
.stat-row .stat-value { color: var(--color-text-secondary); text-align: right; white-space: nowrap; }
.stat-row .stat-value:has(.status-indicator) {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  white-space: normal;
}
.stat-row .stat-label .tech-value { display: inline-block; margin-top: 3px; }
.stat-row .tech-value {
  font-family: Consolas, monospace;
  font-size: 11px;
  color: var(--color-text-tertiary);
  background: var(--color-surface-inset);
  padding: 2px 7px;
  border-radius: 4px;
}

/* ---- status indicator (semantic dot + word, security/config pages) ---- */

.status-indicator { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; }
.status-indicator .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.status-indicator.ok { color: var(--color-success); }
.status-indicator.ok .dot { background: var(--color-success); box-shadow: 0 0 0 3px var(--color-success-soft); }
.status-indicator.warning { color: var(--color-warning); }
.status-indicator.warning .dot { background: var(--color-warning); box-shadow: 0 0 0 3px var(--color-warning-soft); }
.status-indicator.danger { color: var(--color-danger); }
.status-indicator.danger .dot { background: var(--color-danger); box-shadow: 0 0 0 3px var(--color-danger-soft); }
.status-indicator.neutral { color: var(--color-text-secondary); }
.status-indicator.neutral .dot { background: var(--color-text-secondary); }

/* ---- outcome distribution bar (discipline overview) ---- */

.outcome-bar {
  display: flex;
  height: 10px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--color-surface-inset);
  margin-bottom: 12px;
}
.outcome-bar .seg { height: 100%; }
.outcome-bar .seg.success { background: var(--color-success); }
.outcome-bar .seg.warning { background: var(--color-warning); }
.outcome-bar .seg.danger { background: var(--color-danger); }
.outcome-bar .seg.neutral { background: var(--color-text-tertiary); }
.outcome-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--color-text-secondary); }
.outcome-legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.outcome-legend .dot.success { background: var(--color-success); }
.outcome-legend .dot.warning { background: var(--color-warning); }
.outcome-legend .dot.danger { background: var(--color-danger); }
.outcome-legend .dot.neutral { background: var(--color-text-tertiary); }

/* ---- route card (Prompts & AI Routes page) ---- */

.route-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  margin-bottom: 12px;
  overflow: hidden;
}
.route-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
  cursor: pointer;
  flex-wrap: wrap;
  user-select: none;
}
.route-card-header:hover { background: var(--color-surface-muted); }
.route-card-heading { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.route-card-title { font-size: 14px; font-weight: 700; color: var(--color-text-primary); }
.route-card-id { font-family: Consolas, monospace; font-size: 11px; color: var(--color-text-tertiary); }
.route-card-summary { display: flex; gap: 26px; flex-wrap: wrap; }
.route-card-summary .item span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-tertiary); margin-bottom: 3px; }
.route-card-summary .item strong { font-size: 13px; color: var(--color-text-primary); font-weight: 600; }
.route-card-chevron { color: var(--color-text-tertiary); transition: transform var(--transition-fast); flex: 0 0 auto; }
.route-card.expanded .route-card-chevron { transform: rotate(180deg); }
.route-card-body { padding: 4px 18px 16px; display: none; border-top: 1px solid var(--color-border); }
.route-card.expanded .route-card-body { display: block; }
.route-card-body .stat-list-columns { margin-top: 10px; }
.route-card-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}
.route-card-note strong { color: var(--color-text-primary); }

/* ---- compact table row height per polish-pass density target ---- */

.compact-table th, .compact-table td { padding: 8px 12px !important; }

/* ---- responsive baseline (spec section 18) ----
   1440/1280px: full target experience (default styles above already cover
   this density; 1440px gets a touch more breathing room on the card grid).
   1024px: collapsed/grouped nav. Mobile: core flows stay usable, dense
   tables scroll horizontally instead of force-collapsing. */

@media (min-width: 1440px) {
  .cards { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

@media (max-width: 1280px) {
  .main-content { padding: 20px; }
}

@media (max-width: 1024px) {
  .sidebar { width: var(--sidebar-width-collapsed); flex-basis: var(--sidebar-width-collapsed); padding: 16px 8px; }
  .sidebar .nav-group-label,
  .sidebar .nav-item span.nav-item-label,
  .sidebar .brand span,
  .sidebar-footer { display: none; }
  .nav-item { justify-content: center; }
  .top-status-bar { padding: 12px 16px; }
  .login-body { justify-content: center; padding: 0 5vw; }
}

@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-basis: auto;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  .sidebar .nav-group { display: flex; gap: 4px; margin-bottom: 0; }
  .sidebar .nav-group-label { display: none; }
  .sidebar-footer { display: none; }
  .top-status-bar { flex-direction: column; align-items: flex-start; }
  .cards { grid-template-columns: 1fr 1fr; }
  .two { grid-template-columns: 1fr; }
  .table-responsive-x { overflow-x: auto; }
}
