:root {
  color-scheme: dark;
  --navy: #0E2A4F;
  --page: #0C2341;
  --surface: #13325A;
  --surface-2: #183B68;
  --line: #2A4C78;
  --text: #EAF2FA;
  --muted: #A3B8D1;
  --turq: #35D6C5;
  --turq-soft: #8CF0E5;
  --amber: #F2B55C;
  --red: #F28B82;
  --radius-l: 18px;
  --radius-s: 10px;
  --font: "Avenir Next", "Avenir", "Segoe UI", system-ui, -apple-system, sans-serif;
  --nav-w: 200px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--turq); outline-offset: 2px; }

.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.nav { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 20px 12px; background: var(--navy); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; letter-spacing: .08em; font-size: 18px; }
.brand img { border-radius: 7px; }
.navbtn { text-align: left; background: none; border: 0; border-radius: var(--radius-s); padding: 0 14px; min-height: 44px; color: var(--muted); font-weight: 500; cursor: pointer; }
.navbtn:hover { color: var(--text); background: var(--surface); }
.navbtn[aria-current="page"] { color: var(--text); background: var(--surface-2); box-shadow: inset 3px 0 0 var(--turq); }

main { padding: 28px clamp(16px, 4vw, 44px) 120px; max-width: 1080px; width: 100%; min-width: 0; outline: none; overflow-wrap: anywhere; }
h1 { font-size: 30px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 19px; font-weight: 600; margin: 32px 0 12px; }
h3 { font-size: 16px; font-weight: 600; margin: 0; }
p { margin: 0 0 10px; }
.lead { color: var(--muted); margin-bottom: 24px; max-width: 64ch; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }

.btn { min-height: 44px; padding: 0 16px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-weight: 500; }
.btn:hover { border-color: var(--turq); }
.btn.primary { background: var(--turq); color: #062A33; border-color: var(--turq); font-weight: 600; }
.btn.ghost { background: none; }
.btn.danger { border-color: #7A3B45; color: var(--red); background: none; }
.btn.small { min-height: 44px; padding: 0 12px; font-size: 14px; }

input, select, textarea { background: var(--page); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; min-height: 44px; width: 100%; }
textarea { min-height: 88px; resize: vertical; }
label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
.inline-select { width: auto; min-width: 140px; }

/* Heute: der eine nächste Schritt ist das prägende Element */
.focus { position: relative; padding: 28px 28px 26px 72px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); margin-bottom: 18px; }
.focus::before { content: ""; position: absolute; left: 28px; top: 34px; width: 22px; height: 22px; background: var(--turq); transform: rotate(45deg); border-radius: 3px; }
.focus .title { font-size: clamp(22px, 3.2vw, 32px); line-height: 1.25; font-weight: 600; margin: 4px 0 10px; }
.focus .why { color: var(--turq-soft); }
.counts { display: flex; gap: 28px; flex-wrap: wrap; margin: 4px 0 6px; color: var(--muted); }
.counts b { color: var(--text); font-size: 22px; font-weight: 600; margin-right: 6px; }

.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list > li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.list .body { flex: 1; min-width: 0; }
.list .meta { color: var(--muted); font-size: 14px; }
.check { width: 26px; height: 26px; min-height: 26px; margin: 9px; accent-color: var(--turq); flex: none; }
.checkwrap { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; flex: none; }

.gem { display: inline-block; width: 9px; height: 9px; transform: rotate(45deg); border-radius: 1px; margin-right: 8px; vertical-align: 1px; background: var(--muted); }
.gem.Hoch { background: var(--amber); }
.gem.Mittel { background: var(--turq); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 20px; margin-bottom: 14px; }
.panel.sub { background: var(--page); border-radius: 14px; padding: 16px; margin-top: 12px; }
.bar { height: 8px; border-radius: 4px; background: var(--page); overflow: hidden; margin: 6px 0 2px; }
.bar > span { display: block; height: 100%; background: var(--turq); width: 0; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin: 12px 0; }
.warn { color: var(--amber); font-size: 14px; }
.warn::before { content: "! "; font-weight: 700; }
.err { color: var(--red); }
.ok { color: var(--turq-soft); }
.tag { display: inline-block; font-size: 13px; padding: 2px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 14px; }
.scroll-x { overflow-x: auto; }

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-l); width: min(560px, calc(100% - 24px)); padding: 24px; max-height: 90vh; max-height: 90dvh; overflow: auto; }
dialog::backdrop { background: rgba(4, 14, 28, .78); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

#statusbar { position: fixed; left: 12px; bottom: 16px; width: calc(var(--nav-w) - 24px); padding: 10px 14px; border-radius: var(--radius-s); background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; color: var(--muted); margin-bottom: env(safe-area-inset-bottom); }
#statusbar.conflict, #statusbar.error { color: var(--amber); border-color: var(--amber); }
#statusbar.synced { color: var(--turq-soft); }
.notice { border-left: 3px solid var(--amber); background: rgba(242, 181, 92, .08); padding: 12px 14px; border-radius: 6px; margin: 12px 0; }

@media (max-width: 899px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav { position: fixed; z-index: 10; bottom: 0; left: 0; right: 0; top: auto; height: auto; flex-direction: row; justify-content: space-around; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .brand { display: none; }
  .nav { gap: 0; padding-left: 2px; padding-right: 2px; }
  .navbtn { padding: 0; font-size: 12px; letter-spacing: -0.01em; text-align: center; flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .navbtn[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--turq); }
  #statusbar { left: 12px; right: 12px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom)); }
  main { padding-bottom: 170px; }
  /* beta.6: auf schmalen Bildschirmen sichtbar, solange nicht alles in der Cloud bestätigt ist (oder Cloud aus) */
  #statusbar:not([data-show="yes"]) { display: none; }
}
@media (max-width: 520px) {
  .two { grid-template-columns: 1fr; }
  .focus { padding: 22px 20px 20px 56px; }
  .focus::before { left: 20px; top: 28px; width: 18px; height: 18px; }
  .hide-narrow { display: none; }
  .panel { padding: 14px; }
  .panel.sub { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Feinschliff nach Sichtprüfung */
.list > li { align-items: center; }
details { margin-top: 12px; }
details > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--muted); }
details > summary:hover { color: var(--text); }
details[open] > * + * { margin-top: 12px; }
details h3 { font-size: 14px; font-weight: 500; }

/* Version 7.0.0-alpha.2 */
.syncline { font-size: 14px; color: var(--muted); max-width: 42ch; text-align: right; margin-top: 8px; }
.syncline.synced { color: var(--turq-soft); }
.syncline.conflict, .syncline.error { color: var(--amber); }
.areas { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.area-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.area-card h3 { margin-bottom: 4px; }
.toggle { display: flex; align-items: center; gap: 4px; min-height: 44px; color: var(--text); font-size: 16px; margin: 0; }
#cs-steps { margin: 8px 0 12px; padding-left: 22px; }
#cs-steps li { margin: 4px 0; }
.boot { color: var(--muted); padding: 40px 0; }
@media (max-width: 520px) { .syncline { text-align: left; } }

/* 7.0.0-beta.1 */
.quick { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin: 0 0 22px; align-items: start; }
.quick p { grid-column: 1 / -1; margin: 0; }
.search { width: auto; flex: 1 1 200px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.report { white-space: pre-wrap; background: var(--page); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px; font-size: 13px; overflow-x: auto; }
.report.err { border-color: var(--amber); }
code { font-size: 14px; background: var(--page); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }

/* beta.6: Speicherstatus (🟢 Cloud · 🟡 nur Gerät · 🔴 Handlung nötig · ⚪ Cloud aus) */
.syncline .sync-title, .savebox .sync-title { font-weight: 600; }
.syncline .sync-detail { margin-top: 2px; font-size: 13px; }
.syncline.level-cloud { color: var(--turq-soft); }
.syncline.level-action { color: var(--amber); }
.savebox { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 14px; margin: 8px 0 12px; }
.savebox p { margin: 4px 0 0; }
.savebox.level-cloud { border-color: var(--turq-soft); }
.savebox.level-action { border-color: var(--amber); }
#statusbar[data-level="cloud"] { color: var(--turq-soft); }
#statusbar[data-level="action"] { color: var(--amber); border-color: var(--amber); }
details.tech > summary { font-size: 13px; color: var(--muted); }

/* beta.6 mobil: Aufgabentabelle. Ursache des Zerfalls: main hat overflow-wrap:anywhere, dadurch wurden die Spalten
   auf Minimalbreite gequetscht (Datum „19.1/1.20/26“, „Be/arb/eite/n“). */
.tasktable { overflow-wrap: break-word; }
.tasktable th, .tasktable .c-due, .tasktable .c-act { white-space: nowrap; }
.tasktable .c-status select { width: auto; max-width: 100%; }
table select, table input { font-size: 16px; }   /* unter 16 px zoomt iOS Safari beim Antippen in die Seite */
@media (max-width: 599px) {
  .tasktable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tasktable, .tasktable tbody { display: block; }
  .tasktable tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "title title title" "status due act"; align-items: center; column-gap: 10px; row-gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .tasktable td { display: block; padding: 0; border: 0; }
  .tasktable .c-title { grid-area: title; font-weight: 500; }
  .tasktable .c-status { grid-area: status; min-width: 0; }
  .tasktable .c-status select { width: 100%; }
  .tasktable .c-due { grid-area: due; color: var(--muted); font-size: 14px; }
  .tasktable .c-act { grid-area: act; }
  .tasktable .c-ref { display: none; }
  .tasktable td[colspan] { grid-column: 1 / -1; }
}
/* beta.6 mobil: seitliche Sicherheitsbereiche (iPhone quer: Dynamic Island, Gehäuserundung) */
@media (max-width: 899px) {
  .nav { padding-left: calc(2px + env(safe-area-inset-left)); padding-right: calc(2px + env(safe-area-inset-right)); }
  #statusbar { left: calc(12px + env(safe-area-inset-left)); right: calc(12px + env(safe-area-inset-right)); }
}
