/* Warenwirtschaft Grüber – Gestaltung nach Design System „Grüber – Erneuerbare Energien“ */
@font-face {
  font-family: 'Source Sans 3';
  src: url('/fonts/SourceSans3.woff') format('woff');
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --brand-green: #009640;
  --brand-green-dark: #007a34;
  --brand-blue: #007fc7;
  --brand-blue-dark: #006aa8;
  --brand-yellow: #fbb900;
  --brand-grey: #706f6f;
  --ink: #3c3c3b;
  --surface: #ffffff;
  --surface-alt: #f6f6f5;
  --line: #dcdcdb;
  --danger: #b3261e;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font: 'Source Sans 3', system-ui, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface-alt); color: var(--ink); font: 400 16px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-blue-dark); }
.laedt { padding: 48px 20px; color: var(--brand-grey); text-align: center; }

/* Kopfzeile */
.kopf { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px; display: flex; align-items: center; gap: 8px; min-height: 60px; }
.kopf .zurueck { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; margin-left: -10px;
  color: var(--ink); text-decoration: none; border-radius: var(--radius-md); }
.kopf h1 { margin: 0; font-size: 20px; line-height: 26px; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kopf .logo { height: 36px; width: auto; display: block; }
.kopf .rechts { margin-left: auto; display: flex; gap: 8px; align-items: center; }

main { max-width: 960px; margin: 0 auto; padding: 16px 16px calc(env(safe-area-inset-bottom) + 96px); display: flex; flex-direction: column; gap: 16px; }

/* Karten, Abschnitte */
.karte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.karte h2 { margin: 0; font-size: 13px; line-height: 18px; font-weight: 700; color: var(--brand-grey); text-transform: uppercase; letter-spacing: .5px; }
.hinweis { margin: 0; font-size: 14px; color: var(--brand-grey); }
.gruss { margin: 4px 0 0; font-size: 22px; line-height: 28px; font-weight: 700; }

/* Kacheln auf der Startseite */
.kacheln { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px) { .kacheln { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kachel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; min-height: 104px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px; text-decoration: none; color: var(--ink); }
.kachel strong { font-size: 17px; font-weight: 700; }
.kachel span { font-size: 13px; color: var(--brand-grey); }
.kachel .marke { width: 28px; height: 28px; border-radius: 6px; transform: skewX(-12deg); }
.kachel.aus { opacity: .55; pointer-events: none; }
.m-gruen { background: var(--brand-green); } .m-blau { background: var(--brand-blue); } .m-gelb { background: var(--brand-yellow); } .m-grau { background: var(--brand-grey); }

/* Kennzahlen */
.zahlen { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px) { .zahlen { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.zahl { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px 16px; }
.zahl b { display: block; font-size: 28px; line-height: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.zahl span { font-size: 13px; color: var(--brand-grey); }

/* Formulare */
.feld { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.feld input, .feld select, .feld textarea { height: 46px; padding: 0 12px; border: 1.5px solid #c9c9c8; border-radius: var(--radius-md);
  background: var(--surface); font-size: 16px; font-weight: 400; }
.feld textarea { height: auto; min-height: 80px; padding: 10px 12px; }
.feld input:focus, .feld select:focus, .feld textarea:focus, .suche input:focus { outline: 2px solid var(--brand-blue); outline-offset: 1px; border-color: var(--brand-blue); }
.feld small { font-weight: 400; color: var(--brand-grey); }
.reihe { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.schalter { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; font-size: 16px; }
.schalter input { width: 24px; height: 24px; accent-color: var(--brand-green-dark); }

.btn { height: 48px; padding: 0 20px; border-radius: var(--radius-md); border: 0; background: var(--brand-green-dark); color: #fff;
  font-size: 16px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.zweit { background: var(--surface); color: var(--ink); border: 1.5px solid #c9c9c8; }
.btn.klein { height: 38px; padding: 0 14px; font-size: 14px; }
.btn.gefahr { background: var(--surface); color: var(--danger); border: 1.5px solid var(--danger); }
.btn:disabled { opacity: .6; cursor: default; }
.btn:focus-visible, .kachel:focus-visible, .zeile:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px; }
.leiste { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line);
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px); display: flex; gap: 10px; justify-content: center; z-index: 5; }
.leiste .btn { flex: 1; max-width: 420px; }

.fehler { margin: 0; color: var(--danger); font-size: 14px; min-height: 0; }
.fehler:empty { display: none; }
.meldung { padding: 10px 12px; border-radius: var(--radius-md); font-size: 14px; }
.meldung.warn { background: #fff4d1; color: #5c4300; }
.meldung.info { background: #e6f2fa; color: #004d7a; }
.meldung.ok { background: #e3f4ea; color: #0b5a2b; }

/* Suche und Listen */
.suche { display: flex; gap: 8px; }
.suche input { flex: 1; height: 48px; padding: 0 14px; border: 1.5px solid #c9c9c8; border-radius: var(--radius-md); background: var(--surface); font-size: 16px; }
.filter { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 34px; padding: 0 12px; border-radius: 17px; border: 1.5px solid #c9c9c8; background: var(--surface); font-size: 14px; cursor: pointer; }
.chip[aria-pressed='true'] { background: var(--ink); color: #fff; border-color: var(--ink); }
.liste { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.zeile { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); min-height: 60px; }
.zeile:first-child { border-top: 0; }
.zeile .haupt { flex: 1; min-width: 0; }
.zeile .titel { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile .unter { font-size: 13px; color: var(--brand-grey); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile .wert { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.zeile .wert small { display: block; font-size: 12px; color: var(--brand-grey); }
.zeile.inaktiv .titel { color: var(--brand-grey); }
.marker { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: var(--radius-sm); vertical-align: 2px; margin-left: 6px; }
.marker.sn { background: #e6f2fa; color: #004d7a; }
.marker.aus { background: var(--surface-alt); color: var(--brand-grey); border: 1px solid var(--line); }
.marker.fz { background: #fff4d1; color: #5c4300; }
.mehr { padding: 12px 16px; font-size: 14px; color: var(--brand-grey); border-top: 1px solid var(--line); }

table.tab { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tab th { text-align: left; font-size: 12px; color: var(--brand-grey); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.tab td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tab td.z { text-align: right; font-variant-numeric: tabular-nums; }
.unterliste { display: flex; flex-direction: column; gap: 12px; }
.unterposten { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-alt); }

.dialog { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 20; }
.dialog .karte { max-width: 420px; width: 100%; }
.passwort { font-family: ui-monospace, Consolas, monospace; font-size: 20px; letter-spacing: 1px; background: var(--surface-alt); padding: 10px 12px; border-radius: var(--radius-md); user-select: all; }

.anmeldung { max-width: 400px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 48px) 20px 40px; display: flex; flex-direction: column; gap: 16px; }
.anmeldung .logo { width: 220px; height: auto; align-self: center; margin-bottom: 8px; }
.anmeldung h1 { margin: 0; font-size: 26px; text-align: center; }
.anmeldung .sub { margin: 0; text-align: center; color: var(--brand-grey); }

@media (min-width: 720px) { .leiste { position: static; border: 0; padding: 0; background: none; justify-content: flex-start; } main { padding-bottom: 40px; } }
