/* Auftragszentrale – ruhiges, warmes Design im Stil der Claude-App */
:root {
  --bg: #faf9f5; --side: #f0eee6; --surface: #ffffff; --surface-2: #f5f4ed; --hover: #ebe8de; --sel: #e6e2d6;
  --text: #1f1e1d; --text-2: #3d3929; --muted: #73726c; --faint: #a3a198; --border: #e5e2d9; --border-2: #d6d2c4;
  --accent: #c96442; --accent-2: #b5573a; --accent-soft: #f6e8e1; --accent-text: #fff;
  --ok: #2f7d4f; --ok-soft: #e3f1e7; --warn: #9a6a12; --warn-soft: #fbf0d9; --bad: #b3261e; --bad-soft: #fbe5e3;
  --info: #2c5d93; --info-soft: #e3edf8; --violet: #6b4fa0; --violet-soft: #eee8f8;
  --bx: #c96442; --bh: #2c6fb3; --bd: #2f8a5b;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.14);
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 10px; --r-lg: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #262624; --side: #1f1e1d; --surface: #30302e; --surface-2: #2b2b29; --hover: #353532; --sel: #3d3c38;
  --text: #f5f4ef; --text-2: #e3e1d8; --muted: #a6a39a; --faint: #7c7a72; --border: #3a3936; --border-2: #4a4945;
  --accent: #d97757; --accent-2: #e08a6c; --accent-soft: #3d2c25; --accent-text: #1f1e1d;
  --ok: #7cc79a; --ok-soft: #22362a; --warn: #e6b45c; --warn-soft: #3a3020; --bad: #f08b84; --bad-soft: #3d2423;
  --info: #8ab8ea; --info-soft: #23303f; --violet: #b9a3e3; --violet-soft: #2f2a3d;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 8px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}}
:root[data-theme="dark"] {
  --bg: #262624; --side: #1f1e1d; --surface: #30302e; --surface-2: #2b2b29; --hover: #353532; --sel: #3d3c38;
  --text: #f5f4ef; --text-2: #e3e1d8; --muted: #a6a39a; --faint: #7c7a72; --border: #3a3936; --border-2: #4a4945;
  --accent: #d97757; --accent-2: #e08a6c; --accent-soft: #3d2c25; --accent-text: #1f1e1d;
  --ok: #7cc79a; --ok-soft: #22362a; --warn: #e6b45c; --warn-soft: #3a3020; --bad: #f08b84; --bad-soft: #3d2423;
  --info: #8ab8ea; --info-soft: #23303f; --violet: #b9a3e3; --violet-soft: #2f2a3d;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 8px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.grow { flex: 1; }
.hidden { display: none !important; }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Buttons & Felder */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-2);
  background: var(--surface); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 13px; }
.btn.icon { width: 32px; padding: 0; justify-content: center; }
.btn.danger { color: var(--bad); }
input.f, select.f, textarea.f { width: 100%; border: 1px solid var(--border-2); background: var(--surface); border-radius: 8px; padding: 7px 10px; outline: none; }
input.f:focus, select.f:focus, textarea.f:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.f { resize: vertical; min-height: 70px; line-height: 1.45; }
select.f { padding-right: 26px; }
label.chk { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-2); border-radius: 20px; transition: .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }

/* ---------- Marken & Status */
.br { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 5px; font-size: 10.5px; font-weight: 700; color: #fff; flex: none; }
.br.X { background: var(--bx); } .br.H { background: var(--bh); } .br.D { background: var(--bd); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.dot.X { background: var(--bx); } .dot.H { background: var(--bh); } .dot.D { background: var(--bd); }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 22px; font-size: 12px; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.violet { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; font-size: 11px; background: var(--surface-2);
  color: var(--muted); border: 1px solid var(--border); margin-left: 4px; white-space: nowrap; }
.tag.order { color: var(--info); background: var(--info-soft); border-color: transparent; }
.tag.form { color: var(--violet); background: var(--violet-soft); border-color: transparent; }
.tag.claude { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

/* ---------- Grundlayout */
#app { display: flex; height: 100vh; }
#side { width: 256px; flex: none; background: var(--side); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 10px 10px 8px; gap: 2px; }
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.logo { display: flex; align-items: center; gap: 9px; padding: 6px 8px 12px; font-family: var(--serif); font-size: 18px; letter-spacing: -.01em; }
.logo .mark { width: 26px; height: 26px; color: var(--accent); }
.newbtn { display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 10px; margin-bottom: 8px; border-radius: 10px; border: 1px solid var(--border-2);
  background: var(--surface); cursor: pointer; font-weight: 500; box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.newbtn:hover { background: var(--bg); }
.newbtn .plus { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; }
.nav { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px; cursor: pointer; color: var(--text-2); user-select: none; }
.nav:hover { background: var(--hover); }
.nav.on { background: var(--sel); color: var(--text); font-weight: 500; }
.nav .n { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav .n.hot { color: var(--accent-text); background: var(--accent); border-radius: 10px; padding: 0 7px; line-height: 18px; font-weight: 600; }
.side-h { font-size: 11.5px; color: var(--muted); padding: 14px 10px 4px; letter-spacing: .02em; }
.side-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.status-line { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); padding: 0 10px; min-height: 18px; }
.status-line .led { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.status-line .led.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.status-line .led.busy { background: var(--accent); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.user { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px; }
.user .av { width: 28px; height: 28px; border-radius: 50%; background: var(--text-2); color: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 600; }

/* ---------- Kopfleiste im Hauptbereich */
.topbar { height: 52px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.topbar h1 { font-family: var(--serif); font-weight: 400; font-size: 19px; margin: 0; letter-spacing: -.01em; white-space: nowrap; }
.search { position: relative; flex: 1; max-width: 460px; }
.search input { width: 100%; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); padding: 0 12px 0 34px; outline: none; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { position: absolute; left: 11px; top: 9px; color: var(--muted); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 27px; padding: 0 10px; border-radius: 7px; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
#menu-btn { display: none; }

.view { flex: 1; min-height: 0; display: none; }
.view.on { display: flex; }

/* ---------- Postansicht */
#mlist { width: 420px; flex: none; border-right: 1px solid var(--border); overflow-y: auto; background: var(--bg); }
.mrow { display: grid; grid-template-columns: 18px minmax(0, 150px) minmax(0, 1fr) auto; gap: 8px; align-items: center; height: 31px; padding: 0 12px 0 10px;
  border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px; position: relative; }
.mrow:hover { background: var(--hover); }
.mrow.sel { background: var(--sel); }
.mrow.unread { background: var(--surface); }
.mrow.unread .who, .mrow.unread .sub, .mrow.unread .dt { font-weight: 700; color: var(--text); }
.mrow.unread .dt { color: var(--accent); }
.mrow.unread::before { content: ''; position: absolute; left: 3px; top: 12px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.mrow .who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); font-weight: 400; }
.mrow .line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.mrow .line .sub { color: var(--text-2); }
.mrow .dt { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mrow.done .who, .mrow.done .line .sub { color: var(--muted); }
body.comfy .mrow { height: auto; padding-top: 8px; padding-bottom: 8px; grid-template-columns: 18px minmax(0,1fr) auto; grid-template-rows: auto auto; }
body.comfy .mrow .line { grid-column: 2 / 4; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.list-foot { padding: 12px; text-align: center; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty .big { font-family: var(--serif); font-size: 20px; color: var(--text-2); margin-bottom: 6px; }

#reader { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
#rscroll { flex: 1; overflow-y: auto; }
.rwrap { max-width: 860px; margin: 0 auto; padding: 22px 28px 30px; }
.rsubj { font-family: var(--serif); font-size: 24px; line-height: 1.25; margin: 0 0 12px; letter-spacing: -.01em; font-weight: 400; }
.rmeta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); flex: none; }
.rmeta .who b { font-weight: 600; }
.ractions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.mailbody { padding: 18px 20px; overflow-x: auto; }
.mailbody pre { white-space: pre-wrap; word-wrap: break-word; font: 14px/1.55 var(--sans); margin: 0; }
.mailbody iframe { width: 100%; border: 0; min-height: 120px; background: #fff; border-radius: 8px; }
.atts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.att { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-2); font-size: 13px; }
.att:hover { background: var(--hover); text-decoration: none; }
.thread-h { display: flex; align-items: center; gap: 8px; margin: 26px 0 8px; font-size: 13px; color: var(--muted); }
.tl { position: relative; padding-left: 18px; }
.tl::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1.5px; background: var(--border); }
.tli { position: relative; padding: 6px 10px; border-radius: 8px; cursor: pointer; display: grid; grid-template-columns: 100px 1fr; gap: 10px; font-size: 13px; }
.tli:hover { background: var(--hover); }
.tli::before { content: ''; position: absolute; left: -17px; top: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 2px solid var(--border-2); }
.tli.out::before { border-color: var(--accent); }
.tli.cur { background: var(--sel); }
.tli .d { color: var(--muted); font-variant-numeric: tabular-nums; }
.tli .s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Claude-Eingabe (wie in der Claude-App) */
.composer-dock { flex: none; padding: 10px 24px 18px; background: linear-gradient(to bottom, transparent, var(--bg) 30%); }
.composer { max-width: 860px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border-2); border-radius: 18px; box-shadow: var(--shadow); padding: 10px 10px 8px 14px; }
.composer:focus-within { border-color: var(--border-2); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.composer textarea { width: 100%; border: 0; outline: none; resize: none; background: transparent; min-height: 24px; max-height: 220px; line-height: 1.5; padding: 3px 0; }
.composer .row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.composer .chips { display: flex; gap: 6px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; }
.composer .chips::-webkit-scrollbar { display: none; }
.chip { flex: none; white-space: nowrap; }
.chip { height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; }
.chip:hover { background: var(--hover); }
.send { width: 32px; height: 32px; border-radius: 9px; border: 0; background: var(--accent); color: var(--accent-text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.send:disabled { background: var(--border-2); color: var(--muted); cursor: default; }
.composer-dock .hint { font-size: 11.5px; color: var(--faint); text-align: center; margin-top: 6px; }

/* Entwurfskarte im Lesebereich */
.draftcard { margin-top: 18px; border: 1px solid var(--accent); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.draftcard .dh { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 500; }
.draftcard textarea { width: 100%; border: 0; outline: none; padding: 14px 16px; min-height: 260px; resize: vertical; background: var(--surface); font: 14px/1.55 var(--sans); }
.draftcard .df { display: flex; gap: 6px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.draftcard .df .redo { display: flex; gap: 6px; flex: 1 1 260px; min-width: 0; }
.warnbox { margin: 10px 14px 0; padding: 8px 12px; border-radius: 9px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }

/* Kundenpanel rechts */
#info { width: 320px; flex: none; border-left: 1px solid var(--border); background: var(--side); overflow-y: auto; padding: 16px 14px; }
#info h3 { font-family: var(--serif); font-weight: 400; font-size: 17px; margin: 0 0 2px; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 4px 10px; font-size: 13px; margin: 10px 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.ocardmini { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.ocardmini:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.ocardmini .t { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.ocardmini .nr { font-weight: 600; font-variant-numeric: tabular-nums; }
.sec-h { font-size: 11.5px; color: var(--muted); letter-spacing: .03em; text-transform: uppercase; margin: 18px 0 8px; }

/* ---------- Tabellen (Auftraege, Kunden) */
.tablewrap { flex: 1; overflow: auto; }
.filters { display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.t th { position: sticky; top: 0; background: var(--bg); text-align: left; font-weight: 500; color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1; font-size: 12.5px; }
table.t td { padding: 0 10px; height: 34px; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
table.t tr { cursor: pointer; }
table.t tbody tr:hover td { background: var(--hover); }
table.t tr.sel td { background: var(--sel); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nr { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Seitenleiste (Drawer) fuer Auftragsdetails */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--bg); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  z-index: 40; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s ease; }
.drawer.open { transform: none; }
.drawer .dhead { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.drawer .dhead h2 { font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 0; }
.drawer .dbody { flex: 1; overflow-y: auto; padding: 16px 18px 40px; }
.scrim { position: fixed; inset: 0; background: rgba(20,20,19,.25); z-index: 30; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.fgrid .fld { display: flex; flex-direction: column; gap: 4px; }
.fgrid .fld.wide { grid-column: 1 / -1; }
.fgrid label { font-size: 12px; color: var(--muted); }
.files { display: flex; gap: 8px; flex-wrap: wrap; }
.loglist { font-size: 13px; color: var(--text-2); }
.loglist div { padding: 4px 0; border-bottom: 1px dashed var(--border); }
.loglist .d { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 8px; }

/* ---------- Seiten mit Inhalt (Aufgaben, Einstellungen) */
.page { flex: 1; overflow-y: auto; }
.page .inner { max-width: 880px; margin: 0 auto; padding: 26px 28px 60px; }
.page h2 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 0 0 6px; letter-spacing: -.01em; }
.page h3 { font-family: var(--serif); font-weight: 400; font-size: 19px; margin: 28px 0 10px; }
.page p.lead { color: var(--muted); margin: 0 0 18px; }
.task { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; margin-bottom: 8px; }
.task .ic { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--muted); }
.task .ic.hot { background: var(--accent-soft); color: var(--accent); }
.task .ttl { font-weight: 500; }
.setcard { padding: 16px 18px; margin-bottom: 12px; }
.setcard .head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.setcard .head b { font-size: 15px; }
.setgrid { display: grid; grid-template-columns: 150px 1fr 150px 1fr; gap: 8px 12px; align-items: center; }
.setgrid label { font-size: 13px; color: var(--muted); }
.setgrid .span3 { grid-column: 2 / 5; }
.copybox { display: flex; gap: 6px; align-items: center; }
.copybox code { flex: 1; padding: 7px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font: 12.5px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Modal (Mail bearbeiten) */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(20,20,19,.35); }
.modal .box { width: min(920px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--bg); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden; }
.modal .mh { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal .mh b { font-family: var(--serif); font-weight: 400; font-size: 19px; }
.cfields { display: grid; grid-template-columns: 70px 1fr; gap: 6px 10px; padding: 12px 16px 6px; align-items: center; }
.cfields label { color: var(--muted); font-size: 13px; }
.cfields input, .cfields select { border: 0; border-bottom: 1px solid var(--border); background: transparent; padding: 6px 2px; outline: none; border-radius: 0; }
.cfields input:focus, .cfields select:focus { border-bottom-color: var(--accent); }
#cbody { flex: 1; min-height: 300px; margin: 6px 16px; border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface); outline: none; resize: none; font: 14px/1.55 var(--sans); }
#cbody:focus { border-color: var(--border-2); box-shadow: 0 0 0 3px var(--accent-soft); }
.cclaude { display: flex; gap: 6px; margin: 4px 16px 0; }
.cclaude input { flex: 1; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); padding: 0 12px; outline: none; }
.cclaude input:focus { border-color: var(--accent); }
.catt { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 16px; }
.catt span { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; }
.catt b { cursor: pointer; color: var(--muted); }
.mfoot { display: flex; align-items: center; gap: 8px; padding: 10px 16px 14px; }

/* ---------- Anmeldung */
#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 100; padding: 20px; }
#login .lbox { width: 380px; max-width: 100%; text-align: center; }
#login .mark { width: 44px; height: 44px; color: var(--accent); margin-bottom: 14px; }
#login h1 { font-family: var(--serif); font-weight: 400; font-size: 30px; margin: 0 0 6px; letter-spacing: -.01em; }
#login p { color: var(--muted); margin: 0 0 22px; }
#login form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
#login input { height: 42px; }
#login .btn { height: 42px; justify-content: center; font-weight: 500; }
#login .err { color: var(--bad); min-height: 20px; font-size: 13px; text-align: center; }

/* ---------- Toast & Spinner */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  box-shadow: var(--shadow-lg); z-index: 200; opacity: 0; pointer-events: none; transition: .2s; max-width: 90vw; }
#toast.on { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--bad); color: #fff; }
.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.thinking { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: 13px; }
.thinking .mark { width: 18px; height: 18px; animation: sp 2.4s linear infinite; }

/* ---------- Kleine Bildschirme */
@media (max-width: 1280px) { #info { display: none; } #info.force { display: block; position: fixed; right: 0; top: 0; bottom: 0; z-index: 35; box-shadow: var(--shadow-lg); } }
@media (max-width: 980px) {
  #side { position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  #side.open { transform: none; }
  #menu-btn { display: inline-flex; }
  #mlist { width: 100%; border-right: 0; }
  #reader { display: none; position: fixed; inset: 0; z-index: 25; }
  body.reading #reader { display: flex; }
  #back-btn { display: inline-flex !important; }
  .setgrid { grid-template-columns: 1fr; } .setgrid .span3 { grid-column: auto; }
  .fgrid { grid-template-columns: 1fr; }
  .search { max-width: none; }
  .topbar h1 { display: none; }
}
#back-btn { display: none; }

/* ---------- Scans */
.dropzone { display: block; border: 2px dashed var(--border-2); border-radius: var(--r-lg); padding: 28px; text-align: center; color: var(--muted); background: var(--surface); cursor: pointer; transition: .15s; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone b { color: var(--text); }
.scangrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 18px; }
.scancard { overflow: hidden; display: flex; flex-direction: column; }
.scancard .thumb { height: 220px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; border-bottom: 1px solid var(--border); cursor: zoom-in; }
.scancard .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.scancard .body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.scancard .nm { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scancard .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.8); display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; }
.lightbox iframe, .lightbox img { max-width: 95vw; max-height: 92vh; width: auto; background: #fff; border: 0; border-radius: 8px; }
.lightbox iframe { width: 90vw; height: 92vh; }
