/* Voryntiq Dienstplan – Gestaltung der App
   Farben stehen als Variablen oben; Hell- und Dunkelmodus automatisch. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #ebe8df;
  --ink: #16161a;
  --ink-2: #4a4a52;
  --ink-3: #6b6b73;
  --line: #d9d5ca;
  --accent: #c2410c;
  --accent-hover: #9a3412;
  --on-accent: #ffffff;
  --accent-soft: #fbe6d7;
  --ok: #166534;
  --ok-soft: #dcfce7;
  --warn: #92400e;
  --warn-soft: #fef3c7;
  --err: #b91c1c;
  --err-soft: #fee2e2;
  --focus: #1d4ed8;

  /* Blockfarben: Hintergrund / Rand / Text */
  --gruen-bg: #eaf3de;  --gruen-bd: #639922;  --gruen-tx: #27500a;
  --orange-bg: #faeeda; --orange-bd: #ba7517; --orange-tx: #633806;
  --blau-bg: #e6f1fb;   --blau-bd: #378add;   --blau-tx: #0c447c;
  --rot-bg: #fcebeb;    --rot-bd: #e24b4a;    --rot-tx: #791f1f;
  --lila-bg: #eeedfe;   --lila-bd: #7f77dd;   --lila-tx: #3c3489;
  --grau-bg: #efede6;   --grau-bd: #9c9a91;   --grau-tx: #4a4a45;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --radius: 14px;
  --radius-sm: 9px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --surface: #1b1b1f;
    --surface-2: #242429;
    --ink: #f2f0ea;
    --ink-2: #b9b7b0;
    --ink-3: #97958e;
    --line: #313137;
    --accent: #ff7a45;
    --accent-hover: #ff9a6e;
    --on-accent: #16161a;
    --accent-soft: #3a2218;
    --ok: #86efac;
    --ok-soft: #14301f;
    --warn: #fcd34d;
    --warn-soft: #3a2c0c;
    --err: #fca5a5;
    --err-soft: #3b1717;
    --focus: #93c5fd;

    --gruen-bg: #22400c;  --gruen-bd: #97c459;  --gruen-tx: #c9e3a4;
    --orange-bg: #4f2d06; --orange-bd: #ef9f27; --orange-tx: #fac775;
    --blau-bg: #0c3a69;   --blau-bd: #85b7eb;   --blau-tx: #bcd9f6;
    --rot-bg: #641a1a;    --rot-bd: #f09595;    --rot-tx: #f7c1c1;
    --lila-bg: #342d7a;   --lila-bd: #afa9ec;   --lila-tx: #d4d1f8;
    --grau-bg: #2c2c2a;   --grau-bd: #7a7972;   --grau-tx: #c4c2bb;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
}
main { flex: 1; width: 100%; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 0.5em; text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 1.4rem + 2vw, 2.4rem); font-weight: 750; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 650; }
p { margin: 0 0 0.9em; }
.muted { color: var(--ink-2); }
.small { font-size: 0.9rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 860px; }

/* ---------- Kopf ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-family: var(--font-display);
  font-weight: 750; font-size: 1.15rem; letter-spacing: -0.03em; color: var(--ink); }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand:hover { color: var(--ink); }
.tabs { margin-left: auto; display: flex; gap: 4px; list-style: none; padding: 0; margin-top: 0; margin-bottom: 0; }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 999px;
  text-decoration: none; font-weight: 600; color: var(--ink-2); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--bg); }
@media (max-width: 400px) { .brand-name { display: none; } .tabs a { padding: 0 11px; } }

/* ---------- Fuß ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 0 calc(28px + env(safe-area-inset-bottom)); font-size: 0.88rem; color: var(--ink-2); }
.footer ul { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.footer a { display: inline-block; padding: 6px 0; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer .legal-buttons a { font-weight: 650; color: var(--ink); }

/* ---------- Bausteine ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1 1 auto; }
.spacer { height: 24px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px;
  border-radius: 999px; border: 2px solid transparent; font: inherit; font-weight: 650; line-height: 1.2; cursor: pointer;
  text-decoration: none; text-align: center; transition: background-color .15s, color .15s, border-color .15s; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-2); }
.btn-danger { background: transparent; color: var(--err); border-color: currentColor; }
.btn-danger:hover { background: var(--err-soft); color: var(--err); }
.btn-small { min-height: 40px; padding: 6px 14px; font-size: 0.92rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.is-on { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); cursor: pointer; font: inherit; }
.icon-btn:hover { color: var(--ink); border-color: var(--ink-2); }
.icon-btn svg { width: 20px; height: 20px; }

.alert { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 14px; font-weight: 550; border: 1px solid currentColor; }
.alert-info { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-err { background: var(--err-soft); color: var(--err); }
.alert a { color: inherit; font-weight: 700; }
.alert .btn { margin-top: 10px; }

/* ---------- Formulare ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > label, .field > .label, legend { font-weight: 600; }
.hint { font-size: 0.88rem; color: var(--ink-2); margin: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="time"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); }
textarea { min-height: 90px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
.check { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px 16px; margin: 0; display: grid; gap: 10px; }
.auth-page { padding-top: 32px; padding-bottom: 16px; }
.auth-page h1 { margin-bottom: 0.3em; }
.form-foot { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; font-size: 0.95rem; }

/* ---------- Heute-Ansicht ---------- */
.clock { color: var(--ink-3); font-size: 0.92rem; margin: 16px 0 12px; font-variant-numeric: tabular-nums; }
.daynav { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 14px; }
.daynav button { min-height: 42px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit;
  font-size: 0.85rem; font-weight: 600; border-radius: 9px; cursor: pointer; padding: 0; }
.daynav button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.daynav button.is-today:not([aria-pressed="true"]) { border-color: var(--accent); color: var(--ink); }
.daynav button.is-empty { opacity: .5; }

.now-card { border-radius: 18px; padding: 22px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); }
.now-kicker { font-size: 0.82rem; color: var(--ink-3); margin-bottom: 6px; font-weight: 600; letter-spacing: 0.02em; }
.now-label { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; line-height: 1.15; margin-bottom: 8px; letter-spacing: -0.02em; }
.now-range { font-size: 0.95rem; color: var(--ink-2); margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.now-note { font-size: 0.95rem; margin: -6px 0 14px; white-space: pre-line; }
.bar { height: 7px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; margin-bottom: 10px; }
.bar > span { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--ink-2); transition: width 1s linear; }
.countdown { font-weight: 700; font-variant-numeric: tabular-nums; }
.now-card.pulse { animation: pulse 1.2s ease-in-out infinite; }
.now-card.flash { animation: flash 1.4s ease-out; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(226, 75, 74, .35); } 50% { box-shadow: 0 0 0 9px rgba(226, 75, 74, 0); } }
@keyframes flash { 0% { filter: brightness(1.25); } 100% { filter: none; } }
@media (prefers-reduced-motion: reduce) { .now-card.pulse, .now-card.flash { animation: none; } .bar > span { transition: none; } }

.next-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.next-card .now-label { font-size: 1.1rem; margin: 0; }
.next-time { color: var(--ink-2); font-size: 0.92rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

.event-card { border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; background: var(--lila-bg); color: var(--lila-tx); border: 1px solid var(--lila-bd); }
.event-card .t { font-size: 0.8rem; opacity: .85; font-weight: 600; }
.event-card .n { font-weight: 700; font-size: 1.05rem; }
.event-card .d { font-size: 0.92rem; opacity: .9; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tl { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px;
  border-left: 4px solid transparent; font-variant-numeric: tabular-nums; }
.tl-time { font-size: 0.85rem; opacity: .8; }
.tl-label { font-weight: 600; }
.tl-note { display: block; font-weight: 400; font-size: 0.85rem; opacity: .85; white-space: pre-line; }
.tl-bell { opacity: .6; }
.tl-bell svg { width: 16px; height: 16px; display: block; }
.tl.is-current { outline: 2.5px solid var(--ink); outline-offset: -2px; }
.tl.is-past { opacity: .6; }

.c-gruen { background: var(--gruen-bg); color: var(--gruen-tx); border-left-color: var(--gruen-bd); }
.c-orange { background: var(--orange-bg); color: var(--orange-tx); border-left-color: var(--orange-bd); }
.c-blau { background: var(--blau-bg); color: var(--blau-tx); border-left-color: var(--blau-bd); }
.c-rot { background: var(--rot-bg); color: var(--rot-tx); border-left-color: var(--rot-bd); }
.c-lila { background: var(--lila-bg); color: var(--lila-tx); border-left-color: var(--lila-bd); }
.c-grau { background: var(--grau-bg); color: var(--grau-tx); border-left-color: var(--grau-bd); }
.now-card.c-gruen .bar > span { background: var(--gruen-bd); }
.now-card.c-orange .bar > span { background: var(--orange-bd); }
.now-card.c-blau .bar > span { background: var(--blau-bd); }
.now-card.c-rot .bar > span { background: var(--rot-bd); }
.now-card.c-lila .bar > span { background: var(--lila-bd); }
.now-card.c-grau .bar > span { background: var(--grau-bd); }
.now-card[class*="c-"] { border-color: transparent; }
.now-card[class*="c-"] .now-kicker, .now-card[class*="c-"] .now-range { color: inherit; opacity: .8; }

.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 5px; border: 2px solid; vertical-align: -3px; }

/* ---------- Plan-Editor ---------- */
.editor-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin: 8px 0 16px; }
.editor-days button { min-height: 44px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit;
  font-weight: 650; border-radius: 9px; cursor: pointer; position: relative; }
.editor-days button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.editor-days .count { display: block; font-size: 0.7rem; font-weight: 500; opacity: .75; }

.block-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.block-item { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; }
.block-item.b-gruen { border-left-color: var(--gruen-bd); }
.block-item.b-orange { border-left-color: var(--orange-bd); }
.block-item.b-blau { border-left-color: var(--blau-bd); }
.block-item.b-rot { border-left-color: var(--rot-bd); }
.block-item.b-lila { border-left-color: var(--lila-bd); }
.block-item.b-grau { border-left-color: var(--grau-bd); }
.block-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.block-grid .full { grid-column: 1 / -1; }
.block-grid label { font-size: 0.82rem; font-weight: 600; color: var(--ink-2); display: grid; gap: 4px; }
.block-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.colors { display: flex; gap: 6px; flex-wrap: wrap; }
.colors label { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; border: 2px solid transparent; }
.colors input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.colors span { width: 24px; height: 24px; border-radius: 7px; border: 2px solid; }
.colors input:checked + span { outline: 3px solid var(--ink); outline-offset: 2px; }
.colors input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.sw-gruen { background: var(--gruen-bg); border-color: var(--gruen-bd); }
.sw-orange { background: var(--orange-bg); border-color: var(--orange-bd); }
.sw-blau { background: var(--blau-bg); border-color: var(--blau-bd); }
.sw-rot { background: var(--rot-bg); border-color: var(--rot-bd); }
.sw-lila { background: var(--lila-bg); border-color: var(--lila-bd); }
.sw-grau { background: var(--grau-bg); border-color: var(--grau-bd); }

.list-plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.list-item .meta { font-size: 0.88rem; color: var(--ink-2); }
.inline-form { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.inline-form .full { grid-column: 1 / -1; }
@media (max-width: 480px) { .inline-form { grid-template-columns: 1fr; } }

.savebar { position: sticky; bottom: 0; z-index: 15; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); margin-top: 20px; }
.savebar .wrap { display: flex; gap: 12px; align-items: center; }
.savebar .status { flex: 1; font-size: 0.92rem; color: var(--ink-2); }
.savebar.is-dirty .status { color: var(--warn); font-weight: 600; }

details.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
details.section > summary { cursor: pointer; padding: 16px 20px; font-weight: 700; font-family: var(--font-display); font-size: 1.1rem; list-style: none; min-height: 44px; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::after { content: "+"; float: right; font-weight: 400; }
details.section[open] > summary::after { content: "–"; }
details.section > .body { padding: 0 20px 20px; display: grid; gap: 14px; }

/* ---------- Konto / Preise ---------- */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .plans { grid-template-columns: 1fr; } }
.plan-option { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; display: grid; gap: 6px; }
.plan-option.is-best { border: 2px solid var(--accent); }
.plan-option .price { font-family: var(--font-display); font-size: 1.5rem; font-weight: 750; }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--accent); color: var(--on-accent); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.stat .n { font-family: var(--font-display); font-size: 1.8rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 0.85rem; color: var(--ink-2); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,.25);
  max-width: calc(100% - 32px); }

dialog { border: none; border-radius: 16px; background: var(--surface); color: var(--ink); padding: 20px; width: min(420px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }

.empty { text-align: center; padding: 28px 16px; color: var(--ink-2); }
.center { text-align: center; }

/* Markenzeichen */
.mk-bg { fill: var(--ink); }
.mk-v { stroke: var(--bg); }
.mk-dot { fill: var(--accent); }

@media print {
  .topbar, .footer, .btn, .toast, .savebar { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #999; }
}

/* Symbole in Buttons */
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-small svg { width: 16px; height: 16px; }

/* Kompaktere Blöcke im Editor */
.block-item { padding: 12px 14px; gap: 8px; }
.block-grid { gap: 8px 10px; }
@media (min-width: 620px) {
  .block-grid { grid-template-columns: 110px 110px 1fr; }
  .block-grid .label-field { grid-column: 3; grid-row: 1; }
  .block-grid .half { grid-column: 1 / 3; }
  .block-grid .wide { grid-column: 3; }
}
.topbar .wrap { max-width: 860px; }
@media (min-width: 620px) { .block-grid { grid-template-columns: 124px 124px 1fr; } }

/* Plan per Foto */
.photo-card { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.photo-card .btn-primary { justify-self: start; }
.photo-card input[type="text"] { background: var(--surface); }
.alert ul { margin: 8px 0 0; padding-left: 1.2em; font-weight: 450; }
