/* ============================================================
   FIDUX – Oberfläche
   ============================================================ */

:root {
  --bg:        #080b12;
  --panel:     #0f1420;
  --panel-2:   #151c2b;
  --panel-3:   #1b2434;
  --line:      #212b3f;
  --line-soft: #1a2233;
  --text:      #e8eefb;
  --muted:     #8695b0;
  --muted-2:   #5e6d88;

  --brand:     #2563eb;
  --brand-2:   #22d3ee;
  --grad:      linear-gradient(135deg, #2563eb, #22d3ee);

  --steuer:    #22d3ee;
  --kredit:    #a78bfa;
  --mieter:    #34d399;

  --danger:    #f87171;
  --ok:        #34d399;
  --warn:      #fbbf24;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;

  --line-stark: #2c3950;
  --flaeche-hoch:        rgba(255, 255, 255, .06);
  --flaeche-hoch-hover:  rgba(255, 255, 255, .11);
  --flaeche-tief:        rgba(4, 7, 13, .35);
  --flaeche-tief-hover:  rgba(4, 7, 13, .5);
  --auth-karte: rgba(15, 20, 32, .82);
  --rollbalken: #222d42;
  --rollbalken-hover: #2f3c56;
  --auf-hell: 0;          /* 1 = heller Modus, für Bildumkehrungen */

  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .8);
  --sidebar-w: 248px;

  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ---------- Heller Modus ---------- */

:root[data-theme="hell"] {
  --bg:        #f2f5fa;
  --panel:     #ffffff;
  --panel-2:   #f1f4f9;
  --panel-3:   #e5eaf2;
  --line:      #d3dae6;
  --line-soft: #e6ebf2;
  --line-stark:#b6c1d3;
  --text:      #111a2b;
  --muted:     #5a6880;
  --muted-2:   #7d8ba3;

  --brand:     #1d4ed8;
  --brand-2:   #0e7490;
  --grad:      linear-gradient(135deg, #2563eb, #0891b2);

  --steuer:    #0e7490;
  --kredit:    #6d28d9;
  --mieter:    #047857;

  --danger:    #dc2626;
  --ok:        #047857;
  --warn:      #b45309;

  --flaeche-hoch:        rgba(17, 26, 43, .05);
  --flaeche-hoch-hover:  rgba(17, 26, 43, .1);
  --flaeche-tief:        rgba(17, 26, 43, .04);
  --flaeche-tief-hover:  rgba(17, 26, 43, .08);
  --auth-karte: rgba(255, 255, 255, .88);
  --rollbalken: #c6cedd;
  --rollbalken-hover: #aab5c9;
  --auf-hell: 1;

  --shadow: 0 16px 36px -18px rgba(17, 26, 43, .35);
}

/* Auf hellem Grund brauchen die farbigen Flächen dunkle Schrift bzw. Umkehrung */
:root[data-theme="hell"] .btn--primary { color: #fff; }
:root[data-theme="hell"] .chip.is-active,
:root[data-theme="hell"] .tagchip.is-active,
:root[data-theme="hell"] .wtag.is-today .wtag__kopf { color: #fff; }
:root[data-theme="hell"] .check input:checked::after { background: #fff; }
:root[data-theme="hell"] .tagchip.is-active .tagchip__punkt { background: #fff; color: var(--brand); }
:root[data-theme="hell"] .konv__team { color: #fff; }
:root[data-theme="hell"] input[type="date"]::-webkit-calendar-picker-indicator,
:root[data-theme="hell"] input[type="time"]::-webkit-calendar-picker-indicator { filter: none; }
:root[data-theme="hell"] .msg--error { color: #b91c1c; }
:root[data-theme="hell"] .msg--ok { color: #065f46; }
:root[data-theme="hell"] .avatar { color: #fff; }

/* ---------- Umschalter Sonne / Mond ---------- */

.modus {
  position: relative;
  flex: none;
  width: 58px;
  height: 30px;
  padding: 0;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  transition: background .2s, border-color .2s;
}
.modus:hover { border-color: var(--line-stark); }

.modus__knopf {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--grad);
  display: grid;
  place-items: center;
  transition: transform .28s cubic-bezier(.35, 1.5, .5, 1);
}
:root[data-theme="hell"] .modus__knopf { transform: translateX(28px); }

/* Der Knopf zeigt das Zeichen des gerade eingestellten Modus */
.modus__knopf svg {
  grid-area: 1 / 1;
  width: 14px;
  height: 14px;
  color: #04121f;
  transition: opacity .2s, transform .28s;
}
:root[data-theme="hell"] .modus__knopf svg { color: #fff; }

.modus__knopf .modus__sonne { opacity: 0; transform: rotate(-90deg); }
:root[data-theme="hell"] .modus__knopf .modus__mond  { opacity: 0; transform: rotate(90deg); }
:root[data-theme="hell"] .modus__knopf .modus__sonne { opacity: 1; transform: none; }

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-2); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--rollbalken); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--rollbalken-hover); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

[hidden] { display: none !important; }

/* ---------- Marke ---------- */

.brand { display: flex; align-items: center; gap: 11px; }
.brand__mark { width: 38px; height: 38px; border-radius: 11px; flex: none; }
.brand__name {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: .18em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand__sub { font-size: 11px; color: var(--muted-2); letter-spacing: .1em; text-transform: uppercase; margin-top: -3px; }

/* ============================================================
   Anmeldung
   ============================================================ */

#auth {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(900px 620px at 12% -10%, rgba(37, 99, 235, .30), transparent 62%),
    radial-gradient(760px 560px at 92% 108%, rgba(34, 211, 238, .22), transparent 60%),
    var(--bg);
}

.auth-card {
  width: min(430px, 100%);
  background: var(--auth-karte);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 38px 34px 32px;
  box-shadow: var(--shadow);
}

.auth-logo { display: grid; justify-items: center; gap: 14px; margin-bottom: 26px; }
.auth-logo img {
  width: 76px; height: 76px; border-radius: 22px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 22px 44px -14px rgba(37, 99, 235, .75);
}
.auth-logo .brand__name { font-size: 30px; letter-spacing: .28em; text-indent: .28em; }

.auth-title { font-size: 17px; font-weight: 650; margin: 0 0 4px; text-align: center; }
.auth-sub { color: var(--muted); font-size: 13.5px; text-align: center; margin: 0 0 24px; }

/* ============================================================
   Formularelemente
   ============================================================ */

.field { margin-bottom: 15px; }
.field > label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: .01em;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="time"], input[type="search"], input[type="tel"], select, textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 11px 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  background: var(--panel-3);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .22);
}
textarea { resize: vertical; min-height: 92px; }
select { appearance: none; background-image: none; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(.7); cursor: pointer; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--r);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  transition: transform .12s, filter .15s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: var(--line-stark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; pointer-events: none; }

.btn--primary {
  background: var(--grad);
  border-color: transparent;
  color: #04121f;
  font-weight: 700;
  box-shadow: 0 12px 26px -12px rgba(34, 211, 238, .8);
}
.btn--primary:hover { filter: brightness(1.08); background: var(--grad); }

.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--panel-2); color: var(--text); }

.btn--danger { color: var(--danger); border-color: rgba(248, 113, 113, .3); background: rgba(248, 113, 113, .08); }
.btn--danger:hover { background: rgba(248, 113, 113, .16); border-color: rgba(248, 113, 113, .5); }

.btn--block { width: 100%; }
.btn--sm { padding: 7px 11px; font-size: 13px; border-radius: var(--r-sm); }

.msg {
  border-radius: var(--r);
  padding: 10px 13px;
  font-size: 13.5px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.msg--error { background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .32); color: #fca5a5; }
.msg--ok    { background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .32); color: #6ee7b7; }

.hint { font-size: 12.5px; color: var(--muted-2); }
.link-btn { background: none; border: none; color: var(--brand-2); font-size: 13px; padding: 0; text-decoration: underline; }

/* ============================================================
   Grundgerüst
   ============================================================ */

#app { display: flex; height: 100%; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 6px;
}
.sidebar__brand { padding: 6px 8px 18px; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--r);
  border: none;
  background: none;
  color: var(--muted);
  font-weight: 550;
  font-size: 14.5px;
  text-align: left;
  position: relative;
  transition: background .15s, color .15s;
}
.nav__item:hover { background: var(--panel-2); color: var(--text); }
.nav__item.is-active { background: var(--panel-3); color: var(--text); }
.nav__item.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--grad);
}
.nav__item svg { width: 19px; height: 19px; flex: none; }
.nav__badge {
  margin-left: auto;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 19px;
  height: 19px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  padding: 0 5px;
}

.sidebar__foot { border-top: 1px solid var(--line-soft); padding-top: 12px; display: grid; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 6px; min-width: 0; }
.me__text { min-width: 0; }
.me__name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me__role { font-size: 11.5px; color: var(--muted-2); }

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

.topbar {
  height: 62px;
  flex: none;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  background: rgba(15, 20, 32, .6);
  backdrop-filter: blur(10px);
}
.topbar h1 { font-size: 17.5px; font-weight: 680; margin: 0; white-space: nowrap; }
.topbar__spacer { flex: 1; }

/* Schnellzugriff rechts neben dem Titel */
.topbar__aktionen { display: flex; gap: 6px; align-items: center; }
.topbar__aktionen:empty { display: none; }
.topbar__aktionen .btn { gap: 6px; white-space: nowrap; }
.topbar__aktionen .btn svg { width: 16px; height: 16px; flex: none; }

/* Wird es eng, bleiben nur die Pluszeichen stehen */
@media (max-width: 760px) {
  .topbar__aktionen .topbar__text { display: none; }
  .topbar__aktionen .btn { padding: 7px 11px; font-size: 15px; }
}
.topbar__meta { font-size: 12.5px; color: var(--muted-2); }

.view { flex: 1; overflow: auto; padding: 22px; }
.view--flush { padding: 0; display: flex; flex-direction: column; overflow: hidden; }

.menu-toggle { display: none; }

/* ============================================================
   Bausteine
   ============================================================ */

.card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 18px;
}
.card__title { font-size: 14px; font-weight: 680; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }

.grid { display: grid; gap: 14px; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row--tight { gap: 6px; }
.spacer { flex: 1; }

.stat { position: relative; overflow: hidden; }
.stat__label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.stat__value { font-size: 30px; font-weight: 750; letter-spacing: -.02em; margin-top: 4px; }
.stat__foot { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.stat::after {
  content: "";
  position: absolute;
  right: -30px; top: -30px;
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--grad);
  opacity: .1;
}

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
  position: relative;
}
.avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.avatar--lg { width: 46px; height: 46px; font-size: 16px; }
.avatar.is-online::after {
  content: "";
  position: absolute;
  right: -1px; bottom: -1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ok);
  border: 2px solid var(--panel);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 650;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag--steuerkunde { color: var(--steuer); background: rgba(34, 211, 238, .1); }
.tag--kreditkunde { color: var(--kredit); background: rgba(167, 139, 250, .1); }
.tag--mieter      { color: var(--mieter); background: rgba(52, 211, 153, .1); }
.tag--plain       { color: var(--muted-2); background: var(--panel-2); }
.tag--plain::before { display: none; }

.empty { text-align: center; padding: 46px 20px; color: var(--muted-2); }
.empty__icon { font-size: 34px; opacity: .5; margin-bottom: 10px; }
.empty p { margin: 0 0 4px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { flex: 1; min-width: 210px; position: relative; }
.toolbar .search input { padding-left: 36px; }
.toolbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted-2); }

.chip {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 99px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--line-stark); }
.chip.is-active { background: var(--grad); border-color: transparent; color: #04121f; }

/* ---------- Ankreuzfelder für Kundenarten ---------- */

.checks { display: flex; gap: 10px; flex-wrap: wrap; }
.check {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--r);
  padding: 11px 14px;
  cursor: pointer;
  flex: 1 1 150px;
  transition: all .15s;
  user-select: none;
}
.check:hover { border-color: var(--line-stark); }
.check input { appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--muted-2); border-radius: 5px; flex: none; display: grid; place-items: center; transition: all .15s; }
.check input::after {
  content: "";
  width: 10px; height: 10px;
  transform: scale(0);
  transition: transform .15s;
  background: currentColor;
  clip-path: polygon(14% 45%, 0 60%, 39% 100%, 100% 20%, 84% 5%, 37% 68%);
}
.check input:checked { border-color: currentColor; background: currentColor; }
.check input:checked::after { transform: scale(1); background: #04121f; }
.check__label { font-size: 13.5px; font-weight: 600; }
.check--steuerkunde:has(input:checked) { color: var(--steuer); border-color: var(--steuer); background: rgba(34, 211, 238, .1); }
.check--kreditkunde:has(input:checked) { color: var(--kredit); border-color: var(--kredit); background: rgba(167, 139, 250, .1); }
.check--mieter:has(input:checked)      { color: var(--mieter); border-color: var(--mieter); background: rgba(52, 211, 153, .1); }

.check--emergency:has(input:checked) { color: #f87171; border-color: #dc2626; background: rgba(220, 38, 38, .18); }
.check--high:has(input:checked) { color: var(--danger); border-color: var(--danger); background: rgba(248, 113, 113, .1); }
.check--low:has(input:checked)  { color: var(--warn);   border-color: var(--warn);   background: rgba(251, 191, 36, .1); }

/* Auswahlknöpfe (nur eine Möglichkeit) rund statt eckig */
.check input[type="radio"] { border-radius: 50%; }
.check input[type="radio"]::after { clip-path: circle(50%); width: 8px; height: 8px; }

/* ============================================================
   Kundenliste
   ============================================================ */

/* minmax(0, 1fr) statt der Vorgabe "auto": eine auto-Spalte wird so breit
   wie ihr Inhalt und schiebt damit lange Namen aus dem Bild. */
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

.customer {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 12px 15px;
  text-align: left;
  width: 100%;
  transition: border-color .15s, background .15s, transform .12s;
}
.customer:hover { border-color: var(--line-stark); background: var(--panel-2); transform: translateX(2px); }
.customer__body { min-width: 0; flex: 1; }
.customer__name { font-weight: 650; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.customer__meta { font-size: 12.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.customer__tags { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }

/* ============================================================
   Tickets und Aufgaben
   ============================================================ */

/* Emergency ist bewusst gefüllt statt umrandet – es soll auch beim
   flüchtigen Blick aus der Liste herausspringen. */
.tag--emergency {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}
.tag--emergency::before { background: #fff; }
.tag--high     { color: var(--danger); background: rgba(248, 113, 113, .12); }
.tag--low      { color: var(--warn);   background: rgba(251, 191, 36, .12); }
.tag--erledigt { color: var(--ok);     background: rgba(52, 211, 153, .12); }

.chip--emergency.is-active { background: #dc2626;    color: #fff; }
.chip--high.is-active      { background: var(--danger); color: #2a0808; }
.chip--low.is-active       { background: var(--warn);   color: #2c1f02; }
.chip--erledigt.is-active  { background: var(--ok);     color: #05231a; }

/* Trennstrich vor "Nur meine": macht sichtbar, dass es sich
   mit den Knöpfen links kombinieren lässt statt sie zu ersetzen. */
.chip-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; flex: none; }

.chip--mine.is-active {
  background: var(--brand);
  border-color: transparent;
  color: #fff;
}

.ticket {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--muted-2);
  border-radius: var(--r);
  padding: 12px 15px;
  transition: border-color .15s, background .15s, transform .12s;
}
.ticket:hover { background: var(--panel-2); transform: translateX(2px); }

.ticket--emergency { border-left-color: #dc2626; border-left-width: 5px; }
.ticket--high { border-left-color: var(--danger); }
.ticket--low  { border-left-color: var(--warn); }
.ticket--done { border-left-color: var(--ok); opacity: .62; }
.ticket--done .ticket__title { text-decoration: line-through; }

/* Abgelaufene Frist: roter Schimmer über die Zeile – aber den linken
   Farbbalken in Ruhe lassen, der zeigt weiterhin die Dringlichkeit. */
.ticket.is-late {
  background: rgba(220, 38, 38, .09);
  border-top-color: rgba(220, 38, 38, .35);
  border-right-color: rgba(220, 38, 38, .35);
  border-bottom-color: rgba(220, 38, 38, .35);
}

.ticket__check {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--muted-2);
  background: none;
  color: transparent;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: all .15s;
}
.ticket__check:hover { border-color: var(--ok); color: var(--ok); }
.ticket--done .ticket__check { border-color: var(--ok); background: var(--ok); color: #05231a; }

.ticket__body { flex: 1; min-width: 0; text-align: left; background: none; border: none; padding: 0; }
.ticket__title {
  font-weight: 650;
  font-size: 14.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ticket__meta {
  font-size: 12.5px;
  color: var(--muted-2);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ticket__meta.is-late { color: var(--danger); }
.ticket__tags { flex: none; display: flex; gap: 5px; }

/* ---------- Mahnung bei abgelaufener Frist ---------- */

.mahnung {
  background: rgba(220, 38, 38, .12);
  border: 1px solid rgba(220, 38, 38, .45);
  border-radius: var(--r-lg);
  padding: 15px 17px;
  margin-bottom: 18px;
}
.mahnung__kopf { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.mahnung__icon {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 800;
}
.mahnung__kopf strong { font-size: 15px; }
.mahnung__text { font-size: 13px; color: var(--danger); font-weight: 600; margin-top: 1px; }

.mahnung__zeile {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  background: var(--flaeche-tief);
  border: 1px solid transparent;
  color: var(--text);
  transition: border-color .15s, background .15s;
}
.mahnung__zeile:hover { border-color: rgba(220, 38, 38, .5); background: var(--flaeche-tief-hover); }
.mahnung__titel {
  flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mahnung__frist { flex: none; font-size: 12px; font-weight: 700; color: var(--danger); }

@media (max-width: 620px) {
  .mahnung__zeile { flex-wrap: wrap; }
  .mahnung__titel { flex: 1 1 100%; white-space: normal; }
}

/* ============================================================
   Termine
   ============================================================ */

.tagstreifen {
  display: flex;
  gap: 7px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.tagchip {
  flex: none;
  position: relative;
  min-width: 58px;
  padding: 9px 8px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  display: grid;
  gap: 1px;
  transition: all .15s;
}
.tagchip:hover { border-color: var(--line-stark); color: var(--text); }
.tagchip__wt  { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.tagchip__tag { font-size: 19px; font-weight: 750; line-height: 1.1; }
.tagchip.is-today { border-color: var(--brand-2); }
.tagchip.is-active { background: var(--grad); border-color: transparent; color: #04121f; }
.tagchip__punkt {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.tagchip.is-active .tagchip__punkt { background: #04121f; color: #fff; }

/* ============================================================
   Notizen und Verlauf
   ============================================================ */

.verlauf { display: flex; flex-direction: column; gap: 2px; }
.verlauf__eintrag {
  display: flex;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  position: relative;
}
.verlauf__eintrag--notiz { background: var(--panel-2); }
.verlauf__eintrag--aenderung { opacity: .8; }
/* Verbindungslinie zwischen den Einträgen – macht die Abfolge sichtbar */
.verlauf__eintrag:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 26px;
  top: 40px;
  bottom: -2px;
  width: 1px;
  background: var(--line);
}
.verlauf__inhalt { flex: 1; min-width: 0; }
.verlauf__kopf { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.verlauf__kopf strong { font-size: 13px; }
.verlauf__zeit { font-size: 11.5px; color: var(--muted-2); }
.verlauf__text { font-size: 13.5px; margin-top: 1px; overflow-wrap: anywhere; }
.verlauf__eintrag--aenderung .verlauf__text { color: var(--muted); font-size: 13px; }

/* ============================================================
   Beschreibung mit Formatierung
   ============================================================ */

.textwerkzeuge {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  padding: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--r) var(--r) 0 0;
}
.twz {
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  transition: background .12s, color .12s;
}
.twz:hover { background: var(--panel-3); color: var(--text); }
.twz__strich { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.twz__farbe { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,.35); }
.twz__farbe:hover { transform: scale(1.15); }
.twz__farbe--schrift {
  background: var(--panel-3);
  font-weight: 800;
  font-size: 13px;
  border-color: var(--line);
}

.reichtext {
  min-height: 110px;
  max-height: 320px;
  overflow-y: auto;
  padding: 11px 13px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 0 0 var(--r) var(--r);
  outline: none;
  line-height: 1.55;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.reichtext:focus {
  border-color: var(--brand);
  background: var(--panel-3);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .22);
}
.reichtext:empty::before {
  content: attr(data-leer);
  color: var(--muted-2);
  pointer-events: none;
}
.reichtext--klein { min-height: 68px; max-height: 200px; }

/* Markierter Text braucht auf hellem Grund dunkle Schrift –
   gilt auch für die Notizen im Verlauf. */
.reichtext [style*="background"],
.verlauf__text [style*="background"] { color: #1a1a1a; padding: 0 2px; border-radius: 2px; }

@media (pointer: coarse) {
  .twz { width: 38px; height: 38px; }
  .twz__farbe { width: 26px; height: 26px; }
}

/* ============================================================
   Auswahlfeld mit Suche
   ============================================================ */

.suchwahl { position: relative; }
.suchwahl__feld { width: 100%; padding-right: 38px; }
.suchwahl__weg {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--muted-2);
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1;
}
.suchwahl__weg:hover { color: var(--text); background: var(--panel-3); }

.suchwahl__liste {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 5px;
}
.suchwahl__eintrag {
  display: flex;
  align-items: baseline;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  color: var(--text);
  transition: background .12s;
}
.suchwahl__eintrag:hover,
.suchwahl__eintrag.is-markiert { background: var(--panel-3); }
.suchwahl__eintrag.is-gewaehlt { color: var(--brand-2); }
.suchwahl__text { font-size: 13.5px; font-weight: 600; flex: none; }
.suchwahl__zusatz {
  font-size: 12px; color: var(--muted-2); flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right;
}
.suchwahl__nix { padding: 12px; color: var(--muted-2); font-size: 13px; text-align: center; }

/* ---------- Wochenansicht ---------- */

.woche {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}
.wtag {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  overflow: hidden;
  min-height: 120px;
  display: flex;
  flex-direction: column;
}
.wtag.is-today { border-color: var(--brand-2); }

.wtag__kopf {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 6px;
  background: var(--panel-2);
  border: none;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  transition: background .15s, color .15s;
}
.wtag__kopf:hover { background: var(--panel-3); color: var(--text); }
.wtag.is-today .wtag__kopf { background: var(--grad); color: #04121f; }
.wtag__wt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.wtag__nr { font-size: 16px; font-weight: 750; }

.wtag__liste { display: flex; flex-direction: column; gap: 5px; padding: 6px; flex: 1; }
.wtag__leer { color: var(--muted-2); font-size: 13px; text-align: center; padding: 8px 0; }

.wkarte {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  text-align: left;
  padding: 7px 8px;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--brand-2);
  color: var(--text);
  transition: background .15s, border-color .15s;
}
.wkarte:hover { background: var(--panel-3); border-color: var(--line-stark); }
.wkarte--erledigt { border-left-color: var(--ok); opacity: .65; }
.wkarte--abgesagt { border-left-color: var(--muted-2); opacity: .5; }
.wkarte--abgesagt .wkarte__titel { text-decoration: line-through; }

.wkarte__zeit  { font-size: 12px; font-weight: 750; color: var(--brand-2); }
.wkarte--erledigt .wkarte__zeit { color: var(--ok); }
.wkarte__titel {
  font-size: 12.5px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.wkarte__wer {
  font-size: 11px; color: var(--muted-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Schmale Bildschirme: die sieben Spalten untereinander statt nebeneinander */
@media (max-width: 900px) {
  .woche { grid-template-columns: 1fr; }
  .wtag { min-height: 0; }
  .wtag__kopf { justify-content: flex-start; padding-left: 12px; }
  .wkarte { flex-direction: row; align-items: baseline; gap: 8px; }
  .wkarte__zeit { flex: none; width: 44px; }
  .wkarte__titel { flex: 1; -webkit-line-clamp: 2; }
  .wkarte__wer { flex: none; max-width: 35%; }
}

.termin {
  display: flex;
  align-items: stretch;
  gap: 13px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--brand-2);
  border-radius: var(--r);
  padding: 12px 15px;
  transition: border-color .15s, background .15s, transform .12s;
}
.termin:hover { background: var(--panel-2); transform: translateX(2px); }
.termin--erledigt { border-left-color: var(--ok); opacity: .68; }
.termin--abgesagt { border-left-color: var(--muted-2); opacity: .55; }
.termin--abgesagt .termin__titel { text-decoration: line-through; }

.termin__zeit { flex: none; width: 54px; padding-top: 1px; }
.termin__von { font-size: 15px; font-weight: 750; letter-spacing: -.01em; }

.termin__body { flex: 1; min-width: 0; text-align: left; background: none; border: none; padding: 0; }
.termin__titel {
  font-weight: 650; font-size: 14.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.termin__meta {
  font-size: 12.5px; color: var(--muted-2); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.termin__kunde { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 12.5px; }

.tag--abgesagt { color: var(--muted-2); background: var(--panel-2); }
.termin__ab { flex: none; align-self: center; white-space: nowrap; }

/* Liegenschaftsnummer vor dem Termintitel */
.lnr {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: .02em;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--panel-3);
  color: var(--brand-2);
  vertical-align: 1px;
}

/* Profilbild statt Anfangsbuchstaben */
.avatar--bild { background: var(--panel-3) !important; padding: 0; overflow: hidden; }
.avatar--bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar--xl { width: 68px; height: 68px; font-size: 22px; flex: none; }

/* Vorschau des Firmenlogos. Karierter Grund, damit man bei einem
   durchsichtigen PNG sieht, wo das Bild aufhört. */
.logo-vorschau {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--r);
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e9e9e9 25%, transparent 25%, transparent 75%, #e9e9e9 75%),
    linear-gradient(45deg, #e9e9e9 25%, transparent 25%, transparent 75%, #e9e9e9 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
.logo-vorschau img { max-height: 52px; max-width: 60%; width: auto; }
.logo-vorschau .hint { color: #555; }

.rollenwahl {
  width: auto;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--r-sm);
}

/* ---------- Abschluss vor Ort ---------- */

.unterschrift {
  width: 100%;
  height: 190px;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--r);
  cursor: crosshair;
  touch-action: none;          /* sonst scrollt die Seite beim Unterschreiben */
  display: block;
}

.rapport__fotos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.rapport__fotos img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.rapport__sig {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px;
  margin-top: 8px;
}
.rapport__sig img { width: 100%; max-height: 150px; object-fit: contain; display: block; }

@media (max-width: 620px) {
  .termin { flex-wrap: wrap; }
  .termin__zeit { width: 48px; }
  /* Der Knopf bekommt eine eigene Zeile über die volle Breite. Sonst bleiben
     für den Titel nur ein paar Zeichen übrig ("Heizungs…"). */
  .termin__ab { flex: 1 0 100%; margin-top: 8px; align-self: stretch; }
}

/* ============================================================
   Dialog
   ============================================================ */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, .72);
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 60;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } }

.modal {
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise .2s cubic-bezier(.2, .8, .3, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }

.modal__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
}
.modal__head h2 { margin: 0; font-size: 16.5px; font-weight: 680; }
.modal__body { padding: 22px; overflow: auto; }
.modal__foot {
  display: flex;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line-soft);
  background: var(--panel);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .field--wide { grid-column: 1 / -1; }

.section-label {
  grid-column: 1 / -1;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 12px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.section-label:first-child { margin-top: 0; padding-top: 0; border-top: none; }

/* ============================================================
   Chat
   ============================================================ */

.chat { display: flex; height: 100%; min-height: 0; }

.chat__side {
  flex: none;
  width: 216px;
  border-right: 1px solid var(--line-soft);
  background: var(--panel);
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.konv {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--muted);
  text-align: left;
  background: none;
  border: none;
  transition: background .15s, color .15s;
}
.konv:hover { background: var(--panel-2); color: var(--text); }
.konv.is-active { background: var(--panel-3); color: var(--text); }
.konv__name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600;
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.konv__team {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  background: var(--grad); color: #04121f;
}

.chat__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat__title { font-weight: 650; font-size: 14.5px; color: var(--text); }

/* Schmale Bildschirme: die Gesprächsliste wandert als Streifen nach oben */
@media (max-width: 760px) {
  .chat { flex-direction: column; }
  .chat__side {
    width: auto;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid var(--line-soft);
    padding: 7px 8px;
  }
  .konv { width: auto; flex: none; }
  .konv__name { max-width: 110px; }
}

.chat__head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel);
}
.chat__stream { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 3px; }

.chat__day { align-self: center; font-size: 11.5px; color: var(--muted-2); background: var(--panel-2); border: 1px solid var(--line-soft); padding: 4px 12px; border-radius: 99px; margin: 14px 0 10px; }

.bubble-row { display: flex; gap: 10px; align-items: flex-end; max-width: 74%; margin-top: 10px; }
.bubble-row.is-mine { align-self: flex-end; flex-direction: row-reverse; }
.bubble-row.is-stacked { margin-top: 2px; }
.bubble-row.is-stacked .avatar { visibility: hidden; }

.bubble {
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 16px 16px 16px 5px;
  padding: 9px 13px;
  min-width: 0;
}
.is-mine .bubble {
  background: linear-gradient(135deg, rgba(37, 99, 235, .3), rgba(34, 211, 238, .2));
  border-color: rgba(34, 211, 238, .32);
  border-radius: 16px 16px 5px 16px;
}
.bubble__who { font-size: 12px; font-weight: 700; color: var(--brand-2); margin-bottom: 2px; }
.bubble__text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.2px; }
.bubble__time { font-size: 10.5px; color: var(--muted-2); margin-top: 3px; text-align: right; }

.bubble__del {
  opacity: 0;
  border: none;
  background: none;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1;
  padding: 5px 6px;
  border-radius: 6px;
  align-self: center;
  flex: none;
  transition: opacity .15s, color .15s, background .15s;
}
.bubble-row:hover .bubble__del,
.bubble__del:focus-visible { opacity: 1; }
.bubble__del:hover { color: var(--danger); background: rgba(248, 113, 113, .13); }
/* Ohne Maus (Handy, Tablet) gibt es kein Überfahren – dann dauerhaft andeuten */
@media (hover: none) { .bubble__del { opacity: .5; } }

/* ---------- Anhänge im Chat ---------- */

.anhang { margin-bottom: 6px; }
.anhang__bild-link { display: block; line-height: 0; }
.anhang__bild {
  max-width: min(280px, 100%);
  max-height: 300px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.anhang__datei {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  background: var(--flaeche-hoch);
  border: 1px solid var(--line);
  color: inherit;
  max-width: 280px;
  transition: background .15s, border-color .15s;
}
.anhang__datei:hover { background: var(--flaeche-hoch-hover); border-color: var(--line-stark); }
.anhang__symbol { font-size: 22px; flex: none; }
.anhang__text { min-width: 0; display: flex; flex-direction: column; }
.anhang__name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.anhang__groesse { font-size: 11.5px; opacity: .7; }

.chat__stream.is-over { outline: 2px dashed var(--brand-2); outline-offset: -10px; }

/* ---------- Emoji-Auswahl ---------- */

.composer__icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 17px;
  line-height: 1;
  align-self: flex-end;
  transition: background .15s, border-color .15s;
}
.composer__icon:hover { background: var(--panel-3); border-color: var(--line-stark); }

.emoji-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 12px;
  z-index: 30;
  width: min(360px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.emoji-reiter {
  display: flex;
  gap: 2px;
  padding: 6px;
  border-bottom: 1px solid var(--line-soft);
  overflow-x: auto;
  flex: none;
}
.emoji-reiter__knopf {
  flex: none;
  width: 34px;
  height: 32px;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  font-size: 17px;
  line-height: 1;
  opacity: .55;
  transition: opacity .12s, background .12s;
}
.emoji-reiter__knopf:hover { opacity: 1; background: var(--panel-3); }
.emoji-reiter__knopf.is-active { opacity: 1; background: var(--panel-3); box-shadow: inset 0 -2px 0 var(--brand-2); }

.emoji-gitter {
  max-height: 226px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 2px;
  padding: 8px;
}
.emoji {
  font-size: 20px;
  line-height: 1;
  padding: 6px;
  border-radius: var(--r-sm);
  background: none;
  border: none;
  transition: background .12s, transform .12s;
}
.emoji:hover { background: var(--panel-3); transform: scale(1.18); }

.composer__status { position: absolute; left: 12px; right: 12px; bottom: calc(100% + 6px); }
.composer__status:empty { display: none; }

.composer {
  position: relative;
  flex: none;
  border-top: 1px solid var(--line-soft);
  padding: 14px 22px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--panel);
}
.composer textarea {
  min-height: 44px;
  max-height: 160px;
  resize: none;
  border-radius: 14px;
  padding: 11px 14px;
}

/* ============================================================
   Dateien
   ============================================================ */

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--r-lg);
  padding: 30px 20px;
  text-align: center;
  transition: all .15s;
  background: var(--panel);
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand-2); background: rgba(34, 211, 238, .06); }
.dropzone__icon { font-size: 30px; opacity: .65; }
.dropzone__title { font-weight: 650; margin-top: 8px; }

.file {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 11px 14px;
  transition: border-color .15s, background .15s;
}
.file:hover { border-color: var(--line-stark); background: var(--panel-2); }
.file__icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 17px;
  background: var(--panel-3);
  overflow: hidden;
}
.file__icon img { width: 100%; height: 100%; object-fit: cover; }
.file__body { flex: 1; min-width: 0; }
.file__name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file__meta { font-size: 12px; color: var(--muted-2); }

.progress { height: 4px; background: var(--panel-3); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress__bar { height: 100%; background: var(--grad); width: 0; transition: width .2s; }

/* ============================================================
   Team
   ============================================================ */

.person {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 13px 15px;
}
.person__body { flex: 1; min-width: 0; }
.person__name { font-weight: 650; font-size: 14.5px; }
.person__mail { font-size: 12.5px; color: var(--muted-2); }

/* ============================================================
   Meldungen (Toast)
   ============================================================ */

#toasts {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: grid;
  gap: 10px;
  z-index: 90;
  pointer-events: none;
}
.toast {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand-2);
  border-radius: var(--r);
  padding: 12px 16px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: toastIn .22s cubic-bezier(.2, .8, .3, 1);
  max-width: 340px;
}
.toast--error { border-left-color: var(--danger); }
.toast--ok { border-left-color: var(--ok); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }

/* ============================================================
   Kleine Bildschirme
   ============================================================ */

@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.2, .8, .3, 1);
    box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 13, .6);
    z-index: 65;
  }
  .view { padding: 16px; }
  .topbar { padding: 0 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .bubble-row { max-width: 90%; }
  .chat__stream, .composer { padding-left: 14px; padding-right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   Handy und Tablet
   ============================================================ */

/* Auf Handys schrumpft die sichtbare Höhe, sobald die Adressleiste
   erscheint. "dvh" rechnet das mit, "vh" nicht – sonst rutscht der
   untere Rand unter die Leiste. */
@supports (height: 100dvh) {
  html, body { height: 100dvh; }
  .modal { max-height: calc(100dvh - 40px); }
}

@media (max-width: 900px) {
  /* Unter 16px zoomt Safari auf dem iPhone beim Antippen eines Feldes
     hinein und der Nutzer muss von Hand wieder herauszoomen. */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="date"], input[type="time"], input[type="search"],
  input[type="tel"], input[type="number"], select, textarea {
    font-size: 16px;
  }

  .auth-card { padding: 28px 22px 24px; border-radius: 18px; }
  .modal { border-radius: 18px; }
  .modal__head, .modal__body, .modal__foot { padding-left: 16px; padding-right: 16px; }

  /* Fusszeile der Dialoge: auf schmalen Geräten untereinander statt
     nebeneinander, damit "Speichern" nicht auf 60px zusammenschrumpft. */
  .modal__foot { flex-wrap: wrap; }
  .modal__foot .btn { flex: 1 1 auto; }
  .modal__foot .spacer { display: none; }

  .card { padding: 16px; }
  .grid--2 { grid-template-columns: 1fr; }

  /* Überschriften in Listen dürfen zweizeilig werden. Eine harte
     Abkürzung nach acht Zeichen hilft auf dem Handy niemandem. */
  .termin__titel, .ticket__title, .customer__name, .file__name {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Zeilen mit Aktionsknöpfen: Knöpfe rutschen unter den Inhalt,
     statt ihn auf wenige Zeichen zusammenzudrücken. */
  .file { flex-wrap: wrap; }
  .file__body { flex: 1 1 100%; }
  .file .btn { flex: 1 1 0; }

  .person { flex-wrap: wrap; }
  .person__body { flex: 1 1 100%; }
  .person .row { flex: 1 1 100%; }
  .person .btn, .person .rollenwahl { flex: 1 1 auto; }

  .toolbar .search { flex: 1 1 100%; }
}

/* Fingerbedienung: grössere Trefferflächen. Gilt für Touchgeräte,
   nicht für schmale Fenster am Rechner mit Maus. */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn--sm { min-height: 40px; }
  .chip, .tagchip, .konv, .rollenwahl { min-height: 42px; }
  .composer__icon { width: 44px; height: 44px; }
  .ticket__check { width: 26px; height: 26px; }
  .emoji { padding: 9px; }
  .nav__item { padding-top: 11px; padding-bottom: 11px; }
}

/* Randbereiche moderner Handys (Notch oben, Balken unten).
   Die Seite läuft wegen "viewport-fit=cover" bis unter beide. */
@supports (padding: max(0px)) {
  .sidebar {
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
    padding-left: max(14px, env(safe-area-inset-left));
  }
  .topbar {
    height: calc(62px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    padding-right: max(22px, env(safe-area-inset-right));
  }
  .view {
    padding-bottom: max(22px, env(safe-area-inset-bottom));
    padding-right: max(22px, env(safe-area-inset-right));
  }
  .composer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .modal__foot { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}
