/* ============================================================
   ThresholdLab Design System — style.css
   Data-brutalist aesthetic for endurance athletes.
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
  --font-mono: "JetBrains Mono", "Fira Code", "Courier New", monospace;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;

  --bg: #F9F9F7;
  --surface: #FFFFFF;
  --border: #E2E2DC;
  --text: #1A1A18;
  --text-muted: #6B6B63;
  --accent: #1A1A18;

  --green: #2D6A4F;
  --green-bg: #E8F5EE;
  --yellow: #B7791F;
  --yellow-bg: #FEF3C7;
  --red: #9B1C1C;
  --red-bg: #FEE2E2;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s6: 24px;
  --s8: 32px;
  --s12: 48px;

  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
  --transition: 150ms ease;

  --nav-height: 56px;
  --sidebar-width: 240px;
  --touch-min: 44px;
}

/* Dark mode — system preference */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --surface: #1C1C1B;
    --border: #2E2E2C;
    --text: #EDEDEB;
    --text-muted: #9B9B93;
    --accent: #EDEDEB;
    --green: #4ADE80;
    --green-bg: #1A3D2B;
    --yellow: #FCD34D;
    --yellow-bg: #3D2E0A;
    --red: #FCA5A5;
    --red-bg: #3D0F0F;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
  }
}

/* Dark mode — manual toggle class on <html> */
html.dark {
  --bg: #111110;
  --surface: #1C1C1B;
  --border: #2E2E2C;
  --text: #EDEDEB;
  --text-muted: #9B9B93;
  --accent: #EDEDEB;
  --green: #4ADE80;
  --green-bg: #1A3D2B;
  --yellow: #FCD34D;
  --yellow-bg: #3D2E0A;
  --red: #FCA5A5;
  --red-bg: #3D0F0F;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
}

/* Light mode — manual toggle override */
html.light {
  --bg: #F9F9F7;
  --surface: #FFFFFF;
  --border: #E2E2DC;
  --text: #1A1A18;
  --text-muted: #6B6B63;
  --accent: #1A1A18;
  --green: #2D6A4F;
  --green-bg: #E8F5EE;
  --yellow: #B7791F;
  --yellow-bg: #FEF3C7;
  --red: #9B1C1C;
  --red-bg: #FEE2E2;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
}


/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity var(--transition);
}

a:hover {
  opacity: 0.7;
}

img, svg {
  display: block;
  max-width: 100%;
}


/* --- Typography --- */
.data-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
}

.data-value-lg {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
}

.data-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.body-text {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
}

.muted {
  font-family: var(--font-body);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-muted);
}

h1, h2, h3, h4 {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

h1 { font-size: 2rem; letter-spacing: -0.03em; }
h2 { font-size: 1.5rem; letter-spacing: -0.02em; }
h3 { font-size: 1.125rem; letter-spacing: -0.01em; }
h4 { font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; }

p { margin-bottom: var(--s4); }
p:last-child { margin-bottom: 0; }


/* --- Risk Pills --- */
.risk-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s1) var(--s3);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.risk-pill.green {
  background: var(--green-bg);
  color: var(--green);
}

.risk-pill.yellow {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.risk-pill.red {
  background: var(--red-bg);
  color: var(--red);
}

.risk-pill .risk-shape {
  font-size: 0.875rem;
  line-height: 1;
}

/* Large traffic light */
.traffic-light {
  display: flex;
  align-items: center;
  gap: var(--s4);
}

.traffic-light .risk-shape {
  font-size: 3rem;
  line-height: 1;
}

.traffic-light.green .risk-shape { color: var(--green); }
.traffic-light.yellow .risk-shape { color: var(--yellow); }
.traffic-light.red .risk-shape { color: var(--red); }

.traffic-light .risk-label {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
}

.traffic-light.green .risk-label { color: var(--green); }
.traffic-light.yellow .risk-label { color: var(--yellow); }
.traffic-light.red .risk-label { color: var(--red); }


/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s6);
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s4);
}

.card-header h3 {
  margin: 0;
}

.card-header .data-label {
  margin: 0;
}

.card-body {
  margin-bottom: var(--s4);
}

.card-body:last-child {
  margin-bottom: 0;
}

.card-footer {
  padding-top: var(--s4);
  border-top: 1px solid var(--border);
}

/* Card variants */
.card-risk {
  border-left: 4px solid var(--border);
}

.card-risk.green { border-left-color: var(--green); }
.card-risk.yellow { border-left-color: var(--yellow); }
.card-risk.red { border-left-color: var(--red); }

.card-cta {
  background: var(--yellow-bg);
  border-color: var(--yellow);
}


/* --- Layout --- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--s6) 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 0 var(--s6);
  margin-bottom: var(--s8);
}

.sidebar-logo a {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -0.03em;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  padding: 0 var(--s3);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s3);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  min-height: var(--touch-min);
  transition: all var(--transition);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--text);
  background: var(--bg);
}

.sidebar-nav a.active {
  font-weight: 600;
}

.sidebar-nav .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.sidebar-footer {
  padding: var(--s4) var(--s6);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--s8);
  max-width: 1200px;
}

.page-header {
  margin-bottom: var(--s8);
}

.page-header h1 {
  margin-bottom: var(--s2);
}

.page-header p {
  color: var(--text-muted);
  margin: 0;
}


/* --- Grid --- */
.grid {
  display: grid;
  gap: var(--s6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.grid-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s6);
}

.grid-full {
  grid-column: 1 / -1;
}


/* --- Navigation (mobile) --- */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--s2) 0;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, var(--s2));
}

.mobile-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--s1) var(--s2);
  font-size: 0.625rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  justify-content: center;
  transition: color var(--transition);
}

.mobile-nav a:hover,
.mobile-nav a.active {
  color: var(--text);
}

.mobile-nav .nav-icon {
  font-size: 1.25rem;
}

.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--s4);
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}

.mobile-header .logo {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
}


/* --- Forms --- */
.form-group {
  margin-bottom: var(--s6);
}

.form-group label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--s2);
}

.form-input,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="password"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: var(--s3) var(--s4);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: var(--touch-min);
  transition: border-color var(--transition);
  -webkit-appearance: none;
}

.form-input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(26, 26, 24, 0.1);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236B6B63' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s3) center;
  padding-right: var(--s8);
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--s1);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s4);
}

.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  cursor: pointer;
  min-height: var(--touch-min);
  padding: var(--s2) 0;
}

.form-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-checkbox span {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text);
}


/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: var(--s3) var(--s6);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: var(--touch-min);
  transition: all var(--transition);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.btn:hover {
  opacity: 0.85;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red);
}

.btn-strava {
  background: #FC4C02;
  color: #FFFFFF;
  border-color: #FC4C02;
}

.btn-strava:hover {
  background: #E34402;
}

.btn-lg {
  padding: var(--s4) var(--s8);
  font-size: 1rem;
  min-height: 52px;
}

.btn-sm {
  padding: var(--s1) var(--s3);
  font-size: 0.75rem;
  min-height: 32px;
}

.btn-block {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: var(--s3);
  flex-wrap: wrap;
}


/* --- Calendar Grid --- */
.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.calendar-day-header {
  background: var(--surface);
  padding: var(--s2) var(--s3);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-align: center;
}

.calendar-day {
  background: var(--surface);
  padding: var(--s3);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.calendar-day.today {
  background: var(--bg);
}

.calendar-day.rest {
  opacity: 0.6;
}

.calendar-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.calendar-date.today {
  color: var(--accent);
  font-weight: 700;
}

.calendar-workout {
  padding: var(--s1) var(--s2);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  line-height: 1.3;
  border-left: 3px solid var(--border);
}

.calendar-workout.planned {
  background: var(--bg);
  border-left-color: var(--accent);
}

.calendar-workout.completed {
  background: var(--green-bg);
  border-left-color: var(--green);
}

.calendar-workout .workout-title {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

.calendar-workout .workout-detail {
  color: var(--text-muted);
  font-size: 0.625rem;
}

.calendar-phase {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: var(--s2) 0;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s4);
}

.calendar-nav .week-label {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
}

.recovery-week {
  position: relative;
}

.recovery-week::after {
  content: "RECOVERY";
  position: absolute;
  top: var(--s2);
  right: var(--s2);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green);
  background: var(--green-bg);
  padding: 2px var(--s2);
  border-radius: 100px;
}


/* --- Onboarding Steps --- */
.onboarding-container {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--s12) var(--s6);
}

.onboarding-progress {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s8);
}

.onboarding-step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}

.onboarding-step-dot.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.onboarding-step-dot.done {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green);
}

.onboarding-step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
}

.onboarding-step-line.done {
  background: var(--green);
}

.onboarding-step {
  display: none;
}

.onboarding-step.active {
  display: block;
}

.onboarding-step h2 {
  margin-bottom: var(--s4);
}

.onboarding-step p {
  color: var(--text-muted);
  margin-bottom: var(--s6);
}


/* --- Brief List --- */
.brief-item {
  padding: var(--s4) var(--s6);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.brief-item:hover {
  background: var(--bg);
}

.brief-item-header {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s2);
}

.brief-date {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
}

.brief-preview {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.brief-full {
  padding: var(--s4) var(--s6);
  font-size: 0.9375rem;
  line-height: 1.7;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}


/* --- Charts --- */
.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}


/* --- Flash Messages --- */
.flash {
  padding: var(--s3) var(--s6);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: var(--s4);
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.flash-success {
  background: var(--green-bg);
  color: var(--green);
}

.flash-warning {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.flash-error {
  background: var(--red-bg);
  color: var(--red);
}


/* --- Loading / HTMX --- */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline-block;
}

.htmx-request.htmx-indicator {
  display: inline-block;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* --- Landing Page --- */
.landing-page {
  background: var(--bg);
}

.landing-hero {
  padding: var(--s12) var(--s6);
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.landing-hero h1 {
  font-size: 3rem;
  letter-spacing: -0.04em;
  margin-bottom: var(--s6);
  line-height: 1.1;
}

.landing-hero .subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin-bottom: var(--s8);
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s6);
  max-width: 960px;
  margin: 0 auto;
  padding: var(--s12) var(--s6);
}

.landing-feature {
  text-align: center;
  padding: var(--s6);
}

.landing-feature .feature-icon {
  font-size: 2rem;
  margin-bottom: var(--s4);
}

.landing-feature h3 {
  margin-bottom: var(--s3);
}

.landing-feature p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.landing-cta {
  text-align: center;
  padding: var(--s12) var(--s6);
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.landing-cta h2 {
  margin-bottom: var(--s4);
}

.landing-pricing {
  text-align: center;
  padding: var(--s12) var(--s6);
  max-width: 480px;
  margin: 0 auto;
}

.pricing-card {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--s8);
}

.pricing-card .price {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
}

.pricing-card .price-period {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.pricing-card .price-annual {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: var(--s2);
}

.pricing-features {
  list-style: none;
  text-align: left;
  margin: var(--s6) 0;
}

.pricing-features li {
  padding: var(--s2) 0;
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.pricing-features li::before {
  content: "✓";
  font-weight: 700;
  color: var(--green);
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s4) var(--s6);
  max-width: 1200px;
  margin: 0 auto;
}

.landing-nav .logo {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
}

.landing-nav-links {
  display: flex;
  gap: var(--s6);
  align-items: center;
}

.landing-nav-links a {
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--text-muted);
}

.landing-nav-links a:hover {
  color: var(--text);
}


/* --- Settings --- */
.settings-section {
  margin-bottom: var(--s8);
  padding-bottom: var(--s8);
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.settings-section h3 {
  margin-bottom: var(--s6);
}

.settings-danger {
  background: var(--red-bg);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: var(--s6);
}


/* --- Taper --- */
.taper-assessment {
  padding: var(--s6);
  border-radius: var(--radius);
  text-align: center;
}

.taper-assessment.optimal {
  background: var(--green-bg);
  color: var(--green);
}

.taper-assessment.tired {
  background: var(--red-bg);
  color: var(--red);
}

.taper-assessment.flat {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.taper-metric {
  text-align: center;
}

.taper-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s6);
  margin: var(--s6) 0;
}


/* --- Utilities --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-green { color: var(--green); }
.text-yellow { color: var(--yellow); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }

.mt-1 { margin-top: var(--s1); }
.mt-2 { margin-top: var(--s2); }
.mt-4 { margin-top: var(--s4); }
.mt-6 { margin-top: var(--s6); }
.mt-8 { margin-top: var(--s8); }
.mb-2 { margin-bottom: var(--s2); }
.mb-4 { margin-bottom: var(--s4); }
.mb-6 { margin-bottom: var(--s6); }
.mb-8 { margin-bottom: var(--s8); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--s2); }
.gap-3 { gap: var(--s3); }
.gap-4 { gap: var(--s4); }
.gap-6 { gap: var(--s6); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden { display: none !important; }

.change-positive { color: var(--green); }
.change-negative { color: var(--red); }
.change-neutral { color: var(--text-muted); }


/* --- Responsive: Tablet --- */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: block;
  }

  .mobile-header {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: var(--s4);
    padding-top: calc(var(--nav-height) + var(--s4));
    padding-bottom: calc(80px + var(--s4));
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .landing-features {
    grid-template-columns: 1fr;
  }

  .landing-hero h1 {
    font-size: 2rem;
  }

  .calendar-week {
    grid-template-columns: 1fr;
  }

  .calendar-day {
    min-height: auto;
    flex-direction: row;
    align-items: center;
    gap: var(--s3);
  }

  .calendar-day-header {
    display: none;
  }

  .taper-metrics {
    grid-template-columns: 1fr;
  }

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

/* --- Responsive: Small phone --- */
@media (max-width: 480px) {
  :root {
    --s6: 16px;
    --s8: 24px;
    --s12: 32px;
  }

  .landing-hero h1 {
    font-size: 1.75rem;
  }

  .data-value {
    font-size: 1.5rem;
  }

  .data-value-lg {
    font-size: 2rem;
  }

  .card {
    padding: var(--s4);
  }

  .btn-lg {
    padding: var(--s3) var(--s6);
  }
}


/* --- Print --- */
@media print {
  .sidebar, .mobile-nav, .mobile-header, .btn {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
  }
}
