/* Work Dashboard – mobile-first */
:root {
  --bg: #F3F4F6; --surface: #FFFFFF; --surface-2: #F3F4F6; --ink: #15181C; --ink-2: #3A414B; --muted: #5A6370;
  --line: #DDE1E6; --line-2: #EEF0F3; --blue: #1F47B8; --blue-ink: #16348A; --blue-bg: #E7ECF8;
  --red: #C53030; --red-ink: #9B1C1C; --red-bg: #FCE8E8; --amber: #B7791F; --amber-ink: #7A4A0A; --amber-bg: #FDF1DC;
  --green: #1E8A4C; --green-ink: #14532D; --green-bg: #E3F3EA; --bar: #15181C; --bar-2: #2B3038; --bar-ink: #C9CED6;
  --radius: 10px; --tabbar-h: 64px;
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1114; --surface: #181B20; --surface-2: #20242A; --ink: #ECEEF1; --ink-2: #C7CCD3; --muted: #9AA3AF;
    --line: #2C3138; --line-2: #23272D; --blue: #7C9CF5; --blue-ink: #A9BEF8; --blue-bg: #1C2540;
    --red: #F07171; --red-ink: #F7A6A6; --red-bg: #3A1D1F; --amber: #E0A852; --amber-ink: #F0C98D; --amber-bg: #3A2C16;
    --green: #4CC283; --green-ink: #9AE0B9; --green-bg: #15301F; --bar: #0B0D10; --bar-2: #20242A; --bar-ink: #AEB5BF;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); }
a { color: var(--blue); }
a:hover { color: var(--blue-ink); }
h1 { font-size: 24px; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h2 { margin: 0; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.mono { font-family: var(--mono); }
.strong { font-weight: 600; }
.meta { font-size: 13px; color: var(--muted); }
.meta-red, .red { color: var(--red-ink) !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: block; }
.label-blue { color: var(--blue); }

/* Kopfzeile */
.topbar { background: var(--bar); color: #fff; padding-top: env(safe-area-inset-top); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 52px; }
.brand { color: #fff; font-weight: 700; font-size: 16px; text-decoration: none; margin-right: auto; }
.brand:hover { color: #fff; }
.topnav, .topsearch { display: none; }
.iconbtn { color: var(--bar-ink); display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 8px; }
.iconbtn:hover { color: #fff; background: var(--bar-2); }

/* Bottom-Tabbar (mobil) */
.main { padding-top: 16px; padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--tabbar-h);
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; }
.tabbar a.active { color: var(--blue); }
.tabbar a.tab-capture svg { background: var(--blue); color: #fff; border-radius: 50%; padding: 6px; width: 36px; height: 36px; }

@media (min-width: 900px) {
  h1 { font-size: 28px; }
  .wrap { padding: 0 24px; }
  .brand { margin-right: 8px; }
  .topnav { display: flex; gap: 4px; margin-right: auto; }
  .topnav a { color: var(--bar-ink); padding: 8px 12px; border-radius: 6px; text-decoration: none; font-size: 14px; }
  .topnav a:hover { color: #fff; }
  .topnav a.active { color: #fff; background: var(--bar-2); font-weight: 600; }
  .topsearch { display: block; }
  .topsearch input { width: 280px; padding: 8px 12px; border-radius: 8px; border: 1px solid #3A404A; background: #22262D; color: #fff; font: inherit; font-size: 14px; }
  .tabbar { display: none; }
  .main { padding-top: 28px; padding-bottom: 48px; gap: 24px; }
}

/* Karten & Layout */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
@media (min-width: 900px) { .card { padding: 20px; } }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.col-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.col-side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 900px) { .cols, .col-main, .col-side { gap: 24px; } }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.group { display: flex; flex-direction: column; gap: 10px; }
.pagehead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.titlerow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back { font-size: 13px; text-decoration: none; }
.hero { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.lead { color: var(--ink-2); margin-top: 4px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pills a { text-decoration: none; }
.empty { color: var(--muted); font-size: 14px; }

/* Ampel */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.pill-red { background: var(--red-bg); color: var(--red-ink); } .pill-red .dot { background: var(--red); }
.pill-yellow { background: var(--amber-bg); color: var(--amber-ink); } .pill-yellow .dot { background: var(--amber); }
.pill-green { background: var(--green-bg); color: var(--green-ink); } .pill-green .dot { background: var(--green); }

/* Formulare */
input, select, textarea, button { font: inherit; }
input:not([type=checkbox]), select, textarea {
  font-size: 16px; /* verhindert Zoom auf iOS */ width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink);
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-ink); border-color: var(--blue-ink); color: #fff; }
.btn-outline { color: var(--blue); border-color: var(--blue); }
.btn-sm { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btnrow select { width: auto; min-height: 36px; padding: 6px 10px; font-size: 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }

.capture-row { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: end; }
@media (min-width: 640px) { .capture-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; } }
.capture-compact textarea { min-height: 52px; }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--line-2); }
.list > li:last-child { border-bottom: 0; }
.plain { margin: 0; padding-left: 18px; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.task form { margin: 0; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; overflow-wrap: anywhere; }
.task .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--muted); background: transparent; cursor: pointer; padding: 0; flex: none;
  /* grössere Trefferfläche als sichtbarer Kreis */ box-shadow: 0 0 0 8px transparent; margin: 2px; }
.check:hover { border-color: var(--green); background: var(--green-bg); }
.check.checked { background: var(--green); border-color: var(--green); display: inline-block; }
.task-done .task-title { text-decoration: line-through; color: var(--muted); }
.event { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 10px 0; align-items: start; }
.event .when { font-size: 14px; color: var(--ink-2); padding-top: 1px; }
.why { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; font-size: 14px; }
.tl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; align-items: start; }
.tl-body .meta { overflow-wrap: anywhere; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag-amber, .tag-k-risk { background: var(--amber-bg); color: var(--amber-ink); }
.tag-event, .tag-k-commitment { background: var(--blue-bg); color: var(--blue-ink); }
.tag-note, .tag-k-decision { background: var(--green-bg); color: var(--green-ink); }
.tag-k-deadline { background: var(--red-bg); color: var(--red-ink); }
.tag-chat { background: #EFE7FB; color: #4C2A85; }
@media (prefers-color-scheme: dark) { .tag-chat { background: #2A2140; color: #CDB8F5; } }

/* Aufmerksamkeit & Vorschläge */
.alert { display: block; padding: 12px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.alert:hover { color: var(--ink); filter: brightness(.98); }
.alert-red { background: var(--red-bg); } .alert-yellow { background: var(--amber-bg); }
.alert-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.alert .meta { color: var(--ink-2); margin-top: 4px; }
.suggest { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }

/* Board-Karten */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; }
.chip-active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip-active:hover { color: var(--surface); }
.chip-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.chip-primary:hover { color: #fff; }
.acard { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--green); border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.acard:hover { color: var(--ink); border-color: var(--muted); }
.acard-red { border-top-color: var(--red); } .acard-yellow { border-top-color: var(--amber); }
.acard-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; font-size: 16px; }
.reason { font-size: 13px; font-weight: 500; }
.reason-red { color: var(--red-ink); } .reason-yellow { color: var(--amber-ink); } .reason-green { color: var(--muted); }
.summary { font-size: 14px; color: var(--ink-2); }
.next { font-size: 13px; background: var(--surface-2); border-radius: 6px; padding: 8px 10px; }
.stats { display: flex; gap: 16px 20px; flex-wrap: wrap; }
.stats > div { display: flex; flex-direction: column; gap: 1px; }
.stats b { font-family: var(--mono); font-size: 17px; font-weight: 500; }
.stats span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.statsbar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }

/* Thema-Detail */
.statustext { font-size: 16px; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.box { background: var(--surface-2); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.box-amber { background: var(--amber-bg); }
.box-amber .label { color: var(--amber-ink); }
.pre { white-space: pre-line; }
.nextstep { border: 2px solid var(--blue); border-radius: 8px; padding: 12px; display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; }
.nextstep > div { flex: 1 1 260px; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: min(320px, calc(100vw - 32px)); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
@media (max-width: 639px) { .menu-body { position: fixed; left: 16px; right: 16px; top: auto; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); width: auto; } }
.addtask > summary { list-style: none; margin-top: 8px; }
.addtask > summary::-webkit-details-marker { display: none; }
.addtask[open] > summary { margin-bottom: 10px; }

/* Verlauf */
.ix { padding: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.ix-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.ix-in .tag { background: var(--blue-bg); color: var(--blue-ink); }
.ix-error .ix-text { color: var(--red-ink); }
.ix-text { font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.ix-assign { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ix-assign select { width: auto; max-width: 100%; min-height: 36px; padding: 6px 10px; font-size: 14px; }

/* Meldungen, Login, Tokens */
.flash { background: var(--green-bg); color: var(--green-ink); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.flash-red { background: var(--red-bg); color: var(--red-ink); }
.token { display: block; margin-top: 6px; font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; user-select: all; }
code { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.login { max-width: 400px; margin: 10vh auto 0; width: 100%; }
body:has(.login) .tabbar, body:has(.login) .topnav, body:has(.login) .topsearch, body:has(.login) .iconbtn { display: none; }

.htmx-request { opacity: .6; transition: opacity .2s; }

/* Kompakte Erfassung (Today): Optionen in einer Zeile, ohne Feldbeschriftung */
.capture-compact .capture-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.capture-compact .field-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.capture-compact .capture-row select { font-size: 14px; padding: 8px; }
.check-row { display: flex; gap: 10px; align-items: center; min-height: 44px; font-size: 14px; }
.check-row input { width: 20px; height: 20px; }
