/* =========================================================
   PilotMetrics - Dashboard
   Styles for the pages dashboard.js runs: Dashboard, Flights, Pace, Progress, Experience, Settings
   ========================================================= */

body.is-read-only .log-entry-card,
body.is-read-only .settings-card,
body.is-read-only #importCard,
body.is-read-only .action-btn {
display: none !important;
}

/* Dashboard: where the rest of PilotMetrics is */
.explore-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.explore-list a {
  display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline;
  padding: 10px 12px; border-radius: 8px; background: #0f172a; border: 1px solid var(--line);
  color: #fff; text-decoration: none; font-size: 13px;
}
.explore-list a:hover { border-color: var(--blue); }
.explore-list a > span { grid-column: 2; font-size: 11px; color: var(--muted); }

.eyebrow {
text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 10px;
  font-weight: 800;
  color: var(--cyan);
}

h1 {
font-size: 22px; 
  margin: 2px 0 0; 
  font-weight: 800; 
  letter-spacing: -0.02em; 
  color: #fff; 
  word-break: break-word;
}

.sync-badge.saving {
background: var(--blue-light); color: #60a5fa; border-color: rgba(59,130,246,0.3);
}

.pill-tab-container {
display: flex;
  background: #0f172a;
  border: 1px solid var(--line-light);
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pill-tab {
flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-height: 36px;
}

.pill-tab.active {
background: var(--line);
  color: #ffffff;
  border: 1px solid var(--line-light);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.pill-tab-icon {
width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}

.syllabus-toolbar {
margin-bottom:10px; display:flex; flex-direction:column; gap:6px;
}

.syllabus-school-label {
font-size: 11px; color: var(--muted);
}

.syllabus-legend {
display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 10px; background: #0f172a; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--line);
}

.syllabus-legend-title {
font-weight: 700; color: var(--text); margin-right: 4px;
}

.syllabus-legend-group {
display: flex; align-items: center; gap: 4px;
}

.syllabus-legend-item {
display: inline-flex; align-items: center; gap: 3px; font-weight: 600; padding: 2px 6px; border-radius: 3px; font-size: 9px;
}

.syllabus-stage-tabs {
display: flex; 
  gap: 4px; 
  overflow-x: auto; 
  border-bottom: 1px solid var(--line); 
  padding: 0 4px; 
  scrollbar-width: thin; 
  -webkit-overflow-scrolling: touch;
}

.syllabus-stage-tab {
border: 1px solid var(--line); 
  border-bottom: none; 
  background: #0f172a; 
  color: var(--muted); 
  border-radius: 8px 8px 0 0; 
  padding: 8px 12px; 
  font-size: 11px; 
  font-weight: 700; 
  cursor: pointer; 
  white-space: nowrap; 
  min-height: 38px;
  display: inline-flex;
  align-items: center;
}

.syllabus-stage-tab.active {
background:var(--card); color:var(--cyan); border-color:var(--line-light);
}

.syllabus-stage-tab .count {
background: #1e293b; color: var(--muted); padding: 1px 6px; border-radius: 10px; font-size: 9px; margin-left: 4px;
}

.syllabus-stage-tab.active .count {
background: var(--cyan-light); color: var(--cyan);
}

.syllabus-stage-panel {
border:1px solid var(--line); border-top:none; border-radius:0 0 8px 8px; background:var(--card);
}

.syllabus-stage-title {
padding: 10px 14px; font-size: 12px; display: flex; justify-content: space-between; align-items: center; background: #0f172a; border-bottom: 1px solid var(--line); flex-wrap: wrap; gap: 6px;
}

.syllabus-progress-track {
height: 5px; background: #1e293b; width: 100%;
}

.syllabus-progress-fill {
height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width 0.3s ease;
}

.syllabus-lessons {
display:flex; flex-direction:column; gap:6px; padding:10px; max-height:520px; overflow-y:auto; -webkit-overflow-scrolling: touch;
}

.syllabus-lesson {
display: grid; 
  grid-template-columns: minmax(200px, 1.35fr) minmax(160px, 1fr) auto; 
  gap: 12px; 
  align-items: center; 
  min-height: 44px; 
  height: auto;
  border: 1px solid rgba(16, 185, 129, 0.3); 
  border-radius: 6px; 
  padding: 10px 12px; 
  background: rgba(16, 185, 129, 0.05); 
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.syllabus-lesson:hover {
border-color: var(--blue); background: rgba(59, 130, 246, 0.08);
}

.syllabus-lesson.pending {
border-color:var(--line); background:#0f172a;
}

.syllabus-lesson-name {
font-size: 11px; 
  font-weight: 700; 
  min-width: 0; 
  color: #fff; 
  word-break: break-word; 
  line-height: 1.35;
}

.syllabus-lesson-time {
font-size:9px; color:var(--muted); display:flex; flex-direction:column; gap:4px; min-width:0;
}

.syllabus-time-track {
position:relative; height:6px; background:#1e293b; border-radius:999px; overflow:visible;
}

.syllabus-time-track .actual {
height:100%; border-radius:999px; background:#10b981; min-width:0;
}

.syllabus-time-track .actual.complete {
background:#10b981;
}

.syllabus-time-track .actual.shorter-5 {
background:#facc15;
}

.syllabus-time-track .actual.shorter-15 {
background:#fb923c;
}

.syllabus-time-track .actual.shorter-30 {
background:#ea580c;
}

.syllabus-time-track .actual.shorter-45 {
background:#f87171;
}

.syllabus-time-track .actual.shorter-60 {
background:#ef4444;
}

.syllabus-time-track .actual.longer-5 {
background:#38bdf8;
}

.syllabus-time-track .actual.longer-15 {
background:#2563eb;
}

.syllabus-time-track .actual.longer-30 {
background:#6366f1;
}

.syllabus-time-track .actual.longer-45 {
background:#a855f7;
}

.syllabus-time-track .actual.longer-60 {
background:#d946ef;
}

.syllabus-time-track .expected-marker {
position:absolute; top:-3px; bottom:-3px; width:2px; background:#f8fafc; border-radius:2px;
}

.syllabus-status {
font-size:8px; font-weight:800; text-transform:uppercase; padding:3px 7px; border-radius:4px; white-space:nowrap; text-align:center; display:inline-block;
}

.syllabus-date {
margin-top:2px; font-size:9px; color:#34d399; font-weight:700; white-space:nowrap;
}

.syllabus-status.complete {
background:var(--green-light); color:#34d399; border:1px solid rgba(16,185,129,0.3);
}

.syllabus-status.pending {
background:#1e293b; color:var(--muted);
}

.syllabus-status.shorter-5 {
background:rgba(250,204,21,0.2); color:#fef08a;
}

.syllabus-status.shorter-15 {
background:rgba(251,146,60,0.2); color:#ffedd5;
}

.syllabus-status.shorter-30 {
background:rgba(234,88,12,0.2); color:#ffedd5;
}

.syllabus-status.shorter-45 {
background:rgba(248,113,113,0.2); color:#fca5a5;
}

.syllabus-status.shorter-60 {
background:rgba(239,68,68,0.3); color:#f87171;
}

.syllabus-status.longer-5 {
background:rgba(56,189,248,0.2); color:#7dd3fc;
}

.syllabus-status.longer-15 {
background:rgba(37,99,235,0.2); color:#93c5fd;
}

.syllabus-status.longer-30 {
background:rgba(99,102,241,0.2); color:#c7d2fe;
}

.syllabus-status.longer-45 {
background:rgba(168,85,247,0.2); color:#e9d5ff;
}

.syllabus-status.longer-60 {
background:rgba(217,70,239,0.2); color:#f5d0fe;
}

.syllabus-repeat {
display:inline-block; margin-left:5px; padding:2px 5px; border-radius:4px; background:var(--amber-light); color:var(--amber); font-size:8px; font-weight:800;
}

.syllabus-summary {
font-size:11px; font-weight:700; color:var(--muted);
}

.syllabus-empty {
padding:24px; text-align:center; color:var(--muted); font-size:11px;
}

.lesson-id {
display: inline-block; font-weight: 800; color: var(--cyan); background: var(--cyan-light); padding: 1px 5px; border-radius: 3px; font-size: 10px; margin-right: 4px;
}

.stat .sub-text {
font-size: 10px; font-weight: 500; color: var(--muted);
}

.badge-cat {
font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; text-transform: uppercase;
}

.badge-cat.dual {
background: var(--amber-light); color: #facc15; border: 1px solid rgba(245,158,11,0.3);
}

.badge-cat.solo {
background: var(--blue-light); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3);
}

.badge-loc {
font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: var(--green-light); color: #34d399; border: 1px solid rgba(16,185,129,0.3); text-transform: uppercase;
}

.badge-linked {
font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: var(--purple-light); color: #c084fc; border: 1px solid rgba(139,92,246,0.3); margin-left: 4px;
}

.matrix-table-wrapper {
width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.matrix-table {
width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; min-width: 480px;
}

.matrix-table th {
background: #0f172a; color: var(--muted); text-transform: uppercase; font-size: 10px; padding: 8px 10px; border-bottom: 2px solid var(--line); text-align: center;
}

.matrix-table td {
padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: center; color: #fff;
}

.matrix-table tr td:first-child, .matrix-table tr th:first-child {
text-align: left; font-weight: 700; color: #fff;
}

.chart-card-large {
min-height: 400px;
}

.chart-card-large .chart {
height: 320px;
}

.chart-tooltip {
position: fixed;
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  border: 1px solid var(--line-light);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 9999;
  box-shadow: 0 8px 16px rgba(0,0,0,0.4);
  transform: translate(-50%, -100%);
  margin-top: -8px;
  display: none;
  max-width: 260px;
}

.hover-target {
cursor: pointer; transition: all 0.15s ease;
}

.hover-target:hover {
opacity: 0.85; filter: brightness(1.2);
}

.hover-bar:hover {
fill: var(--blue);
}

button.purple {
background: var(--purple); color: #fff;
}

button.purple:hover {
background: #7c3aed; box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
}

.cal-nav {
display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}

.cal-title {
font-weight: 700; font-size: 13px; min-width: 110px; text-align: center; color: #fff;
}

.calendar {
display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px;
}

.calhead {
font-size: 10px; text-align: center; color: var(--muted); font-weight: 700; padding: 2px;
}

.calday {
aspect-ratio: 1.1;
  border-radius: 6px;
  background: #0f172a;
  border: 1px solid var(--line);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--muted);
  min-height: 38px;
  padding: 2px;
}

.calday.today {
border-color: var(--cyan); font-weight: 700; color: #fff;
}

.calday.other-month {
opacity: 0.3;
}

.calday.flight {
background: var(--blue); color: #fff; border-color: var(--blue);
}

.calday.multi {
background: var(--green); color: #fff; border-color: var(--green);
}

.calday.linked {
background: var(--purple); color: #fff; border-color: var(--purple);
}

.calday .time-tag {
font-size: 8px; opacity: 0.95; margin-top: 1px; font-weight: 600; text-align: center; line-height: 1;
}

.piewrap {
display: flex; align-items: center; justify-content: center; gap: 16px; height: 100%; min-height: 140px; flex-wrap: wrap;
}

.pie {
width: 110px; height: 110px; border-radius: 50%; flex-shrink: 0;
}

.legend {
font-size: 11px; color: var(--muted);
}

.legend div {
margin: 4px 0;
}

.dot {
display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px;
}

.breakdown-list {
display: flex; 
  flex-direction: column; 
  gap: 8px; 
  margin-top: 4px; 
  max-height: 260px; 
  overflow-y: auto; 
  padding-right: 4px; 
  -webkit-overflow-scrolling: touch;
}

.breakdown-item {
display: flex; flex-direction: column; gap: 3px;
}

.breakdown-info {
display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; color: #fff;
}

.breakdown-bar-bg {
background: #0f172a; border-radius: 4px; height: 7px; overflow: hidden; width: 100%; border: 1px solid var(--line);
}

.breakdown-bar-fill {
background: var(--blue); height: 100%; border-radius: 4px;
}

.insight-grid {
display: flex; flex-direction: column; gap: 8px;
}

.insight-subgrid {
display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
}

.insight-card {
padding: 10px 12px; background: #0f172a; border: 1px solid var(--line); border-radius: 8px;
}

.insight-card b {
display: block; font-size: 14px; color: #fff; margin-bottom: 2px; word-break: break-word;
}

.insight-card span {
font-size: 9px; color: var(--muted); font-weight: 600; text-transform: uppercase;
}

.gaps-box {
background: #0f172a; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}

.gaps-box h3 {
margin: 0 0 6px 0; font-size: 10px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.03em;
}

.gaps-box ol {
margin: 0; padding-left: 14px; font-size: 11px; font-weight: 600; color: #fff;
}

.gaps-box li {
margin-bottom: 4px;
}

.gaps-box li span {
font-weight: 400; color: var(--muted); font-size: 10px;
}

/* Training Streak & Personal Records */
.streak-hero {
display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(239, 68, 68, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.streak-hero.cold { background: #0f172a; border-color: var(--line); }
.streak-flame { font-size: 34px; line-height: 1; }
.streak-hero.cold .streak-flame { filter: grayscale(1); opacity: 0.5; }
.streak-value { font-size: 24px; font-weight: 900; color: #fff; line-height: 1.1; }
.streak-label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: 0.04em; }
.streak-week { font-size: 11px; color: var(--muted); margin-top: 3px; }
.streak-week b { color: #fbbf24; }
.streak-week.done b { color: #34d399; }

.record-banner {
display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 10px 14px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.18), rgba(139, 92, 246, 0.14));
  border: 1px solid rgba(234, 179, 8, 0.5); color: #fff; font-size: 12px;
}
.record-banner .record-banner-icon { font-size: 22px; }
.record-banner b { color: #facc15; }

.records-grid {
display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
}
.record-tile { position: relative; }
.record-tile .record-when { font-size: 10px; color: var(--muted); margin-top: 4px; }
.record-tile.is-new { border-color: rgba(234, 179, 8, 0.6); box-shadow: 0 0 12px rgba(234, 179, 8, 0.15); }
.record-new-badge {
position: absolute; top: 6px; right: 6px; font-size: 8px; font-weight: 900; letter-spacing: 0.06em;
  padding: 2px 5px; border-radius: 4px; background: var(--gold); color: #1a1300;
}

@media (max-width: 900px) {
  .records-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Training Duration & Pace Planner */
.plan-stats {
display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
}

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

.plan-stat.ahead b { color: var(--green); }
.plan-stat.behind b { color: var(--amber); }
.plan-stat.late b { color: var(--danger); }

.plan-message {
margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 12px; line-height: 1.45;
  background: #0f172a; border: 1px solid var(--line); color: var(--text);
}

.plan-message.ahead { border-color: rgba(16, 185, 129, 0.45); background: var(--green-light); }
.plan-message.behind { border-color: rgba(245, 158, 11, 0.45); background: var(--amber-light); }
.plan-message.late { border-color: rgba(239, 68, 68, 0.45); background: var(--danger-light); }
.plan-message.muted { color: var(--muted); font-style: italic; }

.plan-timeline {
position: relative; height: 10px; margin: 14px 0 4px; border-radius: 5px;
  background: #0f172a; border: 1px solid var(--line); overflow: visible;
}

.plan-timeline-fill {
position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--blue);
}

.plan-timeline-marker {
position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 1px; transform: translateX(-1px);
}

.plan-timeline-marker.planned { background: #fff; }
.plan-timeline-marker.projected { background: var(--amber); }

.plan-timeline-legend {
display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 10px; color: var(--muted);
}

.plan-timeline-legend i {
display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: -1px;
}

.plan-details {
margin: 10px 0 0; padding: 0; list-style: none; font-size: 11px; color: var(--muted);
}

.plan-details li {
display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line);
}

.plan-details li:last-child { border-bottom: 0; }
.plan-details li b { color: #fff; font-weight: 700; text-align: right; }

.planner-inputs {
display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px;
}

.planner-inputs .field { min-width: 0; }

.planner-breaks {
background: #0f172a; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px;
}

.planner-breaks-head {
display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--muted);
}

.planner-break-row {
display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 6px; margin-top: 8px; align-items: center;
}

.planner-break-row button { padding: 6px 10px; }

.planner-breaks-empty {
font-size: 11px; color: var(--muted); font-style: italic; margin-top: 6px;
}

@media (max-width: 900px) {
  .planner-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .plan-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .planner-break-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.log-container {
max-height: 380px;
  overflow-y: auto; 
  overflow-x: auto; 
  border: 1px solid var(--line); 
  border-radius: 8px; 
  background: #0f172a; 
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

tr.linked-row {
background: rgba(139, 92, 246, 0.08);
}

.remarks-col {
max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; color: var(--muted);
}

.instruction-list {
background: #0f172a;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px 10px 28px;
  margin: 10px 0 16px;
  font-size: 12px;
  color: var(--text);
}

.instruction-list li {
margin-bottom: 4px;
}

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

::-webkit-scrollbar-track {
background: transparent;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
background-color: #555555;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
background-color: #777777;
}

/* Today: the top of the Dashboard */
.today-card { width: 100%; padding: 20px; }
.today-greeting { font-size: 20px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.today-label {
  margin: 18px 0 8px; font-size: 10px; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--cyan);
}
.today-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .today-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.today-stat { padding: 12px 14px; }
.today-stat b { font-size: 20px; margin-top: 4px; }
.today-stat b em { font-size: 11px; font-style: normal; font-weight: 700; color: var(--muted); }
.today-stat small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }

.today-bar { height: 6px; margin-top: 8px; border-radius: 3px; background: var(--line); overflow: hidden; }
.today-bar-fill { height: 100%; border-radius: 3px; background: var(--blue); }
.today-bar-fill.done { background: var(--green); }

.today-milestone { padding: 12px 14px; border-radius: 8px; background: #0f172a; border: 1px solid var(--line); }
.today-milestone-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; }
.today-milestone-head span { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.today-milestone-next { margin-top: 8px; font-size: 12px; color: var(--muted); }

.today-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.today-actions button, .today-actions .btn { flex: 1 1 160px; min-height: 44px; font-size: 13px; }

@media (max-width: 600px) {
  .today-card { padding: 16px 14px; }
  .today-actions { flex-direction: column; }
  .today-actions button, .today-actions .btn { flex: none; }
}

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(6, 1fr); }
  .span-8, .span-7, .span-6, .span-5, .span-4, .span-3 { grid-column: span 12; }
}

@media (max-width: 900px) {
.stats-grid { grid-template-columns: repeat(4, 1fr); }
  .chart-card-large { min-height: 320px; }
  .chart-card-large .chart { height: 250px; }
}

@media (max-width: 768px) {
  header.hero {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 14px;
  }

  .user-panel {
    justify-content: space-between;
    width: 100%;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .filter-bar > div {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 6px !important;
  }

  .view-tabs {
    width: 100%;
  }

  .view-btn {
    flex: 1;
  }

  .log-entry-card .controls > div,
  .settings-card .controls > div {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .log-entry-card .controls .field,
  .settings-card .controls .field {
    width: 100% !important;
    flex: none !important;
  }

  .log-entry-card button,
  .settings-card button {
    width: 100% !important;
  }

  /* Responsive Syllabus Lesson Box Fixes */
  .syllabus-lesson {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    min-height: auto;
    padding: 10px 12px;
    gap: 8px 12px;
  }

  .syllabus-lesson-time {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .syllabus-stage-tab {
    padding: 7px 10px;
  }
}

@media (max-width: 600px) {
.stats-grid { 
    grid-template-columns: repeat(2, 1fr); 
  }

  .card {
    padding: 12px;
  }

  h1 { font-size: 18px; }

  .modal div[style*="display: flex"],
  .modal div[style*="display:flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .modal .field {
    width: 100% !important;
    max-width: none !important;
  }

  .modal button {
    width: 100% !important;
  }

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

  .cal-title {
    width: 100%;
    order: -1;
    margin-bottom: 4px;
  }

  .calday {
    aspect-ratio: auto;
    min-height: 42px;
    font-size: 9px;
  }

  .calday .time-tag {
    font-size: 7px;
  }

  .insight-subgrid {
    grid-template-columns: 1fr;
  }
}

/* One stat per row only on the narrowest phones (iPhones are 375-430px wide) */
@media (max-width: 340px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 400px) {
  .syllabus-lesson {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 8px;
  }

  .syllabus-lesson-time {
    grid-column: 1;
    grid-row: auto;
  }

  .syllabus-status {
    align-self: flex-start;
  }

  .pill-tab {
    padding: 6px 10px;
    font-size: 11px;
  }
}

/* =========================================================
   Setup wizard (scripts/setup.js) and the Today card's setup checklist
   ========================================================= */

.setup-checklist {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(6, 182, 212, 0.45);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(6, 182, 212, 0.08));
}
.setup-checklist-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.setup-checklist-head b { display: block; font-size: 14px; }
.setup-checklist-head span { font-size: 11px; color: var(--muted); }
.setup-checklist ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; font-size: 12px; color: var(--muted); }
.setup-checklist li.done { color: #34d399; }

body.setup-open { overflow: hidden; }
.modal.setup-modal { max-width: 640px; padding: 22px 24px; }
.setup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.setup-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.setup-steps li { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 10px 4px 4px; border-radius: 20px; border: 1px solid var(--line); }
.setup-steps li span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #0f172a; font-size: 10px; }
.setup-steps li.current { color: #fff; border-color: var(--cyan); }
.setup-steps li.current span { background: var(--cyan); color: #04121a; }
.setup-steps li.done { color: #34d399; border-color: rgba(16, 185, 129, 0.4); }
.setup-steps li.done span { background: var(--green-light); }
.setup-close { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 2px 9px; min-height: 0; }
.setup-eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cyan); }
.setup-modal h3 { margin: 2px 0 8px; font-size: 20px; }
.setup-note { margin: 10px 0 0; font-size: 11px; }

.setup-option { margin-top: 12px; padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: #0f172a; }
.setup-option.primary { border-color: rgba(6, 182, 212, 0.5); background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(6, 182, 212, 0.06)); }
.setup-option-head { display: flex; gap: 12px; align-items: flex-start; }
.setup-option-head b { display: block; font-size: 14px; }
.setup-option-head span { font-size: 12px; color: var(--muted); }
.setup-option-icon { font-size: 22px; line-height: 1; }
.setup-option .instruction-list { margin: 12px 0; }

.setup-result { margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13px; border: 1px solid var(--line); }
.setup-result small { color: var(--muted); }
.setup-result.ok { background: var(--green-light); border-color: rgba(16, 185, 129, 0.45); }
.setup-result.error { background: var(--danger-light); border-color: rgba(239, 68, 68, 0.45); color: #fecaca; }

.setup-guess { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; padding: 10px 12px; border-radius: 8px; font-size: 13px; background: var(--cyan-light); border: 1px solid rgba(6, 182, 212, 0.45); }
.setup-guess span { flex: 1 1 240px; }

.setup-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.setup-fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.setup-fields .span-2 { grid-column: 1 / -1; }

.setup-projection { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: #0f172a; border: 1px solid var(--line); font-size: 13px; }
.setup-projection p { margin: 6px 0; }
.setup-projection-left { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.setup-story { margin-top: 6px; padding: 14px 16px; border-radius: 10px; border: 1px solid rgba(6, 182, 212, 0.45); background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(6, 182, 212, 0.06)); font-size: 14px; line-height: 1.5; }
.setup-story p { margin: 4px 0; }
.setup-story .late { color: #f87171; }
.setup-story .ahead { color: #34d399; }
.setup-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.setup-tiles .stat b { font-size: 16px; margin-top: 4px; }
.setup-tiles .stat small { display: block; margin-top: 3px; font-size: 10px; color: var(--muted); }
.setup-tiles .stat.late b { color: #f87171; }
.setup-tiles .stat.ahead b { color: #34d399; }
.setup-hero { font-size: 44px; text-align: center; margin-top: 8px; }
.setup-lead { text-align: center; font-size: 17px; font-weight: 700; margin: 6px 0; }

.setup-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.setup-foot-right { display: flex; align-items: center; gap: 10px; }
.setup-foot-cta { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.setup-foot-cta button, .setup-foot-cta .btn { min-height: 44px; font-size: 14px; }
.link-btn { background: transparent; border: 0; color: var(--muted); text-decoration: underline; padding: 4px; min-height: 0; }
.link-btn:hover { color: #fff; background: transparent; }

@media (max-width: 600px) {
  .modal.setup-modal { padding: 16px; }
  .setup-steps li { padding: 3px; }
  .setup-steps li:not(.current) { font-size: 0; gap: 0; }
  .setup-fields, .setup-fields.three { grid-template-columns: minmax(0, 1fr); }
  .setup-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup-checklist ul { grid-template-columns: minmax(0, 1fr); }
}
.setup-option a { color: var(--cyan); }
