:root {
  --ink: #17191c;
  --muted: #626870;
  --line: #c9cdd1;
  --surface: #ffffff;
  --surface-soft: #f3f4f5;
  --table: #c5c7c9;
  --table-dark: #aeb1b4;
  --yellow: #ffef00;
  --red: #e30613;
  --red-dark: #b8000a;
  --blue: #123c55;
  --shadow: 0 14px 40px rgba(17, 28, 38, .10);
  --radius: 16px;
}
* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: #e8eaec; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1420px, calc(100% - 32px)); margin-inline: auto; }
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(23,25,28,.96); color: white; border-bottom: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(12px); }
.header-inner { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 9px; background: var(--yellow); color: #111; font-weight: 900; font-size: 1.25rem; }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: #bac1c7; font-size: .76rem; font-weight: 500; }
.version { color: #cfd4d8; font-size: .82rem; }
.site-footer { margin-top: 42px; padding: 22px 0; background: #17191c; color: #cfd4d8; font-size: .86rem; }
.site-footer .shell { display: flex; flex-wrap: wrap; gap: 8px; }
.site-footer a { color: white; }
.hub-main, .module-main { padding-top: 28px; }
.breadcrumbs { display: flex; gap: 9px; align-items: center; margin: 2px 0 22px; color: var(--muted); font-size: .88rem; }
.breadcrumbs a { text-decoration: none; }
.hero { background: linear-gradient(120deg, #fff 0%, #f6f7f7 70%, #e5e8e9 100%); border: 1px solid #d4d7da; border-radius: var(--radius); box-shadow: var(--shadow); }
.compact-hero { padding: 42px; }
.module-hero { padding: 32px 38px; display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.hero h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.55rem); line-height: 1.02; letter-spacing: -.04em; }
.hero p:not(.eyebrow) { max-width: 860px; margin: 16px 0 0; color: var(--muted); line-height: 1.6; font-size: 1.02rem; }
.eyebrow { margin: 0 0 8px; color: var(--red); text-transform: uppercase; letter-spacing: .14em; font-size: .76rem; font-weight: 850; }
.hero-badge { min-width: 132px; aspect-ratio: 1; display: grid; place-content: center; text-align: center; border-radius: 50%; background: var(--yellow); font-size: 1.3rem; font-weight: 900; line-height: 1.1; box-shadow: inset 0 0 0 6px rgba(0,0,0,.06); }
.hero-badge small { font-size: .7rem; font-weight: 700; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; margin-top: 24px; }
.module-card { min-height: 220px; display: flex; gap: 22px; padding: 28px; border-radius: var(--radius); border: 1px solid #d1d5d8; background: white; text-decoration: none; box-shadow: 0 10px 26px rgba(0,0,0,.06); }
.module-card.active:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.module-card { transition: .18s ease; }
.module-card h2 { margin: 0 0 10px; font-size: 1.42rem; }
.module-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.module-number { flex: 0 0 50px; height: 50px; display: grid; place-items: center; border-radius: 10px; background: var(--yellow); font-weight: 900; }
.module-card.planned { opacity: .68; }
.card-link { display: block; margin-top: 28px; font-weight: 800; color: var(--red-dark); }
.info-strip { margin-top: 20px; padding: 22px 28px; display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; border: 1px solid #d1d5d8; background: #f6f7f7; border-radius: var(--radius); }
.info-strip strong, .info-strip span { display: block; }
.info-strip span { margin-top: 4px; color: var(--muted); font-size: .9rem; }
.input-card { margin-top: 22px; background: var(--red); color: white; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
#coordinate-form { display: grid; grid-template-columns: minmax(0,2.1fr) minmax(250px,.9fr); gap: 22px; align-items: end; }
.input-card label { display: block; margin-bottom: 8px; font-weight: 800; }
.input-card label small { font-weight: 500; opacity: .86; }
.coordinate-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; }
.input-wrap { position: relative; }
.input-wrap input { padding-left: 48px; }
.input-icon { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); color: #4d5358; font-size: 1.35rem; pointer-events: none; }
input[type="text"] { width: 100%; min-height: 54px; border: 2px solid transparent; border-radius: 8px; padding: 11px 14px; background: white; color: #111; outline: none; }
input[type="text"]:focus { border-color: var(--yellow); box-shadow: 0 0 0 4px rgba(255,239,0,.24); }
.btn { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 17px; border: 1px solid transparent; border-radius: 8px; text-decoration: none; font-weight: 800; white-space: nowrap; }
.btn-primary { min-width: 142px; min-height: 54px; background: white; color: #111; border-color: #cdd1d3; box-shadow: 0 2px 0 rgba(0,0,0,.16); }
.btn-primary:hover { background: var(--yellow); }
.btn-secondary { background: white; border-color: #b8bdc1; color: #202326; font-size: .88rem; }
.btn-secondary:hover { background: #f0f1f2; }
.btn:disabled { opacity: .6; cursor: wait; }
.spinner { display: none; width: 17px; height: 17px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.form-meta { margin-top: 8px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 18px; font-size: .82rem; }
.text-button { border: 0; padding: 0; background: transparent; color: white; text-decoration: underline; text-underline-offset: 3px; }
.status { min-height: 0; margin-top: 0; border-radius: 8px; font-size: .9rem; }
.status:not(:empty) { min-height: 43px; margin-top: 16px; padding: 11px 13px; background: rgba(0,0,0,.18); }
.status.error { background: #720008; }
.result-section { margin-top: 26px; }
.result-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
.result-head h2 { margin: 0; font-size: 2rem; }
.result-head .muted { margin: 5px 0 0; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.muted { color: var(--muted); }
.summary-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 16px; }
.summary-item { min-height: 88px; padding: 15px 17px; border: 1px solid #cdd1d4; border-radius: 10px; background: white; }
.summary-item span, .summary-item strong { display: block; }
.summary-item span { color: var(--muted); font-size: .78rem; }
.summary-item strong { margin-top: 8px; font-size: 1.02rem; overflow-wrap: anywhere; }
.method-layout { display: grid; grid-template-columns: 245px minmax(0,1fr); border: 1px solid #92979b; background: var(--table); box-shadow: var(--shadow); }
.method-panel { padding: 14px; border-right: 1px solid #858a8e; background: #b6b9bb; }
.method-label { margin: 0 0 10px; font-size: .76rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.method-button { width: 100%; padding: 13px 12px; margin-bottom: 8px; text-align: left; border: 1px solid #8e9397; background: #d0d2d3; color: #151719; }
.method-button span, .method-button small { display: block; }
.method-button span { font-weight: 760; }
.method-button small { margin-top: 3px; color: #555c61; font-size: .72rem; }
.method-button.active { border-color: #111; background: var(--yellow); box-shadow: inset 5px 0 0 var(--red); }
.method-button.active span { font-weight: 900; }
.method-note { margin-top: 14px; padding: 10px; background: rgba(255,255,255,.35); font-size: .75rem; line-height: 1.4; }
.table-panel { min-width: 0; background: var(--table); }
.table-title-row { min-height: 58px; display: grid; grid-template-columns: 175px 1fr; border-bottom: 1px solid #111; }
.gridpoint-label { display: flex; align-items: center; padding: 10px 13px; background: var(--yellow); border-right: 1px solid #111; font-size: 1.05rem; font-weight: 900; }
.table-title-row > div:last-child { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 15px; }
.table-title-row span { color: #3d4246; font-size: .8rem; }
.table-scroll { overflow: auto; max-height: 72vh; background: var(--table); }
.rain-table { width: 100%; min-width: 850px; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.rain-table th, .rain-table td { padding: 7px 9px; border-right: 1px solid #111; border-bottom: 1px solid #111; text-align: right; background: var(--table); }
.rain-table th { font-weight: 780; }
.rain-table thead th { position: sticky; top: 0; z-index: 3; background: var(--table-dark); text-align: center; }
.rain-table thead th:first-child { left: 0; z-index: 4; }
.rain-table tbody th { position: sticky; left: 0; z-index: 2; text-align: center; background: #d0d2d3; }
.rain-table tr:hover td, .rain-table tr:hover th { background: #e0e1e2; }
.rain-table tr.highlight td, .rain-table tr.highlight th { font-weight: 900; }
.source-box { margin-top: 16px; padding: 17px 20px; border-left: 5px solid var(--yellow); background: white; box-shadow: 0 5px 16px rgba(0,0,0,.04); }
.source-box p { margin: 6px 0 0; color: var(--muted); line-height: 1.5; }
.small { font-size: .78rem; }
.explanation-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-top: 22px; }
.explanation-grid article { position: relative; padding: 22px 20px 19px 66px; border: 1px solid #cdd1d4; background: rgba(255,255,255,.72); }
.explanation-grid article > span { position: absolute; left: 19px; top: 21px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #1c2023; color: white; font-weight: 900; }
.explanation-grid h3 { margin: 0; font-size: 1rem; }
.explanation-grid p { margin: 7px 0 0; color: var(--muted); font-size: .84rem; line-height: 1.5; }
@media (max-width: 980px) {
  #coordinate-form, .method-layout { grid-template-columns: 1fr; }
  .method-panel { border-right: 0; border-bottom: 1px solid #858a8e; display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
  .method-label, .method-note { grid-column: 1 / -1; }
  .method-button { margin: 0; }
  .summary-grid { grid-template-columns: repeat(2,1fr); }
  .module-grid { grid-template-columns: 1fr; }
  .info-strip, .explanation-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .shell { width: min(100% - 18px, 1420px); }
  .header-inner { height: 62px; }
  .version { display: none; }
  .module-hero, .compact-hero { padding: 25px 20px; }
  .hero-badge { display: none; }
  .input-card { padding: 16px; }
  .coordinate-row { grid-template-columns: 1fr; }
  .btn-primary { width: 100%; }
  .result-head { align-items: flex-start; flex-direction: column; }
  .summary-grid { grid-template-columns: 1fr; }
  .method-panel { grid-template-columns: 1fr; }
  .table-title-row { grid-template-columns: 1fr; }
  .gridpoint-label { border-right: 0; border-bottom: 1px solid #111; }
  .table-title-row > div:last-child { align-items: flex-start; flex-direction: column; }
  .form-meta { flex-direction: column; }
}
@media print {
  .site-header, .site-footer, .input-card, .result-actions, .explanation-grid, .breadcrumbs { display: none !important; }
  body { background: white; }
  .shell { width: 100%; }
  .method-layout { box-shadow: none; }
  .table-scroll { max-height: none; overflow: visible; }
}

/* Ort- und Postleitzahlensuche */
.form-side { min-width: 0; }
.place-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.btn-place-search { min-height: 54px; background: #202326; border-color: rgba(255,255,255,.5); color: white; }
.btn-place-search:hover { background: var(--yellow); color: #111; border-color: #111; }
.place-help { margin-top: 7px; color: rgba(255,255,255,.9); font-size: .76rem; line-height: 1.4; }
.place-results { margin-top: 9px; max-height: 280px; overflow: auto; border: 1px solid #7d0007; border-radius: 8px; background: white; color: #17191c; box-shadow: 0 12px 28px rgba(0,0,0,.22); }
.place-result-item { width: 100%; display: block; padding: 11px 13px; border: 0; border-bottom: 1px solid #d8dbdd; background: white; color: #17191c; text-align: left; }
.place-result-item:last-child { border-bottom: 0; }
.place-result-item:hover, .place-result-item:focus { background: var(--yellow); outline: none; }
.place-result-item strong, .place-result-item span { display: block; }
.place-result-item strong { font-size: .9rem; }
.place-result-item span { margin-top: 3px; color: #596067; font-size: .73rem; line-height: 1.35; }
.place-result-item:hover span, .place-result-item:focus span { color: #303438; }

@media (max-width: 680px) {
  .place-search-row { grid-template-columns: 1fr; }
  .btn-place-search { width: 100%; }
}

/* Berechnung speichern/laden/zurücksetzen */
.btn-reset {
  background: #fff1f2;
  border-color: #c20a15;
  color: #9b0009;
  font-size: .88rem;
}
.btn-reset:hover { background: #ffdadd; }
.persistence-hint { padding-top: 8px; border-top: 1px solid #e1e3e5; }
.print-report { display: none; }

/* Druckausgabe nach der offiziellen eHYD-Tabellenvorlage */
@page { size: A4 landscape; margin: 7mm; }

@media print {
  html, body { width: auto; min-height: 0; margin: 0; padding: 0; background: #fff !important; color: #000; }
  body > *:not(.print-report) { display: none !important; }
  .print-report { display: block !important; font-family: Arial, Helvetica, sans-serif; color: #000; }
  .print-page {
    position: relative;
    width: 100%;
    min-height: 190mm;
    padding: 0 0 23mm;
    break-after: page;
    page-break-after: always;
  }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .print-page-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 7mm;
    padding: 0 8mm 1.5mm;
    font-size: 8pt;
  }
  .print-page-top span:first-child { margin-inline: auto; transform: translateX(34mm); }
  .print-title-box {
    min-height: 22mm;
    padding: 2mm 5mm 2.5mm;
    border: .25mm solid #333;
    text-align: center;
  }
  .print-title-box h1 { margin: 0; font-size: 12pt; line-height: 1.15; }
  .print-title-box p { margin: .3mm 0 0; font-size: 10.5pt; line-height: 1.1; }
  .print-title-box .print-project { margin-top: 1.2mm; font-size: 8pt; }
  .print-continuation { height: 16mm; display: flex; align-items: center; justify-content: center; font-size: 9pt; }
  .print-rain-table {
    width: 78%;
    margin: 0 auto;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 8.5pt;
    font-variant-numeric: tabular-nums;
  }
  .print-rain-table th, .print-rain-table td {
    padding: .45mm 1.25mm;
    border: 0;
    text-align: right;
    line-height: 1.05;
  }
  .print-rain-table thead th {
    border-top: .22mm solid #333;
    border-bottom: .22mm solid #333;
    font-weight: 700;
    text-align: center;
  }
  .print-rain-table thead tr:first-child th:first-child,
  .print-rain-table thead tr:nth-child(2) th:first-child {
    width: 36mm;
    padding-right: 2mm;
    text-align: right;
    font-weight: 400;
  }
  .print-rain-table thead tr:nth-child(2) th { border-top: 0; }
  .print-duration-group tr:first-child > * { border-top: .18mm solid #555; }
  .print-duration-group:last-of-type tr:last-child > * { border-bottom: .22mm solid #333; }
  .print-duration-group th[scope="rowgroup"] {
    border-right: .18mm solid #555;
    text-align: right;
    vertical-align: middle;
    font-weight: 700;
    white-space: nowrap;
  }
  .print-maxmodn td, .print-okostra td { font-style: italic; font-weight: 400; }
  .print-bemessung td { font-weight: 700; }
  .print-notes {
    position: absolute;
    left: 8mm;
    right: 8mm;
    bottom: 2mm;
    font-size: 7.2pt;
    line-height: 1.22;
  }
  .print-notes p { margin: 0 0 1.1mm; }
  .print-notes a { color: #000; text-decoration: underline; }
}

.module-next-link a { font-weight: 800; color: var(--red-dark); }


/* Grafikdialog Bemessungsniederschlag */
.graphic-dialog { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 12px; background: rgba(0,0,0,.52); }
.graphic-dialog[hidden] { display: none !important; }
.graphic-dialog-panel { width: min(760px, 100%); max-height: calc(100vh - 24px); overflow: auto; border-radius: 14px; background: #fff; box-shadow: 0 22px 70px rgba(0,0,0,.28); }
body.graphic-dialog-open { overflow: hidden; }
.graphic-form { padding: 22px; background: #fff; }
.graphic-form-head h3 { margin: 0 0 8px; font-size: 1.3rem; }
.graphic-form-head p { margin: 0 0 18px; color: var(--muted); line-height: 1.45; }
.graphic-form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.graphic-form fieldset { margin: 0; padding: 14px; border: 1px solid #d1d5d8; }
.graphic-form legend { padding: 0 6px; font-weight: 800; }
.graphic-form label { display: block; margin: 10px 0 6px; font-weight: 700; font-size: .9rem; }
.graphic-form select { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid #b7bdc2; border-radius: 8px; font: inherit; }
.graphic-check { display: flex !important; align-items: center; gap: 8px; margin-top: 16px !important; font-weight: 700; }
.graphic-check input { width: 18px; height: 18px; }
.graphic-form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
@media (max-width: 680px) { .graphic-form-grid { grid-template-columns: 1fr; } .graphic-form-actions .btn { width: 100%; } }
