/* Webseiten-Cockpit, Gestaltung nach dem ICOS App-Design-System (icos-styleguide.html, Stand 02.08.2026):
   Tokens, App-Shell mit Navy-Sidebar 256px und Topbar 64px, Buttons 34px/8px, Karten 12px, Badges 6px, Trennung über
   1px-Linien, keine Schatten. Hell, Dunkel und Auto (folgt dem System). Schrift lokal (Open Sans). */
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/open-sans-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/open-sans-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --blue-base: #1E4975; --blue-90: #355B83; --blue-80: #4B6D91; --blue-70: #62809E; --blue-20: #D2DBE3; --blue-10: #E9EDF1;
  --orange-base: #FF940A; --orange-10: #FFF4E7; --orange-20: #FFEACE; --orange-text: #B65E00;
  --gray-base: #191919; --gray-70: #5E5E5E; --gray-50: #8C8C8C;
  --success: #1E8E57; --success-strong: #136540; --success-soft: #E7F4EC;
  --error: #D23B2E; --error-strong: #A82318; --error-soft: #FBEAE8;
  --bg: #FFFFFF; --bg-subtle: #F5F7F9; --bg-sunken: #EAEFF3;
  --border: #E6EBEF; --border-strong: #D2DBE3;
  --text: #191919; --text-secondary: #5E5E5E; --text-muted: #8C8C8C;
  --font-sans: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --radius-sm: 8px; --radius-card: 12px; --radius-badge: 6px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --blue-10: #243447; --blue-20: #35516E; --orange-10: #3D2E15; --orange-20: #4E3B1C; --orange-text: #FFB45C;
  --success: #2FA76B; --success-strong: #7BD3A5; --success-soft: #1A3328;
  --error: #E05445; --error-strong: #F49287; --error-soft: #3B211D;
  --bg: #1C2127; --bg-subtle: #14181D; --bg-sunken: #262D35; --border: #2B333C; --border-strong: #3B4650;
  --text: #E9EDF1; --text-secondary: #A9B4BF; --text-muted: #7B8794; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --blue-10: #243447; --blue-20: #35516E; --orange-10: #3D2E15; --orange-20: #4E3B1C; --orange-text: #FFB45C;
    --success: #2FA76B; --success-strong: #7BD3A5; --success-soft: #1A3328;
    --error: #E05445; --error-strong: #F49287; --error-soft: #3B211D;
    --bg: #1C2127; --bg-subtle: #14181D; --bg-sunken: #262D35; --border: #2B333C; --border-strong: #3B4650;
    --text: #E9EDF1; --text-secondary: #A9B4BF; --text-muted: #7B8794; color-scheme: dark;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { font-family: var(--font-sans); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg-subtle);
  display: flex; min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--blue-base); }
:root[data-theme="dark"] a { color: #8FB3DA; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] a { color: #8FB3DA; } }
:focus-visible { outline: 2px solid var(--blue-base); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--bg); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 50; }
.skip-link:focus { left: 8px; }

/* ---------- Sidebar ---------- */
.sidebar { width: 256px; flex-shrink: 0; background: var(--blue-base); color: #fff; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; }
.sidebar-brand { padding: 20px 20px 14px; }
.sidebar-brand img { height: 40px; width: auto; display: block; }
.brand-sub { font-size: 11px; color: #D2DBE3; margin-top: 8px; letter-spacing: .04em; text-transform: uppercase; font-weight: 700; }
.nav-section { padding: 14px 12px 4px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #9DB2C8; padding: 0 10px 6px; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: #E9EDF1;
  font-size: 14px; text-decoration: none; position: relative; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--orange-base); }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.nav-badge { margin-left: auto; background: var(--orange-base); color: var(--gray-base); font-size: 11px; font-weight: 700; border-radius: var(--radius-badge); padding: 1px 6px; }
.sidebar a { color: inherit; }
.sidebar-footer { margin-top: auto; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue-80); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 600; }
.user-mail { font-size: 11px; color: #D2DBE3; overflow: hidden; text-overflow: ellipsis; max-width: 150px; white-space: nowrap; }
.sidebar-footer form { margin-left: auto; }
.knopf-text { background: none; border: 0; color: #D2DBE3; font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; }
.theme-wahl { padding: 0 16px 12px; display: flex; gap: 4px; }
.theme-wahl button { flex: 1; border: 1px solid rgba(255,255,255,.18); background: transparent; color: #D2DBE3; font: inherit; font-size: 11px; padding: 4px 0; border-radius: 6px; cursor: pointer; }
.theme-wahl button.on { background: rgba(255,255,255,.14); color: #fff; }

/* ---------- Main ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 64px; background: var(--bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px;
  padding: 0 28px; position: sticky; top: 0; z-index: 10; }
.page-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.topbar-aktionen { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.content { padding: 24px 28px 48px; max-width: 1180px; width: 100%; }
.content--breit { max-width: none; }
.modus-hinweis { background: var(--error-soft); color: var(--error-strong); font-weight: 600; font-size: 12.5px; padding: 6px 28px; border-bottom: 1px solid var(--border); }

/* ---------- Buttons ---------- */
.btn { height: 34px; padding: 0 13px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; font-family: inherit; border: none;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; text-decoration: none; line-height: 1;
  transition: background .12s ease, border-color .12s ease; }
.btn-primary { background: var(--orange-base); color: var(--gray-base) !important; }
.btn-primary:hover { background: #F08800; }
.btn-secondary { background: var(--blue-base); color: #fff !important; }
.btn-secondary:hover { background: var(--blue-90); }
.btn-ghost { background: var(--bg); border: 1px solid var(--border-strong); color: var(--text) !important; }
.btn-ghost:hover { border-color: var(--blue-70); }
.btn-danger { background: var(--bg); border: 1px solid var(--error); color: var(--error-strong) !important; }
.btn-sm { height: 30px; font-size: 13px; padding: 0 10px; }
.btn-xs { height: 26px; font-size: 12px; padding: 0 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Karten, Raster ---------- */
.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid-2 > .card + .card, .grid-3 > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.card-sub { font-size: 12.5px; color: var(--text-muted); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.kpi-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.kpi-value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--text-muted); }
.klein { font-size: 12.5px; }
.zeile { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.zeile--ende { justify-content: flex-end; }
.abstand-oben { margin-top: 16px; }
p + p { margin-top: 8px; }

/* ---------- Tabellen ---------- */
.tabelle-rahmen { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 12.5px; color: var(--text-muted); padding: 8px 12px; border-bottom: 1px solid var(--border); font-weight: 600; white-space: nowrap; }
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tbody tr:hover { background: var(--bg-subtle); }
tbody tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--text-muted); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; border-radius: var(--radius-badge); padding: 2px 8px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--success-soft); color: var(--success-strong); }
.badge-blue { background: var(--blue-10); color: var(--blue-base); }
.badge-orange { background: var(--orange-10); color: var(--orange-text); }
.badge-red { background: var(--error-soft); color: var(--error-strong); }
.badge-gray { background: var(--bg-sunken); color: var(--gray-70); }
:root[data-theme="dark"] .badge-blue { color: #8FB3DA; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .badge-blue { color: #8FB3DA; } }

/* ---------- Formulare ---------- */
.field { margin-bottom: 12px; }
.field label, .field .label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .field select, .field textarea, select.klein-wahl {
  width: 100%; height: 34px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; font-size: 14px;
  font-family: inherit; background: var(--bg); color: var(--text); }
.field textarea { height: auto; min-height: 76px; resize: vertical; line-height: 1.45; }
select.klein-wahl { width: auto; height: 30px; padding: 3px 8px; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-base) !important; box-shadow: 0 0 0 3px rgba(30,73,117,.15); }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--blue-base); }
.meldung { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px; border: 1px solid var(--border); background: var(--bg); }
.meldung-ok { background: var(--success-soft); color: var(--success-strong); border-color: transparent; }
.meldung-fehler { background: var(--error-soft); color: var(--error-strong); border-color: transparent; }
.meldung-hinweis { background: var(--orange-10); color: var(--orange-text); border-color: transparent; }
code, .mono { font-family: "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12.5px; }
.segmented { display: inline-flex; background: var(--bg-sunken); border-radius: var(--radius-sm); padding: 3px; gap: 2px; border: 1px solid var(--border); flex-wrap: wrap; }
.segmented button { border: none; background: transparent; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text-secondary); padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.segmented button.on { background: var(--bg); color: var(--blue-base); }
:root[data-theme="dark"] .segmented button.on { color: var(--text); }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .segmented button.on { color: var(--text); } }
:root[data-theme="dark"] .neu-typen button.on { background: var(--blue-90); border-color: var(--blue-90); }

/* ---------- Anmeldung (Kapitel 13) ---------- */
body.auth { display: grid; place-items: center; padding: 32px 16px; }
.auth-spalte { width: 100%; max-width: 360px; text-align: center; }
.auth-spalte .logo { height: 48px; width: auto; margin: 0 auto 20px; display: block; }
.auth-spalte h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.auth-spalte .kontext { color: var(--text-secondary); margin: 6px 0 18px; }
.auth-spalte .card { text-align: left; }
.auth-transparenz { font-size: 12px; color: var(--text-muted); margin-top: 16px; }
.logo-hell { display: block; }
.logo-dunkel { display: none !important; }
:root[data-theme="dark"] .logo-hell { display: none !important; }
:root[data-theme="dark"] .logo-dunkel { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .logo-hell { display: none !important; }
  :root[data-theme="auto"] .logo-dunkel { display: block !important; }
}

/* ---------- Live-Ansicht ---------- */
.live { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 480px); gap: 16px; align-items: start; }
.vorschau-kopf { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.vorschau-rahmen { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; height: calc(100vh - 190px); min-height: 420px; display: flex; justify-content: center; }
.vorschau-rahmen iframe { border: 0; width: 100%; height: 100%; background: #fff; }
.vorschau-rahmen.schmal iframe { width: 320px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.panel { position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow-y: auto; }
.neu-typen { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.neu-typen button { border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.neu-typen button.on { background: var(--blue-base); border-color: var(--blue-base); color: #fff; }
.ablage { border: 1px dashed var(--border-strong); border-radius: var(--radius-card); padding: 18px; text-align: center; color: var(--text-secondary); background: var(--bg-subtle); }
.ablage.ueber { border-color: var(--blue-base); background: var(--blue-10); }
.fortschritt { height: 6px; background: var(--bg-sunken); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.fortschritt > span { display: block; height: 100%; width: 0; background: var(--blue-base); transition: width .2s ease; }
.bereich { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--bg); margin-top: 12px; }
.bereich-kopf { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.bereich-kopf .titel { font-weight: 600; flex: 1; min-width: 120px; }
.baustein { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.baustein:last-child { border-bottom: 0; }
.baustein.aus { opacity: .55; }
.baustein .art { font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: none; }
.baustein .kurz { font-size: 13.5px; overflow-wrap: anywhere; }
.baustein .knoepfe { display: flex; gap: 4px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; max-width: 170px; }
.icon-knopf { width: 28px; height: 28px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); border-radius: 6px; cursor: pointer; display: inline-grid; place-items: center; font-size: 13px; line-height: 1; }
.icon-knopf:hover { border-color: var(--blue-70); }
.bearbeiten { grid-column: 1 / -1; border-top: 1px dashed var(--border); padding-top: 10px; }
.status-leiste { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--text-secondary); }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: 420px; z-index: 40; }
.qr img { width: 160px; height: 160px; background: #fff; border-radius: var(--radius-sm); }
details.einklapp > summary { cursor: pointer; font-weight: 600; list-style: none; }
details.einklapp > summary::-webkit-details-marker { display: none; }
details.einklapp > summary::before { content: "▸ "; color: var(--text-muted); }
details.einklapp[open] > summary::before { content: "▾ "; }
.hinweisliste { list-style: none; }
.hinweisliste li { font-size: 12.5px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.hinweisliste li:last-child { border-bottom: 0; }

/* ---------- schmal ---------- */
@media (max-width: 1100px) {
  .live { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; max-height: none; }
  .vorschau-rahmen { height: 70vh; }
}
@media (max-width: 860px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .nav-section { padding: 6px 8px; }
  .nav-label { display: none; }
  .nav-item.active::before { display: none; }
  .grid-3, .grid-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 16px; }
  .topbar { height: auto; min-height: 64px; padding: 10px 16px; flex-wrap: wrap; position: static; }
  .topbar-aktionen { margin-left: 0; }
  .page-title { overflow-wrap: anywhere; }
  .sidebar-brand { padding: 14px 16px 6px; }
  .brand-sub { display: none; }
  .sidebar-footer { margin-top: 0; }
}
.content .knopf-text, .knopf-text-link { color: var(--blue-base); cursor: pointer; text-decoration: underline; background: none; border: 0; font: inherit; }
:root[data-theme="dark"] .content .knopf-text, :root[data-theme="dark"] .knopf-text-link { color: #8FB3DA; }
