/* RE-TEC Intranet – Oberfläche
   Designsprache: helle Fläche, weiße Karten mit großem Radius und weichem
   Schatten, Dunkelgrün als Primärfarbe, Limette als Akzent. */

/* Farbschemata – umschaltbar über data-theme am <html>-Element:
   blau (Standard), blau-dunkel, retec (Rot/Schwarz), retec-dunkel. */

:root,
:root[data-theme="blau"] {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --border: #e3e9f2;
  --border-strong: #d3dbe8;
  --text: #101c2e;
  --text-dim: #5c6b80;

  --brand: #1b3a6b;           /* Dunkelblau: Hauptaktionen */
  --brand-dark: #142c52;
  --brand-soft: #e9eff9;      /* aktive Navigation, Chips */
  --brand-ink: #ffffff;       /* Schrift auf Dunkelblau */
  --accent: #d92d35;          /* Rot: Marke und Akzente */
  --accent-dark: #b61f28;
  --accent-soft: #fdeaeb;

  --good: #1f7a46;
  --good-soft: #e6f3eb;
  --warn: #9a6300;
  --warn-soft: #fdf3dd;
  --bad: #c62a30;
  --bad-soft: #fdeaeb;

  --chart-income: #1b3a6b;
  --chart-expense: #d92d35;

  --shadow: 0 1px 2px rgba(16, 28, 46, .05), 0 10px 28px rgba(16, 28, 46, .07);
  --shadow-lg: 0 18px 50px rgba(16, 28, 46, .22);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 248px;
  font-synthesis: none;
}

:root[data-theme="retec"] {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e4e6ea;
  --border-strong: #d4d7dd;
  --text: #15171a;
  --text-dim: #646a75;

  --brand: #1a1c20;           /* Schwarz: Hauptaktionen */
  --brand-dark: #000000;
  --brand-soft: #eceef1;
  --brand-ink: #ffffff;
  --accent: #e01e26;          /* RE-TEC Rot */
  --accent-dark: #b8151c;
  --accent-soft: #fdeaeb;

  --good: #1f7a46;
  --good-soft: #e9f4ee;
  --warn: #9a6300;
  --warn-soft: #fdf3dd;
  --bad: #e01e26;
  --bad-soft: #fdeaeb;

  --chart-income: #1a1c20;
  --chart-expense: #e01e26;

  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 10px 28px rgba(0, 0, 0, .07);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .25);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 248px;
}

:root[data-theme="blau-dunkel"] {
  --bg: #0c1420;
  --surface: #131d2d;
  --surface-2: #1a2537;
  --border: #243246;
  --border-strong: #2f4059;
  --text: #e8eef7;
  --text-dim: #94a3b8;

  --brand: #4b86d8;
  --brand-dark: #3d72bd;
  --brand-soft: #1b2c44;
  --brand-ink: #0c1420;
  --accent: #f0565d;
  --accent-dark: #d8434a;
  --accent-soft: #2d1b1e;

  --good: #5fc98a;
  --good-soft: #15291f;
  --warn: #e0b45f;
  --warn-soft: #2a2316;
  --bad: #f0565d;
  --bad-soft: #2d1b1e;

  --chart-income: #4b86d8;
  --chart-expense: #f0565d;

  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .6);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 248px;
}

:root[data-theme="retec-dunkel"] {
  --bg: #0d0e10;
  --surface: #16181c;
  --surface-2: #1d2025;
  --border: #272a30;
  --border-strong: #343840;
  --text: #eceef2;
  --text-dim: #9aa1ad;

  --brand: #f0f1f3;
  --brand-dark: #ffffff;
  --brand-soft: #22252b;
  --brand-ink: #15171a;
  --accent: #f3353d;
  --accent-dark: #d8232b;
  --accent-soft: #2c1517;

  --good: #5fc98a;
  --good-soft: #152a1e;
  --warn: #e0b45f;
  --warn-soft: #2a2316;
  --bad: #f3353d;
  --bad-soft: #2c1517;

  --chart-income: #eceef2;
  --chart-expense: #f3353d;

  --shadow: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .65);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 248px;
}

/* Schwarz · RE-TEC Rot – wie die Anmeldung und die Techniker-App.
   Die Anmeldung nutzt dieses Schema immer (unabhängig von der Auswahl). */
:root[data-theme="schwarz"],
.login-screen {
  --bg: #000000;
  --surface: #0b0b0c;
  --surface-2: #141416;
  --border: #222226;
  --border-strong: #2a2a30;
  --text: #f2f2f4;
  --text-dim: #9b9ba3;

  --brand: #e1242c;
  --brand-dark: #c51d24;
  --brand-soft: #2a0f11;
  --brand-ink: #ffffff;
  --accent: #e1242c;
  --accent-dark: #c51d24;
  --accent-soft: #2a0f11;

  --good: #4fd17f;
  --good-soft: #0f2418;
  --warn: #f0b444;
  --warn-soft: #2a2010;
  --bad: #ff4d55;
  --bad-soft: #2a0f11;

  --chart-income: #f2f2f4;
  --chart-expense: #e1242c;

  --shadow: 0 1px 2px rgba(0, 0, 0, .8);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .9);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 248px;
  color-scheme: dark;
}
:root[data-theme="schwarz"] body {
  background: radial-gradient(1000px 520px at 10% 0%, rgba(225, 36, 44, .14) 0%, transparent 60%) fixed, #000;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650;
  letter-spacing: -.01em; }
h1 { font-size: 21px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
a { color: var(--brand); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ Login */

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: radial-gradient(900px 500px at 10% 0%, rgba(225, 36, 44, .18) 0%, transparent 60%), #000;
  color: var(--text);
}
html:has(.login-screen:not(.hidden)), body:has(.login-screen:not(.hidden)) { background: #000; color-scheme: dark; }
.login-screen .login-box { border-color: #222226; box-shadow: 0 16px 50px rgba(0, 0, 0, .8); }
.login-screen input:focus { outline-color: #e1242c; border-color: #e1242c; background: #0b0b0c; }

.login-box {
  width: 100%;
  max-width: 410px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.login-brand h1 { margin: 0; font-size: 19px; }
.login-brand p { margin: 2px 0 0; color: var(--text-dim); font-size: 12.5px; }

.login-logo {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; letter-spacing: .5px;
  flex: none;
}
.login-logo.small { width: 34px; height: 34px; border-radius: 11px; font-size: 12px; }

.login-hint { margin: 0; font-size: 12px; color: var(--text-dim); }

/* ---------------------------------------------------------------- Formular */

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.field > span { color: var(--text-dim); font-weight: 600; }
/* Passwortfeld mit Knopf „Anzeigen/Verbergen“ */
.field > span.pw-feld { position: relative; display: block; color: inherit; font-weight: 400; }
.pw-feld input { width: 100%; padding-right: 96px; box-sizing: border-box; }
.pw-auge { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent;
  color: var(--brand); font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 8px; cursor: pointer; border-radius: 8px; }
.pw-auge:hover { background: var(--brand-soft); }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  width: 100%;
  min-width: 0;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  border-color: var(--brand);
}
input[readonly], input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-2);
  color: var(--text-dim);
}
textarea { min-height: 74px; resize: vertical; }
input[type="checkbox"] { width: auto; min-width: 0; accent-color: var(--brand); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 13px;
}
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }

/* ----------------------------------------------------------------- Buttons */

.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-dim); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--brand); border-color: var(--brand); color: var(--brand-ink);
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-accent {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-income { background: var(--good); border-color: var(--good); color: #fff; }
.btn-expense, .btn-danger {
  background: var(--bad); border-color: var(--bad); color: #fff;
}
.btn-danger:hover { filter: brightness(.94); background: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.icon-btn { padding: 7px 10px; font-size: 16px; border-radius: 12px; }


/* ----------------------------------------------------------------- Layout */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px 14px;
}
.sidebar-brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.sidebar-brand span { font-size: 11.5px; color: var(--text-dim); }

/* Schnellsuche: tippen, Enter, sofort auf der Seite */
.nav-search { padding: 2px 12px 4px; }
.nav-search input {
  width: 100%; box-sizing: border-box; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 13.5px;
}
.nav-search input::placeholder { color: var(--text-dim); }
.nav-search input:focus {
  outline: none; border-color: var(--brand);
  background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft);
}

.nav-results { padding: 4px 0; }
.nav-result {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 13px; margin-bottom: 2px;
  color: var(--text); text-decoration: none; font-size: 13.5px;
}
.nav-result:hover, .nav-result.first {
  background: var(--brand-soft); color: var(--brand);
}
.nav-result .nav-icon {
  width: 26px; height: 26px; flex: none; border-radius: 9px;
  display: grid; place-items: center; font-size: 13px;
  background: var(--surface-2); color: var(--text-dim);
}
.nav-result.first .nav-icon, .nav-result:hover .nav-icon {
  background: var(--brand); color: var(--brand-ink);
}
.nav-result-label { font-weight: 550; }
.nav-result-area {
  margin-left: auto; font-size: 10.5px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .05em;
}
.nav-empty { padding: 16px 12px; font-size: 12.5px; color: var(--text-dim); }

.nav { padding: 6px 12px 12px; overflow-y: auto; flex: 1; }
/* Aufklappbare Rollenbereiche */
.nav-section {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 10px 11px; margin-top: 4px; border: none; border-radius: 13px;
  background: transparent; font: inherit; font-size: 11px; font-weight: 800;
  letter-spacing: .09em; text-transform: uppercase; color: var(--text-dim);
  cursor: pointer; text-align: left;
}
.nav-section:hover { background: var(--surface-2); color: var(--text); }
.nav-section.current { color: var(--brand); }
.nav-section .nav-count {
  margin-left: auto; font-size: 10.5px; letter-spacing: 0;
  background: var(--surface-2); border-radius: 999px; padding: 1px 8px;
  font-weight: 700;
}
.nav-section .chev {
  font-size: 15px; line-height: 1; transition: transform .16s ease;
  color: var(--text-dim);
}
.nav-section.open .chev { transform: rotate(90deg); }
.nav-items { padding: 2px 0 6px; }
.nav-group {
  font-size: 11.5px; color: var(--text-dim); padding: 12px 12px 4px; font-weight: 700;
}
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 13px; margin-bottom: 2px;
  color: var(--text); text-decoration: none; font-size: 13.5px; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active {
  background: var(--brand-soft); color: var(--brand); font-weight: 650;
}
.nav .nav-icon {
  width: 26px; height: 26px; flex: none; border-radius: 9px;
  display: grid; place-items: center; font-size: 13px;
  background: var(--surface-2); color: var(--text-dim);
}
.nav a.active .nav-icon { background: var(--brand); color: var(--brand-ink); }
.nav .nav-count {
  margin-left: auto; font-size: 11px; background: var(--surface-2);
  border-radius: 999px; padding: 1px 8px;
}
.sidebar-foot {
  margin: 10px 12px 14px;
  padding: 14px;
  border-radius: 16px;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 11.5px;
  line-height: 1.5;
  opacity: .95;
}
.sidebar-foot a { color: var(--brand-ink); font-weight: 700;
  text-decoration: underline; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px;
  background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { margin: 0; font-size: 19px; font-weight: 650; }
.page-head { min-width: 0; }
.page-hint { margin: 2px 0 0; font-size: 13px; color: var(--text-dim); }
.page-hint:empty { display: none; }

/* CARE-Upgrade-Auftrag (intern, vom Techniker) – sofort erkennbar */
.badge-care { background: rgba(245,158,11,.16); color: #d97706; font-weight: 700; }
.chip-care { border-color: #f59e0b !important; color: #b45309 !important; }
.chip-care.active { background: #f59e0b !important; color: #fff !important; }
.care-auftrag { border: 2px solid #f59e0b; overflow: hidden; }
.care-auftrag-kopf { background: rgba(245,158,11,.14); color: var(--text); padding: 14px 18px; font-size: 13px; }
.care-auftrag-titel { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.care-auftrag-wunsch { display: flex; gap: 12px; padding: 10px 12px; border-radius: 12px;
  background: var(--surface-2); margin-bottom: 12px; }
.care-schritte { display: flex; flex-wrap: wrap; gap: 6px; }
.care-schritt { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2);
  color: var(--text-dim); font-weight: 600; }
.care-schritt.fertig { background: var(--good-soft); color: var(--good); }

/* CARE: drei große Kacheln beim Kartenscan (Techniker) */
.abo-kacheln { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0; }
.abo-kachel {
  border-radius: var(--radius); padding: 14px 16px; text-align: center;
  background: var(--good-soft); color: var(--good); border: 2px solid var(--good);
}
.abo-kachel.leer { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.abo-kachel-name { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.abo-kachel-wert { font-size: 28px; font-weight: 800; margin: 4px 0; }
.abo-kachel-unten { font-size: 12.5px; font-weight: 600; }
@media (max-width: 700px) { .abo-kacheln { grid-template-columns: 1fr; } }

/* Große Schrift (Knopf oben rechts, gilt pro Gerät) */
html.gross { zoom: 1.15; }

/* Startseite: große Knöpfe */
.start-gruss { margin: 6px 0 16px; }
.start-gruss h2 { margin: 0; font-size: 22px; }
.start-gruss p { margin: 2px 0 0; color: var(--text-dim); }
.start-titel { margin: 22px 0 10px; font-size: 16px; }
.start-aufgaben li { font-size: 14.5px; padding-top: 12px; padding-bottom: 12px; }
.start-kacheln {
  display: grid; gap: 12px; margin-bottom: 8px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.start-kachel {
  display: flex; align-items: flex-start; gap: 14px; text-align: left;
  padding: 18px; min-height: 92px; cursor: pointer; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.start-kachel:hover { border-color: var(--brand); }
.start-kachel:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.start-kachel-icon {
  flex: none; width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; font-size: 22px;
  background: var(--brand-soft); color: var(--brand);
}
.start-kachel-text strong { display: block; font-size: 16px; margin-bottom: 3px; }
.start-kachel-text small { display: block; font-size: 13px; color: var(--text-dim); line-height: 1.4; }
.start-kachel.haupt { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.start-kachel.haupt .start-kachel-icon { background: rgba(255,255,255,.2); color: inherit; }
.start-kachel.haupt small { color: inherit; opacity: .85; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
#menu-toggle { display: none; }
.user-chip {
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px;
}
.user-name { font-size: 13px; font-weight: 650; }

.content { padding: 4px 22px 26px; flex: 1; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 40; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .18s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  #menu-toggle { display: inline-flex; }
  .content { padding: 4px 14px 20px; }
  .topbar { padding: 12px 14px; }
  .topbar-right .btn { display: none; }
  .form-grid .span-2 { grid-column: span 1; }
}

/* ------------------------------------------------------------------ Karten */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 16px 18px 12px;
}
.card-head h3 { margin: 0; font-size: 15.5px; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 0 18px 18px; }
.card-body.tight { padding: 0; }
.card > .card-body:first-child { padding-top: 18px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  position: relative;
}
.stat .stat-label { font-size: 12.5px; color: var(--text-dim); font-weight: 500; }
.stat .stat-value {
  font-size: 25px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em;
}
.stat .stat-hint { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }
.stat.tone-good { background: var(--brand); border-color: var(--brand); }
.stat.tone-good .stat-label, .stat.tone-good .stat-hint {
  color: var(--brand-ink); opacity: .75; }
.stat.tone-good .stat-value { color: var(--brand-ink); }
.stat.tone-warn .stat-value { color: var(--warn); }
.stat.tone-bad .stat-value { color: var(--bad); }
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { border-color: var(--text-dim); }

/* ------------------------------------------------------------------ Tabelle */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td {
  padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data th {
  background: var(--surface);
  color: var(--text-dim);
  font-weight: 600; font-size: 11px; white-space: nowrap;
  text-transform: uppercase; letter-spacing: .06em;
  position: sticky; top: 0;
}
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num {
  text-align: right; font-variant-numeric: tabular-nums;
}
table.data td.actions { text-align: right; white-space: nowrap; }
table.data tfoot td {
  font-weight: 650; background: var(--surface-2); border-bottom: none;
}
table.data .muted { color: var(--text-dim); }
.row-bad { background: var(--bad-soft) !important; }
/* bereits verbuchte Rate: zurueckgenommen, damit die offenen auffallen */
.row-done { opacity: .62; }
.row-warn { background: var(--warn-soft) !important; }

.empty {
  padding: 36px 16px; text-align: center; color: var(--text-dim); font-size: 13px;
}

/* ------------------------------------------------------------------ Badges */

.badge {
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-dim);
}
.badge-good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge-info { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badge-role { background: var(--accent); color: #fff; border-color: transparent; }

/* ------------------------------------------------------------- Werkzeugbar */

.toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .spacer { margin-left: auto; }
.toolbar input[type="search"], .toolbar input[type="text"] {
  max-width: 280px; border-radius: 999px; background: var(--surface);
}
.toolbar select, .toolbar input[type="date"], .toolbar input[type="number"] {
  width: auto; border-radius: 999px; background: var(--surface);
}
.filter-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: 999px; padding: 6px 14px; font-size: 12.5px; cursor: pointer;
  font-weight: 500;
}
.chip:hover { background: var(--surface-2); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ------------------------------------------------------------------- Alerts */

.alert {
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px;
  border: 1px solid transparent;
}
.alert-bad { background: var(--bad-soft); color: var(--bad); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-good { background: var(--good-soft); color: var(--good); }
.alert-info { background: var(--brand-soft); color: var(--brand); }

/* ------------------------------------------------------------------- Toasts */

.toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 100;
  display: flex; flex-direction: column; gap: 9px; max-width: 360px;
}
.toast {
  background: var(--brand); color: var(--brand-ink); border-radius: 14px;
  padding: 12px 16px; box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500; animation: slidein .16s ease;
}
.toast.good { background: var(--good); color: #fff; font-weight: 650; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------------- Modal */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(12, 24, 17, .45);
  backdrop-filter: blur(2px);
  display: grid; place-items: start center; z-index: 90; overflow-y: auto;
  padding: 28px 14px;
}
.modal {
  background: var(--surface); border-radius: 22px; border: 1px solid var(--border);
  width: 100%; max-width: 640px; box-shadow: var(--shadow-lg);
  animation: popin .15s ease;
}
.modal.wide { max-width: 1000px; }
@keyframes popin { from { opacity: 0; transform: translateY(-8px) scale(.99); } }
.modal-head {
  padding: 18px 20px 14px;
  display: flex; align-items: center; gap: 10px;
}
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head .spacer { margin-left: auto; }
.modal-body { padding: 0 20px 20px; max-height: calc(100vh - 230px); overflow-y: auto; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
}
.modal-foot .spacer { margin-right: auto; }

/* ---------------------------------------------------------------- Detailsicht */

.detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px; align-items: start;
}
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 7px 12px; font-size: 13px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; font-weight: 500; }

.tabs {
  display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px; width: fit-content; max-width: 100%;
}
.tabs button {
  border: none; background: none; font: inherit; cursor: pointer;
  padding: 8px 16px; color: var(--text-dim); border-radius: 999px;
  font-weight: 600; font-size: 13px;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { background: var(--brand); color: #fff; }

.pager {
  display: flex; align-items: center; gap: 10px; justify-content: flex-end;
  padding: 12px 16px; font-size: 12.5px; color: var(--text-dim);
}

.bar {
  height: 7px; background: var(--surface-2); border-radius: 999px;
  overflow: hidden; min-width: 60px;
}
.bar > span { display: block; height: 100%; background: var(--brand);
  border-radius: 999px; }

.spark { display: flex; align-items: flex-end; gap: 6px; height: 110px; }
.spark-col {
  flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center; gap: 6px; min-width: 0;
}
.spark-col .bar-v {
  width: 100%; background: var(--chart-income); border-radius: 7px 7px 4px 4px;
  min-height: 3px;
}
.spark-col:nth-child(even) .bar-v { background: var(--chart-expense); }
.spark-col .lbl { font-size: 10px; color: var(--text-dim); white-space: nowrap; }

.loading { padding: 38px; text-align: center; color: var(--text-dim); }

.task-list { list-style: none; margin: 0; padding: 0; }
.task-list li {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.task-list li:last-child { border-bottom: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--brand); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.item-table input, .item-table select { padding: 6px 9px; font-size: 12.5px;
  border-radius: 9px; }
.item-table td { padding: 6px 8px; }
.item-table th { padding: 8px; }

.print-only { display: none; }

/* ------------------------------------------------------- Einkaufskorb */

.korb-titel {
  margin: 16px 0 8px; font-size: 13px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-dim);
}
.korb-titel:first-child { margin-top: 0; }
.korb-raster {
  display: grid; gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.korb-zeile {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px; cursor: text;
}
.korb-menge { width: 64px; text-align: right; }
.korb-name { display: block; font-size: 13px; }
.korb-klein { font-size: 11.5px; color: var(--text-dim); }

/* Kopf der Bestellliste: links der Auftrag, rechts die Summe */
.sheet-head {
  display: flex; align-items: flex-start; gap: 16px;
  padding-bottom: 10px; margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.sheet-head > div:first-child { flex: 1; }

@media print {
  .sidebar, .topbar, .toolbar, .modal-head, .modal-foot, .toasts,
  .no-print { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border: none; }
  .modal-backdrop { position: static; background: none; padding: 0; overflow: visible; }
  .modal { max-width: none; box-shadow: none; border: none; }
  .modal-body { max-height: none; overflow: visible; }
  .print-only { display: block; }
  body { background: #fff; }
}



/* ------------------------------------------------ Einkaufsregeln */

.rule-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
}
.rule-grid .field.span-all { grid-column: 1 / -1; }
.rule-grid label {
  display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 4px;
}
.rule-grid input, .rule-grid select, .rule-grid textarea {
  width: 100%; box-sizing: border-box;
}
@media (max-width: 760px) { .rule-grid { grid-template-columns: 1fr; } }

/* --------------------------------------------------- PC-Konfigurator */

.config-wrap {
  display: grid; grid-template-columns: 1fr 320px; gap: 20px;
  align-items: start;
}
.config-head { margin: 0 0 12px; }
.config-grid { display: grid; gap: 12px; }
.config-grid .field label, .config-wrap .field label {
  display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 4px;
}
.config-wrap .field { margin-bottom: 12px; }
.config-wrap .field select, .config-wrap .field input {
  width: 100%; box-sizing: border-box;
}
.config-wrap .req { color: var(--bad); }
.field-hint { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }
.field-hint.bad { color: var(--bad); }

.config-summary {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; position: sticky; top: 12px;
}
.config-sum-head {
  font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--text-dim); margin: 10px 0 6px;
}
.config-sum-head:first-child { margin-top: 0; }
.config-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; padding: 3px 0; font-size: 13px;
}
.config-row small { color: var(--text-dim); font-size: 11px; }
.config-row.dim, .config-row.dim strong { color: var(--text-dim);
  font-weight: 400; }
.config-row.big strong { font-size: 20px; }
.config-row.good strong { color: var(--good); }
.config-row.bad strong { color: var(--bad); }
/* ------------------------------------------- Barcode-Etikett (Karton) */

.bc-sheet { display: flex; justify-content: center; padding: 10px 0; }
.bc-label {
  background: #fff; color: #000; width: 90mm; padding: 6mm 6mm 5mm;
  border: 1px solid var(--line); border-radius: 6px; text-align: center;
  font-family: Arial, Helvetica, sans-serif;
}
.bc-name { font-size: 11pt; font-weight: 700; margin-bottom: 3mm;
  line-height: 1.25; }
.bc-svg { width: 100%; }
.bc-code { font-size: 13pt; letter-spacing: 2px; margin-top: 2mm;
  font-weight: 700; }
.bc-unit { font-size: 9pt; color: #333; margin-top: 1mm; }

@media print {
  .bc-label { border: none; border-radius: 0; width: 90mm; }
}

/* Kompatibilitätsprüfung über der Auswahl */
.config-checks { margin-bottom: 12px; display: grid; gap: 6px; }
.config-check {
  font-size: 12.5px; padding: 7px 10px; border-radius: 8px;
  border-left: 3px solid var(--line); background: var(--surface-2);
}
.config-check.good { border-left-color: var(--good); color: var(--good); }
.config-check.fehler { border-left-color: var(--bad); color: var(--bad);
  background: var(--bad-soft); font-weight: 600; }
.config-check.warnung { border-left-color: var(--warn); }
.config-check.hinweis { color: var(--text-dim); }

.config-parts {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-dim);
}

@media (max-width: 900px) {
  .config-wrap { grid-template-columns: 1fr; }
  .config-summary { position: static; }
}

/* ------------------------------------------------- Shop-Vorschau je Artikel */

.shop-thumb {
  width: 52px; height: 52px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2);
}
.shop-thumb-leer {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 18px;
}

.shop-preview h3 {
  margin: 18px 0 8px; font-size: 13px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-dim);
}
.shop-head { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.shop-title { margin: 0 0 6px; font-size: 20px; }
.shop-meta {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  font-size: 12px; color: var(--text-dim);
}
.shop-checks { display: grid; gap: 6px; margin-top: 12px; }
.shop-checks .alert { margin: 0; }

.shop-gallery {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.shop-image {
  width: 150px; height: 150px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2);
}

.shop-desc {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background: var(--surface-2); max-height: 320px; overflow: auto;
  font-size: 13.5px; line-height: 1.55;
}
.shop-desc img { max-width: 100%; height: auto; border-radius: 8px; }
.shop-desc table { width: 100%; border-collapse: collapse; }
.shop-desc td, .shop-desc th {
  border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left;
}
.shop-desc :last-child { margin-bottom: 0; }

.shop-foot { margin-top: 18px; padding-top: 12px;
  border-top: 1px solid var(--line); }

@media (max-width: 700px) {
  .shop-image { width: 112px; height: 112px; }
}

/* ------------------------------------------- Artikel zusammenstellen */

.calc-note {
  font-size: 12px; color: var(--text-dim); margin: -4px 0 12px;
}
.compose-card { margin-bottom: 14px; }
.compose-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
}
.compose-head > div:first-child { flex: 1; }

.compose-grid { display: grid; gap: 8px; }
.compose-row {
  display: grid; gap: 8px; align-items: center;
  grid-template-columns: 190px 1fr 90px 36px;
}
.compose-row select, .compose-row input { width: 100%; }
.compose-qty { text-align: right; }

.compose-actions {
  display: flex; align-items: center; gap: 8px; margin-top: 14px;
}
.compose-actions .spacer { flex: 1; }

.compose-result {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
}
.compose-preview {
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  background: var(--surface);
}
.compose-preview .shop-desc { max-height: none; }

.compose-bild { position: relative; }
.compose-bild-weg {
  position: absolute; top: 4px; right: 4px; padding: 0 7px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; line-height: 1.6;
}

@media (max-width: 760px) {
  .compose-row { grid-template-columns: 1fr 70px 36px; }
  .compose-row select { grid-column: 1 / -1; }
}

/* --------------------------------- Rechnungsdruck (A4, DIN 5008 Form B)

   Maße nach DIN 5008 Form B – passt in einen DIN-lang-Fensterumschlag
   (Fenster links), zweimal gefalzt (Wickelfalz in drei Teile):
   - Seitenränder 25 mm links, 20 mm rechts, 20 mm oben und unten
   - Anschriftfeld beginnt 45 mm von oben und 20 mm vom linken Blattrand,
     85 x 45 mm (Rücksendezeile + Anschrift) – genau hinter dem Fenster
   - Informationsblock rechts daneben
   - Falzmarken bei 105 mm und 210 mm, Lochmarke bei 148,5 mm
   Bewusst ohne durchgezogene Trennlinien: gegliedert wird über Abstände. */

.invoice-sheet {
  background: #fff; color: #000; width: 100%; max-width: 760px;
  margin: 0 auto; padding: 0;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 10pt; line-height: 1.38;
  display: flex; flex-direction: column; min-height: 940px;
  position: relative;
}

/* Briefkopf: Logo oben rechts, endet vor dem Anschriftfeld */
.inv-head { height: 25mm; display: flex; align-items: flex-start;
  justify-content: flex-end; }
.inv-logo { width: 52mm; height: auto; }
.inv-brand-main {
  font-size: 26pt; font-weight: 700; letter-spacing: 3px; line-height: 1;
}
.inv-brand-main .inv-dash, .inv-brand-main .inv-tec { color: #d0021b; }
.inv-brand-sub { font-size: 10pt; letter-spacing: 7px; margin-top: 3px; }

/* Anschriftfeld (85 x 45 mm) und Informationsblock nebeneinander */
.inv-address-row {
  display: flex; justify-content: space-between; gap: 10mm;
  align-items: flex-start;
}
.inv-address { width: 85mm; min-height: 45mm; }
@media print { .inv-address { margin-left: -5mm; } }
.inv-sender {
  font-size: 7pt; padding-bottom: 1mm; margin-bottom: 2mm;
  color: #333;
}
.inv-recipient { line-height: 1.45; }

/* Informationsblock rechts: Datum, Nummern, Ansprechpartner */
.inv-info { font-size: 9.5pt; min-width: 62mm; }
.inv-info div { display: flex; justify-content: space-between; gap: 6mm; }
.inv-info span:first-child { color: #333; }
.inv-info span:last-child { text-align: right; }

/* Betreffzeile: fett, kein Wort "Betreff", danach eine Leerzeile */
.inv-subject { font-weight: 700; margin: 7mm 0 3mm; font-size: 11pt; }
.inv-intro { margin-bottom: 3mm; }

/* Positionen: nur eine zarte Linie unter der Kopfzeile */
.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 4mm; }
.inv-table thead th {
  border-bottom: .5pt solid #999;
  padding: 0 2mm 1.5mm 0; text-align: left; font-weight: 700;
  font-size: 10pt;
}
.inv-table tbody td { padding: 2.5mm 2mm 0 0; vertical-align: top; }
.inv-table tbody tr:first-child td { padding-top: 3mm; }
.inv-table .inv-pos { width: 10mm; }
.inv-table .inv-qty { width: 22mm; white-space: nowrap; }
.inv-table .inv-num { text-align: right; width: 28mm; white-space: nowrap;
  padding-right: 0; }
.inv-item-title { font-weight: 700; }
.inv-item-lines { font-size: 9pt; line-height: 1.45; margin-top: 1mm;
  color: #222; }

/* Beträge: rechtsbündig, ohne Rahmen, Summe nur durch Fettung abgesetzt */
.inv-totals-wrap { display: flex; justify-content: flex-end; margin-top: 5mm; }
.inv-totals { border-collapse: collapse; min-width: 72mm; }
.inv-totals td { padding: .6mm 0; }
.inv-totals td.inv-num { text-align: right; padding-left: 8mm;
  white-space: nowrap; }
.inv-totals .inv-sum td { font-weight: 700; padding-top: 2mm; }
.inv-totals .inv-sum td:first-child { padding-right: 4mm; }

.inv-notes { margin-top: 5mm; font-size: 9pt; }
.inv-notes p { margin: 0 0 2mm; }
.inv-thanks { margin-top: 5mm; }
.inv-thanks .inv-tec { color: #d0021b; font-weight: 700; }
.inv-thanks .inv-re { font-weight: 700; }
.inv-payment { font-weight: 700; margin-top: 3mm; }
.inv-cancelled {
  margin-top: 5mm; font-weight: 700; color: #d0021b; letter-spacing: 2px;
}

/* Fußzeile mit der roten Linie darüber – das Kennzeichen der RE-TEC-Rechnung */
.inv-foot {
  display: flex; justify-content: space-between; gap: 8mm;
  margin-top: auto; padding-top: 2mm;
  border-top: 2.2pt solid #d0021b;
  font-size: 7.5pt; line-height: 1.4; color: #222;
  break-inside: avoid; page-break-inside: avoid;
}
.inv-foot > div { padding-top: 1mm; }
.inv-foot-right { text-align: right; }

/* Falz- und Lochmarken (DIN 5008) – nur auf Papier sinnvoll */
.inv-marks { display: none; }

/* Vorschau im Rechnungsdetail: das Blatt so, wie es auf Papier aussieht */
.invoice-preview {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 26px 30px; overflow: auto;
}
.invoice-preview .invoice-sheet { max-width: 700px; }

/* Beim Drucken wird nur dieses Blatt ausgegeben, nie die Oberflaeche */
#print-area { display: none; }

@media print {
  /* DIN 5008 Form B: links 25 mm, rechts 20 mm, oben 20 mm, unten 20 mm.
     297 mm - 40 mm = 257 mm Satzspiegel in der Höhe. */
  /* Links nur 20 mm Seitenrand: das Anschriftfeld beginnt dort (Fenster),
     der übrige Text rückt über 5 mm Innenabstand auf die 25 mm ein. */
  @page { size: A4; margin: 20mm 20mm 20mm 20mm; }
  .invoice-sheet {
    max-width: none; padding: 0 0 0 5mm; box-sizing: border-box; font-size: 10pt; min-height: 252mm;
    /* Verkleinerung, falls der Inhalt sonst nicht auf eine Seite passt */
    transform: scale(var(--inv-scale, 1)); transform-origin: top left;
    width: calc(100% / var(--inv-scale, 1));
  }
  .inv-brand-main { font-size: 24pt; }
  .inv-logo { width: 52mm; }
  .invoice-preview { border: none; padding: 0; overflow: visible; }

  /* Falzmarken bei 105 mm und 210 mm, Lochmarke bei 148,5 mm – gemessen
     vom oberen Blattrand, deshalb gegen den Seitenrand (20 mm) verrechnet. */
  .inv-marks { display: block !important; }
  .inv-marks i {
    position: fixed; left: -12mm; width: 5mm; height: 0;
    border-top: .4pt solid #666;
  }
  .inv-marks i.fold1 { top: 85mm; }
  .inv-marks i.fold2 { top: 190mm; }
  .inv-marks i.punch { top: 128.5mm; width: 8mm; }

  body.print-invoice .app,
  body.print-invoice .modal-backdrop { display: none !important; }
  body.print-invoice #print-area { display: block !important; }
}

/* ---------------------------------------------------- CARE Monitor ---- */
/* Diagrammfarben (geprüfte Standardpalette, feste Reihenfolge):
   CPU = Slot 1 blau, GPU = Slot 2 orange, Hotspot = Slot 3 türkis */
:root { --care-cpu: #2a78d6; --care-gpu: #eb6834; --care-hot: #1baf7a; }
:root[data-theme$="-dunkel"], :root[data-theme="schwarz"] { --care-cpu: #3987e5; --care-gpu: #d95926; --care-hot: #199e70; }
.care-grid { display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.care-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.care-card h4 { margin: 0; font-size: 15px; }
/* Kalender: jeder Tag ein deutlich abgegrenzter Kasten mit farbigem Kopf */
.care-card.kal-tag { padding: 0; overflow: hidden; border: 2px solid var(--border-strong);
  border-top: 4px solid var(--brand); align-self: start; }
.kal-tag .kal-kopf { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--brand-soft); border-bottom: 1px solid var(--border-strong); }
.kal-anzahl { font-size: 12px; font-weight: 600; color: var(--brand); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.kal-tag .kal-inhalt { padding: 10px 16px 14px; }
.kal-tag .kal-frei { margin-top: 6px; }
.care-card.kal-tag.kal-heute { border-color: var(--accent); border-top-color: var(--accent); }
.kal-heute .kal-kopf { background: var(--accent-soft); }
.care-sub { font-size: 12px; color: var(--text-dim); }
.care-werte { display: flex; gap: 16px; margin: 10px 0 6px; flex-wrap: wrap; }
.care-wert { min-width: 82px; }
.care-wert .zahl { font-size: 22px; font-weight: 700; color: var(--text); }
.care-wert .name { font-size: 11.5px; color: var(--text-dim); display: flex;
  align-items: center; gap: 6px; }
.care-punkt { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.care-status { font-size: 11.5px; font-weight: 600; }
.care-chart { position: relative; }
.care-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.care-chart .gitter { stroke: var(--border); stroke-width: 1; }
.care-chart .achse { fill: var(--text-dim); font-size: 10px; }
.care-chart .linie { fill: none; stroke-width: 2; stroke-linejoin: round;
  stroke-linecap: round; }
.care-chart .etikett { font-size: 11px; fill: var(--text); }
.care-chart .fadenkreuz { stroke: var(--text-dim); stroke-width: 1;
  stroke-dasharray: 3 3; }
.care-chart .pause { stroke: var(--border-strong); stroke-width: 1;
  stroke-dasharray: 2 4; }
.care-geraet { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 8px; }
/* Tagesroute: Karte 2/3, Termine 1/3 daneben (schmal: untereinander) */
.tour-zeile { display: flex; gap: 16px; align-items: stretch; }
.tour-karte { flex: 2 1 0; min-width: 0; height: 66vh; min-height: 420px; border-radius: 12px;
  overflow: hidden; border: 1px solid var(--border); background: var(--bg);
  position: relative; z-index: 0; }   /* eigene Ebene: Leaflet bleibt unter Dialogen/Menü */
.tour-liste { flex: 1 1 0; min-width: 0; max-height: 66vh; overflow-y: auto; padding-right: 4px; }
.tour-liste > .care-geraet:first-child { border-top: none; margin-top: 0; padding-top: 0; }
@media (max-width: 1000px) {
  .tour-zeile { flex-direction: column; }
  .tour-karte { flex: none; height: 55vh; }
  .tour-liste { max-height: none; }
}
.care-tip { position: absolute; pointer-events: none; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 9px;
  font-size: 12px; box-shadow: var(--shadow-lg); white-space: nowrap;
  color: var(--text); z-index: 5; }

.care-score { width: 64px; height: 64px; border-radius: 50%; border: 6px solid var(--text-dim);
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700;
  flex: none; }
.care-antwort { border-left: 3px solid var(--care-cpu); padding: 6px 10px;
  margin-bottom: 10px; background: var(--surface-2, rgba(127,127,127,.08));
  border-radius: 0 6px 6px 0; }

/* Glocke: Nachrichten aus der CARE-App */
.glocke { position: relative; font-size: 17px; }
.glocke-zahl { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.glocke-neu { animation: glocke-wackeln 1.6s ease-in-out 2; }
@keyframes glocke-wackeln { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(14deg); }
  40% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) { .glocke-neu { animation: none; } }

/* ---- CARE-Chat (wie in My CARE): weißer Hintergrund, Nachrichten des
   Kunden (Empfänger) rot links, eigene (RE-TEC) grau rechts – auch im dunklen Design ---- */
.chat-verlauf { display: flex; flex-direction: column; gap: 6px; height: 56vh; overflow-y: auto;
  padding: 12px; border-radius: 10px; background: #ffffff; border: 1px solid #e3e5ea; }
.chat-blase { max-width: 68%; padding: 6px 10px 18px; border-radius: 12px; position: relative;
  white-space: pre-wrap; word-wrap: break-word; min-width: 80px; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.chat-blase.wir { align-self: flex-end; background: #e9eaee; color: #1f2328; border-bottom-right-radius: 4px; }
.chat-blase.kunde { align-self: flex-start; background: #e1242c; color: #ffffff; border-bottom-left-radius: 4px; }
.chat-name { font-size: 11.5px; font-weight: 700; color: #5b6170; margin-bottom: 2px; }
.chat-titel { font-size: 11.5px; font-weight: 700; margin-bottom: 2px; opacity: .85; }
.chat-zeit { position: absolute; right: 9px; bottom: 3px; font-size: 10.5px; opacity: .7; }
.chat-tag { align-self: center; font-size: 12px; padding: 2px 12px; border-radius: 8px;
  background: #f1f2f5; color: #5b6170; margin: 6px 0; }
.chat-leer { margin: auto; color: #5b6170; }
.chat-eingabe { display: flex; gap: 8px; margin-top: 10px; align-items: stretch; }
.chat-eingabe textarea { flex: 1; resize: none; }

/* ---- Roter Punkt am Menüpunkt (Unklarheiten, z. B. Bankabgleich) ---- */
.nav-rot { position: relative; }
.nav-rot::after { content: ""; position: absolute; right: 10px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px;
  border-radius: 50%; background: #e1242c; box-shadow: 0 0 0 2px rgba(225, 36, 44, .25); }
.nav-section.nav-rot::after { right: 30px; }

/* ---- Bankabgleich (Konto) ---- */
.bank-schalter { width: 44px; height: 24px; border-radius: 12px; border: none; background: #c4c8d0; position: relative;
  cursor: pointer; transition: background .15s; padding: 0; }
.bank-schalter.an { background: #1a9e55; }
.bank-schalter:disabled { cursor: not-allowed; opacity: .6; }
.bank-schalter-knopf { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.bank-schalter.an .bank-schalter-knopf { left: 23px; }
.bank-rot { border: 2px solid #e1242c; background: rgba(225, 36, 44, .07); color: #b3141b; border-radius: 12px;
  padding: 10px 14px; margin-bottom: 14px; }
.bank-rot-zeile { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid rgba(225, 36, 44, .2); }
.bank-rot-zeile div { white-space: normal; }
.bank-rot-zeit { font-size: 12px; opacity: .75; }
.bank-reiter { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.bank-reiter button { border: none; background: none; padding: 8px 12px; font: inherit; font-weight: 600; color: var(--text-dim);
  cursor: pointer; border-bottom: 2px solid transparent; }
.bank-reiter button.aktiv { color: var(--text); border-bottom-color: #e1242c; }
.bank-regel { display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: 12px; align-items: center; padding: 8px 0;
  border-bottom: 1px solid var(--border); }
.bank-regel-titel { font-weight: 600; }
.bank-regel-titel .care-sub { font-weight: 400; white-space: normal; }

/* ---- Postfach an der Glocke: Kacheln ---- */
.pf-kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; margin-bottom: 14px; }
.pf-kachel { text-align: left; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--border);
  background: var(--surface); cursor: pointer; color: var(--text); font: inherit; }
.pf-kachel:hover { border-color: var(--text-dim); }
.pf-kachel.aktiv { border-color: #e1242c; }
.pf-kachel .pf-zahl { font-size: 26px; font-weight: 800; line-height: 1.1; }
.pf-kachel .pf-name { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.pf-kachel.rot .pf-zahl { color: #e1242c; }
.pf-zeile { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); margin-bottom: 8px; cursor: pointer; background: var(--surface); }
.pf-zeile:hover { border-color: var(--text-dim); }
.pf-zeile .pf-text { flex: 1; min-width: 0; }
.pf-zeile .pf-vorschau { color: var(--text-dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-punkt { width: 10px; height: 10px; border-radius: 50%; flex: none; background: #c4c8d0; }
.pf-punkt.neu { background: #e1242c; } .pf-punkt.unbeantwortet { background: #f0a020; }

/* ---- CARE-Kunden (wie Techniker-App) (Abo-Kacheln + Ampel) ---- */
.ck-kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.ck-kachel { text-align: left; background: var(--surface); border: 2px solid var(--border); border-radius: 16px;
  padding: 14px; color: var(--text); font: inherit; cursor: pointer; }
.ck-kachel:active { transform: scale(.98); }
.ck-500 { border-color: #d4a017; box-shadow: 0 0 0 1px rgba(212,160,23,.35), 0 4px 14px rgba(212,160,23,.18); }
.ck-350 { border-color: #e0242c; box-shadow: 0 0 0 1px rgba(224,36,44,.25); }
.ck-name { font-weight: 800; font-size: 17px; }
.ck-500 .ck-name { color: #c99412; }
.ck-350 .ck-name { color: #e0242c; }
.ck-zahl { font-size: 26px; font-weight: 800; margin: 6px 0 2px; }
.ck-zahl span { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.ck-gemeldet { font-size: 13px; font-weight: 700; color: var(--text-dim); }
.ck-gemeldet.ja { color: #e0242c; }
.ck-legende { font-size: 12.5px; color: var(--text-dim); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ck-500-rahmen { border: 2px solid #d4a017; }
.ck-350-rahmen { border: 2px solid #e0242c; }
.ck-zeile { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; background: none;
  border: 0; border-bottom: 1px solid var(--border); color: var(--text); font: inherit; cursor: pointer; }
.ck-zeile:last-child { border-bottom: 0; }
.ck-kname { font-weight: 650; }
.ck-grund { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ampel { display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex: none; }
.ampel-rot { background: #e0242c; box-shadow: 0 0 0 3px rgba(224,36,44,.2); }
.ampel-orange { background: #f08c00; box-shadow: 0 0 0 3px rgba(240,140,0,.2); }
.ampel-gruen { background: #1a9e3f; box-shadow: 0 0 0 3px rgba(26,158,63,.18); }
.ampel-grau { background: #8a919c; }
.ck-kacheln { grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 1300px; }
/* CARE Mobile (Laptops) */
.ck-mobil { border-style: dashed; }


/* ---- Menü: "Mehr anzeigen" (nur das Wichtigste sichtbar) ---- */
.nav-mehr { display: block; width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 650; color: var(--text-dim); padding: 8px 14px; border-radius: 8px; }
.nav-mehr:hover { background: var(--bg); color: var(--text); }
.start-mehr { display: block; margin: 18px 0 8px; }

/* Wareneingang: zu viel eingetragen */
input.is-invalid { border-color: var(--bad) !important; background: rgba(208, 59, 59, .08); }


/* Wareneingang: erwarteten Artikel anklicken, dann EAN scannen */
.wa-zeile { cursor: pointer; }
.wa-zeile:hover td { background: var(--bg); }
.wa-zeile.wa-aktiv td { background: rgba(31, 122, 224, .12); box-shadow: inset 0 0 0 0 transparent; }
.wa-zeile.wa-aktiv td:first-child { box-shadow: inset 4px 0 0 #1f7ae0; }

