:root {
  color-scheme: light;
  --bg: #f7f1f2;
  --surface: #ffffff;
  --surface-alt: #f3e7ea;
  --ink: #231f20;
  --muted: #6b6366;
  --accent: #7d1b2f;
  --accent-strong: #5a0f22;
  --accent-soft: rgba(125, 27, 47, 0.14);
  --border: rgba(35, 31, 32, 0.12);
  --shadow: 0 20px 60px rgba(35, 31, 32, 0.1);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", system-ui, sans-serif;
  background: radial-gradient(circle at top, #fff7f8 0%, #f2e4e8 55%, #ead8dd 100%);
  color: var(--ink);
  min-height: 100vh;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app.pulse {
  animation: pulse-glow 0.9s ease;
}

@keyframes pulse-glow {
  0% {
    box-shadow: inset 0 0 0 rgba(125, 27, 47, 0);
  }
  50% {
    box-shadow: inset 0 0 0 9999px rgba(125, 27, 47, 0.05);
  }
  100% {
    box-shadow: inset 0 0 0 rgba(125, 27, 47, 0);
  }
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 5vw;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: var(--surface-alt);
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  overflow: hidden;
}

.brand-mark img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.brand-title {
  font-family: "Playfair Display", serif;
  font-size: 18px;
  letter-spacing: 0.04em;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--muted);
}

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

.status-pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.main {
  padding: 32px 5vw 64px;
}

.login {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 28px;
}

.login-card {
  max-width: 420px;
  width: 100%;
}

.login-card .primary,
.login-card .secondary {
  width: 100%;
  justify-content: center;
}

.login-card .divider {
  text-align: center;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 12px;
}

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

.input-group {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

label {
  font-size: 13px;
  color: var(--muted);
}

input,
select {
  font-family: inherit;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 14px;
  width: 100%;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 25px rgba(35, 31, 32, 0.12);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

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

.secondary {
  background: var(--surface-alt);
  color: var(--ink);
}

.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
}

.start-run-btn {
  padding: 12px 22px;
  font-size: 14px;
  letter-spacing: 0.08em;
}

.hint {
  margin-top: 12px;
  font-size: 12px;
  color: #b3261e;
}

.divider {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0;
}

.dashboard {
  display: none;
}

.dashboard.active {
  display: block;
}

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

.date-pill {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 12px;
}

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.admin-grid {
  display: grid;
  gap: 18px;
}

.admin-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px;
  box-shadow: var(--shadow);
}

.admin-card h3 {
  margin-bottom: 10px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.admin-cell-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.admin-cell-text {
  font-size: 12px;
  color: #1f1a1b;
  line-height: 1.4;
}

.admin-chip {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  margin-right: 6px;
}

@media (max-width: 900px) {
  .admin-table {
    min-width: 720px;
  }
}

@media (max-width: 700px) {
  .admin-grid {
    display: grid;
    gap: 16px;
  }

  .admin-card {
    padding: 18px;
  }

  .admin-table {
    font-size: 11px;
  }

  .admin-table th:nth-child(2),
  .admin-table th:nth-child(3),
  .admin-table td:nth-child(2),
  .admin-table td:nth-child(3) {
    display: none;
  }

  .admin-table th:nth-child(4),
  .admin-table td:nth-child(4) {
    display: none;
  }
}

.plan-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 18px;
}

.plan-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.plan-pill.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: rgba(125, 27, 47, 0.35);
}

.plan-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(35, 31, 32, 0.1);
}

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

.table {
  display: grid;
  gap: 16px;
}

.location-card {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  padding: 16px;
  display: grid;
  gap: 12px;
}

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

.table-row {
  display: grid;
  grid-template-columns: minmax(140px, 2fr) minmax(90px, 1fr) minmax(90px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.card-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 16px;
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.board-column {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px;
  display: grid;
  gap: 10px;
  position: relative;
}

.board-column.ready {
  border-color: rgba(39, 108, 76, 0.4);
  background: rgba(39, 108, 76, 0.08);
}

.prep-banner {
  background: rgba(39, 108, 76, 0.14);
  color: #1f5b3f;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.item-row.ready {
  background: rgba(39, 108, 76, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
}

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

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.toggle input {
  width: 24px;
  height: 24px;
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
}

.chip.delay {
  background: #fff3e0;
  color: #ef6c00;
}

.timeline {
  display: grid;
  gap: 18px;
}

.stop-card {
  padding: 18px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: grid;
  gap: 12px;
}

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

.badge {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--surface-alt);
}

.badge.late {
  background: #fbe9e7;
  color: #c62828;
}

.badge.ontime {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge.warning {
  background: #fff3e0;
  color: #ef6c00;
}

.timer-bar {
  width: 100%;
  height: 6px;
  background: rgba(125, 27, 47, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.timer-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0;
}

.countdown-box {
  display: grid;
  gap: 6px;
  margin: 10px 0 18px;
}

.countdown-label {
  font-size: 12px;
  color: var(--muted);
}

.countdown-big {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.checklist {
  display: grid;
  gap: 12px;
}

.checklist.locked {
  pointer-events: none;
  opacity: 0.55;
}

.checklist.disabled {
  opacity: 0.6;
  pointer-events: none;
}

.check-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}

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

.check-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.check-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

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

.check-toggle input {
  width: 20px;
  height: 20px;
}

.check-toggle.ok.active {
  background: rgba(39, 108, 76, 0.12);
  border-color: rgba(39, 108, 76, 0.4);
  color: #1f5b3f;
}

.check-toggle.missing.active {
  background: rgba(198, 40, 40, 0.12);
  border-color: rgba(198, 40, 40, 0.4);
  color: #c62828;
}

.item-list {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.map-card {
  background: linear-gradient(135deg, rgba(125, 27, 47, 0.08), rgba(255, 255, 255, 0.7));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}

.map-route {
  height: 160px;
  border-radius: 16px;
  background: #fff;
  border: 1px dashed rgba(125, 27, 47, 0.35);
  position: relative;
}

.route-line {
  position: absolute;
  top: 50%;
  left: 8%;
  right: 8%;
  height: 4px;
  background: linear-gradient(90deg, rgba(125, 27, 47, 0.2), rgba(125, 27, 47, 0.7));
  border-radius: 999px;
}

.route-stop {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 6px 14px rgba(35, 31, 32, 0.2);
}

.route-stop.active {
  background: #fff;
  border: 4px solid var(--accent);
  width: 18px;
  height: 18px;
}

.route-stop.done {
  background: rgba(39, 108, 76, 0.85);
}

.map-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.timer {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--accent-strong);
}

.note {
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-row {
    grid-template-columns: 1fr;
  }

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

  .check-item {
    grid-template-columns: 1fr;
  }
}
