/* "Slate": a mid-tone scheme, blue-grey canvas with cards one step lighter
   and an amber accent. Every colour in the app comes from these variables. */
:root {
  color-scheme: dark;
  --bg: #414c5c;
  --surface: #4d5969;
  --surface-raised: #5a6779;
  --text: #eef2f7;
  --muted: #b7c1cd;
  --line: #606e80;
  --line-strong: #78879b;
  --accent: #fbbf24;
  --accent-text: #1f2937;
  --danger: #fca5a5;
  --ok: #86efac;
  --warn: #fcd34d;
  --today: #566478;
  --ok-bg: #2b4a3a;
  --warn-bg: #5a4a1e;
  --notice-bg: #2b4a3a;
  --notice-border: #3f7a5c;
  --notice-text: #bbf7d0;
  --alert-bg: #4f2f33;
  --alert-border: #8a4a52;
  --alert-text: #fecaca;
  --switch-off: #78879b;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0 0 0.4rem; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.6rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; }

.container { max-width: 980px; margin: 0 auto; padding: 0 1.25rem; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.9em; margin-top: 0.3rem; }
.error-text { color: var(--danger); font-size: 0.85em; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); letter-spacing: 0.01em; }
.topbar__nav { display: flex; align-items: center; gap: 1rem; }
.topbar__nav a { text-decoration: none; }
.topbar__nav form { margin: 0; }

main { padding: 2rem 0 4rem; }

.hero { text-align: center; padding: 3.5rem 0 2rem; }
.hero h1 { font-size: 2.6rem; letter-spacing: -0.02em; max-width: 720px; margin: 0.4rem auto 0.6rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; margin: 0.5rem auto 1.5rem; }
.hero form { display: inline-block; }
.hero__actions { display: flex; justify-content: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.hero__actions form { margin: 0; }
.eyebrow { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 600; margin: 0; }
.btn--large { padding: 0.7rem 1.3rem; font-size: 1.05em; }

/* Landing page */
.landing-section { margin-top: 4rem; }
.landing-section h2 { font-size: 1.5rem; margin-bottom: 1rem; }
.landing-section--split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.landing-section .card h3 { margin-bottom: 0.3rem; }
.landing-section .card p { margin: 0; color: var(--muted); }

.demo { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(280px, 2fr); gap: 1.5rem; align-items: stretch; margin: 2rem auto 0; max-width: 860px; }
.demo__sources, .demo__feed { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.demo__caption { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin-bottom: 0.75rem; }
.demo__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.demo__list li { display: flex; align-items: center; gap: 0.55rem; }
.demo__week { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; height: 190px; }
.demo__day { position: relative; border-top: 1px solid var(--line); padding-top: 1.4rem; background: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, var(--line) 31px, var(--line) 32px); }
.demo__day > span { position: absolute; top: 0.15rem; left: 0; font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.demo__event {
  position: absolute; left: 2px; right: 2px; top: calc(1.4rem + (100% - 1.4rem) * var(--top) / 100%); height: calc((100% - 1.4rem) * var(--h) / 100%);
  border-radius: 4px; color: #fff; font-style: normal; font-size: 0.68rem; line-height: 1.2; padding: 0.2rem 0.3rem; overflow: hidden; opacity: 0.92;
}

.how { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; counter-reset: how; }
.how li { position: relative; padding-left: 3rem; }
.how li::before {
  counter-increment: how; content: counter(how);
  position: absolute; left: 0; top: 0; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--accent); color: var(--accent-text); font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.how h3 { margin-bottom: 0.3rem; }
.how p { color: var(--muted); margin: 0; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; max-width: 720px; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.plan--featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan h3 { margin: 0; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.plan__price { font-size: 2.2rem; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.plan__period { font-size: 1rem; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.plan form { margin-top: auto; }
.plan .hint { margin-top: auto; }

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.checks li { position: relative; padding-left: 1.6rem; }
.checks li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--ok); font-weight: 700; }
.checks--wide { max-width: 720px; gap: 0.7rem; }

.faq { margin: 0; max-width: 720px; }
.faq dt { font-weight: 600; margin-top: 1.1rem; }
.faq dd { margin: 0.25rem 0 0; color: var(--muted); }

.cta { text-align: center; margin: 4rem 0 1rem; padding: 2.5rem 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cta h2 { font-size: 1.5rem; }
.cta form { display: inline-block; margin-top: 0.5rem; }

.prose { max-width: 720px; }
.prose h1 { margin-bottom: 0.25rem; }
.prose h2 { margin-top: 2rem; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li ul { margin-top: 0.5rem; }
.prose .table { margin: 0.75rem 0 1.5rem; }
.prose h3 { margin-top: 1.25rem; margin-bottom: 0.25rem; }
.prose li { margin-bottom: 0.5rem; }

.topbar__link { color: var(--text); }
.footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 2rem; }
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 1.25rem; padding-bottom: 1.25rem; font-size: 0.9em; color: var(--muted); }
.footer__brand { margin: 0; }
.footer__nav { display: flex; gap: 1.25rem; }
.footer__nav a { color: var(--muted); text-decoration: none; }
.footer__nav a:hover { color: var(--text); }

.section--danger { border-top: 1px solid var(--line); padding-top: 1.5rem; }

.grid { display: grid; gap: 1rem; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.section { margin-top: 2.25rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.actions form { margin: 0; }

.btn {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95em;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--line-strong); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn--primary:hover { filter: brightness(1.05); border-color: var(--accent); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--danger); }
.btn--small { padding: 0.25rem 0.6rem; font-size: 0.85em; }

.link-button {
  background: none; border: none; padding: 0; margin: 0;
  color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline;
}
.link-button--danger { color: var(--danger); }

.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline; margin-left: 0.6rem; }

.badge {
  display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px;
  font-size: 0.75em; font-weight: 600; background: var(--surface-raised); color: var(--text); vertical-align: middle;
}
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }

.flash { padding: 0.7rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; border: 1px solid; }
.flash--notice { background: var(--notice-bg); border-color: var(--notice-border); color: var(--notice-text); }
.flash--alert { background: var(--alert-bg); border-color: var(--alert-border); color: var(--alert-text); }
.flash .btn { margin-left: 0.75rem; }

.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; max-width: 640px; }
.form--inline { display: flex; gap: 0.5rem; align-items: center; max-width: none; padding: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.form--inline input[type="text"] { flex: 1; min-width: 200px; }
.field { margin-bottom: 1rem; border: none; padding: 0; min-width: 0; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.choice { display: flex; align-items: center; gap: 0.5rem; font-weight: 400 !important; margin-bottom: 0.25rem !important; }
input[type="text"], input[type="url"], select {
  width: 100%; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; background: var(--surface); color: var(--text);
}
input[aria-invalid="true"] { border-color: var(--danger); }
.form--inline input[type="text"], .form--inline select { width: auto; }
.form .actions .hint { margin: 0; }
.field__title { font-weight: 600; margin: 0 0 0.4rem; }

/* Calendars by link */
.crumbs { font-size: 0.85em; margin-bottom: 0.5rem; }
.crumbs a { color: var(--muted); }
.wizard__heading { margin-top: 1.5rem; }
.account-list__status { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.account-list__status form { margin: 0; }
.where, .reasons, .upcoming { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.where li, .upcoming li { display: grid; grid-template-columns: minmax(120px, 150px) 1fr; gap: 0.75rem; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); }
.where li:last-child, .upcoming li:last-child, .reasons li:last-child { border-bottom: none; }
.where li span:first-child { font-weight: 600; }
.where li span:last-child, .upcoming__when { color: var(--muted); }
.upcoming { margin-bottom: 1rem; }
.upcoming__when { font-variant-numeric: tabular-nums; }
.reasons li { padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--line); color: var(--muted); }
.defs { display: grid; grid-template-columns: minmax(120px, 150px) 1fr; gap: 0.4rem 0.75rem; margin: 0 0 1rem; }
.defs dt { color: var(--muted); }
.defs dd { margin: 0; overflow-wrap: anywhere; }

.links { display: grid; gap: 0.75rem; }
.link-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.85rem 1rem; }
.link-card--revoked { opacity: 0.6; }
.link-card__head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.link-card__head form { margin-left: auto; }
.copy-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.copy-row code { flex: 1; padding: 0.4rem 0.6rem; background: var(--bg); border-radius: 6px; overflow-wrap: anywhere; }

.legend { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; font-size: 0.9em; }
.legend li { display: flex; align-items: center; gap: 0.45rem; }
.legend__swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }

.calendar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; font-size: 0.9rem; min-height: 320px; }
.calendar .fc {
  --fc-border-color: var(--line);
  --fc-page-bg-color: var(--surface);
  --fc-neutral-bg-color: var(--bg);
  --fc-neutral-text-color: var(--muted);
  --fc-today-bg-color: var(--today);
  --fc-highlight-color: var(--today);
  --fc-list-event-hover-bg-color: var(--bg);
  --fc-now-indicator-color: var(--accent);
}
.calendar .fc .fc-toolbar-title { font-size: 1.15rem; }
.calendar .fc .fc-button { background: var(--surface); border-color: var(--line); color: var(--text); text-transform: none; box-shadow: none; }
.calendar .fc .fc-button:hover { background: var(--bg); }
.calendar .fc .fc-button-primary:not(:disabled).fc-button-active,
.calendar .fc .fc-button-primary:not(:disabled):active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.calendar .fc .fc-button:disabled { opacity: 0.5; }
.calendar .fc .fc-daygrid-day.fc-day-today, .calendar .fc .fc-timegrid-col.fc-day-today { background: var(--today); }
.calendar .fc-event { cursor: default; }
.calendar .fc-event[href] { cursor: pointer; }
.calendar .fc-event.is-tentative { opacity: 0.75; border-style: dashed; }
.calendar .fc-event.is-transparent { opacity: 0.65; }
.calendar .fc .fc-list-event:hover td { background: var(--bg); }

.wizard { max-width: 640px; margin: 0 auto; }
.wizard h1 { margin-bottom: 0.5rem; }
.wizard__actions { display: flex; align-items: center; gap: 0.75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.wizard__actions form { margin: 0; }

.steps { list-style: none; display: flex; gap: 1.5rem; margin: 0 0 1.5rem; padding: 0; font-size: 0.85em; color: var(--muted); counter-reset: step; }
.steps li { display: flex; align-items: center; gap: 0.45rem; }
.steps li::before {
  counter-increment: step; content: counter(step);
  display: inline-flex; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line);
  align-items: center; justify-content: center; font-weight: 600; font-size: 0.85em;
}
.steps li.is-current { color: var(--text); font-weight: 600; }
.steps li.is-current::before { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.steps li.is-done::before { content: "✓"; background: var(--ok-bg); border-color: var(--ok-bg); color: var(--ok); }

.account-list { list-style: none; margin: 0 0 1rem; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.account-list li { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); }
.account-list li:last-child { border-bottom: none; }
.account-list__email { font-weight: 600; }

.picker { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.25rem 1rem 1rem; }
.picker__account { margin: 1rem 0 0.25rem; font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.picker__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-top: 1px solid var(--line); }
.picker__mode { width: auto; }
.picker__row:not(:has(input:checked)) .picker__mode { opacity: 0.5; }

.switch { display: flex; align-items: center; gap: 0.7rem; cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--switch-off); transition: background 0.15s; flex: none; }
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s;
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }

.share-box { display: flex; align-items: center; gap: 0.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem; margin: 1rem 0 0.5rem; }
.share-box code { flex: 1; font-size: 0.95em; overflow-wrap: anywhere; }

.subscribe { margin: 1rem 0 1.5rem; }
.subscribe__buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.subscribe__outlook summary { list-style: none; cursor: pointer; }
.subscribe__outlook summary::-webkit-details-marker { display: none; }
.subscribe__outlook[open] { flex-basis: 100%; }
.subscribe__outlook[open] summary { display: inline-block; }
.subscribe__outlook .hint { margin: 0.5rem 0 0; }
.subscribe .copy-row { margin-top: 0.75rem; }
.share-page .footer__brand a { color: var(--accent); }
.link-card .hint { margin: 0.6rem 0 0; }
.link-card .hint form { display: inline; }
.link-card .copy-row { margin-top: 0.3rem; }
.form--inline .choice { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; }

.rules { margin-top: 0.5rem; }
.rules td input, .rules td select { width: auto; min-width: 0; }
.rules td input[type="text"] { width: 100%; }
.rules td input[type="checkbox"] { width: 1rem; height: 1rem; }

.day { margin: 1.1rem 0 0.3rem; font-size: 0.95rem; color: var(--muted); font-weight: 600; }
.events { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.events li { display: grid; grid-template-columns: 130px 1fr auto; gap: 0.75rem; padding: 0.45rem 0.8rem; border-bottom: 1px solid var(--line); }
.events li:last-child { border-bottom: none; }
.events__time { color: var(--muted); font-variant-numeric: tabular-nums; }
.events__source { font-size: 0.85em; }

@media (max-width: 640px) {
  .page-head, .section-head { flex-direction: column; align-items: flex-start; }
  .field-row { grid-template-columns: 1fr; }
  .events li { grid-template-columns: 1fr; gap: 0.1rem; }
  .hero h1 { font-size: 2rem; }
  .demo { grid-template-columns: 1fr; }
  .where li, .upcoming li, .defs { grid-template-columns: 1fr; gap: 0.15rem; }
  .topbar__link { display: none; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
}
