:root {
  --bg: #f5f7f7; --card: #ffffff; --fg: #142022; --muted: #5d6b6e; --line: #dde3e4;
  --accent: #0f766e; --accent-fg: #ffffff; --warn: #b45309; --err: #b91c1c; --ok: #15803d;
  --chip: #eef3f3; --me: #e6f2f1;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1416; --card: #13201f; --fg: #e5eeee; --muted: #93a3a5; --line: #24393a;
    --accent: #2dd4bf; --accent-fg: #062523; --warn: #f59e0b; --err: #f87171; --ok: #4ade80;
    --chip: #1b2e2e; --me: #173230;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 96px; }
a { color: var(--accent); }
h1 { font-size: 1.8rem; margin: .2em 0; }
h2 { font-size: 1.1rem; margin: .4em 0 .6em; }
.accent, .brand span { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.warn { color: var(--warn); }
.error, .danger { color: var(--err); }
.good { color: var(--ok); }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; color: var(--fg); }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; text-align: center; padding: 8px 0 6px; font-size: .75rem; color: var(--muted); text-decoration: none; }
.tabs a b { display: block; font-size: 1.2rem; line-height: 1.2; }
.tabs a.on { color: var(--accent); }

.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0;
  color: inherit; text-decoration: none; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row > textarea { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: end; }
.span3 { grid-column: span 3; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } .grid3 { grid-template-columns: 1fr 1fr; } .span3 { grid-column: span 2; } }

input, textarea, select { width: 100%; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 10px; margin: 4px 0; }
textarea { resize: vertical; }
#source { font-size: 15px; line-height: 1.55; min-height: 50vh; }
label { display: block; font-size: .85rem; color: var(--muted); }
label input, label select { color: var(--fg); font-size: 1rem; }
label.radio { display: inline-flex; gap: 6px; align-items: center; font-size: 1rem; color: var(--fg); }
label.radio input { width: auto; }
.lbl { margin-top: 10px; }
input.title { font-size: 1.15rem; font-weight: 600; border: none; background: transparent; padding-left: 0; }

button, .button { font: inherit; display: inline-block; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--chip); color: var(--fg); cursor: pointer; text-decoration: none; white-space: nowrap; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
button.big { width: 100%; padding: 14px; font-size: 1.1rem; margin-top: 12px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.link { background: none; border: none; padding: 4px; color: var(--accent); }
button.link.danger { color: var(--err); }
.file { display: inline-block; padding: 9px 12px; border: 1px dashed var(--line); border-radius: 8px; color: var(--fg); cursor: pointer; font-size: .95rem; }
.file input { display: none; }
form.inline { display: inline; }

.center { max-width: 420px; margin: 12vh auto 0; text-align: center; }
.note { padding: 8px 12px; border-radius: 8px; background: var(--chip); }
.note.ok { border-left: 4px solid var(--ok); }
.note.err { border-left: 4px solid var(--err); }
.pill { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--chip); color: var(--muted); }
.s-geplant { background: #dbeafe; color: #1e3a8a; }
.s-freigegeben { background: #fef3c7; color: #78350f; }
.s-veroeffentlicht { background: #dcfce7; color: #14532d; }
.s-fehler { background: #fee2e2; color: #7f1d1d; }
.s-wird_veroeffentlicht { background: #ede9fe; color: #4c1d95; }
.f-ok { background: #dcfce7; color: #14532d; }
.f-knapp { background: #fef3c7; color: #78350f; }
.f-zu-lang { background: #fee2e2; color: #7f1d1d; }

.capture textarea { min-height: 84px; }
.idea { display: flex; gap: 10px; align-items: flex-start; }
.idea img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; }
.idea.status-verworfen { opacity: .5; }
.clip { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; white-space: pre-line; overflow-wrap: anywhere; }
.meta { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.media-grid img, .media-grid video { width: 100%; border-radius: 8px; display: block; }
.media-grid .attached img, .media-grid .attached video { outline: 3px solid var(--accent); }

details summary { cursor: pointer; font-weight: 600; }
.hooks { padding-left: 18px; margin: 4px 0; }
.counter { font-size: .85rem; color: var(--muted); margin: -2px 0 6px; }
.preview { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); padding: 10px; border-radius: 8px; font: inherit; font-size: .95rem; }

.msg { padding: 8px 10px; border-radius: 10px; margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { background: var(--me); margin-left: 15%; }
.msg.assistant { background: var(--chip); margin-right: 8%; }
.msg.busy { font-style: italic; color: var(--muted); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.metric { padding: 6px 0; border-bottom: 1px solid var(--line); }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.dow { text-align: center; font-size: .75rem; color: var(--muted); }
.day { min-height: 72px; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 2px 3px; overflow: hidden; }
.day.other { opacity: .45; }
.day.today { border-color: var(--accent); border-width: 2px; }
.dnum { font-size: .75rem; color: var(--muted); }
.ev { display: block; font-size: .68rem; line-height: 1.25; padding: 2px 3px; margin-top: 2px; border-radius: 4px; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--chip); color: var(--fg); }
.legend .ev { display: inline-block; }

.table-wrap { overflow-x: auto; }
table.log { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.log th, table.log td { text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.log .r { text-align: right; white-space: nowrap; }
code { font-size: .85em; overflow-wrap: anywhere; }
.msg .who { display: block; font-size: .72rem; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.msg button.take { margin-top: 6px; padding: 6px 10px; font-size: .85rem; }
select.model { width: auto; flex: 1; }
.bridge { margin-top: 10px; }
