/* ============================================================
   Sentinel Decs — Design System
   Identity: 170th Intelligence Support Squadron
   Palette: derived from unit patch (gold, navy, crimson, silver)
   ============================================================ */

/* ── Self-hosted fonts (no external requests, no Google tracking) ─── */

/* Inter — vietnamese */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('../fonts/inter-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
/* Inter — latin-ext */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('../fonts/inter-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* Inter — latin */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('../fonts/inter-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* JetBrains Mono — vietnamese */
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 500; font-display: swap; src: url('../fonts/jetbrains-mono-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
/* JetBrains Mono — latin-ext */
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 500; font-display: swap; src: url('../fonts/jetbrains-mono-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* JetBrains Mono — latin */
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 500; font-display: swap; src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Space Grotesk — vietnamese */
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 500 700; font-display: swap; src: url('../fonts/space-grotesk-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
/* Space Grotesk — latin-ext */
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 500 700; font-display: swap; src: url('../fonts/space-grotesk-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* Space Grotesk — latin */
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 500 700; font-display: swap; src: url('../fonts/space-grotesk-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Backgrounds — navy-tinted dark */
  --sd-bg-page:    #0f1219;
  --sd-bg-card:    #161c28;
  --sd-bg-surface: #1e2636;
  --sd-bg-input:   #1e2636;

  /* Text */
  --sd-text-primary:   #f0f2f5;
  --sd-text-secondary: #9aa5b8;
  --sd-text-muted:     #5a6478;

  /* Borders */
  --sd-border:       #2a3348;
  --sd-border-focus: #E8B800;

  /* Accent — 170 ISS Gold (lightning bolts on unit patch) */
  --sd-accent:       #E8B800;
  --sd-accent-hover: #C49C00;
  --sd-accent-glow:  rgba(232, 184, 0, 0.18);

  /* Unit identity colors */
  --sd-navy:       #3C5280;
  --sd-navy-light: #7B97C8;  /* navy lightened for text on dark surfaces */
  --sd-crimson:    #8B2222;
  --sd-silver:     #B0B8C8;

  /* Semantic */
  --sd-success: #2eb50b;
  --sd-warning: #f99d1c;
  --sd-danger:  #8B2222;
  --sd-info:    #4a7ab5;

  /* Elevation */
  --sd-shadow-flat:    0 2px 9px 0 rgba(0,0,0,.28);
  --sd-shadow-raised:  0 0 0 .2rem rgba(232,184,0,.22);
  --sd-shadow-float:   0 5px 14px rgba(0,0,0,.4);
  --sd-shadow-overlay: 0 0 30px rgba(0,0,0,.7);

  /* Spacing — 5px grid */
  --sd-space-1:  5px;
  --sd-space-2:  10px;
  --sd-space-3:  15px;
  --sd-space-4:  20px;
  --sd-space-6:  30px;
  --sd-space-8:  40px;
  --sd-space-12: 60px;

  /* Radius */
  --sd-radius-sm: 4px;
  --sd-radius:    6px;
  --sd-radius-lg: 10px;

  /* Sidebar */
  --sd-sidebar-width: 220px;
}

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

html, body {
  height: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  background-color: var(--sd-bg-page);
  color: var(--sd-text-primary);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: var(--sd-text-primary);
  margin-top: 0;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

.sd-mono { font-family: 'JetBrains Mono', monospace; }

/* The vMPF confirmation row is a flex pair of a wrapping award name and this
   input. Without a floor the input collapses to a few pixels at 375px and the
   count the member is meant to check becomes unreadable. */
.sd-count-input { width: 4.5rem; }

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

/* ── Layout: Sidebar + Main ─────────────────────────────────── */
.sd-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sd-sidebar {
  width: var(--sd-sidebar-width);
  background: var(--sd-bg-card);
  border-right: 1px solid var(--sd-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  /* dvh, not vh: on iOS Safari 100vh is the *large* viewport, measured with the
     bottom toolbar retracted. A fixed element that tall runs underneath the
     toolbar, and the sidebar footer — the user badge and the Logout button —
     is the part that ends up off-screen. vh first as the fallback for browsers
     without dvh. */
  height: 100vh;
  height: 100dvh;
  z-index: 100;
  overflow-y: auto;
}

.sd-sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sd-space-2);
  padding: var(--sd-space-4) var(--sd-space-4) var(--sd-space-3);
  border-bottom: 1px solid var(--sd-border);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--sd-text-primary);
  text-decoration: none;
}

.sd-sidebar-brand:hover { color: var(--sd-text-primary); }

/* The 170 ISS emblem is a disc with a scroll banner across the bottom, so it is
   not square. It ships on a padded transparent canvas and is fitted, not cropped
   to a circle, which would slice through the banner. */
.sd-brand-patch {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  object-fit: contain;
}

.sd-nav {
  flex: 1;
  padding: var(--sd-space-3) 0;
  min-height: 0;
  overflow-y: auto;
}

.sd-nav-section {
  padding: var(--sd-space-2) var(--sd-space-4) var(--sd-space-1);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sd-text-muted);
}

.sd-nav-link {
  display: flex;
  align-items: center;
  gap: var(--sd-space-2);
  padding: var(--sd-space-2) var(--sd-space-4);
  color: var(--sd-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.sd-nav-link:hover {
  color: var(--sd-text-primary);
  background: rgba(255,255,255,0.04);
  border-left-color: var(--sd-border);
}

.sd-nav-link.active {
  color: var(--sd-text-primary);
  background: rgba(206,0,112,0.1);
  border-left-color: var(--sd-accent);
}

.sd-nav-sub {
  padding-left: var(--sd-space-8);
  font-size: 0.825rem;
}

.sd-sidebar-footer {
  position: sticky;
  bottom: 0;
  padding: var(--sd-space-3) var(--sd-space-4);
  /* Clear the iPhone home indicator, which otherwise overlaps the Logout
     button on a device with no home button. Resolves to 0 everywhere else. */
  padding-bottom: calc(var(--sd-space-3) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--sd-border);
  background: var(--sd-bg-card);
}

.sd-user-badge {
  display: flex;
  align-items: center;
  gap: var(--sd-space-2);
  margin-bottom: var(--sd-space-2);
}

.sd-user-avatar {
  width: 32px;
  height: 32px;
  background: var(--sd-bg-surface);
  border: 1px solid var(--sd-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--sd-text-secondary);
  flex-shrink: 0;
}

.sd-user-info { min-width: 0; }
.sd-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sd-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sd-user-rank {
  font-size: 0.7rem;
  color: var(--sd-text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* Main content area */
.sd-main {
  margin-left: var(--sd-sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.sd-topbar {
  display: none; /* hidden on desktop — mobile only */
}

.sd-content {
  flex: 1;
  padding: var(--sd-space-8) var(--sd-space-8);
  width: 100%;
}

.sd-flash-zone {
  padding: var(--sd-space-4) var(--sd-space-8) 0;
}

.sd-footer {
  padding: var(--sd-space-4) var(--sd-space-8);
  border-top: 1px solid var(--sd-border);
  text-align: center;
  font-size: 0.75rem;
  color: var(--sd-text-muted);
}

/* ── Bootstrap Dark Overrides ───────────────────────────────── */
.card {
  background: var(--sd-bg-card);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius);
  box-shadow: var(--sd-shadow-flat);
  color: var(--sd-text-primary);
}

.card-header {
  background: var(--sd-bg-surface);
  border-bottom: 1px solid var(--sd-border);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--sd-text-primary);
}

.card-body { padding: var(--sd-space-4); }

/* Forms */
.form-control,
.form-select {
  background: var(--sd-bg-input);
  border: 1px solid var(--sd-border);
  color: var(--sd-text-primary);
  border-radius: var(--sd-radius-sm);
  font-size: 0.875rem;
}

.form-control:focus,
.form-select:focus {
  background: var(--sd-bg-input);
  border-color: var(--sd-border-focus);
  color: var(--sd-text-primary);
  box-shadow: var(--sd-shadow-raised);
  outline: none;
}

.form-control::placeholder { color: var(--sd-text-muted); }

.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--sd-text-secondary);
  margin-bottom: var(--sd-space-1);
}

.form-text { color: var(--sd-text-muted); font-size: 0.75rem; }

.form-control:disabled,
.form-select:disabled {
  background: var(--sd-bg-page);
  color: var(--sd-text-muted);
  border-color: var(--sd-border);
  opacity: 0.7;
}

/* Buttons */
.btn-primary {
  background: var(--sd-accent);
  border-color: var(--sd-accent);
  color: #0f1219;
  border-radius: var(--sd-radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--sd-accent-hover);
  border-color: var(--sd-accent-hover);
  color: #0f1219;
  box-shadow: 0 0 16px rgba(232,184,0,.25);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--sd-border);
  color: var(--sd-text-secondary);
  border-radius: var(--sd-radius-sm);
  font-weight: 500;
  font-size: 0.875rem;
  transition: border-color 0.15s, color 0.15s;
}

.btn-secondary:hover,
.btn-secondary:focus {
  background: var(--sd-bg-surface);
  border-color: var(--sd-text-secondary);
  color: var(--sd-text-primary);
}

.btn-danger {
  background: var(--sd-danger);
  border-color: var(--sd-danger);
  color: #fff;
}

.btn-danger:hover { opacity: 0.85; color: #fff; }

.btn-success {
  background: var(--sd-success);
  border-color: var(--sd-success);
  color: #fff;
}

.btn-sm {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: var(--sd-radius-sm);
}

/* Tables */
.table {
  /* Bootstrap paints every cell with --bs-table-bg, which defaults to white.
     The dark overrides below only reach .table-striped and .table-hover, so a
     plain .table used to render white cells under light text. */
  --bs-table-bg: transparent;
  --bs-table-color: var(--sd-text-primary);
  color: var(--sd-text-primary);
  border-color: var(--sd-border);
  font-size: 0.875rem;
}

.table thead th {
  background: var(--sd-bg-surface);
  border-bottom: 1px solid var(--sd-border);
  color: var(--sd-text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--sd-space-2) var(--sd-space-3);
  white-space: nowrap;
}

.table tbody tr {
  border-bottom: 1px solid var(--sd-border);
  transition: background 0.1s;
}

.table tbody tr:hover { background: rgba(255,255,255,0.03); }

.table tbody td {
  padding: var(--sd-space-2) var(--sd-space-3);
  vertical-align: middle;
  color: var(--sd-text-primary);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: var(--sd-bg-surface) !important;
  color: var(--sd-text-primary) !important;
  --bs-table-accent-bg: transparent;
}
.table-striped > tbody > tr:nth-of-type(even) > * {
  background-color: var(--sd-bg-card) !important;
  color: var(--sd-text-primary) !important;
}

/* Bootstrap .table-hover dark override */
.table-hover > tbody > tr:hover > * {
  background-color: rgba(232,184,0,0.06) !important;
  color: var(--sd-text-primary) !important;
}

/* Badges */
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--sd-radius-sm);
  padding: 3px 8px;
  letter-spacing: 0.02em;
}

.bg-success   { background: var(--sd-success) !important; }
.bg-warning   { background: var(--sd-warning) !important; color: #000 !important; }
.bg-danger    { background: var(--sd-danger) !important; }
.bg-secondary { background: var(--sd-bg-surface) !important; color: var(--sd-text-secondary) !important; border: 1px solid var(--sd-border); }
.bg-primary   { background: var(--sd-accent) !important; }
.bg-sd-navy   { background: var(--sd-navy) !important; color: var(--sd-text-primary) !important; }

/* Alerts / Flash messages */
.alert {
  border: none;
  border-left: 4px solid;
  border-radius: var(--sd-radius-sm);
  background: var(--sd-bg-surface);
  color: var(--sd-text-primary);
  font-size: 0.875rem;
  padding: var(--sd-space-3) var(--sd-space-4);
}

.alert-info    { border-left-color: var(--sd-info); }
.alert-success { border-left-color: var(--sd-success); }
.alert-warning { border-left-color: var(--sd-warning); }
.alert-danger  { border-left-color: var(--sd-danger); }

.alert .btn-close { filter: invert(1) grayscale(1); opacity: 0.6; }
.alert .btn-close:hover { opacity: 1; }

/* Modals */
.modal-content {
  background: var(--sd-bg-card);
  /* Bootstrap 5.3.8 changed --bs-modal-color from empty to var(--bs-body-color).
     While it was empty the color declaration was invalid at computed-value time,
     so modal text silently inherited --sd-text-primary from body. Now it
     resolves to Bootstrap's light default #212529 against this dark card, which
     is 1.11:1. Set it here, where every modal descendant inherits through. */
  color: var(--sd-text-primary);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius);
  box-shadow: var(--sd-shadow-overlay);
}

.modal-header {
  border-bottom: 1px solid var(--sd-border);
  padding: var(--sd-space-4);
}

.modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  color: var(--sd-text-primary);
}

.modal-body { padding: var(--sd-space-4); }

.modal-footer {
  border-top: 1px solid var(--sd-border);
  padding: var(--sd-space-3) var(--sd-space-4);
}

.modal-backdrop { background: rgba(0,0,0,0.7); }
.btn-close { filter: invert(1) grayscale(1); opacity: 0.6; }
.btn-close:hover { opacity: 1; }


/* Pagination */
.pagination .page-link {
  background: var(--sd-bg-card);
  border-color: var(--sd-border);
  color: var(--sd-text-secondary);
  font-size: 0.8rem;
}

.pagination .page-link:hover {
  background: var(--sd-bg-surface);
  color: var(--sd-text-primary);
}

.pagination .page-item.active .page-link {
  background: var(--sd-accent);
  border-color: var(--sd-accent);
  color: #fff;
}

.pagination .page-item.disabled .page-link {
  background: var(--sd-bg-page);
  color: var(--sd-text-muted);
  border-color: var(--sd-border);
}

/* ── Custom Components ──────────────────────────────────────── */

/* Stat Card (Grafana-style) */
.sd-stat-card {
  background: var(--sd-bg-card);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius);
  padding: var(--sd-space-4);
  box-shadow: var(--sd-shadow-flat);
}

.sd-stat-card-link {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}
.sd-stat-card-link:hover {
  border-color: var(--sd-accent);
  box-shadow: var(--sd-shadow-card);
}

.sd-stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--sd-text-primary);
  line-height: 1;
}

.sd-stat-label {
  font-size: 0.75rem;
  color: var(--sd-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: var(--sd-space-1);
}

.sd-stat-success { color: var(--sd-success); }
.sd-stat-warning { color: var(--sd-warning); }
.sd-stat-info    { color: var(--sd-info); }

/* ── Dashboard Hero Block ───────────────────────────────────── */
.sd-dash-hero {
  display: flex;
  align-items: center;
  gap: var(--sd-space-8);
  background: var(--sd-bg-card);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius-lg);
  padding: var(--sd-space-8);
  margin-bottom: var(--sd-space-6);
  box-shadow: var(--sd-shadow-flat);
}

.sd-dash-hero-content { flex: 1; min-width: 0; }

.sd-dash-hero-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sd-text-muted);
  margin-bottom: var(--sd-space-1);
}

.sd-dash-hero-count {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(3rem, 7vw, 5rem);
  font-weight: 700;
  line-height: 1;
  color: var(--sd-accent);
  margin-bottom: var(--sd-space-2);
}

.sd-dash-hero-sub {
  font-size: 0.9rem;
  color: var(--sd-text-secondary);
}

.sd-dash-hero-link {
  color: var(--sd-accent);
  text-decoration: none;
}
.sd-dash-hero-link:hover { text-decoration: underline; }

.sd-dash-hero-rack {
  flex: 0 0 auto;
  width: clamp(120px, 18vw, 200px);
  max-height: 180px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sd-dash-hero-rack svg { width: 100%; height: auto; opacity: 0.88; }

.sd-dash-rack-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 80px;
  border: 1px dashed var(--sd-border);
  border-radius: var(--sd-radius);
  text-decoration: none;
}

.sd-anim-stagger {
  opacity: 0;
  animation: sd-fadeInUp 0.35s ease-out both;
}

.sd-anim-in {
  animation: sd-fadeInUp 0.2s ease-out both;
}

@media (max-width: 767px) {
  .sd-dash-hero { flex-direction: column; align-items: flex-start; gap: var(--sd-space-4); }
  .sd-dash-hero-rack { width: clamp(80px, 40vw, 160px); align-self: center; }
}

/* Section heading */
.sd-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sd-space-4);
  padding-bottom: var(--sd-space-3);
  border-bottom: 1px solid var(--sd-border);
}

.sd-section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--sd-text-primary);
  margin: 0;
}

/* Status timeline (Grafana-style vertical) */
.sd-timeline { position: relative; padding-left: var(--sd-space-6); }

.sd-timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--sd-border);
}

/* Rendered as an <a> on the dashboard so a member can click through to the
   decoration's criteria, so display:block is load-bearing, not cosmetic. */
.sd-timeline-item {
  position: relative;
  display: block;
  margin-bottom: var(--sd-space-4);
  color: inherit;
  text-decoration: none;
}

a.sd-timeline-item:hover .sd-timeline-label { color: var(--sd-text-primary); }

.sd-timeline-dot {
  position: absolute;
  left: calc(-1 * var(--sd-space-6) + 2px);
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sd-bg-surface);
  border: 2px solid var(--sd-border);
}

.sd-timeline-dot.active {
  background: var(--sd-accent);
  border-color: var(--sd-accent);
  box-shadow: 0 0 0 3px var(--sd-accent-glow);
}

.sd-timeline-dot.done {
  background: var(--sd-success);
  border-color: var(--sd-success);
}

.sd-timeline-label {
  font-size: 0.8rem;
  color: var(--sd-text-secondary);
}

.sd-timeline-date {
  font-size: 0.7rem;
  color: var(--sd-navy-light);
  font-family: 'JetBrains Mono', monospace;
}

/* Per-award device editor on the ribbon rack */
.sd-device-editor { background: var(--sd-bg-surface); }

.sd-device-field { display: flex; flex-direction: column; min-width: 0; }

.sd-device-field input[type="number"] { width: 5.5rem; }

.sd-device-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: var(--sd-space-3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

/* Dashboard feed (alerts + notifications merged) */
.sd-feed-item {
  padding: var(--sd-space-3) 0;
  border-bottom: 1px solid var(--sd-border);
}

.sd-feed-item:last-child { border-bottom: none; }

.sd-feed-unread { border-left: 3px solid var(--sd-accent); padding-left: var(--sd-space-3); }

.sd-feed-body {
  font-size: 0.8rem;
  color: var(--sd-text-secondary);
  margin-top: 2px;
}

.sd-feed-date {
  font-size: 0.7rem;
  color: var(--sd-text-muted);
  white-space: nowrap;
}

/* Dashboard subordinate eligibility */
.sd-sub-elig {
  padding: var(--sd-space-3) 0;
  border-bottom: 1px solid var(--sd-border);
}

.sd-sub-elig:last-child { border-bottom: none; }

.sd-sub-elig-awards {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sd-space-2);
  margin-top: var(--sd-space-2);
}

.sd-sub-elig-awards .badge { text-decoration: none; }

/* Method badges (audit log) */
.sd-method-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--sd-radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sd-method-get    { background: rgba(0,100,218,0.2); color: #5b9cf6; border: 1px solid rgba(0,100,218,0.3); }
.sd-method-post   { background: rgba(206,0,112,0.15); color: #e85fa0; border: 1px solid rgba(206,0,112,0.25); }
.sd-method-put    { background: rgba(249,157,28,0.15); color: #f9a825; border: 1px solid rgba(249,157,28,0.25); }
.sd-method-delete { background: rgba(241,98,33,0.15); color: #f16221; border: 1px solid rgba(241,98,33,0.25); }
.sd-method-patch  { background: rgba(46,181,11,0.15); color: #2eb50b; border: 1px solid rgba(46,181,11,0.25); }

/* Page title area */
.sd-page-header {
  margin-bottom: var(--sd-space-6);
}

.sd-page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--sd-text-primary);
  margin: 0 0 var(--sd-space-1) 0;
}

.sd-page-subtitle {
  font-size: 0.875rem;
  color: var(--sd-text-muted);
}

/* ── Coming soon landing pages ─────────────────────────────── */
.sd-coming-soon {
  position: relative;
  display: grid;
  min-height: min(620px, calc(100vh - 190px));
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius-lg);
  background:
    radial-gradient(circle at 50% 42%, rgba(60, 82, 128, 0.24), transparent 46%),
    var(--sd-bg-card);
}

.sd-coming-soon-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.3;
  background-image:
    linear-gradient(rgba(232, 184, 0, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 184, 0, 0.08) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, black, transparent 74%);
}

.sd-coming-soon-panel {
  max-width: 600px;
  padding: var(--sd-space-8) var(--sd-space-6);
  text-align: center;
}

.sd-coming-soon-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: var(--sd-space-4);
  color: var(--sd-accent);
  border: 1px solid rgba(232, 184, 0, 0.5);
  border-radius: 50%;
  background: var(--sd-accent-glow);
  box-shadow: 0 0 36px rgba(232, 184, 0, 0.12);
}

.sd-coming-soon-kicker {
  margin-bottom: var(--sd-space-2);
  color: var(--sd-accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sd-coming-soon .sd-page-title {
  max-width: 520px;
  margin: 0 auto var(--sd-space-3);
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.sd-coming-soon-copy {
  max-width: 420px;
  margin: 0 auto var(--sd-space-6);
  color: var(--sd-text-secondary);
}

@media (max-width: 575px) {
  .sd-coming-soon {
    min-height: calc(100vh - 130px);
  }

  .sd-coming-soon-panel {
    padding: var(--sd-space-6) var(--sd-space-4);
  }
}

/* ── Nav Tabs (Bootstrap dark override) ─────────────────────── */
.nav-tabs {
  border-bottom: 1px solid var(--sd-border);
}

.nav-tabs .nav-link {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--sd-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: var(--sd-space-2) var(--sd-space-4);
  transition: color 0.15s, border-color 0.15s;
}

.nav-tabs .nav-link:hover {
  color: var(--sd-text-primary);
  border-color: transparent;
  background: transparent;
}

.nav-tabs .nav-link.active {
  color: var(--sd-text-primary);
  background: transparent;
  border-bottom-color: var(--sd-accent);
}

.sd-tab-content {
  padding-top: var(--sd-space-4);
}

/* ── List group dark override ────────────────────────────────── */
.list-group-item {
  background: var(--sd-bg-card);
  border-color: var(--sd-border);
  color: var(--sd-text-primary);
}

.list-group-flush .list-group-item {
  border-left: none;
  border-right: none;
}

.list-group-item:first-child { border-top: none; }
.list-group-item:last-child  { border-bottom: none; }

/* ── Landing Mode: Full-Screen Layout ──────────────────────── */
.sd-landing-mode .sd-sidebar,
.sd-landing-mode .sd-sidebar-overlay { display: none !important; }
.sd-landing-mode .sd-main { margin-left: 0 !important; }
.sd-landing-mode .sd-topbar { display: none !important; }
.sd-landing-mode .sd-flash-zone { padding: 0; margin: 0; position: relative; z-index: 10; }
.sd-landing-mode .sd-content { padding: 0; display: flex; flex-direction: column; }
.sd-landing-mode .sd-footer { display: none !important; }

/* ── Auth page (login / signup) atmosphere ──────────────────── */
.sd-auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: url('/static/img/hero-bg.webp') center center / cover no-repeat;
}
.sd-auth-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 13, 19, 0.82);
}
.sd-auth-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 50%, rgba(60,82,128,0.10) 0%, transparent 70%);
}
.sd-landing-mode .sd-login-wrap {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--sd-space-6) var(--sd-space-4);
}
.sd-landing-mode .sd-login-card {
  backdrop-filter: blur(10px);
  background: rgba(19, 25, 38, 0.88);
  border-color: rgba(255, 255, 255, 0.07);
}

/* ── Landing Keyframes ──────────────────────────────────────── */
@keyframes sd-float {
  0%   { transform: translateY(0) scale(1); opacity: 0; }
  8%   { opacity: 0.8; }
  90%  { opacity: 0.4; }
  100% { transform: translateY(-100vh) scale(0.7); opacity: 0; }
}

@keyframes sd-fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes sd-expand {
  from { width: 0; }
  to   { width: 64px; }
}

@keyframes sd-marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── Hero Section ────────────────────────────────────────────── */
.sd-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--sd-bg-page);
}

.sd-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 50%, rgba(60,82,128,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.sd-hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: url('/static/img/hero-bg.webp') center center / cover no-repeat;
}

.sd-hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 13, 19, 0.72);
}

.sd-particles { position: absolute; inset: 0; }

.sd-particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(232, 184, 0, 0.7);
  box-shadow: 0 0 5px rgba(232, 184, 0, 0.35);
  bottom: -8px;
  animation: sd-float 12s 0s linear infinite;
}

/* Per-particle position, size, and timing (CSP-compliant — no inline styles) */
.sd-particle:nth-child(1)  { left:  5%; width:2px; height:2px; animation-duration:13s; animation-delay:-1s; }
.sd-particle:nth-child(2)  { left: 12%; width:4px; height:4px; animation-duration: 9s; animation-delay:-4s; }
.sd-particle:nth-child(3)  { left: 20%; width:3px; height:3px; animation-duration:11s; animation-delay:-7s; }
.sd-particle:nth-child(4)  { left: 28%; width:2px; height:2px; animation-duration:14s; animation-delay:-2s; }
.sd-particle:nth-child(5)  { left: 38%; width:5px; height:5px; animation-duration:10s; animation-delay:-9s; }
.sd-particle:nth-child(6)  { left: 47%; width:2px; height:2px; animation-duration:12s; animation-delay:-3s; }
.sd-particle:nth-child(7)  { left: 55%; width:3px; height:3px; animation-duration: 8s; animation-delay:-6s; }
.sd-particle:nth-child(8)  { left: 63%; width:4px; height:4px; animation-duration:15s; animation-delay:-1s; }
.sd-particle:nth-child(9)  { left: 70%; width:2px; height:2px; animation-duration:10s; animation-delay:-8s; }
.sd-particle:nth-child(10) { left: 78%; width:3px; height:3px; animation-duration:13s; animation-delay:-5s; }
.sd-particle:nth-child(11) { left: 85%; width:5px; height:5px; animation-duration: 9s; animation-delay:-2s; }
.sd-particle:nth-child(12) { left: 91%; width:2px; height:2px; animation-duration:11s; animation-delay:-7s; }
.sd-particle:nth-child(13) { left: 33%; width:3px; height:3px; animation-duration:16s; animation-delay:-4s; }
.sd-particle:nth-child(14) { left: 58%; width:4px; height:4px; animation-duration:14s; animation-delay:-10s; }
.sd-particle:nth-child(15) { left: 74%; width:2px; height:2px; animation-duration:12s; animation-delay:-3s; }

.sd-hero-content {
  position: relative;
  z-index: 10;
  text-align: center;
  max-width: 680px;
  padding: 48px 28px;
  animation: sd-fadeInUp 0.7s ease-out both;
}

.sd-hero-eyebrow {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sd-accent);
  margin-bottom: 20px;
  padding: 4px 14px;
  border: 1px solid rgba(232,184,0,.3);
  border-radius: 20px;
}

.sd-hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.8rem, 6vw, 5.8rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--sd-text-primary);
  margin: 0 0 24px 0;
}

.sd-hero-divider {
  width: 0;
  height: 3px;
  background: var(--sd-accent);
  border-radius: 2px;
  margin: 0 auto 28px;
  animation: sd-expand 0.9s 0.3s ease-out both;
}

.sd-hero-sub {
  color: var(--sd-text-secondary);
  font-size: 1rem;
  line-height: 1.78;
  max-width: 460px;
  margin: 0 auto 42px;
}

.sd-hero-cta {
  display: inline-block;
  background: var(--sd-accent);
  color: #0a0d13;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 14px 52px;
  border-radius: var(--sd-radius);
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
}

.sd-hero-cta:hover {
  background: var(--sd-accent-hover);
  color: #0a0d13;
  box-shadow: 0 0 36px rgba(232,184,0,.28), 0 2px 8px rgba(0,0,0,.4);
  transform: translateY(-1px);
}

/* ── Features Section ────────────────────────────────────────── */
.sd-features {
  background: var(--sd-bg-card);
  padding: 88px 28px;
  border-top: 1px solid var(--sd-border);
}

.sd-features-inner { max-width: 1000px; margin: 0 auto; }

.sd-features-heading {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sd-text-muted);
  margin-bottom: 48px;
}

.sd-features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.sd-feature-card {
  background: var(--sd-bg-surface);
  border: 1px solid var(--sd-border);
  border-top: 3px solid var(--sd-accent);
  border-radius: var(--sd-radius-lg);
  padding: 32px 26px;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease-out, transform 0.55s ease-out, border-color 0.2s;
}

.sd-feature-card.sd-visible { opacity: 1; transform: translateY(0); }
.sd-feature-card:nth-child(2) { transition-delay: 0.12s; }
.sd-feature-card:nth-child(3) { transition-delay: 0.24s; }
.sd-feature-card:hover { border-color: rgba(232,184,0,.45); border-top-color: var(--sd-accent); }

.sd-feature-icon { font-size: 1.6rem; margin-bottom: 16px; display: block; }

.sd-feature-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--sd-text-primary);
  margin: 0 0 10px 0;
}

.sd-feature-desc {
  font-size: 0.85rem;
  color: var(--sd-text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* ── Ribbon Showcase Marquee ─────────────────────────────────── */
.sd-showcase {
  background: var(--sd-bg-page);
  padding: 52px 0;
  border-top: 1px solid var(--sd-border);
  overflow: hidden;
}

.sd-showcase-label {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sd-text-muted);
  margin-bottom: 24px;
}

.sd-showcase-track-wrap {
  position: relative;
  overflow: hidden;
}

.sd-showcase-track-wrap::before,
.sd-showcase-track-wrap::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 100px;
  z-index: 2;
  pointer-events: none;
}

.sd-showcase-track-wrap::before {
  left: 0;
  background: linear-gradient(to right, var(--sd-bg-page), transparent);
}

.sd-showcase-track-wrap::after {
  right: 0;
  background: linear-gradient(to left, var(--sd-bg-page), transparent);
}

.sd-showcase-track {
  display: flex;
  gap: 0;
  width: max-content;
  animation: sd-marquee 45s linear infinite;
  padding: 4px 0;
}

.sd-hero-ribbon {
  height: 18px;
  width: 60px;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  /* margin-right makes each ribbon's trailing space part of its own width,
     so the half-set width (12*70px = 840px) equals exactly -50% of the
     full track width (24*70px = 1680px) — seamless marquee loop */
  margin-right: 10px;
}

/* The showcase sets its own size: these fill the 60x18 marquee cell rather than
   the 56x16 the swatch uses in lists. */
.sd-hero-ribbon .sd-ribbon-swatch { width: 60px; height: 17px; border: 0; }

/* ── Landing Mobile ──────────────────────────────────────────── */
@media (max-width: 767px) {
  .sd-hero-title { font-size: 3rem; }
  .sd-features-grid { grid-template-columns: 1fr; }
  .sd-features { padding: 60px 20px; }
}

/* ── Login Card ─────────────────────────────────────────────── */
.sd-login-wrap {
  display: flex;
  justify-content: center;
  padding-top: var(--sd-space-8);
}

.sd-login-card {
  background: var(--sd-bg-card);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius-lg);
  box-shadow: var(--sd-shadow-float);
  padding: var(--sd-space-8);
  width: 100%;
  max-width: 400px;
}

.sd-login-header {
  text-align: center;
  margin-bottom: var(--sd-space-6);
}

.sd-login-icon {
  font-size: 1.75rem;
  margin-bottom: var(--sd-space-3);
}

.sd-login-title {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: var(--sd-space-1);
}

.sd-login-hint {
  font-size: 0.8rem;
  color: var(--sd-text-muted);
  margin: 0;
}

/* ── Unit Eligibility Summary ──────────────────────────────────── */

/* Rows already handled by a human. This only needs to grey/dim them, never
   hide them. */
.sd-row-actioned {
  opacity: 0.55;
}

/* The engine's working under an award name: "3 earned . 1 on record . missing
   2 . 12y 5m since 2014-03-11". Kept on one line above the mobile breakpoint
   because the award column is content-sized: let it wrap and the browser keeps
   the column at 80px and stacks the line seven high, which measured a 251px
   row at 1440px. Refusing to wrap widens the column to fit, and the award name
   then needs fewer lines too, so the row comes out at 113px -- shorter than
   before this line existed. The table already scrolls inside
   .table-responsive, so the extra width costs nothing. Below the breakpoint
   the table is a stacked card and a nowrap line would overflow it, so the rule
   stops there. */
.sd-progress-line {
  white-space: nowrap;
}

@media (max-width: 767px) {
  .sd-progress-line {
    white-space: normal;
  }
}

/* Inline note field on the "Not Sent to CSS" mini-form, kept narrow so the
   three per-row action forms fit without wrapping the table awkwardly. */
.sd-note-input {
  width: 110px;
  display: inline-block;
}

/* ── Ribbon Rack Catalog ────────────────────────────────────── */
.sd-catalog-section {
  padding: 4px 6px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--sd-text-muted);
  background: var(--sd-bg-surface);
  border-bottom: 1px solid var(--sd-border);
}

.sd-catalog-item {
  padding: 5px 6px;
  border-bottom: 1px solid var(--sd-border);
  transition: background 0.1s;
}

.sd-catalog-item:hover { background: rgba(255,255,255,0.03); }

.sd-catalog-empty {
  padding: var(--sd-space-3);
  font-size: 0.75rem;
  color: var(--sd-text-muted);
  text-align: center;
}

.sd-catalog-earned { background: rgba(46,181,11,0.07); }
.sd-catalog-earned:hover { background: rgba(46,181,11,0.1); }

/* ── Ribbon Rack Canvas ─────────────────────────────────────── */
.sd-rack-canvas {
  position: relative;
  background: radial-gradient(ellipse at 50% 35%, rgba(60,82,128,0.28) 0%, transparent 65%),
              var(--sd-bg-card);
  border: 1px solid rgba(232,184,0,0.3);
  border-radius: var(--sd-radius);
  padding: 42px 20px 24px;
  text-align: center;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.25), var(--sd-shadow-float);
}

.sd-rack-toolbar {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0.25;
  transition: opacity 0.2s ease;
  z-index: 2;
}

.sd-rack-canvas:hover .sd-rack-toolbar { opacity: 1; }

.sd-rack-canvas-hint {
  font-size: 0.65rem;
  color: var(--sd-text-muted);
  letter-spacing: 0.03em;
  margin-top: 10px;
  margin-bottom: 0;
}

/* Badges — secondary collapsible */
.sd-badges-details {
  background: var(--sd-bg-card);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius);
  margin-top: var(--sd-space-3);
}

.sd-badges-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  list-style: none;
  font-size: 0.82rem;
  color: var(--sd-text-secondary);
}

.sd-badges-summary::-webkit-details-marker { display: none; }
.sd-badges-summary::marker { display: none; }

.sd-badges-chevron { transition: transform 0.18s ease; flex-shrink: 0; color: var(--sd-text-muted); }
.sd-badges-details[open] .sd-badges-chevron { transform: rotate(180deg); }

.sd-badges-body { padding: 8px 16px 12px; }

@media (prefers-reduced-motion: reduce) {
  .sd-rack-toolbar      { transition: none; }
  .sd-badges-chevron    { transition: none; }
  .sd-anim-in           { animation: none; }
  .sd-auth-bg .sd-particle { animation: none; opacity: 0; }
}

/* ── PII Acknowledgement Banner + Blocking Overlay ─────────── */
.sd-pii-page-overlay {
  position: fixed;
  inset: 0;
  z-index: 1039;
  background: rgba(0, 0, 0, 0.55);
  cursor: not-allowed;
  pointer-events: all;
}

.sd-pii-banner {
  position: relative;
  z-index: 1040;
  background: rgba(139, 0, 0, 0.18);
  border-bottom: 2px solid rgba(200, 0, 0, 0.5);
  padding: 12px var(--sd-space-8);
}

.sd-pii-banner-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sd-pii-banner-icon { font-size: 1.1rem; flex-shrink: 0; }

.sd-pii-banner-text { flex: 1; font-size: 0.82rem; color: var(--sd-text-secondary); }
.sd-pii-banner-text strong { color: #ff6b6b; }

.sd-pii-banner-btn {
  background: transparent;
  border: 1px solid rgba(200, 0, 0, 0.5);
  color: var(--sd-text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 6px 16px;
  border-radius: var(--sd-radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.sd-pii-banner-btn:hover {
  background: rgba(200, 0, 0, 0.15);
  border-color: rgba(200, 0, 0, 0.8);
}

/* ── Utility Classes ────────────────────────────────────────── */
.sd-link-plain    { color: inherit; text-decoration: none; }
.sd-form-inline   { display: inline; }
.sd-text-xs       { font-size: 0.75rem; }
.sd-text-xxs      { font-size: 0.7rem; }
.sd-pre-mono      { white-space: pre-wrap; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
.sd-catalog-scroll     { max-height: 500px; overflow-y: auto; }
/* Ribbon thumbnail. A ribbon bar is 35mm x 10mm, so every size below is 3.5:1 —
   56x16, and the per-surface overrides elsewhere in this file. The swatch used
   to be squeezed into 42x12 with overflow:hidden, which sliced off the right
   quarter and lower third of every ribbon; the image now fills its box, so a
   mismatched ratio would stretch the artwork instead of cropping it. Keep any
   width/height pair here or in an override at 3.5:1.
   content-box so the border sits outside the ratio rather than eating it. */
.sd-ribbon-swatch-flex { flex-shrink: 0; display: flex; }
.sd-ribbon-swatch      { display: block; box-sizing: content-box; width: 56px; height: 16px; border: 1px solid var(--sd-border); }
.sd-ribbon-swatch-missing { background: repeating-linear-gradient(45deg, #6b6b6b, #6b6b6b 3px, #888 3px, #888 6px); }
.sd-rack-svg           { max-width: 100%; height: auto; }
.sd-flex-fill          { flex: 1; min-width: 0; }
.sd-btn-xs             { font-size: 0.7rem; padding: 2px 6px; }

.text-muted { color: var(--sd-text-muted) !important; }
.text-secondary { color: var(--sd-text-secondary) !important; }
.bg-dark { background-color: var(--sd-bg-card) !important; }

/* CSP-safe replacements for inline style= attributes */
.sd-hidden            { display: none; }
.cursor-pointer       { cursor: pointer; }
.sd-device-bronze     { background: #CD7F32; color: #fff; }
.sd-device-silver     { background: #5b6a8a; color: #fff; }.sd-badge-danger-sm   { background: var(--sd-danger); font-size: 0.65rem; }
.sd-rack-scroll       { display: inline-block; max-width: 100%; overflow-x: auto; }
.sd-team-scroll-pane  { max-height: 480px; overflow-y: auto; }
.sd-w-80              { width: 80px; }
.sd-w-120             { width: 120px; }
.sd-w-160             { width: 160px; }
.sd-col-pct-14        { width: 14%; }
.sd-col-pct-12        { width: 12%; }
.sd-col-pct-11        { width: 11%; }
.sd-color-primary     { color: var(--sd-text-primary); }
.sd-text-sm           { font-size: 0.8rem; }
.sd-ribbon-img        { max-width: 200px; border: 1px solid var(--sd-border); border-radius: var(--sd-radius-sm); }
.sd-ribbon-placeholder { width: 140px; height: 40px; background: #888; margin: 0 auto; }
select.sd-filter-chip { appearance: none; }

hr { border-color: var(--sd-border); opacity: 1; }

/* ── Mobile Layout ──────────────────────────────────────────── */
@media (max-width: 991px) {
  .sd-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sd-sidebar.open { transform: translateX(0); }

  .sd-main { margin-left: 0; }

  .sd-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sd-space-3) var(--sd-space-4);
    background: var(--sd-bg-card);
    border-bottom: 1px solid var(--sd-border);
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .sd-topbar-brand {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--sd-text-primary);
    text-decoration: none;
  }

  .sd-menu-toggle {
    background: none;
    border: 1px solid var(--sd-border);
    color: var(--sd-text-secondary);
    border-radius: var(--sd-radius-sm);
    padding: 5px 9px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
  }

  .sd-content {
    padding: var(--sd-space-4);
  }

  .sd-flash-zone {
    padding: var(--sd-space-4) var(--sd-space-4) 0;
  }

  .sd-pii-banner {
    padding: 12px var(--sd-space-4);
  }

  .sd-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }

  .sd-sidebar-overlay.open { display: block; }
}

@media (min-width: 992px) {
  .sd-sidebar { transform: none !important; }
  .sd-sidebar-overlay { display: none !important; }
}

/* Wide displays: content runs full width, so widen the gutters.
   Landing mode keeps padding: 0 — its own rule is more specific. */
@media (min-width: 1600px) {
  .sd-content,
  .sd-flash-zone,
  .sd-footer,
  .sd-pii-banner {
    padding-left: var(--sd-space-12);
    padding-right: var(--sd-space-12);
  }
}

/* ── Admin Dashboard ──────────────────────────────────────── */

/* Tab nav */
.sd-admin-tabs .nav-link {
  color: var(--sd-text-secondary);
  border-color: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 16px;
}
.sd-admin-tabs .nav-link:hover { color: var(--sd-text-primary); background: rgba(255,255,255,0.04); }
.sd-admin-tabs .nav-link.active {
  color: var(--sd-accent);
  background: var(--sd-bg-card);
  border-color: var(--sd-border) var(--sd-border) var(--sd-bg-card);
}
.sd-admin-tabs { border-bottom-color: var(--sd-border); }

.sd-admin-tab-content {
  background: var(--sd-bg-card);
  border: 1px solid var(--sd-border);
  border-top: none;
  border-radius: 0 0 var(--sd-radius) var(--sd-radius);
  padding: var(--sd-space-4);
}

/* Admin table — sticky header + denser layout */
.sd-admin-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--sd-bg-surface) !important;
  border-bottom: 2px solid var(--sd-border);
}
.sd-admin-table td { font-size: 0.8rem; padding: 6px 10px !important; }
.sd-admin-table th { font-size: 0.7rem; padding: 6px 10px !important; }

/* Filter chip row */
.sd-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--sd-space-3); align-items: center; }
.sd-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 1px solid var(--sd-border);
  border-radius: 99px;
  font-size: 0.75rem;
  color: var(--sd-text-secondary);
  background: var(--sd-bg-surface);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
  white-space: nowrap;
}
.sd-filter-chip:hover { border-color: var(--sd-accent); color: var(--sd-text-primary); }
.sd-filter-chip.active { border-color: var(--sd-accent); color: var(--sd-accent); background: var(--sd-accent-glow); }
.sd-filter-chip input[type="text"],
.sd-filter-chip input[type="search"] {
  background: transparent;
  border: none;
  outline: none;
  color: var(--sd-text-primary);
  font-size: 0.75rem;
  width: 120px;
}

/* Empty state */
.sd-empty-state {
  text-align: center;
  padding: var(--sd-space-8) var(--sd-space-4);
  color: var(--sd-text-muted);
}
.sd-empty-state-icon { font-size: 2rem; margin-bottom: var(--sd-space-2); opacity: 0.4; }
.sd-empty-state-msg { font-size: 0.875rem; }

/* Inline edit row */
.sd-edit-row { background: var(--sd-bg-page) !important; }
.sd-edit-row td { padding: 0 !important; }
.sd-inline-edit-form {
  background: var(--sd-bg-surface);
  border-top: 2px solid var(--sd-accent);
  padding: var(--sd-space-4) !important;
  width: 100%;
}
.sd-inline-edit-form .form-label { font-size: 0.75rem; color: var(--sd-text-secondary); margin-bottom: 2px; }
.sd-roster-note-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Toast notification */
#sd-toast-area {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.sd-toast {
  background: var(--sd-bg-surface);
  border: 1px solid var(--sd-border);
  border-left: 3px solid var(--sd-success);
  border-radius: var(--sd-radius);
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--sd-text-primary);
  box-shadow: var(--sd-shadow-float);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: auto;
}
.sd-toast.show { opacity: 1; transform: translateY(0); }

/* ── SVG icon system (Lucide) ────────────────────────────── */
.sd-icon { display: inline-block; vertical-align: middle; }
.sd-feature-icon .sd-icon { color: var(--sd-accent); }
.sd-login-icon { color: var(--sd-accent); display: flex; justify-content: center; }
.sd-pii-banner-icon .sd-icon { color: var(--sd-warning, #f5a623); }

/* Mobile: collapse admin tables to stacked cards */
@media (max-width: 768px) {
  .sd-admin-table thead { display: none; }
  .sd-admin-table, .sd-admin-table tbody, .sd-admin-table tr { display: block; width: 100%; }
  .sd-admin-table tr {
    border: 1px solid var(--sd-border);
    border-radius: var(--sd-radius-sm);
    margin-bottom: 8px;
    padding: 8px;
    background: var(--sd-bg-card);
  }
  .sd-admin-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Wrap, or a cell holding more than a bare value clips its overflow off
       the card edge with no scrollbar to reveal it. The pending queue's rank
       cell is the live case: it can carry two warning badges beside the rank,
       and the second one was simply invisible at 375px. */
    flex-wrap: wrap;
    row-gap: 4px;
    padding: 4px 0 !important;
    border: none !important;
    font-size: 0.8rem;
  }
  .sd-admin-table td::before {
    content: attr(data-label);
    font-size: 0.7rem;
    color: var(--sd-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    flex-shrink: 0;
    margin-right: 8px;
  }
  .sd-admin-table thead th { position: static; }
  .sd-admin-tab-content { padding: var(--sd-space-3); }
}

/* ── Form section rhythm ──────────────────────────────────── */
.sd-form-section {
  margin-bottom: var(--sd-space-6);
}

.sd-form-section-title {
  border-left: 2px solid var(--sd-accent);
  padding-left: var(--sd-space-3);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sd-text-secondary);
  margin-bottom: var(--sd-space-4);
}

.sd-form-section-note {
  font-size: 0.65rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--sd-text-muted);
}

/* ── Onboarding progress stepper ─────────────────────────── */
.sd-onboarding-stepper {
  display: flex;
  align-items: flex-start;
  margin-bottom: var(--sd-space-8);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sd-stepper-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  text-decoration: none;
  min-width: 80px;
}

.sd-stepper-item::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  width: 100%;
  height: 1px;
  background: var(--sd-border);
  z-index: 0;
}
.sd-stepper-item:last-child::after { display: none; }

.sd-stepper-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--sd-border);
  background: var(--sd-bg-surface);
  color: var(--sd-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
  margin-bottom: var(--sd-space-2);
}

.sd-stepper-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sd-text-muted);
  text-align: center;
  line-height: 1.3;
}

.sd-stepper-item--active .sd-stepper-marker {
  border-color: var(--sd-accent);
  background: rgba(232, 184, 0, 0.1);
  color: var(--sd-accent);
}

.sd-stepper-item--active .sd-stepper-label {
  color: var(--sd-text-secondary);
}

/* ── AI draft sheet ───────────────────────────────────────── */
.sd-draft-sheet-wrap {
  display: flex;
  flex-direction: column;
}

.sd-draft-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sd-space-3);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sd-text-secondary);
}

.sd-draft-sheet-copy-btn {
  background: transparent;
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius-sm);
  color: var(--sd-text-secondary);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.sd-draft-sheet-copy-btn:hover {
  color: var(--sd-accent);
  border-color: rgba(232, 184, 0, 0.4);
}

.sd-draft-sheet {
  background: #f4f1ea;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--sd-radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  color: #1c1a17;
  font-family: 'Times New Roman', Georgia, serif;
  font-size: 0.9rem;
  line-height: 1.8;
  padding: var(--sd-space-6) var(--sd-space-8);
  white-space: pre-wrap;
}

.sd-draft-sheet--mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
}

/* ── Uniform reference page ─────────────────────────────────────────── */

.sd-uniform-layout {
  display: flex;
  gap: var(--sd-space-6);
  align-items: flex-start;
  flex-wrap: wrap;
}

.sd-uniform-figure {
  flex: 1 1 380px;
  min-width: 0;
}

.sd-uniform-svg {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  margin: 0 auto;
}

.sd-uniform-panel {
  flex: 1 1 300px;
  min-width: 0;
  position: sticky;
  top: var(--sd-space-4);
}

.sd-uniform-panel-label {
  font-size: 1.05rem;
  margin-bottom: var(--sd-space-3);
}

.sd-uniform-panel-meta dt {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}

.sd-uniform-panel-meta dd {
  margin-bottom: var(--sd-space-3);
}

.sd-uniform-zone {
  fill: transparent;
  stroke: rgba(232, 184, 0, 0.45);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  cursor: pointer;
  transition: stroke 0.15s, fill 0.15s;
}

.sd-uniform-zone:hover,
.sd-uniform-zone:focus {
  stroke: var(--sd-accent);
  fill: rgba(232, 184, 0, 0.12);
  outline: none;
}

.sd-uniform-zone-active {
  stroke: var(--sd-accent);
  stroke-dasharray: none;
  fill: rgba(232, 184, 0, 0.08);
}

.sd-uniform-badge-fallback {
  fill: #3a4a78;
  stroke: #dfe6f5;
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.sd-uniform-zone-heading {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sd-text-muted);
  margin: var(--sd-space-4) 0 var(--sd-space-2);
}

.sd-uniform-zone-note {
  color: var(--sd-text-muted);
  font-size: 0.82rem;
}

.sd-uniform-worn {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sd-uniform-worn-item {
  display: flex;
  align-items: center;
  gap: var(--sd-space-2);
  padding: var(--sd-space-2) 0;
  border-bottom: 1px solid var(--sd-border);
}

.sd-uniform-worn-item:last-child {
  border-bottom: none;
}

.sd-uniform-worn-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.85rem;
}

.sd-uniform-worn-img {
  max-height: 36px;
  max-width: 72px;
}

.sd-uniform-add {
  display: flex;
  flex-direction: column;
  gap: var(--sd-space-1);
}

.sd-uniform-add-item {
  border: 1px solid var(--sd-border);
  border-radius: 6px;
}

.sd-uniform-add-item[open] {
  border-color: var(--sd-border-focus);
}

.sd-uniform-add-summary {
  display: flex;
  align-items: center;
  gap: var(--sd-space-2);
  padding: var(--sd-space-2);
  cursor: pointer;
  font-size: 0.85rem;
}

.sd-uniform-add-summary:hover {
  background: var(--sd-bg-surface);
}

.sd-uniform-add-img {
  max-height: 28px;
  max-width: 60px;
}

.sd-uniform-add-name {
  min-width: 0;
}

.sd-uniform-add-body {
  padding: 0 var(--sd-space-2) var(--sd-space-2);
}

/* ── Insignia picker (onboarding step 2 + badges page) ─────────────────── */

.sd-picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sd-space-2);
  align-items: center;
  margin-bottom: var(--sd-space-3);
}

.sd-picker-search {
  max-width: 280px;
}

.sd-picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sd-space-1);
}

.sd-picker-chip {
  background: var(--sd-bg-surface);
  border: 1px solid var(--sd-border);
  color: var(--sd-text-secondary);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.sd-picker-chip:hover {
  border-color: var(--sd-border-focus);
  color: var(--sd-text-primary);
}

.sd-picker-chip--active {
  background: var(--sd-accent);
  border-color: var(--sd-accent);
  color: #10131a;
  font-weight: 600;
}

.sd-picker-group-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sd-text-secondary);
  border-bottom: 1px solid var(--sd-border);
  padding-bottom: 4px;
  margin: var(--sd-space-4) 0 var(--sd-space-2);
}

.sd-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sd-space-2);
}

.sd-picker-card {
  position: relative;
  display: block;
  background: var(--sd-bg-surface);
  border: 1px solid var(--sd-border);
  border-radius: 8px;
  padding: var(--sd-space-2);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-bottom: 0;
}

.sd-picker-card:hover {
  border-color: var(--sd-border-focus);
  box-shadow: var(--sd-shadow-flat);
}

.sd-picker-card--held {
  cursor: default;
  opacity: 0.65;
}

.sd-picker-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  accent-color: var(--sd-accent);
}

.sd-picker-card:has(.sd-picker-check:checked) {
  border-color: var(--sd-accent);
  box-shadow: 0 0 0 1px var(--sd-accent);
}

.sd-picker-held-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.62rem;
}

.sd-picker-media {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-bottom: var(--sd-space-1);
}

.sd-picker-media .sd-ribbon-swatch {
  width: 84px;
  height: 24px;
}

.sd-picker-badge-img {
  max-height: 44px;
  max-width: 90px;
}

.sd-picker-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 34px;
  padding: 0 8px;
  border: 1px dashed var(--sd-text-muted);
  border-radius: 6px;
  color: var(--sd-text-secondary);
  font-size: 0.72rem;
}

.sd-picker-name {
  font-size: 0.78rem;
  color: var(--sd-text-primary);
  line-height: 1.25;
}

.sd-picker-abbr {
  font-size: 0.68rem;
  color: var(--sd-text-muted);
}

.sd-picker-desc {
  font-size: 0.68rem;
  color: var(--sd-text-muted);
  line-height: 1.3;
}

.sd-picker-details {
  display: none;
  margin-top: var(--sd-space-2);
  border-top: 1px solid var(--sd-border);
  padding-top: var(--sd-space-2);
}

.sd-picker-check:checked ~ .sd-picker-details {
  display: block;
}

.sd-picker-details-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sd-text-muted);
  margin-bottom: 3px;
}

.sd-picker-actions {
  display: flex;
  align-items: center;
  gap: var(--sd-space-3);
  margin: var(--sd-space-6) 0 var(--sd-space-8);
}

.sd-badge-img {
  max-height: 32px;
  max-width: 64px;
}

/* ── Regulation repository ── */

/* The description column takes the row and the link column sits to its right.
   Without a basis, flex-wrap decides per card: a short "governs" line leaves
   the button beside it and a long one pushes it underneath, so the list reads
   ragged. A basis wide enough for prose keeps every card the same shape and
   still wraps to stacked when the viewport genuinely cannot fit both. */
.sd-reg-body {
  flex: 1 1 28rem;
  min-width: 0;
}

.sd-reg-action {
  flex: 0 0 auto;
}
