:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #eff6ff;
  --emerald: #047857;
  --emerald-soft: #ecfdf5;
  --rose: #be123c;
  --rose-soft: #fff1f2;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 14px rgba(15, 23, 42, 0.04);
  --radius: 12px;
}

:root[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-alt: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --primary-soft: #172554;
  --emerald: #34d399;
  --emerald-soft: #064e3b;
  --rose: #fb7185;
  --rose-soft: #4c0519;
  --amber: #fbbf24;
  --amber-soft: #451a03;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

.container {
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: 1rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
  flex-wrap: wrap;
  padding-block: 0.5rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 1.05rem; line-height: 1.2; }
.brand-text small { font-size: 0.72rem; color: var(--muted); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.main-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
}
.main-nav a:hover { color: var(--primary); background: var(--surface-alt); }

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.lang-select, .icon-btn {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.42rem 0.65rem;
  font-size: 0.86rem;
  cursor: pointer;
}

/* Main */
.site-main { padding-block: 1.5rem 3rem; }
.hero { margin-bottom: 1.5rem; }
.hero h1, .page-intro h1 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.22;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}
.hero-sub { color: var(--muted); font-size: 1.02rem; max-width: 72ch; margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; }
.nowrap { white-space: nowrap; }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}
.breadcrumbs a { color: var(--primary); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.section { margin-block: 2rem; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.section h2 { margin: 0 0 0.35rem; font-size: 1.35rem; }

/* Buttons & Badges */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.62rem 1.05rem;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn-sm { padding: 0.42rem 0.8rem; font-size: 0.84rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-alt); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.text-link { color: var(--primary); font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.badge-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.65rem; }
.iso-badge {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.78rem;
}
.badge, .sched-badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--muted);
}
.badge-verified { background: var(--emerald-soft); color: var(--emerald); }
.badge-info { background: var(--primary-soft); color: var(--primary); }
.badge-public { background: var(--rose-soft); color: var(--rose); }
.badge-joint { background: var(--amber-soft); color: var(--amber); }
.badge-obs { background: var(--surface-alt); color: var(--muted); }
.badge-muted { background: var(--surface-alt); color: var(--muted); }

/* Calculator */
.calc-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  flex-wrap: wrap;
}
.calc-tab {
  background: var(--surface-alt);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 9px;
  font-weight: 600;
  cursor: pointer;
}
.calc-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.preset-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 1rem;
}
.preset-label { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.preset-chip, .filter-chip, .year-chip {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.preset-chip:hover, .filter-chip:hover, .year-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active, .year-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 0.9rem;
  margin-bottom: 0.9rem;
}
.field { display: flex; flex-direction: column; gap: 0.35rem; position: relative; }
.field label { font-size: 0.83rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .directory-search {
  width: 100%;
  padding: 0.58rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}
.country-combobox { position: relative; }
.country-dropdown {
  position: absolute;
  inset-inline: 0;
  top: 100%;
  z-index: 30;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  margin-top: 4px;
  box-shadow: var(--shadow);
}
.country-option {
  display: flex;
  justify-content: space-between;
  width: 100%;
  text-align: start;
  padding: 0.52rem 0.75rem;
  background: transparent;
  color: var(--text);
  border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.9rem;
}
.country-option:hover { background: var(--primary-soft); }

.custom-weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}
.day-pill input { display: none; }
.day-pill span {
  display: inline-block;
  padding: 0.35rem 0.72rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
}
.day-pill input:checked + span {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.calc-toggles { margin-bottom: 1rem; }
.checkbox-label { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.92rem; cursor: pointer; }

.calc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.5rem;
}
.sponsor-note { font-size: 0.78rem; color: var(--muted); margin: 0.25rem 0 0; }

.alert-info {
  margin-top: 0.9rem;
  padding: 0.75rem 1rem;
  border-radius: 9px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 0.88rem;
  font-weight: 500;
}

/* Results */
.calc-results { margin-top: 1.25rem; border-top: 1px solid var(--border); padding-top: 1.25rem; }
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.25rem;
}
.stat-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}
.stat-box.stat-highlight {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.stat-num { display: block; font-size: 1.55rem; font-weight: 800; line-height: 1.2; color: var(--text); }
.stat-label { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 0.2rem; font-weight: 600; }

/* Grids */
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 0.9rem;
}
.country-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.country-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.country-card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.country-card h3 { margin: 0 0 0.25rem; font-size: 1.02rem; }
.country-card p { margin: 0; font-size: 0.84rem; color: var(--muted); }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
}
.feature-card h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.feature-card p { margin: 0; font-size: 0.92rem; color: var(--muted); }

.spotlight-card { border-inline-start: 4px solid var(--primary); }
.spotlight-links, .guide-cta, .guide-banner { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.9rem; }

.action-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.year-switcher { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; margin-top: 0.85rem; }
.year-label { font-weight: 700; font-size: 0.86rem; color: var(--muted); }
.source-note { font-size: 0.86rem; color: var(--muted); margin: 0.35rem 0; }

/* 12-Month Visual Grid */
.cal-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; font-size: 0.84rem; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border); }
.dot-work { background: var(--surface); }
.dot-weekend { background: var(--surface-alt); }
.dot-public { background: var(--rose-soft); border-color: var(--rose); }
.dot-joint { background: var(--amber-soft); border-color: var(--amber); }
.dot-obs { background: var(--primary-soft); border-color: var(--primary); }

.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 0.9rem;
}
.mini-month {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  break-inside: avoid;
}
.mini-month h3 { margin: 0 0 0.5rem; font-size: 0.95rem; text-align: center; }
.mini-cal { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.78rem; }
.mini-cal th { color: var(--muted); font-weight: 600; padding-bottom: 0.3rem; text-align: center; }
.mini-cal td { text-align: center; padding: 0.22rem 0.1rem; border-radius: 4px; }
.cal-weekend { background: var(--surface-alt); color: var(--muted); }
.cal-obs { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.cal-joint { background: var(--amber-soft); color: var(--amber); font-weight: 700; }
.cal-public { background: var(--rose-soft); color: var(--rose); font-weight: 700; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td {
  padding: 0.62rem 0.8rem;
  border-bottom: 1px solid var(--border);
  text-align: start;
}
.data-table thead th { background: var(--surface-alt); font-weight: 700; font-size: 0.82rem; color: var(--muted); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.total-row { background: var(--surface-alt); }
.row-off { background: color-mix(in srgb, var(--surface-alt) 60%, transparent); }

/* Directory Controls */
.directory-controls { display: flex; flex-direction: column; gap: 0.85rem; }
.region-filters { display: flex; flex-wrap: wrap; gap: 0.45rem; }

/* FAQ & Prose */
.faq-list { display: flex; flex-direction: column; gap: 0.65rem; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.85rem 1rem; }
.faq-item summary { font-weight: 700; cursor: pointer; }
.faq-item p { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.94rem; }
.prose-card h1 { margin-top: 0.5rem; }
.prose-card p, .prose-card li { max-width: 72ch; }
.center-card { text-align: center; padding-block: 3rem; }
.center-card .guide-cta { justify-content: center; }

/* Ad Zone (Strictly separated below editorial content/tables) */
.ad-zone {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
  text-align: center;
}
.ad-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.5rem; }
.ad-container { min-height: 90px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding-block: 1.5rem;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-brand p { margin: 0.2rem 0 0; font-size: 0.84rem; color: var(--muted); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-nav a { color: var(--muted); text-decoration: none; font-size: 0.88rem; }
.footer-nav a:hover { color: var(--primary); }

/* Consent Banner */
.consent-banner {
  position: fixed;
  inset-block-end: 1rem;
  inset-inline: 1rem;
  max-width: 720px;
  margin-inline: auto;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
}
.consent-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.consent-inner p { margin: 0; font-size: 0.86rem; flex: 1 1 280px; }
.consent-actions { display: flex; gap: 0.5rem; }

/* Print A4 Styles */
@page {
  size: A4 portrait;
  margin: 12mm;
}
@media print {
  .no-print, .site-header, .site-footer, .ad-zone, .consent-banner { display: none !important; }
  body { background: #fff !important; color: #000 !important; font-size: 10pt; }
  .container { max-width: 100%; padding: 0; }
  .card { box-shadow: none; border: 1px solid #cbd5e1; padding: 0.6rem; }
  .year-grid { grid-template-columns: repeat(3, 1fr); gap: 6mm; }
  .mini-month { padding: 4mm; border: 1px solid #cbd5e1; }
  .mini-cal { font-size: 7.5pt; }
  .table-wrap { border: 1px solid #cbd5e1; overflow: visible; }
  .data-table th, .data-table td { padding: 4px 6px; font-size: 8.5pt; }
}
