@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage/bricolage-grotesque-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree/figtree-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #fbfaff;
  --surface: #ffffff;
  --ink: #1e1b3a;
  --ink-2: #5c5878;
  --lav-1: #eeebfa;
  --lav-2: #dad5f4;
  --lav-3: #b9b0ea;
  --line: #cfc9ee;
  --weekend: #f5f2fe;
  --accent: #5b45e0;
  --accent-strong: #4731c4;
  --accent-ink: #ffffff;
  --danger: #b3261e;
  --ok: #1b6b45;

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;

  --page-max: 880px;
  --gutter: 20px;
  --radius-field: 999px;
  --radius-card: 20px;
  --tap: 48px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; scroll-padding-bottom: 7rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
a, button, summary, label, input, textarea { touch-action: manipulation; }
html { -webkit-tap-highlight-color: rgba(91, 69, 224, .15); }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent-strong); }
[hidden] { display: none !important; }

.skip {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 100;
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 999px;
}
.skip:focus { top: .75rem; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Seitenraster: Header, Inhalt und Footer teilen sich dieselbe Innenkante */
.topbar,
.site-footer {
  padding-inline: max(var(--gutter), calc((100% - var(--page-max)) / 2));
}
.main {
  width: 100%;
  max-width: calc(var(--page-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
  flex: 1;
}
.main--narrow { max-width: calc(520px + 2 * var(--gutter)); }

/* Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px;
  padding-block: 8px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--accent); }
.brand__name { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--ink); letter-spacing: -0.01em; }

.menu { position: relative; }
.menu__btn {
  list-style: none; cursor: pointer;
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  border-radius: 50%; background: var(--lav-2);
}
.menu__btn::-webkit-details-marker { display: none; }
.menu__initials { font-weight: 700; font-size: .95rem; text-transform: uppercase; }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 14rem; padding: .5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 12px 32px rgba(30, 27, 58, .14);
}
.menu__who { padding: .5rem .75rem .75rem; display: grid; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: .35rem; }
.menu__who span { color: var(--ink-2); font-size: .85rem; overflow-wrap: anywhere; }
.menu__item {
  display: block; width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  padding: .7rem .75rem; border-radius: 10px; text-decoration: none; color: var(--ink); min-height: 44px;
}
.menu__item:hover { background: var(--lav-1); }

/* Monatsnavigation */
.monthnav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1.25rem; }
.monthnav__title {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem, 6vw, 2.4rem);
  letter-spacing: -0.02em; line-height: 1.1; text-align: center;
}
.monthnav__title span { color: var(--ink-2); font-weight: 500; }
.monthnav__btn {
  width: var(--tap); height: var(--tap); display: grid; place-items: center;
  border-radius: 50%; background: var(--lav-1); color: var(--ink); flex: none;
}
.monthnav__btn:hover { background: var(--lav-2); }
.monthnav__today { text-align: center; margin-top: .25rem; font-size: .9rem; }

/* Summen: wie die Summe-Felder unten auf dem Papierformular */
.sums {
  display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: .6rem;
  margin-top: 1rem;
}
.sums__item {
  display: grid; gap: 2px; padding: .6rem .9rem;
  border: 1.5px solid var(--ink); border-radius: 18px;
  background: var(--surface);
}
.sums__item--total { background: var(--ink); color: #fff; border-color: var(--ink); }
.sums__item--days { display: none; }
.sums__label { font-size: .78rem; letter-spacing: .02em; color: var(--ink-2); }
.sums__item--total .sums__label { color: var(--lav-3); }
.sums__value { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; line-height: 1.15; }
.sums__value small { font-size: .85rem; font-weight: 500; opacity: .7; }

/* Tagesliste */
.days-head { display: none; }
.days { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 4px; }
.day { border-radius: 16px; background: var(--lav-1); }
.day:nth-child(even) { background: var(--lav-2); }
.day--weekend { background: var(--weekend); }
.day--weekend:nth-child(even) { background: var(--weekend); }
.day--weekend .day__no, .day--weekend .day__wd { color: var(--ink-2); }
.day--today { box-shadow: inset 0 0 0 2px var(--accent); }

.day__btn {
  display: grid; grid-template-columns: 2.9rem 1fr auto; column-gap: .75rem; row-gap: .15rem;
  width: 100%; min-height: 60px; padding: .55rem .9rem .55rem .7rem;
  text-align: left; cursor: pointer; background: none; border: 0; border-radius: inherit; align-items: center;
}
.day__btn:hover { background: rgba(91, 69, 224, .07); }
.day__id { display: grid; justify-items: center; line-height: 1.05; }
.day__no { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; }
.day__wd { font-size: .75rem; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.day--today .day__no { color: var(--accent-strong); }

.day__time { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; min-width: 0; }
.day__time .cell { font-weight: 600; }
.cell--status { display: none; }
.day--status .cell--status {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--ink); color: #fff; font-weight: 700; font-size: .9rem;
}
.day__statuslabel { font-weight: 600; }
.cell--von:empty, .cell--bis:empty, .cell--pause:empty, .day__to:empty { display: none; }
.cell--von, .cell--bis { padding: .1rem .55rem; border-radius: 999px; background: var(--surface); }
.day__to { color: var(--ink-2); font-size: .85rem; }
.cell--pause { color: var(--ink-2); font-size: .85rem; margin-left: .25rem; }
.cell--pause::before { content: "Pause "; }
.day__empty { color: var(--ink-2); font-size: .95rem; }
.day__empty::before { content: "+ "; font-weight: 700; color: var(--accent-strong); }
.day--weekend .day__empty { opacity: .6; }

.day__hours { display: grid; justify-items: end; line-height: 1.15; }
.cell--normal { font-weight: 700; }
.cell--over { font-size: .85rem; font-weight: 600; color: var(--accent-strong); }

.cell--note { grid-column: 2 / -1; color: var(--ink-2); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell--note:empty { display: none; }

/* Aktionsleiste */
.actionbar {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-top: 1rem; padding: .75rem 0 calc(.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--paper) 70%, transparent);
}
.actionbar__legend { display: none; color: var(--ink-2); font-size: .85rem; }
.actionbar__pdf { flex: 1; }

/* Formularfelder: alle gleich */
.field {
  display: block; width: 100%; min-height: var(--tap);
  padding: .65rem 1.1rem;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius-field);
  font-size: 1rem; line-height: 1.3;
  appearance: none; -webkit-appearance: none;
}
.field:hover { border-color: var(--lav-3); }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91, 69, 224, .22); }
.field--area { border-radius: 20px; resize: vertical; min-height: 6rem; }
.field--btn { text-align: left; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 1.1rem; }
.field--btn .field__val:empty::before { content: "Wählen"; }
.field--btn.is-empty .field__val { color: var(--ink-2); font-weight: 500; }
.label { display: block; font-weight: 600; font-size: .92rem; margin: 1rem 0 .4rem; padding: 0; }
.label--sub { font-weight: 500; color: var(--ink-2); margin-top: .85rem; }
.label__hint { font-weight: 400; color: var(--ink-2); font-size: .85rem; margin-left: .25rem; }
.hint { color: var(--ink-2); font-size: .88rem; margin-top: .4rem; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap); padding: .6rem 1.4rem;
  border-radius: 999px; border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--lav-1); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn--quiet { border-color: transparent; background: transparent; color: var(--ink-2); font-weight: 600; }
.btn--small { min-height: 40px; padding: .4rem .9rem; font-size: .9rem; font-weight: 600; border-color: var(--line); }
.btn--block { width: 100%; margin-top: 1.5rem; }
.btn[disabled] { opacity: .6; cursor: progress; }
.iconbtn {
  width: var(--tap); height: var(--tap); display: grid; place-items: center; flex: none;
  border: 0; border-radius: 50%; background: var(--lav-1); cursor: pointer;
}
.iconbtn:hover { background: var(--lav-2); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding: .45rem 1rem;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 600;
}
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.chip b { font-weight: 800; }

.alert { background: #fdecea; color: var(--danger); border-radius: 14px; padding: .7rem 1rem; margin: 1rem 0 0; font-weight: 600; }
.notice { background: #e6f4ec; color: var(--ok); border-radius: 14px; padding: .7rem 1rem; margin: 1rem 0 0; font-weight: 600; }

/* Login, Einstellungen */
.login { padding-top: 3rem; }
.login__title, .pagetitle { font-family: var(--font-display); font-weight: 700; font-size: 2.2rem; letter-spacing: -0.02em; line-height: 1.1; }
.login__lead { color: var(--ink-2); margin: .5rem 0 1.5rem; }
.pagetitle { margin: .5rem 0 1rem; }
.backlink { display: inline-block; margin-top: 1.25rem; min-height: 44px; line-height: 44px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 1.25rem 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.card__title { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; }
.card .btn { margin-top: 1.25rem; }

/* Standardzeiten in den Einstellungen */
.times { margin-top: 1rem; display: grid; gap: .6rem; }
.times__head, .times__row { display: grid; grid-template-columns: 2.2rem 1fr 1fr 1fr; gap: .4rem; align-items: center; }
.times__head { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.times__day { font-weight: 600; }
.times .field { padding-inline: .25rem; text-align: center; min-width: 0; font-size: 1rem; }
.suggest { margin-top: 1rem; padding: .7rem 1rem; border-radius: 14px; background: var(--lav-2); font-size: .92rem; }

/* Bearbeiten-Dialog */
.sheet {
  width: 100%; max-width: 34rem; max-height: 92dvh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 24px 24px 0 0; background: var(--paper); color: var(--ink);
  box-shadow: 0 -12px 40px rgba(30, 27, 58, .25); overflow: auto; overscroll-behavior: contain;
}
.sheet::backdrop { background: rgba(30, 27, 58, .45); }
.sheet[open] { animation: sheet-in .22s ease-out; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet__form { padding: 1rem var(--gutter) calc(1.25rem + env(safe-area-inset-bottom)); }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.sheet__title { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.01em; flex: 1; }
.sheet__spacer { width: var(--tap); }
.sheet__actions { display: grid; gap: .5rem; margin-top: 1.5rem; }
.group { margin-top: .25rem; }
.group--pair { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.group--pair .label { margin-top: 1rem; }
.calc { margin-top: 1rem; padding: .7rem 1rem; border-radius: 14px; background: var(--lav-1); font-weight: 600; min-height: 2.6rem; }
.calc:empty { display: none; }

.timeprev { font-family: var(--font-display); font-weight: 700; font-size: 3.4rem; text-align: center; margin: 1rem 0 .25rem; letter-spacing: -0.02em; }
.grid { display: grid; gap: 6px; }
.grid--hours { grid-template-columns: repeat(6, 1fr); }
.grid--mins { grid-template-columns: repeat(6, 1fr); }
.grid button {
  min-height: 46px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface);
  font-weight: 600; cursor: pointer; font-size: 1rem;
}
.grid button:hover { background: var(--lav-1); }
.grid button[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.fine { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }

.site-footer { padding-block: 1.25rem 1.5rem; color: var(--ink-2); font-size: .85rem; }

/* Ab Tablet: Tagesliste wie das Formular, mit Spalten */
@media (min-width: 760px) {
  :root { --gutter: 32px; }
  .sums { grid-template-columns: repeat(4, 1fr); }
  .sums__item--days { display: grid; }
  .actionbar__legend { display: block; }
  .actionbar__pdf { flex: none; }

  .days-head, .day__btn {
    display: grid;
    grid-template-columns: 3.4rem 4rem 5.2rem 5.2rem 5.6rem 4.6rem 4.6rem 1fr;
    column-gap: .4rem; align-items: center;
  }
  .days-head {
    margin-top: 1.25rem; padding: 0 .9rem 0 .7rem; font-size: .8rem; font-weight: 600; color: var(--ink-2);
  }
  .days-head span { text-align: center; }
  .days-head span:first-child { text-align: center; }
  .days-head span:last-child { text-align: left; padding-left: .5rem; }
  .days { margin-top: .35rem; }

  .day__btn { min-height: 48px; padding-block: .3rem; }
  .day__id { grid-auto-flow: column; justify-content: center; align-items: baseline; gap: .35rem; }
  .day__no { font-size: 1.1rem; }
  .day__time, .day__hours { display: contents; }
  .cell {
    display: block; text-align: center; min-height: 1.9rem; line-height: 1.9rem; border-radius: 999px;
    background: var(--surface); font-size: .95rem;
  }
  .cell--status, .day--status .cell--status {
    display: block; width: auto; height: auto; min-height: 1.9rem; line-height: 1.9rem; border-radius: 999px;
    background: var(--surface); color: var(--ink); font-size: .95rem; font-weight: 700;
  }
  .cell--von:empty, .cell--bis:empty, .cell--pause:empty { display: block; }
  .cell--von, .cell--bis { padding: 0; }
  .cell--pause { margin: 0; color: var(--ink); font-size: .95rem; }
  .cell--pause::before { content: none; }
  .cell--over { color: var(--ink); font-size: .95rem; }
  .cell--note { grid-column: auto; text-align: left; padding: 0 .75rem; }
  .cell--note:empty { display: block; }
  .day__to, .day__statuslabel, .day__empty { display: none; }
  .sheet { margin: auto; border-radius: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet[open] { animation: none; }
  html { scroll-behavior: auto; }
}
