/* AgentWERK ToDo-Dashboard – Prototyp. Design-Tokens zuerst; Dark Mode vorbereitet via [data-theme="dark"]. */
:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --line: #e6e3db;
  --line-strong: #d4d0c4;
  --ink: #1d1f23;
  --ink-2: #4b4f58;
  --ink-3: #8a8e97;
  --accent: #0e6b63;
  --accent-soft: #e2f1ee;
  --p1: #c53030;
  --p1-soft: #fbe9e7;
  --p2: #c26a12;
  --p2-soft: #fdf0dd;
  --p3: #6b7280;
  --p3-soft: #eeeeea;
  --warn: #c53030;
  --radius: 6px;
  --shadow: 0 1px 2px rgb(20 20 20 / 0.05);
  --shadow-pop: 0 12px 40px rgb(20 20 20 / 0.18);
  --font-head: 'Bahnschrift', 'Segoe UI Variable Display', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
  --side-w: 236px;
}
[data-theme='dark'] {
  --bg: #15171a;
  --surface: #1d2024;
  --surface-2: #22262b;
  --line: #2d3239;
  --line-strong: #3a4048;
  --ink: #eceef1;
  --ink-2: #b4b9c2;
  --ink-3: #7e848e;
  --accent: #4fc3b6;
  --accent-soft: #1b3330;
  --p1: #f27878;
  --p1-soft: #3a2224;
  --p2: #f0a050;
  --p2-soft: #392b1b;
  --p3: #9aa1ac;
  --p3-soft: #2a2e34;
  --warn: #f27878;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 13.5px/1.4 var(--font-body); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { margin: 0; font-family: var(--font-head); font-weight: 600; letter-spacing: 0.01em; }
svg.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app { display: grid; grid-template-columns: var(--side-w) 1fr; grid-template-rows: 52px 1fr; height: 100vh; }

/* Topbar */
.topbar {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; width: calc(var(--side-w) - 16px); font-family: var(--font-head); font-size: 15px; font-weight: 600; letter-spacing: 0.02em; }
.brand-mark { width: 24px; height: 24px; background: var(--ink); color: var(--surface); display: grid; place-items: center; border-radius: 4px; font-size: 13px; position: relative; }
.brand-mark::after { content: ''; position: absolute; right: -3px; bottom: -3px; width: 8px; height: 8px; background: var(--accent); border-radius: 2px; }
.brand small { font-family: var(--font-body); font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.date { color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.search {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 32px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-3);
}
.search:focus-within { border-color: var(--accent); background: var(--surface); }
.search input { flex: 1; border: 0; background: none; outline: none; color: var(--ink); }
.search kbd, .kbd { font: 11px var(--font-body); border: 1px solid var(--line-strong); border-radius: 3px; padding: 0 5px; color: var(--ink-3); background: var(--surface); }
.spacer { flex: 1; }
.badge-test { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--p2); background: var(--p2-soft); border: 1px solid color-mix(in srgb, var(--p2) 35%, transparent); padding: 3px 8px; border-radius: 999px; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); font-weight: 500; }
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--p1); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12.5px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg button { height: 30px; padding: 0 10px; color: var(--ink-2); background: var(--surface); }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--surface); }

/* Sidebar */
.side { background: var(--surface-2); border-right: 1px solid var(--line); overflow-y: auto; padding: 12px 8px; display: flex; flex-direction: column; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 10px; height: 31px; padding: 0 10px; border-radius: var(--radius);
  color: var(--ink-2); text-align: left; position: relative;
}
.nav-item:hover { background: var(--p3-soft); color: var(--ink); }
.nav-item[aria-current='page'] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow), inset 0 0 0 1px var(--line); }
.nav-item[aria-current='page']::before { content: ''; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 3px; background: var(--accent); border-radius: 0 2px 2px 0; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.nav-item .count.hot { color: var(--warn); font-weight: 600; }
.nav-label { margin: 16px 10px 5px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.dot { width: 9px; height: 9px; border-radius: 2px; background: var(--c, var(--ink-3)); flex: none; }
.side-foot { margin-top: auto; padding: 12px 10px 2px; font-size: 11.5px; color: var(--ink-3); line-height: 1.4; }

/* Main */
.main { overflow-y: auto; padding: 22px 28px 48px; }
.view { max-width: 1180px; }
.view-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; }
.view-head h1 { font-size: 22px; line-height: 1.15; }
.view-head .sub { color: var(--ink-3); margin-top: 3px; }
.view-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.cols { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 22px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.panel-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-2); }
.panel-head .n { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.panel-head .right { margin-left: auto; }
.panel.alert .panel-head { background: var(--p1-soft); }
.panel.alert .panel-head h2 { color: var(--p1); }
.empty { padding: 14px 12px; color: var(--ink-3); }

/* Fokus */
.focus { background: var(--ink); color: var(--surface); border-radius: 8px; padding: 14px 16px; display: grid; grid-template-columns: auto 1fr; gap: 4px 18px; }
.focus h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: color-mix(in srgb, var(--surface) 60%, transparent); grid-column: 1 / -1; }
.focus .headline { grid-column: 1 / -1; font-family: var(--font-head); font-size: 20px; margin-bottom: 6px; }
.focus ol { grid-column: 1 / -1; margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; counter-reset: f; }
.focus li { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-top: 1px solid color-mix(in srgb, var(--surface) 15%, transparent); counter-increment: f; }
.focus li::before { content: counter(f); width: 20px; font-family: var(--font-head); color: color-mix(in srgb, var(--surface) 50%, transparent); }
.focus li button.f-title { flex: 1; text-align: left; }
.focus li button.f-title:hover { text-decoration: underline; }
.focus .tag { font-size: 11.5px; opacity: 0.7; }

/* Task rows */
.tasks > li {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 104px 36px 82px 26px; align-items: center; gap: 10px;
  min-height: 38px; padding: 4px 12px; border-top: 1px solid var(--line);
}
.tasks > li:first-child { border-top: 0; }
.tasks > li:hover { background: var(--surface-2); }
.tasks.compact > li { grid-template-columns: 22px minmax(0, 1fr) auto 36px 26px; }
.tasks.compact .proj-chip, .tasks.compact .status { display: none; }
.tasks.compact.show-proj .proj-chip { display: inline-flex; }
.chk { width: 18px; height: 18px; border: 1.6px solid var(--line-strong); border-radius: 50%; display: grid; place-items: center; color: transparent; background: var(--surface); }
.chk:hover { border-color: var(--accent); color: var(--accent); }
.is-done .chk { background: var(--accent); border-color: var(--accent); color: #fff; }
.chk svg { width: 11px; height: 11px; stroke-width: 2.6; }
.t-main { min-width: 0; display: flex; align-items: center; gap: 6px; }
.t-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.t-note { color: var(--ink-3); flex: none; }
.is-done .t-title { text-decoration: line-through; color: var(--ink-3); font-weight: 400; }
.recur-ic { color: var(--accent); flex: none; display: inline-flex; }
.recur-ic svg { width: 13px; height: 13px; }
.proj-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 150px; font-size: 12px; color: var(--ink-2); padding: 1px 8px 1px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.proj-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-chip.none { color: var(--ink-3); border-style: dashed; }
.due { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.due.over { color: var(--warn); font-weight: 600; }
.due.today { color: var(--accent); font-weight: 600; }
.due.none { color: var(--ink-3); }
.prio { height: 20px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.03em; }
.prio.p1 { background: var(--p1-soft); color: var(--p1); }
.prio.p2 { background: var(--p2-soft); color: var(--p2); }
.prio.p3 { background: var(--p3-soft); color: var(--p3); }
.prio:hover, .status:hover { filter: brightness(0.95); outline: 1px solid var(--line-strong); }
.status { height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11.5px; font-weight: 500; text-align: center; white-space: nowrap; border: 1px solid var(--line); color: var(--ink-2); }
.status.s-doing { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.status.s-waiting { background: var(--p2-soft); color: var(--p2); border-color: transparent; }
.status.s-done { color: var(--ink-3); }
.icon-btn { width: 26px; height: 26px; border-radius: 4px; display: grid; place-items: center; color: var(--ink-3); }
.icon-btn:hover { background: var(--p3-soft); color: var(--ink); }
.tasks > li .icon-btn { opacity: 0; }
.tasks > li:hover .icon-btn, .tasks > li .icon-btn:focus-visible { opacity: 1; }

/* Projects */
.mini-proj { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 12px; border-top: 1px solid var(--line); width: 100%; text-align: left; }
.mini-proj:first-child { border-top: 0; }
.mini-proj:hover { background: var(--surface-2); }
.mini-proj .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mini-proj .meta { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bar { grid-column: 2 / -1; height: 4px; background: var(--p3-soft); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c, var(--accent)); }
.ptable { width: 100%; border-collapse: collapse; }
.ptable th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.ptable td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.ptable tr[data-proj]:hover { background: var(--surface-2); cursor: pointer; }
.ptable .bar { width: 160px; }
.type-tag { font-size: 11.5px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }

/* Toolbar */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.field, .toolbar select { height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.quick { display: flex; gap: 8px; margin-bottom: 14px; }
.quick input { flex: 1; height: 40px; padding: 0 14px; font-size: 14.5px; border: 1.5px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.quick input:focus { outline: none; border-color: var(--accent); }
.hint { color: var(--ink-3); font-size: 12px; margin: -6px 0 14px; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.cal .dow { padding: 6px 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 104px; padding: 4px 5px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.out { background: var(--surface-2); color: var(--ink-3); }
.cal .day .num { font-size: 12px; font-variant-numeric: tabular-nums; padding: 1px 4px; align-self: flex-start; }
.cal .day.is-today .num { background: var(--accent); color: #fff; border-radius: 10px; font-weight: 700; }
.chip { display: flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 1px 5px; border-radius: 3px; text-align: left; background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-left: 3px solid var(--c); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; width: 100%; }
.chip:hover { background: color-mix(in srgb, var(--c) 26%, var(--surface)); }
.chip.done { opacity: 0.5; text-decoration: line-through; }
.more { font-size: 11.5px; color: var(--ink-3); padding-left: 5px; }

/* Settings & misc */
.setting { display: flex; align-items: center; gap: 14px; padding: 12px; border-top: 1px solid var(--line); }
.setting:first-of-type { border-top: 0; }
.setting p { margin: 2px 0 0; color: var(--ink-3); }

/* Dialog */
dialog { border: 0; padding: 0; border-radius: 10px; box-shadow: var(--shadow-pop); background: var(--surface); color: var(--ink); width: min(560px, 94vw); }
dialog::backdrop { background: rgb(15 15 15 / 0.4); }
.dlg-head { display: flex; align-items: center; padding: 14px 18px 4px; }
.dlg-head h2 { font-size: 16px; }
.dlg-body { padding: 10px 18px 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg-body label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.dlg-body .full { grid-column: 1 / -1; }
.dlg-body input, .dlg-body select, .dlg-body textarea { height: 34px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-weight: 400; color: var(--ink); width: 100%; }
.dlg-body textarea { height: 72px; padding: 7px 9px; resize: vertical; }
.dlg-body .title-in { height: 40px; font-size: 15px; font-weight: 500; }
.dlg-foot { display: flex; gap: 8px; padding: 14px 18px 16px; }
.dlg-foot .spacer { flex: 1; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 9px 16px; border-radius: 8px; box-shadow: var(--shadow-pop); opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 50; }
.toast.show { opacity: 1; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } }

/* Darstellung: kompakt */
.dense .tasks > li { min-height: 30px; padding-top: 1px; padding-bottom: 1px; }
.dense .main { padding-top: 16px; }

.offline { background: var(--p1-soft); color: var(--p1); border: 1px solid var(--p1); border-radius: var(--radius); padding: 6px 12px; margin-bottom: 12px; }
.badge-test { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

.chip.ghost { background: transparent; border: 1px dashed color-mix(in srgb, var(--c) 55%, transparent); border-left: 3px dashed var(--c); color: var(--ink-2); }

/* Spracheingabe */
.mic.listening { background: var(--p1-soft); border-color: var(--p1); }
.menu-btn { display: none; }

/* Smartphone / schmale Fenster */
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .app { grid-template-columns: 1fr; grid-template-rows: 52px 1fr; }
  .topbar { gap: 8px; padding: 0 10px; }
  .menu-btn { display: grid; width: 36px; height: 36px; }
  .brand { width: auto; }
  .brand small, .date, .badge-test, .seg, .search kbd, .btn .kbd, .btn-label { display: none; }
  .search { flex: 1; min-width: 0; }
  .btn.primary { padding: 0 11px; }
  .side { position: fixed; z-index: 40; top: 52px; bottom: 0; left: 0; width: min(82vw, 300px); transform: translateX(-102%); transition: transform 0.18s; box-shadow: var(--shadow-pop); }
  .side-open .side { transform: none; }
  .side-open::after { content: ''; position: fixed; inset: 52px 0 0 min(82vw, 300px); background: rgb(0 0 0 / 0.3); z-index: 39; }
  .main { padding: 14px 12px 40px; }
  .view-head { flex-wrap: wrap; }
  .view-head .actions { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .tasks > li, .tasks.compact > li { grid-template-columns: 26px minmax(0, 1fr) auto 36px; min-height: 46px; row-gap: 2px; }
  .tasks .proj-chip, .tasks .status, .tasks > li .icon-btn { display: none; }
  .tasks > li .t-main { grid-column: 2; }
  .chk { width: 22px; height: 22px; }
  .quick { flex-wrap: wrap; }
  .quick input { flex-basis: 100%; height: 46px; }
  .quick .btn { flex: 1; height: 42px; }
  .cal .day { min-height: 58px; padding: 2px; }
  .chip { font-size: 10.5px; padding: 0 3px; }
  .cal .dow { padding: 4px; font-size: 10.5px; }
  .dlg-body { grid-template-columns: 1fr; }
  .focus .headline { font-size: 17px; }
  .ptable .bar { width: 80px; }
}
.t-main[data-act=edit] { cursor: pointer; }
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app > * { min-width: 0; }
  .brand span:last-child { display: none; }
  .search { max-width: none; }
  .search input { min-width: 0; width: 100%; }
  .topbar .spacer { display: none; }
  .tasks > li, .tasks.compact > li { padding-left: 8px; padding-right: 8px; gap: 8px; }
  .due { font-size: 12px; }
  .view { max-width: 100%; }
}
