/* SolixController – Mobile-first dark UI */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-bg:           #030712;
  --c-surface:      #111827;
  --c-border:       #1f2937;
  --c-text:         #e5e7eb;
  --c-muted:        #6b7280;
  --c-accent:       #facc15;
  --c-blue:         #3b82f6;
  --c-blue-hover:   #2563eb;
  --c-green:        #22c55e;
  --c-green-400:    #4ade80;
  --c-green-text:   #86efac;
  --c-red:          #ef4444;
  --c-orange:       #f97316;
  --nav-h:          56px;
  --content-max:    76rem;
  --radius-sm:      6px;
  --radius:         8px;
  --radius-lg:      12px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.4);
  --shadow:         0 4px 12px rgba(0,0,0,.5);
}
@media (min-width: 768px) {
  :root { --nav-h: 64px; }
}

/* ── Reset & Base ── */
html {
  height: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}
body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
@media (min-width: 768px) {
  body { font-size: 15px; }
}

/* Text selection */
::selection { background: rgba(59,130,246,0.3); color: #fff; }

/* Thin scrollbar on desktop */
@media (min-width: 768px) {
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }
  ::-webkit-scrollbar-thumb:hover { background: #4b5563; }
}

/* ── Navigation ── */
nav {
  background: #0d1117;
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  overflow: visible;
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
}
@media (min-width: 768px) {
  .nav-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 28px;
  }
}
.nav-logo {
  color: var(--c-accent);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.02em;
  white-space: nowrap;
  flex-shrink: 0;
}
@media (min-width: 768px) {
  .nav-logo { font-size: 18px; }
}

/* Desktop nav links – hidden on mobile */
.nav-links {
  display: none;
  gap: 2px;
}
@media (min-width: 768px) {
  .nav-links { display: flex; gap: 4px; }
}
.nav-link {
  color: #9ca3af;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  transition: all .15s;
  white-space: nowrap;
}
@media (min-width: 768px) {
  .nav-link { font-size: 14px; padding: 7px 14px; }
}
.nav-link:hover {
  color: #fff;
  background: #1f2937;
}
.nav-link.active {
  color: var(--c-accent);
  background: rgba(250, 204, 21, 0.08);
  font-weight: 600;
}

/* Hamburger – only on mobile */
.nav-hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  background: none;
  border: none;
  margin-left: auto;
}
@media (min-width: 768px) {
  .nav-hamburger { display: none; }
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #9ca3af;
  border-radius: 2px;
  transition: all .2s;
}

/* Mobile drawer */
.nav-drawer {
  display: flex;
  flex-direction: column;
  background: #0d1117;
  border-bottom: 1px solid var(--c-border);
  padding: 0 16px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transition: max-height 0.22s ease, opacity 0.18s ease, padding 0.18s ease;
}
.nav-drawer.open {
  max-height: 600px;
  opacity: 1;
  padding: 8px 16px 16px;
  pointer-events: auto;
}
.nav-drawer .nav-link {
  padding: 10px 12px;
  font-size: 15px;
  border-radius: 8px;
}
.nav-user {
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #6b7280;
}
@media (min-width: 768px) {
  .nav-user { display: flex; justify-content: flex-end; }
}

.nav-drawer-user {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: 13px;
  color: #6b7280;
}

/* ── Main layout ── */
main {
  flex: 1;
  padding: 16px;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
}
@media (min-width: 768px) {
  main { padding: 28px 28px; }
}

/* ── Cards ── */
.card,
.card-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 16px;
}
@media (min-width: 768px) {
  .card, .card-panel { padding: 20px; }
}
.card-label {
  font-size: 11.5px;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
@media (min-width: 768px) {
  .card-label { font-size: 12px; }
}
.card-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
@media (min-width: 768px) {
  .card-value { font-size: 28px; }
}
.section-title {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 14px;
}
@media (min-width: 768px) {
  .section-title { font-size: 13px; margin-bottom: 16px; }
}

/* ── Grids – mobile first ── */
.grid { display: grid; gap: 12px; }
/* Allow grid children to shrink below content size (fixes overflow-x: auto on iOS) */
.grid > * { min-width: 0; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.sm\:grid-cols-2 { grid-template-columns: 1fr; } /* 1 on mobile, 2 at sm */
.grid-cols-3 { grid-template-columns: repeat(2, 1fr); } /* 2 on mobile */
.grid-cols-4 { grid-template-columns: repeat(2, 1fr); } /* 2 on mobile */
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
  .grid { gap: 16px; }
  .grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
  .md\:grid-cols-6 { grid-template-columns: repeat(6, 1fr); }
}
.col-span-2 { grid-column: span 2; }

/* ── Buttons ── */
button, .btn,
a.btn-primary, a.btn-secondary, a.btn-danger, a.btn-warn,
label.btn-primary, label.btn-secondary, label.btn-danger {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
a.btn-primary, a.btn-secondary, a.btn-danger, a.btn-warn,
label.btn-primary, label.btn-secondary, label.btn-danger {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}
.btn-primary { background: var(--c-blue); color: #fff; }
.btn-primary:hover { background: var(--c-blue-hover); }
.btn-primary:active { background: #1d4ed8; }
.btn-secondary { background: #1f2937; color: #d1d5db; border: 1px solid var(--c-border); }
.btn-secondary:hover { background: #293548; border-color: #374151; }
.btn-secondary:active { background: #374151; }
.btn-warn { background: #7c3aed; color: #fff; }
.btn-warn:hover { background: #6d28d9; }
.btn-boost { background: #065f46; color: #6ee7b7; border: 1px solid #047857; }
.btn-boost:hover { background: #047857; }
.btn-danger { background: #7f1d1d; color: #fca5a5; border: 1px solid #991b1b; }
.btn-danger:hover { background: #991b1b; }
button:disabled, .btn:disabled, button[disabled], input[type="submit"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.w-full { width: 100%; }

/* ── Forms ── */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select, textarea {
  background: #0f172a;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  color: var(--c-text);
  padding: 10px 12px;
  font-size: 16px; /* 16px verhindert iOS Auto-Zoom! */
  font-family: inherit;
  width: 100%;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--c-blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
  outline: none;
}
::placeholder { color: #4b5563; opacity: 1; }
::-webkit-input-placeholder { color: #4b5563; }
.input-sm { padding: 8px 10px; font-size: 14px; width: auto; }
label { font-size: 12px; color: var(--c-muted); display: block; margin-bottom: 6px; }

/* Minimum 44px touch targets on mobile */
@media (max-width: 639px) {
  button, .btn, a.btn-primary, a.btn-secondary { min-height: 44px; }
  .nav-hamburger { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
}

/* ── Tables – scrollbar on mobile ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 480px; }
.mini-table th {
  text-align: left;
  color: var(--c-muted);
  font-weight: 500;
  padding: 6px 10px;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.mini-table td { padding: 6px 10px; border-bottom: 1px solid #0d1117; }
.mini-table tr:last-child td { border-bottom: none; }
.mini-table tr:hover td { background: #0f172a; }
@media (min-width: 768px) {
  .mini-table { font-size: 13.5px; }
  .mini-table th, .mini-table td { padding: 9px 14px; }
}

/* ── Badges ── */
.badge-yellow { background: #451a03; color: var(--c-accent); border: 1px solid #92400e; border-radius: 4px; padding: 2px 8px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-red    { background: #450a0a; color: #f87171; border: 1px solid #7f1d1d; border-radius: 4px; padding: 2px 8px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-green  { background: #052e16; color: #86efac; border: 1px solid #14532d; border-radius: 4px; padding: 2px 8px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.state-badge  { font-size: 11px; padding: 2px 6px; border-radius: 3px; background: #1f2937; color: #9ca3af; font-family: monospace; white-space: nowrap; }

/* ── Status strip ── */
.status-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.status-pill {
  background: #1f2937;
  border: 1px solid var(--c-border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-green  { background: #22c55e; }
.dot-red    { background: #ef4444; }
.dot-yellow { background: #facc15; }
.dot-gray   { background: #4b5563; }

/* ── Charts ── */
.chart-container    { position: relative; height: 180px; }
.chart-container-lg { position: relative; height: 260px; }
@media (min-width: 768px) {
  .chart-container    { height: 220px; }
  .chart-container-lg { height: 380px; }
}

/* ── Spacing helpers ── */
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 20px; }
@media (min-width: 768px) {
  .space-y-6 > * + * { margin-top: 24px; }
}

/* ── Flex helpers ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

/* ── Misc ── */
.mono { font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace; }
.text-xs  { font-size: 11px; }
.text-sm  { font-size: 12px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.rounded { border-radius: 8px; }
.overflow-x-auto { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.border   { border: 1px solid var(--c-border); }
.border-b { border-bottom: 1px solid var(--c-border); }
.border-t { border-top: 1px solid var(--c-border); }
.p-3  { padding: 12px; }
.p-6  { padding: 24px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.mt-1 { margin-top: 4px; }
.mb-4 { margin-bottom: 16px; }
.ml-2 { margin-left: 8px; }
.font-bold    { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-mono    { font-family: monospace; }
.tracking-tight { letter-spacing: -.025em; }
.text-lg  { font-size: 18px; }
.text-2xl { font-size: 22px; }
@media (min-width: 768px) { .text-2xl { font-size: 26px; } }
.transition { transition: all .15s; }
.max-w-7xl { max-width: var(--content-max); }

/* ── Keyboard focus ring (hides on mouse, shows on keyboard) ── */
:focus-visible {
  outline: 2px solid var(--c-blue);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ── Footer max-width consistency ── */
footer { max-width: var(--content-max); margin-left: auto; margin-right: auto; width: 100%; }

/* ── Card hover lift (interactive cards only) ── */
a.card, a.card-panel {
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
a.card:hover, a.card-panel:hover {
  border-color: #374151;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* ── Nav active link underline indicator ── */
.nav-link.active {
  position: relative;
}
@media (min-width: 768px) {
  .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--c-accent);
    border-radius: 1px;
  }
}

/* ── Utility: text colors using design tokens ── */
.text-green { color: var(--c-green); }
.text-green-400 { color: var(--c-green-400); }
.text-green-subtle { color: var(--c-green-text); }
.text-red { color: var(--c-red); }
.text-orange { color: var(--c-orange); }
.text-blue { color: var(--c-blue); }
.text-accent { color: var(--c-accent); }
.text-muted { color: var(--c-muted); }
.text-white { color: #fff; }
.text-gray-300 { color: #d1d5db; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.mx-auto { margin-left: auto; margin-right: auto; }
.w-20 { width: 5rem; }
.min-h-full { min-height: 100%; }
.h-full { height: 100%; }

/* ── Colors ── */
.text-white    { color: #fff; }
.text-gray-100 { color: #f3f4f6; }
.text-gray-200 { color: #e5e7eb; }
.text-gray-300 { color: #d1d5db; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-blue-400   { color: #60a5fa; }
.text-green-400  { color: #4ade80; }
.text-green-500  { color: #22c55e; }
.text-red-400    { color: #f87171; }
.text-red-500    { color: #ef4444; }
.text-orange-400 { color: #fb923c; }
.text-yellow-400 { color: #facc15; }
.text-emerald-400 { color: #34d399; }
.bg-gray-950 { background: #030712; }
.bg-gray-900 { background: #111827; }
.bg-red-950  { background: #1a0a0a; }
.border-red-800 { border-color: #991b1b; }

/* ── Auth / setup page shell — vertically centers card on all screens ── */
.auth-layout {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-layout .login-card,
.auth-layout .wizard-card { margin: 0; }

/* ── Login / Auth pages ── */
.login-card {
  max-width: 380px;
  width: 100%;
  margin: 48px auto 24px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  padding: 32px 24px;
}
@media (min-width: 480px) {
  .login-card { padding: 40px; }
}
.login-card h1 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.login-logo { font-size: 32px; margin-bottom: 16px; text-align: center; }
.form-group { margin-bottom: 16px; }
.error-msg {
  background: #450a0a;
  border: 1px solid #7f1d1d;
  color: #fca5a5;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── Setup wizard ── */
.wizard-card {
  max-width: 520px;
  width: 100%;
  margin: 24px auto;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  padding: 24px 20px;
}
@media (min-width: 560px) {
  .wizard-card { padding: 40px; }
}
.step-indicator { display: flex; gap: 6px; margin-bottom: 28px; justify-content: center; }
.step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--c-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--c-muted); flex-shrink: 0;
}
.step-dot.done   { background: var(--c-green); border-color: var(--c-green); color: #000; }
.step-dot.active { border-color: var(--c-blue); color: var(--c-blue); }

/* ── Tab bar (users / analysis sub-tabs) ── */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: -1px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}
.tab-btn {
  display: inline-block;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 400;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: transparent;
  color: #6b7280;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: #d1d5db; }
.tab-btn.active {
  color: #60a5fa;
  border-bottom-color: #3b82f6;
  font-weight: 600;
}

/* ── Responsive table helpers ── */
@media (max-width: 639px) {
  .col-hide-mobile { display: none !important; }
}
@media (min-width: 640px) {
  .col-show-mobile { display: none !important; }
}

/* ── Desktop form constraints ── */
@media (min-width: 768px) {
  /* Number inputs in config panels shouldn't stretch to column width */
  .card-panel input[type="number"],
  .card-panel select {
    max-width: 280px;
  }
}

/* ── Scrollbar hide helpers ── */
#tab-bar-analyse::-webkit-scrollbar { display: none; }

/* ── Pill range buttons (Telemetrie / Ersparnisse) ── */
.pill-range-btn {
  padding: 5px 13px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: #9ca3af;
  background: transparent;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.pill-range-btn:hover  { background: #1f2937; color: #d1d5db; }
.pill-range-btn.active { background: #1e3a5f; color: #60a5fa; font-weight: 600; }

/* Adaptive tab font size (Analyse page) */
@media (max-width: 500px) {
  #tab-live, #tab-ersparnisse, #tab-exceedances, #tab-protokoll {
    font-size: 11px !important;
    padding: 7px 8px !important;
  }
}
@media (max-width: 380px) {
  #tab-live, #tab-ersparnisse, #tab-exceedances, #tab-protokoll {
    font-size: 9.5px !important;
  }
}

/* ── Today stat strip (Dashboard) ── */
#today-strip { padding-top: 10px; padding-bottom: 10px; }
#today-strip .section-title { margin-bottom: 8px; }
#today-strip .today-grid {
  gap: 1px;
  background: rgba(255,255,255,0.07);
  border-radius: 8px;
  overflow: hidden;
}
html[data-theme="light"] #today-strip .today-grid { background: var(--c-border); }
.today-stat {
  background: var(--c-surface);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 10px 8px; text-align: center;
  gap: 4px;
}
.today-stat-label {
  font-size: 11px; color: var(--c-muted); text-transform: uppercase;
  letter-spacing: .06em; white-space: nowrap;
}
.today-stat-value {
  font-size: 24px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
@media (min-width: 768px) { .today-stat-value { font-size: 28px; } }
.today-stat-sub { font-size: 11px; line-height: 1.4; color: var(--c-muted); }

/* ── Dashboard controls grid ── */
@media (min-width: 900px) {
  #dashboard-controls-grid { grid-template-columns: minmax(0,340px) 1fr !important; }
}

/* ── Footer ── */
footer {
  text-align: center;
  font-size: 12px;
  color: #6b7280;
  padding: 16px;
  border-top: 1px solid var(--c-border);
  /* safe area for notched phones */
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* ═══════════════════════════════════════════════════════════════
   LIGHT THEME
   Applied via html[data-theme="light"]
   ═══════════════════════════════════════════════════════════════ */
html[data-theme="light"] {
  --c-bg:      #f1f5f9;
  --c-surface: #ffffff;
  --c-border:  #e2e8f0;
  --c-text:    #0f172a;
  --c-muted:   #64748b;
  --c-accent:  #d97706;
}

/* ── Base ── */
html[data-theme="light"] body   { background: var(--c-bg); color: var(--c-text); }
html[data-theme="light"] footer { color: #94a3b8; border-color: #e2e8f0; }

/* ── Nav: keep dark for contrast ── */
html[data-theme="light"] nav          { background: #1e293b; border-color: #334155; }
html[data-theme="light"] .nav-drawer  { background: #1e293b; border-color: #334155; }

/* ── Cards / panels ── */
html[data-theme="light"] .card,
html[data-theme="light"] .card-panel,
html[data-theme="light"] .login-card,
html[data-theme="light"] .wizard-card { background: #fff; border-color: var(--c-border); color: #0f172a; }

/* ── Section title ── */
html[data-theme="light"] .section-title { color: #64748b; }

/* ── Text utility classes (hardcoded light/white in dark theme) ── */
html[data-theme="light"] .text-white     { color: #0f172a !important; }
html[data-theme="light"] .text-gray-100  { color: #1e293b !important; }
html[data-theme="light"] .text-gray-200  { color: #334155 !important; }
html[data-theme="light"] .text-gray-300  { color: #475569 !important; }
html[data-theme="light"] .text-gray-400  { color: #64748b !important; }
html[data-theme="light"] .text-gray-500  { color: #64748b !important; }
html[data-theme="light"] .text-gray-600  { color: #475569 !important; }
html[data-theme="light"] .text-gray-700  { color: #334155 !important; }

/* ── Background utility classes ── */
html[data-theme="light"] .bg-gray-950   { background: #f1f5f9 !important; color: #0f172a !important; }
html[data-theme="light"] .bg-gray-900   { background: #f8fafc !important; color: #0f172a !important; }

/* ── Buttons ── */
html[data-theme="light"] .btn-secondary         { background: #f1f5f9; color: #0f172a; border-color: #cbd5e1; }
html[data-theme="light"] .btn-secondary:active  { background: #e2e8f0; }

/* ── Forms (CSS-class-based) ── */
html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="password"],
html[data-theme="light"] input[type="number"],
html[data-theme="light"] input[type="email"],
html[data-theme="light"] select,
html[data-theme="light"] textarea { background: #f8fafc; border-color: #cbd5e1; color: #0f172a; }

/* ── Tables ── */
html[data-theme="light"] .mini-table th         { color: #64748b; border-color: #e2e8f0; }
html[data-theme="light"] .mini-table td         { border-color: #e2e8f0; color: #334155; }
html[data-theme="light"] .mini-table tr:hover td { background: #f8fafc; }

/* ── Status pills ── */
html[data-theme="light"] .status-pill { background: #f1f5f9; border-color: #cbd5e1; color: #334155; }

/* ── Badges ── */
html[data-theme="light"] .badge-yellow { background: #fef3c7; color: #92400e; border-color: #fbbf24; }
html[data-theme="light"] .badge-red    { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
html[data-theme="light"] .badge-green  { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
html[data-theme="light"] .state-badge  { background: #e2e8f0; color: #475569; }

/* ── Tab bar (old .tab-btn style) ── */
html[data-theme="light"] .tab-btn        { color: #64748b; }
html[data-theme="light"] .tab-btn:hover  { color: #0f172a; }
html[data-theme="light"] .tab-btn.active { color: #2563eb; border-bottom-color: #2563eb; }

/* ── Pill range buttons (light) ── */
html[data-theme="light"] .pill-range-btn        { color: #64748b; }
html[data-theme="light"] .pill-range-btn:hover  { background: #f1f5f9; color: #0f172a; }
html[data-theme="light"] .pill-range-btn.active { background: #dbeafe; color: #1d4ed8; }

/* ── Nav active link (light) ── */
html[data-theme="light"] .nav-link.active { color: #d97706; background: rgba(217,119,6,0.08); }

/* ── Segmented tab bars (new pill style – inline bg overrides) ──
   Container #111827 → light gray, active pill #1e3a5f → light blue */
html[data-theme="light"] [style*="background:#1e3a5f"],
html[data-theme="light"] [style*="background: #1e3a5f"] { background: #dbeafe !important; color: #1d4ed8 !important; }

/* ── Inline background overrides (dark → light) ── */
html[data-theme="light"] [style*="background:#111827"],
html[data-theme="light"] [style*="background: #111827"] { background: #f8fafc !important; }

html[data-theme="light"] [style*="background:#0f172a"],
html[data-theme="light"] [style*="background: #0f172a"] { background: #f1f5f9 !important; }

html[data-theme="light"] [style*="background:#1f2937"],
html[data-theme="light"] [style*="background: #1f2937"] { background: #f1f5f9 !important; }

html[data-theme="light"] [style*="background:#0d1117"],
html[data-theme="light"] [style*="background: #0d1117"] { background: #f8fafc !important; }

html[data-theme="light"] [style*="background:#030712"],
html[data-theme="light"] [style*="background: #030712"] { background: #f1f5f9 !important; }

html[data-theme="light"] [style*="background:#374151"],
html[data-theme="light"] [style*="background: #374151"] { background: #e2e8f0 !important; }

/* ── Inline text color overrides (white / near-white → dark) ── */
html[data-theme="light"] [style*="color:#fff"],
html[data-theme="light"] [style*="color: #fff"]       { color: #0f172a !important; }

html[data-theme="light"] [style*="color:#ffffff"],
html[data-theme="light"] [style*="color: #ffffff"]    { color: #0f172a !important; }

html[data-theme="light"] [style*="color:#f3f4f6"],
html[data-theme="light"] [style*="color: #f3f4f6"]    { color: #1e293b !important; }

html[data-theme="light"] [style*="color:#f1f5f9"],
html[data-theme="light"] [style*="color: #f1f5f9"]    { color: #334155 !important; }

html[data-theme="light"] [style*="color:#e5e7eb"],
html[data-theme="light"] [style*="color: #e5e7eb"]    { color: #1e293b !important; }

html[data-theme="light"] [style*="color:#d1d5db"],
html[data-theme="light"] [style*="color: #d1d5db"]    { color: #334155 !important; }

html[data-theme="light"] [style*="color:#9ca3af"],
html[data-theme="light"] [style*="color: #9ca3af"]    { color: #64748b !important; }

html[data-theme="light"] [style*="color:#6b7280"],
html[data-theme="light"] [style*="color: #6b7280"]    { color: #64748b !important; }

html[data-theme="light"] [style*="color:#4b5563"],
html[data-theme="light"] [style*="color: #4b5563"]    { color: #475569 !important; }

html[data-theme="light"] [style*="color:#374151"],
html[data-theme="light"] [style*="color: #374151"]    { color: #334155 !important; }

/* ── Inline border color overrides ── */
html[data-theme="light"] [style*="border:1px solid #374151"],
html[data-theme="light"] [style*="border: 1px solid #374151"],
html[data-theme="light"] [style*="border-bottom:1px solid #374151"],
html[data-theme="light"] [style*="border-bottom: 1px solid #374151"] { border-color: #e2e8f0 !important; }

html[data-theme="light"] [style*="border:1px solid #1f2937"],
html[data-theme="light"] [style*="border: 1px solid #1f2937"]        { border-color: #e2e8f0 !important; }

html[data-theme="light"] [style*="border-bottom:1px solid #1f2937"],
html[data-theme="light"] [style*="border-bottom: 1px solid #1f2937"] { border-color: #e2e8f0 !important; }

/* ── Inline forms with hardcoded dark inputs ── */
html[data-theme="light"] [style*="background:#111827"][style*="border:1px solid #374151"],
html[data-theme="light"] [style*="background:#111827"][style*="border: 1px solid #374151"] {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* ── Charts ── */
html[data-theme="light"] canvas { filter: brightness(0.95) contrast(1.05); }

/* ── Config page: scale tab text on very narrow screens ── */
@media (max-width: 400px) {
  #tab-regellogik, #tab-integrationen, #tab-benachrichtigungen {
    font-size: 11px !important;
  }
}

/* ── Responsive 2-col grid: 1 col on mobile, 2 col at ≥640px ── */
.sm\:grid-cols-2 { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Config page inline grids: stack to 1 col on mobile ── */
@media (max-width: 639px) {
  #panel-integrationen [style*="display:grid"],
  #panel-benachrichtigungen [style*="display:grid"] {
    grid-template-columns: 1fr !important;
  }
}

/* ── Dashboard contextual banners ── */
.dash-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid;
  border-left-width: 4px;
  font-size: 13px;
  line-height: 1.5;
  animation: banner-in .25s ease;
}
.dash-banner-critical { background: rgba(127,29,29,.15); border-color: #7f1d1d; border-left-color: #ef4444; }
.dash-banner-warning  { background: rgba(120,53,15,.15);  border-color: #92400e; border-left-color: #f59e0b; }
.dash-banner-info     { background: rgba(30,58,138,.15);  border-color: #1e3a8a; border-left-color: #3b82f6; }
.dash-banner-icon  { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.dash-banner-body  { flex: 1; min-width: 0; }
.dash-banner-title { font-weight: 700; margin-bottom: 2px; }
.dash-banner-title-critical { color: #fca5a5; }
.dash-banner-title-warning  { color: #fcd34d; }
.dash-banner-title-info     { color: #93c5fd; }
.dash-banner-msg    { color: #9ca3af; font-size: 12px; }
.dash-banner-action { color: #60a5fa; text-decoration: none; font-size: 12px; font-weight: 600; margin-top: 4px; display: inline-block; }
.dash-banner-action:hover { text-decoration: underline; }
.dash-banner-dismiss { flex-shrink: 0; background: none; border: none; color: #4b5563; cursor: pointer; font-size: 18px; padding: 0; line-height: 1; align-self: flex-start; }
.dash-banner-dismiss:hover { color: #9ca3af; }
@keyframes banner-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ── Integration inputs: keep 16px on mobile (iOS no-zoom), compact on desktop ── */
/* input.input-cfg specificity (0,1,1) matches and post-dates global input[type] rule */
input.input-cfg { font-size: 16px; }
@media (min-width: 640px) {
  input.input-cfg { font-size: 13px; padding: 8px 10px; }
}

/* ── HTMX in-flight state ── */
.btn-primary.htmx-request,
.btn-secondary.htmx-request { opacity: 0.55; cursor: wait; pointer-events: none; }
