/* =============================================================================
   HMF Server Admin – Design System v3.2
   Ruhige, helle Arbeitsoberfläche. Eine Akzentfarbe, klare Hierarchie über
   Schriftgewicht und Abstände statt über Dekoration.
   ========================================================================== */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f4;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #5b6573;
  --muted-2: #6b7482;
  --line: #e4e7ec;
  --line-2: #d5dae2;
  --accent: #1d4fd7;
  --accent-hover: #1743ba;
  --accent-ink: #143a9e;
  --accent-soft: #eaf0ff;
  --accent-ring: rgba(29, 79, 215, .18);
  --success: #157a53;
  --success-soft: #e6f6ee;
  --warning: #8a5a0b;
  --warning-soft: #fdf3dc;
  --danger: #c02b2b;
  --danger-hover: #a52424;
  --danger-soft: #fdeceb;
  --violet: #5b3fc4;
  --violet-soft: #efeafc;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-2: 0 4px 12px -2px rgba(16, 24, 40, .08), 0 2px 4px -1px rgba(16, 24, 40, .04);
  --shadow-3: 0 20px 40px -12px rgba(16, 24, 40, .18), 0 4px 10px -4px rgba(16, 24, 40, .08);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --sidebar-w: 268px;
  --topbar-h: 64px;
  --font: "Inter", "SF Pro Text", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  color: var(--ink); background: var(--bg);
  font: 14px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01", "tnum";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, dl, dd { margin: 0; }
svg.icon { width: 18px; height: 18px; fill: currentColor; display: block; flex: 0 0 auto; }
code { font-family: var(--mono); font-size: .92em; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -9999px; top: 10px; z-index: 300; padding: 10px 14px; background: var(--ink); color: #fff; border-radius: var(--r-sm); font-weight: 600; }
.skip-link:focus { left: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.searchbox input:focus-visible { outline: none; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.spaced-top { margin-top: 20px; }
.spaced-bottom { margin-bottom: 20px; }

/* -----------------------------------------------------------------------------
   Shell
----------------------------------------------------------------------------- */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 14px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 16px; border-radius: var(--r-sm); }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; flex: 0 0 auto; display: block; object-fit: cover; background: #fff; border: 1px solid var(--line); }
.brand-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.brand-copy strong { font-size: 14px; font-weight: 650; letter-spacing: -.01em; color: var(--ink); }
.brand-copy span { font-size: 12px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kas-pill {
  margin: 0 4px 14px; padding: 8px 10px;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
  color: var(--muted); font-size: 12px;
}
.kas-pill b { color: var(--ink-2); font-weight: 600; font-family: var(--mono); font-size: 11.5px; }
.kas-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }

.nav { display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 0 10px 6px; color: var(--muted-2); font-size: 11.5px; font-weight: 600; }
.nav-link {
  position: relative; min-height: 38px;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 500;
}
.nav-link:hover { background: var(--surface-3); color: var(--ink); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-icon { width: 22px; height: 22px; display: grid; place-items: center; color: var(--muted-2); }
.nav-link.active .nav-icon { color: var(--accent); }

.sidebar-user {
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: minmax(0,1fr) 40px; align-items: center; gap: 6px;
}
.sidebar-user-link { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 8px; border-radius: var(--r-sm); }
.sidebar-user-link:hover { background: var(--surface-3); }
.avatar { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 99px; display: grid; place-items: center; font-size: 12.5px; font-weight: 650; color: var(--accent-ink); background: var(--accent-soft); border: 1px solid rgba(29,79,215,.14); }
.sidebar-user-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-user-copy strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy span { font-size: 12px; color: var(--muted-2); }
.inline-form { display: contents; }
.logout-icon { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: transparent; border-radius: var(--r-sm); color: var(--muted-2); cursor: pointer; }
.logout-icon:hover { background: var(--danger-soft); color: var(--danger); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 0 32px;
  background: rgba(244,245,247,.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.crumb { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; color: var(--muted); }
.crumb a:hover { color: var(--ink); }
.crumb-sep { color: var(--line-2); }
.crumb strong { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.top-time { color: var(--muted-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.user-menu { position: relative; }
.top-avatar { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 99px; border: 1px solid transparent; cursor: pointer; list-style: none; color: var(--ink-2); font-size: 13px; font-weight: 500; }
.top-avatar::-webkit-details-marker { display: none; }
.top-avatar:hover, .user-menu[open] .top-avatar { background: var(--surface); border-color: var(--line); }
.top-avatar .icon { width: 14px; height: 14px; color: var(--muted-2); }
.user-menu-panel {
  position: absolute; right: 0; top: 46px; min-width: 240px; z-index: 30;
  padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-3);
  animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.user-menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-menu-head strong { font-size: 13.5px; }
.user-menu-head span { font-size: 12px; color: var(--muted-2); }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: transparent; border-radius: var(--r-sm); color: var(--ink-2); font-size: 13.5px; text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--surface-3); color: var(--ink); }
.menu-item .icon { width: 16px; height: 16px; color: var(--muted-2); }
.menu-item-danger:hover { background: var(--danger-soft); color: var(--danger); }
.menu-item-danger:hover .icon { color: var(--danger); }

.content { width: min(1180px, 100%); padding: 28px 32px 64px; }

/* -----------------------------------------------------------------------------
   Seitenkopf
----------------------------------------------------------------------------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 4px 0 24px; }
.page-header h1 { font-size: 24px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; word-break: break-word; }
.page-header p { margin-top: 4px; color: var(--muted); font-size: 14px; max-width: 60ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; flex: 0 0 auto; }
.backline { margin: -6px 0 14px; }
.backline a { display: inline-flex; align-items: center; min-height: 32px; color: var(--muted); font-size: 13px; font-weight: 500; }
.backline a:hover { color: var(--accent-ink); }

/* -----------------------------------------------------------------------------
   Buttons
----------------------------------------------------------------------------- */
.btn {
  min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), var(--shadow-1);
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active { box-shadow: none; }
.btn .icon { width: 16px; height: 16px; }
.btn.secondary { background: var(--surface); border-color: var(--line-2); color: var(--ink-2); box-shadow: var(--shadow-1); }
.btn.secondary:hover { background: var(--surface-2); border-color: #c3cad4; color: var(--ink); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn:disabled, .btn.loading { opacity: .6; cursor: progress; }
.btn.loading::before { content: ""; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* -----------------------------------------------------------------------------
   Kennzahlen (ein Streifen, keine drei Kacheln)
----------------------------------------------------------------------------- */
.stat-strip {
  display: grid; grid-template-columns: repeat(3, minmax(0,1fr));
  margin-bottom: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden;
}
.stat { display: flex; align-items: center; gap: 14px; padding: 18px 22px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-icon { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: var(--accent); background: var(--accent-soft); }
.stat-copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 650; letter-spacing: -.03em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.stat-hint { font-size: 12px; color: var(--muted-2); }

/* -----------------------------------------------------------------------------
   Flächen
----------------------------------------------------------------------------- */
.panel, .workspace-card, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.panel { padding: 22px 24px; }
.panel + .panel { margin-top: 16px; }
.panel.narrow { max-width: 760px; }
.panel h2 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.panel h3 { font-size: 14.5px; font-weight: 650; margin: 0 0 12px; }
.panel-head { margin-bottom: 18px; }
.panel-head p { margin-top: 3px; color: var(--muted); font-size: 13.5px; }
.panel-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 18px; }
.panel-title p { margin-top: 3px; color: var(--muted); font-size: 13.5px; }
.panel.danger-zone { border-color: #f1cfcf; }
.panel.danger-zone h2, .panel.danger-zone h3 { color: var(--danger); }
.panel.danger-zone .icon { color: var(--danger); }
.danger-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 14px 0; border-top: 1px solid var(--line); }
.danger-row:first-of-type { border-top: 0; padding-top: 0; }
.danger-row .muted { font-size: 13px; }
.note-panel { margin-top: 20px; display: flex; gap: 14px; padding: 16px 18px; border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--muted); font-size: 13.5px; }
.note-panel .icon { color: var(--accent); margin-top: 2px; }
.note-panel strong { display: block; color: var(--ink); margin-bottom: 2px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 20px; min-height: 148px; transition: border-color .12s ease, box-shadow .12s ease; }
.card:hover { border-color: #b9c6e6; box-shadow: var(--shadow-2); }
.card strong { font-size: 16px; font-weight: 650; letter-spacing: -.01em; margin-top: auto; }
.card-lead { color: var(--muted); font-size: 13px; }
.card-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); color: var(--ink-2); margin-bottom: 8px; }
.card.featured .card-icon { background: var(--accent-soft); color: var(--accent); }
.card.featured { border-color: #c7d5f5; background: linear-gradient(180deg, #fff, #f7f9ff); }

/* Zweispaltig: Formular + Zusammenfassung */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.split-main { min-width: 0; }
.split-aside { position: sticky; top: calc(var(--topbar-h) + 20px); }
.summary dl { display: grid; gap: 12px; margin-top: 14px; }
.summary dt { font-size: 12px; color: var(--muted-2); font-weight: 500; margin-bottom: 2px; }
.summary dd { font-size: 13.5px; color: var(--ink-2); word-break: break-word; }
.summary-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; }
.summary-note { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted-2); }

.reveal-panel { text-align: left; }
.reveal-check { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 99px; background: var(--success-soft); color: var(--success); margin-bottom: 14px; }
.reveal-check .icon { width: 22px; height: 22px; }
.reveal-panel h2 { font-size: 18px; margin-bottom: 4px; }
.reveal-panel .muted { display: block; margin-bottom: 18px; font-size: 13.5px; }

/* -----------------------------------------------------------------------------
   Workspace: Tabs, Suche, Liste
----------------------------------------------------------------------------- */
.workspace-card { overflow: hidden; }
.workspace-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 10px; }
.segment { min-height: 34px; padding: 6px 12px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 550; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; }
.segment span { min-width: 20px; padding: 0 6px; display: inline-flex; justify-content: center; border-radius: 99px; background: rgba(17,24,39,.07); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.segment.active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-1); }
.segment.active span { color: var(--accent-ink); background: var(--accent-soft); }
.mail-filters { display: flex; align-items: center; gap: 8px; }
.searchbox { width: min(300px, 32vw); min-height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--muted-2); }
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.searchbox .icon { width: 15px; height: 15px; }
.searchbox input { width: 100%; min-width: 0; min-height: 0; padding: 0; border: 0; outline: 0; background: transparent; box-shadow: none; font-size: 14px; }
.mail-filters select { width: auto; min-width: 170px; min-height: 38px; padding: 6px 32px 6px 10px; font-size: 13.5px; }
.mail-tab-panel { display: none; }
.mail-tab-panel.active { display: block; }

.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.object-table-wrap, .table-wrap { overflow-x: auto; }
.object-table, .data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.object-table th, .data-table th {
  padding: 10px 14px; text-align: left; background: var(--surface); border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.data-table th { background: var(--surface-2); }
.object-table th:first-child, .object-table td:first-child { padding-left: 20px; }
.object-table th:last-child, .object-table td:last-child { padding-right: 16px; }
.object-table td, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); font-size: 13.5px; }
.data-table td { vertical-align: top; }
.data-table td.break { word-break: break-word; }
.object-table tbody tr:last-child td, .data-table tbody tr:last-child td { border-bottom: 0; }
.object-table tbody tr:hover, .data-table tbody tr:hover { background: var(--surface-2); }
.mail-identity { min-width: 240px; display: flex; align-items: center; gap: 12px; }
.mail-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: var(--accent); background: var(--accent-soft); }
.mail-icon.forward-icon { color: var(--violet); background: var(--violet-soft); }
.mail-icon .icon { width: 16px; height: 16px; }
.mail-identity > div:last-child { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.mail-identity strong { color: var(--ink); font-size: 14px; font-weight: 600; word-break: break-word; }
.mail-identity span { margin-top: 2px; color: var(--muted-2); font-size: 12.5px; word-break: break-word; }
.login-code { display: inline-flex; padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.status-pill i { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.status-pill.active { color: var(--success); background: var(--success-soft); border-color: rgba(21,122,83,.15); }
.status-pill.paused { color: var(--warning); background: var(--warning-soft); border-color: rgba(138,90,11,.15); }
.status-pill.blocked { color: var(--danger); background: var(--danger-soft); border-color: rgba(192,43,43,.15); }
.status-pill.neutral { color: var(--ink-2); background: var(--surface-3); }
.chip-list { display: flex; flex-wrap: wrap; gap: 5px; }
.soft-chip { display: inline-flex; max-width: 320px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; word-break: break-word; }
.target-chip { color: var(--violet); background: var(--violet-soft); border-color: #dfd7f6; }
.empty-value { color: var(--muted-2); }
.action-col { width: 130px; }
.actions { text-align: right; white-space: nowrap; }
.icon-btn { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 550; box-shadow: var(--shadow-1); }
.icon-btn:hover { border-color: #b9c6e6; color: var(--accent-ink); background: var(--accent-soft); }
.icon-btn .icon { width: 14px; height: 14px; }
.filter-empty, .empty-state { min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; color: var(--muted); }
.empty-state .icon, .filter-empty .icon { width: 30px; height: 30px; margin-bottom: 10px; color: var(--line-2); }
.empty-state strong, .filter-empty strong { color: var(--ink); font-size: 14.5px; font-weight: 600; }
.empty-state span, .filter-empty span { max-width: 420px; margin-top: 4px; font-size: 13px; }
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; color: var(--accent-ink); background: var(--accent-soft); font-size: 12px; font-weight: 600; }
.ok-badge { color: var(--success); background: var(--success-soft); }
.neutral-badge { color: var(--ink-2); background: var(--surface-3); }

/* -----------------------------------------------------------------------------
   Formulare
----------------------------------------------------------------------------- */
input, select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
  font-size: 16px; outline: none; box-shadow: var(--shadow-1);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input::placeholder, textarea::placeholder { color: #98a1ad; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input[readonly] { background: var(--surface-2); font-family: var(--mono); font-size: 15px; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7482' d='m6 9 6 6 6-6 1.4 1.4L12 17.8 4.6 10.4 6 9Z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.field { margin-bottom: 16px; }
.field label, .field-label { display: block; margin-bottom: 6px; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field-error { margin-top: 6px; color: var(--danger); font-size: 13px; font-weight: 500; }
.hint { margin-top: 6px; color: var(--muted-2); font-size: 12.5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-actions { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; }
.filter-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-form .field { margin: 0; min-width: 260px; }
.filter-form .form-actions { margin: 0; padding: 0; border: 0; }
.email-compose { display: grid; grid-template-columns: minmax(160px,1fr) 28px minmax(220px,1.3fr); align-items: start; gap: 8px; }
.email-compose .at { padding-top: 34px; text-align: center; color: var(--muted-2); font-size: 18px; }
.input-action { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: start; }
.input-action .btn { min-height: 40px; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.check { min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 13.5px; }
.check:hover { border-color: var(--line-2); background: var(--surface-2); }
.check:has(input:checked) { border-color: #b9c6e6; background: var(--accent-soft); color: var(--accent-ink); }
.check input { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; box-shadow: none; accent-color: var(--accent); }
.preset { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 14px 16px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.preset strong { font-size: 13.5px; }
.preset .muted { font-size: 13px; }

.flash, .error-box { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; margin-bottom: 18px; border-radius: var(--r); font-size: 13.5px; }
.flash { border: 1px solid rgba(21,122,83,.2); background: var(--success-soft); color: #0f5e3f; }
.error-box { border: 1px solid rgba(192,43,43,.22); background: var(--danger-soft); color: #8f1f1f; }
.flash .icon, .error-box .icon { width: 17px; height: 17px; margin-top: 1px; }
.error-box code { background: #fff; padding: 1px 5px; border-radius: 4px; }

/* -----------------------------------------------------------------------------
   Zwei-Faktor
----------------------------------------------------------------------------- */
.code-input { font-family: var(--mono); font-size: 20px !important; letter-spacing: .18em; text-align: center; max-width: 260px; }
.qr-row { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.qr-box { width: 200px; height: 200px; flex: 0 0 auto; padding: 6px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-manual { min-width: 0; flex: 1 1 240px; }
.qr-manual strong { font-size: 13.5px; }
.secret-code { display: block; margin: 8px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); font-size: 15px; letter-spacing: .06em; word-break: break-all; user-select: all; }
.recovery-codes { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.recovery-codes li code { display: block; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); font-size: 14px; letter-spacing: .05em; text-align: center; }
.status-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; font-size: 13.5px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-ink); font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }
.login-cancel { margin-top: 16px; text-align: center; }
.inline-note { margin-top: 14px; }
.danger-zone-inline { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.danger-zone-inline h3 { color: var(--danger); }
.recovery-panel h3 { margin-top: 0; }

/* -----------------------------------------------------------------------------
   Login / Setup
----------------------------------------------------------------------------- */
body:has(> .login) { background: radial-gradient(1200px 600px at 50% -10%, #e6edff 0%, var(--bg) 60%); }
.login { width: min(420px, calc(100% - 32px)); margin: 10vh auto 40px; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3); }
.login-logo { width: 48px; height: 48px; margin-bottom: 20px; display: block; border-radius: 12px; border: 1px solid var(--line); object-fit: cover; }
.login h1 { margin: 0 0 4px; font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.login > .muted { display: block; margin-bottom: 20px; font-size: 13.5px; }
.login .btn { width: 100%; min-height: 42px; margin-top: 4px; }

/* -----------------------------------------------------------------------------
   Responsive
----------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  :root { --sidebar-w: 72px; }
  .sidebar { padding-inline: 12px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand-copy, .sidebar-user-copy, .nav-text, .nav-label, .kas-pill { display: none; }
  .nav-link { justify-content: center; padding-inline: 0; }
  .sidebar-user { grid-template-columns: 1fr; justify-items: center; gap: 4px; }
  .sidebar-user-link { padding: 4px; }
  .top-avatar-name { display: none; }
  .split { grid-template-columns: 1fr; }
  .split-aside { position: static; order: -1; }
  .summary { padding: 16px 18px; }
  .summary-icon { display: none; }
  .summary dl { grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-top: 10px; }
  .summary-note { display: none; }
}

@media (max-width: 800px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; display: block; padding: 10px 12px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { justify-content: flex-start; padding: 4px 4px 10px; }
  .brand-copy { display: flex; }
  .sidebar-user, .kas-pill { display: none; }
  .nav { flex-direction: row; gap: 4px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-group { flex-direction: row; gap: 4px; }
  .nav-label { display: none; }
  .nav-link { min-width: max-content; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); }
  .nav-link.active { border-color: #b9c6e6; }
  .nav-text { display: inline; }
  .topbar { position: sticky; height: 56px; padding: 0 16px; }
  .crumb a, .crumb-sep, .top-time { display: none; }
  .content { padding: 20px 16px 48px; }
  .page-header { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 18px; }
  .page-header h1 { font-size: 21px; }
  .page-actions { justify-content: stretch; }
  .page-actions .btn { flex: 1 1 auto; min-height: 44px; }
  .stat-strip { grid-template-columns: 1fr; }
  .stat + .stat { border-left: 0; border-top: 1px solid var(--line); }
  .stat { padding: 14px 18px; }
  .stat-value { font-size: 22px; }
  .workspace-head { align-items: stretch; flex-direction: column; gap: 10px; padding: 12px; }
  .mail-filters { width: 100%; }
  .searchbox { width: 100%; min-height: 44px; }
  .mail-filters select { min-height: 44px; }
  .form-grid, .email-compose, .checks, .recovery-codes { grid-template-columns: 1fr; }
  .code-input { max-width: none; }
  .email-compose .at { display: none; }
  .input-action { grid-template-columns: 1fr; }
  .btn-row .btn { flex: 1 1 auto; }
  .btn, .icon-btn, .segment, input, select, .input-action .btn { min-height: 44px; }
  .panel { padding: 18px; }
  .panel-title, .preset, .danger-row { align-items: stretch; flex-direction: column; }
  .filter-form { align-items: stretch; flex-direction: column; }
  .filter-form .field { min-width: 0; }
  .form-actions .btn { flex: 1 1 auto; }

  /* Tabellen -> Cards */
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table thead { display: none; }
  .responsive-table tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .responsive-table tr:last-child { border-bottom: 0; }
  .responsive-table td { padding: 3px 0 !important; border: 0; }
  .responsive-table td[data-label]::before { content: attr(data-label); display: block; margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--muted-2); }
  .responsive-table td.identity-cell { padding: 0 !important; }
  .responsive-table td.actions { text-align: left; white-space: normal; margin-top: 12px; }
  .responsive-table .icon-btn { width: 100%; }
  .mail-identity { min-width: 0; }
  .action-col { width: auto; }
  .object-table-wrap, .table-wrap { overflow-x: visible; }
}

@media (max-width: 560px) {
  .content { padding-inline: 12px; }
  .segmented { width: 100%; }
  .segment { flex: 1; justify-content: center; }
  .mail-filters { flex-direction: column; }
  .mail-filters select { width: 100%; min-width: 0; }
  .responsive-table tr { padding: 14px 12px; }
  .login { padding: 24px; margin-top: 6vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
