/* Aufgaben – layout and components. All colors and shapes come from the
   theme variables (public/themes/*.json, see docs/themes.md). The values
   below are the Graphit defaults used before a theme is loaded. */

:root {
  --bg: #111318; --panel: #1a1d24; --card: #222631;
  --text: #e5e7eb; --muted: #9ca3af; --line: #2f3542;
  --accent: #e5e7eb; --overdue: #fb8c8c; --today: #fbbf24;
  --timer: #4ade80; --on-timer: #0b0d10;
  --c-q1: #f87171; --c-q2: #60a5fa; --c-q3: #fbbf24; --c-q4: #a1a7b3;
  --c-inbox: #a78bfa; --c-wv: #2dd4bf; --c-done: #4ade80;
  --radius: 10px; --card-radius: 7px; --tint: 13%; --q-border: 0px; --head-dot: none;
  --hover: color-mix(in srgb, var(--text) 8%, var(--card));
  --gap: 8px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.icon { width: 18px; height: 18px; flex: none; display: block; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- shell: wide (sidebar + main) ---------- */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); height: 100vh; }
.bottom-bar, .backdrop, .area-line { display: none; }

.sidebar {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.side-head { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px 12px 6px; }
.side-head .sync-dot { margin-right: auto; }
.side-head h1 { font-size: 15px; margin: 0; flex: 1; font-weight: 600; }

/* ---------- Bereiche ---------- */
.area-switch { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px 8px; }
.area-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); font-size: 12px; color: var(--text);
}
.area-pill .icon { width: 14px; height: 14px; color: var(--muted); }
.area-pill:hover { background: var(--hover); }
.area-pill.active { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.area-pill.active .icon { color: var(--bg); }
.area-tag { display: inline-grid; place-items: center; color: var(--muted); flex: none; }
.area-tag .icon { width: 15px; height: 15px; }
.area-line {
  align-items: center; gap: 8px; width: 100%; padding: 6px 4px; border: 0; background: none; cursor: pointer;
  color: var(--text); font-weight: 600; font-size: 13px; text-align: left;
}
.area-line .icon { width: 17px; height: 17px; color: var(--muted); }
.area-line .chevron { display: block; width: 14px; height: 14px; }
.area-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.area-row { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 2px; background: var(--card); border-radius: var(--card-radius); }
.area-row .area-icon { width: 17px; height: 17px; color: var(--muted); }
.area-row .area-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-row .area-count { color: var(--muted); font-size: 12px; min-width: 1.5em; text-align: right; }
.add-area { align-self: flex-start; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; }
.icon-choice {
  display: grid; place-items: center; height: 38px; border: 1px solid var(--line); border-radius: var(--card-radius);
  background: var(--card); color: var(--muted); cursor: pointer;
}
.icon-choice .icon { width: 20px; height: 20px; }
.icon-choice.active { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.device-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.device-row { display: flex; align-items: center; gap: 4px; padding: 5px 4px 5px 10px; background: var(--card); border-radius: var(--card-radius); }
.device-row.current { outline: 1px solid var(--line); }
.device-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.device-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-meta { font-size: 12px; color: var(--muted); }
.danger-icon { color: var(--overdue); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.chip.files { display: inline-flex; align-items: center; gap: 2px; }
.chip.files .icon { width: 11px; height: 11px; }
.attachments h3 { font-size: 12px; margin: 0 0 4px; color: var(--muted); font-weight: 600; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.thumb { width: 72px; height: 72px; padding: 0; border: 1px solid var(--line); border-radius: var(--card-radius); overflow: hidden; background: var(--panel); cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.broken { background: var(--hover); }
.att-list { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.att, .upload { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.att-icon { width: 18px; height: 18px; color: var(--muted); }
.att-name { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 3px 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-name:hover { text-decoration: underline; }
.att-size { color: var(--muted); font-size: 12px; white-space: nowrap; }
.att .icon-btn { width: 28px; height: 28px; }
.upload .bar { width: 90px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.upload .bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.att-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.file-btn { cursor: pointer; }
.btn.camera-btn { display: none; }
.drop-hint { font-size: 12px; color: var(--muted); }
.drop-target { outline: 2px dashed var(--accent) !important; outline-offset: -2px; }
.preview { width: min(920px, calc(100vw - 24px)); }
.modal:has(.preview) { width: min(960px, calc(100vw - 24px)); }
.preview-img { max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--card-radius); background: var(--bg); align-self: center; }
.modal-actions.row { flex-direction: row; flex-wrap: wrap; }
.quota-text { margin: 0; font-size: 13px; color: var(--muted); }
.quota-bar { display: block; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.quota-bar > i { display: block; height: 100%; width: 0; background: var(--accent); }
.quota-form { display: flex; align-items: flex-end; gap: 8px; }
.quota-form .field { flex: 1; }
.mail-section { display: flex; flex-direction: column; gap: 6px; }
.mail-section .hint, .mail-section .error { margin: 0; font-size: 13px; }
.mail-section .hint { color: var(--muted); }
.mail-address { display: flex; align-items: center; gap: 6px; padding: 5px 4px 5px 10px; background: var(--card); border-radius: var(--card-radius); }
.mail-address > .icon { width: 16px; height: 16px; color: var(--muted); flex: none; }
.mail-addr { flex: 1; min-width: 0; overflow-wrap: anywhere; user-select: all; font-weight: 600; }
.mail-senders { width: 100%; box-sizing: border-box; resize: vertical; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
.mail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mail-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.mail-entry { display: flex; flex-direction: column; padding: 5px 10px; background: var(--card); border-radius: var(--card-radius); }
.mail-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-meta { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.mail-entry.rejected .mail-subject { color: var(--muted); }
.check-label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.modal input.check { width: 16px; height: 16px; padding: 0; }
.area-option { justify-content: flex-start; }
.area-option.active { border-color: var(--accent); }
.reordering { opacity: .6; background: var(--hover); border-radius: 5px; }
.reordering .grip { cursor: grabbing; }
.side-scroll { flex: 1; overflow-y: auto; padding: 0 10px 12px; display: flex; flex-direction: column; gap: 12px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: var(--card-radius);
  background: none; cursor: pointer; text-align: left;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--card); }
.nav-item .nav-label { flex: 1; }
.nav-item .count { color: var(--muted); font-size: 12px; }
.nav-matrix .icon { color: var(--muted); }
.nav-wv .icon { color: var(--c-wv); }
.nav-done .icon { color: var(--c-done); }

.main { display: flex; flex-direction: column; gap: var(--gap); padding: var(--gap); min-height: 0; overflow: hidden; }
.matrix {
  flex: 1; min-height: 0; display: grid; gap: var(--gap);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
}
.list-view { flex: 1; min-height: 0; display: flex; }
.list-view .section { flex: 1; }

.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-done); flex: none; }
.sync-syncing { background: var(--accent); }
.sync-offline { background: var(--muted); }
.sync-error { background: var(--overdue); }

/* ---------- sections ---------- */
.sec-q1 { --area: var(--c-q1); } .sec-q2 { --area: var(--c-q2); }
.sec-q3 { --area: var(--c-q3); } .sec-q4 { --area: var(--c-q4); }
.sec-inbox { --area: var(--c-inbox); } .sec-wv { --area: var(--c-wv); } .sec-done { --area: var(--c-done); }

.section {
  background: color-mix(in srgb, var(--area) var(--tint), var(--panel));
  border: var(--q-border) solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
}
.section-head {
  display: flex; align-items: center; gap: 7px; width: 100%; padding: 9px 11px 6px;
  background: none; border: 0; text-align: left; font-weight: 600; font-size: 13px;
  color: var(--head, var(--area)); cursor: default;
}
.head-dot { display: var(--head-dot); width: 8px; height: 8px; border-radius: 50%; background: var(--area); flex: none; }
.section-title { flex: 1; }
.section-head .count { font-weight: 500; color: var(--muted); font-size: 12px; }
.chevron { display: none; width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.section-body { padding: 0 8px 8px; display: flex; flex-direction: column; gap: 6px; min-height: 0; flex: 1; }
.list { list-style: none; margin: 0; padding: 0 2px 0 0; display: flex; flex-direction: column; gap: 5px; min-height: 36px; overflow-y: auto; flex: 1; }
.item { list-style: none; }
.empty { margin: 4px 2px; color: var(--muted); font-size: 13px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--muted);
  font-weight: 500; cursor: pointer; padding: 2px 8px 2px 0; margin-right: 4px; border-right: 1px solid var(--line);
}
.back-btn .icon { width: 16px; height: 16px; }
.back-btn:hover { color: var(--text); }

/* the Eingang lives in the sidebar: no box around it */
.sidebar .section { background: none; border: 0; overflow: visible; flex: none; } /* never shrink: the sidebar scrolls instead */
.sidebar .section-head { padding: 4px 2px 6px; }
.sidebar .section-body { padding: 0; }
.sidebar .list { overflow: visible; }

/* ---------- quick add ---------- */
.quick-add input {
  width: 100%; padding: 6px 9px; border: 1px dashed color-mix(in srgb, var(--area, var(--muted)) 35%, var(--line));
  border-radius: var(--card-radius); background: transparent;
}
.quick-add input::placeholder { color: var(--muted); }
.quick-add input:focus { border-style: solid; background: var(--card); }

/* ---------- timer strip ---------- */
.timer-strip {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 12px; flex: none;
  background: color-mix(in srgb, var(--timer) 14%, var(--panel)); border-radius: var(--radius);
}
.strip-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; background: none; border: 0; padding: 2px 0; cursor: pointer; text-align: left; }
.strip-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-meta { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-clock { font: 600 16px/1 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--timer); font-variant-numeric: tabular-nums; }
.strip-stop {
  display: inline-flex; align-items: center; gap: 4px; border: 0; border-radius: var(--card-radius);
  background: var(--timer); color: var(--on-timer); font-weight: 600; padding: 5px 11px; cursor: pointer;
}
.strip-stop .icon { width: 15px; height: 15px; }
.run-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--timer); flex: none; animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .run-dot { animation: none; } }

.filter-banner {
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap); padding: 6px 10px; flex: none;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel)); border-radius: var(--radius);
}

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--card-radius); }
.card.open { outline: 1px solid color-mix(in srgb, var(--area, var(--accent)) 55%, transparent); }
.card.is-done .card-title { text-decoration: line-through; color: var(--muted); }
.card-row { display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px 8px; min-height: 36px; cursor: grab; }
.card-title {
  flex: 1; min-width: 5.5em; /* the title always stays readable; chips give way */ text-align: left; background: none; border: 0; padding: 5px 2px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card.open .card-title { white-space: normal; font-weight: 600; }
.check {
  appearance: none; width: 16px; height: 16px; margin: 0; flex: none; cursor: pointer;
  border: 1.5px solid var(--muted); border-radius: 4px; background: transparent; display: grid; place-items: center;
}
.check:checked { background: var(--c-done); border-color: var(--c-done); }
.check:checked::after { content: ""; width: 4px; height: 8px; border: solid var(--bg); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; flex: 0 1 auto; min-width: 0; max-width: 58%; }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--hover); color: var(--muted); white-space: nowrap; }
.chip.due.today { background: color-mix(in srgb, var(--today) 20%, var(--card)); color: var(--today); font-weight: 600; }
.chip.due.overdue { background: color-mix(in srgb, var(--overdue) 18%, var(--card)); color: var(--overdue); font-weight: 600; }
.chip.urgent { color: var(--today); }
.chip.wv, .chip.returned { background: color-mix(in srgb, var(--c-wv) 16%, var(--card)); color: var(--c-wv); }
.chip.time.over { color: var(--overdue); }

.icon-btn {
  flex: none; width: 30px; height: 30px; border: 0; border-radius: var(--card-radius); background: none; cursor: pointer;
  color: var(--muted); display: inline-grid; place-items: center; position: relative;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn .icon { width: 17px; height: 17px; }
.timer-btn.on { color: var(--timer); }
.details-btn.up .icon { transform: rotate(180deg); }

.card-body { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 9px; border-top: 1px solid var(--line); cursor: default; }
.title-input, .notes, .sub-title, .field input, .manual-time input, .manual-time select, .modal input, .modal select, .login input {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: calc(var(--card-radius) - 2px); background: var(--panel);
}
.title-input { font-weight: 600; }
.notes { resize: vertical; min-height: 56px; }
.invalid { border-color: var(--overdue) !important; }
.links { margin: 0; padding-left: 18px; font-size: 13px; }
.links a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.field input { color: var(--text); font-size: 13px; }

.subtasks h3 { font-size: 12px; margin: 0 0 4px; color: var(--muted); font-weight: 600; }
.sub-list { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sub-row { display: flex; align-items: center; gap: 6px; }
.sub-title { border-color: transparent; background: transparent; padding: 3px 5px; }
.sub-title:hover, .sub-title:focus { border-color: var(--line); background: var(--panel); }
.sub.is-done .sub-title { text-decoration: line-through; color: var(--muted); }
.sub-body { padding: 6px 0 6px 22px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.sub-body .fields { width: 100%; }
.sub-add input { font-size: 13px; }

.times summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.time-list { list-style: none; margin: 6px 0; padding: 0; font-size: 12px; }
.time-list li { display: flex; gap: 8px; align-items: center; padding: 1px 0; border-bottom: 1px dotted var(--line); }
.time-list .when { flex: 1; }
.time-list .who { color: var(--muted); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.time-list .dur { font-variant-numeric: tabular-nums; }
.manual-time { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.manual-time input, .manual-time select { width: auto; flex: 1 1 90px; font-size: 13px; }
.est { max-width: 110px; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.drag-ghost { opacity: .4; }
.sortable-chosen .card { box-shadow: 0 6px 18px rgb(0 0 0 / .3); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--card-radius); background: var(--card); cursor: pointer;
}
.btn .icon { width: 16px; height: 16px; }
.btn:hover { background: var(--hover); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.small .icon { width: 14px; height: 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.btn.danger { color: var(--overdue); }
.btn.ghost { border-color: transparent; background: none; }
.btn:disabled { opacity: .6; cursor: default; }

/* ---------- calendar ---------- */
.calendar { display: flex; flex-direction: column; gap: 4px; }
.cal-head { display: flex; align-items: center; gap: 2px; }
.cal-title { flex: 1; text-align: left; font-weight: 600; background: none; border: 0; padding: 4px 2px; cursor: pointer; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.cal-wd { text-align: center; font-size: 11px; color: var(--muted); padding: 2px 0; }
.cal-day {
  border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; height: 30px; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.cal-day:hover { background: var(--hover); }
.cal-day.other .num { color: var(--muted); opacity: .5; }
.cal-day.today { border-color: var(--accent); font-weight: 700; }
.cal-day.selected { background: var(--accent); color: var(--bg); }
.cal-day .num { font-size: 12px; }
.dots { display: flex; gap: 2px; height: 4px; }
.dot { display: inline-block; width: 4px; height: 4px; border-radius: 50%; }
.dot.due { background: var(--overdue); }
.dot.urgent { background: var(--today); }
.dot.wv { background: var(--c-wv); }

/* ---------- dialogs ---------- */
.modal {
  border: 1px solid var(--line); border-radius: calc(var(--radius) + 2px); padding: 0; background: var(--panel); color: var(--text);
  width: min(420px, calc(100vw - 24px)); box-shadow: 0 10px 40px rgb(0 0 0 / .4);
}
.modal::backdrop { background: rgb(0 0 0 / .5); }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.modal h2 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.modal p { margin: 0; color: var(--muted); }
.modal-actions, .menu-list { display: flex; flex-direction: column; gap: 6px; }
.menu-label { font-size: 12px; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.menu-grid .btn { justify-content: flex-start; border-left: 3px solid var(--line); }
.menu-grid .col-inbox { border-left-color: var(--c-inbox); }
.menu-grid .col-q1 { border-left-color: var(--c-q1); }
.menu-grid .col-q2 { border-left-color: var(--c-q2); }
.menu-grid .col-q3 { border-left-color: var(--c-q3); }
.menu-grid .col-q4 { border-left-color: var(--c-q4); }
.quick-dates { display: flex; gap: 6px; flex-wrap: wrap; }
.error { color: var(--overdue); margin: 0; min-height: 1em; }
.theme-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.theme-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--card-radius); background: var(--card); text-align: left;
}
.theme-option.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.swatches { display: flex; gap: 3px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgb(127 127 127 / .4); }
.theme-name { font-weight: 600; }
.theme-mode { font-size: 11px; color: var(--muted); }

/* ---------- login ---------- */
.login {
  max-width: 320px; margin: 12vh auto; padding: 24px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); display: flex; flex-direction: column; gap: 8px;
}

.login .field span { color: var(--muted); }

/* ---------- search ---------- */
.side-search { position: relative; margin: 2px 12px 8px; }
.side-search > .icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search-input {
  width: 100%; padding: 6px 9px 6px 30px; border: 1px solid var(--line); border-radius: var(--card-radius); background: var(--bg);
}
.sec-search { --area: var(--accent); background: var(--panel); }
.sec-search .section-body { overflow-y: auto; }
.result-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.result-head { display: flex; align-items: center; gap: 7px; margin: 4px 2px 0; font-size: 12px; font-weight: 600; color: var(--head, var(--area)); }
.result-head .count { color: var(--muted); font-weight: 500; }
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }

/* ---------- toast (undo) ---------- */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 12px; max-width: min(560px, calc(100vw - 24px));
  padding: 9px 10px 9px 14px; border-radius: var(--radius); background: var(--text); color: var(--bg);
  box-shadow: 0 8px 28px rgb(0 0 0 / .35); font-size: 13px;
}
.toast-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-action {
  border: 0; background: none; color: var(--bg); font-weight: 700; cursor: pointer; padding: 3px 6px;
  border-radius: 5px; text-decoration: underline; text-underline-offset: 2px;
}
.toast-action:hover { background: color-mix(in srgb, var(--bg) 15%, transparent); }

/* ---------- subtask grip, entry edit, forgotten timer ---------- */
.grip { display: inline-grid; place-items: center; color: var(--muted); cursor: grab; opacity: .55; touch-action: none; }
.grip .icon { width: 15px; height: 15px; }
.sub-row:hover .grip { opacity: 1; }

.time-list .icon-btn { width: 26px; height: 26px; }
.time-list .icon-btn .icon { width: 14px; height: 14px; }
.modal input[type="datetime-local"] { color: var(--text); }
.forgotten-timer h2 { display: flex; align-items: center; gap: 6px; }
.forgotten-timer h2 .icon { color: var(--timer); }

/* ---------- narrow: phone and pinned side window ---------- */
@media (max-width: 899px) {
  :root { --bar-h: calc(60px + env(safe-area-inset-bottom)); }
  .shell { display: block; height: auto; min-height: 100vh; }
  .bottom-bar {
    display: flex; align-items: center; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    height: var(--bar-h); padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: var(--panel); border-top: 1px solid var(--line);
  }
  .bottom-bar .icon-btn { width: 44px; height: 44px; color: var(--text); }
  .bottom-bar .icon-btn .icon { width: 22px; height: 22px; }
  .bar-search { flex: 1; min-width: 0; position: relative; display: flex; align-items: center; }
  .bar-search > .icon { position: absolute; left: 11px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
  .bar-search .search-input { height: 44px; padding-left: 36px; padding-right: 40px; font-size: 16px; } /* 16px: no zoom on focus */
  .bar-search .bar-clear { position: absolute; right: 2px; width: 40px; height: 40px; }
  .bar-add { background: var(--accent) !important; color: var(--bg) !important; }
  .bar-add:hover { background: var(--accent); }
  .badge {
    position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
    background: var(--c-inbox); color: var(--bg); font-size: 11px; font-weight: 700; line-height: 14px; text-align: center;
    border: 2px solid var(--panel);
  }
  .sidebar {
    position: fixed; top: 0; bottom: var(--bar-h); left: 0; z-index: 40; width: min(310px, 86vw);
    transform: translateX(-104%); transition: transform .2s ease; box-shadow: 4px 0 24px rgb(0 0 0 / .35);
  }
  .drawer-open .sidebar { transform: none; }
  .side-search { display: none; }
  .backdrop { position: fixed; top: 0; left: 0; right: 0; bottom: var(--bar-h); z-index: 30; background: rgb(0 0 0 / .5); }
  .drawer-open .backdrop { display: block; }
  .main { overflow: visible; padding: 8px 8px calc(var(--bar-h) + 16px); }
  .timer-strip { position: sticky; top: 0; z-index: 15; box-shadow: 0 0 0 8px var(--bg); }
  .strip-meta, .strip-stop-label { display: none; }
  .area-line { display: flex; }
  .matrix { display: flex; flex-direction: column; }
  .matrix .sec-q1 { order: 1; } .matrix .sec-q3 { order: 2; } .matrix .sec-q2 { order: 3; } .matrix .sec-q4 { order: 4; }
  .section { overflow: visible; }
  .list { overflow: visible; }
  .section-head { cursor: pointer; }
  .chevron { display: block; }
  .collapsed .chevron { transform: rotate(-90deg); }
  .collapsed .section-body { display: none; }
  .list-view { display: block; }
  .sec-search .section-body { overflow: visible; }
  .icon-btn { width: 34px; height: 34px; }
  .chips { max-width: 50%; }
  .chip.origin { display: none; } /* keeps room for the title */
  .btn.camera-btn { display: inline-flex; }
  .drop-hint { display: none; }
  .toast { bottom: calc(var(--bar-h) + 12px); }
}

@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
