/* =========================================================
   strafmassrechner.ch – zh.css
   Behoerdliches, nuechternes Layout (Grundfarbe unveraendert: #0b4f9f)
   Verwendet von: index.php, index2.php, common.php
   ========================================================= */

/* -----------------------------------------------------
   1. Reset
----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans", sans-serif;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--zh-text);
  background: var(--zh-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--zh-blue-2); }
input, select, button, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { letter-spacing: -0.012em; }
table { border-collapse: collapse; }

/* -----------------------------------------------------
   2. Design Tokens
----------------------------------------------------- */
:root{
  /* Grundfarben – unveraendert */
  --zh-blue:   #0b4f9f;
  --zh-blue-2: #0a3f82;
  --zh-blue-3: #0c63c7;

  /* Abgeleitete Blau-Toene */
  --zh-blue-tint:   #eef3fa;
  --zh-blue-tint-2: #dfe9f6;

  --zh-bg:        #f6f8fb;
  --zh-surface:   #ffffff;
  --zh-surface-2: #f1f5fb;

  --zh-text:  #0b1220;
  --zh-muted: #55617a;

  --zh-line:   #dde3ec;
  --zh-line-2: #c9d3e2;
  --zh-border: #dde3ec;

  --zh-danger:    #8a1220;
  --zh-danger-bg: #fdf2f3;
  --zh-danger-ln: #e6c3c8;

  --zh-shadow:   0 1px 2px rgba(11,18,32,.05), 0 8px 24px rgba(11,18,32,.05);
  --zh-shadow-s: 0 1px 2px rgba(11,18,32,.06);

  --radius:    10px;
  --radius-sm: 8px;

  --container: 1180px;
  --header-h:  72px;
}

/* -----------------------------------------------------
   3. Layout-Helfer
----------------------------------------------------- */
.container{ width: min(var(--container), calc(100% - 40px)); margin: 0 auto; }
.section{ padding: 20px 0; }
.section + .section{ padding-top: 4px; }
.stack{ display: grid; gap: 12px; }
.narrow{ max-width: 520px; margin: 0 auto; }
.mt-8{ margin-top: 8px; } .mt-12{ margin-top: 12px; } .mt-16{ margin-top: 16px; }
.nowrap{ white-space: nowrap; }
.num{ font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.text-right{ text-align: right; }

.lead{ margin: 0; color: rgba(255,255,255,.92); max-width: 74ch; font-size: 15px; }
.micro{ display:inline-block; margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--zh-muted); }
.hint{ margin-top: 5px; font-size: 12.5px; color: var(--zh-muted); }
.section-note{ margin: 6px 0 14px; color: var(--zh-muted); font-size: 13.5px; max-width: 85ch; }
.section-note:last-child{ margin-bottom: 0; }

/* -----------------------------------------------------
   4. Skip-Link / Fokus
----------------------------------------------------- */
.skip-link{
  position: absolute; left: -9999px; top: 8px;
  background: var(--zh-blue); color: #fff;
  padding: 10px 14px; border-radius: var(--radius-sm);
  text-decoration: none; z-index: 9999;
}
.skip-link:focus{ left: 12px; }

:focus-visible{
  outline: 2px solid var(--zh-blue-3);
  outline-offset: 2px;
  border-radius: 4px;
}

/* -----------------------------------------------------
   5. Kopfbereich / Navigation
----------------------------------------------------- */
.site-header{
  position: sticky; top: 0; z-index: 100;
  background: var(--zh-surface);
  border-bottom: 1px solid var(--zh-line);
  border-top: 3px solid var(--zh-blue);
}
.site-header__bar{
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; min-height: var(--header-h); padding: 10px 0;
}

.brand{ display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand__mark{
  width: 38px; height: 38px; flex: none;
  border-radius: 6px;
  background: var(--zh-blue);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 19px; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.brand__title strong{ display: block; font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.brand__title span{ display: block; color: var(--zh-muted); font-size: 12.5px; margin-top: 1px; }

.nav{ display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.nav a{
  text-decoration: none; font-weight: 600; font-size: 13.5px;
  color: var(--zh-blue-2);
  padding: 8px 11px; border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.nav a:hover{ background: var(--zh-blue-tint); }
.nav a[aria-current="page"]{
  background: var(--zh-blue-tint);
  border-color: var(--zh-blue-tint-2);
}
.nav__sep{ width: 1px; height: 22px; background: var(--zh-line); margin: 0 6px; }
.nav form{ display: inline; }

/* Schmale Bildschirme: Kopfzeile umbrechen lassen */
@media (max-width: 760px){
  .site-header__bar{ flex-wrap: wrap; gap: 8px; padding: 10px 0 6px; min-height: 0; }
  .nav{ width: 100%; margin-left: -11px; }
  .nav__sep{ display: none; }
  .brand__mark{ width: 34px; height: 34px; font-size: 17px; }
}
@media (max-width: 560px){
  .container{ width: calc(100% - 28px); }
  .card{ padding: 16px; }
  .kpi__value{ font-size: 20px; }
  .actions .btn{ flex: 1 1 auto; }
}

/* -----------------------------------------------------
   6. Seitenkopf
----------------------------------------------------- */
.pagehead{
  background: linear-gradient(120deg, var(--zh-blue-2) 0%, var(--zh-blue) 60%, var(--zh-blue-3) 140%);
  color: #fff;
}
.pagehead__inner{ padding: 26px 0 30px; }
.breadcrumbs{ font-size: 12.5px; color: rgba(255,255,255,.78); margin-bottom: 8px; }
.breadcrumbs a{ color: rgba(255,255,255,.9); text-decoration: none; }
.breadcrumbs a:hover{ text-decoration: underline; }
.pagehead h1{ margin: 0 0 8px; color: #fff; font-size: clamp(24px, 3vw, 30px); font-weight: 700; }

/* Sprungnavigation unter dem Seitenkopf */
.tabbar{
  background: var(--zh-surface);
  border-bottom: 1px solid var(--zh-line);
  box-shadow: var(--zh-shadow-s);
}
.tabbar__inner{ display: flex; gap: 2px; overflow-x: auto; }
.tabbar a{
  padding: 13px 14px;
  font-size: 13.5px; font-weight: 600;
  color: var(--zh-muted); text-decoration: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tabbar a:hover{ color: var(--zh-blue-2); background: var(--zh-blue-tint); }
.tabbar a.is-active{ color: var(--zh-blue-2); border-bottom-color: var(--zh-blue); }

/* -----------------------------------------------------
   7. Karten
----------------------------------------------------- */
.card{
  background: var(--zh-surface);
  border: 1px solid var(--zh-line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--zh-shadow);
}
.card > h2:first-child, .card > h3:first-child{ margin-top: 0; }
.card h2{
  margin: 0 0 4px; font-size: 19px; font-weight: 700;
  padding-bottom: 10px; border-bottom: 1px solid var(--zh-line);
}
.card h3{ margin: 0 0 12px; font-size: 14px; font-weight: 700; letter-spacing: .01em; }
.card p{ margin: 8px 0; }
.card p:last-child{ margin-bottom: 0; }

/* Karte ohne eigenen Rahmen (Spalteninhalt) */
.card--flush{ box-shadow: none; border: none; padding: 0; background: transparent; }
/* Ergebnis-Spalte */
.card--result{ box-shadow: none; border: 1px solid var(--zh-line); background: var(--zh-surface); }

/* -----------------------------------------------------
   8. Raster
----------------------------------------------------- */
.grid{ display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,.9fr); gap: 20px; align-items: start; }
.grid--result-sticky > aside{ position: sticky; top: calc(var(--header-h) + 16px); }
@media (max-width: 1000px){
  .grid{ grid-template-columns: 1fr; }
  .grid--result-sticky > aside{ position: static; }
}

/* -----------------------------------------------------
   9. Formulare
----------------------------------------------------- */
.form-grid{ display: grid; grid-template-columns: 1fr; gap: 14px; }
.field label{
  display: flex; flex-wrap: wrap; align-items: baseline;
  font-size: 13px; font-weight: 600; color: var(--zh-text);
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field select{
  width: 100%;
  border: 1px solid var(--zh-line-2);
  background: #fff;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  font-variant-numeric: tabular-nums;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field select{ appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--zh-muted) 50%), linear-gradient(135deg, var(--zh-muted) 50%, transparent 50%); background-position: calc(100% - 18px) calc(50% + 1px), calc(100% - 13px) calc(50% + 1px); background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.field input::placeholder{ color: #9aa5b8; }
.field input:hover, .field select:hover{ border-color: #aebbd0; }
.field input:focus, .field select:focus{
  border-color: var(--zh-blue-3);
  box-shadow: 0 0 0 3px rgba(11,79,159,.14);
}
.field input[aria-invalid="true"]{ border-color: var(--zh-danger-ln); box-shadow: 0 0 0 3px rgba(138,18,32,.10); }
.field--inline{ display: grid; grid-template-columns: 1fr; }

fieldset{ border: 0; margin: 0; padding: 0; min-width: 0; }
legend{ padding: 0; }

.actions{
  display: flex; align-items: center; gap: 10px;
  margin-top: 6px; padding-top: 14px;
  border-top: 1px solid var(--zh-line);
  flex-wrap: wrap;
}
.actions--plain{ border-top: 0; padding-top: 10px; margin-top: 2px; }

/* Gruppenblock (z. B. Substanzen) */
.group{
  border: 1px solid var(--zh-line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fff, #fcfdff);
  padding: 14px;
}
.group .field + .field{ margin-top: 14px; }
.group .pairs .field + .field{ margin-top: 0; }
.group__title{
  display: block; width: 100%;
  font-weight: 700; font-size: 13px; color: var(--zh-blue-2);
  margin: 0 0 12px; padding: 0 0 8px;
  border-bottom: 1px solid var(--zh-line);
}
.group__title small{ float: right; font-weight: 600; color: var(--zh-muted); font-size: 11.5px; }
.group__title::after{ content: ""; display: block; clear: both; }
.group .field:last-child{ margin-bottom: 0; }

.pairs{ display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.pairs--last{ margin-bottom: 0; }
@media (max-width: 900px){ .pairs{ grid-template-columns: 1fr; } }

/* Aufklappbereich */
details.panel{
  border: 1px solid var(--zh-line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 0;
}
details.panel > summary{
  cursor: pointer; list-style: none;
  padding: 12px 14px;
  font-weight: 700; font-size: 13px; color: var(--zh-blue-2);
  display: flex; align-items: center; gap: 8px;
}
details.panel > summary::-webkit-details-marker{ display: none; }
details.panel > summary::before{
  content: "+"; display: grid; place-items: center;
  width: 18px; height: 18px; border-radius: 4px;
  background: var(--zh-blue-tint); color: var(--zh-blue-2);
  font-weight: 700; font-size: 13px; line-height: 1;
}
details.panel[open] > summary::before{ content: "–"; }
details.panel[open] > summary{ border-bottom: 1px solid var(--zh-line); }
.panel__body{ padding: 14px; display: grid; gap: 14px; }

/* -----------------------------------------------------
   10. Schaltflaechen
----------------------------------------------------- */
.btn{
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; border-radius: var(--radius-sm);
  padding: 10px 16px; border: 1px solid transparent;
  cursor: pointer; font-weight: 600; font-size: 13.5px;
  user-select: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary{ background: var(--zh-blue); color: #fff; box-shadow: var(--zh-shadow-s); }
.btn-primary:hover{ background: var(--zh-blue-2); }
.btn-ghost{ background: #fff; border-color: var(--zh-line-2); color: var(--zh-blue-2); }
.btn-ghost:hover{ background: var(--zh-blue-tint); border-color: var(--zh-blue-tint-2); }
.btn-link{
  background: none; border: none; padding: 8px 11px;
  color: var(--zh-blue-2); font-size: 13.5px; font-weight: 600; cursor: pointer;
  border-radius: var(--radius-sm);
}
.btn-link:hover{ background: var(--zh-blue-tint); }
.btn[disabled], .btn[aria-disabled="true"]{ opacity: .5; pointer-events: none; }

/* -----------------------------------------------------
   11. Tabellen
----------------------------------------------------- */
.table-wrap{ width: 100%; overflow-x: auto; }
.table{
  width: 100%;
  font-size: 14px;
  border: 1px solid var(--zh-line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.table caption{
  caption-side: top; text-align: left;
  font-size: 12.5px; color: var(--zh-muted); padding: 0 0 8px;
}
.table thead th{
  text-align: left;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--zh-muted);
  background: var(--zh-surface-2);
  border-bottom: 1px solid var(--zh-line);
  padding: 9px 12px;
}
.table tbody td, .table tbody th{
  padding: 9px 12px;
  border-bottom: 1px solid var(--zh-line);
  vertical-align: top;
  text-align: left;
  font-weight: 400;
}
.table tbody td:last-child{ font-variant-numeric: tabular-nums; }
.table tbody tr:last-child td, .table tbody tr:last-child th{ border-bottom: none; }
.table tbody tr:hover td, .table tbody tr:hover th{ background: #fafcff; }
.table .row-group td{
  background: var(--zh-blue-tint);
  font-weight: 700; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--zh-blue-2);
}
.table .row-total td, .table .row-total th{ font-weight: 700; background: #fbfdff; }

/* Ergebnis-Kennzahlen */
.kpi{ display: grid; gap: 10px; margin: 0 0 14px; }
.kpi__item{
  border: 1px solid var(--zh-blue-tint-2);
  border-left: 4px solid var(--zh-blue);
  background: var(--zh-blue-tint);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.kpi__label{ font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--zh-blue-2); }
.kpi__value{ font-size: 22px; font-weight: 700; line-height: 1.25; margin-top: 2px; font-variant-numeric: tabular-nums; color: var(--zh-text); }
.kpi__sub{ font-size: 12.5px; color: var(--zh-muted); margin-top: 2px; }

.empty-state{
  border: 1px dashed var(--zh-line-2);
  border-radius: var(--radius-sm);
  padding: 22px 16px;
  text-align: center;
  color: var(--zh-muted);
  font-size: 13.5px;
  background: #fcfdff;
}

/* -----------------------------------------------------
   12. Badges / Hinweise
----------------------------------------------------- */
.badge{
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--zh-blue-tint); border: 1px solid var(--zh-blue-tint-2);
  color: var(--zh-blue-2); font-weight: 700; font-size: 11.5px;
  letter-spacing: .03em; text-transform: uppercase;
}
.alert{
  padding: 12px 14px;
  border: 1px solid var(--zh-line-2);
  border-left: 4px solid var(--zh-blue);
  background: var(--zh-blue-tint);
  border-radius: var(--radius-sm);
  color: var(--zh-text);
  margin: 0 0 16px;
  font-size: 13.5px;
}
.alert--error{
  border-color: var(--zh-danger-ln);
  border-left-color: var(--zh-danger);
  background: var(--zh-danger-bg);
  color: var(--zh-danger);
}
.alert ul{ margin: 6px 0 0; padding-left: 18px; }

/* -----------------------------------------------------
   12b. Geführter Ablauf: Schritte, Katalog, Fallkorb
----------------------------------------------------- */
.sr{
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.stepno{
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; margin-right: 10px;
  border-radius: 50%;
  background: var(--zh-blue); color: #fff;
  font-size: 14px; font-weight: 700; line-height: 1;
  vertical-align: 2px;
}

/* Katalogliste */
.katalog{ display: grid; gap: 18px; }
.katalog__titel{
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--zh-muted); padding-bottom: 6px; margin-bottom: 6px;
  border-bottom: 1px solid var(--zh-line);
}
.katalog__liste{ list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.katalog__liste a{
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--zh-text); font-size: 14px;
  border: 1px solid transparent;
}
.katalog__liste a small{ color: var(--zh-muted); font-size: 11.5px; white-space: nowrap; }
.katalog__liste a:hover{ background: var(--zh-blue-tint); }
.katalog__liste a.is-active{
  background: var(--zh-blue-tint); border-color: var(--zh-blue-tint-2);
  font-weight: 600; color: var(--zh-blue-2);
}

@media (max-width: 620px){
  .katalog__liste a{ flex-direction: column; align-items: flex-start; gap: 2px; }
  .katalog__liste a small{ white-space: normal; }
}

.delikt__kopf{
  padding: 10px 12px; margin-bottom: 14px;
  background: var(--zh-surface-2); border-radius: var(--radius-sm);
  border-left: 3px solid var(--zh-blue);
}
.delikt__kopf strong{ display: block; font-size: 14.5px; }
.delikt__kopf span{ display: block; font-size: 12px; color: var(--zh-muted); margin-top: 2px; }

/* Kennzahlen nebeneinander */
.kpi--row{ grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
@media (max-width: 560px){ .kpi--row{ grid-template-columns: 1fr; } }

/* Kompakte Felder in Tabellen */
.input-mini{
  width: 74px; padding: 5px 7px;
  border: 1px solid var(--zh-line-2); border-radius: 6px;
  font-variant-numeric: tabular-nums; text-align: right;
}
.input-mini:focus{ border-color: var(--zh-blue-3); box-shadow: 0 0 0 3px rgba(11,79,159,.14); outline: none; }

.btn-link--danger{ color: var(--zh-danger); }
.btn-link--danger:hover{ background: var(--zh-danger-bg); }

.field--check label{ display: flex; flex-direction: row; align-items: center; gap: 9px; margin: 0; }
.field--check input{ width: 16px; height: 16px; accent-color: var(--zh-blue); }

.uebernahme{ display: inline; }

/* -----------------------------------------------------
   13. Fusszeile
----------------------------------------------------- */
.footer{
  margin-top: 28px;
  border-top: 1px solid var(--zh-line);
  background: var(--zh-surface);
  padding: 20px 0 28px;
  color: var(--zh-muted);
  font-size: 12.5px;
}
.footer__inner{ display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; }

::selection{ background: rgba(11,79,159,.16); }

/* -----------------------------------------------------
   14. Druckansicht
----------------------------------------------------- */
@media print{
  :root{ --zh-bg: #fff; }
  body{ background: #fff; font-size: 11pt; }
  .site-header, .tabbar, .actions, .skip-link, .nav, .katalog, .uebernahme,
  details.panel > summary::before{ display: none !important; }
  .stepno{ background: none; color: #000; border: 1px solid #000; }
  .pagehead{ background: none !important; color: #000; border-bottom: 2px solid #000; }
  .pagehead h1, .lead, .breadcrumbs, .breadcrumbs a{ color: #000 !important; }
  .card{ box-shadow: none; border: 1px solid #999; break-inside: avoid; }
  .grid{ grid-template-columns: 1fr; }
  .kpi__item{ border: 1px solid #999; background: none; }
  a[href]::after{ content: ""; }
  details.panel{ break-inside: avoid; }
  details.panel[open] > summary{ font-weight: 700; }
}

/* -----------------------------------------------------
   15. Bewegungsreduktion
----------------------------------------------------- */
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *{ transition: none !important; animation: none !important; }
}
