:root {
  --bg: #0a0a0f; --bg2: #14141f; --bg3: #1a1a2e; --bdr: #2a2a3e;
  --txt: #f0f0f8; --dim: #c4c4d8; --alk: #6c5ce7;
  --alk-g: rgba(108, 92, 231, .35); --go: #00b894; --warn: #fdcb6e; --err: #f87171;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(108, 92, 231, .18), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(0, 184, 148, .10), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--txt);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

header.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 10, 15, .82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bdr);
}
.top-inner {
  max-width: 680px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px clamp(16px, 3vw, 40px);
}
body.admin .top-inner { max-width: min(1500px, 95vw); }   /* Admin-Bar so breit wie der Admin-Inhalt */
header.top .brand { font-weight: 800; font-size: 25px; letter-spacing: .01em; }
header.top .brand b { color: var(--alk); }
header.top nav { display: flex; align-items: center; gap: 8px; }
header.top nav a, header.top nav button {
  font-size: 14px; font-weight: 600; color: var(--dim); font-family: inherit; cursor: pointer;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--bdr); background: var(--bg2);
  transition: all .15s;
}
header.top nav a:hover, header.top nav button:hover { color: var(--txt); border-color: var(--alk); }
.top-left { display: flex; align-items: center; gap: 12px; }

/* Burger + Sidebar-Drawer (Admin) */
.burger {
  display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
  border-radius: 11px; border: 1px solid var(--bdr); background: var(--bg2); color: var(--txt);
  cursor: pointer; padding: 0; transition: border-color .15s, background .15s;
}
.burger:hover { border-color: var(--alk); background: var(--bg3); }
.sidebar {
  position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; width: 250px; z-index: 40;
  background: var(--bg2); border-right: 1px solid var(--bdr);
  transform: translateX(-100%); transition: transform .22s ease;
  display: flex; flex-direction: column; padding: 18px 14px;
}
body.nav-open .sidebar { transform: translateX(0); box-shadow: 0 0 48px rgba(0, 0, 0, .55); }
.sidebar-brand { font-weight: 800; font-size: 20px; padding: 6px 12px 16px; }
.sidebar-brand b { color: var(--alk); }
.sidebar-nav { display: flex; flex-direction: column; gap: 6px; }
.sidebar-nav a { padding: 12px 14px; border-radius: 11px; color: var(--dim); font-weight: 600; font-size: 16px; transition: all .12s; }
.sidebar-nav a:hover { background: var(--bg3); color: var(--txt); }
.sidebar-nav a.active { background: var(--alk); color: #fff; }
.sidebar-logout { margin-top: auto; padding: 12px 14px; border-radius: 11px; color: var(--dim); border: 1px solid var(--bdr); text-align: center; font-weight: 600; transition: all .15s; }
.sidebar-logout:hover { border-color: var(--err); color: var(--err); }

/* Als installierte PWA (Standalone) die volle Höhe nutzen, aber Safe-Areas (Notch/Home-Indicator) beachten */
@media (display-mode: standalone) {
  .top-inner { padding-top: calc(16px + env(safe-area-inset-top)); }
  .sidebar { padding-top: calc(18px + env(safe-area-inset-top)); padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .wrap { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
}
.nav-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .2s; }
body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

/* Ab Laptop/Querformat: Top-Bar bleibt oben (Schriftzug), Sidebar dauerhaft darunter.
   Body bekommt links Platz für die Sidebar → Inhalt zentriert sich wieder von selbst. */
@media (min-width: 1000px) {
  body.admin { padding-left: 250px; }
  body.admin header.top { width: calc(100% + 250px); margin-left: -250px; flex-shrink: 0; }
  body.admin .top-inner { max-width: none; height: 58px; padding-top: 0; padding-bottom: 0; }
  body.admin .burger { display: none; }
  body.admin .sidebar { transform: none; box-shadow: none; top: 59px; height: calc(100dvh - 59px); }
  body.admin .sidebar-brand { display: none; }
  body.admin .nav-backdrop { display: none; }
  /* Admin nutzt ab Desktop die volle Breite (neben der Sidebar), nicht auf 1500px gedeckelt */
  body.admin .wrap.wide { max-width: none; margin: 0; padding-right: 28px; }
}

body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
/* width:100% ist nötig, weil margin:0 auto im Flex-Column-Body sonst align-items:stretch
   abschaltet und .wrap auf die Inhaltsbreite schrumpft (Seiten mit wenig Inhalt wurden schmal). */
.wrap { flex: 1 0 auto; width: 100%; max-width: 680px; margin: 0 auto; padding: 12px 20px 90px; }
.wrap.wide { max-width: min(1500px, 95vw); }

h1 { font-size: clamp(28px, 6vw, 38px); font-weight: 900; letter-spacing: -.02em; margin-bottom: 8px; }
h1 .grad { background: linear-gradient(120deg, var(--alk), #55efc4); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
h2 { font-size: 19px; font-weight: 700; margin: 26px 0 12px; }
.sub { color: var(--dim); font-size: 16px; line-height: 1.5; margin-bottom: 22px; }

.card {
  border: 1px solid var(--bdr); border-radius: 18px; background: rgba(20, 20, 31, .94);
  padding: 18px;
}
.card + .card { margin-top: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 20px; border-radius: 13px; border: 2px solid var(--bdr);
  background: var(--bg2); color: var(--txt); font-size: 16px; font-weight: 700;
  cursor: pointer; transition: transform .1s, border-color .15s, background .15s;
  font-family: inherit;
}
.btn:hover { border-color: var(--alk); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(120deg, var(--alk), #7d6cf0); border-color: transparent; color: #fff; box-shadow: 0 4px 14px var(--alk-g); }
.btn.danger { border-color: rgba(248, 113, 113, .4); color: var(--err); }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 14px; font-size: 14px; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; vertical-align: middle; }
.pill.alk { background: var(--alk-g); color: #cdc4ff; }
.pill.go { background: rgba(0, 184, 148, .2); color: #63e6be; }
.pill.err { background: rgba(248, 113, 113, .2); color: #ffa8a8; }
.pill.warn { background: rgba(253, 203, 110, .18); color: #ffd98a; }
.pill.neutral { background: rgba(255, 255, 255, .10); color: var(--dim); }

input, select {
  padding: 12px 14px; border-radius: 11px; border: 2px solid var(--bdr);
  background: var(--bg); color: var(--txt); font-size: 16px; outline: none; width: 100%;
  font-family: inherit;
}
input:focus, select:focus { border-color: var(--alk); }

/* Hübschere Selects statt Standard-Browser-Dropdown */
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 42px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a8a8c0' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 15px;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
select:hover { border-color: #3b3b55; background-color: var(--bg2); }
select:focus {
  box-shadow: 0 0 0 3px var(--alk-g);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c5ce7' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
select option { background: var(--bg2); color: var(--txt); }
select:required:invalid, select:has(option[value=""]:checked) { color: var(--dim); }

/* Voll gestyltes Custom-Dropdown (ersetzt native <select> im Builder/Admin) */
.csel { position: relative; width: 100%; min-width: 0; font-family: inherit; }
.csel-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-radius: 11px; border: 2px solid var(--bdr);
  background: var(--bg); color: var(--txt); font-size: 16px; cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s; user-select: none;
}
.csel-trigger:hover { border-color: #3b3b55; background: var(--bg2); }
.csel.open .csel-trigger { border-color: var(--alk); box-shadow: 0 0 0 3px var(--alk-g); }
.csel-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.csel-label.placeholder { color: var(--dim); }
.csel-chev { flex-shrink: 0; width: 16px; height: 16px; color: var(--dim); transition: transform .18s, color .18s; }
.csel.open .csel-chev { transform: rotate(180deg); color: var(--alk); }
.csel-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 1000;
  background: var(--bg2); border: 2px solid var(--bdr); border-radius: 12px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .55); padding: 6px; max-height: 280px;
  overflow-y: auto; display: none; animation: cselIn .12s ease;
}
.csel.open .csel-menu { display: block; }
.csel-opt { padding: 11px 12px; border-radius: 8px; font-size: 16px; cursor: pointer; transition: background .1s; }
.csel-opt:hover { background: var(--bg3); }
.csel-opt.sel { background: var(--alk-g); color: #fff; }
.csel-opt .tag { font-size: 12px; color: var(--dim); margin-left: 6px; }
.csel-opt.sel .tag { color: #cdc4ff; }
@keyframes cselIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
label { display: block; font-size: 13px; color: var(--dim); margin-bottom: 6px; }

.notice { padding: 16px; border-radius: 13px; background: rgba(253, 203, 110, .1); border: 1px solid rgba(253, 203, 110, .3); color: var(--warn); }
.error { padding: 14px; border-radius: 13px; background: rgba(248, 113, 113, .12); border: 1px solid rgba(248, 113, 113, .35); color: #ffb4b4; }

/* Builder */
.counter { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.counter .big { font-size: 30px; font-weight: 900; }
.counter .big small { font-size: 15px; color: var(--dim); font-weight: 600; }
.slot { display: flex; gap: 12px; align-items: center; }
.slot > div:first-child { min-width: 0; }
.slot .stepper { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.stepper .num { min-width: 26px; text-align: center; font-weight: 800; font-size: 18px; }
.ml { font-size: 13px; color: var(--dim); margin-top: 6px; }

/* Code */
.code-big {
  font-size: clamp(64px, 20vw, 104px); font-weight: 900; letter-spacing: .12em;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--alk);
  text-shadow: 0 8px 40px var(--alk-g);
}
.row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--bdr); }
.row:last-child { border-bottom: none; }
.mono { font-family: ui-monospace, monospace; color: var(--dim); }

/* Dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.tile { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 84px; }
.tiles .card + .card { margin-top: 0; }  /* Grid-Kacheln: kein Stack-Margin (sonst wird die erste höher) */
.spark-tile { position: relative; overflow: hidden; }
.spark-tile .v, .spark-tile .l { position: relative; z-index: 1; }
.spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 60%; z-index: 0; }
.spark-line { fill: none; stroke: var(--alk); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-area { fill: var(--alk-g); stroke: none; opacity: .55; }

/* Skeleton-Ladezustand (Dashboard lädt Zahlen async nach) */
.skel-box { display: inline-block; width: 54px; height: 30px; border-radius: 8px; }
.skel-row { height: 15px; border-radius: 6px; margin: 13px 4px; }
.skel-box, .skel-row { background: linear-gradient(90deg, var(--bg3) 25%, #26263c 37%, var(--bg3) 63%); background-size: 400% 100%; animation: skelsh 1.4s ease infinite; }
@keyframes skelsh { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
[data-loading] input, [data-loading] .switch { opacity: .45; pointer-events: none; }
.tile .v { font-size: 34px; font-weight: 900; color: var(--alk); }
.tile .l { font-size: 13px; color: var(--dim); }
.meter { height: 12px; border-radius: 7px; background: var(--bg3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--alk), #7d6cf0); }
.meter.low > span { background: var(--warn); }
.meter.empty > span { background: var(--err); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 148px; }
.bars .b { flex: 1; text-align: center; }
.bars .b > i { display: block; background: var(--alk); border-radius: 4px 4px 0 0; }
.bars .b > span { font-size: 11px; color: var(--dim); }
.subnav { display: flex; gap: 8px; margin: 6px 0 22px; flex-wrap: wrap; }
.subnav a {
  padding: 10px 18px; border-radius: 11px; border: 1px solid var(--bdr);
  background: var(--bg2); color: var(--dim); font-size: 15px; font-weight: 600; transition: all .15s;
}
.subnav a:hover { color: var(--txt); border-color: #3b3b55; }
.subnav a.active { background: var(--alk); border-color: var(--alk); color: #fff; box-shadow: 0 6px 20px var(--alk-g); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.dash-cols { align-items: start; margin-top: 26px; }
.dash-cols h2 { margin-top: 0; }

/* Dashboard: Health-Hero-Karten (klickbar → Detailseiten) */
.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px 0 0; }
.hcard { display: flex; flex-direction: column; color: var(--txt); text-decoration: none; transition: border-color .15s, transform .12s; }
.hcard:hover { border-color: var(--alk); transform: translateY(-2px); }
.hcard-main { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; line-height: 1.15; margin-bottom: 3px; }
.hcard .sub2 { flex: 1; }
.hcard-go { margin-top: 12px; font-size: 13px; font-weight: 700; color: var(--dim); transition: color .15s; }
.hcard:hover .hcard-go { color: var(--alk); }
.hdot { width: 14px; height: 14px; border-radius: 50%; background: #555; flex-shrink: 0; }
.hdot.ok { background: var(--go); animation: pulse 1.5s ease-out infinite; }
.hdot.warn { background: var(--warn); }
.hdot.crit { background: var(--err); animation: pulseErr 1.3s ease-out infinite; }
@keyframes pulseErr {
  0% { box-shadow: 0 0 0 0 rgba(248, 113, 113, .55); }
  70% { box-shadow: 0 0 0 9px rgba(248, 113, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0); }
}

/* Live-Monitoring: Ereignis-Log */
.log-panel { padding: 0; overflow: hidden; }
.log { max-height: 340px; overflow-y: auto; }
.log-row { display: flex; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--bdr); font-size: 14px; border-left: 3px solid transparent; }
.log-row:last-child { border-bottom: none; }
.log-t { color: var(--dim); font-family: ui-monospace, monospace; font-size: 13px; flex-shrink: 0; }
.log-msg { min-width: 0; word-break: break-word; }
.log-row.start { border-left-color: var(--alk); }
.log-row.done  { border-left-color: var(--go); }
.log-row.ing   { border-left-color: #40c4ff; }
.log-row.led   { border-left-color: var(--warn); }
.log-row.err   { border-left-color: var(--err); }
.log-empty { padding: 24px 16px; color: var(--dim); text-align: center; }

/* Glas-Visualisierung der Zusammensetzung (Code-Seite) */
.glassbox { display: flex; justify-content: center; margin: 6px 0 18px; }
.glass {
  position: relative; width: 220px; height: 320px;
  border: 3px solid #4a4a63; border-top: none; border-radius: 12px 12px 30px 30px;
  overflow: hidden;
  background: rgba(255, 255, 255, .015);
  box-shadow: inset 0 -10px 40px rgba(0, 0, 0, .35), 0 12px 30px rgba(0, 0, 0, .4);
}
.liquid {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(100% - 20px);
  display: flex; flex-direction: column-reverse; overflow: hidden;
}
.liquid::before { /* Flüssigkeitsoberfläche */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; z-index: 3;
  background: rgba(255, 255, 255, .18);
}
.glass::after { /* Glanzstreifen */
  content: ""; position: absolute; top: 0; left: 12px; width: 26px; height: 100%;
  background: linear-gradient(to right, rgba(255, 255, 255, .10), transparent);
  z-index: 4; pointer-events: none;
}
.layer {
  position: relative; display: flex; align-items: center; justify-content: center;
  text-align: center; overflow: hidden; min-height: 26px;
}
.layer .lbl {
  position: relative; z-index: 3; font-size: 15px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .6); padding: 2px 8px; line-height: 1.15;
}
.layer .lbl small { display: block; font-weight: 600; opacity: .9; font-size: 12px; letter-spacing: .02em; }
.bubbles { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.bubbles i {
  position: absolute; bottom: -12px; border-radius: 50%;
  background: rgba(255, 255, 255, .45); animation: rise linear infinite;
}
@keyframes rise {
  0% { transform: translateY(0) scale(.5); opacity: 0; }
  12% { opacity: .75; }
  100% { transform: translateY(-340px) scale(1); opacity: 0; }
}

/* "Nicht verfügbar" + Kontakt-Block */
.offbox { text-align: center; padding: 34px 24px; margin-top: 8px; }
.offbox .ttl { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.offbox hr { border: none; border-top: 1px solid var(--bdr); margin: 24px 0; }
.offic { margin-bottom: 12px; line-height: 0; }
@keyframes shimmer { 0% { transform: translateY(0); opacity: .9; } 100% { transform: translateY(-16px); opacity: 0; } }
.i-cocktail .shimmer  { animation: shimmer 1.6s ease-out infinite; }
.i-cocktail .shimmer2 { animation: shimmer 1.9s ease-out infinite .45s; }
.i-cocktail .shimmer3 { animation: shimmer 1.5s ease-out infinite .85s; }
.i-cocktail .shimmer4 { animation: shimmer 1.75s ease-out infinite .25s; }

/* Live-Monitor: Statuspunkte, Panels, Steuerung */
.statusbar {
  display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center;
  padding: 12px 16px; border: 1px solid var(--bdr); border-radius: 14px;
  background: rgba(20, 20, 31, .55); margin-bottom: 20px;
}
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--dim); }
.status b { color: var(--txt); font-weight: 700; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #555; flex-shrink: 0; }
.dot.on { background: var(--go); box-shadow: 0 0 0 0 rgba(0, 184, 148, .6); animation: pulse 1.5s ease-out infinite; }
.dot.off { background: var(--err); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 184, 148, .55); }
  70% { box-shadow: 0 0 0 9px rgba(0, 184, 148, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 184, 148, 0); }
}

/* Live-Bereich: Spiegel links, Panels rechts (ab ~1000px zweispaltig) */
.livetop { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
@media (min-width: 1000px) { .livetop { grid-template-columns: minmax(0, 520px) 1fr; align-items: start; } }
.livegrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.panel { border: 1px solid var(--bdr); border-radius: 16px; background: rgba(20, 20, 31, .94); padding: 16px; }
.panel h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin-bottom: 10px; }
.panel .big { font-size: clamp(26px, 7vw, 38px); font-weight: 900; line-height: 1.1; }
.panel .big small { font-size: 15px; color: var(--dim); font-weight: 600; }
.panel .sub2 { font-size: 14px; color: var(--dim); margin-top: 4px; }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--bg3); font-weight: 700; font-size: 15px; }

.leddot { width: 14px; height: 14px; border-radius: 50%; background: #555; display: inline-block; box-shadow: 0 0 8px rgba(0, 0, 0, .4); }

/* Echter Display-Spiegel (reales index.html im iframe, auf Panelbreite skaliert) */
.mirror-wrap { width: 100%; margin: 0 auto; aspect-ratio: 1024 / 600; position: relative; overflow: hidden; border: 3px solid #33334a; border-radius: 16px; background: #000; }
.mirror-wrap iframe { position: absolute; top: 0; left: 0; width: 1024px; height: 600px; border: 0; transform-origin: top left; }
.mirror-off { position: absolute; inset: 0; z-index: 5; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 20px; background: rgba(10, 10, 16, .985); color: var(--dim); font-weight: 700; font-size: 18px; }
.mirror-off small { font-weight: 500; font-size: 14px; }

/* Live-Spiegel des Hector-Displays */
.device {
  aspect-ratio: 16 / 10; width: 100%; max-width: 460px; margin: 0 auto;
  border: 3px solid #33334a; border-radius: 16px; overflow: hidden; position: relative;
  background: radial-gradient(130% 130% at 50% -10%, #17172b, #0a0a12);
  display: flex; align-items: center; justify-content: center; color: var(--txt);
}
.dev-scr { position: absolute; top: 8px; left: 11px; font-size: 11px; letter-spacing: .06em; color: var(--dim); font-family: ui-monospace, monospace; text-transform: uppercase; }
.dev-center { text-align: center; padding: 16px; width: 100%; }
.dev-title { font-size: clamp(18px, 5vw, 24px); font-weight: 800; }
.dev-sub { font-size: 14px; color: var(--dim); margin-top: 5px; }
.dev-drink { font-size: clamp(20px, 6vw, 28px); font-weight: 900; color: var(--alk); margin-top: 8px; }
.dev-home { display: flex; gap: 14px; width: 88%; margin: 0 auto; }
.dev-btn { flex: 1; height: clamp(70px, 18vw, 96px); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-weight: 800; border: 2px solid var(--bdr); font-size: 15px; text-align: center; }
.dev-btn.alk { border-color: rgba(108, 92, 231, .5); background: rgba(108, 92, 231, .14); }
.dev-btn.noalk { border-color: rgba(231, 76, 60, .5); background: rgba(231, 76, 60, .14); }
.dev-glass { width: 46px; height: 58px; border: 3px solid var(--dim); border-top: none; border-radius: 0 0 11px 11px; margin: 0 auto 10px; position: relative; overflow: hidden; }
.dev-glass > span { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(180deg, var(--alk), rgba(108, 92, 231, .5)); }
.dev-bar { height: 9px; border-radius: 6px; background: var(--bg3); overflow: hidden; margin-top: 12px; }
.dev-bar > span { display: block; height: 100%; background: var(--alk); transition: width .25s; }
.dev-ring { width: 54px; height: 54px; border-radius: 50%; border: 4px solid var(--go); margin: 0 auto 8px; }

.ctrl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ctrl-grid .btn { width: 100%; }
.hint { font-size: 13px; color: var(--warn); margin-top: 10px; }
.offline-note { font-size: 13px; color: var(--dim); }
.set-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }

/* Steuerung */
.ctrl-out { margin: 12px 0 20px; font-family: ui-monospace, monospace; font-size: 14px; color: var(--txt); }
.ctrl-out.flash { animation: outflash .6s ease; }
@keyframes outflash { 0% { border-color: var(--alk); box-shadow: 0 0 0 3px var(--alk-g); } 100% { border-color: var(--bdr); box-shadow: none; } }
.ctrl-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.cal { margin-top: 14px; border-top: 1px solid var(--bdr); padding-top: 14px; }
.cal-head { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); margin-bottom: 10px; }
.cal-steps { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.cal-set { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cal-set input { width: 240px; max-width: 100%; }
.flush-chans { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.fchan { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--bdr); border-radius: 11px; background: var(--bg2); cursor: pointer; font-size: 15px; transition: border-color .12s, background .12s; }
.fchan input { width: 18px; height: 18px; accent-color: var(--alk); flex-shrink: 0; }
.fchan span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchan.sel { border-color: var(--alk); background: var(--alk-g); }

/* Servos einzeln */
.servo-list { margin-top: 14px; border-top: 1px solid var(--bdr); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.servo-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.servo-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.servo-btns { display: flex; gap: 8px; flex-shrink: 0; }

/* Spül-Wizard */
.flush-step { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 6px 0; font-size: 16px; }
.flush-prog { font-size: 13px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.flush-cur { font-size: 22px; font-weight: 800; }

/* Verlauf: klickbare Custom-Zeile */
.row-click { cursor: pointer; margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 8px; transition: background .12s; }
.row-click:hover { background: var(--bg3); }
.row-more { font-size: 12px; color: var(--alk); margin-left: 8px; }

/* Verlauf */
.hist-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--bdr); background: var(--bg2); color: var(--dim); font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--alk); color: var(--txt); }
.chip.active { background: var(--alk-g); border-color: transparent; color: #cdc4ff; }
.hist-list .row:first-child { padding-top: 0; }
.hist-list .row:last-child { border-bottom: none; padding-bottom: 0; }
.hist-more { text-align: center; color: var(--dim); font-size: 14px; padding: 16px; }
.hist-end { text-align: center; color: var(--dim); font-size: 13px; padding: 18px; }

/* Eigene Mixe */
.mix-filters { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.mix-filter { display: flex; flex-direction: column; gap: 6px; }
.mix-filter label { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.mix-sort { min-width: 220px; }
.mix-count { color: var(--dim); font-size: 14px; margin-left: auto; align-self: center; }

/* Segmented Control */
.segmented { display: inline-flex; background: var(--bg2); border: 1px solid var(--bdr); border-radius: 11px; padding: 3px; gap: 3px; }
.seg { border: none; background: transparent; color: var(--dim); font-family: inherit; font-size: 14px; font-weight: 700; padding: 8px 14px; border-radius: 8px; cursor: pointer; transition: all .12s; }
.seg:hover { color: var(--txt); }
.seg.active { background: var(--alk); color: #fff; }

/* Zutaten-Filter (Mehrfachauswahl) */
.mix-ingfilter { margin-bottom: 18px; }
.mix-ingfilter > label { display: block; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.mix-ingnote { text-transform: none; letter-spacing: 0; font-weight: 400; }
.mix-ingnote b { color: var(--txt); }
.chipset { display: flex; flex-wrap: wrap; gap: 8px; }

.mix-card { border: 1px solid var(--bdr); border-radius: 16px; background: rgba(20, 20, 31, .94); padding: 16px 16px 16px 18px; margin-bottom: 12px; border-left-width: 4px; }
.mix-card.is-alk { border-left-color: var(--alk); }
.mix-card.is-non { border-left-color: var(--go); }
.mix-card.is-invalid { border-left-color: var(--err); }
.mix-invalid { color: #ffa8a8; }
.mix-invalid b { color: #ffa8a8; }
.mix-ing.missing { opacity: .6; border-style: dashed; }
.mix-miss { color: var(--err); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }

/* Import-Wizard: Diff */
.diff-block { margin-bottom: 14px; }
.diff-block h4 { font-size: 14px; margin-bottom: 6px; }
.diff-total { font-weight: 400; color: var(--dim); font-size: 13px; }
.diff-line { font-size: 14px; padding: 3px 0; word-break: break-word; }
.diff-line.add { color: #63e6be; }
.diff-line.chg { color: var(--warn); }
.diff-line.rem { color: #ffa8a8; }
.diff-line.diff-none { color: var(--dim); }
.import-warn { margin: 12px 0; padding: 12px 14px; border-radius: 11px; border: 1px solid rgba(253, 203, 110, .4); background: rgba(253, 203, 110, .12); color: var(--warn); font-size: 14px; font-weight: 600; }
.mix-recipe { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; }
.mix-ing { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 10px; background: var(--bg3); border: 1px solid var(--bdr); font-weight: 600; }
.mix-ing b { color: var(--dim); font-weight: 800; }
.mix-ing.alk { background: rgba(108, 92, 231, .16); border-color: rgba(108, 92, 231, .45); }
.mix-ing.alk b { color: var(--alk); }
.mix-plus { color: var(--dim); font-weight: 400; }
.mix-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 14px; color: var(--dim); }
.mix-stat b { color: var(--txt); font-weight: 800; }
.mix-codes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--bdr); }
.mix-codes-lbl { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.mix-del { margin-left: auto; font-size: 13px; padding: 5px 12px; border-radius: 8px; border: 1px solid var(--bdr); background: transparent; color: var(--dim); cursor: pointer; }
.mix-del:hover { border-color: var(--err); color: var(--err); background: rgba(248, 113, 113, .08); }
.mix-del:disabled { opacity: .5; cursor: default; }
.mix-code { font-family: ui-monospace, monospace; font-weight: 700; font-size: 13px; padding: 3px 9px; border-radius: 8px; background: var(--bg3); border: 1px solid var(--bdr); color: var(--dim); }
.mix-code.used { color: #63e6be; border-color: rgba(0, 184, 148, .3); }
.mix-code.match { background: var(--alk); color: #fff; border-color: transparent; box-shadow: 0 0 0 3px var(--alk-g); }
.mix-codesearch { width: 160px; font-family: ui-monospace, monospace; letter-spacing: .12em; }
@media (max-width: 560px) { .mix-filter, .mix-sort, .segmented { width: 100%; min-width: 0; } .segmented { justify-content: center; } .mix-count { margin-left: 0; } }

.set-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.set-row label { margin: 0; color: var(--txt); font-size: 15px; cursor: pointer; }
/* Echter Schiebe-Toggle */
.switch { position: relative; width: 54px; height: 30px; border-radius: 999px; background: var(--bg3); border: 2px solid var(--bdr); cursor: pointer; padding: 0; flex-shrink: 0; transition: background .2s, border-color .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #c8c8d8; transition: transform .2s, background .2s; }
.switch.on { background: var(--alk); border-color: var(--alk); }
.switch.on::after { transform: translateX(24px); background: #fff; }
.switch:active::after { width: 26px; }

/* Verwaltung: Kopf, Karten, Modal, Zutaten-Editor */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.page-head h1 { margin-bottom: 0; }

.mcard { display: flex; align-items: center; gap: 14px; justify-content: space-between; flex-wrap: wrap;
  border: 1px solid var(--bdr); border-radius: 14px; background: rgba(20, 20, 31, .7); padding: 14px 16px; margin-bottom: 10px; }
.mcard-main { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }
.mcard-title { font-weight: 800; font-size: 17px; }
.mcard-sub { font-size: 13px; color: var(--dim); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; }
.mcard-fill { min-width: 160px; flex: 1; max-width: 320px; }
.mcard-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chan { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 11px; background: var(--bg3); border: 1px solid var(--bdr); font-weight: 800; font-size: 15px; }

/* Mobil: Karten umbrechen – Füllbalken volle Breite, Aktionen volle Breite */
.btn-mini { display: none; }
@media (max-width: 620px) {
  .mcard-main { flex-wrap: wrap; }
  .mcard-fill { min-width: 100%; max-width: none; }
  .mcard-actions { width: 100%; }
  .mcard-actions .btn { flex: 1; }
  .btn-full { display: none; }
  .btn-mini { display: inline; }
}

.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 40px; overflow-y: auto; animation: cselIn .12s ease; }
.modal { width: 100%; max-width: 560px; background: var(--bg2); border: 1px solid var(--bdr); border-radius: 18px;
  padding: 22px; box-shadow: 0 24px 70px rgba(0, 0, 0, .55); }
.modal h2 { margin: 0; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-close { cursor: pointer; color: var(--dim); background: none; border: none; font-size: 26px; line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--txt); }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }

.ing-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ing-move { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.ing-move button { width: 30px; height: 20px; padding: 0; border-radius: 6px; border: 1px solid var(--bdr); background: var(--bg3);
  color: var(--dim); cursor: pointer; font-size: 11px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.ing-move button:hover:not(:disabled) { color: var(--txt); border-color: var(--alk); }
.ing-move button:disabled { opacity: .3; cursor: default; }
.ing-row .csel { flex: 1; min-width: 0; }
.ing-ml { width: 92px; flex-shrink: 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(10px); z-index: 80;
  background: var(--bg3); border: 1px solid var(--bdr); color: var(--txt); padding: 12px 18px; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; }
.btn.loading { pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Fußzeile / Kontakt */
body.admin .foot { display: none; }
.foot {
  max-width: 1080px; margin: 0 auto; padding: 22px 20px 40px; flex-shrink: 0; width: 100%;
  border-top: 1px solid var(--bdr); text-align: center; color: var(--dim); font-size: 14px;
}
.foot a { color: var(--alk); font-weight: 700; }
.foot a:hover { text-decoration: underline; }
.foot-links { margin-top: 8px; font-size: 13px; color: var(--dim); }
.foot-links a { color: var(--dim); font-weight: 600; }
.foot-links a:hover { color: var(--txt); }

/* Rechtsseiten (Impressum / Datenschutz) */
.legal { line-height: 1.65; padding-bottom: 40px; }
.legal h1 { margin-bottom: 18px; }
.legal h2 { font-size: 18px; margin: 28px 0 8px; }
.legal p, .legal li { color: var(--txt); }
.legal p { margin-bottom: 12px; }
.legal ul { margin: 0 0 12px 22px; }
.legal li { margin-bottom: 8px; }
.legal a { color: var(--alk); }

/* Gespeicherte Mixe (localStorage) */
.saved-item { border: 1px solid var(--bdr); border-radius: 14px; background: rgba(20, 20, 31, .94); padding: 14px; margin-bottom: 10px; }
.saved-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.saved-head .nm { font-weight: 800; font-size: 17px; }
.saved-head .dt { font-size: 12px; color: var(--dim); flex-shrink: 0; }
.ratio { display: flex; height: 36px; border-radius: 9px; overflow: hidden; border: 1px solid var(--bdr); }
.ratio > div {
  display: flex; align-items: center; justify-content: center; min-width: 0;
  color: #fff; font-size: 12px; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, .55);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 5px;
}
.saved-actions { display: flex; gap: 8px; margin-top: 10px; }
.notice.ok { background: rgba(0, 184, 148, .12); border-color: rgba(0, 184, 148, .35); color: #63e6be; }

/* Center layout for login/code */
.center { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
