:root {
  /* Glacier Blue palette */
  --gb-sky: #0EA5E9;
  --gb-navy: #0369A1;
  --gb-deep: #0C4A6E;
  --gb-label: #38BDF8;
  --gb-amber: #F59E0B;
  --gb-amber-dark: #B45309;
  --gb-green: #22C55E;
  --gb-green-dark: #15803D;
  --gb-red: #EF4444;
  --gb-bg: #EFF6FF;
  --gb-card: #ffffff;
  --gb-border: #BAE6FD;
  --gb-separator: #E0F2FE;
  --gb-text: #0C4A6E;
  --gb-muted: #64748B;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--gb-bg);
  color: var(--gb-text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.pw-gate {
  align-items: center;
  background: #080808;
  bottom: 0;
  display: none;
  justify-content: center;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 1000;
}

.pw-gate.show {
  display: flex;
}

.pw-box {
  background: #0d0d0d;
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  width: 320px;
}

.pw-logo {
  align-items: center;
  color: #f5f5f7;
  display: flex;
  font-size: 24px;
  font-weight: 700;
  gap: 10px;
  justify-content: center;
  letter-spacing: 0;
  margin-bottom: 0.5rem;
}

.pw-logo img {
  height: 36px;
  width: 36px;
}

.pw-logo .brand-name {
  color: #f5f5f7;
}

.pw-logo .brand-name span {
  color: #0a84ff;
}

.pw-sub {
  color: #888;
  font-size: 13px;
  margin-bottom: 1.5rem;
}

.pw-input {
  background: #141414;
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #f0f0f0;
  font-size: 14px;
  margin-bottom: 0.75rem;
  outline: none;
  padding: 10px 14px;
  width: 100%;
}

.pw-btn {
  background: #2563eb;
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 11px;
  width: 100%;
}

.pw-err {
  color: #f87171;
  font-size: 12px;
  margin-top: 0.5rem;
  min-height: 18px;
}

.opscore-nav {
  align-items: center;
  background: rgba(5, 5, 6, 0.96);
  border-bottom: 1px solid #27272b;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(220px, 1fr) auto 156px;
  height: 64px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav-brand {
  align-items: center;
  color: #f5f5f7;
  display: inline-flex;
  font-size: 17px;
  font-weight: 700;
  gap: 9px;
  justify-self: start;
  text-decoration: none;
}

.nav-brand img {
  display: block;
  height: 29px;
  width: 29px;
}

.nav-brand .brand-word {
  color: #f5f5f7;
}

.nav-brand .brand-word span {
  color: #0a84ff;
}

.nav-credit {
  color: #6f6f74;
  font-size: 11px;
  font-weight: 500;
}

.nav-date {
  border-left: 1px solid #303034;
  color: #a1a1a6;
  font-size: 11px;
  font-weight: 600;
  padding-left: 10px;
  white-space: nowrap;
}

.opscore-links {
  align-items: center;
  display: flex;
  gap: 3px;
  grid-column: 2;
  justify-self: end;
}

.nav-link {
  align-items: center;
  border: 0;
  border-radius: 7px;
  color: #86868b;
  display: inline-flex;
  font-size: 14px;
  font-weight: 600;
  min-height: 34px;
  padding: 8px 12px;
  text-decoration: none;
}

.nav-link:hover {
  background: #151518;
  color: #fff;
}

.nav-link.active {
  background: #0a84ff;
  border: 1px solid #43a5ff;
  box-shadow: 0 0 0 1px rgba(10, 132, 255, 0.18), 0 5px 16px rgba(10, 132, 255, 0.2);
  color: #fff;
  font-weight: 650;
}

.nav-link.active:hover {
  background: #0077ed;
}

.nav-clock {
  border-left: 1px solid rgba(255, 255, 255, 0.38);
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 36px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
  margin-left: 9px;
  padding-left: 9px;
  white-space: nowrap;
}

.nav-clock .clock-seconds {
  color: rgba(255, 255, 255, 0.68);
  font-size: 27px;
  font-weight: 600;
  vertical-align: baseline;
}

.nav-status {
  align-items: center;
  color: #8e8e93;
  display: flex;
  font-size: 12px;
  gap: 8px;
  grid-column: 3;
  justify-content: flex-end;
  justify-self: end;
  width: 156px;
}

.nav-status-dot {
  background: #34d399;
  border-radius: 50%;
  height: 7px;
  width: 7px;
}

/* ─── Refresh overlay ──────────────────────────────────────────── */
.refresh-overlay {
  align-items: center;
  background: rgba(239, 246, 255, 0.94);
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  justify-content: center;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 10;
}

.refresh-icon {
  animation: spin 0.85s linear infinite;
  border: 8px solid var(--gb-border);
  border-top-color: var(--gb-sky);
  border-radius: 999px;
  height: 80px;
  width: 80px;
}

.refresh-title {
  color: var(--gb-deep);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Screen wrapper ───────────────────────────────────────────── */
.screen {
  min-height: 100vh;
  padding: 8px 10px;
}

/* ─── Error banner ─────────────────────────────────────────────── */
.error-banner {
  background: rgba(239, 68, 68, 0.08);
  border: 0.5px solid rgba(239, 68, 68, 0.35);
  border-radius: 12px;
  color: var(--gb-red);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
  padding: 12px 16px;
}

/* ─── Board ────────────────────────────────────────────────────── */
.board {
  display: grid;
  gap: 6px;
}

/* ─── Day section card ─────────────────────────────────────────── */
.day-section {
  background: var(--gb-card);
  border: 0.5px solid var(--gb-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(14, 165, 233, 0.08);
}

.container-section {
  border-top: 3px solid var(--gb-amber);
}

.day-section.today-section {
  border: 0.5px solid #BBF7D0;
  border-top: 3px solid var(--gb-green);
}

/* ─── Container section header row ─────────────────────────────── */
.container-type-header {
  align-items: center;
  background: #FFFBEB;
  border-bottom: 0.5px solid #FDE68A;
  display: flex;
  gap: 6px;
  padding: 4px 14px;
}

.container-type-icon {
  display: inline-grid;
  place-items: center;
  color: var(--gb-amber-dark);
}

.container-type-icon svg {
  width: 16px;
  height: 16px;
}

.container-type-label {
  color: var(--gb-amber-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* ─── Day header — COMPACT ─────────────────────────────────────── */
.day-header {
  align-items: center;
  background: #F9FAFB;
  border-bottom: 0.5px solid var(--gb-separator);
  display: grid;
  gap: 12px;
  grid-template-columns: auto 1fr auto;
  padding: 4px 14px;
}

.day-section.today-section .day-header {
  background: #F0FFF4;
  border-bottom: 0.5px solid #BBF7D0;
}

.day-title {
  color: var(--gb-text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.day-subtitle {
  color: var(--gb-muted);
  font-size: 13px;
  font-weight: 500;
}

.day-section.today-section .day-title {
  color: var(--gb-green-dark);
}

.day-count {
  background: rgba(100, 116, 139, 0.1);
  border-radius: 99px;
  color: var(--gb-muted);
  font-size: 12px;
  font-weight: 700;
  justify-self: end;
  padding: 2px 9px;
}

.day-section.today-section .day-count {
  background: #DCFCE7;
  color: var(--gb-green-dark);
}

/* ─── Event list ───────────────────────────────────────────────── */
.event-list {
  display: grid;
}

/* ─── Base event row ───────────────────────────────────────────── */
.event {
  display: grid;
  gap: 10px;
  grid-template-columns: 1.2fr 0.38fr 1fr;
  padding: 8px 14px;
}

.event + .event {
  border-top: 0.5px solid var(--gb-separator);
}

.event.past {
  opacity: 0.42;
}

.event.completed {
  opacity: 0.55;
}

/* ─── Event type variants ──────────────────────────────────────── */
.calendar-event {
  background: rgba(14, 165, 233, 0.03);
}

.container-event {
  padding-top: 10px;
  padding-bottom: 10px;
  grid-template-columns: 0.7fr 0.9fr 1fr;
}

.event.event-recently-added {
  background: rgba(239, 68, 68, 0.04);
  border-left: 3px solid var(--gb-red);
  padding-left: 11px;
}

.event.event-recently-added .event-label,
.event.event-recently-added .event-title,
.event.event-recently-added .event-detail,
.event.event-recently-added .event-status {
  color: var(--gb-red);
}

.vc-po-event.vc-po-recently-changed {
  background: #FFFFFF;
  opacity: 1;
}

.vc-po-event.vc-po-recently-changed .pickup-date-line {
  align-items: center;
  display: flex;
  font-size: 14px;
  gap: 6px;
  margin-top: 7px;
}

.vc-po-event.vc-po-recently-changed .pickup-date-line .tracked-date {
  font-size: 17px;
  font-weight: 800;
}

.event.container-event.container-arriving-soon {
  background: #FFFFFF;
  border: 6px solid #FF3B30;
  border-radius: 18px;
  box-shadow:
    0 5px 16px rgba(255, 59, 48, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.72);
  box-sizing: border-box;
  margin: 7px 10px;
  padding: 10px 14px;
  position: relative;
  width: calc(100% - 20px);
  z-index: 1;
}

/* ─── Event content ────────────────────────────────────────────── */
.event-label {
  color: var(--gb-label);
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.event.past .event-label,
.event.completed .event-label {
  color: #BAE6FD;
}

/* Monospace for PO and container IDs */
.event-title {
  color: var(--gb-text);
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 29px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: pre-line;
}

.event-detail {
  color: var(--gb-text);
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.12;
}

/* Calendar events use regular font (titles are plain text, not codes) */
.calendar-event .event-title,
.calendar-event .event-detail {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  font-weight: 600;
}

.event-status {
  font-size: 25px;
  font-weight: 600;
  line-height: 1.12;
  min-width: 0;
}

/* ─── Status badge pill ────────────────────────────────────────── */
.status-badge {
  align-items: center;
  border-radius: 99px;
  display: inline-flex;
  gap: 7px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 14px;
  margin-top: 2px;
  white-space: nowrap;
}

.status-badge svg {
  width: 18px;
  height: 18px;
}

.status-badge.done {
  background: #DCFCE7;
  color: #15803D;
}

.status-badge.packed {
  background: #DBEAFE;
  color: #1D4ED8;
}

.status-badge.preparing {
  background: #FEF9C3;
  color: #854D0E;
}

.status-badge.pending {
  background: #F1F5F9;
  color: var(--gb-muted);
}

/* ─── Container date display ───────────────────────────────────── */
.container-vancouver-eta {
  color: var(--gb-muted);
  font-size: 17px;
  font-weight: 500;
  margin-bottom: 3px;
}

.tracked-date {
  display: inline-block;
  line-height: 1;
}

.container-delivery-date {
  color: var(--gb-amber-dark);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.pickup-date-line {
  color: var(--gb-muted);
  font-size: 11px;
  font-weight: 500;
  margin-top: 3px;
}

.pickup-date-line .tracked-date {
  color: var(--gb-text);
}

.date-recently-changed {
  background: rgba(239, 68, 68, 0.1);
  border: 0.5px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  box-sizing: border-box;
  color: var(--gb-red) !important;
  display: inline-block;
  max-width: 100%;
  padding: 2px 7px;
  width: fit-content;
}

/* ─── Empty state ──────────────────────────────────────────────── */
.empty-state {
  color: var(--gb-muted);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  padding: 120px 0;
  text-align: center;
}

/* ─── Scroll status chip ───────────────────────────────────────── */
.scroll-status {
  background: rgba(12, 74, 110, 0.88);
  border: none;
  border-radius: 12px;
  bottom: 14px;
  box-shadow: none;
  color: #ffffff;
  padding: 8px 14px;
  position: fixed;
  right: 14px;
  z-index: 6;
}

.scroll-status-title {
  color: rgba(186, 230, 253, 0.5);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1px;
}

.scroll-status-detail {
  font-size: 13px;
  font-weight: 600;
  margin-top: 0;
}

/* ─── Sync status (hidden) ─────────────────────────────────────── */
.sync-status {
  display: none;
}

/* ─── Utility ──────────────────────────────────────────────────── */
.hidden {
  display: none;
}

/* ─── Responsive ───────────────────────────────────────────────── */
@media (min-width: 761px) and (max-width: 1200px) {
  .opscore-nav {
    gap: 10px;
    padding: 0 16px;
  }

  .nav-link {
    padding-left: 8px;
    padding-right: 8px;
  }

  .nav-clock {
    font-size: 24px;
    margin-left: 7px;
    padding-left: 7px;
  }

  .nav-clock .clock-seconds {
    font-size: 18px;
  }
}

@media (max-width: 900px) {
  .screen {
    padding: 12px;
  }

  .event {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .day-header {
    grid-template-columns: 1fr;
    gap: 4px;
  }

}

@media (max-width: 760px) {
  .opscore-nav {
    height: auto;
    grid-template-columns: 1fr auto;
    padding: 14px 16px;
  }

  .opscore-links {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .nav-link {
    justify-content: center;
    min-width: 0;
    padding: 8px 6px;
    text-align: center;
    white-space: normal;
  }

  .nav-date {
    font-size: 10px;
    padding-left: 7px;
  }

  .nav-clock {
    border-left: 0;
    display: block;
    font-size: 10px;
    margin-left: 5px;
    padding-left: 0;
  }

  .nav-clock .clock-seconds {
    font-size: 8px;
  }

  .nav-status {
    grid-column: 2;
    grid-row: 1;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .refresh-icon { animation: none; }
  html { scroll-behavior: auto; }
}

/* Build Week wallboard polish: preserve the TV layout while clarifying urgency. */
.event.container-event.container-overdue {
  margin: 6px 10px;
  width: calc(100% - 20px);
  padding: 10px 14px;
  border: 5px solid #dc2626;
  border-radius: 16px;
  background: #fff7f6;
  box-shadow: 0 4px 14px rgba(220, 38, 38, .14);
  opacity: 1;
}

.event.container-event.container-arriving-soon {
  margin: 6px 10px;
  width: calc(100% - 20px);
  padding: 10px 14px;
  border: 4px solid #f59e0b;
  border-radius: 16px;
  background: #fffbeb;
  box-shadow: 0 4px 13px rgba(245, 158, 11, .13);
}

.event.container-event.event-recently-added:not(.container-overdue):not(.container-arriving-soon) {
  border-left: 4px solid #0ea5e9;
  color: var(--gb-text);
  background: #f0f9ff;
  padding-left: 14px;
}

.event.container-event.event-recently-added:not(.container-overdue):not(.container-arriving-soon) .event-label,
.event.container-event.event-recently-added:not(.container-overdue):not(.container-arriving-soon) .event-title,
.event.container-event.event-recently-added:not(.container-overdue):not(.container-arriving-soon) .event-detail,
.event.container-event.event-recently-added:not(.container-overdue):not(.container-arriving-soon) .event-status {
  color: var(--gb-text);
}

.container-alert-label {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.container-alert-label svg { width: 14px; height: 14px; }
.container-alert-label.overdue { color: #991b1b; background: #fee2e2; }
.container-alert-label.soon { color: #92400e; background: #fef3c7; }
.container-alert-label.new { color: #075985; background: #e0f2fe; }
