/* Safelexx Office – Oberfläche
   Im Erscheinungsbild der Safelexx-Website: Anthrazit (Logo-Grau), Orange #F05A0E, Bernstein #FFAA00, Schrift Inter.
   Immer heller Modus (auch wenn macOS/iOS auf dunkel steht). Akzentfarbe aus den Firmeneinstellungen (--brand). */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand: #F05A0E;
  --brand-soft: #c94a0b;          /* Akzent als Textfarbe (besser lesbar) */
  --brand-grad: linear-gradient(90deg, #F05A0E, #FFAA00);
  --signal: #FFAA00;
  --chrome: #242425;              /* Logo-Grau (Akzentflächen) */
  --chrome-2: #323233;
  --ink: #323233;                 /* Überschriften auf Belegen */
  --bg: #F3F5F8;
  --surface: #ffffff;
  --surface-2: #F7F9FC;
  --text: #1A1E2A;
  --muted: #5A6478;
  --border: #E4E9F0;
  --border-strong: #CED5DF;
  --ok: #1e7f4a;
  --ok-bg: #e7f5ec;
  --warn: #a5650b;
  --warn-bg: #fdf3e1;
  --danger: #b4301f;
  --danger-bg: #fbeceb;
  --info-bg: #FFF4EC;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .14);
  --sidebar: 244px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}


* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
a { color: inherit; }
a:hover { color: var(--brand-soft); }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1rem; font-weight: 650; margin-bottom: .9rem; display: flex; align-items: center; gap: .4rem; }
p { margin: 0 0 .75rem; }
code { font-family: var(--mono); font-size: .92em; }
/* Nummern (Belege, Kunden, Beleg-Nr. …) in der Hausschrift Inter – Ziffern gleich breit, damit Spalten sauber fluchten */
.mono { font-family: inherit; font-variant-numeric: tabular-nums; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: .05em .35em; }
address { font-style: normal; }
[hidden] { display: none !important; }

.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.icon-sm { width: 15px; height: 15px; vertical-align: -2px; }
.icon-xs { width: 12px; height: 12px; vertical-align: -1px; }

.muted { color: var(--muted); }
.small { font-size: .84rem; }
.center { text-align: center; }
.pad { padding: 2rem 1rem; }
.pre { white-space: pre-line; }
.strike { text-decoration: line-through; color: var(--muted); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.danger { color: var(--danger); }
.nowrap { white-space: nowrap; }
.mt-s { margin-top: .5rem; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: .85rem; }

/* ---------- Grundlayout ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  background: var(--surface); color: var(--text); display: flex; flex-direction: column;
  padding: calc(22px + env(safe-area-inset-top)) 12px 12px; border-right: 1px solid var(--border);
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; text-decoration: none; color: var(--text); padding: 2px 12px 22px; }
.brand:hover { color: var(--text); }
.brand-logo { display: block; width: 156px; height: auto; }
.brand-sub { font-size: .66rem; font-weight: 600; text-transform: uppercase; letter-spacing: .32em; color: var(--muted); padding-left: 2px; }
.brand-sub::before { content: ""; display: inline-block; width: 16px; height: 2px; background: var(--brand-grad); vertical-align: middle; margin-right: 8px; transform: skewX(-35deg); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-divider { height: 1px; background: var(--border); margin: 10px 12px; }
.nav-section { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; opacity: .45; padding: 16px 12px 5px; }
.nav-item {
  display: flex; align-items: center; gap: .75rem; padding: 9px 12px; border-radius: var(--radius-sm);
  color: #3d4556; text-decoration: none; font-size: .94rem; font-weight: 500;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--info-bg); color: var(--text); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.nav-item.active .icon { color: var(--brand); }
.sidebar-foot { display: flex; align-items: center; gap: .4rem; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; }
.sidebar-foot .icon-btn { color: var(--muted); }
.sidebar-foot .icon-btn:hover { background: var(--surface-2); color: var(--text); }
.user-chip { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; text-decoration: none; color: var(--text); padding: 4px; border-radius: 8px; }
.user-chip:hover { color: var(--text); background: var(--surface-2); }
.user-chip-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-chip-text strong { font-size: .86rem; }
.user-chip-text small { font-size: .74rem; opacity: .6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--brand-grad); color: #fff; font-weight: 700; font-size: .85rem;
}
.avatar-lg { width: 42px; height: 42px; font-size: 1rem; background: var(--info-bg); color: var(--brand-soft); }

.main { margin-left: var(--sidebar); padding: calc(28px + env(safe-area-inset-top)) 36px 120px; max-width: calc(1280px + var(--sidebar)); }
.topbar { display: none; }
.scrim { display: none; }

@media (max-width: 900px) {
  .topbar {
    display: flex; align-items: center; gap: .5rem; position: sticky; top: 0; z-index: 30;
    height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0;
    background: var(--surface); color: var(--text); border-bottom: 2px solid var(--brand);
  }
  .topbar .icon-btn { color: var(--text); }
  .topbar-brand { flex: 1; display: flex; align-items: center; text-decoration: none; color: var(--text); font-weight: 650; font-size: 1.02rem; }
  .topbar-brand img { width: 118px; height: auto; display: block; }
  .topbar-brand:hover { color: var(--text); }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); padding-top: calc(18px + env(safe-area-inset-top)); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 35; }
  .main { margin-left: 0; padding: 18px 14px 120px; }
  h1 { font-size: 1.3rem; }
  .hide-sm { display: none !important; }
}
@media (max-width: 1150px) { .hide-md { display: none !important; } }

/* ---------- Seitenkopf ---------- */
.page-head { display: flex; flex-direction: column; align-items: flex-start; gap: .9rem; margin-bottom: 1.25rem; }
/* Aktions-Buttons links unter dem Titel; Hauptaktion (im HTML zuletzt) steht ganz links */
.page-head > .actions { flex-direction: row-reverse; justify-content: flex-end; }
.page-head h1 { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.page-head p { margin: .3rem 0 0; }
.back { display: inline-block; font-size: .85rem; color: var(--muted); text-decoration: none; margin-bottom: .35rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.subnav { display: flex; gap: .25rem; margin-top: .7rem; flex-wrap: wrap; }
.subnav-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: calc(100vw - 28px); }
.subnav-item {
  padding: .38rem .75rem; border-radius: 999px; text-decoration: none; font-size: .88rem; color: var(--muted);
  white-space: nowrap; display: inline-flex; align-items: center; gap: .35rem;
}
.subnav-item:hover { background: var(--surface); color: var(--text); }
.subnav-item.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

/* ---------- Karten, Tabellen ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.table-card { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th {
  text-align: left; font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: var(--surface-2); padding: .65rem 1rem; border-bottom: 1px solid var(--border);
}
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:hover td { background: var(--surface-2); }
.row-link { text-decoration: none; font-weight: 550; }
tr.is-draft td { color: var(--muted); }
tr.inactive td { opacity: .55; }

@media (max-width: 640px) {
  .table th, .table td { padding: .6rem .7rem; }
}

/* ---------- Badges, Tags, Chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .25rem; padding: .12rem .55rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border); vertical-align: middle;
}
.badge-customer, .badge-st-accepted, .badge-st-paid, .badge-st-done { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge-lead, .badge-st-open { background: var(--info-bg); color: var(--brand-soft); border-color: transparent; }
.badge-partner, .badge-supplier { background: #efeaf8; color: #5b3e95; border-color: transparent; }
.badge-overdue, .badge-st-rejected { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge-partial { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge-st-cancelled, .badge-inactive { text-decoration: line-through; }
.badge-st-draft { border-style: dashed; }

.tag { display: inline-block; font-size: .74rem; padding: .05rem .45rem; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.tags { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .6rem; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip {
  padding: .32rem .75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  text-decoration: none; font-size: .85rem; color: var(--muted); white-space: nowrap;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.active:hover { color: #fff; }
.chip-warn.active { background: var(--danger); border-color: var(--danger); }
.sent-mark { color: var(--muted); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.search { position: relative; flex: 1 1 260px; max-width: 420px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 36px; }
.toolbar select { width: auto; }
.summary-bar { display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: .9rem; margin: 0 0 .75rem; padding: 0 .25rem; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; }

/* ---------- Formulare ---------- */
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .55rem .7rem;
  transition: border-color .12s, box-shadow .12s; min-height: 40px;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }

input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--brand); }
input[type=color] { padding: 3px; height: 40px; width: 80px; }
input[type=file] { padding: .45rem; }
fieldset { border: 0; padding: 0; margin: 0 0 .5rem; }
legend { font-weight: 650; margin-bottom: .6rem; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > span:first-child { font-size: .82rem; font-weight: 550; color: var(--muted); }
.field-error { color: var(--danger); font-size: .8rem; }
.field-hint { color: var(--muted); font-size: .78rem; }
.field-inline { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); }
.field-inline input { width: auto; min-height: 34px; padding: .3rem .5rem; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .9rem; cursor: pointer; margin-top: .4rem; }
.check-sm { font-size: .82rem; margin: 0; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1rem; }
.span-2 { grid-column: span 2; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.span-all { grid-column: 1 / -1; }
.form-narrow { max-width: 760px; display: flex; flex-direction: column; gap: 1rem; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; align-items: center; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline-form input { width: auto; flex: 1 1 200px; }
.input-code { font-family: var(--mono); font-size: 1.35rem; letter-spacing: .3em; text-align: center; max-width: 220px; }
textarea.code { font-family: var(--mono); font-size: .8rem; }
@media (max-width: 760px) {
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; margin-bottom: 1rem; flex-wrap: wrap; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .85rem; border-radius: 7px; font-size: .88rem; color: var(--muted); }
.segmented input:checked + span { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); }
.segmented-sm { margin-bottom: .6rem; }
.segmented-sm span { padding: .28rem .6rem; font-size: .82rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-size: .9rem; font-weight: 600;
  padding: .55rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); text-decoration: none; cursor: pointer; white-space: nowrap; min-height: 40px;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 85%, #000); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; min-height: 32px; }
.btn-block { width: 100%; }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-bg); color: var(--danger); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn-sm { width: 30px; height: 30px; }

/* ---------- Meldungen ---------- */
.alert, .flash { border-radius: var(--radius-sm); padding: .75rem 1rem; margin-bottom: 1rem; font-size: .92rem; }
.alert-error, .flash-error { background: var(--danger-bg); color: var(--danger); }
.alert-info, .flash-info { background: var(--info-bg); }
.flash-success { background: var(--ok-bg); color: var(--ok); }
.flash { display: flex; align-items: flex-start; gap: .6rem; white-space: pre-line; }
.flash > span { flex: 1; }
.flash-close { border: 0; background: none; color: inherit; cursor: pointer; opacity: .6; padding: 0; }

.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-state h1, .empty-state h2 { justify-content: center; margin-bottom: .4rem; }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.empty-icon .icon { width: 26px; height: 26px; }

/* ---------- KPIs & Dashboard ---------- */
.kpis { display: grid; gap: .9rem; margin-bottom: 1.25rem; }
.kpis-4 { grid-template-columns: repeat(4, 1fr); }
.kpis-3 { grid-template-columns: repeat(3, 1fr); }
.kpis-2 { grid-template-columns: repeat(2, 1fr); }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  display: flex; flex-direction: column; gap: .15rem; text-decoration: none; box-shadow: var(--shadow);
}
a.kpi:hover { border-color: var(--border-strong); color: inherit; }
.kpi span { font-size: .8rem; color: var(--muted); font-weight: 550; }
.kpi strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi small { color: var(--muted); font-size: .78rem; }
.kpi-warn strong { color: var(--danger); }
@media (max-width: 1000px) { .kpis-4, .kpis-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .kpi strong { font-size: 1.12rem; } .kpi { padding: 12px 14px; } }

.widgets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; align-items: start; }
.widget-wide { grid-column: 1 / -1; }
.widget-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.widget-head h2 { margin: 0; }
@media (max-width: 900px) { .widgets { grid-template-columns: 1fr; } }

.setup-banner { display: flex; align-items: center; gap: 1rem; text-decoration: none; margin-bottom: 1.25rem; border-left: 4px solid var(--signal); }
.setup-banner > span:nth-child(2) { flex: 1; }
.setup-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); display: grid; place-items: center; }

.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 190px; align-items: end; padding-top: 6px; }
.bar-col { display: flex; flex-direction: column; align-items: stretch; height: 100%; gap: 6px; }
.bar-pair { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; border-bottom: 1px solid var(--border); }
.bar { width: 42%; max-width: 18px; border-radius: 3px 3px 0 0; min-height: 0; }
.bar-cur { background: var(--brand); }
.bar-prev { background: var(--border-strong); }

.bar-col.future .bar-cur { opacity: .35; }
.bar-label { text-align: center; font-size: .72rem; color: var(--muted); }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; color: var(--muted); }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }
.lg-cur { background: var(--brand); }
.lg-prev { background: var(--border-strong); }


.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list a { display: flex; align-items: center; gap: .75rem; padding: .55rem .25rem; text-decoration: none; border-bottom: 1px solid var(--border); }
.recent-list li:last-child a { border-bottom: 0; }
.recent-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; }
.recent-main { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.recent-main strong { font-size: .9rem; font-weight: 600; }
.recent-main .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-side { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; }

/* ---------- Aufgaben ---------- */
.task-list { list-style: none; margin: 0; padding: 0; }
.task-row { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: 0; }
.task-main { flex: 1; min-width: 0; }
.task-main a { text-decoration: none; }
.task-check {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-strong); background: transparent;
  display: grid; place-items: center; color: transparent; cursor: pointer; padding: 0;
}
.task-check:hover { border-color: var(--ok); color: var(--ok); }
.task-check.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.task-row.overdue .task-main strong, .task-row.overdue .task-main a { color: var(--danger); }

/* ---------- Detailansicht ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
.split-main, .split-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.split-doc { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 1100px) { .split, .split-doc { grid-template-columns: 1fr; } .split-doc .split-side { order: -1; } }

.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab {
  border: 0; background: none; font: inherit; font-size: .92rem; font-weight: 550; color: var(--muted); cursor: pointer;
  padding: .6rem .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab.active { color: var(--text); border-bottom-color: var(--brand); }

.tab .count { font-size: .74rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 .4rem; margin-left: .2rem; }
.tab-panel { display: none; flex-direction: column; gap: 1rem; }
.tab-panel.active { display: flex; }

.activity-form { display: flex; flex-direction: column; gap: .6rem; padding: 16px; }
.activity-form-foot { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; }
.activity-form-foot select { width: auto; min-height: 34px; padding: .3rem .5rem; font-size: .85rem; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline-item { position: relative; display: flex; gap: .85rem; padding: 0 0 1.1rem; }
.timeline-item::before { content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.t-call { color: #1f7a5a; } .t-email { color: #2a5f95; } .t-meeting { color: #6a4aa6; } .t-task { color: var(--warn); }
.timeline-body { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem .9rem; }
.timeline-item.is-open .timeline-body { border-left: 3px solid var(--signal); }
.timeline-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.timeline-body p { margin: .35rem 0 0; font-size: .92rem; }
.timeline-task { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
.timeline-del { opacity: 0; transition: opacity .15s; }
.timeline-item:hover .timeline-del { opacity: 1; }
@media (hover: none) { .timeline-del { opacity: 1; } }

.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.contact-card { display: flex; flex-direction: column; gap: .6rem; }
.contact-head { display: flex; gap: .75rem; align-items: center; }
.contact-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; }
.contact-lines li { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.contact-lines a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-lines .icon { color: var(--muted); }
.contact-edit summary, .contact-new summary { list-style: none; cursor: pointer; }
.contact-edit summary::-webkit-details-marker, .contact-new summary::-webkit-details-marker { display: none; }
.contact-edit[open] summary { margin-bottom: .6rem; }
.contact-new summary { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-weight: 600; }
.contact-new[open] summary { margin-bottom: 1rem; }
.contact-new:not([open]) { border-style: dashed; box-shadow: none; }
.contact-form { gap: .6rem; }

.address { line-height: 1.55; margin-bottom: .75rem; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0; font-size: .9rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; }
.dl-inline dd { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Belegformular ---------- */
.doc-form { display: flex; flex-direction: column; gap: 1rem; }
.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .doc-grid { grid-template-columns: 1fr; } }
.picker, .item-title-wrap { position: relative; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto;
}
.suggest button {
  display: flex; width: 100%; text-align: left; border: 0; background: none; font: inherit; color: var(--text);
  padding: .55rem .75rem; cursor: pointer; justify-content: space-between; gap: .75rem; border-bottom: 1px solid var(--border);
}
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover, .suggest button.active { background: var(--surface-2); }
.suggest .s-main { display: flex; flex-direction: column; min-width: 0; }
.suggest .s-main small { color: var(--muted); }
.suggest .s-side { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.suggest .s-empty { padding: .6rem .75rem; color: var(--muted); font-size: .88rem; }

.items-card { padding-bottom: 12px; }
.items-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.items { display: flex; flex-direction: column; }
.item-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto 32px; gap: .75rem; align-items: start;
  padding: .85rem 0; border-top: 1px solid var(--border);
}
.item-handle { display: flex; flex-direction: column; align-items: center; gap: 0; }
.item-pos { font-weight: 650; color: var(--muted); font-size: .85rem; margin: .55rem 0 .2rem; }
.item-handle .icon-btn { width: 26px; height: 22px; }
.item-main { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.item-title { font-weight: 600; }
.item-desc { font-size: .9rem; min-height: 38px; }
.item-meta { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.item-meta select { width: auto; min-height: 32px; padding: .2rem .5rem; font-size: .82rem; }
.item-nums { display: grid; grid-template-columns: 78px 78px 110px 70px 78px 110px; gap: .5rem; align-items: start; }
.item-nums label { display: flex; flex-direction: column; gap: .2rem; }
.item-nums label span, .item-total span { font-size: .72rem; color: var(--muted); font-weight: 550; }
.item-nums input, .item-nums select { padding: .45rem .5rem; text-align: right; font-variant-numeric: tabular-nums; }
.item-nums select { text-align: left; }
.item-total { display: flex; flex-direction: column; gap: .2rem; text-align: right; }
.item-total strong { padding-top: .5rem; font-variant-numeric: tabular-nums; }
.item-del { margin-top: .3rem; }
.item-row.is-text .item-title { font-size: 1.02rem; }
.item-row.is-optional .item-total strong { color: var(--muted); font-weight: 500; }
.items-add { display: flex; gap: .5rem; padding: .6rem 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.no-tax .item-nums [data-f=tax_rate] { opacity: .45; }

@media (max-width: 1200px) {
  .item-row { grid-template-columns: 30px minmax(0, 1fr) 32px; }
  .item-nums { grid-column: 2 / 3; grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 520px) {
  .item-nums { grid-template-columns: repeat(2, 1fr); }
  .item-total { grid-column: span 2; flex-direction: row; justify-content: space-between; align-items: baseline; }
}

.totals { margin-left: auto; width: min(100%, 380px); padding-top: .75rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: .3rem; }
.totals-row { display: flex; justify-content: space-between; gap: 1rem; font-size: .92rem; font-variant-numeric: tabular-nums; }
.totals-grand { font-size: 1.08rem; border-top: 2px solid var(--text); padding-top: .4rem; margin-top: .2rem; }
.tax-notes { margin-top: .5rem; color: var(--muted); }
.tax-notes p { margin: 0 0 .25rem; }

.sticky-actions {
  position: sticky; bottom: 0; z-index: 15; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: .75rem 0 calc(.75rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border);
}
@media (max-width: 640px) {
  .sticky-actions .btn { flex: 1; }
  .sticky-actions .spacer { display: none; }
}

/* ---------- Belegansicht (Papier) ---------- */
.paper {
  background: #fff; color: #1b1b1b; border: 1px solid var(--border); border-radius: 4px; box-shadow: var(--shadow);
  padding: 44px 48px 52px; font-size: 13.5px; line-height: 1.5; position: relative; overflow: hidden;
}
.paper.is-draft::after {
  content: "ENTWURF"; position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-28deg);
  font-size: 92px; font-weight: 800; color: rgba(0, 0, 0, .045); pointer-events: none; letter-spacing: .05em;
}
.paper-head { display: flex; justify-content: space-between; gap: 2rem; margin-bottom: 2.25rem; }
.paper-sender-line { display: block; font-size: 10px; color: #777; border-bottom: 1px solid #ccc; padding-bottom: 2px; margin-bottom: 10px; }
.paper-meta { text-align: right; min-width: 230px; }
.paper-logo { max-width: 200px; max-height: 70px; margin-bottom: 1rem; }
.paper-company { font-size: 22px; font-weight: 700; color: var(--ink); margin-bottom: 1rem; }
.paper-meta dl { display: grid; grid-template-columns: auto auto; gap: 1px 1rem; margin: 0; font-size: 12px; justify-content: end; }
.paper-meta dt { color: #777; text-align: left; }
.paper-meta dd { margin: 0; text-align: right; }
.paper-title { font-size: 20px; color: var(--ink); margin-bottom: .2rem; display: block; }
.paper-subject { font-weight: 650; }
.paper-items { width: 100%; border-collapse: collapse; margin: 1.2rem 0 .5rem; }
.paper-items th { background: var(--ink); color: #fff; font-size: 11.5px; text-align: left; padding: 6px 8px; font-weight: 600; }
.paper-items td { padding: 8px; border-bottom: 1px solid #e6e6e6; vertical-align: top; }
.paper-items .num { text-align: right; white-space: nowrap; }
.paper-items .muted { color: #666; font-size: 12.5px; }
.paper-optional td { color: #888; }
.paper-textrow td { padding-top: 12px; }
.paper-totals { margin: .5rem 0 1.25rem auto; width: min(100%, 330px); font-variant-numeric: tabular-nums; }
.paper-totals > div { display: flex; justify-content: space-between; gap: 1rem; padding: 2px 0; }
.paper-grand { font-weight: 700; font-size: 15px; border-top: 2px solid var(--brand); margin-top: 4px; padding-top: 5px !important; }
.paper-note { font-weight: 600; font-size: 12.5px; }
@media (max-width: 640px) {
  .paper { padding: 20px 16px 28px; font-size: 12.5px; }
  .paper-head { flex-direction: column-reverse; gap: 1rem; }
  .paper-meta { text-align: left; min-width: 0; }
  .paper-meta dl { justify-content: start; }
  .paper-items th:nth-child(4), .paper-items td:nth-child(4) { display: none; }
}

.finalize-card.highlight { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.check-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .45rem; font-size: .88rem; }
.check-list li { display: flex; gap: .5rem; align-items: flex-start; }
.check-list .icon { margin-top: 2px; }
.row-actions { display: flex; justify-content: center; margin-top: .75rem; }

.action-list { display: flex; flex-direction: column; }
.action-item {
  display: flex; align-items: center; gap: .7rem; width: 100%; border: 0; background: none; font: inherit; font-size: .92rem;
  color: var(--text); padding: .6rem .5rem; border-radius: 7px; cursor: pointer; text-align: left;
}
.action-item:hover { background: var(--surface-2); }
.action-item .icon { color: var(--muted); }
.action-primary { font-weight: 650; }
.action-primary .icon { color: var(--brand-soft); }
.action-danger, .action-danger .icon { color: var(--danger); }

.payment-list { list-style: none; margin: .75rem 0; padding: 0; border-top: 1px solid var(--border); }
.payment-list li { display: flex; align-items: center; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.payment-list li > span { flex: 1; }
.payment-form { margin-top: 1rem; display: flex; flex-direction: column; gap: .75rem; }
.link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; font-size: .9rem; }
.link-list li { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.history { list-style: none; margin: 0; padding: 0; font-size: .86rem; }
.history li { display: flex; justify-content: space-between; gap: .75rem; padding: .35rem 0; border-bottom: 1px dashed var(--border); }
.history li:last-child { border-bottom: 0; }

/* ---------- Einstellungen ---------- */
.logo-preview { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 12px; display: inline-block; max-width: 260px; }
.logo-preview img { max-width: 100%; max-height: 80px; display: block; }
.user-list { list-style: none; margin: 0; padding: 0; }
.user-list li { display: flex; align-items: flex-start; gap: .8rem; padding: .8rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.user-list li:last-child { border-bottom: 0; }
.user-main { flex: 1; min-width: 200px; }
.user-edit { min-width: 220px; }
.user-edit summary { list-style: none; }
.user-edit summary::-webkit-details-marker { display: none; }
.user-edit[open] summary { margin-bottom: .6rem; }
.twofa-setup { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.qr-box { background: #fff; padding: 8px; border-radius: 8px; border: 1px solid var(--border); line-height: 0; }
.qr-box svg { width: 200px; height: 200px; }
.steps { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .5rem; }
.secret { font-size: 1rem; letter-spacing: .05em; display: inline-block; margin-top: .25rem; word-break: break-all; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.module-card { display: flex; flex-direction: column; gap: .5rem; cursor: pointer; }
.module-card.on { border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); }
.module-head { display: flex; gap: .75rem; align-items: center; }
.module-head > div { flex: 1; }
.module-icon { width: 38px; height: 38px; border-radius: var(--radius-sm); background: var(--surface-2); display: grid; place-items: center; color: var(--brand-soft); flex: none; }

.module-coming { border-style: dashed; box-shadow: none; cursor: default; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
.switch-track::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:disabled + .switch-track { opacity: .55; }

/* ---------- Gastseiten (Login, Einrichtung) ---------- */
body.guest {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 14px;
  background: radial-gradient(1200px 600px at 85% -10%, rgba(240, 90, 14, .08), transparent 60%), var(--bg);
}
body.guest::before { content: ""; position: fixed; inset: 0 0 auto 0; height: 3px; background: var(--brand-grad); }
.guest-main { width: 100%; max-width: 420px; }
.guest-main:has(.guest-card-wide) { max-width: 720px; }
.guest-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text); margin-bottom: 1.75rem; }
.guest-brand .brand-logo { width: 230px; }
.guest-brand .brand-sub { padding-left: .32em; }
.guest-card { padding: 28px; }
.guest-card h1 { margin-bottom: 1rem; font-size: 1.35rem; }
.guest-foot { color: var(--muted); font-size: .8rem; text-align: center; margin-top: 1.25rem; display: flex; gap: .4rem; justify-content: center; align-items: center; }

@media print {
  .sidebar, .topbar, .split-side, .page-head .actions, .sticky-actions { display: none !important; }
  .main { margin: 0; padding: 0; }
  .paper { border: 0; box-shadow: none; }
}
.item-nums [data-f=unit] { text-align: left; }

/* Listen auf dem Handy als Karten statt Tabelle */
@media (max-width: 640px) {
  .table-click thead { display: none; }
  .table-click tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-auto-flow: row dense;
    gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border);
  }
  .table-click tbody tr:last-child { border-bottom: 0; }
  .table-click td { display: block; padding: 0; border: 0; grid-column: 1; min-width: 0; }
  .table-click td.num { grid-column: 2; grid-row: 1; }
  .table-click td:last-child:not(.num) { grid-column: 2; grid-row: 2; text-align: right; }
  .table-click td.mono { font-size: inherit; }
}
@media (max-width: 640px) {
  .table-click tbody tr:hover td { background: transparent; }
  .table-click tbody tr:hover { background: var(--surface-2); }
}

/* ---------- Kilometergeld ---------- */
.mt-l { margin-top: 1.5rem; }
.table-compact th, .table-compact td { padding: 6px 8px; font-size: .86rem; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; }
.plain-list a { text-decoration: none; }
.hint-list { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .45rem; color: var(--muted); font-size: .9rem; }
.hint-list strong { color: var(--text); }
.meter { height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: .45rem; }
.meter span { display: block; height: 100%; background: var(--brand-grad); }
.kpi-warn .meter span { background: var(--danger); }
.kpi strong small { font-size: .78rem; font-weight: 500; color: var(--muted); }
.field-check { align-self: end; padding-bottom: .6rem; }
.trip-calc { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; border-top: 3px solid var(--brand); }
.trip-calc div { display: flex; flex-direction: column; gap: .1rem; }
.trip-calc strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.trip-calc .trip-total { color: var(--brand-soft); font-size: 1.35rem; }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 2px solid var(--brand); }
.print-head h2 { margin: 0 0 .2rem; font-size: 1.2rem; }
.print-sum { margin-top: 1rem; max-width: 520px; margin-left: auto; }
.print-sum .strong td { font-weight: 700; border-top: 2px solid var(--ink); }
@media (max-width: 640px) { .trip-calc { grid-template-columns: 1fr 1fr; } .trip-calc div:last-child { grid-column: 1 / -1; } }
@media print {
  .no-print, .flash { display: none !important; }
  .print-sheet { border: 0; box-shadow: none; padding: 0; }
  .print-table { font-size: 9pt; }
  body { background: #fff; color: #000; }
}
form.inline { display: inline; }
.table-scroll { overflow-x: auto; }
@media print { .table-scroll { overflow: visible; } }

/* Sortierbare und verschiebbare Spalten */
.table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.table th.sortable:hover { color: var(--text); background: var(--surface); }
.table th[draggable="true"] { cursor: grab; }
.table th.sortable[draggable="true"] { cursor: pointer; }
.sort-ind { display: inline-flex; flex-direction: column; gap: 2px; margin-left: .45em; vertical-align: middle; }
.sort-ind i { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; opacity: .35; }
.sort-ind .up { border-bottom: 6px solid currentColor; }
.sort-ind .down { border-top: 6px solid currentColor; }
.table th.sortable:hover .sort-ind i { opacity: .6; }
.table th[aria-sort="ascending"] .sort-ind .up, .table th[aria-sort="descending"] .sort-ind .down { opacity: 1; color: var(--brand); }
.table th[aria-sort="ascending"] .sort-ind .down, .table th[aria-sort="descending"] .sort-ind .up { opacity: .15; }
.table th[aria-sort="ascending"], .table th[aria-sort="descending"] { color: var(--text); }
.table th.sortable:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.table th.dragging { opacity: .45; }
.table th.drop-before { box-shadow: inset 3px 0 0 var(--brand); }
.table th.drop-after { box-shadow: inset -3px 0 0 var(--brand); }
.table-reset { display: block; margin: .5rem 0 0 auto; background: none; border: 0; color: var(--muted); font: inherit; font-size: .8rem; cursor: pointer; padding: .2rem .4rem; }
.table-reset:hover { color: var(--brand-soft); }
@media print { .sort-ind, .table-reset { display: none !important; } }
mark.hit { background: var(--info-bg); color: var(--brand-soft); padding: 0 .25em; border-radius: 3px; }

/* Ansprechpartner-Seite */
.contact-title { display: flex; align-items: center; gap: .9rem; }
.contact-title h1 { margin: 0; }
.contact-title p { margin: .15rem 0 0; }
.contact-link { text-decoration: none; }
.contact-link:hover { color: var(--brand-soft); text-decoration: underline; }
.section-title { margin: 1.5rem 0 .8rem; }
.open-tasks { border-left: 3px solid var(--signal); }
.task-line { display: flex; align-items: center; gap: .6rem; }
.task-line .task-check { width: 22px; height: 22px; }
.contact-hits { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: .15rem; }
a.hit { background: var(--info-bg); color: var(--brand-soft); padding: 0 .35em; border-radius: 3px; text-decoration: none; font-weight: 500; }
a.hit:hover { text-decoration: underline; }

/* ---------- Zeiterfassung ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 1.5rem 0 .8rem; }
.section-head .section-title { margin: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 16px 20px 6px; }
.card-head h2 { margin: 0; }

/* Laufende Zeit in Seitenleiste / Kopfzeile */
.run-pill { display: flex; align-items: center; gap: .5rem; margin: 0 6px 14px; padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--info-bg); color: var(--text); text-decoration: none; font-size: .86rem; border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); }
.run-pill:hover { color: var(--text); border-color: var(--brand); }
.run-pill .run-time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand-soft); }
.run-pill .run-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.run-pill-compact { margin: 0; padding: 5px 9px; }
.run-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; display: inline-block; animation: run-pulse 1.6s ease-in-out infinite; }
@keyframes run-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(240, 90, 14, .45); } 50% { box-shadow: 0 0 0 6px rgba(240, 90, 14, 0); } }
@media (prefers-reduced-motion: reduce) { .run-dot { animation: none; } }
.topbar .run-pill { flex: none; }
@media (min-width: 901px) { .topbar .run-pill { display: none; } }

/* Timer-Karte */
.timer-card { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.timer-card.is-running { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); background: linear-gradient(180deg, var(--info-bg), var(--surface) 70%); }
.timer-info { display: flex; flex-direction: column; gap: .15rem; min-width: 220px; flex: 1; }
.timer-label { display: inline-flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); font-weight: 500; }
.timer-big { font-size: 2.6rem; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.timer-project { font-weight: 600; text-decoration: none; }
.timer-form { display: flex; gap: .6rem; flex: 1 1 320px; flex-wrap: wrap; }
.timer-form input { flex: 1 1 200px; }
.timer-start { display: grid; grid-template-columns: 1fr 1fr auto; gap: .8rem; align-items: end; width: 100%; }
.timer-start .span-2 { grid-column: 1 / 3; }
.timer-start .btn-start { grid-row: 1 / 3; grid-column: 3; align-self: stretch; }
.btn-start, .btn-stop { font-weight: 700; min-height: 44px; }
.btn-start { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-start:hover { background: color-mix(in srgb, var(--ok) 85%, #000); color: #fff; }
.btn-stop { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-stop:hover { background: color-mix(in srgb, var(--danger) 85%, #000); color: #fff; }
.timer-card .btn-start, .timer-card .btn-stop { font-size: 1.05rem; padding: .7rem 1.6rem; }
.timer-inline .timer-big { font-size: 2rem; }

/* Budget-Balken */
.budget-bar { height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin: .45rem 0 .3rem; }
.budget-bar span { display: block; height: 100%; background: var(--ok); transition: width .3s; }
.budget-bar.lvl-warn span { background: var(--signal); }
.budget-bar.lvl-over span { background: var(--danger); }
.budget-bar.lvl-none span { background: var(--border-strong); }
.budget-bar-sm { height: 6px; margin: .3rem 0 .15rem; max-width: 320px; }
.badge-running { background: var(--info-bg); color: var(--brand-soft); border-color: transparent; }

/* Projektkarten */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.project-card { display: flex; flex-direction: column; gap: .2rem; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.project-card:hover { border-color: var(--brand); color: inherit; box-shadow: var(--shadow-lg); }
.project-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.project-card-nums { display: flex; justify-content: space-between; gap: .5rem; font-size: .88rem; flex-wrap: wrap; }

/* Positionen im Projekt */
.position-table tfoot td { border-top: 2px solid var(--ink); font-weight: 600; background: var(--surface-2); }
.position-table tr.is-running-row td { background: var(--info-bg); }
.position-table td:last-child { position: relative; }
.pos-edit { display: inline-block; vertical-align: middle; }
.pos-edit > summary { list-style: none; display: inline-grid; cursor: pointer; }
.pos-edit > summary::-webkit-details-marker { display: none; }
.pos-edit-form { position: absolute; right: 8px; top: 100%; z-index: 20; width: min(360px, 90vw); text-align: left; box-shadow: var(--shadow-lg); }
.project-forms { margin-top: 1.25rem; align-items: start; }
.project-forms > details > summary { list-style: none; cursor: pointer; }
.project-forms > details > summary::-webkit-details-marker { display: none; }
.project-forms > details > summary h2 { margin: 0; }
.project-forms > details[open] > summary { margin-bottom: 1rem; }

/* Drag & Drop */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 2.2rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .4rem;
  text-align: center; cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s; margin-bottom: .8rem; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-over { border-color: var(--brand); background: var(--info-bg); outline: none; }
.dropzone.is-busy { opacity: .7; pointer-events: none; }
.dropzone-icon { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--brand); border: 1px solid var(--border); }
.dropzone-icon .icon { width: 26px; height: 26px; }
.dropzone-status { margin-top: .4rem; font-weight: 600; color: var(--brand-soft); }
.dropzone-status.is-error { color: var(--danger); }
.new-project { align-items: start; }

/* Prüfansicht */
.review-table input { min-height: 36px; padding: .35rem .5rem; }
.review-table td[data-label="Bezeichnung"] { min-width: 260px; width: 40%; }
.review-table td[data-label="Bezeichnung"] input { width: 100%; }
.review-table td[data-label="Menge"] { white-space: normal; min-width: 110px; }
.review-table .input-xs { width: 64px; }
.review-table .input-num { width: 100px; text-align: right; }
.review-table tr.is-optional td { color: var(--muted); }
.review-desc { max-width: 520px; margin-top: .25rem; }

/* Widget */
.widget-run { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--info-bg); margin-bottom: .8rem; }
.widget-run strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.widget-run .inline { margin-left: auto; }
.widget-projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem 1.2rem; }
.widget-project { text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.widget-project:hover .wp-name { color: var(--brand-soft); }
.wp-name { font-weight: 600; font-size: .92rem; }

/* Handy */
@media (max-width: 720px) {
  .timer-big { font-size: 2.2rem; }
  .timer-start { grid-template-columns: 1fr; }
  .timer-start .span-2, .timer-start .btn-start { grid-column: auto; grid-row: auto; }
  .timer-card .btn-start, .timer-card .btn-stop { width: 100%; justify-content: center; padding: .9rem; font-size: 1.15rem; }
  .timer-form { flex-direction: column; flex: 1 1 100%; }
  .timer-form input { flex: none; }
  .position-table thead, .review-table thead { display: none; }
  .position-table tr, .review-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .position-table td, .review-table td { display: block; padding: 0; border: 0; text-align: left; }
  .position-table td[data-label="Position"], .review-table td[data-label="Bezeichnung"] { grid-column: 1 / -1; }
  .position-table td[data-label]:not([data-label="Position"]):not([data-label=""])::before,
  .review-table td[data-label]:not([data-label="Bezeichnung"])::before { content: attr(data-label); display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
  .position-table td[data-label="Pos."] { display: none; }
  .position-table td:last-child { grid-column: 1 / -1; display: flex; gap: .5rem; align-items: center; }
  .position-table td:last-child .btn-start, .position-table td:last-child .btn-stop { flex: 1; justify-content: center; }
  .position-table td:last-child form.inline { flex: 1; display: flex; }
  .position-table tfoot tr { grid-template-columns: 1fr 1fr 1fr; }
  .pos-edit-form { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; }
  .review-table .input-num { width: 100%; text-align: left; }
}
.sidebar-foot .icon-btn.active { color: var(--brand); background: var(--info-bg); }
.sidebar-foot { gap: .15rem; }
.sidebar-foot .icon-btn { width: 34px; height: 34px; flex: none; }
.sidebar-foot .user-chip-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Aufgaben anlegen */
.task-new { margin-bottom: 1.25rem; border-top: 3px solid var(--brand); }
.task-new h2 { margin-bottom: 1rem; }
.task-chips { margin-bottom: 1rem; }
.task-main .muted a { color: inherit; }
.task-main .muted a:hover { color: var(--brand-soft); }

/* Übersicht */
.widget-scroll { max-height: 520px; overflow-y: auto; }
.count-pill { font-size: .72rem; font-weight: 600; background: var(--info-bg); color: var(--brand-soft); border-radius: 999px; padding: .05rem .5rem; margin-left: .2rem; }
.recent-side { text-align: right; line-height: 1.35; flex: none; }

/* Daten übernehmen (neue AB/Rechnung) */
.takeover { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; border-left: 3px solid var(--brand); margin-bottom: .5rem; }
.takeover-title { flex: none; display: inline-flex; align-items: center; gap: .35rem; }
.takeover .takeover-customer { flex: 1 1 200px; min-width: 0; }
.takeover [data-takeover-doc] { flex: 2 1 320px; min-width: 0; }
.takeover-or { margin: .2rem 0 1rem; }

/* Finanzen: Prognose */
.forecast-head { display: flex; align-items: baseline; gap: .4rem 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.forecast-total { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.forecast-bar { position: relative; display: flex; height: 18px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); overflow: visible; }
.forecast-bar span { display: block; height: 100%; }
.forecast-bar .fb-rev { background: var(--ok); border-radius: 9px 0 0 9px; }
.forecast-bar .fb-open { background: var(--signal); }
.forecast-bar .fb-open:last-of-type { border-radius: 0 9px 9px 0; }
.forecast-bar .fb-prev { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); border-radius: 1px; }
.forecast-legend { margin: .5rem 0 .8rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.lg-open { background: var(--signal); }
.lg-line { width: 2px !important; background: var(--ink); }
.forecast-orders { border-top: 1px solid var(--border); margin-top: .4rem; }

.forecast-legend .lg-cur { background: var(--ok); }

/* Finanzen: Rechnungen & Zahlungen */
.inv-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1rem; }
.inv-stats > div { display: flex; flex-direction: column; gap: .1rem; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.inv-stats strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
@media (max-width: 800px) { .inv-stats { grid-template-columns: 1fr 1fr; } }
.inv-toolbar { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.inv-table tr.is-overdue td { background: var(--danger-bg); }
.inv-table tr.is-paid td { color: var(--muted); }
.inv-action { white-space: nowrap; }
.inv-pay { display: inline-flex; gap: .4rem; align-items: center; }
.inv-pay input[type=date] { width: auto; min-height: 32px; padding: .2rem .4rem; font-size: .85rem; }
.inv-action .btn-sm { min-height: 32px; }
.badge-paid { background: var(--ok-bg); color: var(--ok); border-color: transparent; margin-right: .3rem; }


/* Auswahlfelder: eigene Darstellung, damit Safari sie gleich hoch wie Eingabefelder zeichnet */
select {
  -webkit-appearance: none; appearance: none;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235A6478' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .6rem center; background-size: 12px;
  padding-right: 1.9rem !important;
}
select[multiple] { background-image: none; padding-right: .7rem !important; }
.item-nums select { min-height: 40px; height: 40px; }

/* ============================================================
   Angleichung an die neu gestaltete Website (localhost:8743, css/style.css):
   heller Hintergrund #F7F9FC, weiße Karten mit feinem Rand + weichem Schatten, 6px-Ecken,
   Buttons mit Verlauf #F05A0E → #FF7A1A, Symbol-Kacheln hellorange, Etiketten orange umrandet
   ============================================================ */
:root {
  --bg: #F7F9FC;
  --surface-2: #F0F4F9;
  --border: #E4E9F0;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow: 0 2px 12px rgba(0, 0, 0, .04);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, .14);
  --btn-grad: linear-gradient(to top right, #F05A0E, #FF7A1A);
  --btn-grad-hover: linear-gradient(to top right, #DC4F09, #F26E10);
  --icon-tile: linear-gradient(135deg, rgba(240, 90, 14, .1), rgba(255, 170, 0, .1));
}

/* Hauptbuttons wie auf der Website */
.btn { font-weight: 600; transition: background .2s, box-shadow .2s, transform .2s, border-color .15s, color .15s; }
.btn-primary { background: var(--btn-grad); border-color: transparent; box-shadow: none; }
.btn-primary:hover { background: var(--btn-grad-hover); color: #fff; transform: translateY(-1px); box-shadow: none; }
.btn-primary:active { transform: none; }
.chip.active { background: var(--btn-grad); border-color: transparent; }

/* Karten: feiner Rand, weicher Schatten; anklickbare Karten mit orangem Streifen beim Darüberfahren */
.card, .kpi { border-color: var(--border); box-shadow: var(--shadow); }
a.kpi, .project-card { position: relative; overflow: hidden; transition: transform .25s, box-shadow .25s, border-color .25s; }
a.kpi::before, .project-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--brand-grad); transform: scaleX(0); transform-origin: left; transition: transform .3s;
}
/* kein Anheben der Karte: verschob die Trefferfläche unter der Maus → Hover flackerte bzw. ging verloren */
a.kpi:hover, .project-card:hover { box-shadow: var(--shadow-lg); border-color: transparent; }
a.kpi:hover::before, .project-card:hover::before { transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) { a.kpi, .project-card, .btn { transition: none; } a.kpi:hover, .project-card:hover, .btn-primary:hover { transform: none; } }

/* Symbol-Kacheln hellorange mit dunklem Symbol */
.module-icon, .recent-icon, .empty-icon, .dropzone-icon, .setup-icon { background: var(--icon-tile); color: var(--ink); border: 0; }
.module-icon, .recent-icon { border-radius: var(--radius-sm); }

/* Etiketten wie „ISO 12100 · EN 62061“ auf der Website */
.tag {
  font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brand); background: transparent; border: 1px solid rgba(240, 90, 14, .25); border-radius: 4px; padding: .1rem .5rem;
}

/* Betreff direkt in der Liste ändern */
.subject-inline { display: flex; width: fit-content; align-items: center; gap: .3rem; background: none; border: 0; padding: .05rem 0; margin: 0; font: inherit; font-size: .84rem; color: var(--muted); cursor: text; text-align: left; border-bottom: 1px dashed transparent; }
.subject-inline:hover { color: var(--brand-soft); border-bottom-color: currentColor; }
.subject-inline .icon { opacity: 0; transition: opacity .15s; }
.subject-inline:hover .icon, .subject-inline:focus-visible .icon { opacity: 1; }
.subject-inline em { font-style: normal; opacity: .7; }
.subject-input { display: block; margin-top: .2rem; min-height: 32px; padding: .25rem .5rem; font-size: .86rem; max-width: 360px; }

/* ---------- Belegvorschau im Word-Stil (Aufträge, Rechnungen, Gutschriften) ---------- */
.paper-letter { font-family: var(--font); font-size: 13.5px; line-height: 1.38; color: #000; padding: 32px 40px 28px 52px; }
.paper-letter .pre { white-space: pre-line; }
.pl-logo { text-align: center; margin-bottom: 34px; }
.pl-logo img { width: 48%; max-width: 330px; }
.pl-sender { margin: 0 0 14px; }
.pl-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; }
.pl-address { font-style: normal; }
.pl-info { border-collapse: collapse; }
.pl-info th, .pl-info td { text-align: right; padding: 0 0 0 1.4rem; vertical-align: top; }
.pl-info th { font-weight: 700; }
.pl-title { font-size: 20px; font-weight: 700; margin: 2.2rem 0 .2rem; color: #000; }
.pl-p { margin: 0; }
.pl-note { margin-top: 1.1rem; text-align: justify; }
.pl-table-wrap { overflow-x: auto; margin: 1.5rem 0 .5rem; }
.pl-items { width: 100%; border-collapse: collapse; }
.pl-items th { background: #F2F2F2; font-weight: 700; text-align: left; padding: 7px 8px; white-space: nowrap; }
.pl-items td { padding: 8px; border-bottom: 1px solid #D9D9D9; vertical-align: top; }
.pl-items th.pl-pos { background: #FF8901; color: #fff; text-align: center; width: 42px; }
.pl-items td.pl-pos { background: #FFE1C1; font-weight: 700; text-align: center; border-bottom-color: #FFE1C1; }
.pl-items .c { text-align: center; }
.pl-items .num { text-align: right; white-space: nowrap; }
.pl-optional td { color: #777; }
.pl-totals { margin: 1rem 0 .5rem auto; width: min(100%, 340px); font-variant-numeric: tabular-nums; }
.pl-totals > div { display: flex; justify-content: space-between; gap: 1rem; padding: 2px 0; }
.pl-totals .pl-grand { font-weight: 700; font-size: 15.5px; margin-top: 3px; }
.pl-taxnote { font-weight: 700; font-size: 12.5px; margin: .5rem 0 0; }
.pl-sections { color: #404040; margin-top: 2rem; }
.pl-sections section { margin-bottom: 1.1rem; }
.pl-sections h3 { font-size: 14px; font-weight: 700; margin: 0; color: #404040; }
.pl-sections p { margin: 0 0 1.1rem; text-align: justify; }
.pl-sections section p { margin: 0; }
.pl-bank { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; }
.pl-bank dl { display: grid; grid-template-columns: 110px auto; margin: 0; }
.pl-bank dd { margin: 0; }
.pl-bank .pl-sub { margin-top: .5rem; }
.pl-qr .qr-note { font-size: 12px; color: #7F7F7F; }
.pl-footer { display: grid; grid-template-columns: 1fr 1fr 1fr 70px; gap: 1rem; align-items: start; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid #eee; font-size: 11px; color: #7F7F7F; line-height: 1.35; }
.pl-footer img { width: 64px; }
@media (max-width: 720px) {
  .paper-letter { padding: 20px 16px 24px; font-size: 13px; }
  .pl-head { flex-direction: column; align-items: stretch; }
  .pl-info th, .pl-info td { padding: 0 1rem 0 0; text-align: left; }
  .pl-footer { grid-template-columns: 1fr 1fr; }
  .pl-footer img { display: none; }
}
.skonto-inline { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; min-width: 0; }
.skonto-inline input { width: 4.2rem; min-width: 0; flex: 0 1 4.2rem; }
.skonto-inline span { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.pl-qr { text-align: center; flex: 0 0 auto; }
.pl-qr svg { display: block; }
.pl-items { font-size: 13px; table-layout: auto; }
.pl-items th, .pl-items td { padding: 6px 6px; }
.pl-items th { white-space: normal; }
.pl-items th.num, .pl-items td.num { padding-left: 4px; }
.pl-items th.pl-pos, .pl-items td.pl-pos { width: 34px; padding-left: 2px; padding-right: 2px; }

/* ---------- Datumsfeld tt.mm.jjjj + Kalender ---------- */
.dp-wrap { position: relative; display: flex; width: 100%; }
.dp-wrap .dp-input { width: 100%; padding-right: 2.6rem; font-variant-numeric: tabular-nums; }
.dp-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); padding: 6px; border-radius: var(--radius-sm); cursor: pointer; display: grid; place-items: center; }
.dp-btn:hover { color: var(--brand); background: var(--surface-2); }
.inv-pay .dp-wrap { width: 9.5rem; }
.inv-pay .dp-input { min-height: 32px; padding: .2rem 2.2rem .2rem .4rem; font-size: .85rem; }
.dp-pop { position: absolute; z-index: 1000; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px; width: 324px; max-width: calc(100vw - 16px); font-size: 15px; user-select: none; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-head strong { font-size: 16px; }
.dp-nav { border: 0; background: transparent; font-size: 24px; line-height: 1; width: 38px; height: 38px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); }
.dp-nav:hover { background: var(--surface-2); color: var(--brand); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.dp-day { height: 40px; border: 0; background: transparent; border-radius: var(--radius-sm); font: inherit; color: var(--text); cursor: pointer; font-variant-numeric: tabular-nums; }
.dp-day:hover:not(:disabled) { background: var(--info-bg); color: var(--brand-soft); }
.dp-day.is-out { color: #B4BCC8; }
.dp-day.is-today { box-shadow: inset 0 0 0 1.5px var(--brand); font-weight: 600; }
.dp-day.is-sel { background: var(--brand); color: #fff; font-weight: 700; }
.dp-day:disabled { opacity: .3; cursor: default; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.dp-link { border: 0; background: transparent; color: var(--brand-soft); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: var(--radius-sm); }
.dp-link:hover { background: var(--info-bg); }
/* Word-Stil: Logo links, Infoblock rechts, feine Linien */
.pl-logo { text-align: left; margin-bottom: 26px; }
.pl-logo img { width: 30%; max-width: 200px; }
.pl-head { align-items: flex-start; }
.pl-info { display: grid; grid-template-columns: auto minmax(0, 14rem); gap: 1px 1.2rem; margin: 0; font-size: 13px; }
.pl-info dt { color: #7F7F7F; }
.pl-info dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.pl-info dd.b { font-weight: 700; }
.pl-totals { border-top: 1px solid #BFBFBF; padding-top: .7rem; margin-top: 1rem; width: 100%; }
.pl-totals > div { margin-left: auto; width: min(100%, 340px); }
.pl-totals .pl-grand { border-top: 1px solid #D9D9D9; padding-top: 5px !important; margin-top: 6px; }
.pl-footer { position: relative; border-top: 1px solid #D9D9D9; margin-left: -52px; margin-right: -40px; padding: 1rem 40px 0 52px; }
.pl-footer img { position: absolute; right: 40px; top: -40px; }
@media (max-width: 720px) {
  .pl-info { grid-template-columns: auto 1fr; }
  .pl-info dd { text-align: left; }
  .pl-footer { margin-left: -16px; margin-right: -16px; padding: 1rem 16px 0; }
}
.pl-info { grid-template-columns: auto auto; justify-content: end; column-gap: 1.6rem; }
.pl-info dd { max-width: 14rem; }
.pl-items tbody tr:last-child td:not(.pl-pos) { border-bottom: 0; }
.pl-footer { grid-template-columns: 1fr 1fr 1fr 64px; }
.pl-footer img { top: -17px; right: 34px; width: 64px; background: #fff; padding: 0 6px; box-sizing: content-box; }
/* €-Zeichen fluchtend untereinander */
.paper-letter .eur { display: inline-flex; justify-content: space-between; gap: .4rem; min-width: 6.2rem; font-variant-numeric: tabular-nums; }
.pl-items td.num { text-align: right; }
.pl-totals .eur { min-width: 7.5rem; }
/* Mengen rechtsbündig, Einheit direkt daneben; Preisspalten mit fester Breite, damit „€“ nahe an der Zahl steht */
.pl-items .pl-qty { width: 4.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.pl-items .pl-unit { width: 4rem; padding-left: 10px; }
.pl-items th.num:nth-last-child(-n+2), .pl-items td.num:nth-last-child(-n+2) { width: 7.5rem; }
.paper-letter .pl-items .eur { min-width: 0; width: 100%; }
/* Inter: „fett“ als SemiBold wie im PDF */
.paper-letter strong, .paper-letter b, .paper-letter th, .pl-address strong, .pl-sections h3, .pl-title, .pl-totals .pl-grand, .pl-info dd.b { font-weight: 600; }
/* Vorschau im A4-Format (210 × 297): schmäler, mindestens A4-hoch, Fußzeile unten */
.paper-letter { max-width: 820px; margin-inline: auto; aspect-ratio: 210 / 297; overflow: visible; display: flex; flex-direction: column; }
.paper-letter .pl-footer { margin-top: auto; }
.paper-letter .pl-sections { margin-bottom: 2.5rem; }
@media (max-width: 720px) { .paper-letter { aspect-ratio: auto; } }

/* ---------- Globale Suche ---------- */
.global-search { position: relative; display: flex; align-items: center; margin: 0 0 1.25rem; }
.global-search .gs-icon { position: absolute; left: 14px; color: var(--muted); display: grid; place-items: center; pointer-events: none; }
.global-search input[type=search] { width: 100%; min-height: 50px; padding: .7rem 3rem .7rem 2.8rem; font-size: 1rem; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.global-search input[type=search]:focus { border-color: var(--brand); outline: 3px solid var(--info-bg); }
.gs-kbd { position: absolute; right: 12px; font: 600 .75rem var(--mono); color: var(--muted); border: 1px solid var(--border-strong); border-radius: 4px; padding: 1px 6px; background: var(--surface-2); }
.gs-results { position: absolute; z-index: 900; top: calc(100% + 6px); left: 0; right: 0; max-height: min(70vh, 560px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; }
.gs-group + .gs-group { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.gs-group-title { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 10px 2px; }
.gs-item { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.gs-item span { font-size: .82rem; color: var(--muted); }
.gs-item:hover, .gs-item.active { background: var(--info-bg); }
.gs-item:hover strong, .gs-item.active strong { color: var(--brand-soft); }
.gs-all { border-top: 1px solid var(--border); margin-top: 4px; font-weight: 600; color: var(--brand-soft); }
.gs-empty { padding: 12px; color: var(--muted); }
.search-group { margin-bottom: 1rem; }
.search-group h2 { display: flex; align-items: center; gap: .4rem; font-size: 1rem; }
.search-list { list-style: none; margin: .25rem 0 0; padding: 0; }
.search-list li + li { border-top: 1px solid var(--border); }
.search-list a { display: flex; flex-direction: column; gap: 1px; padding: .6rem .25rem; color: var(--text); text-decoration: none; }
.search-list a:hover strong { color: var(--brand-soft); }
.pl-notice hr { width: 46px; margin: 0 0 1.1rem; border: 0; border-top: 1.5px solid #404040; }
.pl-paras p + p { margin-top: .6rem; }
/* Belegansicht: A4-Blatt links (bündig mit den Buttons), Seitenleiste rückt direkt daneben */
@media (min-width: 1101px) {
  .split-doc:has(.paper-letter) { grid-template-columns: minmax(0, 820px) 360px; justify-content: start; }
}
.split-doc .paper-letter { margin-inline: 0; }
/* A4-Höhe darf Inhalte nicht zusammendrücken (Tabelle mit overflow würde sonst auf 0 schrumpfen) */
.paper-letter > * { flex-shrink: 0; }
/* Menge: Zahlen rechtsbündig, Block mittig unter „Menge“ (Padding rechts); Einheit mittig */
.pl-items th.pl-qty { text-align: center; }
.pl-items td.pl-qty { text-align: right; padding-right: 1.6rem; }
.pl-items .pl-unit { text-align: center; padding-left: 6px; }
/* Korrektur: aspect-ratio hielt das Blatt auf A4-Höhe fest (Inhalt lief darüber hinaus).
   Stattdessen Mindesthöhe aus der Breite berechnen – längere Belege wachsen mit. */
.split-doc .split-main { container-type: inline-size; }
.paper-letter { aspect-ratio: auto; min-height: calc(min(100cqw, 820px) * 1.4142); }
@media (max-width: 720px) { .paper-letter { min-height: 0; } }
/* dezentere Linien, etwas mehr Luft zwischen den Positionen */
.pl-items td { padding-top: 9px; padding-bottom: 9px; border-bottom-color: #E4E4E4; }
.pl-totals { border-top-color: #C8C8C8; }
.pl-items th.pl-pos + th, .pl-items td.pl-pos + td { padding-left: 16px; }
.pl-items td.pl-pos { font-variant-numeric: tabular-nums; }
.pl-totals .pl-grand { font-size: inherit; }
/* Summenlinie bündig an der letzten Position, dezent wie die Positionslinien */
.pl-table-wrap { margin-bottom: 0; }
.pl-totals { margin-top: 0; border-top: 1px solid #E4E4E4; }
/* gleicher Rand links und rechts */
.paper-letter { padding-left: 40px; padding-right: 40px; }
.paper-letter .pl-footer { margin-left: -40px; margin-right: -40px; padding-left: 40px; padding-right: 40px; }
.pl-items th.num:nth-last-child(2), .pl-items td.num:nth-last-child(2) { padding-left: 2.2rem; }
.pl-items th.num:nth-last-child(2), .pl-items td.num:nth-last-child(2) { padding-left: 1.2rem; }
.pl-items th.pl-pos, .pl-items td.pl-pos { width: 30px; }
.pl-items thead th:last-child { padding-right: 16px; }
.pl-items { margin-right: -10px; width: calc(100% + 10px); }
.pl-items tbody td:last-child { padding-right: 16px; }
/* Vorschau: „Pos.“ passte nicht in die 30px-Spalte und lief nach rechts über */
.pl-items th.pl-pos, .pl-items td.pl-pos { width: 40px; min-width: 40px; padding-left: 0; padding-right: 0; text-align: center; }
.pl-notice hr { width: 23px; }
/* „P“ hat links mehr Vorbreite als der Punkt rechts – optisch ausgleichen */
.pl-items th.pl-pos { padding-right: 3px; }
.pl-items td.pl-pos { border-bottom-color: #E4E4E4; }
.pl-items tbody tr:last-child td.pl-pos { border-bottom-color: transparent; }
.pl-info dt { color: #404040; }
.pl-items { margin-right: -6px; width: calc(100% + 6px); }
.pl-items thead th:last-child, .pl-items tbody td:last-child { padding-right: 12px; }
.pl-totals { margin-right: -6px; width: calc(100% + 6px); padding-right: 6px; box-sizing: border-box; }
.pl-sections .pl-taxnote { color: #000; margin: 0 0 1.1rem; }
.pl-sections .pl-taxnote + .pl-taxnote { margin-top: -1rem; }
.pl-sections .pl-taxnote { font-weight: 400; font-size: inherit; color: #404040; }
.pl-sep { width: 23px; margin: 0 0 1.1rem; border: 0; border-top: 1.5px solid #404040; }
.pl-logo img { width: 36%; max-width: 245px; }
/* E-Mail-Versand */
.mail-form { max-width: 820px; }
.mail-attach { display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem; margin: .5rem 0 .75rem; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.mail-sig { white-space: pre-wrap; font: inherit; font-size: .85rem; color: var(--muted); background: var(--surface-2); padding: .75rem; border-radius: var(--radius-sm); margin: 0; }
.mail-presets { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.mail-split { display: inline-flex; gap: .4rem; flex-wrap: wrap; }
.smtp-details summary { cursor: pointer; }
.smtp-details[open] summary { margin-bottom: 1rem; }
.btn.is-busy { opacity: .6; pointer-events: none; }

/* Ansprechpartner: Kontakt & Firma oben nebeneinander */
.contact-profile { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: .5rem 2rem; position: relative; }
.contact-profile h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 .6rem; }
.cp-list { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .45rem 1rem; margin: 0; font-size: .92rem; }
.cp-list dt { display: flex; align-items: center; gap: .4rem; color: var(--muted); }
.cp-list dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-company { margin: 0 0 .4rem; }
.cp-notes { margin-top: .75rem; }
.cp-edit { grid-column: 1 / -1; }
.cp-edit > summary { position: absolute; top: 1rem; right: 1rem; }
.cp-edit[open] > summary { position: static; margin: .5rem 0; }
@media (max-width: 720px) { .contact-profile { grid-template-columns: 1fr; } .cp-edit > summary { position: static; } }
.cp-edit { border-top: 1px solid var(--border); padding-top: .75rem; margin-top: .5rem; }
.cp-edit > summary, .cp-edit[open] > summary { position: static; margin: 0; }
.cp-edit[open] > summary { margin-bottom: .75rem; }
/* Firma links, Kontakt rechts */
.contact-profile { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
.contact-profile > .cp-col:nth-child(1) { order: 2; }
.contact-profile > .cp-col:nth-child(2) { order: 1; }
.contact-profile > .cp-edit { order: 3; }
@media (max-width: 720px) { .contact-profile { grid-template-columns: 1fr; } }
/* Ansprechpartner-Karten im Kunden: gleicher Hover-Effekt wie Projektkarten (Farbleiste oben, leichtes Anheben) */
.contact-card:not(.contact-new) { position: relative; overflow: hidden; transition: transform .25s, box-shadow .25s, border-color .25s; }
.contact-card:not(.contact-new)::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--brand-grad);
  transform: scaleX(0); transform-origin: left; transition: transform .35s ease;
}
.contact-card:not(.contact-new):hover { box-shadow: var(--shadow-lg); border-color: transparent; }
.contact-card:not(.contact-new):hover::before { transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) { .contact-card { transition: none; } .contact-card:hover { transform: none; } }
/* kleine Buttons in den Ansprechpartner-Karten, nebeneinander */
.btn-xs { min-height: 28px; padding: .2rem .6rem; font-size: .78rem; gap: .3rem; }
.btn-xs .icon { width: 14px; height: 14px; }
.contact-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .4rem; margin-top: .2rem; }
.contact-actions .contact-edit[open] { flex: 1 1 100%; }
/* Symbol-Kacheln hellgrau statt orange (Nutzerwunsch) */
:root { --icon-tile: #EEF1F5; }

/* ---------- Projekte ---------- */
.search-inline input { min-width: 260px; }
.chip-sm { font-size: .75rem; padding: .15rem .55rem; display: inline-flex; align-items: center; gap: .25rem; cursor: pointer; }
.select-sm { width: auto; min-height: 32px; padding: .2rem .5rem; font-size: .85rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.link-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.link-card { display: flex; flex-direction: column; gap: .6rem; }
.link-head { display: flex; align-items: flex-start; gap: .7rem; }
.link-creds { font-size: .88rem; }
.link-creds dd { display: flex; align-items: center; gap: .3rem; }
.is-copied { color: var(--ok) !important; }
.portal-newpw { line-height: 1.7; }
.tab-panel .activity-form-foot { flex-wrap: wrap; }

/* ---------- Kundenterminal ---------- */
body.portal { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
.portal-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem clamp(16px, 4vw, 40px); background: var(--surface); border-bottom: 1px solid var(--border); }
.portal-brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); }
.portal-brand img { height: 26px; }
.portal-brand span { font-weight: 600; color: var(--muted); border-left: 1px solid var(--border-strong); padding-left: .7rem; }
.portal-user { display: flex; align-items: center; gap: .5rem; }
.portal-main { width: min(1180px, 100%); margin: 0 auto; padding: 1.5rem clamp(16px, 4vw, 40px) 3rem; flex: 1; }
.portal-foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; display: flex; justify-content: center; gap: .4rem; align-items: center; }
.portal-login { margin: 6vh auto 0; }
.portal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; margin-top: 1.5rem; align-items: start; }
.mb-s { margin-bottom: .6rem; }
@media (max-width: 900px) { .portal-grid { grid-template-columns: 1fr; } }
/* Projektkarte: kleines Symbol „für Kunde sichtbar“ statt Text-Badge (wurde bei langen Namen abgeschnitten) */
.portal-pill { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.project-card-head strong { min-width: 0; overflow-wrap: anywhere; }
.filter-row { justify-content: flex-start; gap: .75rem; flex-wrap: wrap; }
/* Projekte: je Kunde eine Zeile */
.project-group { margin-bottom: 1.6rem; }
.project-group-head { display: flex; align-items: center; gap: .5rem; font-size: 1rem; margin: 0 0 .7rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.project-group-head a { color: var(--ink); text-decoration: none; }
.project-group-head a:hover { color: var(--brand-soft); }
.project-group-head .count { font-size: .75rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: .05rem .5rem; }
/* Inline-Formulare mit beschriftetem Feld: Button auf Höhe des Eingabefelds */
.inline-form:has(> .field) { align-items: flex-end; }
.inline-form:has(> .field) > .btn, .inline-form > .field select, .inline-form > .field input { height: 44px; min-height: 44px; }
.inline-form > .field { margin: 0; }
/* Projektkacheln: alle gleich groß – Titel max. 2 Zeilen, Kennzahlen immer unten */
.project-group .project-card { height: 150px; justify-content: flex-start; }
.project-group .project-card-head strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.project-group .project-card .budget-bar { margin-top: auto; }
.project-group .project-card .project-card-nums { margin-top: auto; }
.project-group .project-card .budget-bar + .project-card-nums { margin-top: .5rem; }
/* Projektkacheln kompakter */
.project-group .project-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; }
.project-group .project-card { height: 118px; padding: 14px 16px; gap: .15rem; }
.project-group .project-card-head strong { font-size: .95rem; }
.project-group .portal-pill { width: 22px; height: 22px; }
.project-group .project-card .project-card-nums { font-size: .8rem; }
.target-choice { display: grid; gap: .6rem; max-width: 640px; }
.target-choice select { margin-left: 1.6rem; width: calc(100% - 1.6rem); }
/* Übersicht: Kacheln Aufgaben & Zeiterfassung anklickbar (öffnen das Modul), Hover wie Projektkarten */
.widget-click { cursor: pointer; position: relative; overflow: hidden; transition: transform .25s, box-shadow .25s, border-color .25s; }
.widget-click::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--brand-grad); transform: scaleX(0); transform-origin: left; transition: transform .3s; }
.widget-click:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: transparent; }
.widget-click:hover::before { transform: scaleX(1); }
.widget-click .widget-project, .widget-click .task-line { border-radius: var(--radius-sm); transition: background .15s; }
.widget-click .widget-project:hover, .widget-click .task-line:hover { background: var(--surface-2); }
@media (prefers-reduced-motion: reduce) { .widget-click { transition: none; } .widget-click:hover { transform: none; } }
.widget-click .task-list > li { border-radius: var(--radius-sm); transition: background .15s; }
.widget-click .task-list > li:hover { background: var(--surface-2); }
.api-token { display: inline-block; margin: .4rem .4rem .2rem 0; padding: .3rem .5rem; background: var(--surface); border-radius: var(--radius-sm); word-break: break-all; }

/* ---------- Accounting ---------- */
.year-switch select { width: auto; min-height: 40px; }
.badge-exp-review { background: var(--warn-bg); color: var(--warn); }
.badge-exp-booked { background: var(--ok-bg); color: var(--ok); }
.badge-exp-rejected { background: var(--surface-2); color: var(--muted); }
tr.is-muted td { color: var(--muted); }
.table .num.neg { color: var(--danger); }
.table .num.pos { color: var(--ok); }
.uva-table tr.uva-total td { font-weight: 700; border-top: 2px solid var(--border-strong); }
.exp-preview { width: 100%; padding: 0; }
.year-bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: .5rem; align-items: end; height: 200px; margin: 1rem 0 .5rem; }
.yb { display: flex; flex-direction: column; align-items: center; gap: .3rem; height: 100%; }
.yb-bars { flex: 1; display: flex; align-items: flex-end; gap: 3px; width: 100%; justify-content: center; }
.yb-bars span { width: 40%; border-radius: 3px 3px 0 0; min-height: 2px; }
.yb-in, .yb-key.yb-in { background: #2f9e5b; }
.yb-out, .yb-key.yb-out { background: var(--brand); }
.yb small { color: var(--muted); font-size: .72rem; }
.yb-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }
.finance-top { margin-bottom: 1.25rem; }
/* Projektkacheln: auf großen Bildschirmen breiter, damit lange Namen ganz sichtbar sind */
@media (min-width: 1400px) {
  .project-group .project-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
  .project-group .project-card { height: 132px; padding: 16px 18px; }
  .project-group .project-card-head strong { font-size: 1rem; }
}
@media (min-width: 1900px) {
  .project-group .project-grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
}
/* Accounting: eingebettete Beleg-/Dokumentvorschau */
.doc-preview h2 { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.doc-preview iframe { width: 100%; height: 70vh; min-height: 420px; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; background: #fff; }
.doc-preview-lg { padding: .5rem; }
.doc-preview-lg iframe { height: calc(100vh - 220px); min-height: 520px; border: 0; }
.doc-preview img { max-width: 100%; border-radius: 8px; }
/* Filter-Chips neben Suchfeld: nicht auf Feldhöhe strecken, Text mittig */
.chips { align-items: center; }
.chip { display: inline-flex; align-items: center; justify-content: center; }
.badge-st-proforma { background: var(--surface-2, #f1f2f4); color: var(--muted); border-color: transparent; font-style: italic; }
/* Gruppenzeilen in Tabellen (z. B. Eingangsrechnungen nach Status) */
.table tr.group-row th { background: var(--surface-2, #f6f7f9); text-align: left; font-weight: 600; padding-top: .7rem; padding-bottom: .5rem; border-top: 1px solid var(--border); }
.table tr.group-row:first-child th { border-top: 0; }
/* Reiter mit Icon (z. B. Buchhaltung) */
.subnav-item { display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; white-space: nowrap; }
.subnav-item .icon { opacity: .7; }
.subnav-item.active .icon { opacity: 1; color: var(--brand); }
/* Reiter (Kunde, Projekt …) im gleichen Pillen-Stil wie die Buchhaltungs-Reiter */
.tabs { gap: .25rem; border-bottom: 0; padding: .15rem 0 .35rem; }
.tab {
  display: inline-flex; align-items: center; gap: .35rem; padding: .38rem .8rem; border-radius: 999px;
  border: 0; margin-bottom: 0; font-size: .88rem; font-weight: 500; color: var(--muted);
}
.tab:hover { background: var(--surface); color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); border-bottom-color: transparent; }
.tab .count { margin-left: 0; }
/* Reiter: alle weiß hinterlegt, aktiver Reiter hell-orange wie im Hauptmenü */
.subnav-item, .tab { background: var(--surface); border: 1px solid var(--border); box-shadow: none; }
.subnav-item:hover, .tab:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.subnav-item.active, .tab.active { background: var(--info-bg); border-color: color-mix(in srgb, var(--brand) 35%, transparent); color: var(--text); font-weight: 600; box-shadow: none; }
.subnav-item.active .icon, .tab.active .icon { color: var(--brand); opacity: 1; }
/* Buchhaltung: kleine Aktionen direkt unter der Überschrift */
.acc-actions { display: flex; align-items: center; gap: .45rem; margin-top: .55rem; flex-wrap: wrap; }
.acc-actions:empty { display: none; }
.acc-actions .year-switch select { min-height: 32px; padding: .25rem 1.8rem .25rem .65rem; font-size: .82rem; width: auto; }
/* Kacheln anordnen (Finanzen) */
.kpis[data-kpi-sort] [data-kpi-key] { cursor: grab; user-select: none; -webkit-user-drag: none; }
.kpis[data-kpi-sort] [data-kpi-key]:hover { transform: none; }
.kpis[data-kpi-sort] [data-kpi-key].is-dragging { cursor: grabbing; opacity: .75; box-shadow: var(--shadow-lg); background: var(--info-bg); }
/* Kopfzeile aller Module: kompakte Knöpfe und Auswahlfelder (wie in der Buchhaltung) */
.page-head .actions { gap: .45rem; align-items: center; }
.page-head .actions .btn { padding: .3rem .65rem; font-size: .82rem; min-height: 32px; gap: .35rem; }
.page-head .actions .btn .icon { width: 15px; height: 15px; }
.page-head .actions .icon-btn { width: 32px; height: 32px; }
.page-head .actions select, .page-head .actions input:not([type="hidden"]):not([type="checkbox"]) { min-height: 32px; padding: .25rem .65rem; font-size: .82rem; width: auto; }
.page-head .actions select { padding-right: 1.8rem; }
.portal-fieldset { display: flex; flex-direction: column; gap: .4rem; margin: .4rem 0 0; padding-top: .7rem; border-top: 1px solid var(--border); }
.portal-fieldset legend { float: left; width: 100%; font-size: .9rem; margin-bottom: .3rem; }
/* Benutzer: Modulzugriff */
.module-access { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .35rem .9rem; padding: .7rem .8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.module-access legend { grid-column: 1 / -1; float: left; width: 100%; font-size: .9rem; margin-bottom: .2rem; }
/* Benutzerliste: „Mein Konto“ und „Bearbeiten“ rechtsbündig untereinander; geöffnetes Formular über die volle Breite */
.user-edit { min-width: 0; display: flex; flex-direction: column; align-items: flex-end; }
.user-edit[open] { flex-basis: 100%; align-items: stretch; }
.user-edit[open] summary { align-self: flex-end; }
/* Profilbilder */
img.avatar-img { object-fit: cover; padding: 0; background: var(--surface-2); }
.avatar-xl { width: 64px; height: 64px; font-size: 1.4rem; }
.avatar-field { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.avatar-field[data-avatar-drop] { border: 2px dashed transparent; border-radius: var(--radius); padding: .4rem; margin: -.4rem; transition: border-color .15s, background .15s; }
.avatar-field.is-drop { border-color: var(--brand); background: var(--info-bg); }
.project-access { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; padding: .7rem .8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.project-access legend { float: left; width: 100%; font-size: .9rem; margin-bottom: .2rem; }
.project-access input:disabled + * , .project-access label:has(input:disabled) { opacity: .6; }
/* Suchfelder: niedriger (Breite unverändert) */
input[type="search"] { min-height: 34px; padding-top: .35rem; padding-bottom: .35rem; font-size: .9rem; }
.global-search input[type=search] { min-height: 38px; padding: .4rem 3rem .4rem 2.6rem; font-size: .92rem; }
.global-search .gs-icon { left: 12px; }
.search .icon { left: 10px; }
.search input { padding-left: 34px; }

/* ---------- Finanzen: Umschalter Firma/Privat ---------- */
.scope-switch { display: inline-flex; gap: .15rem; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; }
.scope-switch a { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .85rem; border-radius: 999px; font-size: .85rem; font-weight: 500; color: var(--muted); text-decoration: none; }
.scope-switch a:hover { color: var(--text); background: var(--surface-2); }
.scope-switch a.active { background: var(--info-bg); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 35%, transparent); }
.scope-switch a.active .icon { color: var(--brand); }

/* ---------- Private Finanzen ---------- */
.pf-title { margin: .4rem 0 .8rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.pf-split { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.pf-split span { display: block; height: 100%; }
.pf-c1 { background: #323233; } .pf-c2 { background: var(--brand); } .pf-c3 { background: var(--signal); }
.pf-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .2rem; vertical-align: -1px; }
.pf-filter { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: 1rem 0 .8rem; }
.pf-filter .field-inline { display: inline-flex; align-items: center; gap: .4rem; }
.pf-filter select { min-height: 34px; padding: .25rem 1.8rem .25rem .6rem; font-size: .85rem; width: auto; }
.pf-cat { min-height: 30px; padding: .15rem 1.6rem .15rem .5rem; font-size: .82rem; width: auto; max-width: 210px; }
.pf-cat.is-empty { color: var(--muted); border-style: dashed; }
.pf-tx td { vertical-align: middle; }
.pf-import { margin: 1rem 0; }
.pf-import .dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 1.1rem; text-align: center; display: flex; flex-direction: column; gap: .2rem; cursor: pointer; background: var(--surface-2); }
.pf-import .dropzone.is-over { border-color: var(--brand); background: var(--info-bg); }
.import-status { margin: .6rem 0 0; font-size: .9rem; }
.import-status.is-error { color: var(--danger); }
.import-map, .import-preview { margin-top: .8rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
@media (max-width: 800px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pf-details > summary, .pf-details-row > summary { cursor: pointer; list-style: none; }
.pf-details > summary::-webkit-details-marker, .pf-details-row > summary::-webkit-details-marker { display: none; }
.pf-details-row { padding: .3rem 0; }
.pf-price { width: 100px; text-align: right; min-height: 32px; padding: .2rem .5rem; font-size: .85rem; }
.pf-price.is-warn { border-color: var(--danger); }
.pf-depot td { vertical-align: top; }
.pf-goal { padding: .2rem 0 .6rem; border-bottom: 1px solid var(--border); }
.pf-goal:last-child { border-bottom: 0; }
.pf-goal-head { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .35rem; }
.pf-bar { height: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-bottom: .3rem; }
.pf-bar span { display: block; height: 100%; background: var(--brand-grad); border-radius: 999px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
@media (max-width: 800px) { .grid-3 { grid-template-columns: 1fr; } }
.import-spaces { margin-top: .8rem; }
.import-spaces select { min-width: 280px; }

/* Finanzen: Auge zum Verbergen der Zahlen */
.fin-eye { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; padding: 0; }
.fin-eye:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.fin-eye .icon { width: 18px; height: 18px; display: block; }
.fin-eye .fe-on { display: none; }
.fin-eye.is-on { background: var(--info-bg); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.fin-eye.is-on .fe-on { display: inline-flex; }
.fin-eye.is-on .fe-off { display: none; }
.fin-eye .fe-off { display: inline-flex; }
/* Inhalt erst zeigen, wenn die Zahlen markiert sind (kein kurzes Aufblitzen); Notausgang nach 1,5 s falls JS ausfällt */
.main:has([data-fin-eye]):not(.fin-ready) { visibility: hidden; animation: fin-show 0s 1.5s forwards; }
@keyframes fin-show { to { visibility: visible; } }
.main.fin-masked .fin-num { filter: blur(7px); user-select: none; }
.main.fin-masked :is(.year-bars, .forecast-bar, .pf-split, .pf-bar, .budget-bar, .legend .lg) { filter: blur(6px); }
.main.fin-masked .yb-bars span { height: 40% !important; }

/* Belegnummer in der Liste: Inter statt Monospace */
.table td.doc-no, .table-click td.doc-no { font-family: inherit; font-size: inherit; font-weight: 600; white-space: nowrap; }

/* Überschrift mit Filter-Chips daneben (Projekte) */
.head-inline { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.head-inline h1 { margin: 0; }

/* Reiter per Drag & Drop anordnen */
.subnav-item[draggable="true"], .tabs .tab[draggable="true"] { cursor: grab; }
.subnav-item.is-dragging, .tab.is-dragging { opacity: .45; }
.subnav-item.drop-target, .tab.drop-target { outline: 2px dashed var(--brand); outline-offset: 2px; }

/* Nummern-Spalte in allen Listen gleich schmal */
.table .col-no { width: 8.5rem; min-width: 8.5rem; max-width: 8.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Spaltenbreite ziehen */
.table th { position: relative; }
.table.is-resized th, .table.is-resized td { overflow: hidden; text-overflow: ellipsis; }
.col-resizer { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; user-select: none; }
.col-resizer:hover, .is-col-resizing .col-resizer { background: color-mix(in srgb, var(--brand) 35%, transparent); }
body.is-col-resizing { cursor: col-resize; user-select: none; }
tr[hidden] { display: none; }

.filter-row select { width: auto; min-width: 11rem; max-width: 16rem; }

/* Sortierleiste für Kartenlisten (Projekte) – Optik wie Tabellenkopf */
.sortbar { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem 1.25rem; padding: .7rem 1.25rem; margin-bottom: 1rem; background: var(--surface-2, #f1f4f8); }
.sortbar-label { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); opacity: .7; }
.sortbar-item { display: inline-flex; align-items: center; border: 0; background: none; padding: .2rem 0; cursor: pointer; font: inherit; font-size: .76rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.sortbar-item:hover { color: var(--text); }
.sortbar-item:hover .sort-ind i { opacity: .6; }
.sortbar-item[aria-sort="ascending"] .sort-ind .up, .sortbar-item[aria-sort="descending"] .sort-ind .down { opacity: 1; color: var(--brand); }
.sortbar-item[aria-sort="ascending"] .sort-ind .down, .sortbar-item[aria-sort="descending"] .sort-ind .up { opacity: .15; }
.sortbar-item[aria-sort="ascending"], .sortbar-item[aria-sort="descending"] { color: var(--text); }

/* Auswahlfelder in Filterleisten (Jahr, Status …) gleich hoch wie das Suchfeld */
.toolbar select, .filter-row select, .year-switch select { min-height: 35px; height: 35px; padding-top: .3rem; padding-bottom: .3rem; font-size: .9rem; }

/* Projekte: abgeschlossene unten in eigenem Bereich */
.project-section-head { margin: 2rem 0 .75rem; padding-top: 1rem; border-top: 2px solid var(--border); font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.project-groups.is-done .project-card { opacity: .75; }

/* Kunde → Dateien (CRM-Ablage) */
.file-upload { margin-bottom: 1rem; }
.file-upload summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.file-upload form { margin-top: .9rem; }

/* Ansprechpartner: Foto per Klick ändern */
.photo-pick { margin: 0; }
.photo-pick-label { position: relative; display: inline-block; cursor: pointer; border-radius: 50%; }
.photo-pick-badge { position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border-strong); color: var(--muted); box-shadow: var(--shadow); }
.photo-pick-label:hover .photo-pick-badge { color: var(--brand); border-color: var(--brand); }
.photo-pick.is-drop .avatar { outline: 2px dashed var(--brand); outline-offset: 3px; }

/* Buchhaltung → Abgleich mit der Steuerberatung */
.check-quarters { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
.check-q { padding: 0; overflow: hidden; }
.check-q-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--border); }
.check-q-head h2 { margin: 0; font-size: 1.05rem; }
.check-table td, .check-table th { padding-top: .45rem; padding-bottom: .45rem; }
.check-table .col-kz, .check-accounts .col-kz { width: 4.5rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.check-table tr.check-total td { font-weight: 700; border-top: 2px solid var(--border-strong); }
.badge-check-ok { background: #e3f4ea; color: #1d7a45; }
.badge-check-warn { background: #fdecea; color: #b42318; }
.badge-check-info { background: var(--surface-2); color: var(--muted); }
td.danger { color: #b42318; font-weight: 600; }
td .ok, .ok { color: #1d7a45; }
.check-accounts { margin-top: 1rem; }
.check-accounts summary { cursor: pointer; font-weight: 600; padding: .25rem 0; display: flex; align-items: center; gap: .4rem; }
/* Buchhaltung → Steuerrecht */
.law-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.law-top h2, .law-sources h2 { font-size: 1rem; display: flex; align-items: center; gap: .4rem; margin: 0 0 .7rem; }
.law-dates { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.law-dates li { display: grid; grid-template-columns: 6.5rem 1fr; gap: .5rem; font-size: .92rem; }
.law-check { margin: 0 0 .9rem 1.1rem; padding: 0; display: grid; gap: .35rem; font-size: .92rem; }
.law-sec { margin-bottom: .75rem; }
.law-sec summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: .45rem; }
.law-list { display: grid; grid-template-columns: 12rem 1fr; gap: .55rem 1.25rem; margin: 1rem 0 .25rem; font-size: .93rem; }
.law-list dt { font-weight: 600; }
.law-list dd { margin: 0; }
.law-ref { display: inline-block; margin-left: .35rem; font-size: .78rem; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 0 .5rem; }
.law-sources ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .3rem; font-size: .92rem; }
@media (max-width: 640px) { .law-list { grid-template-columns: 1fr; gap: .2rem; } .law-list dd { margin-bottom: .6rem; } }

/* anklickbare Karten (Ansprechpartner) */
[data-card-href] { cursor: pointer; }
[data-card-href] details, [data-card-href] form { cursor: auto; }

.kpis-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1200px) { .kpis-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .kpis-5 { grid-template-columns: repeat(2, 1fr); } }

/* Ansprechpartner: Umschalter Kacheln/Liste */
.view-switch { display: inline-flex; gap: .15rem; padding: 3px; margin-bottom: .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; }
.view-switch button { display: inline-flex; align-items: center; gap: .35rem; border: 0; background: none; padding: .25rem .8rem; border-radius: 999px; font: inherit; font-size: .85rem; color: var(--muted); cursor: pointer; }
.view-switch button:hover { color: var(--text); background: var(--surface-2); }
.view-switch button.active { background: var(--info-bg); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 35%, transparent); }
.contact-grid.is-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem .75rem; }
.contact-grid.is-list .contact-card { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .15rem .8rem; padding: .6rem .9rem; }
.contact-grid.is-list .contact-lines { grid-column: 2; flex-direction: row; flex-wrap: wrap; gap: .1rem 1rem; }
.contact-grid.is-list .contact-head strong { font-size: .95rem; }
.contact-grid.is-list .contact-head .badge { font-size: .7rem; padding: 0 .45rem; }
.contact-grid.is-list .contact-head { display: contents; }
.contact-grid.is-list .contact-head .avatar { width: 40px; height: 40px; font-size: .95rem; grid-row: span 2; }
.contact-grid.is-list .contact-head > div { min-width: 0; }
.contact-grid.is-list .contact-head > div .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-grid.is-list .contact-lines { gap: .1rem; font-size: .82rem; }
.contact-grid.is-list .contact-lines li:nth-child(n+3) { display: none; }
.contact-grid.is-list .contact-card > p, .contact-grid.is-list .contact-actions { display: none; }
.contact-grid.is-list .contact-new { grid-column: 1 / -1; display: block; padding: .6rem .9rem; }
@media (max-width: 800px) { .contact-grid.is-list { grid-template-columns: 1fr; } }

/* ============================================================
   Einheitliche Ecken für Reiter, Umschalter und Filter-Chips:
   gleicher Radius wie Karten/Kacheln (--radius) statt Pillenform.
   Innenliegende Elemente: äußerer Radius minus Innenabstand (konzentrisch).
   Status-Badges, Fortschrittsbalken, Schalter und runde Symbole bleiben unverändert.
   ============================================================ */
.tab, .subnav-item, .chip { border-radius: var(--radius); }
.tab .count, .project-group-head .count, .count-pill { border-radius: var(--radius-sm); }
.segmented, .scope-switch, .view-switch { border-radius: var(--radius); }
.segmented span, .segmented a, .segmented button,
.scope-switch a, .view-switch button { border-radius: calc(var(--radius) - 3px); }
/* Umschalter nur so breit wie sein Inhalt (nicht über die ganze Zeile) */
.view-switch, .scope-switch, .segmented { align-self: flex-start; width: fit-content; max-width: 100%; }

/* ---------- Survey ---------- */
.survey-new summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.survey-new form { margin-top: 1rem; }
.badge-survey-draft { background: var(--surface-2); color: var(--muted); }
.badge-survey-open { background: #e3f4ea; color: #1d7a45; }
.badge-survey-closed { background: #f1f1f1; color: #555; }
.survey-h { font-size: 1rem; display: flex; align-items: center; gap: .4rem; margin: 0 0 .8rem; }
.survey-rows { display: grid; gap: .75rem; margin-bottom: .8rem; counter-reset: q; }
.survey-q { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .6rem; align-items: start; padding: .8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.survey-q-no::before { counter-increment: q; content: counter(q) "."; font-weight: 700; color: var(--muted); display: block; padding-top: 1.9rem; }
.survey-q-body { display: grid; gap: .5rem; min-width: 0; }
.survey-q-line { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.survey-q-line .grow, .survey-slot .grow { flex: 1 1 220px; }
.survey-q-line .check { padding-bottom: .55rem; white-space: nowrap; }
.survey-slot { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.survey-slot .icon-btn, .survey-q .icon-btn { margin-bottom: .35rem; }
.field-narrow { max-width: 260px; }
.survey-delete { margin-top: 1.5rem; }
.survey-link { display: flex; gap: .5rem; }
.survey-link input { flex: 1; }
.actions-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.survey-result h2 { font-size: 1rem; margin: 0 0 .7rem; }
.survey-bars { display: grid; gap: .35rem; }
.survey-bar { display: grid; grid-template-columns: minmax(80px, 220px) 1fr 2.5rem; gap: .6rem; align-items: center; font-size: .9rem; }
.survey-bar-track { height: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm, 4px); overflow: hidden; }
.survey-bar-track i { display: block; height: 100%; background: var(--brand-grad); }
.survey-bar-n { text-align: right; font-variant-numeric: tabular-nums; }
.survey-avg { margin: 0 0 .6rem; }
.survey-texts { margin: 0; padding-left: 1.1rem; display: grid; gap: .35rem; font-size: .92rem; }
.survey-matrix-wrap { overflow-x: auto; }
.survey-matrix th, .survey-matrix td { white-space: nowrap; }
.survey-matrix td.center, .survey-matrix th.center { text-align: center; }
.survey-matrix .vote-yes { background: #e3f4ea; color: #1d7a45; font-weight: 700; }
.survey-matrix .vote-maybe { background: #fff4d6; color: #8a6100; }
.survey-matrix .vote-no { color: var(--muted); }
.survey-matrix th.is-best { background: #e3f4ea; color: #1d7a45; }
.survey-comment { white-space: normal; color: var(--muted); max-width: 260px; }
/* öffentliche Teilnahmeseite */
.survey-public { max-width: 760px; margin: 0 auto; }
.survey-sheet { margin-bottom: 1rem; }
.survey-sheet h1 { font-size: 1.4rem; margin: 0 0 .5rem; }
.survey-intro { white-space: normal; }
.survey-field { border: 0; padding: .9rem 0; margin: 0; border-top: 1px solid var(--border); display: grid; gap: .45rem; }
.survey-field legend { font-weight: 600; padding: 0; margin-bottom: .2rem; float: left; width: 100%; }
.survey-field.has-error legend { color: #b42318; }
.survey-field .req, .field-error { color: #b42318; }
.field-error { font-size: .82rem; }
.survey-scale span { min-width: 2.4rem; justify-content: center; }
.survey-person { border-top: 1px solid var(--border); padding-top: 1rem; display: grid; gap: .6rem; }
.survey-votes { display: grid; gap: .5rem; }
.survey-vote-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--radius); }
.survey-vote-opts { display: flex; gap: .35rem; flex-wrap: wrap; }
.survey-vote-opts label { cursor: pointer; }
.survey-vote-opts input { position: absolute; opacity: 0; pointer-events: none; }
.survey-vote-opts span { display: inline-block; padding: .3rem .7rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: .85rem; color: var(--muted); background: var(--surface); }
.survey-vote-opts .vote-yes input:checked + span { background: #e3f4ea; border-color: #9fd3b4; color: #1d7a45; font-weight: 600; }
.survey-vote-opts .vote-maybe input:checked + span { background: #fff4d6; border-color: #f0d18a; color: #8a6100; font-weight: 600; }
.survey-vote-opts .vote-no input:checked + span { background: var(--surface-2); color: var(--text); font-weight: 600; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ============================================================
   Dunkler Modus (Umschalter in der Seitenleiste, je Benutzer)
   Belegvorschau (Papier) und PDF bleiben bewusst hell.
   ============================================================ */
.theme-toggle { display: flex; align-items: center; gap: .55rem; width: 100%; margin-top: 8px; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer; }
.theme-toggle:hover { color: var(--text); background: var(--surface-2); }
.theme-toggle-label { flex: 1; text-align: left; }
.theme-toggle .theme-ic-sun, html[data-theme="dark"] .theme-toggle .theme-ic-moon { display: none; }
html[data-theme="dark"] .theme-toggle .theme-ic-sun { display: inline; }
.theme-switch { position: relative; width: 30px; height: 17px; border-radius: 999px; background: var(--border-strong); flex: none; transition: background .15s; }
.theme-switch i { position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform .15s; }
html[data-theme="dark"] .theme-switch { background: var(--brand); }
html[data-theme="dark"] .theme-switch i { transform: translateX(13px); }

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121418;
  --surface: #1b1e24;
  --surface-2: #23272e;
  --text: #E6E9EF;
  --muted: #9AA3B3;
  --border: #2D323B;
  --border-strong: #3B414C;
  --info-bg: rgba(240, 90, 14, .16);
  --icon-tile: #262A31;
  --ok: #4cc283;
  --ok-bg: rgba(76, 194, 131, .14);
  --warn: #f0b04a;
  --warn-bg: rgba(240, 176, 74, .14);
  --danger: #f07a6a;
  --danger-bg: rgba(240, 122, 106, .14);
  --brand-soft: #ff8a4c;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
}
html[data-theme="dark"] .brand-logo, html[data-theme="dark"] .topbar-brand img { content: url("../img/logo-white.png"); }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background-color: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: #6f7887; }
html[data-theme="dark"] .badge-check-ok, html[data-theme="dark"] .badge-survey-open, html[data-theme="dark"] .survey-matrix .vote-yes, html[data-theme="dark"] .survey-matrix th.is-best { background: rgba(76, 194, 131, .16); color: #6fd49c; }
html[data-theme="dark"] .badge-check-warn, html[data-theme="dark"] td.danger { color: #f4907f; }
html[data-theme="dark"] .badge-check-warn { background: rgba(240, 122, 106, .16); }
html[data-theme="dark"] .badge-survey-closed { background: var(--surface-2); color: var(--muted); }
html[data-theme="dark"] .survey-matrix .vote-maybe { background: rgba(240, 176, 74, .16); color: #f0c46e; }
html[data-theme="dark"] code { background: var(--surface-2); }
/* Papier-Vorschau der Belege bleibt hell */
html[data-theme="dark"] .paper, html[data-theme="dark"] .paper-letter { color-scheme: light; }
html[data-theme="dark"] .nav-item { color: #b7bfcc; }
html[data-theme="dark"] .nav-item:hover, html[data-theme="dark"] .nav-item.active { color: var(--text); }
html[data-theme="dark"] .t-call { color: #5fc79c; } html[data-theme="dark"] .t-email { color: #7fb0e6; } html[data-theme="dark"] .t-meeting { color: #b49be0; }
html[data-theme="dark"] td .ok, html[data-theme="dark"] .ok { color: #6fd49c; }
.contact-pick { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: .5rem; display: grid; gap: .4rem; }
.contact-pick-search { width: 100%; }
.contact-pick-list { max-height: 260px; overflow-y: auto; display: grid; gap: .5rem; padding: .1rem .25rem; }
.contact-pick-firm { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .15rem; }
.contact-pick-group .check { display: flex; gap: .45rem; align-items: center; padding: .15rem 0; font-size: .92rem; }
/* Ansprechpartner-Auswahl: Kacheln der Gewählten + aufklappende Liste */
.contact-pick { position: relative; }
.contact-pick .contact-pick-list { display: none; }
.contact-pick.is-open .contact-pick-list { display: grid; border-top: 1px solid var(--border); padding-top: .5rem; }
.cp-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.cp-chips:empty { display: none; }
.cp-chip { display: inline-flex; align-items: center; gap: .5rem; padding: .3rem .35rem .3rem .3rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); max-width: 100%; }
.cp-av { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--info-bg); color: var(--brand-soft); font-weight: 700; font-size: .8rem; flex: none; }
.cp-tx { display: grid; line-height: 1.2; min-width: 0; }
.cp-tx strong { font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-tx small { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-x { border: 0; background: none; color: var(--muted); font-size: 1.1rem; line-height: 1; padding: .1rem .35rem; border-radius: var(--radius-sm); cursor: pointer; }
.cp-x:hover { background: var(--surface); color: var(--danger); }
/* schmale Spalten für kurze Werte (Status, Anzahl, Datum) */
.table th.col-w-sm { width: 7.5rem; }
.table th.col-w-md { width: 10rem; }
/* Survey-Teilnahmeseite: Logo dezent */
.survey-public-body .portal-top { justify-content: flex-start; min-height: 72px; padding-top: 1.1rem; padding-bottom: 1.1rem; }
.survey-public-body .portal-brand img { height: 18px; width: auto; }
/* Survey: Teilnehmer mit Foto bzw. Anfangsbuchstabe */
img.cp-av { object-fit: cover; padding: 0; }
.contact-pick-group .check .cp-list-av { width: 26px; height: 26px; font-size: .72rem; flex: none; }
.survey-people { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.survey-person-chip { display: inline-flex; align-items: center; gap: .5rem; padding: .25rem .6rem .25rem .25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); }
.survey-person-chip:hover { border-color: var(--border-strong); background: var(--surface-2); }
.survey-person-chip .avatar { width: 30px; height: 30px; font-size: .78rem; }
.survey-person-chip span { display: grid; line-height: 1.15; font-size: .85rem; font-weight: 600; }
.survey-person-chip small { font-size: .72rem; font-weight: 400; color: var(--muted); }
/* Terminabfrage: „Nicht OK“ als rotes Kreuz */
.survey-matrix .vote-no { color: var(--danger); }
.survey-vote-opts .vote-no input:checked + span { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
/* Terminabfrage: Datum und Uhrzeit getrennt mit Symbolen */
.survey-slot-info { display: grid; gap: .15rem; }
.survey-slot-date { font-weight: 600; }
.survey-slot-time { font-size: .92rem; }
.survey-slot-note { font-size: .85rem; color: var(--muted); }
.survey-emoji { display: inline-block; width: 1.3em; text-align: center; }
.survey-emoji { width: auto; margin-right: .5rem; font-size: .82em; filter: grayscale(1); opacity: .55; vertical-align: .05em; }
/* Survey-Kopfzeile: Logo links, Art (Umfrage/Terminabfrage) mittig */
.survey-public-body .portal-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.survey-head-title { font-size: 1.35rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; line-height: 1.25; text-align: center; }
@media (max-width: 560px) { .survey-public-body .portal-top { grid-template-columns: auto 1fr; } .survey-head-spacer { display: none; } .survey-head-title { text-align: right; font-size: 1.1rem; } }
/* Survey-Teilnahmeseite: orangener Verlaufsstreifen oben auf den Karten (wie die Kacheln in der Übersicht) */
.survey-sheet { position: relative; overflow: hidden; }
.survey-sheet::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--brand-grad); }
/* Terminvorschläge als Kacheln (2–3 Spalten) */
.survey-public { max-width: 900px; }
.survey-votes { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; }
.survey-vote-row { flex-direction: column; align-items: stretch; justify-content: space-between; gap: .75rem; padding: .85rem .9rem; }
.survey-vote-opts { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.survey-vote-opts span { display: block; text-align: center; }
/* Kachel „Keiner der Termine ist OK“ */
.survey-none { cursor: pointer; justify-content: center; align-items: center; text-align: center; border-style: dashed; position: relative; }
.survey-none input { position: absolute; opacity: 0; pointer-events: none; }
.survey-none-box { display: grid; gap: .25rem; }
.survey-none-title { font-weight: 600; }
.survey-none:hover { background: var(--surface-2); }
.survey-none:has(input:checked) { border-style: solid; border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-bg); }
.survey-none:has(input:checked) .survey-none-title { color: var(--danger); }
.survey-none:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
/* Teilnahmeseite: Teilnehmer als Bild-Kacheln mit Kürzel */
.survey-who { border: 0; padding: 0; margin: 0; }
.survey-who legend { font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: .5rem; padding: 0; }
.survey-who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .6rem; }
.survey-who-tile { position: relative; display: grid; justify-items: center; gap: .2rem; padding: .75rem .4rem .6rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: center; transition: border-color .15s, box-shadow .15s; }
.survey-who-tile:hover { border-color: var(--border-strong); background: var(--surface-2); }
.survey-who-tile input { position: absolute; opacity: 0; pointer-events: none; }
.survey-who-av { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--brand-grad); color: #fff; font-weight: 700; font-size: 1.1rem; }
.survey-who-av img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(.35); opacity: .85; transition: filter .15s, opacity .15s; }
.survey-who-ini { font-weight: 700; font-size: .95rem; letter-spacing: .04em; margin-top: .2rem; }
.survey-who-name { font-size: .72rem; color: var(--muted); line-height: 1.2; }
.survey-who-done { font-size: .68rem; color: var(--ok); }
.survey-who-other .survey-who-av { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--border-strong); font-size: 1.5rem; font-weight: 400; }
.survey-who-tile:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); background: var(--info-bg); }
.survey-who-tile:has(input:checked) .survey-who-av img { filter: none; opacity: 1; }
.survey-who-tile:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
/* Fotos ohne Farbstich: kein Verlauf dahinter, nicht durchscheinend */
.survey-who-av:has(img) { background: var(--surface-2); }
.survey-who-av img { opacity: 1; filter: grayscale(.25); }
.survey-who-tile:has(input:checked) .survey-who-av img { filter: none; }
/* Treffer als Kacheln statt langer Liste (erscheinen nur beim Tippen) */
.contact-pick.is-open .contact-pick-list { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .5rem; max-height: 300px; align-content: start; }
.contact-pick-list .contact-pick-group { display: contents; }
.contact-pick-list .contact-pick-group[hidden], .contact-pick-list label[hidden] { display: none !important; }
.contact-pick-list .contact-pick-firm { display: none; }
.contact-pick-group .check { display: flex; align-items: center; gap: .55rem; padding: .45rem .55rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; min-width: 0; }
.contact-pick-group .check:hover { border-color: var(--brand); background: var(--info-bg); }
.contact-pick-group .check input { position: absolute; opacity: 0; pointer-events: none; }
.contact-pick-group .check .cp-list-av { width: 32px; height: 32px; font-size: .8rem; }
.cp-hit-tx { display: grid; line-height: 1.2; min-width: 0; }
.cp-hit-tx strong { font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-hit-tx small { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-pick-group .check { position: relative; }
/* Auswertung: Terminköpfe wie auf der Teilnahmeseite (keine Großbuchstaben) */
.survey-matrix th.slot-head { text-transform: none; letter-spacing: normal; font-size: .85rem; font-weight: 400; color: var(--text); text-align: left; vertical-align: top; white-space: nowrap; }
.survey-matrix th.slot-head .survey-slot-date { font-weight: 600; }
.survey-matrix th.slot-head.is-best { color: var(--text); }
.survey-matrix th.slot-head.is-best .survey-slot-date { color: #1d7a45; }
/* rötlicher Button für beendende Aktionen (z. B. Survey beenden) */
.btn-danger-soft { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger-soft:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
/* Übersicht: Kachel Surveys */
.survey-widget { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.survey-widget li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .45rem 0; border-bottom: 1px solid var(--border); }
.survey-widget li:last-child { border-bottom: 0; }
.survey-widget a { display: grid; text-decoration: none; color: inherit; min-width: 0; }
.survey-widget-name { font-weight: 600; font-size: .92rem; }
