/*
 * AgeCalc: the tool's own components, styled in the site's design language (3 Nov 2026, on the UltraCompress Pro
 * template, after WORKDAYS). Base: /libs/site-pages.css (tokens, Inter and Space Grotesk, buttons, theme toggle,
 * focus rings) and /libs/shared-nav.css (the site's header and footer). This file holds only what the tool needs:
 * the toolbar with the status pill and the four pill tabs, the cards, the date boxes and fields, the age figure and
 * totals, the year rings, the milestone and weekday lists, the date tools (rail, workspace, results, tables), the
 * birthday list, the windows, the toasts, the print layout and the information sections. Light is the default;
 * dark applies when <html> has no data-theme.
 */

/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --radius-lg: 16px;
    --line: rgba(0, 0, 0, 0.1);
    --line-strong: rgba(0, 0, 0, 0.24);
    --amber: #d97706;
    --amber-text: #92400e;
    --amber-soft: rgba(217, 119, 6, 0.12);
    --lived: #8b5cf6;
    --track: rgba(139, 92, 246, 0.16);
    --ok: #166534;
    --bad: #b91c1c;
    --warn: #92400e;
    --wood: #f5f1ff;
    --ring-year: #b9a3f7;
    --ring-decade: #6d28d9;
    --bark: #7c3aed;
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.26);
    --amber: #fbbf24;
    --amber-text: #fbbf24;
    --amber-soft: rgba(251, 191, 36, 0.14);
    --lived: #a78bfa;
    --track: rgba(167, 139, 250, 0.18);
    --ok: #4ade80;
    --bad: #f87171;
    --warn: #fbbf24;
    --wood: #1b1730;
    --ring-year: #5f4fa3;
    --ring-decade: #c4b5fd;
    --bark: #8b5cf6;
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container { max-width: calc(var(--app-max) + 2 * var(--content-gutter)); margin-top: 16px; }
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- The site header is the first thing on the page and stays at the top ----- */
body { padding-top: 0; }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: 90px; }
@media (max-width: 639.98px) { .theme-toggle { top: 75px; } } /* the header is 81 px tall from 640 px, 65 px below */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ----- Hero ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Small helpers ----- */
main [hidden], .dialog [hidden] { display: none !important; } /* the script hides fields that carry their own display */
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.small { font-size: 0.9rem; }
.block { display: block; }
.hint { color: var(--text-3); font-size: 0.8rem; font-weight: 400; line-height: 1.45; }
.err { color: var(--bad); font-size: 0.85rem; font-weight: 600; }
.err:empty { display: none; }
.note { font-size: 0.875rem; color: var(--text-2); line-height: 1.55; max-width: 80ch; }
.note.warn { color: var(--warn); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link:hover { color: var(--link-hover); }
code { font-size: 0.85em; padding: 1px 6px; border-radius: 6px; background: var(--code-bg); color: var(--code-text); }
kbd { font-family: inherit; font-size: 0.72rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 9999px; font-family: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; padding: 12px 24px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn .ico { width: 17px; height: 17px; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid rgba(185, 28, 28, 0.35); padding: 11px 23px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; transform: translateY(-2px); }
.btn-sm { font-size: 0.85rem; padding: 9px 16px; }
.btn-secondary.btn-sm, .btn-danger.btn-sm { padding: 8px 15px; }
.btn-stack { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; padding: 0; font-family: inherit; transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.icon-btn:hover { border-color: var(--brand); color: var(--link); background: var(--surface); }
.icon-btn.del:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn:focus-visible, .link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Toolbar ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin: 0 0 1.25rem; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 10px; border-radius: 9999px; border: 1px solid var(--tint-brand-border); background: var(--tint-brand); min-width: 220px; max-width: 100%; }
.status-icon { font-size: 1.3rem; line-height: 1; }
.status-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.status-main { font-weight: 700; font-size: 0.85rem; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-sub { font-size: 0.72rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 9999px; background: var(--surface-2); max-width: 100%; }
.view-tab { padding: 8px 16px; border: 0; border-radius: 9999px; background: transparent; font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.view-tab:hover { color: var(--link); }
.view-tab.active { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.view-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.view[hidden] { display: none; }
.shell-hint { margin-top: 14px; }

/* ----- Cards ----- */
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.card-grid:empty { display: none; }
.card--wide { grid-column: span 2; }
.card--full { grid-column: 1 / -1; }
.card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); overflow: hidden; display: flex; flex-direction: column; min-width: 0; margin-bottom: 0; }
.view > .card { margin-bottom: 20px; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { margin: 0; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-note { font-size: 0.8125rem; color: var(--text-3); }
.card-body { padding: 16px 20px 20px; flex: 1; min-width: 0; }
.card-body > * + * { margin-top: 16px; }
.form-hint { font-size: 0.8rem; color: var(--text-3); margin: 10px 0 0; line-height: 1.5; }

/* ----- Fields ----- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.label { font-weight: 600; font-size: 0.85rem; color: var(--text-strong); }
.input, .select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.input::placeholder { color: var(--placeholder); }
.input[aria-invalid="true"] { border-color: var(--bad); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.5; }
input[type="time"].input { color-scheme: light; width: 9em; }
:root:not([data-theme="light"]) input[type="time"].input { color-scheme: dark; }
.select { width: auto; max-width: 100%; appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; cursor: pointer; }
.select option { color: #0a0a14; background: #fff; }
.num-input { width: 7.5em; }
.num-input.wide { width: 10em; }
.check-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 0.925rem; color: var(--text); padding: 4px 0; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex-shrink: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.seg button:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.seg button[aria-checked="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--chip); font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.chip .ico { width: 15px; height: 15px; color: var(--link); }
.chip:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Date boxes: day, month and year ----- */
.datef-wrap { position: relative; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.datef-box { display: inline-flex; align-items: center; max-width: 100%; min-height: 46px; padding: 0 4px 0 8px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.datef-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.datef-box.invalid { border-color: var(--bad); }
.datef-part { border: 0; background: transparent; outline: none; padding: 8px 2px; text-align: center; font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.1rem; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; min-width: 0; border-radius: 6px; }
.datef-part:focus { background: var(--tint-brand); }
.datef-part.p2 { width: 3.4ch; }
.datef-part.p4 { width: 5.2ch; }
.datef-part::placeholder { color: var(--placeholder); font-weight: 500; }
.datef-sep { color: var(--text-3); padding: 0 1px; user-select: none; }
.datef-cal { margin-left: 6px; width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.datef-cal:hover { background: var(--tint-brand); color: var(--link); }
.datef-cal:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.datef-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; color-scheme: light; }
:root:not([data-theme="light"]) .datef-native { color-scheme: dark; }
.datef-note { font-size: 0.85rem; color: var(--text-2); min-height: 1.3em; }
.datef-note.err { color: var(--bad); font-weight: 600; }

/* ----- Age: inputs, figure and totals ----- */
.inputs { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: flex-start; }
.on-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.age-read { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 18px 20px 20px; border-radius: 14px; background: var(--tint-brand); border: 1px solid var(--tint-brand-border); }
.age-figure { display: flex; flex-direction: column; gap: 2px; }
.age-years { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0; }
.age-years .n { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: clamp(3.6rem, 9vw, 6rem); font-weight: 700; line-height: 0.95; letter-spacing: -0.03em; background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.age-years .u { font-size: clamp(1.2rem, 2.2vw, 1.5rem); font-weight: 600; color: var(--text-2); }
.age-md { display: flex; align-items: baseline; gap: 6px 10px; flex-wrap: wrap; margin: 6px 0 0; }
.age-md .n { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: clamp(1.8rem, 3.6vw, 2.4rem); font-weight: 700; line-height: 1; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.age-md .u { font-size: 1rem; color: var(--text-2); font-weight: 600; margin-right: 10px; }
.age-line { font-size: 1rem; color: var(--text); max-width: 60ch; margin: 0; }
.age-line strong { color: var(--text-strong); }
.age-celebrate { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; margin: 0; padding: 8px 16px 8px 12px; border-radius: 9999px; background: var(--amber-soft); color: var(--amber-text); font-weight: 700; }
.age-celebrate .ico { width: 20px; height: 20px; }
.age-empty { display: flex; flex-direction: column; gap: 8px; max-width: 52ch; }
.age-empty p { color: var(--text-2); margin: 0; }
.age-empty .big-q { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 700; line-height: 1.1; color: var(--text-strong); }
.age-totals:empty { display: none; }
.totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.totals > div { background: var(--surface); border: 1px solid var(--surface-border); border-top: 3px solid var(--brand); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.totals dt { font-size: 0.75rem; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.totals dd { margin: 2px 0 0; font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.3rem; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.25; }
.totals dd small { font-family: 'Inter', sans-serif; font-size: 0.78rem; color: var(--text-3); font-weight: 500; }
.totals-note { font-size: 0.8rem; color: var(--text-3); margin: 10px 0 0; }

/* ----- The year rings ----- */
.dial-body { display: flex; align-items: center; justify-content: center; }
.dial-wrap { margin: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; width: 100%; min-width: 0; }
.dial { width: min(100%, 400px); aspect-ratio: 1; position: relative; border-radius: 50%; touch-action: manipulation; cursor: crosshair; }
.dial:focus-visible { outline: 2px solid var(--brand); outline-offset: 6px; }
.dial svg { display: block; width: 100%; height: 100%; overflow: visible; }
.dial .wood { fill: var(--wood); }
.dial .rg { fill: none; stroke: var(--ring-year); stroke-linejoin: round; }
.dial .rg.decade { stroke: var(--ring-decade); }
.dial .bark { fill: none; stroke: var(--bark); stroke-linejoin: round; }
.dial .pith { fill: var(--ring-decade); }
.dial .grow { fill: none; stroke: var(--amber); stroke-linecap: round; }
.dial .sel { fill: none; stroke: var(--amber); stroke-opacity: 0.55; pointer-events: none; }
.dial .sel.cur { stroke-opacity: 0.3; }
.dial .dlab { fill: var(--ring-decade); font: 700 10px 'Inter', sans-serif; paint-order: stroke; stroke: var(--wood); stroke-width: 3px; stroke-linejoin: round; }
.dial.ghost { opacity: 0.4; cursor: default; }
.dial.ghost .grow { display: none; }
.dial-cap { font-size: 0.875rem; color: var(--text-2); text-align: center; max-width: 44ch; min-height: 2.7em; }
.dial-cap strong { color: var(--text-strong); }
.dial.anim .rg, .dial.anim .bark { animation: ringIn 0.55s cubic-bezier(.2, .7, .2, 1) both; animation-delay: var(--d, 0s); }
.dial.anim .grow { animation: arcIn 0.9s cubic-bezier(.3, .6, .2, 1) both; animation-delay: 0.6s; }
@keyframes ringIn { from { opacity: 0; transform: scale(0.94); } }
@keyframes arcIn { from { stroke-dashoffset: 1; } }
.dial .rg, .dial .bark { transform-origin: 200px 200px; transform-box: view-box; }

/* ----- Age: the cards below ----- */
.countdown { display: flex; gap: 4px 14px; align-items: baseline; flex-wrap: wrap; font-variant-numeric: tabular-nums; margin: 0; }
.countdown .n { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: clamp(1.9rem, 3.6vw, 2.4rem); font-weight: 700; line-height: 1.05; background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.countdown .u { font-size: 0.95rem; color: var(--text-2); font-weight: 600; margin-left: 3px; }
.card-body p { margin-bottom: 0; }
.facts { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.facts > div { display: grid; grid-template-columns: minmax(8em, 40%) minmax(0, 1fr); gap: 4px 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--text-2); font-size: 0.875rem; }
.facts dd { margin: 0; font-weight: 600; font-size: 0.925rem; color: var(--text-strong); overflow-wrap: anywhere; }
.facts dd .hint { display: block; font-weight: 400; }
.facts dd button.link { font-weight: 600; }
.ms-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.ms { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ms .mark { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-strong); justify-self: center; }
.ms.done .mark { background: var(--lived); border-color: var(--lived); }
.ms.next .mark { background: var(--amber); border-color: var(--amber); }
.ms-name { font-weight: 700; font-size: 0.925rem; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.ms-when { font-size: 0.82rem; color: var(--text-2); }
.ms.done .ms-name { font-weight: 500; color: var(--text-2); }
.wbars { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; max-width: 900px; }
.wbar { display: grid; grid-template-columns: 3.2em minmax(0, 1fr); align-items: center; gap: 10px; min-height: 28px; border-radius: 6px; }
.wbar:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.wbar-day { font-size: 0.85rem; color: var(--text-2); font-weight: 600; }
.wbar-track { display: flex; align-items: center; gap: 8px; min-width: 0; height: 28px; }
.wbar-fill { height: 18px; border-radius: 0 6px 6px 0; background: var(--gradient-brand); min-width: 2px; flex: none; transition: width 0.4s ease; }
.wbar.is-next .wbar-fill { background: var(--amber); }
.wbar-val { font-size: 0.85rem; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 0.82rem; color: var(--text-2); align-items: center; margin: 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.sw.lived { background: var(--lived); }
.sw.now { background: var(--amber); }
.sw.track { background: var(--track); }
.sw.beyond { background: transparent; border: 1px solid var(--line-strong); }
details.more { border-top: 1px solid var(--line); padding-top: 10px; }
details.more summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--link); padding: 4px 0; }
details.more summary:hover { color: var(--link-hover); }
details.more[open] summary { margin-bottom: 8px; }

/* ----- Date tools: the list and the open tool ----- */
.tools-layout { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; margin-bottom: 20px; }
.workspace-card { grid-column: span 2; }
.rail-card { position: sticky; top: 97px; max-height: calc(100vh - 113px); }
.rail-card .card-body { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.tool-back { display: none !important; }
.rail-group + .rail-group { margin-top: 14px; }
.rail-group h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 700; margin: 0 0 6px; }
.rail-items { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.rail-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 5px 10px 5px 5px; border: 1px solid transparent; border-radius: 12px; background: transparent; text-align: left; font-family: inherit; font-size: 0.925rem; font-weight: 600; color: var(--text-strong); cursor: pointer; transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease; }
.rail-item:hover { border-color: var(--brand); color: var(--link); }
.rail-item[aria-current="true"] { background: var(--tint-brand); border-color: var(--tint-brand-border); color: var(--link); }
.rail-item:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.rail-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--tint-brand); color: var(--link); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.rail-sub { display: block; font-size: 0.76rem; color: var(--text-3); font-weight: 400; }
@media (min-width: 1024px) { .rail-sub { display: none; } }
.workspace { min-width: 0; display: flex; flex-direction: column; gap: 20px; outline: none; }
.tool-head { display: flex; flex-direction: column; gap: 6px; }
.tool-title { margin: 0; font-size: 1.35rem; display: flex; align-items: center; gap: 10px; }
.tool-title-ico { width: 38px; height: 38px; border-radius: 11px; background: var(--gradient-brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.tool-title-ico .ico { width: 20px; height: 20px; }
.lead { color: var(--text-2); max-width: 72ch; margin: 0; }
.tool-form { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-start; }
.tool-opts { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-start; }
.result { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 20px; border-radius: 14px; background: var(--tint-brand); border: 1px solid var(--tint-brand-border); min-width: 0; }
.result p { margin: 0; }
.result .big { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: clamp(1.6rem, 3.2vw, 2.3rem); font-weight: 700; line-height: 1.15; color: var(--text-strong); overflow-wrap: anywhere; }
.result .sub { color: var(--text-2); max-width: 72ch; }
.result .sub strong { color: var(--text-strong); }
.result-empty { color: var(--text-2); font-size: 0.95rem; }
.verdict { display: inline-flex; align-items: center; gap: 10px; font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; }
.verdict .ico { width: 30px; height: 30px; stroke-width: 2.6; }
.verdict.ok { color: var(--ok); }
.verdict.no { color: var(--bad); }
.kv { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
.kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.kv dt { color: var(--text-2); font-size: 0.875rem; }
.kv dd { margin: 0; font-weight: 700; color: var(--text-strong); text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kv dd .hint { display: block; font-weight: 400; }
.steps { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--text); font-variant-numeric: tabular-nums; }
.tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 9999px; font-size: 0.72rem; font-weight: 700; border: 1px solid var(--line-strong); white-space: nowrap; color: var(--text-2); vertical-align: 1px; }
.tag.exact { color: var(--ok); border-color: currentColor; }
.tag.est { color: var(--warn); border-color: currentColor; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; color: var(--text); }
.table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); font-weight: 600; }
.table tr.hit td { background: var(--amber-soft); font-weight: 700; color: var(--text-strong); }
.table tr.hit td:first-child { box-shadow: inset 3px 0 0 var(--amber); padding-left: 8px; }
.table tr.past td { color: var(--text-3); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 36px; }
.person-box { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.person-box .input.name { max-width: 20em; }
.tool-section { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tool-section h3 { margin: 0; font-size: 1.05rem; }
.mcal { display: inline-grid; grid-template-columns: repeat(7, minmax(36px, 44px)); gap: 3px; font-variant-numeric: tabular-nums; }
.mcal .mh { font-size: 0.72rem; color: var(--text-3); font-weight: 700; text-align: center; padding: 4px 0; text-transform: uppercase; }
.mcal .md { text-align: center; padding: 8px 0; border-radius: 9px; font-size: 0.9rem; font-weight: 600; color: var(--text); background: var(--surface); }
.mcal .md.we { color: var(--text-3); }
.mcal .md.today { box-shadow: inset 0 0 0 1px var(--line-strong); }
.mcal .md.hit { background: var(--gradient-brand); color: #fff; }
.mcal-title { font-weight: 700; margin: 0 0 6px; color: var(--text-strong); }
.planets { display: flex; flex-direction: column; }
.prow2 { display: grid; grid-template-columns: 28px minmax(7em, 0.8fr) minmax(8em, 0.8fr) minmax(0, 1.6fr); gap: 4px 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pdot { width: 18px; height: 18px; border-radius: 50%; justify-self: center; box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.18); }
.pname { font-weight: 700; color: var(--text-strong); }
.pname .hint { display: block; font-weight: 400; }
.pval { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.3rem; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.pval small { font-family: 'Inter', sans-serif; font-size: 0.8rem; color: var(--text-3); font-weight: 500; }
.pnext { font-size: 0.875rem; color: var(--text-2); }
.prow2.earth { box-shadow: inset 3px 0 0 var(--amber); }
.zod { display: flex; gap: 18px; align-items: flex-start; }
.zod-glyph { font-size: 4rem; line-height: 1; color: var(--link); min-width: 1.1em; text-align: center; }
.zod-name { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--text-strong); }
.zod-cycle { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; max-width: 560px; }
.zc { display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: 9px; font-size: 0.7rem; color: var(--text-3); background: var(--surface); }
.zc b { font-size: 1.2rem; font-weight: 500; color: var(--text-strong); }
.zc.hit { background: var(--gradient-brand); color: #fff; }
.zc.hit b { color: #fff; }
.weeks { width: 100%; max-width: 760px; }
.weeks svg { display: block; width: 100%; height: auto; }
.weeks .w-lived { fill: var(--lived); }
.weeks .w-now { fill: var(--amber); }
.weeks .w-left { fill: var(--track); }
.weeks .w-beyond { fill: none; stroke: var(--line-strong); stroke-width: 0.6; }
.weeks .w-lab { fill: var(--text-3); font: 600 13px 'Inter', sans-serif; }
.weeks .w-hl { fill: none; stroke: var(--text-strong); stroke-width: 1.4; pointer-events: none; }
.meter { height: 12px; border-radius: 9999px; background: var(--track); overflow: hidden; max-width: 560px; }
.meter > div { height: 100%; background: var(--gradient-brand); border-radius: 9999px; }
.zones { display: flex; flex-direction: column; }
.zrow { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.zrow.base { box-shadow: inset 3px 0 0 var(--amber); padding-left: 8px; }
.zrow .dn { color: var(--text-3); justify-self: center; display: inline-flex; }
.zname { font-weight: 700; color: var(--text-strong); overflow-wrap: anywhere; }
.zname .hint { display: block; font-weight: 400; }
.ztime { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.3rem; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; text-align: right; }
.ztime .hint { display: block; font-family: 'Inter', sans-serif; font-size: 0.78rem; font-weight: 500; }
.range { width: min(100%, 520px); accent-color: var(--brand); }

/* ----- Birthdays ----- */
.bd-lead { margin-top: 0; font-size: 0.9rem; color: var(--text-2); }
.people-filter { position: relative; max-width: 360px; }
.people-filter .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.people-filter .input { padding-left: 40px; }
.empty { color: var(--text-2); border: 1px dashed var(--line-strong); border-radius: 14px; padding: 24px 16px; text-align: center; font-size: 0.95rem; }
.empty p { margin: 0 auto; max-width: 60ch; }
.pgroup + .pgroup { margin-top: 18px; }
.pgroup h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 700; margin: 0 0 4px; }
.prow { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pdate { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 14px; background: var(--tint-brand); color: var(--link); line-height: 1.05; }
.pdate b { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pdate span { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.prow.today .pdate { background: var(--gradient-brand); color: #fff; }
.pmain { min-width: 0; }
.pn { font-weight: 700; color: var(--text-strong); overflow-wrap: anywhere; }
.ps { font-size: 0.875rem; color: var(--text-2); }
.pacts { display: flex; gap: 2px; }

/* ----- Settings ----- */
.set-group { display: flex; flex-direction: column; gap: 16px; }
.set-group > * + * { margin-top: 0; }
.plain-list { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); font-size: 0.9rem; }
.plain-list li { margin: 0; }

/* ----- Tooltip ----- */
.tip { position: fixed; z-index: 2000; pointer-events: none; max-width: 280px; background: #0a0a14; color: #fff; padding: 7px 10px; border-radius: 10px; font-size: 0.82rem; line-height: 1.35; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }

/* ----- Windows ----- */
.dialog { margin: auto; border: 1px solid var(--surface-border); border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 16px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); }
.dialog--narrow { width: min(420px, calc(100vw - 16px)); }
.dialog--wide { width: min(680px, calc(100vw - 16px)); }
.dialog::backdrop { background: rgba(10, 10, 20, 0.6); backdrop-filter: blur(6px); }
.dialog[open] { animation: pop 0.2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.dialog-head { padding: 18px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-title { margin: 0; font-size: 1.15rem; }
.dialog-close { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: border-color 0.2s ease, color 0.2s ease; }
.dialog-close:hover { border-color: var(--brand); color: var(--link); }
.dialog-body { padding: 20px; overflow-y: auto; max-height: calc(100vh - 210px); display: flex; flex-direction: column; gap: 14px; }
.dialog-actions { padding: 14px 20px; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.confirm-message { margin: 0; color: var(--text); }
.help-body h3 { margin: 6px 0 0; font-size: 1rem; }
.help-body p { margin: 0; color: var(--text-2); }

/* ----- Toasts ----- */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; background: #0a0a14; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid var(--brand); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); min-width: 260px; max-width: 420px; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; animation: slideIn 0.3s ease; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast button { background: none; border: 0; padding: 0; color: #c4b5fd; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.toast.leaving { opacity: 0; transform: translateX(40px); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ----- Information sections ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.step-card { position: relative; padding-top: 24px; }
.step-num { position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand); color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ----- Tablets ----- */
@media (max-width: 1023px) {
    .card-grid, .tools-layout { grid-template-columns: 1fr; }
    .card--wide, .workspace-card { grid-column: auto; }
    .rail-card { position: static; max-height: none; }
    .tool-back { display: inline-flex !important; align-self: flex-start; }
    body.tool-open .rail-card { display: none; }
    body:not(.tool-open) .workspace-card { display: none; }
    .rail-items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; }
    .info-section .info-grid { grid-template-columns: repeat(2, 1fr); }
    .info-three { grid-template-columns: 1fr; }
    .two-col { grid-template-columns: 1fr; }
    .prow2 { grid-template-columns: 28px minmax(6em, 1fr) minmax(0, 1.2fr); }
    .pnext { grid-column: 2 / -1; }
}

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .app-toolbar { gap: 10px; }
    .toolbar-left, .toolbar-right { width: 100%; }
    .status-pill { flex: 1; min-width: 0; }
    .view-tabs { width: 100%; }
    .view-tab { flex: 1 1 0; padding: 8px 4px; font-size: 0.78rem; text-align: center; }
    .card-grid, .tools-layout { gap: 14px; margin-bottom: 14px; }
    .view > .card { margin-bottom: 14px; }
    .card-header { padding-left: 16px; padding-right: 16px; }
    .card-body { padding: 14px 16px 16px; }
    .age-read, .result { padding: 14px 16px 16px; }
    .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kv { grid-template-columns: 1fr; }
    .rail-items { grid-template-columns: 1fr; }
    .zod-cycle { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .facts > div { grid-template-columns: 1fr; }
    .prow { grid-template-columns: 54px minmax(0, 1fr); align-items: start; }
    .pacts { grid-column: 2; margin-left: -10px; }
    .toasts { bottom: 16px; right: 16px; left: 16px; align-items: stretch; }
    .toast { min-width: 0; max-width: none; }
    .dialog-body, .dialog-head, .dialog-actions { padding-left: 16px; padding-right: 16px; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
}

/* ----- Print: the open tab only ----- */
@media print {
    body > header, .theme-toggle, .app-hero, .app-toolbar, .shell-hint, .info-section, .site-footer, .toasts, .dialog, .btn, .chips, .datef-cal, .tool-back, .rail-card, #zdu-cookie-banner { display: none !important; }
    .container.app-container { max-width: none; padding: 0; margin: 0; }
    .card { box-shadow: none; break-inside: avoid; }
    .card-grid, .tools-layout { grid-template-columns: 1fr; }
    .card--wide, .workspace-card { grid-column: auto; }
    .age-years .n, .countdown .n { color: #000; background: none; -webkit-text-fill-color: #000; }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .info-card, .dialog, .toast, .chip, .seg button, .rail-item, .wbar-fill, .view-tab { transition: none; animation: none; }
    .dial.anim .rg, .dial.anim .bark, .dial.anim .grow { animation: none; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026) */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]) { min-height: 44px; }
    main .icon-btn, main .datef-cal { min-width: 44px; }
    main .check-row { min-height: 44px; align-items: center; }
    main .datef-part { min-height: 44px; }
    main .datef-part.p2 { width: 44px; }
    main .datef-part.p4 { width: 64px; }
    main button.link { min-width: 44px; }
    main input[type="range"] { min-height: 44px; }
    main p, main li, main dd, main td, main figcaption,
    main .note, main .result-empty, main .result .sub, main .dial-cap, main .totals-note, main .form-hint, main .lead,
    main .legend, main .plain-list, main .ps, main .ms-when, main .pnext, main .facts dd, main .kv dt, main .bd-lead,
    main .table, main .steps, main .age-line, main .datef-note, main .small { font-size: 1rem; }
    main .table td:first-child { white-space: normal; }
}
