/* Ethio-Cal v3 — converter-first, professional / data-dense theme.
 * Light & dark palettes via [data-theme]. Monospace for all date values.
 */

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}
/* Country-flag fallback. Linux/Windows desktops ship no flag glyphs, so flag
   codepoints (regional indicators U+1F1E6–U+1F1FF) render as letter pairs.
   Loading just the flag glyphs from Twemoji via unicode-range keeps the rest
   of the system font untouched. */
@font-face {
  font-family: 'Twemoji Country Flags';
  unicode-range:
    U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074,
    U+E0077, U+E007F;
  src: url('https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1/dist/TwemojiCountryFlags.woff2')
    format('woff2');
  font-display: swap;
}
body {
  margin: 0;
  font-family:
    'Twemoji Country Flags',
    'Inter',
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings:
    'ss01' 1,
    'cv11' 1;
}
/* Ambient backdrop — a soft green-tinted aurora high on the page, plus a faint
   bottom vignette. Fixed so it doesn't move with scroll. Subtle enough not to
   distract from data; just enough to lift the page above flat black. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, var(--accent-glow, transparent), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(116, 174, 248, 0.06), transparent 60%);
  opacity: 0.7;
}
body > * {
  position: relative;
  z-index: 1;
}
html[lang='am'] body,
body:lang(am) {
  font-family: 'Twemoji Country Flags', 'Noto Sans Ethiopic', 'Inter', system-ui, sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--accent-hover, var(--accent));
  text-decoration: underline;
}

/* Accessibility: skip-to-content link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
  border-radius: 0 0 6px 0;
}
.skip-link:focus {
  left: 0;
  text-decoration: none;
}

/* Fasting tracker banner (home) */
.fast-banner {
  margin: 0 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}
.fast-banner:hover {
  box-shadow: var(--shadow);
}
.fast-banner:empty {
  display: none;
}
.fast-banner__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
}
.fast-banner__icon {
  font-size: 22px;
  line-height: 1;
}
.fast-banner__body {
  flex: 1;
  min-width: 0;
}
.fast-banner__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
}
.fast-banner__value {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-top: 2px;
}
.fast-banner__link {
  flex-shrink: 0;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.fast-banner--fasting {
  border-left: 4px solid #7c3aed;
}
.fast-banner--feast {
  border-left: 4px solid #10b981;
}
.fast-banner--ok {
  border-left: 4px solid var(--accent);
}
@media (max-width: 520px) {
  .fast-banner__link {
    display: none;
  }
}

button {
  font: inherit;
  color: inherit;
}

/* ---------- Theme tokens ---------- */
:root {
  --mono:
    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
    monospace;

  /* Radius scale */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  /* Spacing scale (4/8/12/16/20/24/32/40/48/64/80/96) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* Motion tokens — single "premium" ease used for all UI motion. */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --dur-fast: 150ms;
  --dur-base: 220ms;
  --dur-slow: 380ms;

  /* Type scale */
  --type-eyebrow: 12px;
  --type-body: 14px;
  --type-h3: clamp(15px, 1.6vw, 17px);
  --type-h2: clamp(20px, 2.4vw, 26px);
  --type-h1: clamp(28px, 3.6vw, 40px);
  --type-display: clamp(38px, 5.5vw, 56px);
}
html[data-theme='light'] {
  color-scheme: light;
  --bg: #f4f5f8;
  --bg-elev: #ffffff;
  --bg-soft: #eef0f4;
  --fg: #0c111a;
  --fg-muted: #5a6473;
  --fg-dim: #8c93a1;
  --border: rgba(15, 20, 25, 0.08);
  --border-strong: rgba(15, 20, 25, 0.16);
  --accent: #0d8a45;
  --accent-hover: #0b7a3d;
  --accent-fg: #ffffff;
  --accent-soft: rgba(13, 138, 69, 0.08);
  --accent-glow: rgba(13, 138, 69, 0.2);
  --warn: #c2590c;
  --danger: #c42b2b;
  --danger-soft: rgba(196, 43, 43, 0.1);
  --info: #1d6fd1;
  --surface-card: linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
  --surface-card-hover: linear-gradient(180deg, #ffffff 0%, #f7f8fa 100%);
  --surface-immersive:
    radial-gradient(ellipse at 50% 0%, rgba(13, 138, 69, 0.05) 0%, transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #f4f5f8 100%);
  --shadow-sm: 0 1px 2px rgba(15, 20, 25, 0.06);
  --shadow: 0 1px 2px rgba(15, 20, 25, 0.04), 0 8px 24px rgba(15, 20, 25, 0.06);
  --shadow-lg: 0 2px 4px rgba(15, 20, 25, 0.06), 0 16px 40px rgba(15, 20, 25, 0.08);
  --shadow-hover:
    0 0 0 1px rgba(13, 138, 69, 0.2), 0 18px 48px rgba(15, 20, 25, 0.12),
    0 0 56px rgba(13, 138, 69, 0.06);
  --glow: 0 0 0 3px rgba(13, 138, 69, 0.18);
}
html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #07090f;
  --bg-elev: #0f131c;
  --bg-soft: #161b27;
  --fg: #ecedf0;
  --fg-muted: #a3aab8;
  --fg-dim: #6b7488;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #3dba6e;
  --accent-hover: #4bcb7d;
  --accent-fg: #04140a;
  --accent-soft: rgba(61, 186, 110, 0.12);
  --accent-glow: rgba(61, 186, 110, 0.22);
  --warn: #e8b44e;
  --danger: #f07070;
  --danger-soft: rgba(240, 112, 112, 0.12);
  --info: #74aef8;

  /* Subtle layered surfaces (Linear / Vercel style) */
  --surface-card:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0%, rgba(255, 255, 255, 0.012) 100%),
    var(--bg-elev);
  --surface-card-hover:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%),
    var(--bg-elev);
  --surface-immersive:
    radial-gradient(ellipse at 50% 0%, rgba(61, 186, 110, 0.06) 0%, transparent 55%),
    linear-gradient(180deg, #0d121d 0%, #08090f 100%);

  /* Premium shadow stack — inset highlight + outer rim + drop */
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 1px 2px rgba(0, 0, 0, 0.4),
    0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg:
    0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 2px 4px rgba(0, 0, 0, 0.4),
    0 16px 40px rgba(0, 0, 0, 0.55);
  --shadow-hover:
    0 1px 0 rgba(255, 255, 255, 0.07) inset, 0 0 0 1px rgba(61, 186, 110, 0.16),
    0 18px 48px rgba(0, 0, 0, 0.6), 0 0 56px rgba(61, 186, 110, 0.06);
  --glow: 0 0 0 3px rgba(61, 186, 110, 0.22);
}
@media (prefers-color-scheme: dark) {
  html[data-theme='auto'] {
    color-scheme: dark;
    --bg: #07090f;
    --bg-elev: #0f131c;
    --bg-soft: #161b27;
    --fg: #ecedf0;
    --fg-muted: #a3aab8;
    --fg-dim: #6b7488;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --accent: #3dba6e;
    --accent-hover: #4bcb7d;
    --accent-fg: #04140a;
    --accent-soft: rgba(61, 186, 110, 0.12);
    --accent-glow: rgba(61, 186, 110, 0.22);
    --warn: #e8b44e;
    --danger: #f07070;
    --danger-soft: rgba(240, 112, 112, 0.12);
    --info: #74aef8;
    --surface-card:
      linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0%, rgba(255, 255, 255, 0.012) 100%),
      var(--bg-elev);
    --surface-card-hover:
      linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%),
      var(--bg-elev);
    --surface-immersive:
      radial-gradient(ellipse at 50% 0%, rgba(61, 186, 110, 0.06) 0%, transparent 55%),
      linear-gradient(180deg, #0d121d 0%, #08090f 100%);
    --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow:
      0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 1px 2px rgba(0, 0, 0, 0.4),
      0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg:
      0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 2px 4px rgba(0, 0, 0, 0.4),
      0 16px 40px rgba(0, 0, 0, 0.55);
    --shadow-hover:
      0 1px 0 rgba(255, 255, 255, 0.07) inset, 0 0 0 1px rgba(61, 186, 110, 0.16),
      0 18px 48px rgba(0, 0, 0, 0.6), 0 0 56px rgba(61, 186, 110, 0.06);
    --glow: 0 0 0 3px rgba(61, 186, 110, 0.22);
  }
}

/* ---------- Typography ---------- */
h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
h1 {
  font-size: 20px;
  font-weight: 600;
}
h2 {
  font-size: 16px;
  font-weight: 600;
}
h3 {
  font-size: 14px;
  font-weight: 600;
}
.mono,
time,
.conv__readout,
.today__value,
.conv__details dd,
input[type='number'],
input[type='date'],
select {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(140%) blur(16px);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
}
.topnav__scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.topnav__scroll::-webkit-scrollbar {
  display: none;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand:hover {
  text-decoration: none;
}
.brand__mark {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand__wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.brand__eth {
  font-family: 'Noto Sans Ethiopic', 'Inter', system-ui, sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.01em;
}
.brand__name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.brand__tag {
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  border-left: 1px solid var(--border);
  padding-left: 8px;
}
.topnav {
  display: flex;
  gap: 2px;
  justify-self: center;
  max-width: 100%;
  min-width: 0;
}
.topnav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  transition:
    color 0.2s ease,
    background 0.2s ease;
  position: relative;
}
.topnav a[data-nav='home'],
.topnav a[data-nav='calendar'],
.topnav a[data-nav='age'],
.topnav a[data-nav='meeting'],
.topnav a[data-nav='rates'],
.topnav a[data-nav='about'] {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
  padding: 4px 12px;
  white-space: normal;
  text-align: center;
}
.topnav a:hover {
  text-decoration: none;
  background: var(--bg-soft);
  color: var(--fg);
}
.topnav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.topbar__tools {
  display: flex;
  gap: 6px;
  align-items: center;
}
/* Hamburger button — hidden on desktop, prominent on mobile */
.topbar__burger {
  display: none;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--fg);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.topbar__burger:hover {
  background: var(--bg-soft);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sitefoot {
  max-width: 1200px;
  margin: 32px auto 0;
  padding: 20px 20px;
  color: var(--fg-dim);
  font-size: 12px;
}
.sitefoot__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  justify-content: space-between;
}
.sitefoot__links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.sitefoot__links a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted transparent;
}
.sitefoot__links a:hover,
.sitefoot__links a:focus-visible {
  color: var(--fg);
  border-bottom-color: var(--fg-dim);
}

/* ---------- Primitives ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
}
.btn:hover {
  background: var(--bg-soft);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn:active {
  transform: translateY(1px);
}
.btn--primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
}
.btn--primary:hover {
  background: var(--accent-hover, var(--accent));
  color: var(--accent-fg);
  border-color: transparent;
}
.btn--icon {
  width: 32px;
  padding: 0;
  font-size: 14px;
}
.btn--sm {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
}
.btn--ghost {
  background: transparent;
}

input[type='number'],
input[type='date'],
input[type='text'],
select {
  font-size: 13px;
  color: var(--fg);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  min-height: 34px;
  width: 100%;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
input:focus,
select:focus,
.btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--glow);
}
select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--fg-muted) 50%),
    linear-gradient(135deg, var(--fg-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 50%,
    calc(100% - 9px) 50%;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  padding-right: 26px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-soft);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}
.chip--ok {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}
.chip--closed {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}
.chip--fast {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  border-color: transparent;
}
.chip--feast {
  color: var(--info);
  background: color-mix(in srgb, var(--info) 14%, transparent);
  border-color: transparent;
}
.chip--period {
  color: var(--fg);
  background: var(--bg-soft);
}
.chip--period .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

/* ---------- Ethiopian time periods (about page) ---------- */
.periods {
  margin: 16px 0 8px;
}
.periods__caption {
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: 8px;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.periods__band {
  position: relative;
  display: flex;
  height: 88px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elev);
}
.periods__seg {
  flex: 0 0 auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  border-right: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.periods__seg:last-child {
  border-right: none;
}
.periods__seg-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}
.periods__seg-am {
  font-size: 12px;
  white-space: nowrap;
}
.periods__seg-range {
  font-size: 11px;
  font-family: var(--font-mono, ui-monospace, monospace);
  white-space: nowrap;
  margin-top: auto;
}
.periods__seg.is-now {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.periods__now {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 2px;
  background: var(--fg);
  pointer-events: none;
  transform: translateX(-1px);
}
.periods__now-dot {
  position: absolute;
  top: -4px;
  left: -5px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid var(--bg);
}
.periods__now-label {
  position: absolute;
  top: -22px;
  left: 10px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--fg);
  color: var(--bg);
  white-space: nowrap;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.periods__axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10px;
  color: var(--fg-muted);
  font-family: var(--font-mono, ui-monospace, monospace);
}
.periods__axislabel {
  text-align: right;
  font-size: 10px;
  margin: 2px 0 0;
}
/* Seasons (about page) — reuses period band visuals for consistency */
.seasons {
  margin: 20px 0 8px;
}
.seasons__caption {
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: 8px;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.seasons__band {
  position: relative;
  display: flex;
  height: 76px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
}
.seasons__seg {
  flex: 0 0 auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  border-right: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.seasons__seg:last-child {
  border-right: none;
}
.seasons__seg-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}
.seasons__seg-am {
  font-size: 11px;
  white-space: nowrap;
}
.seasons__seg.is-now {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.seasons__axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10px;
  color: var(--fg-muted);
  font-family: var(--font-mono, ui-monospace, monospace);
}
.seasons__axis span {
  flex: 1 1 0;
  text-align: center;
}
.seasons__table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}
.seasons__table th,
.seasons__table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}
.seasons__table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  font-weight: 500;
}
.seasons__table td .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: middle;
}
.seasons__table tr.is-now td {
  background: var(--accent-soft);
}
.seasons__table tr.is-now td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}
@media (max-width: 600px) {
  .seasons__band {
    height: 90px;
  }
  .seasons__seg {
    padding: 6px 5px;
  }
  .seasons__seg-name {
    font-size: 12px;
  }
  .seasons__seg-am {
    font-size: 10px;
  }
}

/* Age calculator */
.age-hero {
  padding: 22px 24px;
  margin: 12px 0 16px;
}
.age-hero__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: start;
}
.age-hero__label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.age-hero__big {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 14px;
  line-height: 1.05;
}
.age-hero__num {
  font-size: clamp(44px, 8vw, 72px);
  font-weight: 800;
  color: var(--fg);
  font-family: var(--font-mono, ui-monospace, monospace);
  letter-spacing: -0.02em;
  /* Stable digit widths so the per-second age tick doesn't shift the hero. */
  font-variant-numeric: tabular-nums;
  font-feature-settings:
    'tnum' 1,
    'lnum' 1;
}
.age-hero__unit {
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 500;
  color: var(--fg);
}
.age-hero__right {
  min-width: 260px;
  border-left: 1px solid var(--border);
  padding-left: 24px;
}
.age-singular__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 6px;
}
.age-singular__list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.9;
  color: var(--fg);
  /* The hours/minutes/seconds rows tick every second on "today"; tabular-nums
     keeps the row widths from shifting when digit counts change. */
  font-variant-numeric: tabular-nums;
  font-feature-settings:
    'tnum' 1,
    'lnum' 1;
}
.age-singular__list li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: flex-start;
}
.age-singular__or {
  color: var(--fg-muted);
  font-size: 12px;
  font-style: italic;
}

.age-form {
  padding: 20px 24px;
  margin: 0 0 16px;
}
.age-form__help {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--fg-muted);
}
.age-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 28px;
  align-items: start;
}
.age-form__col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.age-form__col-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.age-form__side-tabs {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  background: var(--bg);
  width: fit-content;
  margin-bottom: 2px;
}
.age-side__tab {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--fg-muted);
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.age-side__tab.is-active {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 700;
}
.age-form__row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.age-select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  min-width: 0;
}
.age-select--month {
  flex: 1 1 100px;
}
.age-select--day {
  flex: 0 1 80px;
}
.age-select--year {
  flex: 0 1 110px;
}
.age-form__actions {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 4px;
}
.age-calc-btn {
  background: #111;
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  font-family: inherit;
  min-width: 220px;
}
.age-calc-btn:hover {
  background: #000;
}
.age-clear {
  background: transparent;
  border: 0;
  color: var(--fg-muted);
  text-decoration: underline;
  padding: 2px 0;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.age-clear:hover {
  color: var(--fg);
}
.age-today-btn {
  background: transparent;
  border: 0;
  color: var(--fg-muted);
  text-decoration: underline;
  padding: 2px 0;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.age-today-btn:hover {
  color: var(--fg);
}

.age-bonus {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 0 0 16px;
}
.age-bonus__cell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg-elev);
}
.age-bonus__cell h3 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  font-weight: 600;
}
.age-error {
  color: #dc2626;
  font-size: 13px;
  margin: 4px 0 0;
}
@media (max-width: 780px) {
  .age-hero__inner {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .age-hero__right {
    border-left: 0;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 14px;
  }
  .age-form__grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .age-bonus {
    grid-template-columns: 1fr;
  }
}

.periods__table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
}
.periods__table th,
.periods__table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}
.periods__table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  font-weight: 500;
}
.periods__table td .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: middle;
}
.periods__table tr.is-now td {
  background: var(--accent-soft);
}
.periods__table tr.is-now td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}
@media (max-width: 600px) {
  .periods__band {
    height: 104px;
  }
  .periods__seg {
    padding: 8px 6px;
  }
  .periods__seg-range {
    font-size: 10px;
  }
}

.muted {
  color: var(--fg-muted);
}
.dim {
  color: var(--fg-dim);
}

/* ---------- Panels ---------- */
.panel {
  background: var(--surface-card, var(--bg-elev));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 2.2vw, 28px);
  box-shadow: var(--shadow);
  transition:
    border-color var(--dur-base) var(--ease),
    box-shadow var(--dur-base) var(--ease),
    transform var(--dur-base) var(--ease);
}
.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.panel__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
}
.panel__sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--fg-muted);
  max-width: 62ch;
}

/* ---------- Today strip ---------- */
.today__grid {
  display: flex;
  flex-wrap: wrap;
  background: var(--surface-card, var(--bg-elev));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.today__item {
  flex: 1 1 auto;
  min-width: 160px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-base) var(--ease);
}
.today__item:hover {
  background: var(--accent-soft);
}
.today__item:last-child {
  border-right: none;
}
.today__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  font-weight: 600;
  white-space: nowrap;
}
.today__value {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  white-space: normal;
  overflow-wrap: anywhere;
  letter-spacing: -0.01em;
}
/* Ticking clock cells: fixed-width digits + minimum width so the seconds
   advancing 09 -> 10 doesn't change column width and shift surrounding cells. */
.today__value[data-tick] {
  font-variant-numeric: tabular-nums;
  font-feature-settings:
    'tnum' 1,
    'lnum' 1;
  min-width: 9ch;
  display: inline-block;
  text-align: left;
}
.today__value--lg {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ---------- Converter ---------- */
.conv {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: stretch;
}
@media (max-width: 760px) {
  .conv {
    grid-template-columns: 1fr;
  }
  .conv__swap {
    transform: rotate(90deg);
  }
}
.conv__side {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.conv__side:focus-within {
  border-color: var(--accent);
  box-shadow: var(--glow);
}
.conv__side > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.conv__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  font-weight: 600;
}
.conv__chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--fg-muted);
}
.conv__inputs {
  display: grid;
  grid-template-columns: 1fr 1.3fr 0.9fr;
  gap: 8px;
}
.conv__inputs--single {
  grid-template-columns: 1fr;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.field > span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  font-weight: 600;
}
.conv__readout {
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
  padding: 8px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv__swap {
  display: grid;
  place-items: center;
}
.conv__swap .btn {
  width: 36px;
  height: 36px;
  font-size: 16px;
  transition:
    transform 0.3s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.conv__swap .btn:hover {
  transform: rotate(180deg);
}

.conv__details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elev);
}
.conv__details dl {
  margin: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
}
.conv__details dl:last-child {
  border-right: 0;
}
.conv__details dt {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  font-weight: 600;
}
.conv__details dd {
  margin: 0;
  font-size: 13px;
  color: var(--fg);
  word-break: break-word;
}

.conv__shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.conv__shortcuts .shortcut-label {
  color: var(--fg-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  align-self: center;
  margin-right: 2px;
}

.conv__error {
  grid-column: 1 / -1;
  padding: 8px 12px;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-top: 8px;
}

/* ---------- Month view (home page) ---------- */
.month__header {
  align-items: center;
}
.month__title {
  flex: 1;
  min-width: 200px;
}
.month__nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.month__nav select {
  width: auto;
  min-width: 110px;
}

.month-view {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.month-view .wd {
  padding: 6px 8px;
  background: var(--bg-soft);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  font-weight: 600;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.month-view .wd .wd__am {
  font-size: 11px;
  color: var(--fg);
  font-weight: 700;
  text-transform: none;
}
.month-view .wd .wd__en {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-weight: 500;
}
.month-view .cell {
  position: relative;
  background: var(--bg-elev);
  min-height: 62px;
  padding: 6px 8px;
  border: 0;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2px;
  color: var(--fg);
}
.month-view .cell:hover {
  background: var(--bg-soft);
}
.month-view .cell.empty {
  background: var(--bg-soft);
  cursor: default;
}
.month-view .cell.weekend {
  background: color-mix(in srgb, var(--bg-soft) 70%, var(--bg-elev));
}
.month-view .cell.today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}
.month-view .cell.closed .num {
  color: var(--danger);
}
.month-view .cell.selected {
  background: var(--accent-soft);
}
.month-view .cell .num {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
}
.month-view .cell .greg {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-muted);
}
.month-view .cell .dots {
  display: flex;
  gap: 3px;
  margin-top: auto;
}
.month-view .cell .dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--fg-dim);
}
.month-view .cell.closed .dot.dot--holiday {
  background: var(--danger);
}
.month-view .cell.fast .dot.dot--fast {
  display: none;
}
.month-view .cell .tip {
  font-size: 10px;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month__summary {
  margin-top: 12px;
}
.month__summary h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  margin-bottom: 6px;
}
.month__summary ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px 14px;
  font-size: 12.5px;
}
.month__summary li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}
.month__summary .summary__day {
  font-family: var(--mono);
  font-weight: 600;
  min-width: 28px;
  color: var(--fg);
}
.month__summary .summary__title {
  flex: 1;
  color: var(--fg);
}
.month__summary .summary__tag {
  font-size: 10px;
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- CTA bar ---------- */
.cta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.cta__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Calendar page ---------- */
.calendar-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.calendar-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-muted);
}
.calendar-toolbar select {
  width: auto;
  min-width: 110px;
}
.month-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.month-picker legend {
  padding: 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
}
.month-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 12px;
  user-select: none;
}
.month-pill input {
  accent-color: var(--accent);
  width: auto;
  min-height: 0;
}
.month-pill:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.months {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.months.print-dense {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.month {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  page-break-inside: avoid;
  break-inside: avoid;
  box-shadow: var(--shadow-sm);
}
.month > header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.month .name {
  font-size: 13px;
  font-weight: 600;
}
.month .sub {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-muted);
}
.month .grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.month .grid .wd {
  font-size: 9.5px;
  letter-spacing: 0.04em;
  padding: 3px 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  color: var(--fg-muted);
  background: var(--bg-soft);
}
.month .grid .wd .wd__am {
  font-size: 10px;
  color: var(--fg);
  font-weight: 700;
  text-transform: none;
}
.month .grid .wd .wd__en {
  font-size: 8px;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-weight: 500;
}
.month .grid .cell {
  background: var(--bg-elev);
  color: var(--fg);
  border: 0;
  padding: 4px 5px;
  text-align: left;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2px;
  transition: background 0.15s ease;
}
.month .grid .cell:hover {
  background: var(--bg-soft);
}
.month .grid .cell.weekend {
  background: color-mix(in srgb, var(--bg-soft) 70%, var(--bg-elev));
}
.month .grid .cell.today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}
.month .grid .cell.closed .num {
  color: var(--danger);
}
.month .grid .cell .num {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}
.month .grid .cell .greg {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--fg-muted);
}
.month .grid .cell .dot {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--fg-dim);
}
.month .grid .cell.closed .dot {
  background: var(--danger);
}
.month .grid .cell.fast .dot {
  display: none;
}
.month .summary {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  font-size: 11.5px;
}
.month .summary li {
  padding: 3px 0;
  border-bottom: 1px dashed var(--border);
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 6px;
  align-items: baseline;
}
.month .summary li.muted {
  display: block;
  color: var(--fg-muted);
  font-style: italic;
}
.month .summary .summary__day {
  font-family: var(--mono);
  font-weight: 600;
}
.month .summary .summary__tag {
  font-size: 9px;
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- Closed-days ribbon (print top banner) ---------- */
.closed-ribbon {
  display: none;
  padding: 8px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 11px;
}
.closed-ribbon strong {
  margin-right: 8px;
  font-family: var(--mono);
}
.ribbon-chip {
  display: inline-block;
  padding: 1px 8px;
  margin: 2px 4px 2px 0;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 10.5px;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal[hidden] {
  display: none;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.modal__dialog {
  position: relative;
  width: min(520px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.modal__dialog > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.modal__dialog > header h3 {
  font-size: 14px;
  font-weight: 600;
}
.modal__body {
  padding: 12px 16px;
  font-size: 13px;
}
.day-detail {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  margin: 0;
}
.day-detail dt {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  font-weight: 600;
  padding-top: 2px;
}
.day-detail dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--fg);
}
.day-detail ul {
  margin: 0;
  padding-left: 16px;
}

/* ---------- Drawer (options) ---------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
}
.drawer[hidden] {
  display: none;
}
.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.drawer__panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(360px, 92%);
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: drawer-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes drawer-in {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}
.drawer__panel > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.drawer__panel h2 {
  font-size: 14px;
}
.drawer__body {
  padding: 12px 16px;
  overflow: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.opt-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.opt-group > legend,
.opt-group > .opt-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  font-weight: 600;
  padding: 0;
  margin-bottom: 2px;
}
.seg {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg button {
  flex: 1;
  background: var(--bg-elev);
  border: 0;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--fg-muted);
  cursor: pointer;
  border-right: 1px solid var(--border);
}
.seg button:last-child {
  border-right: 0;
}
.seg button[aria-pressed='true'] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.opt-check {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.opt-check input {
  accent-color: var(--accent);
  width: auto;
  min-height: 0;
}

/* ---------- About page ---------- */
.prose {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-wrap: break-word;
}
.prose h1 {
  font-size: 22px;
  margin-bottom: 10px;
}
.prose h2 {
  font-size: 16px;
  margin: 24px 0 8px;
}
.prose p,
.prose li {
  font-size: 14px;
  line-height: 1.65;
  color: var(--fg);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: var(--mono);
  margin: 10px 0 18px;
}
.prose th,
.prose td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
}
.prose thead th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border-strong);
  font-family: 'Inter', system-ui, sans-serif;
}
.prose tbody tr:hover {
  background: var(--bg-soft);
}

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

/* ---------- Print ---------- */
@media print {
  @page {
    size: A4 landscape;
    margin: 8mm;
  }
  html,
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .topbar,
  .sitefoot,
  .calendar-toolbar,
  .drawer,
  #day-modal,
  .today,
  .converter,
  .cta,
  .panel__header,
  .month-picker,
  .panel,
  .panel__header .month__nav {
    display: none !important;
  }
  .container {
    max-width: none;
    padding: 0;
  }
  .closed-ribbon {
    display: none !important;
  }
  .months {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .months.print-dense {
    grid-template-columns: repeat(5, 1fr);
  }
  .month {
    border-color: #000;
  }
  .month .grid {
    background: #000;
  }
  .month .grid .wd {
    background: #eee;
    color: #000;
  }
  .month .grid .cell {
    background: #fff;
    color: #000;
  }
  .month .grid .cell.today {
    outline-color: #000;
  }
  .month .grid .cell.closed .num {
    color: #000;
    font-weight: 800;
    text-decoration: underline;
  }
}

/* ---------- Schedule page ---------- */
.sched__hero .panel__header {
  gap: 12px;
}
.sched__hero code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg-soft);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}
.sched__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}
.sched__toolbar .field {
  margin: 0;
  min-width: 180px;
}
.sched__toolbar .btn--primary {
  margin-left: auto;
}

.sched__subhead {
  border-bottom: 1px solid var(--border);
}

.sched__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sched__row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 16px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  position: relative;
}
.sched__row:first-child {
  border-top: none;
}
.sched__row.is-past {
  opacity: 0.55;
}
.sched__row.is-today {
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-elev));
}
.sched__rail {
  border-radius: 3px;
  background: var(--border);
  min-height: 28px;
}
.sched__row--orthodox .sched__rail {
  background: #7c3aed;
}
.sched__row--national .sched__rail {
  background: var(--accent);
}
.sched__row--islamic .sched__rail {
  background: #16a34a;
}
.sched__row--mine .sched__rail {
  background: var(--info);
}

.sched__main {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-width: 0;
}
.sched__date {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sched__greg {
  font-weight: 600;
  font-size: 13px;
  color: var(--fg);
}
.sched__eth {
  font-size: 12px;
}
.sched__wd {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sched__name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sched__title {
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
}
.sched__subname {
  font-size: 12px;
}
.sched__meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.chip--type {
  border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
}
.chip--orthodox {
  color: #7c3aed;
  background: color-mix(in srgb, #7c3aed 12%, transparent);
  border-color: transparent;
}
.chip--national {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}
.chip--islamic {
  color: #16a34a;
  background: color-mix(in srgb, #16a34a 12%, transparent);
  border-color: transparent;
}
.chip--warn {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  border-color: transparent;
}
.chip--countdown {
  font-variant-numeric: tabular-nums;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
}
.chip--countdown--upcoming {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}
.chip--countdown--today {
  color: #fff;
  background: var(--accent);
  border-color: transparent;
  font-weight: 600;
}
.chip--countdown--past {
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  border-color: transparent;
}

.sched__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}
.sched__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--fg);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.sched__btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.sched__btn > span[aria-hidden='true'] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--bg-soft);
  font-weight: 700;
  font-size: 11px;
  font-family: var(--mono);
}
.sched__btn[data-action='gcal'] > span[aria-hidden='true'],
.sched__btn[data-action='mine-gcal'] > span[aria-hidden='true'] {
  background: #4285f4;
  color: #fff;
}
.sched__btn[data-action='outlook'] > span[aria-hidden='true'],
.sched__btn[data-action='mine-outlook'] > span[aria-hidden='true'] {
  background: #0078d4;
  color: #fff;
}
.sched__btn[data-action='ics'] > span[aria-hidden='true'],
.sched__btn[data-action='mine-ics'] > span[aria-hidden='true'] {
  background: var(--fg);
  color: var(--bg-elev);
}
.sched__btn--danger:hover {
  color: var(--danger);
  border-color: var(--danger);
}
.sched__btn--danger > span[aria-hidden='true'] {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Personal event form */
.sched__form {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.sched__form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 14px;
}
.sched__form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  grid-column: 1 / -1;
}
.sched__side-picker {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  grid-column: 1 / -1;
}
.sched__side-picker legend {
  padding: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  margin-bottom: 4px;
}
.sched__radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  font-size: 13px;
  cursor: pointer;
  margin-right: 8px;
}
.sched__radio:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.sched__form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.sched__empty {
  padding: 20px 16px;
}

@media (max-width: 780px) {
  .sched__main {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .sched__row {
    grid-template-columns: 6px 1fr;
  }
  .sched__actions {
    grid-column: 2 / -1;
    justify-content: flex-start;
    margin-top: 4px;
  }
  .sched__form-row {
    grid-template-columns: 1fr;
  }
}

/* ========================================================================
 * Responsive: tablet & phone breakpoints.
 * 900px   — compact tablet / large phone landscape
 * 720px   — tablet portrait / phone landscape
 * 520px   — phone portrait
 * 380px   — narrow phone (iPhone SE width)
 * ======================================================================== */

@media (max-width: 900px) {
  .container {
    padding: 16px 14px;
    gap: 14px;
  }
  .topbar__inner {
    padding: 8px 14px;
    gap: 10px;
  }
  .topnav a {
    padding: 6px 10px;
    font-size: 12.5px;
  }
  .brand__tag {
    display: none;
  }
  .months {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
  }
  .conv__inputs {
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 6px;
  }
  .prose {
    padding: 18px 18px;
  }
}

@media (max-width: 1024px) {
  /* Hamburger menu on mobile — nav hidden by default, opens as dropdown */
  .topbar__burger {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .topbar__inner {
    grid-template-columns: auto 1fr auto auto;
    gap: 8px;
  }
  .topbar {
    position: sticky;
  }
  .topnav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100vw;
    flex-direction: column;
    gap: 0;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 0;
    z-index: 30;
  }
  .topnav.is-open {
    display: flex;
  }
  .topnav a {
    padding: 14px 20px;
    border-radius: 0;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
    color: var(--fg);
  }
  .topnav a:last-child {
    border-bottom: none;
  }
  .topnav a.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
  }
  .topnav a[data-nav='home'],
  .topnav a[data-nav='calendar'],
  .topnav a[data-nav='age'],
  .topnav a[data-nav='meeting'],
  .topnav a[data-nav='rates'],
  .topnav a[data-nav='about'] {
    flex-direction: row;
    gap: 4px;
    padding: 14px 20px;
  }
  .conv__readout {
    font-size: 14px;
    white-space: normal;
    word-break: break-word;
  }
  .conv__details {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
  .today__item {
    min-width: 140px;
    padding: 9px 12px;
  }
  .today__value {
    font-size: 13.5px;
  }
  .today__value--lg {
    font-size: 15px;
  }
  .month-view .cell {
    min-height: 52px;
    padding: 4px 5px;
  }
  .month-view .cell .num {
    font-size: 13px;
  }
  .month-view .cell .greg {
    font-size: 9px;
  }
  .month-view .cell .tip {
    display: none;
  }
  .sched__toolbar .btn--primary {
    margin-left: 0;
  }
  .sched__toolbar .field {
    min-width: 0;
    flex: 1 1 180px;
  }
  .prose h1 {
    font-size: 19px;
  }
  .prose h2 {
    font-size: 15px;
  }
  .prose table {
    font-size: 12px;
  }
  .prose th,
  .prose td {
    padding: 6px 7px;
  }
  .periods__band {
    height: 96px;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 13.5px;
  }
  .container {
    padding: 12px 10px;
    gap: 12px;
  }
  .panel {
    padding: 12px 12px;
  }
  .panel__header {
    gap: 8px;
    margin-bottom: 10px;
  }
  /* Make the whole topbar fit a 320–360px viewport without horizontal overflow. */
  .topbar__inner {
    padding: 8px 10px;
    gap: 0 4px;
  }
  .topbar,
  .topbar__inner,
  .brand,
  .brand__wordmark,
  .topbar__tools {
    min-width: 0;
  }
  .topbar__tools {
    gap: 4px;
    flex-wrap: nowrap;
  }
  .topbar__tools .btn {
    padding: 6px 8px;
    font-size: 12px;
  }
  .brand__name {
    font-size: 14px;
  }
  .brand__wordmark {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Tap targets */
  .btn {
    min-height: 36px;
    padding: 7px 12px;
  }
  .btn--sm {
    min-height: 32px;
  }
  .btn--icon {
    width: 36px;
    height: 36px;
  }
  input[type='number'],
  input[type='date'],
  input[type='text'],
  select {
    min-height: 38px;
    font-size: 14px; /* prevent iOS Safari auto-zoom on focus */
  }
  /* Converter: stack year/month/day */
  .conv__inputs {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .conv__swap .btn {
    width: 40px;
    height: 40px;
  }
  /* Month view: denser cells */
  .month-view {
    gap: 1px;
  }
  .month-view .cell {
    min-height: 44px;
    padding: 3px 4px;
  }
  .month-view .cell .num {
    font-size: 12px;
  }
  .month-view .cell .greg {
    font-size: 8.5px;
  }
  .month-view .cell .dot {
    width: 4px;
    height: 4px;
  }
  .month__summary ul {
    grid-template-columns: 1fr;
  }
  /* Schedule rows: actions row wraps under meta */
  .sched__row {
    padding: 12px 12px;
    gap: 10px;
  }
  .sched__btn {
    min-height: 34px;
    padding: 6px 10px;
  }
  /* Periods band: 4 segs are cramped; let text wrap */
  .periods__band {
    height: 110px;
  }
  .periods__seg {
    padding: 6px 5px;
  }
  .periods__seg-name {
    font-size: 12px;
  }
  .periods__seg-am {
    font-size: 11px;
  }
  .periods__seg-range {
    font-size: 10px;
  }
  /* About prose */
  .prose {
    padding: 14px 14px;
  }
  /* Calendar month cards */
  .months {
    grid-template-columns: 1fr;
  }
  .month {
    padding: 10px 10px;
  }
}

@media (max-width: 380px) {
  .topnav a {
    padding: 6px 8px;
    font-size: 12px;
  }
  .conv__readout {
    font-size: 13.5px;
  }
  .sched__btn span:not([aria-hidden='true']) {
    display: none;
  }
  .sched__btn {
    padding: 6px 8px;
  }
  .sched__btn--danger span:not([aria-hidden='true']) {
    display: inline;
  }
  .periods__seg-am {
    display: none;
  }
}

/* Landscape phones with very short viewport: shrink some vertical padding */
@media (max-height: 480px) and (orientation: landscape) {
  .topbar__inner {
    padding: 6px 12px;
  }
  .container {
    padding-top: 10px;
  }
}

/* ==========================================================================
   Holiday Countdown (homepage ticker)
   ========================================================================== */
.countdown {
  margin: 18px 0 0;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    color-mix(in oklab, var(--accent) 10%, var(--panel)) 0%,
    var(--panel) 70%
  );
  border: 1px solid var(--border);
}
.countdown[hidden] {
  display: none;
}
.countdown__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}
.countdown__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--fg);
}
.countdown__all {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.countdown__all:hover {
  text-decoration: underline;
}
.countdown__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.countdown__card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel-2, var(--panel));
  border: 1px solid var(--border);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.countdown__card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}
.countdown__days {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
  padding: 6px 8px;
  border-radius: 10px;
  background: color-mix(in oklab, var(--accent) 18%, transparent);
  color: var(--accent);
}
.countdown__num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.countdown__unit {
  font-size: 11px;
  text-transform: lowercase;
  opacity: 0.85;
  margin-top: 2px;
}
.countdown__body {
  flex: 1 1 auto;
  min-width: 0;
}
.countdown__name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.countdown__meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.countdown__share {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.countdown__share:hover {
  color: var(--accent);
  border-color: var(--accent);
}
@media (max-width: 520px) {
  .countdown__list {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Saint of the Day
   ========================================================================== */
.saints {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.saints__featured {
  padding: 18px 20px;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    color-mix(in oklab, var(--accent) 18%, var(--panel)) 0%,
    var(--panel) 70%
  );
  border: 1px solid color-mix(in oklab, var(--accent) 40%, var(--border));
}
.saints__featured-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.saints__featured-meta {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.saints__featured-label {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
}
.saints__featured-date {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--fg);
}
.saints__featured-name {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}
.saints__featured-note {
  margin: 4px 0 0;
  color: var(--muted);
  max-width: 70ch;
}

.saints__nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.saints__select,
.saints__year {
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--fg);
  font-size: 14px;
}
.saints__year {
  width: 92px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.saints__month-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.saints__cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.saints__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 120ms ease,
    transform 120ms ease;
  min-height: 74px;
}
.saints__card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  z-index: 5;
}
.saints__card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  z-index: 5;
}
/* Shared rich tooltip — see src/js/day-tooltip.js. Used by month-view,
   calendar-ui, and saints-ui. */
.day-tip {
  position: fixed;
  z-index: 80;
  min-width: 240px;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #111418;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f4f4f5;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.36);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    visibility 140ms;
  pointer-events: none;
}
.day-tip.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.day-tip::after {
  content: '';
  position: absolute;
  left: var(--day-tip-arrow, 50%);
  width: 0;
  height: 0;
  border: 6px solid transparent;
}
.day-tip[data-placement='top']::after {
  top: 100%;
  border-top-color: #111418;
}
.day-tip[data-placement='bottom']::after {
  bottom: 100%;
  border-bottom-color: #111418;
}
.day-tip__head {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.day-tip__sub {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px;
  color: rgba(244, 244, 245, 0.7);
  margin-bottom: 8px;
}
.day-tip__rel {
  color: rgba(244, 244, 245, 0.55);
}
.day-tip__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 8px;
}
.day-tip__row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.day-tip__row-text {
  flex: 1;
  min-width: 0;
}
.day-tip__chip {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.16);
  color: #fca5a5;
}
.day-tip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.day-tip__dot--holiday {
  background: #ef4444;
}
.day-tip__dot--saint {
  background: #f59e0b;
}
.day-tip__dot--fast {
  background: #a78bfa;
}
.day-tip__dot--feast {
  background: #34d399;
}
@media (max-width: 520px) {
  .day-tip {
    display: none;
  }
}
@media print {
  .day-tip {
    display: none !important;
  }
}

/* ---------------- Meeting Planner ---------------- */
.mtg {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.mtg__head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mtg__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}
.mtg__sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  max-width: 70ch;
}
.mtg__grid {
  display: grid;
  grid-template-columns: 1fr auto 1.1fr;
  gap: 14px;
  align-items: stretch;
}
.mtg__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--muted);
  user-select: none;
}
.mtg__source,
.mtg__habesha {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}
.panel--slim {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
}
.panel--accent {
  border-radius: 12px;
  border: 1px solid color-mix(in oklab, var(--accent) 42%, var(--border));
  background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--accent) 12%, var(--panel)) 0%,
    var(--panel) 100%
  );
}
.mtg__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mtg__label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.mtg__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mtg__row--toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mtg__select,
.mtg__input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  font-family: inherit;
}
.mtg__select:focus,
.mtg__input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.mtg__select--compact {
  padding: 6px 8px;
  font-size: 12.5px;
}
.mtg__readout {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in oklab, var(--fg) 4%, transparent);
  border: 1px dashed var(--border);
}
.mtg__read {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.mtg__read-time {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.mtg__read-meta {
  font-size: 12px;
  color: var(--muted);
}
.mtg__read-utc {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted);
}
.mtg__habesha-head {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.mtg__chip {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--accent) 20%, var(--panel));
  color: var(--fg);
  border: 1px solid color-mix(in oklab, var(--accent) 35%, var(--border));
}
.mtg__chip--muted {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.mtg__big {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  padding: 4px 0;
}
.mtg__big-num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 40px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.mtg__big-period {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
}
.mtg__big-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--period, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--period, var(--accent)) 22%, transparent);
}
.mtg__kv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.mtg__kv > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mtg__kv dt {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.mtg__kv dd {
  margin: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 600;
}
.mtg__compare-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.mtg__compare-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: var(--fg);
}
.mtg__compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.mtg__cmp {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mtg__cmp-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.mtg__cmp-row select {
  flex: 1;
  min-width: 0;
}
.mtg__cmp-time {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 18px;
  font-weight: 600;
}
.mtg__cmp-meta,
.mtg__cmp-date {
  font-size: 11.5px;
  color: var(--muted);
}
@media (max-width: 720px) {
  .mtg__grid {
    grid-template-columns: 1fr;
  }
  .mtg__arrow {
    transform: rotate(90deg);
  }
  .mtg__big-num {
    font-size: 32px;
  }
}
@media (max-width: 520px) {
  .mtg__row {
    grid-template-columns: 1fr;
  }
  .mtg__kv {
    grid-template-columns: 1fr;
  }
}
.saints__card.is-major {
  border-color: color-mix(in oklab, var(--accent) 60%, var(--border));
}
.saints__card.is-today {
  background: color-mix(in oklab, var(--accent) 14%, var(--panel));
  border-color: var(--accent);
}
.saints__card.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.saints__card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--muted);
  font-size: 12px;
}
.saints__card-day {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
}
.saints__card-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--fg);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.saints__card-greg {
  font-size: 11px;
  color: var(--muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.saints__detail {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
}
.saints__detail-head {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.saints__detail-name {
  margin: 6px 0 4px;
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
}
.saints__detail-note {
  margin: 0;
  color: var(--fg);
  opacity: 0.85;
  max-width: 70ch;
}

@media (max-width: 520px) {
  .saints__featured-name {
    font-size: 18px;
  }
  .saints__cards {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* Saints popup (mobile bottom-sheet) */
.saints-popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.5);
  align-items: flex-end;
  justify-content: center;
}
.saints-popup-overlay.is-visible {
  display: flex;
}
.saints-popup {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--bg-card, #fff);
  border-radius: 16px 16px 0 0;
  padding: 24px 20px 32px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
  animation: saints-popup-slide-up 0.25s ease-out;
}
@keyframes saints-popup-slide-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.saints-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--fg-muted, #666);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.saints-popup__date {
  font-size: 13px;
  color: var(--fg-muted, #888);
  font-family: var(--mono, monospace);
}
.saints-popup__greg {
  font-size: 12px;
  color: var(--fg-dim, #aaa);
  margin-top: 2px;
  font-family: var(--mono, monospace);
}
.saints-popup__name {
  margin: 12px 0 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--fg, #222);
}
.saints-popup__note {
  margin: 0;
  font-size: 15px;
  color: var(--fg, #444);
  opacity: 0.85;
  line-height: 1.5;
}

/* ===================================================================== */
/* Rates tab — daily bank exchange rates                                  */
/* ===================================================================== */
.rates-guide {
  margin: 0 0 22px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}
.rates-guide__kicker {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--warn);
}
.rates-guide__item + .rates-guide__item {
  border-top: 1px solid var(--border);
  margin-top: 10px;
  padding-top: 10px;
}
.rates-guide__item > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
}
.rates-guide__item > summary::-webkit-details-marker {
  display: none;
}
.rates-guide__item > summary::before {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
  flex: 0 0 auto;
  margin-left: 2px;
}
.rates-guide__item[open] > summary::before {
  transform: rotate(45deg);
}
.rates-guide__item > p {
  margin: 4px 0 6px 22px;
  color: var(--fg-muted);
  line-height: 1.65;
  font-size: 14px;
  max-width: 70ch;
}
@media (max-width: 540px) {
  .rates-guide {
    padding: 14px;
  }
  .rates-guide__item > p {
    margin-left: 0;
    font-size: 13.5px;
  }
}

/* --- Currency converter card -------------------------------------------- */
.rates-converter {
  margin: 0 0 22px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}
.rates-converter[hidden] {
  display: none;
}
.rates-converter__head {
  margin: 0 0 12px;
}
.rates-converter__title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
}
.rates-converter__sub {
  margin: 0;
  color: var(--fg-muted);
  font-size: 13.5px;
}
.rates-converter__direction {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-soft);
  margin: 6px 0 4px;
}
.rates-converter__dirbtn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-muted);
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}
.rates-converter__dirbtn:hover {
  color: var(--fg);
}
.rates-converter__dirbtn.is-active {
  background: var(--warn);
  color: #1f1300;
}
.rates-converter__hint {
  margin: 6px 0 14px;
  font-size: 13px;
  color: var(--fg-muted);
}
.rates-converter__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 14px;
  align-items: end;
}
.rates-converter__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rates-converter__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rates-converter__select {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  min-height: 42px;
}
.rates-converter__select:focus-within {
  border-color: var(--warn);
  box-shadow: 0 0 0 3px rgba(232, 180, 78, 0.18);
}
.rates-converter__flag {
  font-size: 18px;
  line-height: 1;
}
.rates-converter__input {
  flex: 1 1 auto;
  min-width: 0;
  appearance: none;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 6px 0;
  font-size: 15px;
  color: var(--fg);
  font-weight: 500;
}
.rates-converter__amount {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  min-height: 42px;
  font-variant-numeric: tabular-nums;
}
.rates-converter__amount:focus {
  border-color: var(--warn);
  box-shadow: 0 0 0 3px rgba(232, 180, 78, 0.18);
}
.rates-converter__field--result .rates-converter__output {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--warn) 20%, var(--bg-elev));
  color: var(--warn);
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rates-converter__foot {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--fg-muted);
}
.rates-converter__nopath {
  color: var(--warn);
  font-weight: 600;
}
@media (max-width: 540px) {
  .rates-converter {
    padding: 14px;
  }
  .rates-converter__grid {
    grid-template-columns: 1fr;
  }
}

.rates-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--fg-muted);
  flex-wrap: wrap;
}
.rates-meta__fetched {
  font-weight: 600;
  color: var(--fg);
}
.rates-meta__source a {
  color: var(--accent, #2563eb);
  text-decoration: none;
}
.rates-meta__source a:hover {
  text-decoration: underline;
}
.rates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}
.rates-empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--fg-muted);
  font-size: 14px;
}
.rates-notice {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.5;
}

.rate-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.rate-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.rate-card__flag {
  font-size: 28px;
  line-height: 1;
}
.cur-flag-img {
  display: inline-block;
  width: 32px;
  height: 24px;
  border-radius: 3px;
  object-fit: cover;
  vertical-align: middle;
}
.rate-card__code {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--fg);
}
.rate-card__name {
  display: block;
  font-size: 13px;
  color: var(--fg-muted);
  font-weight: 400;
  margin-top: 2px;
}
.rate-card__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.rate-card__table thead th {
  padding: 10px 12px;
  font-weight: 700;
  color: var(--fg-muted);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}
.rate-card__table tbody tr + tr {
  border-top: 1px solid var(--border);
}
.rate-card__table tbody th,
.rate-card__table tbody td {
  padding: 10px 8px;
  vertical-align: middle;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-variant-numeric: tabular-nums;
}
.rate-card__table tbody th {
  font-weight: 600;
  color: var(--fg);
  text-align: left;
}
.rates-row__bank {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  font-family: inherit !important;
}
.rates-row__dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  flex: 0 0 auto;
  overflow: hidden;
}
.rates-row__dot--logo {
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 1px;
}
.rates-row__dot--logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.rates-row__name {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--fg);
}
.rates-row__buy,
.rates-row__sell,
.rates-row__diff {
  text-align: left;
  padding: 6px 8px !important;
  white-space: nowrap;
}
.rates-row__buy {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border-radius: 4px;
  font-weight: 600;
}
.rates-row__sell {
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
  border-radius: 4px;
  font-weight: 600;
}
.rates-row__diff {
  color: var(--fg-muted);
  font-size: 13px;
}
.rates-row__buy.is-best,
.rates-row__sell.is-best {
  outline: 2px solid currentColor;
  outline-offset: -2px;
  font-weight: 700;
}

@media (max-width: 560px) {
  .rates-grid {
    grid-template-columns: 1fr;
  }
  .rate-card__flag {
    font-size: 22px;
  }
  .rate-card__code {
    font-size: 15px;
  }
  .rate-card__name {
    font-size: 12px;
  }
  .rate-card__table thead th:nth-child(4),
  .rate-card__table tbody td:nth-child(4) {
    display: none;
  }
}

/* --- ZEMEN Rates v2 — toolbar, search, official reference, best-rate badge - */
.rates-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
.rates-search {
  position: relative;
  flex: 1 1 320px;
  min-width: 240px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 12px;
  height: 40px;
  background: var(--bg-alt, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.rates-search:focus-within {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.rates-search__icon {
  font-size: 14px;
  opacity: 0.6;
}
.rates-search__input {
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  width: 100%;
  color: var(--fg);
}

.rates-compare {
  margin: 0 0 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.rates-compare__head {
  padding: 16px 18px 8px;
}
.rates-compare__title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
}
.rates-compare__sub {
  margin: 0;
  color: var(--fg-muted);
  font-size: 13px;
  line-height: 1.5;
}
.rates-compare__controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.rates-compare__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rates-compare__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
}
.rates-compare__chip:hover {
  border-color: var(--accent, #0f4c81);
}
.rates-compare__chip.is-active {
  background: var(--accent, #0f4c81);
  border-color: var(--accent, #0f4c81);
  color: #fff;
}
.rates-compare__chip-flag {
  font-size: 14px;
}
.rates-compare__modes {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}
.rates-compare__mode {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
}
.rates-compare__mode + .rates-compare__mode {
  border-left: 1px solid var(--border);
}
.rates-compare__mode.is-active {
  background: var(--accent, #0f4c81);
  color: #fff;
}
.rates-compare__hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.rates-compare__hero-flag {
  font-size: 28px;
  line-height: 1;
}
.rates-compare__hero-label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rates-compare__hero-value {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
}
.rates-compare__list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  counter-reset: rates-rank;
}
.rates-compare__row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  font-size: 14px;
}
.rates-compare__row + .rates-compare__row {
  border-top: 1px solid var(--border);
}
.rates-compare__row.is-best {
  background: linear-gradient(180deg, rgba(202, 160, 40, 0.1) 0%, rgba(202, 160, 40, 0.02) 100%);
}
.rates-compare__rank {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--bg-soft);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--fg-muted);
}
.rates-compare__row.is-best .rates-compare__rank {
  background: #caa028;
  color: #fff;
}
.rates-compare__bank {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.rates-compare__bank-name {
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rates-compare__rate {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 14px;
  color: var(--fg);
}
.rates-compare__caption {
  margin: 0;
  padding: 8px 18px 14px;
  font-size: 11.5px;
  color: var(--fg-muted);
  text-align: right;
}

.rates-official {
  margin: 0 0 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}
.rates-official__head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-soft);
  color: var(--fg);
  border-bottom: 1px solid var(--border);
}
.rates-official__badge {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.rates-official__title {
  margin: 0 0 4px;
  font-size: 16px;
  letter-spacing: 0.02em;
  font-weight: 700;
}
.rates-official__sub {
  margin: 0;
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.45;
}
.rates-official__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.rates-official__table thead th {
  padding: 10px 14px;
  font-weight: 700;
  color: var(--fg-muted);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}
.rates-official__table tbody tr + tr {
  border-top: 1px solid var(--border);
}
.rates-official__table tbody th,
.rates-official__table tbody td {
  padding: 10px 14px;
  vertical-align: middle;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-variant-numeric: tabular-nums;
}
.rates-official__cur {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit !important;
  font-weight: 600;
}
.rates-official__flag {
  font-size: 17px;
}
.rates-official__code {
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--fg);
  font-weight: 800;
}
.rates-official__name {
  font-size: 12px;
  color: var(--fg-muted);
  font-weight: 500;
}
.rates-official__pending {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--fg-muted);
}

.rates-directory {
  margin: 0 0 16px;
}
.rates-directory__head {
  margin: 0 0 12px;
}
.rates-directory__title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.rates-directory__sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.45;
}

.rates-best-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #f5c94b 0%, #caa028 100%);
  color: #1a1a1a;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
  font-family: inherit;
}
.is-best-row {
  background: linear-gradient(90deg, rgba(245, 201, 75, 0.08) 0%, rgba(245, 201, 75, 0) 85%);
}

.rates-pending-chip {
  display: inline-block;
  padding: 2px 8px;
  margin-left: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--warn) 15%, var(--bg-elev));
  color: var(--warn);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: inherit;
}
.rates-row--pending {
  opacity: 0.8;
}
.rates-row--pending td {
  color: var(--fg-muted);
}
.rates-row__pending {
  padding: 8px 14px !important;
  color: var(--warn);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

@media (max-width: 560px) {
  .rates-official__table thead th:nth-child(4),
  .rates-official__table tbody td:nth-child(4) {
    display: none;
  }
  .rates-official__name {
    display: none;
  }
  .rates-grid {
    gap: 12px;
  }
  .rate-card {
    border-radius: 8px;
  }
  .rate-card__head {
    padding: 10px 12px;
  }
  .rate-card__code {
    font-size: 14px;
  }
  .rate-card__table {
    font-size: 12.5px;
  }
  .rate-card__table thead th {
    padding: 8px 8px;
    font-size: 11.5px;
  }
  .rate-card__table tbody th,
  .rate-card__table tbody td {
    padding: 7px 8px;
  }
  .rates-row__bank {
    gap: 6px;
  }
  .rates-row__name {
    font-size: 12px;
  }
  .rates-row__buy,
  .rates-row__sell {
    padding: 4px 7px !important;
  }
  .rates-row__diff {
    font-size: 11.5px;
  }
  .rates-toolbar {
    gap: 8px;
  }
  .rates-search {
    flex: 1 1 100%;
    min-width: 0;
  }
  .rates-meta {
    font-size: 12px;
  }
  .rates-best-badge {
    margin-left: 4px;
    padding: 1px 6px;
    font-size: 10px;
  }
  .rates-official__head {
    padding: 12px 14px;
    gap: 10px;
  }
  .rates-official__badge {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  .rates-official__title {
    font-size: 14px;
  }
  .rates-official__sub {
    font-size: 11.5px;
  }
  .rates-directory__title {
    font-size: 14px;
  }
  .rates-directory__sub {
    font-size: 11.5px;
  }
}

/* ------------ Rates: 30-day history sparkline ------------ */
.rates-history {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  background: var(--surface, #fff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.rates-history__head {
  margin-bottom: 16px;
}
.rates-history__title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
}
.rates-history__sub {
  margin: 0;
  color: var(--muted, #6b7280);
  font-size: 0.9rem;
  line-height: 1.45;
}
.rates-history__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.rates-history__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted, #6b7280);
}
.rates-history__field select {
  padding: 8px 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--bg, #fff);
  color: var(--fg, #111827);
  font-size: 0.95rem;
  min-width: 180px;
}
.rates-history__modes {
  display: inline-flex;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  padding: 2px;
  background: var(--bg-soft, #f3f4f6);
}
.rates-history__mode {
  padding: 6px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 0;
  background: transparent;
  color: var(--muted, #6b7280);
  border-radius: 999px;
  cursor: pointer;
}
.rates-history__mode.is-active {
  background: var(--accent, #2563eb);
  color: #fff;
}
.rates-history__summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.rates-history__caption {
  margin: 0 0 2px;
  font-size: 0.85rem;
  color: var(--muted, #6b7280);
}
.rates-history__latest {
  margin: 0;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}
.rates-history__latest-date {
  font-size: 0.85rem;
  color: var(--muted, #6b7280);
  font-weight: 400;
}
.rates-history__change {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-variant-numeric: tabular-nums;
}
.rates-history__change-label {
  font-size: 0.78rem;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rates-history__change-value {
  font-weight: 700;
  font-size: 1rem;
  color: var(--fg, #111827);
}
.rates-history__change.is-up .rates-history__change-value {
  color: #047857;
}
.rates-history__change.is-down .rates-history__change-value {
  color: #b91c1c;
}
.rates-history__chart {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 8px;
  font-family: inherit;
}
.rates-history__grid {
  stroke: var(--border, #e5e7eb);
  stroke-dasharray: 2 4;
  stroke-width: 1;
}
.rates-history__line {
  fill: none;
  stroke: var(--accent, #2563eb);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.rates-history__area {
  fill: var(--accent, #2563eb);
  fill-opacity: 0.1;
}
.rates-history__dot {
  fill: var(--accent, #2563eb);
}
.rates-history__yt,
.rates-history__xt {
  fill: var(--muted, #6b7280);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
  .rates-history {
    padding: 14px;
  }
  .rates-history__field select {
    min-width: 0;
    width: 100%;
  }
  .rates-history__field {
    flex: 1 1 140px;
  }
  .rates-history__modes {
    flex: 1 1 100%;
    justify-content: center;
  }
}

/* ==========================================================================
   UI Polish — entrance animations, subtle hover effects, selection color
   ========================================================================== */

::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--fg);
}

/* Gentle fade-slide for main content */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.container > * {
  animation: fade-up 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.container > :nth-child(1) {
  animation-delay: 0.04s;
}
.container > :nth-child(2) {
  animation-delay: 0.08s;
}
.container > :nth-child(3) {
  animation-delay: 0.12s;
}
.container > :nth-child(4) {
  animation-delay: 0.16s;
}
.container > :nth-child(5) {
  animation-delay: 0.2s;
}
.container > :nth-child(n + 6) {
  animation-delay: 0.24s;
}

/* Subtle hover lift on schedule rows */
.sched__row {
  transition: background 0.2s ease;
}
.sched__row:hover {
  background: color-mix(in srgb, var(--bg-soft) 60%, var(--bg-elev));
}

/* Footer polish */
.sitefoot {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

/* Smooth scrollbar on WebKit for nav and content */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--fg-dim);
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Friendly fallback shown when a page module fails to load (slow / offline). */
.page-load-error {
  margin: 16px auto;
  max-width: 560px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
}
.page-load-error__title {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--fg);
}
.page-load-error__body {
  margin: 0 0 16px;
  color: var(--fg-dim);
}
.page-load-error__retry {
  display: inline-block;
  padding: 10px 20px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
  cursor: pointer;
}
.page-load-error__retry:hover {
  background: var(--accent-hover, var(--accent));
}
.page-load-error__details {
  margin-top: 16px;
  text-align: left;
  font-size: 12px;
  color: var(--fg-dim);
}
.page-load-error__details summary {
  cursor: pointer;
  user-select: none;
}
.page-load-error__details code {
  display: block;
  margin-top: 6px;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  word-break: break-all;
}

/* =====================================================================
   Premium design overhaul — hero, refined panels, motion.
   Layered on top of existing component rules so it overrides without
   editing every original block.
   ===================================================================== */

/* ---------- Hero (home) ---------- */
.hero {
  position: relative;
  margin: 4px 0 0;
  padding: 40px 24px 36px;
  border-radius: var(--radius-xl);
  background: var(--surface-immersive, var(--bg-elev));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  isolation: isolate;
  text-align: center;
}
.hero::before {
  content: '';
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, var(--accent-glow), transparent 65%);
  opacity: 0.55;
  z-index: -1;
}
/* Subtle Ge'ez-derived hairline accent at the top of the hero — a single
   1px gradient sliver in Ethiopian green, the way Stripe/Linear hint at
   identity without resorting to decoration. */
.hero::after {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--accent) 40%,
    var(--accent) 60%,
    transparent 100%
  );
  opacity: 0.4;
}
.hero__eyebrow {
  font-size: var(--type-eyebrow);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin: 0 0 14px;
  opacity: 0;
  animation: hero-rise 600ms var(--ease) 80ms forwards;
}
.hero__eyebrow .hero__eth {
  font-family: 'Noto Sans Ethiopic', 'Inter', system-ui, sans-serif;
  letter-spacing: 0.02em;
  margin-right: 8px;
}
.hero__title {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin: 0 0 10px;
  max-width: 22ch;
  margin-inline: auto;
  opacity: 0;
  animation: hero-rise 600ms var(--ease) 160ms forwards;
}
.hero__title .hero__accent {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 92%, white) 0%,
    var(--accent) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__sub {
  font-size: clamp(14px, 1.4vw, 16px);
  line-height: 1.5;
  color: var(--fg-muted);
  margin: 0 auto 0;
  max-width: 56ch;
  opacity: 0;
  animation: hero-rise 600ms var(--ease) 240ms forwards;
}
.hero__live {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  animation: hero-rise 600ms var(--ease) 320ms forwards;
  font-variant-numeric: tabular-nums;
  font-feature-settings:
    'tnum' 1,
    'lnum' 1;
}
.hero__live__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: hero-pulse 2.4s ease-in-out infinite;
}
.hero__live__sep {
  width: 1px;
  height: 14px;
  background: var(--border);
  margin: 0 4px;
}
.hero__live__time {
  color: var(--fg);
  font-weight: 600;
  min-width: 7.2em;
  text-align: left;
}
.hero__live__date {
  color: var(--fg-muted);
}

@keyframes hero-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes hero-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 var(--accent-glow);
  }
  50% {
    box-shadow: 0 0 0 8px transparent;
  }
}
@media (max-width: 520px) {
  .hero {
    padding: 28px 16px 24px;
  }
  .hero__live__date {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hero__eyebrow,
  .hero__title,
  .hero__sub,
  .hero__live {
    opacity: 1;
    animation: none;
  }
  .hero__live__dot {
    animation: none;
  }
}

/* ---------- Panels: lift on hover ---------- */
.panel {
  position: relative;
}
.panel:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.panel__title {
  font-size: var(--type-h2);
  font-weight: 700;
  letter-spacing: -0.015em;
}
.panel__sub {
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 64ch;
}

/* ---------- Primary CTA — soft gradient + green halo ---------- */
.btn--primary {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 92%, white) 0%,
    var(--accent) 100%
  );
  border: 1px solid color-mix(in srgb, var(--accent) 92%, black);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 1px 2px rgba(0, 0, 0, 0.18),
    0 8px 24px rgba(13, 138, 69, 0.18);
  font-weight: 600;
  transition:
    transform var(--dur-base) var(--ease),
    box-shadow var(--dur-base) var(--ease),
    filter var(--dur-base) var(--ease);
}
.btn--primary:hover {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent-hover) 92%, white) 0%,
    var(--accent-hover) 100%
  );
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 2px 4px rgba(0, 0, 0, 0.22),
    0 12px 32px rgba(61, 186, 110, 0.28);
}
.btn--primary:active {
  transform: translateY(0);
}

/* ---------- Fasting banner: glass surface, identity green left edge ---------- */
.fast-banner {
  background: var(--surface-card, var(--bg-elev));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin: 0 0 8px;
}
.fast-banner:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.fast-banner__inner {
  padding: 14px 18px;
}
.fast-banner__value {
  letter-spacing: -0.01em;
}
.fast-banner__label {
  letter-spacing: 0.1em;
  font-size: 10.5px;
  color: var(--fg-dim);
}

/* ---------- Topbar refinement ---------- */
.topbar {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
}
.topnav a {
  font-size: 13px;
  transition:
    color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
}

/* ---------- Container rhythm ---------- */
.container {
  gap: 12px;
}

/* ---------- Countdown widget (home) — match new card system ---------- */
.countdown {
  background: var(--surface-card, var(--bg-elev));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
