/* Kalender · Design A „Hell und kräftig“, Feinschliff 1a (heller Ton + Farbstreifen), 2b (Schrift 16, 72 px je Stunde), 3b */
:root {
  --grund: #F5F7FB; --flaeche: #fff; --text: #0F172A; --leise: #64748B; --linie: #EEF1F6; --rand: #E5E9F2;
  --akzent: #2563EB; --jetzt: #E11D48; --ok: #16A34A;
  --stunde: 72px; --luecke: 4px; --kopf-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px; line-height: 1.35;
  background: var(--grund); color: var(--text); -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }

/* ---------- Anmeldung ---------- */
.anmeldung { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.anmeldung form { background: var(--flaeche); border-radius: 20px; padding: 28px; width: min(400px, 100%); box-shadow: 0 2px 10px rgba(15,23,42,.08); }
.anmeldung h1 { margin: 0 0 18px; font-size: 1.5rem; }
.anmeldung .meldung { color: var(--jetzt); min-height: 1.4em; margin: 8px 0 0; }

/* ---------- Formularelemente ---------- */
.feld { display: block; margin: 0 0 14px; }
.feld > span { display: block; font-size: .85rem; font-weight: 600; color: var(--leise); margin-bottom: 4px; }
.feld input, .feld select, .feld textarea { width: 100%; min-height: 46px; border: 1.5px solid var(--rand); border-radius: 12px; padding: 10px 12px; background: #fff; }
.feld textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
.feld input:focus, .feld select:focus, .feld textarea:focus { outline: 3px solid #BFD3FF; border-color: var(--akzent); }
.zeile2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.zeile3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .zeile3 { grid-template-columns: 1fr 1fr; } .zeile3 > :first-child { grid-column: 1 / -1; } }
.haken { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0 0 8px; }
.haken input { width: 22px; height: 22px; }
.knopf { min-height: 46px; padding: 0 18px; border-radius: 12px; background: #EEF2F8; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.knopf.haupt { background: var(--akzent); color: #fff; }
.knopf.gefahr { background: #FEE2E2; color: #B91C1C; }
.knopf.klein { min-height: 38px; padding: 0 12px; font-size: .9rem; }
.knopf:disabled { opacity: .5; cursor: default; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 8px; }
.segment { display: inline-flex; background: #EEF2F8; border-radius: 12px; padding: 3px; gap: 2px; }
.segment button { min-height: 40px; padding: 0 14px; border-radius: 10px; font-weight: 600; }
.segment button[aria-pressed="true"] { background: var(--akzent); color: #fff; }

/* ---------- Kopfleiste ---------- */
.kopf { position: sticky; top: 0; z-index: 20; background: var(--flaeche); border-bottom: 1px solid var(--rand);
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top)); }
.kopf h1 { margin: 0; font-size: 1.3rem; }
.kopf .unter { font-size: .85rem; color: var(--leise); }
.kopf .gruppe { display: flex; gap: 6px; align-items: center; }
.kopf .rund { min-width: 46px; min-height: 46px; border-radius: 12px; background: #EEF2F8; font-size: 1.2rem; font-weight: 700; }
.kopf .neu { background: var(--akzent); color: #fff; padding: 0 16px; font-size: 1rem; }

/* ---------- Kalenderfläche ---------- */
.haupt { display: flex; gap: 16px; padding: 12px 16px 24px; align-items: flex-start; }
.flaeche { flex: 1; min-width: 0; background: var(--flaeche); border-radius: 16px; box-shadow: 0 1px 3px rgba(15,23,42,.08);
  overflow: auto; -webkit-overflow-scrolling: touch; max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); position: relative; }
.raster { display: grid; min-width: min-content; position: relative; }
.ecke { position: sticky; top: 0; left: 0; z-index: 12; background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.tagkopf { position: sticky; top: 0; z-index: 10; background: var(--flaeche); border-bottom: 1px solid var(--linie); border-left: 1px solid var(--linie);
  padding: 8px 6px 6px; min-height: var(--kopf-h); }
.tagkopf .wt { font-weight: 700; cursor: pointer; }
.tagkopf .dt { font-size: .82rem; color: var(--leise); }
.tagkopf.heute .wt, .tagkopf.heute .dt { color: var(--akzent); }
.hinweis { display: block; width: 100%; text-align: left; margin-top: 4px; font-size: .78rem; font-weight: 600; padding: 3px 6px; border-radius: 6px;
  background: var(--hell); border-left: 4px solid var(--farbe); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hinweis.vorlaeufig { border-left-style: dashed; }
.ansicht-tag .hinweis { white-space: normal; font-size: .9rem; padding: 6px 8px; }
.achse { position: sticky; left: 0; z-index: 8; background: var(--flaeche); }
.achse span { position: absolute; right: 8px; transform: translateY(-50%); font-size: .78rem; color: var(--leise); font-variant-numeric: tabular-nums; }
.spalte { position: relative; border-left: 1px solid var(--linie); }
.spalte .linie { position: absolute; left: 0; right: 0; border-top: 1px solid var(--linie); pointer-events: none; }
.spalte .nacht { position: absolute; left: 0; right: 0; background: rgba(99,102,241,.05); pointer-events: none; }
.block { position: absolute; border-radius: 10px; padding: 4px 8px; overflow: hidden; text-align: left; display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch;
  background: var(--hell); border-left: 5px solid var(--farbe); color: var(--text); touch-action: manipulation; z-index: 2;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.block .t { display: block; font-weight: 700; font-size: .92rem; line-height: 1.2; }
.block .z { display: block; font-size: .78rem; color: #334155; font-variant-numeric: tabular-nums; }
.block .b { display: block; font-size: .82rem; color: #334155; margin-top: 3px; white-space: pre-line; }
.block .zeichen { position: absolute; right: 6px; top: 3px; font-size: .78rem; letter-spacing: 1px; }
.block .marke { display: inline-block; font-size: .66rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: rgba(15,23,42,.08); margin-left: 4px; vertical-align: 1px; }
.block.duenn { padding: 0 6px; border-radius: 4px; border-left: 0; background: var(--farbe); color: var(--auf); justify-content: center; }
.block.duenn .t { font-size: .68rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block.duenn .z, .block.duenn .zeichen, .block.duenn .b { display: none; }
.block.vorlaeufig { border-left-style: dashed; outline: 1.5px dashed var(--farbe); outline-offset: -1.5px; }
.block.erledigt { background: #ECFDF3; }
.block.erledigt .t::before { content: "✓ "; color: var(--ok); }
.block.arbeit .t::before { content: "◐ "; }
.block.zieht { opacity: .85; box-shadow: 0 10px 24px rgba(15,23,42,.25); z-index: 15; }
.frei { position: absolute; left: 6px; right: 6px; border-radius: 8px; border: 1.5px dashed #D7DEE9; color: #94A3B8; font-size: .72rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; text-align: center; z-index: 1; }
.jetzt { position: absolute; left: 0; right: 0; height: 2px; background: var(--jetzt); z-index: 6; pointer-events: none; }
.jetzt::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--jetzt); }

/* ---------- Seitenleiste in der Tagesansicht ---------- */
.seite { width: 320px; flex: none; position: sticky; top: 84px; }
.seite section { background: var(--flaeche); border-radius: 16px; padding: 14px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.seite h2 { margin: 0 0 8px; font-size: 1.02rem; }
.liste button { display: flex; width: 100%; gap: 10px; align-items: flex-start; text-align: left; padding: 7px 4px; border-radius: 10px; min-height: 40px; }
.liste button:hover { background: var(--grund); }
.liste .pkt { width: 12px; height: 12px; border-radius: 50%; flex: none; margin-top: 4px; background: var(--farbe); }
.liste .uz { font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--leise); width: 94px; flex: none; }
.liste .leer { color: var(--leise); font-size: .9rem; }
@media (max-width: 1000px) { .seite { display: none; } }

/* ---------- Monatsansicht ---------- */
.monat { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.monat .wtk { padding: 8px; font-weight: 700; font-size: .85rem; color: var(--leise); border-bottom: 1px solid var(--linie); }
.monat .zelle { min-height: 118px; border-left: 1px solid var(--linie); border-bottom: 1px solid var(--linie); padding: 6px; cursor: pointer; text-align: left; width: 100%;
  display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; min-width: 0; }
.monat .zelle .nr { align-self: flex-start; }
.monat .zelle.fremd { background: #FAFBFD; color: #94A3B8; }
.monat .zelle.heute .nr { background: var(--akzent); color: #fff; }
.monat .nr { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 14px; font-weight: 700; font-size: .9rem; }
.monat .ein { display: block; font-size: .76rem; margin-top: 3px; padding: 2px 5px; border-radius: 5px; background: var(--hell); border-left: 3px solid var(--farbe);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.monat .mehr { font-size: .74rem; color: var(--leise); margin-top: 3px; }
@media (max-width: 700px) { .monat .zelle { min-height: 84px; padding: 4px; } .monat .ein { font-size: .66rem; } }

/* ---------- Legende ---------- */
.legende { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 0 16px 24px; font-size: .85rem; }
.legende i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; background: var(--farbe); }

/* ---------- Blätter (Details, Bearbeiten, Menü) ---------- */
.schleier { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.blatt { background: var(--flaeche); width: min(640px, 100%); max-height: 92vh; max-height: 92dvh; overflow: auto; border-radius: 20px 20px 0 0;
  padding: 18px 20px; padding-bottom: max(24px, env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
@media (min-width: 760px) { .schleier { align-items: center; } .blatt { border-radius: 20px; } }
.blatt .oben { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.blatt h2 { margin: 8px 0 4px; font-size: 1.4rem; line-height: 1.2; }
.blatt .info { color: #334155; margin: 4px 0; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; margin: 0 6px 6px 0; background: var(--farbe); color: var(--auf); }
.chip.leer { background: #EEF2F8; color: var(--text); }
.chip.strich { background: transparent; color: var(--text); border: 2px dashed var(--farbe); }
.kasten { background: var(--grund); border-radius: 14px; padding: 12px 14px; margin-top: 12px; }
.kasten h3 { margin: 0 0 6px; font-size: .92rem; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kasten .leer { color: var(--leise); }
.status { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.status button { min-height: 46px; padding: 0 14px; border-radius: 12px; background: #EEF2F8; font-weight: 600; }
.status button[aria-pressed="true"] { background: var(--text); color: #fff; }
.status button.ok[aria-pressed="true"] { background: var(--ok); }
.aufgabe { display: flex; gap: 10px; align-items: center; min-height: 40px; }
.aufgabe input[type=checkbox] { width: 22px; height: 22px; flex: none; }
.aufgabe.erledigt span { text-decoration: line-through; color: var(--leise); }
.aufgabe .weg { margin-left: auto; color: var(--leise); min-height: 36px; padding: 0 8px; }
.notiz p { margin: 0 0 8px; white-space: pre-wrap; }
.notiz ul { margin: 0 0 8px; padding-left: 22px; }
.notiz .check { list-style: none; margin-left: -22px; }
.datei { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--rand); }
.datei:first-of-type { border-top: 0; }
.datei .art { width: 42px; height: 42px; border-radius: 10px; background: #fff; display: grid; place-items: center; font-size: .7rem; font-weight: 800; color: var(--leise); flex: none; border: 1px solid var(--rand); }
.datei .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.datei .name small { display: block; color: var(--leise); }
.ablage { border: 2px dashed #C9D3E3; border-radius: 12px; padding: 12px; text-align: center; color: var(--leise); margin-top: 8px; }
.ablage.drueber { border-color: var(--akzent); background: #EEF4FF; color: var(--akzent); }
.katwahl { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.katwahl button { min-height: 46px; border-radius: 12px; padding: 6px 10px; text-align: left; background: var(--hell); border-left: 5px solid var(--farbe); font-weight: 600; font-size: .9rem; }
.katwahl button[aria-pressed="true"] { outline: 3px solid var(--text); }
.tage { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tage button { min-width: 48px; min-height: 44px; border-radius: 12px; background: #EEF2F8; font-weight: 600; }
.tage button[aria-pressed="true"] { background: var(--akzent); color: #fff; }
.menue button.zeile { display: flex; width: 100%; text-align: left; min-height: 52px; padding: 0 12px; border-radius: 12px; align-items: center; gap: 12px; font-weight: 600; }
.menue button.zeile:hover { background: var(--grund); }
.menue .hilfe { color: var(--leise); font-size: .88rem; margin: 2px 12px 12px; }
.katzeile { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.katzeile input[type=color] { width: 52px; height: 46px; border: 0; padding: 0; background: none; }
.katzeile input[type=text] { min-height: 46px; border: 1.5px solid var(--rand); border-radius: 12px; padding: 8px 12px; width: 100%; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: #fff;
  padding: 12px 18px; border-radius: 12px; z-index: 60; max-width: 90vw; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.laden { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: var(--akzent); z-index: 70; animation: laden 1s ease-in-out infinite; transform-origin: left; }
@keyframes laden { 0% { transform: scaleX(0); } 60% { transform: scaleX(.8); } 100% { transform: scaleX(1); opacity: 0; } }
@media (max-width: 700px) {
  .haupt { padding: 8px 6px 20px; }
  .kopf { padding: 8px 10px; display: grid; grid-template-columns: 1fr auto; }
  .kopf .segment button { padding: 0 10px; }
  .kopf { gap: 8px; }
  .kopf .gruppe { gap: 4px; }
  .kopf .rund { min-width: 40px; }
  .kopf .knopf { padding: 0 10px; }
  .kopf .unter { white-space: nowrap; }
  .kopf h1 { font-size: 1.1rem; }
  .flaeche { max-height: calc(100vh - 170px); max-height: calc(100dvh - 170px); }
}
