:root {
  --bg-deep: #050a12;
  --bg-panel: rgba(12, 20, 34, 0.88);
  --bg-panel-soft: rgba(14, 25, 42, 0.78);
  --line: rgba(95, 220, 255, 0.35);
  --line-strong: rgba(98, 239, 255, 0.75);
  --text-main: #eaf7ff;
  --text-soft: #9ec3d8;
  --cyan: #59e5ff;
  --mint: #52f2b8;
  --warning: #ffba52;
  --danger: #ff5f85;
  --shadow: 0 0 40px rgba(49, 139, 255, 0.16);
  --font-display: "Orbitron", "Segoe UI", sans-serif;
  --font-body: "Rajdhani", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text-main);
  background:
    radial-gradient(circle at 20% 10%, rgba(56, 143, 255, 0.28) 0%, transparent 36%),
    radial-gradient(circle at 83% 88%, rgba(0, 237, 182, 0.18) 0%, transparent 30%),
    linear-gradient(140deg, #03060d 10%, #050a12 45%, #0a1020 100%);
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 185, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 185, 255, 0.08) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.7), transparent 80%);
  opacity: 0.32;
}

.app-shell {
  position: relative;
  z-index: 1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100vh;
}

.topbar {
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(120deg, rgba(42, 106, 176, 0.22), rgba(23, 42, 72, 0.48)),
    var(--bg-panel);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-block h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1vw + 1rem, 1.8rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 0 8px rgba(88, 229, 255, 0.45));
}

.eyebrow {
  margin: 0 0 4px 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-soft);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  border: 1px solid rgba(112, 229, 255, 0.4);
  border-radius: 999px;
  background: rgba(7, 27, 50, 0.7);
  padding: 6px 12px;
  font-size: 0.92rem;
}

.chip[data-mode="ok"] {
  border-color: rgba(82, 242, 184, 0.9);
}

.chip[data-mode="loading"] {
  border-color: rgba(89, 229, 255, 0.9);
}

.chip[data-mode="error"] {
  border-color: rgba(255, 95, 133, 0.9);
}

.ghost-btn,
.primary-btn,
.danger-btn {
  border-radius: 10px;
  border: 1px solid rgba(115, 208, 255, 0.45);
  padding: 7px 12px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ghost-btn {
  background: rgba(10, 31, 55, 0.65);
}

.ghost-btn:hover {
  background: rgba(24, 61, 103, 0.85);
}

.primary-btn {
  background: linear-gradient(100deg, rgba(42, 157, 255, 0.7), rgba(44, 233, 178, 0.45));
  border-color: rgba(89, 229, 255, 0.85);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 16px rgba(89, 229, 255, 0.32);
}

.danger-btn {
  border-color: rgba(255, 95, 133, 0.6);
  background: rgba(58, 20, 38, 0.75);
}

.danger-btn:hover {
  background: rgba(102, 26, 58, 0.9);
}

.archive-btn {
  border: 1px solid rgba(255, 180, 50, 0.5);
  background: rgba(60, 40, 10, 0.7);
  color: #ffc944;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: var(--font-body);
  transition: background 0.15s;
}
.archive-btn:hover {
  background: rgba(90, 60, 15, 0.9);
}

#archiveViewBtn.archive-active {
  background: linear-gradient(100deg, rgba(255, 200, 50, 0.25), rgba(255, 180, 0, 0.15));
  border-color: #ffc944;
  color: #ffc944;
}

.archived-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 3px;
  background: rgba(255, 180, 50, 0.2);
  color: #ffc944;
  border: 1px solid rgba(255, 180, 50, 0.4);
  vertical-align: middle;
  margin-left: 6px;
  letter-spacing: 0.5px;
}

.admin-track-row.archived {
  opacity: 0.6;
  border-left: 3px solid rgba(255, 180, 50, 0.4);
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-panel-soft);
  box-shadow: var(--shadow);
  padding: 8px 12px;
  animation: reveal 0.35s ease;
}

.stat-card span {
  display: block;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.stat-card strong {
  display: block;
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: #ecfbff;
}

.content-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1.85fr) minmax(360px, 1fr);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(91, 190, 255, 0.2);
}

.panel-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.panel-heading p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.map-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#map {
  min-height: 280px;
  flex: 1;
  background: #0a1e31;
}

/* Prevent white flash when Leaflet redraws tiles */
#map .leaflet-tile-pane {
  background: #0a1e31;
}
.leaflet-container {
  background: #0a1e31 !important;
}

.side-stage {
  min-height: 0;
  display: grid;
  gap: 12px;
  grid-template-rows: minmax(220px, 0.95fr) minmax(260px, 1.05fr);
}

.side-stage > .panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.package-cards,
.timeline,
.admin-tracked-list {
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  flex: 1 1 auto;
  max-height: 100%;
  scrollbar-gutter: stable;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.package-card {
  border: 1px solid rgba(93, 195, 255, 0.26);
  border-left: 4px solid var(--package-color, var(--cyan));
  border-radius: 10px;
  background: rgba(11, 33, 58, 0.72);
  color: var(--text-main);
  text-align: left;
  padding: 9px 11px;
  cursor: pointer;
  animation: reveal 0.35s ease;
}

.package-card:hover {
  border-color: rgba(125, 228, 255, 0.65);
}

.package-card.active {
  box-shadow: 0 0 0 1px rgba(113, 233, 255, 0.6), 0 0 22px rgba(113, 233, 255, 0.18);
}

.package-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--package-color, var(--cyan));
  box-shadow: 0 0 10px var(--package-color, var(--cyan));
}

.package-head strong {
  font-size: 1rem;
}

.package-meta,
.package-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 5px;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.status-pill {
  border: 1px solid rgba(130, 212, 255, 0.4);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-good {
  border-color: rgba(82, 242, 184, 0.8);
  color: #8cffd7;
}

.status-bad {
  border-color: rgba(255, 95, 133, 0.85);
  color: #ff90ad;
}

.status-progress {
  border-color: rgba(90, 217, 255, 0.9);
  color: #8ceaff;
}

.status-out {
  border-color: rgba(255, 186, 82, 0.95);
  color: #ffd6a3;
  box-shadow: 0 0 12px rgba(255, 186, 82, 0.25);
}

.warning-text {
  margin: 7px 0 0 0;
  color: #ffc085;
  font-size: 0.85rem;
}

.package-card.out-for-delivery {
  border-color: rgba(255, 186, 82, 0.85);
  box-shadow: 0 0 0 1px rgba(255, 186, 82, 0.45), 0 0 18px rgba(255, 186, 82, 0.2);
}

.ofd-notice {
  display: inline-block;
  margin: 7px 0 0 0;
  padding: 2px 10px;
  color: #ffd06e;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  font-weight: 700;
  border-radius: 6px;
  animation: pulseWarn 1.2s infinite;
}

.delivered-notice {
  display: inline-block;
  margin: 7px 0 0 0;
  padding: 2px 10px;
  color: #66ee88;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  font-weight: 700;
  border-radius: 6px;
  animation: pulseDeliveredText 1.8s ease-in-out infinite;
}

.location-notice {
  color: #c0c0c0;
  font-size: 0.82rem;
  font-weight: 500;
  margin: 4px 0 2px;
  padding: 2px 8px;
  background: rgba(192, 192, 192, 0.08);
  border-radius: 4px;
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.edd-notice {
  margin: 6px 0 0 0;
  padding: 2px 8px;
  color: #a0cfff;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 5px;
  background: rgba(84, 160, 255, 0.1);
  display: inline-block;
}

@keyframes pulseDeliveredText {
  0%   { color: #44dd66; text-shadow: 0 0 4px rgba(68, 221, 102, 0.3); }
  50%  { color: #ccee22; text-shadow: 0 0 10px rgba(204, 238, 34, 0.5); }
  100% { color: #44dd66; text-shadow: 0 0 4px rgba(68, 221, 102, 0.3); }
}

.timeline-item {
  border: 1px solid rgba(83, 190, 255, 0.26);
  border-radius: 10px;
  padding: 9px 10px;
  background: rgba(9, 29, 50, 0.72);
  animation: reveal 0.35s ease;
}

.timeline-item header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.timeline-item p {
  margin: 6px 0 3px;
  font-size: 0.95rem;
  line-height: 1.2;
}

.timeline-item small {
  color: #94b8cf;
}

.empty-state {
  margin: 0;
  padding: 12px;
  border: 1px dashed rgba(90, 188, 255, 0.35);
  border-radius: 10px;
  color: var(--text-soft);
}

.admin-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 95vw);
  height: 100vh;
  z-index: 8;
  border-left: 1px solid rgba(96, 209, 255, 0.38);
  background:
    linear-gradient(160deg, rgba(18, 38, 62, 0.95), rgba(7, 15, 29, 0.98)),
    var(--bg-panel);
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.45);
  transform: translateX(102%);
  transition: transform 0.25s ease;
  overflow: auto;
  padding: 12px;
}

body.admin-open .admin-panel {
  transform: translateX(0);
}

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

.admin-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.05em;
}

.admin-note {
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.admin-form {
  border: 1px solid rgba(91, 191, 255, 0.24);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
  background: rgba(10, 30, 53, 0.6);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.admin-form h3 {
  margin: 0 0 3px;
  font-size: 1rem;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-form label {
  font-size: 0.86rem;
  color: var(--text-soft);
}

.admin-form input {
  width: 100%;
  background: rgba(7, 24, 41, 0.92);
  border: 1px solid rgba(98, 195, 255, 0.35);
  border-radius: 8px;
  color: var(--text-main);
  padding: 8px;
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.admin-form input:focus {
  outline: none;
  border-color: rgba(89, 229, 255, 0.88);
  box-shadow: 0 0 0 2px rgba(89, 229, 255, 0.18);
}

.admin-track-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(95, 195, 255, 0.28);
  border-left: 4px solid var(--package-color, var(--cyan));
  border-radius: 10px;
  padding: 8px;
  background: rgba(11, 32, 55, 0.72);
}

.admin-track-row.editing {
  align-items: stretch;
}

.admin-track-row strong {
  display: block;
}

.admin-track-row small {
  color: var(--text-soft);
}

.admin-row-btns {
  display: flex;
  gap: 8px;
}

.admin-track-edit {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.admin-track-edit label {
  color: var(--text-soft);
  font-size: 0.82rem;
}

.admin-track-edit input {
  width: 100%;
  background: rgba(7, 24, 41, 0.92);
  border: 1px solid rgba(98, 195, 255, 0.35);
  border-radius: 8px;
  color: var(--text-main);
  padding: 7px;
  font-family: var(--font-body);
  font-size: 0.93rem;
}

.admin-track-edit input[type="color"] {
  min-height: 34px;
  padding: 2px;
}

.admin-track-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.delivery-alert {
  border: 1px solid rgba(255, 186, 82, 0.9);
  border-radius: 12px;
  padding: 9px 12px;
  background: linear-gradient(120deg, rgba(88, 44, 14, 0.8), rgba(65, 36, 22, 0.66));
  box-shadow: 0 0 22px rgba(255, 186, 82, 0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.delivery-alert[hidden] {
  display: none;
}

.delivery-alert.alert-ok {
  border-color: rgba(96, 244, 181, 0.7);
  background: linear-gradient(120deg, rgba(14, 68, 44, 0.8), rgba(12, 50, 38, 0.66));
  box-shadow: 0 0 22px rgba(96, 244, 181, 0.15);
  animation: none;
}

.delivery-alert.alert-warn {
  animation: pulseWarn 1.3s infinite;
}

.delivery-alert.alert-info {
  border-color: rgba(84, 225, 255, 0.7);
  background: linear-gradient(120deg, rgba(14, 44, 68, 0.8), rgba(12, 38, 55, 0.66));
  box-shadow: 0 0 22px rgba(84, 225, 255, 0.15);
  animation: none;
}

.delivery-alert strong {
  font-family: var(--font-display);
  color: #ffd58f;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.delivery-alert-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.delivery-alert-list span {
  border: 1px solid rgba(255, 195, 108, 0.55);
  border-radius: 999px;
  padding: 2px 10px;
  background: rgba(255, 170, 71, 0.13);
  color: #ffe2ba;
  font-size: 0.9rem;
}

.delivery-alert-list span.tag-delivered {
  border-color: rgba(96, 244, 181, 0.55);
  background: rgba(96, 244, 181, 0.13);
  color: #b8ffe2;
}

.delivery-alert-list span.tag-transit {
  border-color: rgba(84, 225, 255, 0.55);
  background: rgba(84, 225, 255, 0.13);
  color: #b8f0ff;
}

.delivery-alert-list span.tag-issue {
  border-color: rgba(255, 110, 145, 0.55);
  background: rgba(255, 110, 145, 0.13);
  color: #ffb8c8;
}

.delivery-alert-list span.tag-out {
  border-color: rgba(255, 195, 108, 0.75);
  background: rgba(255, 170, 71, 0.22);
  color: #ffe2ba;
}

.delivery-alert-list span.tag-scheduled {
  border-color: rgba(246, 240, 93, 0.55);
  background: rgba(246, 240, 93, 0.13);
  color: #fff8b8;
}

.delivery-alert em {
  color: #ffdcb1;
  font-style: normal;
  font-size: 0.9rem;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(2, 9, 17, 0.84);
  backdrop-filter: blur(4px);
}

.login-overlay[hidden] {
  display: none;
}

.login-pad {
  width: min(460px, calc(100vw - 28px));
  border: 1px solid rgba(89, 229, 255, 0.45);
  border-radius: 16px;
  background:
    linear-gradient(130deg, rgba(18, 38, 63, 0.92), rgba(7, 15, 29, 0.96)),
    var(--bg-panel);
  box-shadow: 0 0 36px rgba(38, 124, 219, 0.3);
  padding: 12px;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.login-pad-header {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: move;
  user-select: none;
}

.login-logo {
  width: 36px;
  height: 36px;
}

.login-pad-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.login-pad-header p {
  margin: 1px 0 0;
  color: var(--text-soft);
}

.login-code-dots {
  margin: 10px 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.login-code-dots span {
  height: 18px;
  border: 1px solid rgba(100, 199, 255, 0.42);
  border-radius: 999px;
  background: rgba(7, 26, 46, 0.75);
}

.login-code-dots span.filled {
  background: linear-gradient(120deg, rgba(89, 229, 255, 0.95), rgba(84, 242, 186, 0.95));
  box-shadow: 0 0 10px rgba(89, 229, 255, 0.35);
}

.login-code-input {
  width: 100%;
  min-height: 40px;
  margin-bottom: 8px;
  background: rgba(7, 25, 43, 0.9);
  border: 1px solid rgba(100, 199, 255, 0.45);
  border-radius: 9px;
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.22em;
  text-align: center;
  padding: 6px 10px;
}

.login-code-input:focus {
  outline: none;
  border-color: rgba(132, 228, 255, 0.9);
  box-shadow: 0 0 0 2px rgba(78, 174, 255, 0.22);
}

.login-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.login-keypad button {
  min-height: 56px;
  border: 1px solid rgba(96, 198, 255, 0.42);
  border-radius: 10px;
  background: rgba(10, 31, 53, 0.84);
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 1.2rem;
  cursor: pointer;
}

.login-keypad .login-enter-btn {
  grid-column: 1 / -1;
  min-height: 48px;
  font-size: 1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.login-keypad button:hover,
.login-keypad button:focus-visible {
  background: rgba(22, 58, 95, 0.95);
  border-color: rgba(132, 228, 255, 0.9);
}

.login-message {
  min-height: 1.2rem;
  margin: 8px 0 2px;
  color: #ffc085;
}

.admin-message {
  margin: 0;
  min-height: 1.2rem;
  color: #8de5ff;
  font-size: 0.94rem;
}

.admin-message.error {
  color: #ff9fbb;
}

.muted {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

code {
  background: rgba(30, 53, 83, 0.72);
  border: 1px solid rgba(88, 174, 255, 0.26);
  border-radius: 5px;
  padding: 1px 5px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(4, 18, 31, 0.6);
}

::-webkit-scrollbar-thumb {
  background: rgba(95, 195, 255, 0.38);
  border-radius: 8px;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(6, 20, 34, 0.95);
  color: #dff4ff;
  border: 1px solid rgba(82, 196, 255, 0.4);
}

.leaflet-control-zoom a {
  background: rgba(10, 30, 49, 0.85);
  color: #d9f6ff;
  border-color: rgba(79, 198, 255, 0.45);
}

body.tv-mode #adminToggleBtn {
  display: none;
}

body.tv-mode .app-shell {
  padding-right: 14px;
}

/* TV Mode auto-cycle progress bar */
.tv-cycle-progress {
  width: 100%;
  height: 4px;
  background: rgba(89, 229, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.tv-cycle-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--mint));
  border-radius: 2px;
  will-change: width;
}

@keyframes tvProgressFill {
  from {
    width: 0%;
  }
  to {
    width: 100%;
  }
}

/* TV Mode: highlight the active card more visibly */
body.tv-mode .package-card.active {
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(89, 229, 255, 0.35), inset 0 0 12px rgba(89, 229, 255, 0.08);
  transform: scale(1.02);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

body.tv-mode .package-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
  opacity: 0.6;
}

body.tv-mode .package-card.active {
  opacity: 1;
}

/* TV Mode: Out for Delivery — JS-driven rainbow (border/glow set by startMapColorAnimation) */
body.tv-mode .package-card.out-for-delivery {
  opacity: 0.85;
  transition: border-color 0.05s linear, box-shadow 0.05s linear;
}

body.tv-mode .package-card.out-for-delivery.active {
  opacity: 1;
  transform: scale(1.02);
}

body.tv-mode .package-card.out-for-delivery .ofd-notice {
  transition: color 0.05s linear, text-shadow 0.05s linear;
}

/* Rainbow border/text animations are now JS-driven via startMapColorAnimation() */

/* TV Mode: Delivered — JS-driven green/yellow pulse (set by startMapColorAnimation) */
body.tv-mode .package-card.delivered {
  opacity: 0.9;
  transition: border-color 0.05s linear, box-shadow 0.05s linear;
}

body.tv-mode .package-card.delivered.active {
  opacity: 1;
  transform: scale(1.02);
}

/* Delivered pulse animation is now JS-driven via startMapColorAnimation() */

/* OFD map line rainbow stroke is now JS-driven via startMapColorAnimation() */

/* TV Mode button active state */
body.tv-mode #tvModeBtn {
  background: linear-gradient(100deg, rgba(89, 229, 255, 0.35), rgba(82, 242, 184, 0.25));
  border-color: var(--cyan);
}

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

@keyframes pulseWarn {
  0% {
    box-shadow: 0 0 0 rgba(255, 186, 82, 0.12);
  }
  50% {
    box-shadow: 0 0 22px rgba(255, 186, 82, 0.3);
  }
  100% {
    box-shadow: 0 0 0 rgba(255, 186, 82, 0.12);
  }
}

/* Timeline interactive styles */
.timeline-mapped {
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.timeline-mapped:hover {
  border-color: rgba(84, 225, 255, 0.55);
  background: rgba(20, 52, 82, 0.85);
}

.timeline-item.timeline-active {
  border-color: #ffffff;
  background: rgba(30, 70, 110, 0.9);
  box-shadow: 0 0 12px rgba(84, 225, 255, 0.4);
}

.badge-mapped {
  color: #7dffb3;
  font-weight: 600;
}

.badge-nopin {
  color: #7a8e9e;
}

@media (max-width: 1200px) {
  body {
    overflow: auto;
  }

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

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

  .content-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 56vh auto;
  }

  .side-stage {
    grid-template-rows: minmax(230px, auto) minmax(250px, auto);
  }
}

@media (max-width: 700px) {
  .toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .stats-strip {
    grid-template-columns: 1fr;
  }
}
