@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  color-scheme: light;
  --ink: #1f2a34;
  --muted: #5c6670;
  --paper: #f7efe5;
  --panel: #fffaf2;
  --accent: #e4572e;
  --accent-2: #0b7a75;
  --accent-3: #f0b429;
  --line: #d8cfc3;
  --accent-rgb: 228, 87, 46;
  --accent-2-rgb: 11, 122, 117;
  --accent-3-rgb: 240, 180, 41;
  --ink-rgb: 31, 42, 52;
  --muted-rgb: 92, 102, 112;
  --line-rgb: 216, 207, 195;
  --shadow: 0 18px 45px rgba(24, 32, 38, 0.18);
  --radius: 18px;
  --bg-a: rgba(228, 87, 46, 0.18);
  --bg-b: rgba(11, 122, 117, 0.15);
  --bg-base-1: #f6efe4;
  --bg-base-2: #e5f1ee;
  --grid: rgba(31, 42, 52, 0.04);
  --ghost-bg: rgba(31, 42, 52, 0.08);
}

:root[data-mode="dark"] {
  color-scheme: dark;
}

:root[data-theme="ember"][data-mode="dark"] {
  --ink: #f1ede7;
  --muted: #c0b2a2;
  --paper: #141110;
  --panel: #1e1916;
  --accent: #ff7a3d;
  --accent-2: #2ec4b6;
  --accent-3: #f4c45a;
  --line: #302722;
  --accent-rgb: 255, 122, 61;
  --accent-2-rgb: 46, 196, 182;
  --accent-3-rgb: 244, 196, 90;
  --ink-rgb: 241, 237, 231;
  --muted-rgb: 192, 178, 162;
  --line-rgb: 48, 39, 34;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  --bg-a: rgba(255, 122, 61, 0.15);
  --bg-b: rgba(46, 196, 182, 0.12);
  --bg-base-1: #171311;
  --bg-base-2: #120f0d;
  --grid: rgba(255, 255, 255, 0.04);
  --ghost-bg: rgba(255, 255, 255, 0.1);
}

:root[data-theme="tide"][data-mode="light"] {
  --ink: #1b2a32;
  --muted: #5e6f7a;
  --paper: #eef4f6;
  --panel: #f9fcfd;
  --accent: #006d77;
  --accent-2: #3a86ff;
  --accent-3: #90be6d;
  --line: #d2dde3;
  --accent-rgb: 0, 109, 119;
  --accent-2-rgb: 58, 134, 255;
  --accent-3-rgb: 144, 190, 109;
  --ink-rgb: 27, 42, 50;
  --muted-rgb: 94, 111, 122;
  --line-rgb: 210, 221, 227;
  --shadow: 0 18px 45px rgba(18, 36, 45, 0.16);
  --bg-a: rgba(0, 109, 119, 0.16);
  --bg-b: rgba(58, 134, 255, 0.12);
  --bg-base-1: #edf5f7;
  --bg-base-2: #e2eef4;
  --grid: rgba(27, 42, 50, 0.04);
  --ghost-bg: rgba(27, 42, 50, 0.08);
}

:root[data-theme="tide"][data-mode="dark"] {
  --ink: #e4f1f6;
  --muted: #9fb0bb;
  --paper: #0d171d;
  --panel: #14222a;
  --accent: #2bd4c7;
  --accent-2: #3fa9f5;
  --accent-3: #a7d39c;
  --line: #223543;
  --accent-rgb: 43, 212, 199;
  --accent-2-rgb: 63, 169, 245;
  --accent-3-rgb: 167, 211, 156;
  --ink-rgb: 228, 241, 246;
  --muted-rgb: 159, 176, 187;
  --line-rgb: 34, 53, 67;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  --bg-a: rgba(43, 212, 199, 0.12);
  --bg-b: rgba(63, 169, 245, 0.12);
  --bg-base-1: #0e171d;
  --bg-base-2: #0a1217;
  --grid: rgba(255, 255, 255, 0.04);
  --ghost-bg: rgba(255, 255, 255, 0.1);
}

:root[data-theme="forge"][data-mode="light"] {
  --ink: #2b2a27;
  --muted: #6b625b;
  --paper: #f4f2ee;
  --panel: #fbf7f2;
  --accent: #d1495b;
  --accent-2: #3d5a80;
  --accent-3: #f4a261;
  --line: #d6cec4;
  --accent-rgb: 209, 73, 91;
  --accent-2-rgb: 61, 90, 128;
  --accent-3-rgb: 244, 162, 97;
  --ink-rgb: 43, 42, 39;
  --muted-rgb: 107, 98, 91;
  --line-rgb: 214, 206, 196;
  --shadow: 0 18px 45px rgba(34, 32, 30, 0.16);
  --bg-a: rgba(209, 73, 91, 0.16);
  --bg-b: rgba(61, 90, 128, 0.12);
  --bg-base-1: #f6f1ea;
  --bg-base-2: #eae2da;
  --grid: rgba(43, 42, 39, 0.04);
  --ghost-bg: rgba(43, 42, 39, 0.08);
}

:root[data-theme="forge"][data-mode="dark"] {
  --ink: #f2efea;
  --muted: #b6aaa0;
  --paper: #151210;
  --panel: #201b18;
  --accent: #ff6b6b;
  --accent-2: #4f91cd;
  --accent-3: #f4a261;
  --line: #2d2622;
  --accent-rgb: 255, 107, 107;
  --accent-2-rgb: 79, 145, 205;
  --accent-3-rgb: 244, 162, 97;
  --ink-rgb: 242, 239, 234;
  --muted-rgb: 182, 170, 160;
  --line-rgb: 45, 38, 34;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  --bg-a: rgba(255, 107, 107, 0.12);
  --bg-b: rgba(79, 145, 205, 0.12);
  --bg-base-1: #151210;
  --bg-base-2: #110e0c;
  --grid: rgba(255, 255, 255, 0.04);
  --ghost-bg: rgba(255, 255, 255, 0.1);
}

:root[data-theme="prairie"][data-mode="light"] {
  --ink: #2a2f24;
  --muted: #6c7563;
  --paper: #f4f1e6;
  --panel: #fbf9f0;
  --accent: #a84516;
  --accent-2: #2f8f68;
  --accent-3: #d1a24a;
  --line: #d7d1c3;
  --accent-rgb: 168, 69, 22;
  --accent-2-rgb: 47, 143, 104;
  --accent-3-rgb: 209, 162, 74;
  --ink-rgb: 42, 47, 36;
  --muted-rgb: 108, 117, 99;
  --line-rgb: 215, 209, 195;
  --shadow: 0 18px 45px rgba(35, 39, 32, 0.16);
  --bg-a: rgba(168, 69, 22, 0.14);
  --bg-b: rgba(47, 143, 104, 0.12);
  --bg-base-1: #f5f2e9;
  --bg-base-2: #e8efe3;
  --grid: rgba(42, 47, 36, 0.04);
  --ghost-bg: rgba(42, 47, 36, 0.08);
}

:root[data-theme="prairie"][data-mode="dark"] {
  --ink: #f2f0e9;
  --muted: #b6b0a0;
  --paper: #121511;
  --panel: #1b2018;
  --accent: #ff8c4a;
  --accent-2: #4dd1a0;
  --accent-3: #f2c56f;
  --line: #2c332a;
  --accent-rgb: 255, 140, 74;
  --accent-2-rgb: 77, 209, 160;
  --accent-3-rgb: 242, 197, 111;
  --ink-rgb: 242, 240, 233;
  --muted-rgb: 182, 176, 160;
  --line-rgb: 44, 51, 42;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  --bg-a: rgba(255, 140, 74, 0.14);
  --bg-b: rgba(77, 209, 160, 0.12);
  --bg-base-1: #131711;
  --bg-base-2: #0f120e;
  --grid: rgba(255, 255, 255, 0.04);
  --ghost-bg: rgba(255, 255, 255, 0.1);
}

:root[data-theme="mesa"][data-mode="light"] {
  --ink: #2a1f1a;
  --muted: #6d5a50;
  --paper: #f5eee8;
  --panel: #fff7f1;
  --accent: #c6542c;
  --accent-2: #3d7c89;
  --accent-3: #efb35e;
  --line: #dcc9bc;
  --accent-rgb: 198, 84, 44;
  --accent-2-rgb: 61, 124, 137;
  --accent-3-rgb: 239, 179, 94;
  --ink-rgb: 42, 31, 26;
  --muted-rgb: 109, 90, 80;
  --line-rgb: 220, 201, 188;
  --shadow: 0 18px 45px rgba(40, 29, 24, 0.16);
  --bg-a: rgba(198, 84, 44, 0.16);
  --bg-b: rgba(61, 124, 137, 0.12);
  --bg-base-1: #f7efe8;
  --bg-base-2: #efe4da;
  --grid: rgba(42, 31, 26, 0.04);
  --ghost-bg: rgba(42, 31, 26, 0.08);
}

:root[data-theme="mesa"][data-mode="dark"] {
  --ink: #f5ede7;
  --muted: #c1afa5;
  --paper: #14110f;
  --panel: #1f1a16;
  --accent: #ff7f4b;
  --accent-2: #4fc3d3;
  --accent-3: #f3c06f;
  --line: #2f2621;
  --accent-rgb: 255, 127, 75;
  --accent-2-rgb: 79, 195, 211;
  --accent-3-rgb: 243, 192, 111;
  --ink-rgb: 245, 237, 231;
  --muted-rgb: 193, 175, 165;
  --line-rgb: 47, 38, 33;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  --bg-a: rgba(255, 127, 75, 0.14);
  --bg-b: rgba(79, 195, 211, 0.12);
  --bg-base-1: #151210;
  --bg-base-2: #110e0c;
  --grid: rgba(255, 255, 255, 0.04);
  --ghost-bg: rgba(255, 255, 255, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(900px 600px at 15% -10%, var(--bg-a), transparent 60%),
    radial-gradient(900px 600px at 85% 0%, var(--bg-b), transparent 65%),
    linear-gradient(120deg, var(--bg-base-1), var(--bg-base-2));
  background-attachment: fixed;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    135deg,
    var(--grid) 0,
    var(--grid) 1px,
    transparent 1px,
    transparent 12px
  );
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  letter-spacing: -0.02em;
}

h1 {
  margin: 8px 0 4px;
  font-size: clamp(2rem, 3vw, 2.8rem);
}

p {
  margin: 0;
  color: var(--muted);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: rise 0.7s ease both;
  position: relative;
  z-index: 80;
}

.brand p {
  max-width: 460px;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.brand-title h1 {
  margin: 0;
}

.brand-logo {
  height: 44px;
  width: auto;
  display: none;
}

:root[data-mode="light"] .brand-logo-light {
  display: block;
}

:root[data-mode="dark"] .brand-logo-dark {
  display: block;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

  .top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .user-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }

  .app-clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    line-height: 1.1;
  }

  .app-clock-date {
    font-size: 0.85rem;
    letter-spacing: 0.02em;
  }

  .app-clock-time {
    font-size: 1.05rem;
    font-weight: 600;
  }

.theme-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-builder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.theme-builder-column {
  display: grid;
  gap: 10px;
}

.theme-color {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
}

.theme-color input[type="color"] {
  width: 44px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(var(--accent-2-rgb), 0.12);
  color: var(--accent-2);
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  background: var(--accent-2);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(var(--accent-2-rgb), 0.2);
  animation: pulse 1.6s ease infinite;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-weight: 600;
}

.user-pill form {
  margin: 0;
}

.icon-button {
  padding: 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  min-width: 32px;
  min-height: 32px;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.metrics {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.hos-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 12px 25px rgba(24, 32, 38, 0.12);
  animation: rise 0.7s ease both;
}

.metric-title {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.metric:nth-child(2) {
  animation-delay: 0.1s;
}

.metric:nth-child(3) {
  animation-delay: 0.2s;
}

.metric:nth-child(4) {
  animation-delay: 0.3s;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  margin: 8px 0;
}

.metric-note {
  font-size: 0.85rem;
}

.board {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

  .stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .manual-section h3 {
    margin-top: 18px;
    margin-bottom: 6px;
  }

  .manual-section ul,
  .manual-list {
    margin: 8px 0 0;
    padding-left: 18px;
    display: grid;
    gap: 6px;
  }

  .manual-toc-list {
    display: grid;
    gap: 10px;
  }

  .manual-toc-link {
    display: block;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: inherit;
    text-decoration: none;
  }

  .manual-toc-link:hover {
    border-color: var(--accent-2);
    box-shadow: 0 10px 18px rgba(var(--line-rgb), 0.35);
  }

  .manual-toc-link.active {
    border-color: transparent;
    background: var(--accent-2);
    color: #fff;
  }

  .manual-toc-title {
    font-weight: 600;
  }

  .manual-toc-summary {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 4px;
  }

  .manual-toc-link.active .manual-toc-summary {
    color: rgba(255, 255, 255, 0.8);
  }

  .manual-actions {
    display: grid;
    gap: 8px;
  }

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  animation: rise 0.7s ease both;
}

.tall {
  min-height: 520px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.panel-header h3 {
  margin: 0;
  font-size: 1rem;
}

.pill {
  background: rgba(var(--ink-rgb), 0.08);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  color: var(--muted);
}

.pill-select {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pill-select-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
}

.pill-select-item {
  appearance: none;
  border: 1px solid rgba(var(--accent-2-rgb), 0.3);
  background: rgba(var(--accent-2-rgb), 0.12);
  color: var(--accent-2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
}

.pill-select-item:focus {
  outline: 2px solid rgba(var(--accent-2-rgb), 0.4);
  outline-offset: 2px;
}

.pill-select-remove {
  font-weight: 700;
  opacity: 0.7;
}

.pill-select-item:hover .pill-select-remove {
  opacity: 1;
}

.pill-select-empty {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 2px 6px;
}

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

.condensed {
  gap: 8px;
}

.load-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  animation: rise 0.4s ease both;
}

.load-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.load-ref {
  font-weight: 600;
  color: var(--ink);
}

.load-route {
  font-size: 0.9rem;
}

.load-schedule {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.load-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 0.85rem;
  margin: 10px 0 12px;
  color: var(--muted);
}

.load-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--accent);
}

.status-badge.soft {
  background: rgba(var(--accent-2-rgb), 0.12);
  color: var(--accent-2);
}

.status-badge.available,
.status-badge.on-duty,
.status-badge.dispatched,
.status-badge.planning,
.status-badge.assigned,
.status-badge.open,
.status-badge.resolved {
  background: rgba(var(--accent-2-rgb), 0.15);
  color: var(--accent-2);
}

.status-badge.in-transit {
  background: rgba(var(--accent-3-rgb), 0.2);
  color: var(--accent-3);
}

.status-badge.off-duty,
.status-badge.in-service,
.status-badge.out-of-service,
.status-badge.new,
.status-badge.planned,
.status-badge.deferred,
.status-badge.low {
  background: rgba(var(--muted-rgb), 0.16);
  color: var(--muted);
}

.status-badge.delivered,
.status-badge.loaded,
.status-badge.critical {
  background: rgba(var(--accent-rgb), 0.18);
  color: var(--accent);
}

.status-badge.in-progress,
.status-badge.high,
.status-badge.medium {
  background: rgba(var(--accent-3-rgb), 0.2);
  color: var(--accent-3);
}

.mini-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.detail-list {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--ink);
}

.detail-list strong {
  font-weight: 600;
}

.map-block {
  margin-top: 16px;
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.map-frame {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
}

  .map-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    padding: 16px;
    border-radius: 16px;
    border: 1px dashed var(--line);
    color: var(--muted);
    font-size: 0.85rem;
    background: var(--panel);
  }

  .map-message {
    font-size: 0.8rem;
    color: var(--muted);
    min-height: 1rem;
    margin: 6px 0 10px;
  }

.map-pin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.map-pin--link {
  cursor: pointer;
  pointer-events: auto;
}

.map-pin-label {
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
}

.map-pin-label[href] {
  cursor: pointer;
}

.map-pin-label:hover,
.map-pin-label:focus {
  text-decoration: underline;
}

.map-pin::before {
  content: '';
  width: 8px;
  height: 8px;
    border-radius: 999px;
    background: var(--accent);
  }

  .map-pin--trailer::before {
    background: var(--accent-2);
  }

  .map-pin--tractor::before {
    background: var(--accent-3);
  }

.map-cluster {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--panel);
  border: 2px solid var(--panel);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  font-size: 0.78rem;
  font-weight: 700;
}

.map-cluster-count {
  pointer-events: none;
}

.map-cluster-list {
  display: none;
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  gap: 8px;
}

.map-cluster-list.active {
  display: grid;
}

.map-cluster-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
}

.map-cluster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(var(--ink-rgb), 0.04);
  font-size: 0.85rem;
}

.map-cluster-item a {
  text-decoration: none;
}

.map-cluster-item a:hover,
.map-cluster-item a:focus {
  text-decoration: underline;
}

.map-cluster-meta {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.mini-button {
  padding: 4px 8px;
  font-size: 0.72rem;
}

.log-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(var(--ink-rgb), 0.12);
  color: var(--muted);
}

.log-status.driving {
  background: rgba(var(--accent-2-rgb), 0.15);
  color: var(--accent-2);
}

.log-status.yard_move {
  background: rgba(var(--accent-3-rgb), 0.2);
  color: var(--accent-3);
}

.log-status.on_duty {
  background: rgba(var(--accent-3-rgb), 0.2);
  color: var(--accent-3);
}

.log-status.off_duty,
.log-status.sleeper {
  background: rgba(var(--muted-rgb), 0.16);
  color: var(--muted);
}

.log-violation {
  background: rgba(var(--accent-rgb), 0.08);
}

.danger-pill {
  background: rgba(var(--accent-rgb), 0.2);
  color: var(--accent);
  font-weight: 700;
}

.log-grid-wrapper {
  margin: 18px 0 20px;
}

.log-grid {
  display: grid;
  gap: 8px;
}

.log-grid-scale,
.log-grid-row {
  display: grid;
  grid-template-columns: 60px 1fr 60px;
  gap: 10px;
  align-items: center;
}

.log-grid-scale {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.log-grid-hours {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
  gap: 6px;
}

.log-grid-hours span {
  display: inline-block;
  transform: rotate(-35deg);
  transform-origin: bottom left;
  white-space: nowrap;
}

.log-grid-status {
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.log-grid-track {
  position: relative;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background-color: rgba(var(--ink-rgb), 0.03);
  background-image:
    linear-gradient(to right, rgba(var(--line-rgb), 0.4) 1px, transparent 1px),
    linear-gradient(to right, rgba(var(--line-rgb), 0.2) 1px, transparent 1px);
  background-size: calc(100% / 24) 100%, calc(100% / 96) 100%;
  background-position: left top;
  overflow: hidden;
}

.log-grid-segment {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 6px;
  min-width: 2px;
  display: block;
  z-index: 2;
  background: rgba(var(--accent-2-rgb), 0.7);
  box-shadow: inset 0 0 0 1px rgba(var(--ink-rgb), 0.15);
}

.log-grid-segment.off_duty {
  background: rgba(var(--accent-2-rgb), 0.7);
}

.log-grid-segment.sleeper {
  background: rgba(var(--accent-3-rgb), 0.7);
}

.log-grid-segment.driving {
  background: rgba(var(--accent-rgb), 0.8);
}

.log-grid-segment.yard_move {
  background: repeating-linear-gradient(
    135deg,
    rgba(var(--accent-3-rgb), 0.9) 0,
    rgba(var(--accent-3-rgb), 0.9) 6px,
    rgba(var(--accent-3-rgb), 0.35) 6px,
    rgba(var(--accent-3-rgb), 0.35) 12px
  );
}

.log-grid-segment.on_duty {
  background: rgba(var(--ink-rgb), 0.35);
}

.log-grid-segment.open {
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.18) 0,
    rgba(255, 255, 255, 0.18) 6px,
    rgba(0, 0, 0, 0) 6px,
    rgba(0, 0, 0, 0) 12px
  );
}

.log-grid-segment.violation {
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.6);
}

.log-grid-total,
.log-grid-total-label {
  text-align: right;
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.log-grid-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.log-event-table td {
  vertical-align: top;
}

.divider {
  height: 1px;
  background: rgba(var(--line-rgb), 0.7);
  margin: 20px 0;
}

.mini-title {
  font-weight: 600;
  color: var(--ink);
}

.mini-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-row button {
  border: 1px solid rgba(var(--muted-rgb), 0.3);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 600;
  cursor: pointer;
}

.tab-row button.active {
  background: var(--accent-2);
  color: #fff;
  border-color: transparent;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.report-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 12px;
  margin-top: 8px;
}

.report-column {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
}

.report-metrics {
  margin-bottom: 24px;
}

.report-charts {
  margin-top: 20px;
  display: grid;
  gap: 18px;
}

.report-chart {
  display: grid;
  gap: 10px;
}

.report-chart-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(180px, 2fr) minmax(60px, 90px);
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
}

.report-chart-label {
  color: var(--ink);
  font-weight: 600;
}

.report-chart-bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(var(--ink-rgb), 0.1);
  overflow: hidden;
}

.report-chart-bar span {
  display: block;
  height: 100%;
  background: var(--accent-2);
  border-radius: 999px;
}

.report-chart-value {
  text-align: right;
  font-weight: 600;
  color: var(--muted);
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.coord-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-width: 220px;
}

.coord-input {
  width: 100%;
}

.equipment-field {
  display: none;
}

.equipment-field.show {
  display: flex;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--ink);
}

.form-grid .inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.auth-panel {
  max-width: 520px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.primary,
.ghost,
.danger {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.primary {
  background: var(--accent);
  color: #fff;
  grid-column: 1 / -1;
}

.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ghost {
  background: var(--ghost-bg);
  color: var(--ink);
}

.danger {
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent);
}

.mini-select {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-family: inherit;
  font-size: 0.8rem;
}

.mini-input {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--ink);
  width: 90px;
}

.clock-input {
  cursor: pointer;
}

.clock-overlay {
  position: fixed;
  inset: 0;
  background: rgba(var(--ink-rgb), 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.clock-overlay.open {
  display: flex;
}

.clock-panel {
  width: min(340px, 92vw);
  background: var(--panel);
  border-radius: 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 20px 22px 18px;
  display: grid;
  gap: 16px;
}

.clock-header {
  display: grid;
  gap: 10px;
}

.clock-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.65rem;
  color: var(--muted);
}

.clock-display {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--ink);
}

.clock-display-part {
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
  opacity: 0.7;
}

.clock-display-part.active {
  opacity: 1;
  color: var(--accent-2);
}

.clock-separator {
  opacity: 0.6;
}

.clock-meridiem {
  display: flex;
  gap: 8px;
}

.clock-meridiem button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 600;
  cursor: pointer;
}

.clock-meridiem button.active {
  background: var(--accent-2);
  color: #fff;
  border-color: transparent;
}

.clock-face {
  position: relative;
  --clock-size: min(260px, 70vw);
  --clock-radius: calc(var(--clock-size) / 2 - 28px);
  width: var(--clock-size);
  height: var(--clock-size);
  margin: 0 auto;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: radial-gradient(circle at center, rgba(var(--accent-2-rgb), 0.1), transparent 60%);
}

.clock-number {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.clock-number.active {
  background: var(--accent-2);
  color: #fff;
}

.clock-number.minor {
  width: 12px;
  height: 12px;
  font-size: 0;
  background: rgba(var(--ink-rgb), 0.2);
}

.clock-number.minor.active {
  width: 20px;
  height: 20px;
  background: var(--accent-2);
}

.clock-hand {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: calc(var(--clock-radius) - 6px);
  background: var(--accent-2);
  transform-origin: bottom center;
  transform: translate(-50%, -100%);
}

.clock-hand::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-2);
  transform: translateX(-50%);
  box-shadow: 0 0 0 8px rgba(var(--accent-2-rgb), 0.15);
}

.clock-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-2);
  transform: translate(-50%, -50%);
}

.clock-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.nav-group {
  position: relative;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.nav-group.active .nav-toggle,
.nav-group.open .nav-toggle {
  background: var(--accent-2);
  color: #fff;
  border-color: transparent;
}

.nav-caret {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.nav-group.open .nav-caret {
  transform: rotate(180deg);
}

.nav-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 200px;
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--panel);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 120;
}

.nav-group.open .nav-menu {
  display: flex;
}

.nav-item {
  text-decoration: none;
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
}

.nav-item:hover,
.nav-item:focus {
  background: rgba(var(--accent-2-rgb), 0.12);
  color: var(--accent-2);
}

.nav-item.active {
  background: var(--accent-2);
  color: #fff;
}

.nav-toggle-button {
  display: none;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 4px 16px;
}

.page-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.page-header p {
  max-width: 520px;
}

.grid-split {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 20px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  color: var(--muted);
  padding: 0 8px 10px;
}

.table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  vertical-align: top;
}

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

.table tr:target td {
  background: rgba(var(--accent-2-rgb), 0.12);
}

.table .muted {
  color: var(--muted);
  font-size: 0.8rem;
}

.pagination-row {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.pagination-row--top {
  margin: 8px 0 12px;
}

.pagination-row--bottom {
  margin: 12px 0 0;
}

.pagination {
  list-style: none;
  display: flex;
  gap: 10px;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.pagination-limit-form {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.pagination-limit-form label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pagination-limit-form .mini-select {
  min-width: 70px;
}

.pagination li {
  display: inline-flex;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 0.85rem;
  text-decoration: none;
}

.pagination a:hover,
.pagination a:focus {
  background: rgba(var(--accent-2-rgb), 0.12);
  color: var(--accent-2);
}

.pagination .disabled span {
  opacity: 0.5;
}

.alert {
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(var(--accent-2-rgb), 0.12);
  color: var(--accent-2);
  font-weight: 600;
}

.alert.error {
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent);
}

.alert ul {
  margin: 8px 0 0 18px;
  padding: 0;
  color: var(--ink);
  font-weight: 500;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.actions-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.link-button {
  padding: 0;
  border: none;
  background: none;
  color: var(--accent-2);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.link-button:hover,
.link-button:focus {
  text-decoration: underline;
}

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

.stop-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.stop-row .danger {
  grid-column: 1 / -1;
  justify-self: flex-end;
}

.inline-details summary {
  list-style: none;
}

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

.inline-details[open] {
  width: min(360px, 80vw);
}

.inline-details[open] summary {
  margin-bottom: 8px;
}

.delete-form {
  display: inline;
}

.footer {
  margin-top: 32px;
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}

.context-help {
  margin-top: 24px;
}

.context-help-actions {
  margin-top: 12px;
}

.footer h3 {
  margin: 0 0 6px;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-logo {
  display: inline-flex;
  align-items: center;
}

.footer-logo img {
  height: 32px;
  width: auto;
  display: none;
}

:root[data-mode="light"] .footer-logo .logo-light {
  display: block;
}

:root[data-mode="dark"] .footer-logo .logo-dark {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

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

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

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

@media (max-width: 900px) {
  .nav-toggle-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 10px;
  }

  .nav-links[data-open="true"] {
    display: flex;
  }

  .nav-group {
    width: 100%;
  }

  .nav-toggle {
    width: 100%;
    justify-content: space-between;
  }

.nav-menu {
    position: static;
    box-shadow: none;
    padding: 8px;
    margin-top: 8px;
    width: 100%;
    min-width: 0;
  }
}

.access-matrix {
  display: grid;
  gap: 16px;
}

.access-row {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: 12px;
  align-items: start;
}

.access-label {
  font-weight: 600;
}

.access-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 12px;
}

@media (max-width: 720px) {
  #app {
    padding: 24px 16px 36px;
  }

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

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .report-chart-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .report-chart-value {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
