/* EnoDisc 2 (AL-515) - Weboberflaeche im Stil des ECS-Dashboards (Entwurf 30.10.2026)
   Farben, Abstaende und Bausteine aus dashboard/index.html (DEUTA-Rot #cc0000, dunkel/hell).
   CSP des Geraets: default-src 'self' -> keine Inline-Skripte, keine style-Attribute im HTML. */
:root {
  --bg: #0d1117; --bg2: #161b27; --bg3: #1e2435; --text: #ffffff; --text2: #c9d1e0; --text3: #8892a4;
  --border: rgba(255,255,255,0.12); --green: #3ddc97; --amber: #ffb830; --red: #ff5555; --blue: #58a6ff;
  --sidebar: #090d14; --brand: #cc0000; --brand-soft: rgba(204,0,0,0.18); --brand-soft2: rgba(204,0,0,0.10);
  --hover: rgba(255,255,255,0.07); --field: #171d2b; --dlg: #222a3d; --dlg-border: rgba(255,255,255,0.30);
}
body.light {
  --bg: #f1f3f7; --bg2: #ffffff; --bg3: #e7eaf0; --text: #1a1e26; --text2: #3a414b; --text3: #6a7280;
  --border: rgba(0,0,0,0.10); --sidebar: #ebedf2; --brand-soft: rgba(204,0,0,0.12); --brand-soft2: rgba(204,0,0,0.06);
  --green: #1a8c5d; --amber: #b76e00; --red: #c0392b; --blue: #1e6cb8;
  --hover: rgba(0,0,0,0.05); --field: #f6f7fa; --dlg: #ffffff; --dlg-border: rgba(0,0,0,0.18);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14px;
  background: var(--bg); color: var(--text); display: flex; flex-direction: column; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: var(--blue); }

/* LAYOUT */
#app { display: flex; flex: 1; overflow: hidden; }
.sidebar { width: 196px; background: var(--sidebar); border-right: 1px solid var(--border); display: flex;
  flex-direction: column; padding: 14px 12px; gap: 4px; flex-shrink: 0; overflow-y: auto; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; height: 48px; margin-bottom: 14px; padding: 4px 8px; }
.sidebar-logo svg { width: 40px; height: 40px; flex-shrink: 0; }
.sidebar-logo .dc-d { fill: #ffffff; }
body.light .sidebar-logo .dc-d { fill: #000000; }
.sidebar-logo-text { font-size: 13px; font-weight: 600; color: var(--text2); line-height: 1.2; }
.sidebar-logo-text small { display: block; font-size: 10px; font-weight: 400; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px; }
.nav-btn { width: 100%; height: 38px; border-radius: 8px; display: flex; align-items: center; gap: 12px; padding: 0 12px;
  cursor: pointer; color: var(--text3); font-size: 14px; font-weight: 500; border: none; background: transparent;
  position: relative; text-align: left; transition: all 0.15s; }
.nav-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-btn:hover { color: var(--text2); background: var(--hover); }
.nav-btn.active { background: var(--brand-soft2); color: var(--brand); }
.nav-btn.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; background: var(--brand); border-radius: 0 2px 2px 0; }
.nav-sep { height: 1px; background: var(--border); margin: 6px 12px; }
.nav-role { margin-left: auto; font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 10px;
  border: 1px solid var(--text3); color: var(--text3); line-height: 1.4; }
.sidebar-foot { margin-top: auto; padding: 10px 8px 0; font-size: 11px; color: var(--text3); line-height: 1.5; font-family: monospace; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; flex-wrap: wrap; }
.topbar-title { font-size: 21px; font-weight: 500; }
.topbar-sub { font-size: 14px; color: var(--text3); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-chip { font-size: 13px; color: var(--text2); display: flex; align-items: center; gap: 6px; }
.user-chip b { color: var(--text); }
.pill-btn { font-size: 13px; padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border); background: transparent; color: var(--text2); cursor: pointer; font-weight: 600; }
.pill-btn:hover { color: var(--text); border-color: var(--text3); }
.content { flex: 1; padding: 16px; overflow-y: auto; }
.banner { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 13.5px;
  background: rgba(255,85,85,0.12); color: var(--red); border: 1px solid rgba(255,85,85,0.35); }
.banner.info { background: rgba(88,166,255,0.10); color: var(--blue); border-color: rgba(88,166,255,0.35); }

/* BADGES */
.badge { font-size: 12px; padding: 4px 11px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.badge-green { background: rgba(61,220,151,0.18); color: var(--green); }
.badge-amber { background: rgba(255,184,48,0.18); color: var(--amber); }
.badge-red { background: rgba(255,85,85,0.18); color: var(--red); }
.badge-gray { background: var(--hover); color: var(--text3); }
.badge-blue { background: rgba(88,166,255,0.15); color: var(--blue); }

/* METRICS + CARDS */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.metric { background: var(--bg2); border-radius: 12px; padding: 14px 16px; border: 1px solid var(--border); min-width: 0; }
.metric-label { font-size: 13px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 10px; }
.metric-value { font-size: 24px; font-weight: 500; line-height: 1.1; overflow-wrap: anywhere; }
.metric-sub { font-size: 12px; color: var(--text3); margin-top: 6px; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card { background: var(--bg2); border-radius: 12px; padding: 16px; border: 1px solid var(--border); min-width: 0; }
.card + .card { margin-top: 12px; }
.col > .card + .card, .grid2 > .card + .card, .grid3 > .card + .card { margin-top: 0; }
.card-title { font-size: 14px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-hint { font-size: 12.5px; color: var(--text3); margin: -4px 0 12px; line-height: 1.5; }
.v-green { color: var(--green) !important; } .v-amber { color: var(--amber) !important; }
.v-red { color: var(--red) !important; } .v-blue { color: var(--blue) !important; } .v-muted { color: var(--text3) !important; }

/* STATUS-ZEILEN */
.status-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.status-row:last-child { border-bottom: none; }
.status-name { color: var(--text2); font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.status-val { font-size: 13.5px; font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.status-val small { display: block; font-weight: 500; color: var(--text3); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dot-g { background: var(--green); } .dot-a { background: var(--amber); } .dot-r { background: var(--red); }
.dot-b { background: var(--blue); } .dot-off { background: transparent; border: 1px solid var(--text3); }
.dot.blink { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.mono { font-family: Consolas, "Courier New", monospace; }

/* BALKEN (Speicher) */
.bar { height: 8px; border-radius: 4px; background: var(--bg3); overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.bar.warn > span { background: var(--amber); }

/* TABELLEN */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { overflow-wrap: anywhere; }
.empty { text-align: center; color: var(--text3); padding: 26px; }
.rssi-good { color: var(--green); font-weight: 700; } .rssi-mid { color: var(--amber); font-weight: 700; } .rssi-bad { color: var(--red); font-weight: 700; }

/* FORMULARE */
.form-row { display: grid; grid-template-columns: minmax(150px, 30%) minmax(0, 1fr); gap: 6px 14px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.form-row:last-of-type { border-bottom: none; }
.form-row > label { font-weight: 600; color: var(--text2); padding-top: 7px; }
.form-row .help { grid-column: 2; font-size: 12px; color: var(--text3); line-height: 1.45; margin-top: -2px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; max-width: 420px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--field); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { max-width: none; min-height: 120px; font-family: Consolas, monospace; font-size: 12.5px; }
input.invalid { border-color: var(--red); background: rgba(255,85,85,0.08); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: none; background: transparent; color: var(--text2); padding: 7px 14px; cursor: pointer; font-weight: 600; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--brand); color: #fff; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; margin-top: 4px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--bg3); border-radius: 24px; border: 1px solid var(--border); cursor: pointer; transition: 0.15s; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: var(--text3); border-radius: 50%; transition: 0.15s; }
.switch input:checked + span { background: var(--brand); border-color: var(--brand); }
.switch input:checked + span::before { transform: translateX(18px); background: #fff; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.actions .msg { margin-right: auto; font-size: 13px; }
.btn { padding: 7px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg3); color: var(--text); cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--text3); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); border-color: var(--brand); }
.btn-danger { color: var(--red); border-color: rgba(255,85,85,0.45); background: transparent; }
.btn-sm { padding: 3px 10px; font-size: 12.5px; }
.btn:disabled { opacity: 0.45; cursor: default; }

/* LEDs */
.leds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.led { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg3); font-size: 13px; }
.led b { display: block; font-size: 13px; }
.led small { color: var(--text3); }
.led .dot { width: 12px; height: 12px; }

/* ZERTIFIKATE */
.slot { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.slot:last-child { border-bottom: none; }
.slot-nr { width: 30px; height: 30px; border-radius: 8px; background: var(--bg3); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--text3); font-size: 13px; }
.slot-nr.used { background: var(--brand-soft2); color: var(--brand); }
.slot-main b { display: block; overflow-wrap: anywhere; }
.slot-main small { color: var(--text3); display: block; font-size: 12px; overflow-wrap: anywhere; }
.service { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.service:last-child { border-bottom: none; }
.service > b { font-size: 13.5px; }

/* DIALOG */
.dialog { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.box { background: var(--dlg); border: 1px solid var(--dlg-border); border-top: 3px solid var(--brand); border-radius: 12px; width: min(420px, 100%); padding: 22px; box-shadow: 0 18px 50px rgba(0,0,0,0.45); }
.box h2 { margin: 0 0 4px; font-size: 18px; }
.box .sub { color: var(--text3); font-size: 13px; margin-bottom: 16px; }
.box label { display: block; font-weight: 600; color: var(--text2); margin: 12px 0 5px; font-size: 13px; }
.box input { max-width: none; }
.box .error { color: var(--red); font-size: 13px; margin-top: 10px; }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.login-logo svg { width: 42px; height: 42px; }
.login-logo .dc-d { fill: var(--text); }

/* LIVE */
.live-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.live-tools input { max-width: 220px; }
.live-tools .info { margin-left: auto; font-size: 12.5px; color: var(--text3); }
tr.tx td:nth-child(2) { color: var(--blue); }
td.est { color: var(--text3); }

/* UPDATE */
.drop { border: 2px dashed var(--border); border-radius: 12px; padding: 26px; text-align: center; color: var(--text3); }
.drop b { color: var(--text2); }
.progress { height: 8px; border-radius: 4px; background: var(--bg3); overflow: hidden; margin-top: 12px; }
.progress > span { display: block; height: 100%; width: 0; background: var(--brand); }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 60; background: var(--dlg); border: 1px solid var(--dlg-border); border-left: 4px solid var(--green);
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,0.35); }
.toast.err { border-left-color: var(--red); }
.demo-flag { position: fixed; right: 12px; bottom: 6px; font-size: 11px; color: var(--amber); font-weight: 700; letter-spacing: 0.06em; opacity: 0.8; }

/* SCHMAL */
@media (max-width: 1100px) { .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .leds { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  #app { flex-direction: column; overflow: visible; } body { display: block; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 8px; }
  .sidebar-logo, .sidebar-foot, .nav-sep { display: none; }
  .nav-btn { width: auto; flex-shrink: 0; } .nav-btn.active::before { display: none; } .nav-role { display: none; }
  .main { overflow: visible; } .content { overflow: visible; padding: 12px; }
  .metrics, .grid2, .grid3, .leds { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: minmax(0, 1fr); } .form-row .help { grid-column: 1; }
}
