/* certana-portal – Basis-Stylesheet. Farben/Schriften nach certana.de, siehe CLAUDE.md. */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("../fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-weight: 500; font-display: swap; src: url("../fonts/playfair-display-latin-500-normal.woff2") format("woff2"); }

:root {
  --ink: #0B1220; --orange: #F7901E; --orange-strong: #E27A08;
  --bg: #F3F6FA; --surface: #FFFFFF; --surface-2: #F7F8FA; --text: #1A2130; --muted: #5B6475; --muted-2: #3D4452;
  --line: #E3E7ED; --line-strong: #D5DAE2; --track: #ECEFF3;
  --side: #0B1220; --side-text: #C3C9D4; --side-hover: #1D2535; --side-line: #222B3B; --side-card: #141C2C;
  --primary-bg: #0B1220; --primary-text: #FFFFFF; --link: #0B1220;
  --tint: #FEF4E8; --tint-icon: #FEEBD3;
  --ok-text: #0A5A4D; --ok-bg: #E3F1EE; --warn-text: #8A4A0B; --warn-bg: #FDF1E3; --err-text: #9F1F14; --err-bg: #FDECEA;
  --chat-user: #0B1220; --chat-user-text: #FFFFFF;
  --focus: rgba(247, 144, 30, .45);
  --radius: 16px; --radius-s: 12px;
  color-scheme: light;
}
:root[data-theme="dunkel"] {
  --bg: #0B1220; --surface: #131B2B; --surface-2: #0F1626; --text: #E6E9EF; --muted: #9AA3B2; --muted-2: #C3C9D4;
  --line: #232D40; --line-strong: #2E3A50; --track: #222B3B;
  --side: #070C16; --side-line: #1A2232; --side-card: #111827;
  --primary-bg: #F7901E; --primary-text: #0B1220; --link: #F7901E;
  --tint: #2A1F12; --tint-icon: #2A1F12;
  --ok-text: #6EE7B7; --ok-bg: #0F2E26; --warn-text: #FBBF77; --warn-bg: #33230D; --err-text: #FCA5A5; --err-bg: #3A1414;
  --chat-user: #1D2535; --chat-user-text: #E6E9EF;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0B1220; --surface: #131B2B; --surface-2: #0F1626; --text: #E6E9EF; --muted: #9AA3B2; --muted-2: #C3C9D4;
    --line: #232D40; --line-strong: #2E3A50; --track: #222B3B;
    --side: #070C16; --side-line: #1A2232; --side-card: #111827;
    --primary-bg: #F7901E; --primary-text: #0B1220; --link: #F7901E;
    --tint: #2A1F12; --tint-icon: #2A1F12;
    --ok-text: #6EE7B7; --ok-bg: #0F2E26; --warn-text: #FBBF77; --warn-bg: #33230D; --err-text: #FCA5A5; --err-bg: #3A1414;
    --chat-user: #1D2535; --chat-user-text: #E6E9EF;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 "Inter", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--link); font-weight: 600; text-underline-offset: 3px; }
a:hover { color: var(--orange-strong); }
h1, h2, h3 { margin: 0; }
.serif { font-family: "Playfair Display", Georgia, serif; font-weight: 500; letter-spacing: -0.015em; }
.muted { color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--muted-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Grundgerüst ---------- */
.app { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 240px; max-width: 100%; background: var(--side); border-right: 1px solid var(--side-line);
        padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; }
.side .brand { display: block; padding: 0 12px 24px; }
.side .brand img { height: 30px; width: auto; display: block; }
.nav { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: var(--side-text);
       text-decoration: none; font-size: 14px; font-weight: 400; }
.nav:hover { background: var(--side-hover); color: #FFFFFF; }
.nav[aria-current="page"] { background: #1D2535; color: #FFFFFF; box-shadow: inset 0 0 0 1px #2A3446; }
.nav[aria-current="page"] svg { color: var(--orange); }
.nav svg { flex: none; }
.nav .soon { margin-left: auto; font-size: 11px; color: #9AA3B2; border: 1px solid #2A3446; border-radius: 6px; padding: 0 6px; }
.side hr { border: 0; height: 1px; background: var(--side-line); margin: 16px 12px; }
.side .spacer { flex: 1; min-height: 32px; }
.usercard { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 8px; background: var(--side-card); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #2A3446; color: #FFFFFF; display: flex;
          align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex: none; }
.usercard .who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.usercard .name { color: #FFFFFF; font-size: 14px; font-weight: 600; }
.usercard .sub { color: #9AA3B2; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usercard form { margin: 0; }
.iconbtn { background: transparent; border: 0; color: #9AA3B2; width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
           display: inline-flex; align-items: center; justify-content: center; }
.iconbtn:hover { background: var(--side-hover); color: #FFFFFF; }
.main { flex: 999 1 560px; min-width: 0; padding: 32px 40px 48px; display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 700px) { .main { padding: 24px 16px 40px; } }

.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; }
.pagehead .titles { flex: 1 1 320px; display: flex; flex-direction: column; gap: 4px; }
.pagehead h1 { font-size: 34px; line-height: 1.15; }

/* ---------- Bausteine ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h2 { font-size: 17px; font-weight: 600; }
.card.pad-l { padding: 24px; }
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { display: flex; flex-direction: column; gap: 8px; }
.kpi .label { font-size: 14px; color: var(--muted); }
.kpi .value { font-family: "Playfair Display", Georgia, serif; font-size: 40px; line-height: 1.1; }
.kpi.hero { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
:root[data-theme="dunkel"] .kpi.hero { background: #241A0E; border-color: #5A3A12; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .kpi.hero { background: #241A0E; border-color: #5A3A12; } }
.kpi.hero .label { color: #C3C9D4; }
.kpi.hero .value { color: var(--orange); }
.row { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.col-main { flex: 999 1 520px; min-width: 0; }
.col-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.status { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: #1F9D72; }
.status .dot.warn { background: #D98E04; } .status .dot.err { background: #D64545; } .status .dot.off { background: #9AA3B2; }
.status .what { flex: 1; } .status .val { color: var(--muted); }
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 14px; padding: 8px 0; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 2px 8px; background: var(--track); color: var(--muted-2); }
.chip.ok { background: var(--ok-bg); color: var(--ok-text); } .chip.warn { background: var(--warn-bg); color: var(--warn-text); }
.chip.err { background: var(--err-bg); color: var(--err-text); } .chip.brand { background: var(--orange); color: var(--ink); }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.quick a { text-decoration: none; color: inherit; font-weight: 400; display: flex; align-items: center; gap: 14px; }
.quick .ico { width: 40px; height: 40px; border-radius: 10px; background: var(--tint-icon); display: flex; align-items: center;
              justify-content: center; flex: none; color: var(--ink); }
:root[data-theme="dunkel"] .quick .ico { color: var(--orange); }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .quick .ico { color: var(--orange); } }
.quick .t { font-weight: 600; font-size: 15px; display: block; } .quick .d { font-size: 13px; color: var(--muted); }

/* ---------- Formulare & Buttons ---------- */
.btn { font: inherit; font-size: 14px; font-weight: 600; border-radius: var(--radius-s); padding: 10px 16px; min-height: 44px;
       cursor: pointer; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
       display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn.primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-text); }
.btn.primary:hover { filter: brightness(1.12); color: var(--primary-text); }
.btn.small { min-height: 34px; padding: 5px 10px; font-size: 13px; }
.btn.danger { color: var(--err-text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted-2); }
.field input, .field select, textarea.input, select.input {
  font: inherit; font-size: 15px; font-weight: 400; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 12px; min-height: 44px; }
.field .hint { font-weight: 400; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.alert { border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }
.alert.err { background: var(--err-bg); color: var(--err-text); } .alert.ok { background: var(--ok-bg); color: var(--ok-text); }
.alert.warn { background: var(--warn-bg); color: var(--warn-text); } .alert ul { margin: 4px 0 0; padding-left: 18px; }
.code-in { font-size: 22px !important; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Tabellen ---------- */
.tablewrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
table.list th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
                font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.list td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
table.list form { display: inline; margin: 0; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Anmelde- und Einrichtungsseiten ---------- */
.auth { min-height: 100vh; background: #0B1220; color: #E6E9EF; padding: 48px 16px; display: flex; flex-direction: column;
        align-items: center; gap: 32px; }
:root[data-theme] .auth { background: #0B1220; }
.auth .logo { height: 40px; width: auto; }
.auth .panel { width: 100%; max-width: 460px; background: var(--surface); color: var(--text); border-radius: var(--radius);
               padding: 36px 36px 32px; display: flex; flex-direction: column; gap: 18px; border: 1px solid var(--line); }
.auth .panel.wide { max-width: 1040px; padding: 0; overflow: hidden; display: flex; flex-direction: row; flex-wrap: wrap; gap: 0; }
.auth .panel h1 { font-size: 28px; }
.auth .foot { font-size: 13px; color: #9AA3B2; text-align: center; max-width: 640px; line-height: 1.5; }
.steps { flex: 1 1 260px; margin: 0; padding: 32px 28px; background: var(--bg); list-style: none; display: flex; flex-direction: column; gap: 6px; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 14px; color: var(--muted); }
.steps .n { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-strong); display: flex; align-items: center;
            justify-content: center; font-size: 13px; flex: none; }
.steps li.done { color: var(--muted-2); } .steps li.done .n { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-text); }
.steps li.current { color: var(--text); font-weight: 700; } .steps li.current .n { border-color: var(--orange); }
.steps li .later { margin-left: auto; font-size: 11px; font-weight: 500; color: var(--muted); }
.wizard { flex: 999 1 460px; min-width: 0; padding: 40px 48px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 700px) { .wizard { padding: 28px 20px; } .auth .panel { padding: 28px 20px; } }
.qr { background: #FFFFFF; border-radius: 12px; padding: 12px; width: 220px; height: 220px; align-self: center; }
.qr svg { width: 100%; height: 100%; display: block; }
.secret { font-family: ui-monospace, "DejaVu Sans Mono", monospace; font-size: 13px; word-break: break-all; background: var(--surface-2);
          border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }

/* ---------- KI-Assistent ---------- */
.chat { display: flex; flex-direction: column; gap: 16px; min-height: calc(100vh - 80px); }
.chat .bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.chat .bar h1 { font-size: 28px; flex: 1 1 260px; }
.chat .log { flex: 1; display: flex; flex-direction: column; gap: 20px; max-width: 860px; width: 100%; }
.msg { line-height: 1.6; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; max-width: 78%; background: var(--chat-user); color: var(--chat-user-text);
            border-radius: 14px 14px 4px 14px; padding: 12px 16px; }
.msg.bot { align-self: flex-start; max-width: 88%; display: flex; gap: 12px; white-space: normal; }
.msg.bot .mark { width: 32px; height: 32px; border-radius: 8px; background: #1D2535; display: flex; align-items: center;
                 justify-content: center; flex: none; }
.msg.bot .body { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 14px 18px;
                 white-space: pre-wrap; min-width: 60px; }
.msg.bot .meta { font-size: 12px; color: var(--muted); margin-top: 8px; white-space: normal; }
.msg.bot .body.err { background: var(--err-bg); color: var(--err-text); border-color: transparent; }
.typing::after { content: "▍"; animation: blink 1s steps(1) infinite; color: var(--orange); }
@keyframes blink { 50% { opacity: 0; } }
.composer { max-width: 860px; width: 100%; display: flex; flex-direction: column; gap: 8px; }
.composer .box { display: flex; align-items: flex-end; gap: 10px; background: var(--surface); border: 1px solid var(--line-strong);
                 border-radius: 12px; padding: 10px 10px 10px 16px; }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; font: inherit; font-size: 15px; line-height: 1.5;
                     color: var(--text); background: transparent; min-width: 0; max-height: 240px; }
.composer .note { font-size: 12px; color: var(--muted); }
.welcome { color: var(--muted); font-size: 15px; display: flex; flex-direction: column; gap: 12px; }
.welcome .ideas { display: flex; flex-wrap: wrap; gap: 8px; }
.welcome .ideas button { font: inherit; font-size: 13px; color: var(--muted-2); background: var(--surface); border: 1px solid var(--line);
                         border-radius: 16px; padding: 6px 12px; cursor: pointer; }
.welcome .ideas button:hover { border-color: var(--orange); }
.usercard a { text-decoration: none; font-weight: 400; }
.usercard a:hover .name { text-decoration: underline; }
.tabs { display: flex; flex-wrap: wrap; gap: 24px; border-bottom: 1px solid var(--line); }
.tabs a, .tabs span { font-size: 14px; font-weight: 600; padding: 12px 2px; color: var(--muted); text-decoration: none;
                      border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--orange); }
.tabs span[aria-disabled] { font-weight: 500; opacity: .75; }
.tabs small { font-size: 11px; font-weight: 500; }
.stack p, .panel p, .card p { margin: 0; }
.alert .secret { margin: 8px 0; color: var(--text); }
td.actions { gap: 6px; flex-wrap: wrap; justify-content: flex-end; display: flex; }
details summary { cursor: pointer; font-size: 14px; }
details[open] summary { margin-bottom: 8px; }
.nav[aria-disabled] { cursor: default; opacity: .6; }
.nav[aria-disabled]:hover { background: transparent; color: var(--side-text); }
.kpi .chip { align-self: flex-start; }
/* ---------- certana-control ---------- */
.side-label { display: block; margin: -16px 12px 20px; font-size: 11px; font-weight: 600; letter-spacing: .2em;
              text-transform: uppercase; color: var(--orange); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 24px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, "DejaVu Sans Mono", monospace; font-size: 13px; }
.vertrag { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.vertrag summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; }
.field textarea { font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong);
                  border-radius: 8px; padding: 8px 12px; min-height: 70px; }
.searchbar { display: flex; gap: 10px; flex-wrap: wrap; }
.searchbar input { flex: 1 1 260px; font: inherit; font-size: 15px; border: 1px solid var(--line-strong); border-radius: 8px;
                   padding: 0 12px; min-height: 44px; background: var(--surface); color: var(--text); }
pre.status { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 12px;
             overflow-x: auto; margin: 0; }
.bigcode { font-family: ui-monospace, "DejaVu Sans Mono", monospace; font-size: 22px; letter-spacing: .08em; background: var(--surface);
           border: 1px dashed var(--orange); border-radius: 10px; padding: 12px 16px; display: inline-block; color: var(--text); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.grid-2 table.list { min-width: 0; }
