/* Anthracite Tresor. Ruhiger Anthrazit-Grund, Wärme nur aus dem Bernstein-Siegel. */
@font-face { font-family: "Bricolage"; src: url("/fonts/BricolageGrotesque.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --grund: #26221E;
  --flaeche: #302B26;
  --flaeche-hoch: #3A342E;
  --tief: #1E1B18;
  --creme: #F2ECE0;
  --dim: #B0A694;
  --rot: #C8172A;
  --rot-hell: #FF4A52;
  --kante: #524B41;
  --linie: rgba(242, 236, 224, .11);
  --bernstein: #FFC15E;
  --orange: #FF7A3D;
  --gold: #FFF0D8;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --kopf: "Bricolage", "Inter", system-ui, sans-serif;
  --text: "Inter", system-ui, sans-serif;
  --r: 14px;
  --oben: env(safe-area-inset-top, 0px);
  --unten: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--grund);
  color: var(--creme);
  font: 400 15px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
/* feines Korn über allem, nimmt dem Dunkel das Digitale */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .05; z-index: 100;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--bernstein); }
:focus-visible { outline: 2px solid var(--bernstein); outline-offset: 2px; border-radius: 8px; }

h1, h2, h3 { font-family: var(--kopf); font-weight: 700; letter-spacing: -.025em; margin: 0; line-height: 1.1; }
.eyebrow { font: 500 11px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--dim); }

/* ---------- Siegel: das eine Zeichen dieser App ---------- */
.siegel {
  --g: 26px;
  width: var(--g); height: var(--g); flex: none; border-radius: 50%; position: relative; display: inline-block;
  background: radial-gradient(circle at 38% 32%, var(--gold) 0 8%, var(--bernstein) 34%, #C8762A 78%, #8F4E1A 100%);
  box-shadow: inset 0 0 0 1.5px rgba(255, 240, 216, .35), inset 0 -3px 5px rgba(0, 0, 0, .25), 0 1px 2px rgba(0, 0, 0, .4);
  transition: transform .45s cubic-bezier(.2, .9, .3, 1.3), opacity .35s;
}
.siegel::before {
  content: ""; position: absolute; inset: 22%; border-radius: 50%;
  border: 1.5px solid rgba(38, 34, 30, .55);
  background: radial-gradient(circle at 50% 42%, rgba(38, 34, 30, .7) 0 13%, transparent 14%),
    linear-gradient(rgba(38, 34, 30, .7), rgba(38, 34, 30, .7)) 50% 72% / 10% 30% no-repeat;
}
.siegel-gross { --g: 64px; }
.offen > .zeile-kopf .siegel { transform: rotate(-38deg) scale(.86); opacity: .45; }
.laden { min-height: 100dvh; display: grid; place-items: center; }
.laden .siegel { animation: atmen 1.4s ease-in-out infinite; }
@keyframes atmen { 50% { transform: scale(.9); opacity: .6; } }

/* ---------- Knöpfe und Felder ---------- */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--kante);
  background: var(--flaeche); color: var(--creme); font-weight: 600; cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
}
.knopf:hover { background: var(--flaeche-hoch); border-color: var(--dim); }
.knopf:active { transform: scale(.97); }
.knopf.haupt { background: var(--rot); border-color: var(--rot); }
.knopf.haupt:hover { background: #DC1F33; border-color: #DC1F33; }
.knopf.leise { background: transparent; border-color: transparent; color: var(--dim); }
.knopf.leise:hover { color: var(--creme); background: var(--linie); }
.knopf.gefahr { color: var(--rot-hell); }
.knopf.gefahr:hover { border-color: var(--rot-hell); }
.knopf[disabled] { opacity: .5; pointer-events: none; }
.icon-knopf {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--dim);
  display: inline-grid; place-items: center; cursor: pointer; transition: background .2s, color .2s; flex: none;
}
.icon-knopf:hover { background: var(--linie); color: var(--creme); }
.icon-knopf svg, .knopf svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-knopf.ok { color: var(--bernstein); }

label.feld { display: grid; gap: 6px; }
label.feld > span { font-size: 13px; color: var(--dim); font-weight: 500; }
.eingabe, label.feld input, label.feld select, label.feld textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 12px;
  background: var(--tief); border: 1px solid var(--kante); outline: none; transition: border-color .2s, box-shadow .2s;
}
label.feld textarea { min-height: 90px; resize: vertical; }
.eingabe:focus, label.feld input:focus, label.feld select:focus, label.feld textarea:focus { border-color: var(--bernstein); box-shadow: 0 0 0 3px rgba(255, 193, 94, .15); }
.mit-knopf { position: relative; display: flex; gap: 8px; align-items: center; }
.mit-knopf input { flex: 1; }
.code-eingabe { font: 600 24px/1 var(--mono) !important; letter-spacing: .4em; text-align: center; }
.hinweis { color: var(--dim); font-size: 13px; margin: 0; }
.fehler { color: var(--rot-hell); font-size: 14px; margin: 0; min-height: 1.2em; }

/* ---------- Einstiegsseiten (Anmelden, Einladung, Notfall) ---------- */
.tor {
  min-height: 100dvh; display: grid; place-items: center;
  padding: calc(32px + var(--oben)) 20px calc(32px + var(--unten));
}
.tor-karte { width: min(420px, 100%); display: grid; gap: 22px; }
.tor-kopf { display: grid; gap: 14px; justify-items: start; }
.tor-kopf h1 { font-size: clamp(30px, 7vw, 40px); }
.tor-karte form { display: grid; gap: 16px; }
.tor-fuss { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.schritte { display: flex; gap: 6px; }
.schritte i { height: 3px; width: 28px; border-radius: 3px; background: var(--kante); }
.schritte i.an { background: var(--bernstein); }
.schluessel-block {
  font: 600 20px/1.5 var(--mono); letter-spacing: .06em; padding: 18px; border-radius: var(--r);
  background: var(--tief); border: 1px dashed var(--bernstein); color: var(--gold); overflow-wrap: anywhere; word-spacing: .35em; text-align: center;
}

/* ---------- Tresor ---------- */
.tresor { display: grid; grid-template-columns: 300px 1fr; min-height: 100dvh; }
.seite {
  border-right: 1px solid var(--linie); background: var(--tief);
  display: flex; flex-direction: column; height: 100dvh; position: sticky; top: 0;
  padding-top: var(--oben);
}
.seite-kopf { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 10px 20px; }
.marke { display: flex; align-items: center; gap: 10px; font: 700 20px/1 var(--kopf); letter-spacing: -.02em; }
.marke .siegel { --g: 22px; }
.suche { padding: 6px 16px 12px; }
.suche input { min-height: 42px; padding-left: 38px; background: var(--grund) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B0A694' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 12px 50% / 17px no-repeat; }
.kunden { list-style: none; margin: 0; padding: 4px 10px; overflow-y: auto; flex: 1; }
.kunden button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left;
  color: var(--dim); font-weight: 500; transition: background .15s, color .15s;
}
.kunden button:hover { background: var(--linie); color: var(--creme); }
.kunden button[aria-current="true"] { background: var(--flaeche); color: var(--creme); box-shadow: inset 3px 0 0 var(--bernstein); }
.kunden .zahl { font: 500 12px/1 var(--mono); color: var(--dim); opacity: .7; }
.seite-fuss { padding: 12px 16px calc(14px + var(--unten)); border-top: 1px solid var(--linie); display: grid; }
.leer-hinweis { flex: 1; margin: 0; padding: 18px 20px; color: var(--dim); font-size: 14px; }

.bereich { min-width: 0; padding: calc(28px + var(--oben)) clamp(18px, 4vw, 48px) calc(48px + var(--unten)); }
.haupt-kopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.haupt-kopf h1 { font-size: clamp(30px, 5vw, 52px); word-break: break-word; }
.haupt-kopf .aktionen { display: flex; gap: 8px; flex-wrap: wrap; }
.zurueck { display: none; }

.ordner { margin-bottom: 28px; }
.ordner-kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 4px 8px; border-bottom: 1px solid var(--linie); margin-bottom: 6px;
}
.ordner-kopf h2 { font: 500 11px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--dim); }

.zugang { border-radius: var(--r); transition: background .2s; }
.zugang + .zugang { margin-top: 2px; }
.zugang:hover { background: rgba(48, 43, 38, .6); }
.zugang.offen { background: var(--flaeche); box-shadow: 0 0 0 1px var(--linie); margin: 8px 0; }
.zeile-kopf {
  width: 100%; display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 8px 12px;
  border: 0; background: transparent; cursor: pointer; text-align: left; border-radius: var(--r);
}
.zeile-titel { display: grid; min-width: 0; flex: 1; }
.zeile-titel b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zeile-titel small { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.zeile-kopf .pfeil { color: var(--dim); transition: transform .3s; }
.offen .zeile-kopf .pfeil { transform: rotate(90deg); }
.zeile-inhalt { display: grid; gap: 2px; padding: 0 12px 14px 52px; animation: auf .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes auf { from { opacity: 0; transform: translateY(-6px); } }
.wert { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 10px; min-height: 46px; border-top: 1px solid var(--linie); }
.wert:first-child { border-top: 0; }
.wert > span:first-child { color: var(--dim); font-size: 13px; }
.wert .inhalt { min-width: 0; overflow-wrap: anywhere; }
.wert .knoepfe { display: flex; gap: 2px; }
.wert .notiz { white-space: pre-wrap; color: var(--creme); }
.zeile-fuss { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 10px; flex-wrap: wrap; }
.zeile-fuss small { color: var(--dim); font-size: 12px; }

/* Passwort lesbar: Ziffern Bernstein, Zeichen Rot-hell, Buchstaben Creme */
.pw { font: 500 16px/1.4 var(--mono); letter-spacing: .04em; }
.pw .z { color: var(--bernstein); }
.pw .s { color: var(--rot-hell); }
.pw-zu { font: 500 16px/1 var(--mono); letter-spacing: .2em; color: var(--dim); }

.totp { display: inline-flex; align-items: center; gap: 12px; }
.totp b { font: 600 22px/1 var(--mono); letter-spacing: .12em; color: var(--gold); }
.ring { width: 22px; height: 22px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3; }
.ring .bahn { stroke: var(--kante); }
.ring .rest { stroke: var(--bernstein); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.ring.knapp .rest { stroke: var(--orange); }

.leer {
  border: 1px dashed var(--kante); border-radius: var(--r); padding: 38px 24px; text-align: center; display: grid; gap: 14px; justify-items: center;
}
.leer p { margin: 0; color: var(--dim); max-width: 42ch; }
.treffer-kunde { font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--bernstein); padding: 14px 4px 6px; }

/* ---------- Dialoge ---------- */
dialog {
  border: 1px solid var(--kante); border-radius: 20px; background: var(--grund); color: var(--creme);
  padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
dialog::backdrop { background: rgba(20, 18, 16, .66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog[open] { animation: hoch .3s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes hoch { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.dlg { display: grid; gap: 18px; padding: 24px; }
.fluss { display: grid; gap: 16px; min-width: 0; }
dialog form { display: grid; gap: 16px; }
.dlg-kopf { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dlg-kopf h2 { font-size: 24px; }
.dlg-fuss { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dlg-fuss .rechts { display: flex; gap: 8px; margin-left: auto; }
dialog.breit { width: min(760px, calc(100vw - 24px)); }
.reiter { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--linie); margin: 0 -24px; padding: 0 20px; }
.reiter button { border: 0; background: none; color: var(--dim); padding: 10px 10px 12px; cursor: pointer; font-weight: 600; white-space: nowrap; border-bottom: 2px solid transparent; }
.reiter button:hover { color: var(--creme); }
.reiter button[aria-selected="true"] { color: var(--creme); border-bottom-color: var(--bernstein); }
.liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.liste li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--flaeche); }
.liste li .wer { display: grid; min-width: 0; }
.liste li .wer small { color: var(--dim); font-size: 13px; overflow-wrap: anywhere; }
.marke-klein { font: 500 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; padding: 5px 8px; border-radius: 999px; border: 1px solid var(--kante); color: var(--dim); white-space: nowrap; }
.marke-klein.warm { color: var(--bernstein); border-color: rgba(255, 193, 94, .4); }
.haken { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.haken:hover { background: var(--linie); }
.haken input { width: 20px; height: 20px; accent-color: var(--bernstein); }
.protokoll { font-size: 13px; }
.protokoll li { padding: 9px 12px; }
.protokoll time { font-family: var(--mono); color: var(--dim); font-size: 12px; white-space: nowrap; }
.signatur-rahmen { border: 0; width: 100%; height: 76px; display: block; color-scheme: normal; }
.zweispaltig { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

#toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--unten)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--creme); color: var(--grund); font-weight: 600; padding: 12px 20px; border-radius: 999px; z-index: 200;
  transition: opacity .25s, transform .25s; max-width: calc(100vw - 32px); text-align: center;
}
#toast.da { opacity: 1; transform: translate(-50%, 0); }
#toast.warnung { background: var(--orange); color: var(--tief); }

/* ---------- Handy ---------- */
@media (max-width: 760px) {
  .tresor { grid-template-columns: 1fr; }
  .seite { height: auto; min-height: 100dvh; position: static; border-right: 0; background: var(--grund); }
  .tresor.kunde-offen .seite { display: none; }
  .tresor:not(.kunde-offen) .bereich { display: none; }
  .zurueck { display: inline-grid; margin-left: -8px; }
  .bereich { padding-top: calc(12px + var(--oben)); }
  .haupt-kopf { display: grid; gap: 10px; }
  .kunden button { min-height: 52px; font-size: 16px; }
  .zeile-inhalt { padding-left: 12px; }
  .wert { grid-template-columns: 1fr auto; grid-template-areas: "l k" "i k"; padding: 8px 0; row-gap: 2px; }
  .wert > span:first-child { grid-area: l; font-size: 12px; }
  .wert .inhalt { grid-area: i; }
  .wert .knoepfe { grid-area: k; }
  .zweispaltig { grid-template-columns: 1fr; }
  dialog { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto auto 0; border-radius: 20px 20px 0 0; border-bottom: 0; }
  .dlg { padding-bottom: calc(24px + var(--unten)); }
  .eingabe, label.feld input, label.feld select, label.feld textarea { font-size: 16px; }
}

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

/* Wartende Personen: ein warmer Hinweis unter der Suche, nur für Inhaber */
.banner { margin: 0 14px 10px; padding: 12px 14px; border-radius: 12px; display: grid; gap: 10px;
  background: linear-gradient(180deg, rgba(255, 193, 94, .12), rgba(255, 193, 94, .05)); border: 1px solid rgba(255, 193, 94, .32); }
.banner-text { font-size: 14px; color: var(--creme); }
.banner-text b { color: var(--bernstein); font-weight: 600; }
.banner .knopf { justify-self: start; }
.zeile-titel.defekt b { color: var(--rot-hell); }
.knoepfe-text { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
