/* ==========================================================================
   Wallbox Charging Management & Billing - Design System
   Farbschema: Gruen/Blau, Nachhaltigkeit & erneuerbare Energien
   ========================================================================== */

:root {
  --green-900: #063a26;
  --green-800: #0a5334;
  --green-700: #0b6340;
  --green-600: #0e7a4f;
  --green-500: #16a34a;
  --green-400: #34c77b;
  --green-100: #d9f2e4;
  --blue-800: #0d4d80;
  --blue-700: #1266a8;
  --blue-600: #1a76c4;
  --blue-500: #3292dd;
  --blue-100: #dceaf8;
  --amber-500: #d9822b;
  --amber-100: #fdf0dd;
  --red-600: #c0392b;
  --red-100: #fbe4e1;

  --bg: #f2f6f5;
  --bg-accent: radial-gradient(1200px 600px at 12% -8%, #d9f2e4 0%, rgba(217, 242, 228, 0) 60%),
               radial-gradient(900px 500px at 100% 0%, #dceaf8 0%, rgba(220, 234, 248, 0) 55%);
  --surface: #ffffff;
  --surface-2: #f7fbf9;
  --surface-3: #eef4f1;
  --text: #10262c;
  --text-soft: #3b545c;
  --muted: #6a8189;
  --border: #dde8e3;
  --border-strong: #c6d7d1;
  --shadow-sm: 0 1px 2px rgba(14, 60, 45, .06), 0 1px 3px rgba(14, 60, 45, .04);
  --shadow: 0 8px 24px rgba(11, 56, 42, .08), 0 2px 6px rgba(11, 56, 42, .04);
  --shadow-lg: 0 20px 45px rgba(9, 46, 35, .14);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --primary: var(--green-600);
  --primary-contrast: #ffffff;
  --accent: var(--blue-600);
  --gradient: linear-gradient(135deg, var(--green-700) 0%, var(--green-500) 48%, var(--blue-600) 100%);
  --chart-1: #0e7a4f;
  --chart-2: #1a76c4;
  --chart-3: #34c77b;
  --chart-4: #d9822b;
  --chart-5: #7a5cd6;
  --sidebar-width: 254px;
  --topbar-height: 62px;
}

html[data-theme="dark"] {
  --bg: #071216;
  --bg-accent: radial-gradient(1100px 560px at 10% -10%, rgba(22, 163, 74, .18) 0%, rgba(7, 18, 22, 0) 60%),
               radial-gradient(900px 520px at 100% 0%, rgba(26, 118, 196, .18) 0%, rgba(7, 18, 22, 0) 55%);
  --surface: #0f2027;
  --surface-2: #132a33;
  --surface-3: #17323d;
  --text: #e7f3ef;
  --text-soft: #c2d6d3;
  --muted: #8ba5a4;
  --border: #1e3945;
  --border-strong: #2a4b58;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 55px rgba(0, 0, 0, .55);
  --green-100: #113a2a;
  --blue-100: #102b41;
  --amber-100: #3a2a13;
  --red-100: #3b1b17;
  --primary: #2fb673;
  --primary-contrast: #04140d;
  --accent: #4aa3e6;
  --gradient: linear-gradient(135deg, #0b6340 0%, #16a34a 50%, #1a76c4 100%);
  --chart-1: #2fb673;
  --chart-2: #4aa3e6;
  --chart-3: #7fe0ae;
  --chart-4: #e8a85c;
  --chart-5: #a58bf0;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  background-image: var(--bg-accent);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .85rem; }
small, .small { font-size: .8rem; }
.muted { color: var(--muted); }
.text-soft { color: var(--text-soft); }
.mono { font-family: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.grow { flex: 1 1 auto; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }

/* ------------------------------------------------------------------ Layout */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1rem 1.1rem; border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; background: var(--gradient);
  display: grid; place-items: center; color: #fff; flex: 0 0 38px;
  box-shadow: var(--shadow-sm);
}
.brand-text { min-width: 0; }
.brand-title { font-weight: 700; font-size: .95rem; letter-spacing: -.01em; }
.brand-sub { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.nav { padding: .7rem .6rem; overflow-y: auto; flex: 1 1 auto; }
.nav-group-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); padding: .85rem .75rem .35rem; font-weight: 700;
}
.nav-link {
  display: flex; align-items: center; gap: .7rem; min-height: 42px;
  padding: .55rem .75rem; border-radius: 10px; color: var(--text-soft);
  font-weight: 550; font-size: .9rem; transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link.active { background: linear-gradient(90deg, var(--green-100), transparent); color: var(--primary); }
.nav-link.active svg { color: var(--primary); }
.nav-link svg { width: 19px; height: 19px; flex: 0 0 19px; color: var(--muted); }
.nav-badge {
  margin-left: auto; background: var(--amber-100); color: var(--amber-500);
  border-radius: 999px; font-size: .7rem; padding: .1rem .45rem; font-weight: 700;
}

.sidebar-foot { padding: .8rem 1rem; border-top: 1px solid var(--border); font-size: .75rem; color: var(--muted); }

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

.topbar {
  height: var(--topbar-height); position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: .75rem; padding: 0 1.1rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 1.05rem; margin: 0; }
.topbar .crumb { font-size: .78rem; color: var(--muted); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-soft); display: grid; place-items: center;
  cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }

.user-chip {
  display: flex; align-items: center; gap: .55rem; padding: .35rem .7rem .35rem .4rem;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-size: .85rem; color: var(--text); cursor: pointer; font: inherit;
}
.user-chip:hover { background: var(--surface-3); }
.user-chip .chev { display: grid; place-items: center; color: var(--text-soft); margin-left: .15rem; }
.user-menu { position: relative; }
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + .45rem); min-width: 258px; z-index: 70;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow, 0 18px 40px rgba(15, 40, 30, .18)); padding: .45rem;
  display: none;
}
.user-menu.open .user-menu-panel { display: block; }
.user-menu-head {
  display: flex; flex-direction: column; gap: .15rem; padding: .6rem .65rem .55rem;
  border-bottom: 1px solid var(--border); margin-bottom: .35rem;
}
.user-menu-item {
  display: flex; align-items: center; gap: .55rem; padding: .5rem .65rem; border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: .88rem;
}
.user-menu-item:hover { background: var(--surface-3); }
.user-menu-item.danger { color: #b4341f; }
.user-menu-sep { height: 1px; background: var(--border); margin: .35rem .3rem; }
.avatar {
  width: 30px; height: 30px; border-radius: 999px; background: var(--gradient); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .78rem;
}

/* Breite Bildschirme: Inhalt nutzt die Flaeche, Texte bleiben lesbar */
.content { padding: 1.35rem 1.6rem 3rem; max-width: 1900px; width: 100%; }
@media (min-width: 1700px) {
  .content { padding: 1.5rem 2.2rem 3.2rem; }
  .grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 2100px) {
  .content { max-width: 2400px; }
  .grid.cols-4 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .card { margin-bottom: 1.25rem; }
}

/* ------------------------------------------------------------------ Cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.1rem 1.2rem; margin-bottom: 1.1rem;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .9rem 1.1rem; border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 1.05rem 1.1rem; }
.card-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.card-actions.tight { gap: .3rem; align-items: center; }

/* Aktionsleiste: alle Schaltflaechen einer Ansicht an einer Stelle, einheitliche Groesse */
.action-bar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .45rem .9rem; border-top: 1px solid var(--border); background: var(--surface-2);
}
.action-bar.subtle { background: transparent; }
.action-bar-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 600; min-width: 4.5rem;
}
.action-bar-items { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin: 0; }
.action-bar-items.tight { gap: .3rem; }
select.sm, input.sm, .input-sm {
  min-height: 27px; padding: .16rem .42rem; font-size: .78rem; border-radius: 7px;
}
input.sm { min-width: 12rem; }

.grid { display: grid; gap: 1.1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-2-1 { grid-template-columns: 2fr 1fr; }
.grid.cols-1-2 { grid-template-columns: 1fr 2fr; }

.kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem; box-shadow: var(--shadow-sm);
}
.kpi::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--gradient);
}
.kpi.hue-blue::after { background: linear-gradient(180deg, var(--blue-600), var(--blue-500)); }
.kpi.hue-amber::after { background: linear-gradient(180deg, var(--amber-500), #f0b064); }
.kpi.hue-green::after { background: linear-gradient(180deg, var(--green-500), var(--green-400)); }
.kpi-label { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.kpi-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin: .2rem 0 .1rem; }
.kpi-unit { font-size: .85rem; font-weight: 600; color: var(--muted); margin-left: .25rem; }
.kpi-sub { font-size: .8rem; color: var(--muted); }
.trend { font-size: .78rem; font-weight: 700; border-radius: 999px; padding: .05rem .45rem; }
.trend.up { background: var(--green-100); color: var(--green-700); }
.trend.down { background: var(--red-100); color: var(--red-600); }
html[data-theme="dark"] .trend.up { color: var(--green-400); }

/* ------------------------------------------------------------------ Forms */
.form-grid { display: grid; gap: .95rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.one { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field.span-2 { grid-column: 1 / -1; }
label, .label { font-size: .82rem; font-weight: 650; color: var(--text-soft); }
.hint { font-size: .76rem; color: var(--muted); }

input[type="text"], input[type="password"], input[type="number"], input[type="email"],
input[type="search"], input[type="date"], input[type="datetime-local"], input[type="time"],
select, textarea {
  width: 100%; padding: .62rem .7rem; font-size: 16px; font-family: inherit;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 10px; min-height: 44px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--primary); }
.check { display: flex; align-items: center; gap: .55rem; font-size: .88rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 42px; padding: .55rem .95rem; border-radius: 11px; border: 1px solid transparent;
  background: var(--primary); color: var(--primary-contrast); font-weight: 650; font-size: .88rem;
  cursor: pointer; transition: transform .06s, filter .15s, background .15s; font-family: inherit;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-3); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--text-soft); border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { background: var(--red-600); color: #fff; }
.btn.warn { background: var(--amber-500); color: #fff; }
.btn.sm { min-height: 34px; padding: .3rem .65rem; font-size: .8rem; border-radius: 9px; }
.btn.xs { min-height: 27px; padding: .18rem .48rem; font-size: .74rem; border-radius: 7px; gap: .3rem; }
.btn.xs svg { width: 13px; height: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------------ Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th, table.data td { padding: .6rem .7rem; text-align: left; border-bottom: 1px solid var(--border); }
table.data th {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  background: var(--surface-2); position: sticky; top: 0; font-weight: 700; white-space: nowrap;
}
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--border-strong); }
.table-empty { padding: 1.6rem; text-align: center; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .16rem .55rem;
  border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .01em;
  background: var(--surface-3); color: var(--text-soft); white-space: nowrap;
}
.badge.green { background: var(--green-100); color: var(--green-700); }
.badge.blue { background: var(--blue-100); color: var(--blue-700); }
.badge.amber { background: var(--amber-100); color: var(--amber-500); }
.badge.red { background: var(--red-100); color: var(--red-600); }
html[data-theme="dark"] .badge.green { color: var(--green-400); }
html[data-theme="dark"] .badge.blue { color: var(--blue-500); }

.pill-solar {
  display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.solar-bar { width: 68px; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.solar-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue-500), var(--green-500)); }

/* ------------------------------------------------------------------ Filters */
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 135px; }
.filters .field.grow { flex: 1 1 200px; }

.tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .9rem; }
.tab {
  padding: .45rem .85rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-soft); font-size: .84rem; font-weight: 600;
}
.tab.active { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.tab:hover { text-decoration: none; }

/* ------------------------------------------------------------------ Flash */
.flash-stack { position: fixed; top: 74px; right: 18px; z-index: 60; display: flex; flex-direction: column; gap: .5rem; max-width: 380px; }
.flash {
  display: flex; gap: .55rem; align-items: flex-start; padding: .7rem .85rem; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: .88rem; animation: slideIn .25s ease;
}
.flash.success { border-left: 4px solid var(--green-500); }
.flash.error { border-left: 4px solid var(--red-600); }
.flash.warning { border-left: 4px solid var(--amber-500); }
.flash.info { border-left: 4px solid var(--blue-600); }
.flash button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ Charts */
.chart-host { width: 100%; }
.chart-host svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: .55rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.chart-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.axis-label { font-size: 10px; fill: var(--muted); }
.grid-line { stroke: var(--border); stroke-width: 1; }
.sparkline { height: 46px; }

.bar-list { display: flex; flex-direction: column; gap: .55rem; }
.bar-row { display: grid; grid-template-columns: 120px 1fr auto; gap: .6rem; align-items: center; font-size: .85rem; }
.bar-track { height: 9px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--gradient); }

.donut-wrap { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.donut-center { font-weight: 700; }

/* ------------------------------------------------------------------ Misc */
.stack { display: flex; flex-direction: column; gap: .7rem; }
.row { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.divider { height: 1px; background: var(--border); margin: 1rem 0; }
.note {
  background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 12px;
  padding: .8rem .95rem; font-size: .85rem; color: var(--text-soft);
}
.note.info { border-left: 4px solid var(--blue-600); border-style: solid; }
.note.warn { border-left: 4px solid var(--amber-500); border-style: solid; }
.code {
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px;
  padding: .7rem .85rem; font-size: .82rem; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}
dl.meta { margin: 0; display: grid; grid-template-columns: minmax(140px, 34%) 1fr; gap: .35rem .8rem; font-size: .88rem; }
dl.meta dt { color: var(--muted); font-weight: 600; }
dl.meta dd { margin: 0; }

.pagination { display: flex; gap: .35rem; align-items: center; justify-content: center; padding: .85rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 38px; min-height: 38px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); font-size: .85rem;
}
.pagination .current { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); font-weight: 700; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.35rem; border-left: 2px solid var(--border); }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: .3rem; width: 10px; height: 10px;
  border-radius: 999px; background: var(--primary);
}
.timeline .when { font-size: .78rem; color: var(--muted); }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.login-card { width: min(430px, 100%); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden; }
.login-head { background: var(--gradient); color: #fff; padding: 1.6rem 1.5rem; }
.login-head h1 { font-size: 1.15rem; margin: 0 0 .2rem; color: #fff; }
.login-head p { margin: 0; font-size: .84rem; opacity: .9; }
.login-body { padding: 1.4rem 1.5rem 1.5rem; }

.about-hero { background: var(--gradient); color: #fff; border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.about-hero h1, .about-hero h2 { color: #fff; }
.ver-badge { display: inline-flex; gap: .4rem; align-items: center; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); padding: .2rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700; }

.sidebar-toggle { display: none; }
.scrim { display: none; }

/* ------------------------------------------------------------------ Responsive */
@media (max-width: 1180px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-2-1, .grid.cols-1-2 { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; transform: translateX(-102%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(6, 24, 18, .5); z-index: 35; }
  .sidebar-toggle { display: grid; }
  .content { padding: 1rem .85rem 3rem; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 .7rem; }
  .flash-stack { left: .7rem; right: .7rem; max-width: none; top: 70px; }

  /* Tabellen werden zu Karten */
  table.data.responsive thead { display: none; }
  table.data.responsive, table.data.responsive tbody, table.data.responsive tr, table.data.responsive td { display: block; width: 100%; }
  table.data.responsive tr {
    border: 1px solid var(--border); border-radius: 12px; margin-bottom: .7rem;
    padding: .45rem .6rem; background: var(--surface-2);
  }
  table.data.responsive td {
    display: grid; grid-template-columns: 44% 1fr; gap: .5rem; align-items: center;
    border: none; padding: .35rem 0; text-align: right;
  }
  table.data.responsive td::before {
    content: attr(data-label); text-align: left; font-size: .74rem; text-transform: uppercase;
    letter-spacing: .06em; color: var(--muted); font-weight: 700;
  }
  table.data.responsive td.actions-cell { grid-template-columns: 1fr; justify-items: stretch; }
  table.data.responsive td.actions-cell::before { display: none; }
  table.data.responsive td.num { text-align: right; }
  .btn, .icon-btn, .nav-link, input, select { min-height: 44px; }
  .btn.sm { min-height: 40px; }
  dl.meta { grid-template-columns: 1fr; gap: .1rem; }
  dl.meta dt { margin-top: .5rem; }
}

@media print {
  .sidebar, .topbar, .flash-stack, .no-print { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ---- Versionshistorie (Version & Info) ---- */
.release { border-left: 3px solid var(--border); padding: .1rem 0 .1rem .9rem; margin: 0 0 1.15rem; }
.release:last-of-type { margin-bottom: .8rem; }
.release.current { border-left-color: var(--green-600); }
.release-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.ver-badge-dark {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  padding: .15rem .6rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700; color: var(--text);
}
.release-title { margin: .45rem 0 .35rem; font-size: .98rem; }
.release-list { margin: 0; padding-left: 1.1rem; }
.release-list li { margin: .18rem 0; font-size: .88rem; color: var(--text-soft); }
.release-list code { font-size: .82rem; }
@media print { .release { break-inside: avoid; } }