/* PraxisBox – Gestaltung. Systemschrift, keine Fremdquellen (CSP).
   Farben als Variablen, dunkles Schema ueber prefers-color-scheme. */

:root {
  --grund: #f4f6f8;
  --flaeche: #ffffff;
  --flaeche-2: #f8fafb;
  --linie: #e3e8ec;
  --text: #16202a;
  --text-2: #5b6772;
  --akzent: #0f766e;
  --akzent-hell: #ccfbf1;
  --akzent-text: #ffffff;
  --warn: #b45309;
  --warn-hell: #fef3c7;
  --fehler: #b91c1c;
  --fehler-hell: #fee2e2;
  --ok: #15803d;
  --ok-hell: #dcfce7;
  --schatten: 0 1px 2px rgba(16, 24, 32, .06), 0 4px 16px rgba(16, 24, 32, .06);
  --rund: 10px;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #0d1318;
    --flaeche: #151d24;
    --flaeche-2: #1a232b;
    --linie: #26323c;
    --text: #e6edf2;
    --text-2: #93a1ad;
    --akzent: #2dd4bf;
    --akzent-hell: #123b37;
    --akzent-text: #06201d;
    --warn: #fbbf24;
    --warn-hell: #3a2c0b;
    --fehler: #f87171;
    --fehler-hell: #3b1414;
    --ok: #4ade80;
    --ok-hell: #0f2e1a;
    --schatten: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--grund);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--akzent); text-decoration: none; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.leise { color: var(--text-2); }
.versteckt { display: none !important; }

/* ---- Rahmen ---------------------------------------------------------- */
#app { height: 100%; }
.rahmen { display: grid; grid-template-columns: 64px 1fr; height: 100%; }
.leiste {
  background: var(--flaeche); border-right: 1px solid var(--linie);
  display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 6px;
}
.leiste img { width: 36px; height: 36px; margin-bottom: 12px; }
.leiste a {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  color: var(--text-2); font-size: 11px; text-align: center; line-height: 1.1;
}
.leiste a svg { width: 22px; height: 22px; }
.leiste a:hover { background: var(--flaeche-2); color: var(--text); }
.leiste a.aktiv { background: var(--akzent-hell); color: var(--akzent); }
.leiste .unten { margin-top: auto; }
.haupt { display: grid; grid-template-rows: 56px 1fr; min-width: 0; }
.kopfzeile {
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--flaeche); border-bottom: 1px solid var(--linie);
}
.kopfzeile .wer { margin-left: auto; color: var(--text-2); font-size: 13px; }
.inhalt { overflow: auto; padding: 20px; }

/* ---- Suche ----------------------------------------------------------- */
.suche { position: relative; flex: 0 1 560px; }
.suche input {
  width: 100%; height: 38px; padding: 0 12px 0 38px; border-radius: 10px;
  border: 1px solid var(--linie); background: var(--flaeche-2); outline: none;
}
.suche input:focus { border-color: var(--akzent); background: var(--flaeche); box-shadow: 0 0 0 3px var(--akzent-hell); }
.suche .lupe { position: absolute; left: 12px; top: 10px; width: 18px; height: 18px; color: var(--text-2); }
.suche kbd { position: absolute; right: 10px; top: 9px; }
.treffer {
  position: absolute; top: 44px; left: 0; right: 0; z-index: 20; background: var(--flaeche);
  border: 1px solid var(--linie); border-radius: 12px; box-shadow: var(--schatten); overflow: hidden;
  max-height: 70vh; overflow-y: auto;
}
.treffer .art { padding: 8px 14px; font-size: 12px; color: var(--text-2); border-bottom: 1px solid var(--linie); }
.treffer .zeile { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 9px 14px; cursor: pointer; }
.treffer .zeile.an, .treffer .zeile:hover { background: var(--akzent-hell); }
.treffer .leer { padding: 14px; color: var(--text-2); }
kbd {
  font: 11px var(--mono); padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--linie); background: var(--flaeche); color: var(--text-2);
}

/* ---- Bausteine ------------------------------------------------------- */
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--rund); box-shadow: var(--schatten); }
.karte > h2, .karte > header { margin: 0; padding: 12px 16px; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--linie); display: flex; align-items: center; gap: 8px; }
.karte > header .rechts { margin-left: auto; }
.karte .koerper { padding: 12px 16px; }
h1 { font-size: 20px; margin: 0 0 16px; font-weight: 650; }
.knopf {
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--linie);
  background: var(--flaeche); cursor: pointer; font-weight: 550;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; flex: none;
}
.knopf svg { width: 16px; height: 16px; }
.knopf:hover { background: var(--flaeche-2); }
.knopf.haupt-knopf { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf.haupt-knopf:hover { filter: brightness(1.07); }
.knopf.klein { height: 28px; padding: 0 10px; font-size: 12.5px; }
.knopf:disabled { opacity: .5; cursor: default; }
.feld { display: flex; flex-direction: column; gap: 4px; }
.feld label { font-size: 12px; color: var(--text-2); font-weight: 550; }
.feld input, .feld select, .feld textarea, input.eingabe, textarea.eingabe {
  height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--linie);
  background: var(--flaeche); outline: none; width: 100%;
}
.feld textarea, textarea.eingabe { height: auto; padding: 8px 10px; resize: vertical; }
.feld input:focus, .feld select:focus, .feld textarea:focus, .eingabe:focus { border-color: var(--akzent); box-shadow: 0 0 0 3px var(--akzent-hell); }
.raster { display: grid; gap: 12px; }
.raster.zwei { grid-template-columns: 1fr 1fr; }
.raster.drei { grid-template-columns: repeat(3, 1fr); }
.marke { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--flaeche-2); border: 1px solid var(--linie); }
.marke.gkv { background: var(--akzent-hell); color: var(--akzent); border-color: transparent; }
.marke.pkv { background: var(--warn-hell); color: var(--warn); border-color: transparent; }
.marke.ok { background: var(--ok-hell); color: var(--ok); border-color: transparent; }
.marke.fehler { background: var(--fehler-hell); color: var(--fehler); border-color: transparent; }
.meldung { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.meldung.fehler { background: var(--fehler-hell); color: var(--fehler); }
.meldung.ok { background: var(--ok-hell); color: var(--ok); }
.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 50; padding: 10px 16px; border-radius: 10px;
  background: var(--text); color: var(--grund); box-shadow: var(--schatten); animation: rein .15s ease-out;
}
.toast.fehler { background: var(--fehler); color: #fff; }
@keyframes rein { from { transform: translateY(8px); opacity: 0; } }
table.liste { width: 100%; border-collapse: collapse; }
table.liste th { text-align: left; font-size: 12px; color: var(--text-2); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--linie); position: sticky; top: 0; background: var(--flaeche); }
table.liste td { padding: 9px 12px; border-bottom: 1px solid var(--linie); }
table.liste tr.klick { cursor: pointer; }
table.liste tr.klick:hover td { background: var(--flaeche-2); }

/* ---- Anmeldung ------------------------------------------------------- */
.anmelden { height: 100%; display: grid; place-items: center; background: linear-gradient(160deg, var(--akzent-hell), var(--grund) 60%); }
.anmelden .karte { width: 360px; padding: 28px; }
.anmelden .marke-kopf { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.anmelden .marke-kopf img { width: 42px; height: 42px; }
.anmelden .marke-kopf b { font-size: 20px; }

/* ---- Akte ------------------------------------------------------------ */
.akte { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.patientenkopf { display: flex; align-items: center; gap: 16px; padding: 14px 18px; margin-bottom: 16px; }
.patientenkopf .avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--akzent-hell); color: var(--akzent); flex: none; }
.patientenkopf .name { font-size: 18px; font-weight: 650; }
.patientenkopf .daten { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-2); font-size: 13px; margin-top: 2px; }
.patientenkopf .aktionen { margin-left: auto; display: flex; gap: 8px; }
.schnell { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--linie); align-items: start; }
.schnell input.kuerzel { text-transform: uppercase; font-family: var(--mono); text-align: center; }
.schnell textarea { min-height: 36px; height: 36px; }
.hinweis-zeile { padding: 0 16px 8px; font-size: 12px; color: var(--text-2); }
.kartei { list-style: none; margin: 0; padding: 0; }
.kartei .tag { padding: 8px 16px; font-size: 12px; font-weight: 650; color: var(--text-2); background: var(--flaeche-2); border-bottom: 1px solid var(--linie); position: sticky; top: 0; }
.kartei .eintrag { display: grid; grid-template-columns: 54px 1fr; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--linie); }
.kartei .eintrag:hover { background: var(--flaeche-2); }
.kartei .kz { font: 600 12px var(--mono); color: var(--akzent); padding-top: 1px; }
.kartei .text { white-space: pre-wrap; word-break: break-word; }
.kartei .meta { font-size: 11.5px; color: var(--text-2); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.kartei .meta button { background: none; border: 0; padding: 0; color: var(--akzent); cursor: pointer; font-size: 11.5px; }
.kartei .eintrag.berichtigt .text { text-decoration: line-through; text-decoration-color: var(--fehler); color: var(--text-2); }
.kartei .eintrag.berichtigung { border-left: 3px solid var(--warn); }
.kartei .grund { color: var(--warn); font-size: 12px; }
.seite > .karte { margin-bottom: 16px; }
.dia { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px; padding: 7px 16px; border-bottom: 1px solid var(--linie); font-size: 13px; }
.dia:last-child { border-bottom: 0; }
.dia .icd { font: 600 12.5px var(--mono); }
.mini-form { display: flex; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--linie); }
.mini-form input { height: 30px; font-size: 13px; }
.mini-form select { height: 30px; border-radius: 8px; border: 1px solid var(--linie); background: var(--flaeche); }
.mini-form label { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 12.5px; color: var(--text-2); }
.dok { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 8px 16px; border-bottom: 1px solid var(--linie); cursor: pointer; }
.dok:hover { background: var(--flaeche-2); }
.dok .titel { font-weight: 550; }
.ablage-zone { margin: 10px 16px 14px; padding: 14px; border: 2px dashed var(--linie); border-radius: 10px; text-align: center; color: var(--text-2); font-size: 13px; cursor: pointer; }
.ablage-zone.drueber { border-color: var(--akzent); background: var(--akzent-hell); color: var(--akzent); }
.kette-hinweis { font-size: 11px; color: var(--text-2); padding: 8px 16px; }

/* ---- Termine --------------------------------------------------------- */
.tagkopf { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.tagkopf > input.eingabe { flex: 1 1 auto; max-width: 420px; }
.tagkopf h1 { margin: 0 8px 0 0; }
.termin { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--linie); align-items: center; }
.termin .zeit { font: 600 14px var(--mono); }
.termin .status { cursor: pointer; }
.status-geplant { background: var(--flaeche-2); }
.status-da { background: var(--warn-hell); color: var(--warn); border-color: transparent; }
.status-im_zimmer { background: var(--akzent-hell); color: var(--akzent); border-color: transparent; }
.status-fertig { background: var(--ok-hell); color: var(--ok); border-color: transparent; }
.status-abgesagt { text-decoration: line-through; opacity: .6; }

/* ---- Lade-Anzeige ---------------------------------------------------- */
.start-lader { width: 28px; height: 28px; margin: 40vh auto; border-radius: 50%; border: 3px solid var(--linie); border-top-color: var(--akzent); animation: drehen .7s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .akte { grid-template-columns: 1fr; }
  .raster.drei { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .rahmen { grid-template-columns: 1fr; grid-template-rows: 1fr 56px; }
  .leiste { grid-row: 2; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--linie); padding: 0 8px; }
  .leiste img, .leiste .unten { display: none; }
  .raster.zwei, .raster.drei { grid-template-columns: 1fr; }
  .inhalt { padding: 12px 16px; }
  .kopfzeile .wer { display: none; }
}
