/* Tokens (colors, fonts) live in tokens.css. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 var(--f-body); }
h1, h2, h3 { margin: 0; }
a { color: inherit; }
svg { width: 18px; height: 18px; flex: none; }
main:focus { outline: none; }
a:focus-visible, button:focus-visible, input:focus-visible, label.pill:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Top bar and buttons */
.brand__mark--large { width: 48px; height: 48px; border-radius: 12px; font-size: 16px; margin-bottom: 20px; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 0; border-radius: 999px; background: var(--soft); color: var(--fg);
  font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.pill:hover { background: var(--soft-2); }
.pill:disabled { opacity: .6; cursor: progress; }
.pill--ghost { background: transparent; color: var(--muted); font-weight: 400; }
.pill--primary { background: var(--accent); color: var(--accent-on); }
.pill--primary:hover { background: var(--accent); filter: brightness(1.08); }
.pill--block { width: 100%; min-height: 48px; margin-top: 12px; font-size: 15px; }
#theme-button { font-weight: 400; }
.link-btn { align-self: flex-start; min-height: 44px; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Forms */
.input { font: inherit; min-height: 48px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--soft); color: var(--fg); }
.input--short { max-width: 240px; }
.form { display: flex; flex-direction: column; gap: 8px; }
.form label, .login label { font-size: 14px; font-weight: 500; margin-top: 6px; }
.form .pill { align-self: flex-start; margin-top: 8px; }
.form__error { color: var(--bad-text); min-height: 1.4em; margin: 0; font-size: 14px; }
.form__note { color: var(--muted); min-height: 1.4em; margin: 0; font-size: 14px; }
.note { margin: 0; font-size: 14px; color: var(--muted); }

/* Loading and login */
.loading { padding: 64px 16px; text-align: center; color: var(--muted); }
.login-view { display: flex; justify-content: center; padding: 6vh 16px 96px; }
.login { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 8px; }
.login h1 { margin-bottom: 18px; font: 600 32px/1.15 var(--f-display); }
.version { margin: 20px 0 0; text-align: center; font: 12px var(--f-mono); color: var(--muted); }

/* App shell */
.page { display: flex; flex-direction: column; gap: 56px; }
.section-title { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 18px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.eyebrow { display: block; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

/* Dashboard: countdown */
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 32px; }
.hero__main { min-width: 0; }
.hero__date { font-size: 13px; color: var(--muted); }
.hero h1 { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; font-family: var(--f-display); font-weight: 600; line-height: 1; }
.hero__days { font-size: clamp(72px, 10vw, 120px); letter-spacing: -.04em; color: var(--accent); }
.hero__label { font-size: clamp(24px, 3vw, 34px); }
.hero__exam { margin: 12px 0 0; color: var(--muted); }
.focus { flex: 0 1 340px; min-width: 0; padding: 20px 22px; border-radius: 16px; background: var(--soft); }
.focus .eyebrow { color: var(--accent-text); }
.focus strong { display: block; margin-top: 6px; font: 600 22px/1.25 var(--f-display); }
.focus p { margin: 6px 0 0; font-size: 14px; color: var(--muted); }

/* Dashboard: timeline */
.tl { position: relative; padding-top: 26px; }
.tl__today { position: absolute; top: 0; display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--accent-text); white-space: nowrap; }
.tl__today::before { content: ""; width: 2px; height: 14px; background: var(--accent); }
.tl__bar { display: flex; gap: 6px; height: 6px; }
.tl__seg { flex: 1 1 0; min-width: 4px; border-radius: 3px; }
.tl__labels { display: flex; gap: 6px; margin-top: 12px; font-size: 14px; }
.tl__label { flex: 1 1 0; min-width: 0; }
.tl__label strong { display: block; }
.tl__label span { font: 12px var(--f-mono); color: var(--muted); }
.tl__label:last-child { text-align: right; white-space: nowrap; }
.tone-p1 { background: var(--p1); }
.tone-p2 { background: var(--p2); }
.tone-p3 { background: var(--p3); }
.tone-p4 { background: var(--p4); }
.tone-exam { background: var(--fg); }

/* Dashboard: modules and next dates */
.columns { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; }
.columns__main { flex: 999 1 520px; min-width: 0; }
.columns__side { flex: 1 1 260px; min-width: 0; }
.modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 40px; }
.module { display: flex; flex-direction: column; gap: 14px; }
.module__meta { font-size: 13px; color: var(--muted); }
.module__title { margin-top: 2px; font: 600 30px/1.15 var(--f-display); }
.module__title a { text-decoration: none; }
.module__title a:hover { color: var(--accent-text); }
.meter { display: flex; height: 4px; border-radius: 2px; overflow: hidden; background: var(--soft); }
.meter i { display: block; width: 0; }
.meter__good { background: var(--p1); }
.module__stand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.module__pct { font: 600 28px/1 var(--f-display); color: var(--accent-text); }
.module__progress { font-size: 13px; color: var(--muted); }
.module__areas { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.module__areas li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; }
.module__areas .meter { grid-column: 1 / -1; height: 3px; }
.module__area-pct { font: 13px var(--f-mono); color: var(--muted); }
.modules--detail { gap: 56px; }
.section-title--link a { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--accent-text); text-decoration: none; }
.section-title--link a:hover { text-decoration: underline; }
.page-lead { margin: 12px 0 0; max-width: 70ch; color: var(--muted); }

/* Zeitplan */
.plan-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plan-item { display: grid; grid-template-columns: 12px 1fr auto; gap: 14px; align-items: start; padding: 16px 18px; border-radius: 14px; background: var(--soft); }
.plan-item .swatch { margin-top: 6px; }
.plan-item.is-current { box-shadow: inset 0 0 0 2px var(--accent); background: var(--bg); }
.plan-item.is-past { opacity: .65; }
.plan-item__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.plan-item__body strong { font-size: 16px; }
.plan-item__body p { margin: 4px 0 0; font-size: 14px; }
.plan-item__dates { font: 13px var(--f-mono); color: var(--muted); }
.plan-item__how { color: var(--muted); }
.plan-item__state { font-size: 13px; font-weight: 600; color: var(--accent-text); white-space: nowrap; }
.next { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.next li { display: grid; grid-template-columns: 56px 1fr; gap: 12px; font-size: 14px; }
.next strong { display: block; }
.next__date { font-family: var(--f-mono); color: var(--accent-text); }
.next__date--exam { color: var(--fg); font-weight: 500; }
.next__text { color: var(--muted); }

/* Settings */
.back-link { font-size: 14px; color: var(--muted); }
.page-title { margin-top: 10px; font: 600 44px/1.1 var(--f-display); }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 56px 64px; align-items: start; }
.settings section { display: flex; flex-direction: column; gap: 10px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; }

/* AI assistant page and settings */
.input--area { min-height: 120px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
select.input { appearance: auto; }
.ai-form__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.ai-form__row .pill { margin-top: 0; }
.ai-answer { margin-top: 28px; display: flex; flex-direction: column; gap: 8px; }
.ai-answer:empty { display: none; }
.ai-answer.is-error { color: var(--bad-text); }
.ai-answer__text { margin: 0; padding: 18px 20px; border-radius: 14px; background: var(--soft); white-space: pre-wrap; }
.usage { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 8px; }
.usage__row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.usage__value { font-family: var(--f-mono); color: var(--fg); }
.segmented-field { border: 0; margin: 8px 0 0; padding: 0; }
.segmented-field legend { font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: var(--soft); }
.segmented button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--fg); font: inherit; font-size: 14px; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--fg); color: var(--bg); font-weight: 600; }
code { font-family: var(--f-mono); font-size: .92em; }

@media (max-width: 760px) {
  .page { gap: 40px; }
  .tl__labels { flex-direction: column; }
  .tl__label:last-child { text-align: left; }
  .plan-item { grid-template-columns: 12px 1fr; }
  .plan-item__state { grid-column: 2; }
}
