/* Henninger-Portal – gemeinsames Aussehen */
:root {
  --navy: #112332;
  --red: #c70f43;
  --red-dark: #aa0b38;
  --accent: #ef0f44;
  --bg: #f3f5f7;
  --line: #dce3e8;
  --muted: #566a77;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--navy); font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
h1 { font-size: clamp(28px, 4vw, 42px); letter-spacing: -.045em; margin: 0; line-height: 1.1; }
h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
code { background: #e8edf1; padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* Kopfzeile */
header.site { background: #fff; box-shadow: 0 1px 0 var(--line); padding: 12px max(4vw, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: block; width: 170px; height: auto; }
.userNav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 14px; }
.userNav a, .linkButton { text-decoration: none; padding: 7px 11px; border-radius: 8px; font-weight: 600; color: var(--navy); }
.userNav a:hover, .linkButton:hover { background: #edf1f4; }
.userNav a[aria-current] { background: #fff1f4; color: var(--red); }
.userNav form { margin: 0; }
.linkButton { border: 0; background: none; cursor: pointer; font: inherit; font-weight: 600; }

main { max-width: 1180px; margin: 32px auto 60px; padding: 0 4vw; }
@media (min-width: 1300px) { main { padding: 0; } }

/* Formulare & Knöpfe */
button, select, input, textarea { font: inherit; color: inherit; border: 1px solid #bcc7cc; background: #fff; border-radius: 8px; padding: 9px 11px; }
button { cursor: pointer; font-weight: 600; transition: background .15s; }
button:hover { background: #edf1f4; }
button.primary { background: var(--red); border-color: var(--red); color: #fff; }
button.primary:hover { background: var(--red-dark); }
button.danger { color: #a40e2f; border-color: #e4b3c0; }
button.danger:hover { background: #fff1f4; }
button.small { padding: 6px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid #dd4364; outline-offset: 1px; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
label > input, label > select, label > textarea { width: 100%; font-weight: 400; font-size: 15px; min-width: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.stack { display: grid; gap: 14px; }
.alert { background: #fff0f3; border: 1px solid #f2b8c6; color: #8c0b2d; padding: 10px 12px; border-radius: 8px; }
.success { background: #e5f6ec; border: 1px solid #b4e0c5; color: #155c33; padding: 10px 12px; border-radius: 8px; }
.error { color: #a40e2f !important; font-weight: 600; }

/* Login */
.loginBox { max-width: 400px; margin: 6vh auto; background: #fff; padding: 30px; border-radius: 16px; box-shadow: 0 8px 30px #11233214; }
.loginBox h1 { font-size: 30px; margin-bottom: 14px; }
.loginBox .primary { margin-top: 6px; padding: 12px; }

/* Portal-Startseite */
.toolGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-top: 24px; }
.toolCard { display: flex; flex-direction: column; gap: 8px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--red); border-radius: var(--radius); padding: 20px; text-decoration: none; box-shadow: 0 3px 12px #11233209; transition: transform .15s, box-shadow .15s; }
a.toolCard:hover { transform: translateY(-2px); box-shadow: 0 8px 24px #11233218; }
.toolCard p { margin: 0; color: var(--muted); flex: 1; }
.toolCard.soon { opacity: .55; border-top-color: #9cabb9; }
.badge { align-self: flex-start; background: #edf1f4; border-radius: 20px; padding: 4px 10px; font-size: 13px; font-weight: 600; }
.badgeWarn { background: #fff1d9; color: #80500c; }

/* Panels & Tabellen */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-top: 24px; }
.panel h2 { margin-bottom: 14px; }
.narrow { max-width: 480px; }
.wrap { background: #fff; overflow: auto; border-radius: 14px; border: 1px solid var(--line); box-shadow: 0 6px 24px #11233209; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th { font-size: 12px; background: #e8edf1; color: #415460; font-weight: 650; }
td, th { padding: 12px 13px; border-bottom: 1px solid #e3e7e9; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7fafb; }
td small { display: block; margin-top: 3px; color: var(--muted); font-size: 12.5px; }
form.inline { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
form.inline input { width: 150px; }
tr.inactive { opacity: .5; }

/* EVU: Kopfbereich */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.crumb { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
#info { font-size: 13px; margin: 10px 0 0; }

/* EVU: Kacheln */
[data-tone] { --ink: #4c5a64; --tint: #edf0f2; --accent: #77838c; }
[data-tone=new] { --ink: #24589a; --tint: #e8f1ff; --accent: #437ed0; }
[data-tone=working] { --ink: #633997; --tint: #f2ebfb; --accent: #9264c1; }
[data-tone=waiting] { --ink: #80500c; --tint: #fff1d9; --accent: #be831f; }
[data-tone=appointment] { --ink: #6824a5; --tint: #f4e6ff; --accent: #a74ce0; }
[data-tone=alarm] { --ink: #a40e2f; --tint: #ffe5ec; --accent: #d91042; }
#dashboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 20px 0; }
#dashboard button { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; text-align: left; padding: 15px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 3px 12px #11233209; font-weight: 500; }
#dashboard button[data-tone=total] { --ink: #fff; --accent: #ff517b; --tint: #344a5b; background: var(--navy); border-color: var(--navy); color: #fff; }
#dashboard button[data-tone=alarm]:not(.calm) { border-color: #f2b8c6; background: #fff7f9; }
#dashboard button.calm { opacity: .6; }
#dashboard button[aria-pressed=true] { outline: 2px solid #d91042; outline-offset: 2px; }
#dashboard .metricLabel { font-weight: 650; font-size: 13px; }
#dashboard svg { width: 31px; height: 31px; padding: 6px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; background: var(--tint); border-radius: 9px; }
#dashboard strong { grid-column: 1 / -1; font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }
.metricBar { grid-column: 1 / -1; height: 5px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--share), var(--tint) var(--share)); }

/* EVU: Filter & Liste */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 8px; }
.filters input { flex: 1 1 260px; }
.filters select { flex: 0 1 220px; }
#count { font-size: 13px; margin: 0 0 6px; }
.listHeading { font-size: 18px; margin: 22px 0 10px; font-weight: 700; }
.doneBlock summary { cursor: pointer; }
.evuTable td:first-child strong { font-weight: 650; }
.cat { display: inline-flex; align-items: center; }
.lineIcon { width: 19px; height: 19px; margin-right: 7px; flex: none; fill: none; stroke: #405668; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.rowStatus { display: inline-block; max-width: 100%; font-size: 13px; font-weight: 650; color: var(--ink); background: var(--tint); border: 1px solid var(--accent); border-radius: 18px; padding: 6px 10px; cursor: pointer; }
span.rowStatus { cursor: default; }
.statusDetail { max-width: 34ch; line-height: 1.4; font-size: 12px; }
.waitTag { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 650; padding: 3px 8px; border-radius: 12px; background: #e5f6ec; color: #155c33; }
.waitTag.warn { background: #fff1d9; color: #80500c; }
.waitTag.alarm { background: #ffe5ec; color: #a40e2f; }
.waitTag.unknown { background: #edf0f2; color: #4c5a64; }
tr.wait-alarm td:first-child { box-shadow: inset 4px 0 #d91042; }
tr.wait-warn td:first-child { box-shadow: inset 4px 0 #e2a43b; }
.done tr { color: #5e6871; }
.done .rowStatus { color: #58636c; border-color: #b9c2c9; background: #e7ebee; }
tr.empty td { color: var(--muted); padding: 20px 13px; }
.rowAction { text-align: right; }
.rowAction button { padding: 7px 11px; font-size: 13px; }

/* Dialoge */
dialog { border: 0; border-radius: 16px; padding: 24px; width: min(780px, 96vw); max-height: 92vh; color: var(--navy); box-shadow: 0 20px 90px #11233240; }
dialog::backdrop { background: #11233285; }
#networkDialog { width: min(520px, 96vw); }
dialog h2 { margin-bottom: 18px; font-size: 22px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wide { grid-column: 1 / -1; }
.groupTitle { font-size: 13px; font-weight: 700; margin: 4px 0 6px; }
.meterRow { display: grid; grid-template-columns: 1fr 1fr 1.3fr 34px; gap: 10px; align-items: end; margin-bottom: 8px; }
.removeMeter { width: 34px; height: 38px; padding: 0; color: #ad123c; font-size: 20px; line-height: 1; }
#postalHint { font-weight: 400; font-size: 12px; color: var(--muted); }
.history { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
.history ol { margin: 0; padding-left: 18px; font-size: 13px; max-height: 140px; overflow: auto; }
.dialogFooter { display: flex; gap: 10px; align-items: center; margin-top: 20px; }
.spacer { flex: 1; }
.networkRows { display: grid; gap: 8px; margin-bottom: 10px; }
.networkRow { display: flex; gap: 8px; }
.networkRow input { flex: 1; min-width: 0; }

/* Handy & Tablet: Tabelle wird zu Karten */
@media (max-width: 760px) {
  main { margin-top: 20px; }
  .brand { width: 140px; }
  .actions { width: 100%; }
  .actions button { flex: 1; }
  #dashboard { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  #dashboard strong { font-size: 26px; }
  .filters select { flex: 1 1 45%; }
  .wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  .evuTable thead, .userTable thead { display: none; }
  .evuTable tr, .userTable tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; box-shadow: 0 3px 12px #11233209; }
  .evuTable td, .userTable td { border: 0; padding: 0; }
  .evuTable td:first-child { grid-column: 1 / -1; font-size: 16px; box-shadow: none !important; }
  .evuTable td:nth-child(4) { grid-column: 1 / -1; }
  .evuTable tr.wait-alarm { border-left: 5px solid #d91042; }
  .evuTable tr.wait-warn { border-left: 5px solid #e2a43b; }
  .evuTable .rowAction { grid-column: 1 / -1; text-align: left; }
  .evuTable .rowAction button { width: 100%; padding: 10px; }
  .evuTable tr.empty { display: block; }
  .evuTable td:nth-child(5)::before { content: "Zuständig: "; color: var(--muted); font-size: 13px; }
  .userTable td { grid-column: 1 / -1; }
  .userTable td::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
  .grid { grid-template-columns: 1fr; }
  .meterRow { grid-template-columns: 1fr 1fr 34px; }
  .meterRow label:nth-child(3) { grid-column: 1 / 3; grid-row: 2; }
  .meterRow .removeMeter { grid-column: 3; grid-row: 1; }
  dialog { padding: 18px; }
  .dialogFooter { flex-wrap: wrap; }
}
