/* Seddon CDE design tokens — mirrored from SeddonCDE-master/src/app/globals.css */

:root {
  --primary: #022943;
  --primary-hover: #033a5f;
  --red: #ed1c24;
  --turquoise: #30b996;
  --skyblue: #4ebec7;
  --purple: #804097;
  --magenta: #ce167c;
  --orange: #f58720;
  --yellow: #e8bf1e;
  --offwhite: #f1f1f2;

  --background: #f8f9fb;
  --foreground: #0f172a;
  --card: #ffffff;
  --muted: #64748b;
  --muted-soft: #94a3b8;
  --border: #dce3ea;
  --input: #dce3ea;
  --secondary: #e8ecef;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --radius: 0.25rem;
  --radius-lg: 0.375rem;
  --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.05), 0 1px 3px -1px rgba(0, 0, 0, 0.05);
  --shadow-login: 0 24px 70px rgba(2, 41, 67, 0.18);
  --shadow-panel: 0 2px 8px -2px rgba(0, 0, 0, 0.05), 0 1px 3px -1px rgba(0, 0, 0, 0.05);

  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --text-h1: 2rem;
  --text-h2: 1.5rem;
  --text-h3: 1.125rem;
  --text-body: 0.875rem;
  --text-data: 0.8125rem;
  --text-label: 0.75rem;
  --text-micro: 0.625rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--foreground);
  background: var(--background);
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.03);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

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

a:hover {
  text-decoration: underline;
}

/* ── App chrome (CDE / Transport sidebar layout) ──────────────────────── */

.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--background);
}

.sidebar {
  display: none;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 30;
  height: 100vh;
  width: 260px;
  background: var(--primary);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  transition: width 0.3s ease;
}

.app-layout.sidebar-collapsed .sidebar {
  width: 76px;
}

.sidebar-chrome {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
  height: 4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
}

.sidebar-brand-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
  text-decoration: none;
}

.sidebar-brand-link:hover {
  text-decoration: none;
}

.sidebar-brand-link img {
  height: 1.75rem;
  width: auto;
  max-width: 110px;
  object-fit: contain;
  object-position: left center;
}

.sidebar-brand-link span {
  font-size: 8px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-layout.sidebar-collapsed .sidebar-brand-link {
  display: none;
}

.sidebar-collapse {
  height: 2rem;
  width: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.sidebar-collapse:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.app-layout.sidebar-collapsed .sidebar-collapse {
  margin: 0 auto;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sidebar-section {
  margin: 0;
  padding: 0.5rem 0.75rem 0.35rem;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.4);
}

.app-layout.sidebar-collapsed .sidebar-section {
  display: none;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.625rem 0.75rem;
  transition: color 0.15s ease, background 0.15s ease;
  text-decoration: none;
}

.sidebar-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

.sidebar-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-left: 3px solid var(--red);
  padding-left: calc(0.75rem - 3px);
}

.sidebar-item.active.color-turquoise { border-left-color: var(--turquoise); }
.sidebar-item.active.color-skyblue { border-left-color: var(--skyblue); }
.sidebar-item.active.color-purple { border-left-color: var(--purple); }
.sidebar-item.active.color-magenta { border-left-color: var(--magenta); }
.sidebar-item.active.color-orange { border-left-color: var(--orange); }
.sidebar-item.active.color-yellow { border-left-color: var(--yellow); }
.sidebar-item.active.color-red { border-left-color: var(--red); }

.sidebar-item svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-item:hover svg,
.sidebar-item.active svg {
  opacity: 1;
}

.app-layout.sidebar-collapsed .sidebar-item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  gap: 0;
  border-left: none;
}

.app-layout.sidebar-collapsed .sidebar-item.active {
  border-left: none;
  padding-left: 0;
}

.app-layout.sidebar-collapsed .sidebar-item span {
  display: none;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem 0.5rem;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  z-index: 0;
  transition: margin 0.3s ease;
}

.app-header {
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(12px);
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.mobile-menu-btn {
  display: inline-flex;
  height: 2.5rem;
  width: 2.5rem;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #475569;
  cursor: pointer;
}

.mobile-menu-btn:hover {
  background: #f1f5f9;
}

.page-title-block {
  min-width: 0;
  border-left: 3px solid var(--turquoise);
  padding-left: 0.75rem;
}

.page-title-block.color-turquoise { border-left-color: var(--turquoise); }
.page-title-block.color-skyblue { border-left-color: var(--skyblue); }
.page-title-block.color-purple { border-left-color: var(--purple); }
.page-title-block.color-orange { border-left-color: var(--orange); }
.page-title-block.color-red { border-left-color: var(--red); }

.page-title-block h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-title-block p {
  margin: 0.1rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.app-user {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding-left: 0.75rem;
  margin-left: 0.25rem;
  border-left: 1px solid var(--border);
}

.app-user-meta {
  text-align: right;
  min-width: 0;
  max-width: 160px;
}

.app-user-meta strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-user-meta span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted-soft);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.app-avatar {
  height: 2.25rem;
  width: 2.25rem;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.icon-btn {
  height: 2rem;
  width: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  color: var(--red);
  border-color: rgba(237, 28, 36, 0.4);
}

.shell {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem;
  flex: 1;
}

.app-footer {
  padding: 0 1rem 0.75rem;
  text-align: right;
}

.app-footer p {
  margin: 0;
  font-size: 10px;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
}

/* Mobile drawer */
.mobile-drawer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
}

.mobile-drawer.open {
  display: block;
}

.mobile-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 41, 67, 0.45);
}

.mobile-drawer-panel {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(300px, 88vw);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 30px rgba(2, 41, 67, 0.18);
}

.mobile-drawer-brand {
  height: 4rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.mobile-drawer-brand img {
  height: 1.5rem;
  width: auto;
}

.mobile-drawer-brand div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.mobile-drawer-brand strong {
  font-size: 0.95rem;
  color: var(--primary);
  font-weight: 800;
}

.mobile-drawer-brand span {
  font-size: 8px;
  font-weight: 600;
  color: var(--muted-soft);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.mobile-drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  position: relative;
}

.mobile-nav-item:hover {
  color: var(--primary);
  background: #f1f5f9;
}

.mobile-nav-item.active {
  font-weight: 700;
  color: var(--primary);
  background: rgba(2, 41, 67, 0.05);
}

.mobile-nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 3px;
  background: var(--red);
  border-radius: 0 999px 999px 0;
}

.mobile-nav-item svg {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .sidebar {
    display: flex;
  }

  .app-main {
    margin-left: 260px;
  }

  .app-layout.sidebar-collapsed .app-main {
    margin-left: 76px;
  }

  .app-header {
    padding: 0 2rem;
  }

  .shell {
    padding: 2rem;
  }

  .app-footer {
    padding: 0 2rem 0.75rem;
  }

  .mobile-menu-btn {
    display: none;
  }

  .app-user {
    display: flex;
  }

  .mobile-drawer {
    display: none !important;
  }
}

/* ── Buttons ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--primary);
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  font-size: var(--text-body);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  background: var(--secondary);
  text-decoration: none;
}

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

.btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn.ghost:hover {
  color: var(--primary);
  background: var(--secondary);
}

.btn.block {
  width: 100%;
  height: 3rem;
}

/* ── Panels / stats ───────────────────────────────────────────────────── */

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  padding: 1.25rem 1.35rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.stats {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 1.1rem;
}

.stat {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.stat label {
  display: block;
  color: var(--muted);
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.55rem;
  line-height: 1;
}

.stat strong {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  line-height: 1.2;
}

.stat strong.stat-scope {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.section-title h2 {
  margin: 0;
  font-size: var(--text-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground);
  line-height: 1.4;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.pager-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pager-page {
  font-size: var(--text-data);
  font-weight: 600;
  color: var(--primary);
  min-width: 6.5rem;
  text-align: center;
}

.pager .btn:disabled,
.pager .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager-size {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
}

.pager-size select {
  min-width: 4.5rem;
}

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

.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 16px;
}

.insight-scope {
  grid-column: 1 / -1;
  font-size: 0.875rem;
}

.insight-card {
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-height: 6.5rem;
}

.insight-card label {
  display: block;
  color: var(--muted);
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.55rem;
}

.insight-card strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
  margin-bottom: 0.35rem;
  overflow-wrap: anywhere;
}

.detail-day-chip {
  font-size: 0.8125rem;
  font-weight: 600;
}

/* ── Login (CDE-inspired) ─────────────────────────────────────────────── */

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: #f1f5f9;
}

::selection {
  background: rgba(237, 28, 36, 0.3);
}

.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-login);
  overflow: hidden;
}

.brand-stripe {
  height: 0.375rem;
  width: 100%;
  display: flex;
}

.brand-stripe span {
  flex: 1;
}

.brand-stripe .c1 { background: var(--turquoise); }
.brand-stripe .c2 { background: var(--yellow); }
.brand-stripe .c3 { background: var(--purple); }
.brand-stripe .c4 { background: var(--skyblue); }
.brand-stripe .c5 { background: var(--magenta); }
.brand-stripe .c6 { background: var(--orange); }

.login-band {
  background: var(--primary);
  color: #fff;
  padding: 1.5rem 2rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.login-band img {
  height: 2rem;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.login-band-divider {
  height: 2.25rem;
  width: 1px;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.login-band h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.login-band p {
  margin: 0.4rem 0 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--red);
}

.login-body {
  padding: 2rem 2rem 2.25rem;
}

.login-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.login-eyebrow .bar {
  height: 1px;
  width: 1.5rem;
  background: var(--red);
}

.login-eyebrow span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(237, 28, 36, 0.8);
}

.login-body h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.login-body > .lede {
  margin: 0 0 1.5rem;
  font-size: var(--text-body);
  color: var(--muted);
  line-height: 1.5;
}

.login-footer {
  margin-top: 2rem;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted-soft);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  text-align: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.field input,
.field select,
select {
  border: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.5);
  color: var(--primary);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: var(--text-body);
  font-weight: 500;
  height: 3rem;
}

.field input:focus,
.field select:focus,
select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.15);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  margin: 1rem 0;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.error {
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  font-size: 0.75rem;
  font-weight: 700;
  margin: 0.5rem 0 0;
  padding: 0.75rem;
}

.success {
  color: var(--turquoise);
  font-size: 0.875rem;
  font-weight: 600;
}

/* ── Tables ───────────────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body);
}

th,
td {
  text-align: left;
  padding: 0.75rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: var(--text-label);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mono {
  font-family: var(--mono);
  font-size: var(--text-data);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

.row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: end;
}

.row .field {
  flex: 1;
  min-width: 160px;
  margin-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--card);
}

.badge.on {
  color: var(--turquoise);
  background: rgba(48, 185, 150, 0.1);
  border-color: rgba(48, 185, 150, 0.3);
}

.badge.off {
  color: var(--orange);
  background: rgba(245, 135, 32, 0.1);
  border-color: rgba(245, 135, 32, 0.3);
}

.api-key-box {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: #f8fafc;
  border: 1px dashed var(--skyblue);
  word-break: break-all;
  font-family: var(--mono);
  font-size: var(--text-data);
  color: var(--primary);
}

tr.clickable {
  cursor: pointer;
}

tr.clickable:hover td {
  background: rgba(48, 185, 150, 0.06);
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.detail-title {
  margin: 0 0 0.25rem;
  font-size: var(--text-h2);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--primary);
}

.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.875rem;
}

.shot-card {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.shot-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #0f172a;
}

.shot-card figcaption {
  padding: 0.65rem 0.75rem 0.85rem;
  font-size: var(--text-data);
}

.url-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.url-cell a {
  color: var(--skyblue);
  font-size: var(--text-data);
}

.section-label {
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.device-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.device-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.device-card:hover {
  border-color: #b8c4d0;
  box-shadow: 0 8px 20px -6px rgba(2, 41, 67, 0.12);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}

.device-card-shot {
  aspect-ratio: 16 / 10;
  background: #0f172a;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-card-shot.empty {
  background: #eef2f6;
  color: var(--muted);
  font-size: var(--text-data);
  font-weight: 600;
}

.device-card-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.device-card-body {
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.device-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.device-card-top strong {
  display: block;
  color: var(--primary);
  font-size: 0.95rem;
}

.device-card-top p {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
}

.device-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.device-card-metrics label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.device-card-metrics strong {
  font-size: 0.8rem;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.device-card-caption {
  margin: 0;
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-panel {
  margin-bottom: 0;
}

.date-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.date-strip-header strong {
  color: var(--primary);
  font-size: 0.95rem;
}

.date-strip-scroll {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  margin-bottom: 1rem;
  scrollbar-width: thin;
}

.date-chip {
  flex: 0 0 auto;
  min-width: 3.1rem;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius);
  padding: 0.45rem 0.35rem 0.55rem;
  cursor: pointer;
  color: var(--muted);
}

.date-chip-weekday {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.date-chip-day {
  display: block;
  margin-top: 0.15rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.date-chip.active {
  border-color: var(--turquoise);
  background: rgba(48, 185, 150, 0.08);
  box-shadow: inset 0 -3px 0 var(--turquoise);
}

.timeline-summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.timeline-day-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  color: var(--primary);
}

.timeline-metrics {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-size: var(--text-body);
}

.timeline-metrics strong {
  font-size: 1.6rem;
  color: var(--primary);
  letter-spacing: -0.03em;
}

.timeline-metrics .dot {
  color: var(--muted-soft);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(48, 185, 150, 0.12);
  color: var(--turquoise);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.timeline-legend {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.timeline-legend .swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.3rem;
  border-radius: 2px;
  vertical-align: -1px;
}

.timeline-legend .swatch.active { background: #b7e4c7; }
.timeline-legend .swatch.idle { background: #f5b7b1; }
.timeline-legend .swatch.offline { background: #e5e7eb; }

.timeline-scroll {
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scrollbar-width: thin;
}

.timeline-track {
  min-width: 960px;
  position: relative;
}

.timeline-hours {
  position: relative;
  height: 1.1rem;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.timeline-hours span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.timeline-bars {
  display: grid;
  grid-template-columns: repeat(96, minmax(0, 1fr));
  gap: 1px;
  height: 2.75rem;
  background: #eef2f6;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.timeline-slot {
  border: 0;
  padding: 0;
  min-width: 0;
  cursor: pointer;
  background: #eef2f6;
}

.timeline-slot.status-active { background: #b7e4c7; }
.timeline-slot.status-idle { background: #f5b7b1; }
.timeline-slot.status-offline { background: #eef2f6; }

.timeline-slot:hover,
.timeline-slot.selected {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  z-index: 1;
}

.timeline-scrubber {
  position: relative;
  height: 1.5rem;
  margin-top: 0.45rem;
  user-select: none;
  touch-action: none;
}

.timeline-scrubber-rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 999px;
  background: #d8dee6;
  cursor: pointer;
}

.timeline-scrubber.active .timeline-scrubber-rail {
  background: linear-gradient(90deg, rgba(48, 185, 150, 0.35), rgba(78, 190, 199, 0.45));
}

.timeline-scrubber-thumb {
  position: absolute;
  top: 50%;
  width: 1.15rem;
  height: 1.15rem;
  margin-left: -0.575rem;
  margin-top: -0.575rem;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(2, 41, 67, 0.28);
  cursor: grab;
  z-index: 2;
  padding: 0;
}

.timeline-scrubber-thumb.parked {
  background: #64748b;
  opacity: 0.85;
}

.timeline-scrubber-thumb:active,
body.timeline-dragging .timeline-scrubber-thumb {
  cursor: grabbing;
  transform: scale(1.08);
}

body.timeline-dragging {
  cursor: grabbing;
  user-select: none;
}

body.timeline-dragging .timeline-scroll {
  overflow-x: hidden;
}

.timeline-focus {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: var(--radius);
  min-height: 4.5rem;
}

.timeline-focus.empty {
  display: flex;
  align-items: center;
}

.timeline-focus-time {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.timeline-focus-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
  flex-wrap: wrap;
}

.timeline-focus-main strong {
  color: var(--primary);
}

.timeline-focus-main .btn {
  margin-left: auto;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
}

@media (max-width: 720px) {
  .grid.two {
    grid-template-columns: 1fr;
  }

  .insight-grid {
    grid-template-columns: 1fr 1fr;
  }

  .device-card-metrics {
    grid-template-columns: 1fr;
  }

  .login-band {
    padding: 1.25rem 1.5rem 1rem;
  }

  .login-body {
    padding: 1.5rem;
  }
}

/* ── CDE / Transport design system utilities ─────────────────────────── */

.cde-card {
  background: var(--card);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.cde-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.cde-card-header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.cde-card-header .muted {
  font-size: 0.75rem;
  color: var(--muted);
}

.cde-card-body {
  padding: 1.25rem;
}

.cde-card-body.no-padding {
  padding: 0;
}

.cde-section-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.cde-table-wrap {
  overflow-x: auto;
}

.cde-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.cde-table thead {
  background: #f8fafc;
}

.cde-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.cde-table td {
  padding: 0.85rem 1rem;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}

.cde-table tbody tr:hover {
  background: #f8fafc;
}

.cde-table tbody tr:last-child td {
  border-bottom: none;
}

.cde-table .mono {
  color: var(--primary);
}

.cde-table .muted {
  color: var(--muted);
}

.cde-table a {
  color: var(--skyblue);
}

.cde-table a:hover {
  text-decoration: underline;
}

.cde-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border: 1px solid;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
  border-radius: 0;
}

.cde-pill.green {
  color: #0f766e;
  background: rgba(48, 185, 150, 0.12);
  border-color: rgba(48, 185, 150, 0.3);
}

.cde-pill.red {
  color: #991b1b;
  background: rgba(237, 28, 36, 0.1);
  border-color: rgba(237, 28, 36, 0.25);
}

.cde-pill.amber {
  color: #92400e;
  background: rgba(245, 135, 32, 0.12);
  border-color: rgba(245, 135, 32, 0.3);
}

.cde-pill.sky {
  color: #155e75;
  background: rgba(78, 190, 199, 0.12);
  border-color: rgba(78, 190, 199, 0.3);
}

.cde-pill.slate {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.cde-pill.navy {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.cde-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 1rem;
  border: 1px solid;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  background: #fff;
  border-color: #e2e8f0;
  color: #334155;
}

.cde-btn:hover {
  border-color: var(--skyblue);
  color: var(--primary);
  text-decoration: none;
}

.cde-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.cde-btn.primary:hover {
  background: #033a5f;
  border-color: #033a5f;
}

.cde-btn.danger {
  color: #991b1b;
  background: rgba(237, 28, 36, 0.08);
  border-color: rgba(237, 28, 36, 0.25);
}

.cde-btn.danger:hover {
  background: rgba(237, 28, 36, 0.15);
  border-color: rgba(237, 28, 36, 0.4);
}

.cde-btn.small {
  height: 1.75rem;
  padding: 0 0.75rem;
  font-size: 10px;
}

.cde-btn.block {
  width: 100%;
}

.cde-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.cde-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cde-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.cde-form .field {
  margin-bottom: 0;
}

.cde-form .field label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.cde-form .actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.cde-empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

.cde-empty strong {
  display: block;
  color: var(--primary);
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

/* ── Align existing component classes to CDE / Transport ─────────────── */

.panel {
  background: var(--card);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  padding: 1.25rem;
}

.section-title h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.btn {
  height: 2.25rem;
  padding: 0 1rem;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius);
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn.ghost:hover {
  color: var(--primary);
  background: #f1f5f9;
}

.badge {
  border-radius: 0;
  padding: 0.15rem 0.45rem;
  font-size: 9px;
  letter-spacing: 0.06em;
}

.badge.on {
  color: #0f766e;
  background: rgba(48, 185, 150, 0.12);
  border-color: rgba(48, 185, 150, 0.3);
}

.badge.off {
  color: #92400e;
  background: rgba(245, 135, 32, 0.12);
  border-color: rgba(245, 135, 32, 0.3);
}

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

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.875rem;
}

thead {
  background: #f8fafc;
}

th {
  padding: 0.75rem 1rem;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid #e2e8f0;
}

td {
  padding: 0.85rem 1rem;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}

tbody tr:hover {
  background: #f8fafc;
}

tbody tr:last-child td {
  border-bottom: none;
}

.filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: rgba(48, 185, 150, 0.06);
  border: 1px solid rgba(48, 185, 150, 0.2);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.section-title .row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.grid.insights {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.insight-card .cde-card-body {
  padding-top: 0.75rem;
}

.insight-rows {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.insight-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.insight-row-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--primary);
}

.insight-rank {
  width: 1.25rem;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted-soft);
}

.insight-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.insight-value {
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
}

.insight-bar-bg {
  height: 0.5rem;
  background: #e2e8f0;
  border-radius: 0;
  overflow: hidden;
}

.insight-bar {
  height: 100%;
  background: var(--skyblue);
  border-radius: 0;
  transition: width 0.3s ease;
}

.insight-card:nth-child(2) .insight-bar {
  background: var(--turquoise);
}

.insight-card:nth-child(3) .insight-bar {
  background: var(--purple);
}

@media (min-width: 1024px) {
  .grid.insights {
    grid-template-columns: repeat(3, 1fr);
  }
}
