/* Partner-Cockpit (Ticket 01). Gestaltungsregeln: .scratch/jan-cockpit-und-kit/research/08-cockpit-prototyp.md.
   Graustufen plus Rot (Rot nur für Handlungsbedarf), IBM Plex Sans 400 bis 600, Radien 3 bis 4 px, Klickflächen
   ab 24 px, keine Randstreifen, keine Unterstreichung, kleine flache Schatten, Zeilenhöhe ab 1,25.
   Ansichten unter web/ansichten/ nutzen diese Klassen und setzen keine eigenen Farben. */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --sunk: #f3f4f5;
  --ink: #16181b;
  --muted: #62676e;
  --line: #dcdfe3;
  --ok: #6f8f7a;
  --warn: #b39256;
  --bad: #b3261e;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141517; --surface: #1a1b1e; --sunk: #222428; --ink: #e6e7e9; --muted: #9a9ea5; --line: #303338;
    --ok: #7f9e89; --warn: #b89a62; --bad: #ef7d73;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141517; --surface: #1a1b1e; --sunk: #222428; --ink: #e6e7e9; --muted: #9a9ea5; --line: #303338;
  --ok: #7f9e89; --warn: #b89a62; --bad: #ef7d73;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 13.5px; line-height: 1.45; }
h1, h2, h3 { margin: 0; line-height: 1.3; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 20px; font-weight: 600; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
a { display: inline-flex; align-items: center; min-height: 24px; color: var(--ink); font-weight: 500; text-decoration: none; }
strong, b { font-weight: 600; }
a:hover { color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.klein { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.laden { padding: 24px 16px; }

/* Knöpfe: ein Hauptknopf je Formular, sonst Textknöpfe */
.knopf { min-height: 32px; padding: 6px 14px; border-radius: 4px; border: none; background: var(--ink); color: var(--bg); font-weight: 600; }
.knopf:hover { background: var(--muted); }
.textknopf { min-height: 24px; padding: 2px 0; border: none; background: none; color: var(--ink); font-weight: 500; }
.textknopf:hover { color: var(--muted); }

/* Eingaben */
.feld { display: grid; gap: 4px; }
.feld > span { font-size: 12.5px; color: var(--muted); }
input, select, textarea { min-height: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; min-width: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; }
.meldung { min-height: 1.45em; color: var(--bad); font-weight: 500; }

/* Anmeldung */
.anmeldung { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.anmeldung form { width: min(360px, 100%); display: grid; gap: 14px; padding: 24px; border: 1px solid var(--line); border-radius: 4px; }
.anmeldung .knopf { justify-self: start; }
.anmeldung .hinweis { color: var(--muted); }

/* Seitenrahmen */
.rahmen { max-width: 1380px; margin: 0 auto; padding: 12px 16px 48px; }
.kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.kopf .seiten { display: flex; gap: 4px 18px; flex-wrap: wrap; }
.kopf .seiten button { min-height: 28px; padding: 2px 0; border: none; background: none; color: var(--muted); font-weight: 500; }
.kopf .seiten button:hover { color: var(--ink); }
.kopf .seiten button[aria-current="page"] { color: var(--ink); font-weight: 600; }
.kopf .wer { display: flex; gap: 12px; align-items: center; margin-left: auto; color: var(--muted); }
.laufstatus { display: grid; gap: 2px; }
.pfeil { font-weight: 400; }

.arbeit { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.arbeit.mit-akte { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.seite { display: grid; gap: 18px; min-width: 0; }

/* Partnerakte als Seitenteil */
.akte { border: 1px solid var(--line); border-radius: 4px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.akte-kopf { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: start; padding: 16px 16px 0; }
.akte-kopf h2:focus { outline: none; }
.akte-kopf .kid { grid-column: 1; color: var(--muted); font-size: 12.5px; }
.akte-kopf .textknopf { grid-column: 2; grid-row: 1; }
.reiter { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; margin-top: 12px; overflow-x: auto; }
.reiter button { min-height: 36px; padding: 8px 10px; border: none; border-bottom: 2px solid transparent; background: none; color: var(--muted); white-space: nowrap; }
.reiter button:hover { color: var(--ink); }
.reiter button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.akte-inhalt { padding: 16px; display: grid; gap: 20px; }
.akte-block { display: grid; gap: 10px; min-width: 0; }
.leer { color: var(--muted); }

/* Tabellen */
.tabelle { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--sunk); }
tbody tr:last-child td { border-bottom: none; }
tr.zeile { cursor: pointer; }
tr.zeile:hover, tr.zeile[aria-selected="true"] { background: var(--sunk); }
tr.zeile:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.gruppe { display: grid; gap: 8px; }
.gruppe > h2 { font-size: 15px; }

/* Ampel: immer Wort plus 7-px-Punkt, Rot fett */
.ampel { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ampel::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.ampel.gruen::before { background: var(--ok); }
.ampel.gelb::before { background: var(--warn); }
.ampel.rot { color: var(--bad); font-weight: 600; }
.offen { color: var(--bad); font-weight: 600; }
.fehlt { color: var(--bad); font-weight: 600; }

/* Eingeklappte seltene Aktionen */
details.selten summary { cursor: pointer; color: var(--muted); font-size: 12.5px; min-height: 24px; }
details.selten[open] summary { margin-bottom: 8px; }

@media (max-width: 900px) {
  .arbeit.mit-akte { grid-template-columns: minmax(0, 1fr); }
  .akte { position: static; max-height: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .knopf, .textknopf, .kopf .seiten button, .reiter button, tr.zeile, a {
    transition: background-color 150ms ease-out, color 150ms ease-out, border-color 150ms ease-out;
  }
}
