/* Karma Website OS: Kundenportal und Admin-Dashboard teilen dieses Stylesheet.
   Optik folgt dem Social Autopilot OS (Redesign 09/2026): zwei Themes (dunkel = Standard,
   hell ueber den Schalter), eine Schrift (Poppins), grosse Radien, weiche Flaechen, kaum
   Linien. Dunkel fuehrt Neon-Gruen, hell fuehrt Karma-Blau. */
:root {
  --ground: #0a0a0a; --panel: #161616; --panel-2: #212121; --sunken: #101010;
  --line: #262626; --line-strong: #3a3a3a;
  --text: #f5f5f5; --dim: #b0b0b0; --muted: #7a7a7a; --placeholder: #5a5a5a;
  --accent: #99ff66; --accent-hover: #a8ff7d; --accent-ink: #0a0a0a; --accent-soft: rgba(153, 255, 102, 0.12);
  --ok: #99ff66; --ok-soft: rgba(153, 255, 102, 0.12);
  --chan: #7dc1ff; --chan-soft: rgba(125, 193, 255, 0.14);
  --neg: #ff8a80; --neg-soft: rgba(255, 138, 128, 0.14);
  --amber: #ffc46b; --amber-soft: rgba(255, 196, 107, 0.14);
  --side-bg: #0a0a0a; --side-hover: #161616; --side-active: #1c1c1c; --side-line: #1f1f1f; --side-dim: #8a8a8a;
  --toast-bg: #99ff66; --toast-fg: #0a0a0a;
  --scroll-thumb: #2e2e2e; --schatten: none;
  --radius: 18px; --radius-sm: 12px;
  --font: "Poppins", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
}
html[data-theme="hell"] {
  --ground: #eef0f3; --panel: #ffffff; --panel-2: #f2f4f7; --sunken: #f6f7f9;
  --line: #e6e9ee; --line-strong: #cfd5de;
  --text: #121212; --dim: #4a4f58; --muted: #7b8290; --placeholder: #a5abb7;
  --accent: #2b7bd2; --accent-hover: #256cbb; --accent-ink: #ffffff; --accent-soft: #e6f1ff;
  --ok: #2f7a17; --ok-soft: #e4ffd6;
  --chan: #1f5fae; --chan-soft: #e6f1ff;
  --neg: #b3261e; --neg-soft: #ffe3e0;
  --amber: #9a5b06; --amber-soft: #fff1dc;
  --side-bg: #ffffff; --side-hover: #f2f4f7; --side-active: #eef0f3; --side-line: #e6e9ee; --side-dim: #6d7480;
  --toast-bg: #2b7bd2; --toast-fg: #ffffff;
  --scroll-thumb: #d3d8e0;
  --schatten: 0 1px 2px rgba(18, 18, 18, 0.04), 0 8px 24px rgba(18, 18, 18, 0.04);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ground); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: 26px; font-weight: 600; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
a { color: inherit; }
b, strong { font-weight: 600; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
html:not([data-theme="hell"]) .logo-hell { display: none; }
html[data-theme="hell"] .logo-dunkel { display: none; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dim { color: var(--dim); } .muted { color: var(--muted); } .klein { font-size: 12.5px; }

/* ---------------------------------------------------------------- Login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; }
.login-card img { width: 132px; margin-bottom: 44px; display: block; }
.login-card .eyebrow { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.login-card p { color: var(--dim); margin: 10px 0 26px; }
.login-card .btn { width: 100%; margin-top: 14px; }
.hinweis { margin-top: 18px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: 13.5px; }
.hinweis.fehler { background: var(--neg-soft); color: var(--neg); }

/* ---------------------------------------------------------------- Rahmen */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100dvh; }
.side {
  background: var(--side-bg); border-right: 1px solid var(--side-line); padding: 26px 14px 18px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh;
}
.side .logo { width: 118px; margin: 0 10px 6px; }
.side .produkt { font-size: 12px; color: var(--side-dim); margin: 0 10px 22px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--side-dim); text-decoration: none; background: none; border: 0; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--side-hover); color: var(--text); }
.nav-item.aktiv { background: var(--side-active); color: var(--text); font-weight: 500; }
.nav-item .badge { margin-left: auto; }
.side .fuss { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.side .wer { padding: 10px 12px 2px; font-size: 12.5px; color: var(--side-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { padding: 34px 38px 80px; max-width: 1180px; width: 100%; }
.kopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.kopf p { margin: 6px 0 0; color: var(--dim); }
.zurueck { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); text-decoration: none; margin-bottom: 14px; font-size: 13px; }
.zurueck:hover { color: var(--text); }

/* ---------------------------------------------------------------- Bausteine */
.card { background: var(--panel); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--schatten); min-width: 0; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 18px; }
.card-kopf { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-kopf .sub { color: var(--muted); font-size: 12.5px; }
.grid { display: grid; gap: 18px; }
.grid > .card { margin-top: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.g-detail { grid-template-columns: minmax(0, 1fr) 330px; align-items: start; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--sunken); border-radius: var(--radius-sm); padding: 14px 16px; }
.tile .lab { color: var(--muted); font-size: 12.5px; }
.tile .val { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .delta { font-size: 12.5px; color: var(--muted); }
.delta.auf { color: var(--ok); } .delta.ab { color: var(--neg); }
.leer { color: var(--muted); padding: 18px 0 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--radius-sm);
  padding: 11px 18px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.zweit { background: var(--panel-2); color: var(--text); font-weight: 500; }
.btn.zweit:hover { background: var(--line-strong); }
.btn.klein { padding: 7px 12px; font-size: 13px; }
.btn.gefahr { background: var(--neg-soft); color: var(--neg); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
html:not([data-theme="hell"]) .linkbtn { color: var(--chan); }

label.feld { display: block; margin-bottom: 16px; }
label.feld > span { display: block; font-size: 13px; font-weight: 500; color: var(--dim); margin-bottom: 7px; }
label.feld > span i { font-style: normal; font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=url], input[type=date], input[type=search], select, textarea {
  width: 100%; color: var(--text); background: var(--sunken); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 11px 13px; outline: none;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
::placeholder { color: var(--placeholder); }
.reihe { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.check { display: flex; align-items: center; gap: 9px; color: var(--dim); }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 9px 14px; border-radius: 999px; background: var(--sunken); border: 1px solid var(--line); color: var(--dim); cursor: pointer; }
.seg input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 500; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; background: var(--panel-2); color: var(--dim); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.s-neu, .pill.s-arbeit { background: var(--chan-soft); color: var(--chan); }
.pill.s-pruefung, .pill.s-langsam, .pill.s-pruefen { background: var(--amber-soft); color: var(--amber); }
.pill.s-rueckfrage, .pill.s-ausfall, .pill.s-dringend { background: var(--neg-soft); color: var(--neg); }
.pill.s-abnahme { background: var(--accent-soft); color: var(--text); }
.pill.s-abnahme::before { background: var(--accent); }
.pill.s-erledigt, .pill.s-ok { background: var(--ok-soft); color: var(--ok); }
.pill.ohne::before { display: none; }
.badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 11.5px; font-weight: 600; padding: 1px 8px; }

/* Kundendaten-Karte in der Erfassungsmaske und im Admin */
.daten { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 7px 14px; margin: 0; }
.daten dt { color: var(--muted); }
.daten dd { margin: 0; overflow-wrap: anywhere; }
.erkannt { background: var(--sunken); border-radius: var(--radius-sm); padding: 16px 18px; margin: -4px 0 18px; }
.erkannt .titel { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-bottom: 12px; color: var(--ok); }
.erkannt.nicht .titel { color: var(--amber); margin-bottom: 4px; }

/* Upload */
.drop {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 22px; text-align: center;
  color: var(--dim); background: var(--sunken); cursor: pointer; display: block;
}
.drop.ueber { border-color: var(--accent); background: var(--accent-soft); }
.drop input { display: none; }
.dateien { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.dateien li { display: flex; align-items: center; gap: 10px; background: var(--sunken); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.dateien li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dateien li button { background: none; border: 0; color: var(--muted); font-size: 16px; line-height: 1; }
.anhaenge { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.anhang { display: inline-flex; align-items: center; gap: 8px; background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; padding: 6px 11px; font-size: 13px; text-decoration: none; max-width: 100%; }
.anhang:hover { border-color: var(--line-strong); }
.anhang img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; }
.anhang span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Ticket-Listen */
.liste { display: flex; flex-direction: column; }
.zeile {
  display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 13px 4px; border-top: 1px solid var(--line); text-decoration: none; color: inherit;
}
.zeile:first-child { border-top: 0; }
.zeile:hover .t-titel { text-decoration: underline; text-underline-offset: 3px; }
.zeile .nr { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.zeile .t-titel { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile .t-meta { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile .rechts { display: flex; align-items: center; gap: 8px; }
.filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { background: var(--panel); border: 1px solid var(--line); color: var(--dim); border-radius: 999px; padding: 7px 14px; }
.chip.aktiv { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 500; }
.chip .num { color: var(--muted); margin-left: 4px; }

/* Ticket-Detail */
.schritte { display: flex; gap: 6px; margin: 4px 0 2px; }
.schritt { flex: 1; min-width: 0; }
.schritt i { display: block; height: 5px; border-radius: 99px; background: var(--panel-2); }
.schritt.fertig i, .schritt.jetzt i { background: var(--accent); }
.schritt span { display: block; margin-top: 7px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schritt.jetzt span { color: var(--text); font-weight: 500; }
.beschreibung { white-space: pre-wrap; overflow-wrap: anywhere; }
.verlauf { display: flex; flex-direction: column; gap: 14px; }
.ev { display: flex; gap: 12px; }
.ev .punkt { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); color: var(--dim); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.ev.team .punkt { background: var(--accent-soft); color: var(--text); }
.ev .inhalt { flex: 1; min-width: 0; }
.ev .wer { font-size: 13px; }
.ev .wer time { color: var(--muted); margin-left: 6px; font-size: 12.5px; }
.ev .blase { margin-top: 6px; background: var(--sunken); border-radius: 4px 14px 14px 14px; padding: 11px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ev.notiz .blase { background: var(--amber-soft); }
.ev .statuswechsel { color: var(--dim); font-size: 13px; margin-top: 2px; }
.aktion { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 16px 18px; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

/* Website-Status und Core Web Vitals */
.ampel { display: flex; align-items: center; gap: 16px; }
.ampel .licht { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--panel-2); color: var(--muted); }
.ampel .licht .ic { width: 26px; height: 26px; stroke-width: 2; }
.ampel.a-ok .licht { background: var(--ok-soft); color: var(--ok); }
.ampel.a-langsam .licht, .ampel.a-pruefen .licht { background: var(--amber-soft); color: var(--amber); }
.ampel.a-ausfall .licht { background: var(--neg-soft); color: var(--neg); }
.ampel .gross { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.fakten { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.fakt .lab { color: var(--muted); font-size: 12.5px; }
.fakt .val { font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; }
.vitals { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 26px; align-items: center; }
.ring { position: relative; width: 150px; height: 150px; margin: 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .spur { stroke: var(--panel-2); }
.ring .wert { stroke-linecap: round; }
.ring .mitte { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .zahl { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring .von { color: var(--muted); font-size: 12px; margin-top: 4px; }
.gut { color: var(--ok); stroke: var(--ok); } .mittel { color: var(--amber); stroke: var(--amber); } .schlecht { color: var(--neg); stroke: var(--neg); }
.metriken { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metrik { background: var(--sunken); border-radius: var(--radius-sm); padding: 14px 16px; }
.metrik .lab { color: var(--muted); font-size: 12.5px; }
.metrik .val { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metrik .urteil { font-size: 12.5px; font-weight: 500; }
.metrik .was { color: var(--muted); font-size: 12px; margin-top: 4px; }
.trend { margin-top: 18px; display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12.5px; }
.trend svg { flex: 1; height: 44px; min-width: 0; }
.trend polyline { fill: none; stroke: var(--chan); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.balken { display: flex; flex-direction: column; gap: 10px; }
.balken .b { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13px; }
.balken .b i { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; display: block; }
.balken .b i::after { content: ""; display: block; height: 100%; width: var(--w); background: var(--chan); border-radius: 99px; }
.balken .b span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Admin: Tabellen und Dialoge */
table.tab { width: 100%; border-collapse: collapse; }
.tab th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 0 10px 8px 0; }
.tab td { padding: 10px 10px 10px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.tab tr.klick { cursor: pointer; }
.tab tr.klick:hover td { background: var(--sunken); }
.tab .eng { width: 1%; white-space: nowrap; }
.kunde-kopf { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.logins { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.login-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--sunken); border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 13px; }
.login-chip button { background: none; border: 0; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 5px; }
.login-chip button:hover { color: var(--neg); }
dialog { border: 0; border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 26px; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog h2 { margin-bottom: 18px; }
.dialog-fuss { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--toast-bg); color: var(--toast-fg); padding: 11px 20px; border-radius: 999px; font-weight: 500; z-index: 50; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); max-width: calc(100vw - 32px); }
.toast.fehler { background: var(--neg); color: #fff; }

/* ---------------------------------------------------------------- Mobil */
@media (max-width: 980px) {
  .g2, .g-3-2, .g-detail { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vitals { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 20; flex-direction: row;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--side-line); gap: 2px;
  }
  .side .logo, .side .produkt, .side .wer { display: none; }
  .side .fuss { margin: 0; flex-direction: row; flex: 0 0 auto; }
  .side nav { display: flex; flex: 1; gap: 2px; }
  .nav-item { flex-direction: column; gap: 3px; font-size: 11px; padding: 7px 4px; text-align: center; align-items: center; flex: 1; }
  .nav-item .badge { position: absolute; margin: -4px 0 0 26px; }
  .fuss .nav-item span { display: none; }
  .fuss .nav-item { flex: 0 0 44px; }
  .main { padding: 22px 16px 110px; }
  h1 { font-size: 22px; }
  .card { padding: 18px 16px; }
  .reihe, .metriken, .fakten { grid-template-columns: minmax(0, 1fr); }
  .zeile { grid-template-columns: minmax(0, 1fr) auto; }
  .zeile .nr { display: none; }
  .daten { grid-template-columns: 104px minmax(0, 1fr); }
  .schritt span { display: none; }
  .schritt.jetzt span { display: block; overflow: visible; }
  .tab .weg-mobil { display: none; }
}
