/* ==========================================================================
   watchME Dashboard – „Kommandobrücke der Nachtvitrine“
   ==========================================================================
   Dieselbe Welt wie die Kunden-App (Espresso-Schwarz, Champagner-Gold,
   Smaragd nur für „läuft“), aber ein anderer Raum: nicht das Schaufenster,
   sondern das Kontor dahinter. Links eine schmale Messing-Leiste als
   Navigation (mobil: eine Leiste unten), große Serifen-Ziffern für die
   Kennzahlen, Statuslampen wie an einem alten Schaltpult.
   ========================================================================== */

:root {
  --bg:            #0d0b08;
  --bg-panel:      #15120c;
  --bg-raised:     #1e1910;
  --bg-input:      #100e08;

  --line:          #2a2416;
  --line-strong:   #3d341f;

  --text:          #ede5d3;
  --text-dim:      #a99e87;
  --text-faint:    #6f6754;

  --lume:          #d9b96a;
  --lume-deep:     #b3934a;
  --lume-glow:     rgba(217, 185, 106, 0.12);

  --brass:         #e2c37a;
  --mint:          #4fc08a;
  --mint-dim:      rgba(79, 192, 138, 0.14);
  --danger:        #e07a5f;
  --danger-dim:    rgba(224, 122, 95, 0.12);
  --warn:          #d9a13f;
  --warn-dim:      rgba(217, 161, 63, 0.14);

  --radius:        10px;
  --radius-lg:     18px;

  --font-display:  'Fraunces', ui-serif, Georgia, serif;
  --font-sans:     'Archivo', ui-sans-serif, system-ui, sans-serif;
  --font-mono:     'Spline Sans Mono', ui-monospace, 'SF Mono', monospace;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 16px 40px -24px rgba(0, 0, 0, 0.9);
  --edge: inset 0 1px 0 rgba(255, 244, 214, 0.045);

  --rail-w: 236px;
  --nav-h: 62px; /* Höhe der unteren Leiste auf dem Handy */
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 70% 40% at 18% -10%, rgba(217, 185, 106, 0.06), transparent),
    radial-gradient(ellipse 130% 80% at 50% 118%, rgba(0, 0, 0, 0.55), transparent);
}

/* Feines Korn – Samt statt Plastik */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.05;
  mix-blend-mode: overlay;
  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='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

.mono, input, select, textarea, .stat-value, pre, code { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; border: 3px solid var(--bg); }
::selection { background: var(--lume); color: #1a1406; }
:focus-visible { outline: 2px solid var(--lume); outline-offset: 2px; border-radius: 3px; }

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

a { color: var(--brass); text-decoration: none; }
a:hover { text-decoration: underline; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Anmeldung
   -------------------------------------------------------------------------- */

.gate { min-height: 100%; display: grid; place-items: center; padding: 24px; }

.gate-card {
  width: min(380px, 100%);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), var(--edge);
  padding: 40px 36px 32px;
  text-align: center;
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.seal {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  border: 1px solid var(--lume-deep);
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--lume);
  background: radial-gradient(circle at 30% 25%, var(--lume-glow), transparent 70%);
  box-shadow: 0 0 0 5px rgba(217, 185, 106, 0.05), var(--edge);
  flex: none;
}

.gate h1 { font-family: var(--font-display); font-size: 26px; font-weight: 500; margin: 0 0 4px; }
.gate p { color: var(--text-dim); margin: 0 0 24px; font-size: 13.5px; }

/* --------------------------------------------------------------------------
   Grundbausteine
   -------------------------------------------------------------------------- */

input, select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus { border-color: var(--lume-deep); outline: none; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { resize: vertical; min-height: 60px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  box-shadow: var(--edge);
  text-decoration: none;
}
.btn:hover { border-color: var(--lume-deep); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.gold {
  background: linear-gradient(180deg, var(--lume), var(--lume-deep));
  border-color: var(--lume-deep);
  color: #1a1406;
}
.btn.gold:hover { filter: brightness(1.07); }
.btn.danger { border-color: rgba(224, 122, 95, 0.4); color: var(--danger); }
.btn.small { padding: 6px 11px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.5; cursor: wait; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  white-space: nowrap;
}
.chip .lamp { margin: 0; }
.chip.ok    { border-color: rgba(79, 192, 138, 0.35); color: var(--mint); background: var(--mint-dim); }
.chip.bad   { border-color: rgba(224, 122, 95, 0.4);  color: var(--danger); background: var(--danger-dim); }
.chip.warn  { border-color: rgba(217, 161, 63, 0.4);  color: var(--warn); background: var(--warn-dim); }
.chip.gold  { border-color: var(--lume-deep); color: var(--lume); background: var(--lume-glow); }

/* Status eines Kunden – kleine Plakette */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
  white-space: nowrap;
}
.pill.aktiv       { border-color: rgba(79, 192, 138, 0.4); color: var(--mint); background: var(--mint-dim); }
.pill.test        { border-color: var(--lume-deep); color: var(--lume); background: var(--lume-glow); }
.pill.interessent { border-color: var(--line-strong); color: var(--text-dim); }
.pill.pausiert    { border-color: rgba(217, 161, 63, 0.4); color: var(--warn); background: var(--warn-dim); }
.pill.gekuendigt  { border-color: rgba(224, 122, 95, 0.4); color: var(--danger); background: var(--danger-dim); }

.lamp { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex: none; }
.lamp.on  { background: var(--mint);  box-shadow: 0 0 8px rgba(79, 192, 138, 0.8); }
.lamp.off { background: var(--danger); box-shadow: 0 0 8px rgba(224, 122, 95, 0.7); }
.lamp.dim { background: var(--warn); box-shadow: 0 0 8px rgba(217, 161, 63, 0.6); }

.card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), var(--edge);
  padding: 20px 22px;
}

.card h3 {
  margin: 0 0 4px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* Erklärsatz unter einer Überschrift – überall die gleiche freundliche Stimme */
.help {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 14px;
  max-width: 62ch;
}
.card h3 + *:not(.help) { margin-top: 10px; }

/* --------------------------------------------------------------------------
   Gerüst: Messing-Leiste links (Desktop), Leiste unten (Handy)
   -------------------------------------------------------------------------- */

.shell { display: grid; grid-template-columns: var(--rail-w) 1fr; height: 100%; }

.rail {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #14110b, #0f0d09);
  display: flex;
  flex-direction: column;
  padding: 26px 18px 18px;
  gap: 22px;
  position: relative;
  overflow-y: auto;
}
.rail::after {
  content: '';
  position: absolute;
  top: 0; right: -1px; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, var(--lume-deep), transparent 40%, transparent 75%, rgba(179, 147, 74, 0.4));
  opacity: 0.5;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.brand .seal { width: 42px; height: 42px; margin: 0; font-size: 17px; }
.brand-name { font-family: var(--font-display); font-size: 19px; font-weight: 500; line-height: 1.15; }
.brand-sub { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--lume-deep); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 14px 10px 6px;
  font-weight: 700;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 14px;
  border: 1px solid transparent;
}
.nav a svg { flex: none; opacity: 0.75; }
.nav a:hover { color: var(--text); text-decoration: none; background: var(--bg-raised); }
.nav a.active { color: var(--lume); background: var(--lume-glow); border-color: rgba(217, 185, 106, 0.25); }
.nav a .lamp { margin-left: auto; }

.rail-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  padding: 12px 6px 0;
}

.stage { overflow-y: auto; padding: 34px 40px 60px; }
.stage-inner { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }

.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-head h2 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  margin: 0;
}
.page-head .sub { color: var(--text-dim); font-size: 13.5px; flex-basis: 100%; margin-top: -8px; }
.page-head .spacer { flex: 1; }

/* Untere Leiste – nur auf dem Handy sichtbar */
.tabbar { display: none; }

/* --------------------------------------------------------------------------
   Kennzahlen
   -------------------------------------------------------------------------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }

.kpi {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), var(--edge);
  padding: 16px 18px 14px;
  animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.kpi:nth-child(2) { animation-delay: 0.04s; }
.kpi:nth-child(3) { animation-delay: 0.08s; }
.kpi:nth-child(4) { animation-delay: 0.12s; }
.kpi:nth-child(5) { animation-delay: 0.16s; }
.kpi:nth-child(6) { animation-delay: 0.2s; }

.kpi .label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.kpi .value {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 500;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.kpi .value.gold { color: var(--brass); }
.kpi .value.mint { color: var(--mint); }
.kpi .value.bad  { color: var(--danger); }
.kpi .hint { font-size: 12px; color: var(--text-dim); margin-top: 5px; }

.kpi.flat { box-shadow: none; animation: none; }
.kpi.flat .value { font-size: 26px; }

/* --------------------------------------------------------------------------
   Flotte / Kundenliste
   -------------------------------------------------------------------------- */

.fleet { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

.fleet-card {
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), var(--edge);
  padding: 18px 20px;
  color: var(--text);
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s, transform 0.15s;
}
.fleet-card:hover { border-color: var(--lume-deep); transform: translateY(-2px); }

.fleet-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fleet-head .lamp { width: 10px; height: 10px; }
.fleet-name { font-family: var(--font-display); font-size: 19px; font-weight: 500; }
.fleet-head .pill { margin-left: auto; }

.fleet-url { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fleet-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.mini { min-width: 0; }
.mini .label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.mini .value { font-family: var(--font-mono); font-size: 15px; color: var(--text); }
.mini .value.mint { color: var(--mint); }
.mini .value.bad { color: var(--danger); }

/* --------------------------------------------------------------------------
   Tabellen
   -------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
tr.off td { opacity: 0.45; }

.watch-name { font-weight: 600; }
.watch-query { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }

.interval-edit { display: inline-flex; align-items: center; gap: 5px; }
.interval-edit input { width: 64px; padding: 4px 7px; font-size: 12.5px; text-align: right; }
.interval-edit span { color: var(--text-faint); font-size: 12px; }

/* --------------------------------------------------------------------------
   Detailseite, Formulare
   -------------------------------------------------------------------------- */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.sys-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.meter { flex: 1 1 150px; min-width: 150px; }
.meter .label { display: flex; justify-content: space-between; font-size: 11px; font-family: var(--font-mono); color: var(--text-dim); margin-bottom: 4px; }
.meter .bar { height: 6px; border-radius: 4px; background: var(--bg-input); border: 1px solid var(--line); overflow: hidden; }
.meter .fill { height: 100%; background: linear-gradient(90deg, var(--lume-deep), var(--lume)); border-radius: 4px; }
.meter .fill.hot { background: linear-gradient(90deg, #b3562f, var(--danger)); }

.violations { display: flex; flex-direction: column; gap: 8px; }
.violation {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(217, 161, 63, 0.35);
  background: var(--warn-dim);
  color: var(--text);
  border-radius: var(--radius);
  padding: 9px 13px;
  font-size: 13px;
}
.violation .who { font-family: var(--font-mono); color: var(--warn); font-size: 12px; flex: none; }

.form-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.form-row label { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); margin-bottom: 13px; }
.check-row input { width: auto; }

pre.logs {
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 11.5px;
  line-height: 1.6;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-dim);
  margin: 0;
}

.error-item { font-size: 12.5px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.error-item:last-child { border-bottom: none; }
.error-item .when { font-family: var(--font-mono); color: var(--text-faint); font-size: 11px; }
.error-item .msg { color: var(--danger); }

/* Zugangsdaten: Wert-Zeile mit Anzeigen/Kopieren */
.secret-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 8px 8px 12px;
  margin-bottom: 10px;
}
.secret-row .key { font-size: 12px; color: var(--text-faint); flex: none; min-width: 76px; }
.secret-row .val {
  font-family: var(--font-mono);
  font-size: 13px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.secret-row .val.hidden-dots { letter-spacing: 0.2em; color: var(--text-dim); }

/* Onboarding-Checkliste */
.todo { display: flex; flex-direction: column; gap: 4px; }
.todo label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13.5px;
  transition: border-color 0.15s;
}
.todo label:hover { border-color: var(--lume-deep); }
.todo input { width: 17px; height: 17px; accent-color: var(--lume); flex: none; }
.todo label.done { color: var(--text-faint); text-decoration: line-through; }
.todo .todo-hint { margin-left: auto; font-size: 11.5px; color: var(--text-faint); text-decoration: none; }

/* Historie / Tagebuch */
.timeline { display: flex; flex-direction: column; max-height: 300px; overflow-y: auto; }
.timeline .entry { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.timeline .entry:last-child { border-bottom: none; }
.timeline .when { font-family: var(--font-mono); color: var(--text-faint); font-size: 11px; flex: none; width: 110px; }
.note-row { display: flex; gap: 8px; margin-top: 12px; }
.note-row input { flex: 1; }

/* --------------------------------------------------------------------------
   Anleitung „Neuer Kunde“ – nummerierte Schritte
   -------------------------------------------------------------------------- */

.steps { display: flex; flex-direction: column; gap: 14px; counter-reset: step; }

.step {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), var(--edge);
  padding: 20px 22px;
}
.step-num {
  counter-increment: step;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 500;
  color: var(--lume);
  line-height: 1;
  text-align: center;
  padding-top: 2px;
}
.step-num::before { content: counter(step); }
.step h4 { margin: 2px 0 6px; font-family: var(--font-display); font-size: 18px; font-weight: 500; }
.step p { margin: 0 0 10px; color: var(--text-dim); font-size: 13.5px; max-width: 64ch; }
.step ul { margin: 0 0 10px; padding-left: 18px; color: var(--text-dim); font-size: 13.5px; }
.step li { margin-bottom: 3px; }

.cmd {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.cmd code {
  flex: 1;
  font-size: 12.5px;
  color: var(--brass);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.cmd .btn { flex: none; }

/* --------------------------------------------------------------------------
   Tresor
   -------------------------------------------------------------------------- */

.vault-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

.vault-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), var(--edge);
  padding: 16px 18px;
}
.vault-card .vault-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.vault-card .vault-label { font-family: var(--font-display); font-size: 16.5px; font-weight: 500; }
.vault-card .vault-user { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); }
.vault-card .vault-note { font-size: 12.5px; color: var(--text-dim); margin-top: 8px; }
.vault-card .vault-actions { display: flex; gap: 8px; margin-top: 10px; }

/* --------------------------------------------------------------------------
   Quick Links
   -------------------------------------------------------------------------- */

.links-group h3 { margin: 22px 0 10px; font-family: var(--font-display); font-size: 17px; font-weight: 500; color: var(--brass); }
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }

.link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--edge);
  padding: 13px 15px;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
}
.link-card:hover { border-color: var(--lume-deep); text-decoration: none; transform: translateY(-1px); }
.link-card .arrow { margin-left: auto; color: var(--lume-deep); font-family: var(--font-display); }
.link-card .host { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.link-card .del {
  position: absolute;
  top: -7px; right: -7px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--bg-raised);
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: none;
}
.link-card:hover .del { display: block; }
.link-card .del:hover { color: var(--danger); border-color: var(--danger); }

/* --------------------------------------------------------------------------
   Finanzen: Monatsbalken und Kassenbuch
   -------------------------------------------------------------------------- */

.months { display: flex; flex-direction: column; gap: 6px; }
.month-row { display: grid; grid-template-columns: 64px 1fr 110px; gap: 10px; align-items: center; font-size: 12.5px; }
.month-row .m { font-family: var(--font-mono); color: var(--text-dim); }
.month-row .bars { display: flex; flex-direction: column; gap: 3px; }
.month-row .bar-in, .month-row .bar-out { height: 7px; border-radius: 4px; min-width: 2px; }
.month-row .bar-in  { background: linear-gradient(90deg, var(--lume-deep), var(--lume)); }
.month-row .bar-out { background: rgba(224, 122, 95, 0.55); }
.month-row .saldo { text-align: right; font-family: var(--font-mono); }
.month-row .saldo.plus { color: var(--mint); }
.month-row .saldo.minus { color: var(--danger); }

.betrag-in  { color: var(--mint); font-family: var(--font-mono); white-space: nowrap; }
.betrag-out { color: var(--danger); font-family: var(--font-mono); white-space: nowrap; }

/* --------------------------------------------------------------------------
   Papier: Rechnung und Vertrag (Bildschirm + Druck)
   -------------------------------------------------------------------------- */

.paper-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.paper {
  background: #fbf8f1;
  color: #211c12;
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 48px 52px;
  max-width: 800px;
  font-size: 13.5px;
  line-height: 1.6;
  font-family: var(--font-sans);
}
.paper h1 { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin: 0 0 4px; }
.paper .paper-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.paper .absender { font-size: 11px; color: #6f6754; border-bottom: 1px solid #d8d0bd; padding-bottom: 4px; margin-bottom: 10px; }
.paper .meta { text-align: right; font-size: 12.5px; color: #4a4130; }
.paper .meta strong { color: #211c12; }
.paper table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 13px; }
.paper th { color: #6f6754; border-bottom: 1.5px solid #211c12; padding: 6px 8px; text-transform: none; letter-spacing: 0; font-size: 12px; }
.paper td { border-bottom: 1px solid #d8d0bd; padding: 8px; color: #211c12; }
.paper tr.total td { border-top: 2px solid #211c12; border-bottom: none; font-weight: 700; font-size: 14.5px; }
.paper .fuss { margin-top: 30px; font-size: 12px; color: #4a4130; }
.paper pre { font-family: var(--font-sans); white-space: pre-wrap; font-size: 13px; line-height: 1.65; margin: 0; }
.paper[contenteditable='true'] { outline: 2px dashed rgba(179, 147, 74, 0.4); outline-offset: 6px; }

@media print {
  body { background: #fff; }
  body::after, .rail, .tabbar, .paper-toolbar, .toast, .page-head { display: none !important; }
  .shell { display: block; }
  .stage { padding: 0; overflow: visible; }
  .stage-inner { max-width: none; gap: 0; }
  .paper { box-shadow: none; border-radius: 0; max-width: none; padding: 0; }
}

/* --------------------------------------------------------------------------
   Sonstiges
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-raised);
  border: 1px solid var(--lume-deep);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 11px 18px;
  font-size: 13.5px;
  z-index: 1000;
  animation: rise 0.3s both;
  max-width: min(90vw, 480px);
}
.toast.error { border-color: var(--danger); color: var(--danger); }

.empty { color: var(--text-faint); font-size: 13.5px; padding: 8px 0; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }

.loading {
  display: grid;
  place-items: center;
  padding: 80px 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.loading::before {
  content: '';
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--lume);
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Handy: Leiste unten statt Leiste links
   -------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }

  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(18, 15, 10, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line-strong);
    z-index: 100;
  }
  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-faint);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
  }
  .tabbar a.active { color: var(--lume); }
  .tabbar a svg { width: 21px; height: 21px; }

  .stage { padding: 20px 16px calc(var(--nav-h) + 40px); }
  .page-head h2 { font-size: 25px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi .value { font-size: 27px; }
  .fleet { grid-template-columns: 1fr; }
  .step { grid-template-columns: 40px 1fr; padding: 16px; gap: 10px; }
  .step-num { font-size: 26px; }
  .card { padding: 16px; }
  .secret-row .key { min-width: 64px; }
  .timeline .when { width: 84px; }
}
