:root {
  --bg-primary: #0b0f19;
  --bg-card: #151d2e;
  --bg-card-hover: #1c273e;
  --bg-glass: rgba(21, 29, 46, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: #38bdf8;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-sunrise: #f59e0b;
  --accent-sunrise-glow: rgba(245, 158, 11, 0.25);
  --accent-cyan: #38bdf8;
  --accent-cyan-glow: rgba(56, 189, 248, 0.25);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.25);
  --accent-rose: #f43f5e;

  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
}

/* App Container */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Sync Badge */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: pulse-dot 2s infinite ease-in-out;
}

.sync-badge.offline {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.3);
}

.sync-badge.offline .sync-dot {
  background: #fb7185;
  box-shadow: 0 0 8px #fb7185;
  animation: none;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

/* Layout Grid: Tablet Landscape vs Portrait */
.main-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  flex: 1;
}

@media (min-width: 900px) {
  .main-layout {
    grid-template-columns: 420px 1fr;
    align-items: start;
  }
  .hero-section {
    position: sticky;
    top: 16px;
  }
}

@media (min-width: 1200px) {
  .main-layout {
    grid-template-columns: 460px 1fr;
  }
}

/* Hero Section & Card */
.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-sunrise), var(--accent-cyan));
}

/* Giant Countdown */
.countdown-container {
  text-align: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 26px 16px;
}

.countdown-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
  text-align: center;
}

.countdown-digits {
  font-size: 4.2rem;
  font-weight: 900;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--accent-sunrise);
  text-shadow: 0 0 25px var(--accent-sunrise-glow);
  letter-spacing: -0.02em;
}

.countdown-digits.urgent {
  color: var(--accent-rose);
  text-shadow: 0 0 30px rgba(244, 63, 94, 0.4);
  animation: pulse-urgent 1s infinite alternate;
}

.countdown-digits.completed {
  color: var(--accent-emerald);
  text-shadow: 0 0 30px var(--accent-emerald-glow);
}

.countdown-digits.at-school {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 2.3rem;
  line-height: 1.1;
  white-space: nowrap;
}

.countdown-digits.at-school .countdown-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 1em;
}

.countdown-digits.at-school .countdown-text {
  display: inline-block;
  line-height: 1.1;
}

@keyframes pulse-urgent {
  from { transform: scale(1); }
  to { transform: scale(1.03); }
}

.countdown-status {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* Current Task Banner in Hero */
.current-task-banner {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.current-task-banner.active-glow {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.15);
}

.ct-badge {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.ct-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ct-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.ct-details {
  flex: 1;
}

.ct-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.ct-time-left {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-sunrise);
  margin-top: 2px;
}

.ct-progress-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  margin-top: 12px;
  overflow: hidden;
}

.ct-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-cyan);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Departing Buses Card in Hero (Transit state) */
.departing-buses-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.buses-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.buses-header-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.buses-badge {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  text-transform: uppercase;
  white-space: nowrap;
}

.buses-stop-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.buses-live-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.1);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.2);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.buses-live-status.offline {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.3);
}

.buses-status-text {
  white-space: nowrap;
}

.buses-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse-glow 2s infinite ease-in-out;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.buses-live-status.offline .buses-pulse-dot {
  background: #fb7185;
  box-shadow: 0 0 8px #fb7185;
  animation: none;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

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

.bus-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  transition: all 0.2s ease;
}

.bus-row:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(56, 189, 248, 0.3);
}

.bus-row.bus-cancelled {
  opacity: 0.6;
  border-color: rgba(244, 63, 94, 0.3);
}

.bus-badge-container {
  flex-shrink: 0;
}

.bus-line-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #d32f2f;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  min-width: 44px;
  text-align: center;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(211, 47, 47, 0.4);
}

.bus-dest-container {
  display: flex;
  flex-direction: column;
  margin-left: 12px;
  min-width: 0;
  flex: 1;
}

.bus-dest-main {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bus-dest-via {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.bus-time-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 10px;
}

.bus-time-pill {
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.bus-time-pill.imminent {
  color: var(--accent-emerald);
  text-shadow: 0 0 10px var(--accent-emerald-glow);
}

.bus-time-pill.standard {
  color: var(--accent-cyan);
}

.bus-clock-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

.bus-cancelled-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.buses-loading, .buses-empty, .buses-error {
  text-align: center;
  padding: 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.buses-error {
  color: var(--accent-rose);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.btn-retry-buses {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-cyan);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-retry-buses:hover {
  background: rgba(56, 189, 248, 0.25);
}

/* Timeline Section */
.timeline-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Bottom App Footer */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px 8px;
  margin-top: 28px;
  border-top: 1px solid var(--border-color);
  min-height: 64px;
}

.footer-left {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-right {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-school-time-bottom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 9px 20px;
  border-radius: var(--radius-full);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}

.btn-school-time-bottom:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.btn-school-time-bottom strong {
  color: var(--accent-cyan);
  font-weight: 700;
}

.modal-header-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.total-duration-badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
}

/* Debug Simulated Time Pill */
.debug-time-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid var(--accent-sunrise);
  color: var(--accent-sunrise);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.btn-clear-debug {
  background: transparent;
  border: none;
  color: var(--accent-sunrise);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  display: flex;
  align-items: center;
}

.btn-clear-debug:hover {
  color: #fff;
}

/* The Vertical Timeline Component */
.timeline-container {
  position: relative;
  padding: 4px 0 20px 0;
}

/* Continuous Vertical Rail */
.timeline-rail {
  position: absolute;
  top: 30px;
  left: 28px;
  width: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  z-index: 1;
}

.timeline-rail-fill {
  width: 100%;
  height: 0px;
  background: linear-gradient(180deg, var(--accent-emerald), var(--accent-cyan));
  border-radius: 4px;
  transition: height 0.4s ease;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  z-index: 2;
}

/* Timeline Item (Step Node + Card) */
.timeline-item {
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
}

/* Node Circle on the Rail */
.timeline-node {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #151d2e;
  border: 3px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 3;
  transition: all 0.3s ease;
  opacity: 1;
}

.timeline-node .step-num {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: #0b0f19;
  border: 1px solid var(--border-color);
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* State: Completed */
.timeline-item.completed .timeline-node {
  border-color: var(--accent-emerald);
  background-color: #0c2b21;
  box-shadow: 0 0 15px var(--accent-emerald-glow);
}

.timeline-item.completed .timeline-node .step-num {
  background-color: var(--accent-emerald);
  color: #fff;
  border-color: var(--accent-emerald);
}

/* State: Active (Current Task) */
.timeline-item.active .timeline-node {
  border-color: var(--accent-cyan);
  background-color: #0c2c3e;
  box-shadow: 0 0 25px var(--accent-cyan-glow);
  transform: scale(1.08);
  animation: pulse-active-node 2s infinite ease-in-out;
}

@keyframes pulse-active-node {
  0%, 100% { box-shadow: 0 0 15px var(--accent-cyan-glow); }
  50% { box-shadow: 0 0 30px var(--accent-cyan); }
}

.timeline-item.active .timeline-node .step-num {
  background-color: var(--accent-cyan);
  color: #0b0f19;
  font-weight: 900;
  border-color: var(--accent-cyan);
}

/* Timeline Card */
.timeline-card {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-card);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-item.completed .timeline-card {
  opacity: 0.72;
  border-color: rgba(16, 185, 129, 0.25);
}

.timeline-item.active .timeline-card {
  border-color: var(--accent-cyan);
  box-shadow: 0 8px 30px rgba(56, 189, 248, 0.18);
  background: linear-gradient(135deg, rgba(21, 29, 46, 0.95), rgba(30, 41, 62, 0.95));
}

.timeline-item.destination .timeline-card {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(21, 29, 46, 0.95));
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.time-range-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-cyan);
  font-variant-numeric: tabular-nums;
}

.duration-pill {
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge.done {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.status-badge.now {
  background: var(--accent-cyan);
  color: #090d16;
  font-weight: 900;
  animation: pulse-badge 1.5s infinite alternate;
}

@keyframes pulse-badge {
  from { filter: brightness(1); }
  to { filter: brightness(1.2); }
}

.status-badge.next {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-sunrise);
}

.status-badge.upcoming {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.task-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: -4px;
}

/* Live Active Progress Line in Card */
.card-live-progress {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-live-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-sunrise);
}

.card-live-bar-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.card-live-bar-fill {
  height: 100%;
  background: var(--accent-sunrise);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--accent-cyan);
  color: #0b0f19;
  font-weight: 700;
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-subtle {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-subtle:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger-subtle {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
}

.btn-danger-subtle:hover {
  background: rgba(244, 63, 94, 0.25);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-sm {
  font-size: 0.85rem;
  padding: 6px 12px;
}

.btn-block {
  width: 100%;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  z-index: 10;
  padding: 24px 24px 32px 24px;
  animation: modal-enter 0.25s ease-out;
}

.modal-card.modal-lg {
  max-width: 760px;
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 {
  font-size: 1.3rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="time"] {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 1.05rem;
  font-family: inherit;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-row-2 {
  display: flex;
  gap: 12px;
}

/* Roomy & Uncramped Today's Leave Preview Card */
.leave-preview-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin: 18px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.preview-item-label {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.preview-item-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.preview-item.highlight {
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-item-value-large {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-cyan);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.modal-actions-stacked {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.modal-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1 1 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 6px;
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-align: center;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.tab-btn.active {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
  border-bottom-color: var(--accent-cyan);
}

.tab-content {
  display: none;
  padding-bottom: 28px;
}

.tab-content.active {
  display: block;
}

.tab-pane-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.tab-pane-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.tab-pane-info p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  flex: 1;
  min-width: 200px;
}

.btn-add-task {
  width: 100%;
  justify-content: center;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Tasks Editor List - Vertical Cards */
.tasks-editor-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-card-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
}

.task-card-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

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

.task-card-icon {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.task-card-title-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.task-card-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.task-card-duration-pill {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.task-card-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.45;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-cyan);
  word-break: break-word;
}

.task-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
}

.task-card-reorder,
.task-card-modify {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-task-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-task-action:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-task-action:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-action-danger:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.18);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.4);
}

/* Transit Time Card in Schedule Editor */
.transit-time-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.transit-time-card label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.transit-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.transit-input-row input {
  max-width: 120px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
}

.unit-badge {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
}

/* Weekday Grid (Mon-Fri) - Vertical Cards */
.weekday-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.weekday-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.weekday-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.weekday-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.weekday-leave-calc {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.weekday-leave-calc strong {
  color: var(--accent-cyan);
  font-size: 1rem;
}

.weekday-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.weekday-time-label {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.weekday-card-body .day-school-time {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  max-width: 140px;
  text-align: center;
  font-family: inherit;
}

/* Audio Chimes Tab Cards */
.audio-settings-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.audio-setting-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: all 0.2s ease;
}

.audio-setting-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.audio-card-content {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
}

.audio-card-icon {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.audio-card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audio-card-title {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text-primary);
}

.audio-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.audio-volume-card {
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.audio-volume-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.volume-badge {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.volume-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.vol-icon-min,
.vol-icon-max {
  font-size: 1.1rem;
  opacity: 0.75;
}

.volume-slider-row input[type="range"] {
  flex: 1;
  cursor: pointer;
}

.btn-test-chime {
  width: 100%;
  justify-content: center;
  padding: 11px 16px;
  font-size: 0.92rem;
  font-weight: 600;
}

/* Toggles & Sliders */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  display: none;
}

.toggle-custom {
  width: 44px;
  height: 24px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toggle-custom::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.toggle-label input[type="checkbox"]:checked + .toggle-custom {
  background: var(--accent-cyan);
}

.toggle-label input[type="checkbox"]:checked + .toggle-custom::before {
  transform: translateX(20px);
}

.label-text {
  font-size: 0.9rem;
  color: var(--text-primary);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-cyan);
}

/* Weekend Screen */
.weekend-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  flex: 1;
}

.weekend-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-card);
}

.weekend-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.weekend-card h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.weekend-card p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .app-container {
    padding: 10px;
  }
  .modal {
    padding: 8px;
  }
  .modal-card {
    padding: 16px 14px 28px 14px;
    border-radius: var(--radius-md);
    max-height: 94vh;
  }
  .modal-header h3 {
    font-size: 1.15rem;
  }
  .modal-tabs {
    gap: 4px;
    margin-bottom: 14px;
  }
  .tab-btn {
    padding: 8px 4px;
    font-size: 0.84rem;
  }
  .countdown-digits {
    font-size: 3.2rem;
  }
  .countdown-digits.at-school {
    font-size: 1.8rem;
    gap: 8px;
  }
  .countdown-container {
    padding: 18px 14px;
  }
  .timeline-rail {
    left: 23px;
  }
  .timeline-node {
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
  }
  .task-card-item {
    padding: 12px 14px;
    gap: 8px;
  }
  .task-card-icon {
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }
  .task-card-title {
    font-size: 0.98rem;
  }
  .task-card-description {
    font-size: 0.85rem;
    padding: 7px 10px;
  }
  .btn-task-action {
    padding: 6px 10px;
    font-size: 0.78rem;
  }
  .weekday-card {
    padding: 12px 14px;
  }
  .weekday-name {
    font-size: 0.98rem;
  }
  .weekday-card-body .day-school-time {
    padding: 6px 10px;
    font-size: 1rem;
    max-width: 120px;
  }
  .audio-setting-card {
    padding: 12px 14px;
    gap: 12px;
  }
  .audio-card-icon {
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }
  .audio-card-title {
    font-size: 0.98rem;
  }
  .audio-card-desc {
    font-size: 0.84rem;
  }
  .app-footer {
    padding: 12px 4px;
    margin-top: 20px;
  }
  .btn-school-time-bottom {
    padding: 8px 16px;
    font-size: 0.85rem;
  }
}
