/* Klarkopf – ruhiges Grün-Grau, Aufnahme in Orange. Mobil: Tab-Leiste unten, Desktop: Seitenleiste. */
:root {
  --bg: #F3F5F2; --surface: #FFFFFF; --surface-2: #EEF2EF; --fg: #18221E; --muted: #5B6A63; --line: #D9E0DB;
  --accent: #4DFFBC; --accent-fg: #111111; --accent-soft: #E1F9F0; --accent-ink: #257A5A; --rec: #FF4D4D; --rec-fg: #111111; --rec-soft: #FFE5E5; --rec-ink: #B83737;
  --c3-soft: #EEEEEE; --c3-ink: #555555; --c4-soft: #F4F4F4; --c4-ink: #555555; --rec-screen: #101012; --rec-screen-fg: #F2F2F4; --rec-screen-ink: #FF6B6B;
  --ok: #2F7D3A; --danger: #B3261E; --danger-soft: #F9DEDC; --shadow: 0 8px 24px rgba(10, 30, 20, .12);
  --f-display: "Bricolage Grotesque", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --f-body: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --radius: 12px;
  --tabbar-h: 64px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg); font: 15px/1.45 var(--f-body);
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.boot { padding: 40px; color: var(--muted); }

/* ---------- Grundgerüst ---------- */
.shell { display: flex; min-height: 100%; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px); }
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
}
.topbar h1 { font: 700 1.45rem/1.1 var(--f-display); margin: 0; flex: 1; letter-spacing: -.01em; }
.topbar .sub { font: 500 .72rem var(--f-mono); color: var(--accent-ink); background: var(--accent-soft); padding: 3px 9px; border-radius: 99px; }
.view { padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); max-width: 760px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.iconbtn { width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; display: grid; place-items: center; color: var(--muted); }
.iconbtn:hover { background: var(--surface-2); color: var(--fg); }
.iconbtn svg, .tab svg, .side-link svg { width: 22px; height: 22px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
.tab { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; color: var(--muted); padding: 6px 0; text-decoration: none; position: relative; }
.tab.on { color: var(--accent-ink); font-weight: 600; }
.badge { font: 600 .66rem var(--f-mono); background: var(--rec); color: var(--rec-fg); border-radius: 99px; padding: 1px 6px; min-width: 18px; text-align: center; }
.tab .badge { position: absolute; top: 0; left: calc(50% + 6px); }

.fab {
  position: fixed; z-index: 11; right: max(18px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
  width: 62px; height: 62px; border-radius: 50%; border: 0; background: var(--rec); color: var(--rec-fg);
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.fab svg { width: 28px; height: 28px; }
.fab:active { transform: scale(.96); }

@media (min-width: 900px) {
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; width: 230px; flex: none; padding: 20px 14px;
    border-right: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; height: 100vh;
  }
  .brand { font: 700 1.25rem var(--f-display); padding: 4px 10px 18px; display: flex; align-items: center; gap: 8px; }
  .brand img { width: 28px; height: 28px; border-radius: 8px; }
  .side-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 500; }
  .side-link:hover { background: var(--surface-2); color: var(--fg); }
  .side-link.on { background: var(--accent-soft); color: var(--accent-ink); }
  .side-link .badge { margin-left: auto; }
  .side-rec { margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; padding: 11px; background: var(--rec); color: var(--rec-fg); font-weight: 600; }
  .side-rec svg { width: 20px; height: 20px; }
  .tabbar, .fab { display: none; }
  .main { padding-bottom: 40px; }
  .topbar { padding-top: 20px; }
}

/* ---------- Bausteine ---------- */
.quick { display: flex; gap: 8px; }
.quick input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 11px 14px; }
.quick input::placeholder { color: var(--muted); }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: .85rem; border-radius: 8px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.sec { font: 500 .7rem var(--f-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 14px 2px 0; display: flex; align-items: center; gap: 8px; }
.sec .count { color: var(--muted); }
.empty { color: var(--muted); padding: 18px 4px; text-align: center; font-size: .92rem; }
.empty b { color: var(--fg); display: block; font-family: var(--f-display); font-size: 1.05rem; margin-bottom: 4px; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 5px 12px; font-size: .85rem; color: var(--muted); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }

.item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start;
}
.item.done .t { text-decoration: line-through; color: var(--muted); }
.item .body { flex: 1; min-width: 0; cursor: pointer; }
.item .t { font-weight: 500; overflow-wrap: anywhere; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; font-size: .78rem; color: var(--muted); align-items: center; }
.check {
  flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--muted);
  background: transparent; display: grid; place-items: center; padding: 0;
}
.check svg { width: 14px; height: 14px; opacity: 0; }
.check:hover svg { opacity: .4; }
.check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.check.on svg { opacity: 1; }
.tag { font: 500 .7rem var(--f-mono); background: var(--surface-2); padding: 1px 7px; border-radius: 5px; color: var(--muted); white-space: nowrap; }
.tag.ai { background: var(--accent-soft); color: var(--accent-ink); }
.tag.due { background: var(--rec-soft); color: var(--rec-ink); }
.tag.type { background: var(--accent-soft); color: var(--accent-ink); }
.tag.t-waiting, .tag.t-calendar, .tag.t-agenda { background: var(--c3-soft); color: var(--c3-ink); }
.tag.t-routine { background: var(--c4-soft); color: var(--c4-ink); }
.tag.t-project, .tag.t-someday, .tag.t-reference { background: var(--surface-2); color: var(--fg); }

.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 9px; height: 9px; border-radius: 50%; border: 1.6px solid var(--accent-ink); display: block; }
.dots i.f { background: var(--accent-ink); }
.bar { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--accent-ink); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card h3 { margin: 0 0 4px; font: 700 1.02rem var(--f-display); }
.card p { margin: 0 0 8px; color: var(--muted); font-size: .92rem; }
.card.accent { background: var(--accent-soft); border-color: transparent; }
.card.warn { background: var(--rec-soft); border-color: transparent; }
.card.error { background: var(--danger-soft); border-color: transparent; }

/* Inbox / Klären */
.capture { display: flex; flex-direction: column; gap: 8px; }
.capture .src { background: var(--surface-2); border-radius: 10px; padding: 9px 12px; font-size: .86rem; color: var(--muted); }
.capture .src em { color: var(--fg); }
.prop { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; }
.prop.off { opacity: .45; }
.prop .t { font-weight: 600; }
.prop input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent-ink); margin-top: 1px; flex: none; }
.prop .steps { margin: 4px 0 0; padding-left: 18px; font-size: .84rem; color: var(--muted); }
.conf { font: 500 .68rem var(--f-mono); color: var(--rec-ink); }
.spin { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent-ink); border-radius: 50%; animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Listen */
.seg { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a { flex: none; text-decoration: none; color: var(--muted); padding: 7px 12px; border-radius: 9px; font-weight: 500; font-size: .9rem; background: var(--surface); border: 1px solid var(--line); }
.seg a.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.seg a .n { font: 500 .72rem var(--f-mono); opacity: .7; margin-left: 4px; }

/* Bottom-Sheet / Dialog */
.backdrop { position: fixed; inset: 0; background: rgba(5, 12, 9, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  border-radius: 18px 18px 0 0; padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
@media (min-width: 700px) { .backdrop { align-items: center; } .sheet { border-radius: 18px; } }
.grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 10px; }
.sheet h2 { font: 700 1.2rem var(--f-display); margin: 0 0 12px; padding-right: 40px; }
.sheet-top { position: sticky; top: -8px; height: 0; z-index: 3; }
.sheet-close { position: absolute; top: 0; right: -8px; width: 36px; height: 36px; background: var(--bg); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: .78rem; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0;
}
.field textarea { min-height: 80px; resize: vertical; }
.fields2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.typepick { display: flex; flex-wrap: wrap; gap: 6px; }
.typepick button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 11px; font-size: .85rem; }
.typepick button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.wd { display: flex; gap: 4px; }
.wd button { width: 36px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: .8rem; }
.wd button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.sheet-actions .btn { flex: 1; }
.source { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: .88rem; white-space: pre-wrap; color: var(--muted); max-height: 240px; overflow: auto; }

/* Toasts */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 90px); z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: center; width: min(92vw, 480px); pointer-events: none; }
.toast { background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-size: .9rem; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; pointer-events: auto; animation: up .2s; }
.toast button { background: none; border: 0; color: var(--bg); text-decoration: underline; font-weight: 700; padding: 0; }
.toast.err { background: var(--danger); color: #fff; }
@media (min-width: 900px) { #toasts { bottom: 30px; } }

/* Aufnahme (Vollbild) */
.rec {
  position: fixed; inset: 0; z-index: 50; background: var(--rec-screen); color: var(--rec-screen-fg);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 20px calc(env(safe-area-inset-bottom, 0px) + 34px);
}
.rec .state { font: 600 .75rem var(--f-mono); letter-spacing: .06em; padding: 4px 12px; border-radius: 99px; background: var(--rec); color: var(--rec-fg); }
.rec .state.paused { background: #6B6B73; color: #fff; }
.rec .center { display: flex; flex-direction: column; align-items: center; gap: 20px; width: 100%; }
.rec .timer { font: 500 3rem var(--f-mono); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.rec canvas { width: min(90vw, 420px); height: 90px; }
.rec .hint { opacity: .65; font-size: .9rem; text-align: center; max-width: 300px; }
.rec .ctrl { display: flex; gap: 28px; align-items: center; }
.rec .round { width: 56px; height: 56px; border-radius: 50%; border: 1.5px solid rgba(242, 242, 244, .5); background: transparent; color: var(--rec-screen-fg); display: grid; place-items: center; }
.rec .round svg { width: 24px; height: 24px; }
.rec .stop { width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--rec-screen-ink); background: transparent; display: grid; place-items: center; }
.rec .stop i { width: 30px; height: 30px; border-radius: 7px; background: var(--rec-screen-ink); display: block; }
.rec .lbl { font-size: .72rem; opacity: .7; text-align: center; margin-top: 6px; }
.rec .confirm { background: rgba(255, 255, 255, .08); border-radius: 14px; padding: 16px; text-align: center; display: flex; flex-direction: column; gap: 10px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login form { width: min(100%, 380px); display: flex; flex-direction: column; gap: 4px; }
.login h1 { font: 700 2rem var(--f-display); margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.login h1 img { width: 40px; height: 40px; border-radius: 10px; }
.login p { color: var(--muted); margin: 0 0 18px; }
.login .err { color: var(--danger); font-size: .9rem; min-height: 1.3em; }
.login .remember { font-size: .84rem; color: var(--muted); margin-top: 6px; }

/* Review */
.steps-nav { display: flex; gap: 4px; }
.steps-nav i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps-nav i.on { background: var(--accent-ink); }
.rv-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.loose .item { border: 0; padding: 2px 0; background: transparent; }
.ctxrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; margin-bottom: 12px; align-items: center; }
.ctxrow input { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 11px; min-width: 0; width: 100%; }
.ctxrow .hint { grid-column: 1 / -1; grid-row: 2; }
@media (min-width: 640px) {
  .ctxrow { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; }
  .ctxrow .hint { grid-column: auto; grid-row: auto; }
}
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
.theme { border: 2px solid var(--line); border-radius: 12px; padding: 0; overflow: hidden; background: var(--surface); text-align: left; }
.theme.on { border-color: var(--accent-ink); box-shadow: 0 0 0 2px var(--accent-soft); }
.theme .sw { display: flex; height: 38px; }
.theme .sw i { flex: 1; display: block; }
.theme span { display: block; padding: 7px 9px; font-size: .82rem; }
.typerow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; align-items: center; margin-bottom: 12px; }
.typerow.off > input { opacity: .55; }
.typerow input:not([type=checkbox]), .typerow select { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; min-width: 0; width: 100%; }
.typerow .hint { grid-column: 2 / -1; grid-row: 2; }
.typeactive input { width: 20px; height: 20px; accent-color: var(--accent-ink); }
@media (min-width: 700px) {
  .typerow { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.6fr) auto; }
  .typerow .hint { grid-column: auto; grid-row: auto; }
}
.quick select { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 10px; }
.offline { background: var(--rec-soft); color: var(--rec-ink); font-size: .84rem; padding: 6px 12px; border-radius: 10px; }
.kbd { font: 500 .75rem var(--f-mono); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; color: var(--muted); }
table.usage { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.usage td, table.usage th { text-align: left; padding: 5px 4px; border-bottom: 1px solid var(--line); }
table.usage th { color: var(--muted); font-weight: 500; }
.small { font-size: .84rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Sortieren per Ziehen */
.sortable { display: flex; flex-direction: column; gap: 10px; }
.item .drag {
  flex: none; align-self: center; border: 0; background: transparent; color: var(--muted);
  padding: 4px 6px; margin: -4px -6px -4px 0; cursor: grab; touch-action: none; user-select: none;
  font-size: 1rem; line-height: 1; letter-spacing: -3px; border-radius: 6px;
}
.item .drag:focus-visible { outline: 2px solid var(--accent); }
.item.dragging { box-shadow: 0 6px 20px rgb(0 0 0 / .18); position: relative; z-index: 2; border-color: var(--accent); }
.item.dragging .drag { cursor: grabbing; }

/* Projektzugehörigkeit in Zeilen */
.tag.proj {
  display: inline-flex; align-items: center; gap: 4px; text-decoration: none;
  background: transparent; color: var(--fg); border: 1px solid var(--accent-ink); padding: 0 7px;
}
.tag.proj svg { width: 12px; height: 12px; flex: none; color: var(--accent-ink); }
.tag.proj:hover { background: var(--accent-soft); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ver { color: var(--muted); font-family: var(--f-mono); text-align: right; margin-bottom: -4px; }
