/* Kundenportal Netcomplete. Farben, Schrift und Radien stammen aus dem Auftritt von netcomplete.ch
   (STYLE in newsite/build.py). Statusfarben sind für Text leicht abgedunkelt, damit sie WCAG AA erfüllen. */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --bg: #fff;
  --bg-soft: #f5f5f7;
  --surface: #fff;
  --surface-hover: #ececed;
  --accent: #0071e3;
  --accent-hover: #0062c4;
  --link: #0066cc; /* Text-Links: etwas dunkler als das Marken-Blau, damit sie auch auf dem grauen Grund AA erreichen */
  --on-accent: #fff;
  --border: rgba(0, 0, 0, .1);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  --radius: 22px;
  --radius-sm: 12px;
  --ok: #17753f;
  --ok-bg: #e7f5ec;
  --warn: #8a4f0c;
  --warn-bg: #fdf1e1;
  --err: #b8301c;
  --err-bg: #fdeceb;
  --info: #0062c4;
  --info-bg: #eaf3fd;
  --speed: 180ms;
  color-scheme: light;
}
/* Dunkel: ausdrücklich gewählt … */
html[data-theme="dark"] {
  --ink: #f5f5f7;
  --muted: #a1a1a6;
  --bg: #000;
  --bg-soft: #161618;
  --surface: #1c1c1e;
  --surface-hover: #2c2c2e;
  --accent: #2b95ff;
  --accent-hover: #55aaff;
  --link: #2b95ff;
  --on-accent: #00172e;
  --border: rgba(255, 255, 255, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .5);
  --ok: #4cd97b;
  --ok-bg: #10301c;
  --warn: #ffb340;
  --warn-bg: #33240a;
  --err: #ff6b61;
  --err-bg: #3a1512;
  --info: #6cb6ff;
  --info-bg: #0c2440;
  color-scheme: dark;
}
/* … oder vom System vorgegeben, solange nichts gewählt ist. */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --ink: #f5f5f7;
    --muted: #a1a1a6;
    --bg: #000;
    --bg-soft: #161618;
    --surface: #1c1c1e;
    --surface-hover: #2c2c2e;
    --accent: #2b95ff;
    --accent-hover: #55aaff;
    --link: #2b95ff;
    --on-accent: #00172e;
    --border: rgba(255, 255, 255, .16);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .5);
    --ok: #4cd97b;
    --ok-bg: #10301c;
    --warn: #ffb340;
    --warn-bg: #33240a;
    --err: #ff6b61;
    --err-bg: #3a1512;
    --info: #6cb6ff;
    --info-bg: #0c2440;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg-soft);
}
h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 24px; }
h2 { font-size: 1.125rem; line-height: 1.3; margin: 0 0 6px; }
p { margin: 0 0 16px; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
.muted { color: var(--muted); }
.lead { font-size: 1.125rem; color: var(--muted); max-width: 34em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
main:focus { outline: none; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 10; background: var(--accent); color: var(--on-accent); padding: 10px 16px; border-radius: 980px; text-decoration: none; }
.skip:focus { top: 12px; color: var(--on-accent); }

.icon { width: 24px; height: 24px; flex: none; }
.icon-sm { width: 18px; height: 18px; }

/* Einsicht als Kunde: festes, nicht schliessbares Banner in eigener Farbe, mit Icon und Text */
.einsicht { position: sticky; top: 0; z-index: 20; background: #7a2e00; color: #fff; border-bottom: 3px solid #ffb340; }
.einsicht-inner { max-width: 1120px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.einsicht p { margin: 0; flex: 1; min-width: 220px; }
.einsicht form { margin: 0; }
.einsicht .btn { background: #fff; color: #4a1c00; }
.einsicht .btn:hover { background: #ffe8c2; color: #4a1c00; }
.einsicht :focus-visible { outline-color: #fff; }

/* Kopfzeile */
.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top-inner { max-width: 1120px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; min-height: 44px; }
.brand:hover { color: var(--ink); }
.brand-sub { color: var(--muted); font-weight: 400; padding-left: 10px; border-left: 1px solid var(--border); }
.nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; white-space: nowrap; border-radius: 980px; color: var(--ink); text-decoration: none; transition: background-color var(--speed) ease; }
.nav a:hover { background: var(--surface-hover); }
.nav a[aria-current="page"] { background: var(--bg-soft); font-weight: 600; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who { display: flex; align-items: center; gap: 8px; margin: 0; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; transition: background-color var(--speed) ease; }
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn[hidden] { display: none; }
.theme-moon { display: none; }
html[data-theme="dark"] .theme-sun { display: none; }
html[data-theme="dark"] .theme-moon { display: block; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-sun { display: none; }
  html:not([data-theme="light"]) .theme-moon { display: block; }
}

/* Inhalt */
.main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 56px 24px 72px; flex: 1; }
.main-narrow { max-width: 640px; }
.hero, .message { padding-top: 32px; }
.flash { background: var(--info-bg); color: var(--ink); border-radius: var(--radius-sm); padding: 12px 16px; }

/* Knöpfe: eine Hauptaktion pro Ansicht (.btn), alles Weitere ruhig (.btn-quiet) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 22px; border: 1px solid transparent; border-radius: 980px; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color var(--speed) ease, transform var(--speed) ease; }
.btn:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn:active { transform: scale(.98); }
.btn-large { min-height: 52px; padding: 0 30px; font-size: 1.0625rem; }
.btn-small { min-height: 44px; padding: 0 16px; font-size: .9375rem; }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--border); }
.btn-quiet:hover { background: var(--surface-hover); color: var(--ink); }
.btn-text { background: transparent; color: var(--link); padding: 0 10px; font-weight: 500; }
.btn-text:hover { background: transparent; color: var(--accent-hover); text-decoration: underline; }

/* Hinweise */
.notice { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin: 0 0 16px; }
.notice p { margin: 0; color: var(--muted); }
.notice-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--info-bg); color: var(--info); }
.notice-warn .notice-icon { background: var(--warn-bg); color: var(--warn); }
.notice-err .notice-icon { background: var(--err-bg); color: var(--err); }
.notice-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.notice-actions form { margin: 0; }
.notice-actions:empty { display: none; }

/* Status: Farbe, Icon und Text zusammen */
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 8px; border-radius: 980px; font-size: .875rem; font-weight: 600; background: var(--bg-soft); color: var(--muted); }
.status-ok { background: var(--ok-bg); color: var(--ok); }
.status-warn { background: var(--warn-bg); color: var(--warn); }
.status-err { background: var(--err-bg); color: var(--err); }
.status-info { background: var(--info-bg); color: var(--info); }

/* Leerer Zustand */
.empty { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 56px 24px 64px; text-align: center; margin-top: 32px; }
.empty h2 { font-size: 1.5rem; margin-bottom: 8px; }
.empty p { color: var(--muted); max-width: 30em; margin: 0 auto 28px; }
.empty-art { width: 240px; max-width: 70%; height: auto; margin-bottom: 20px; }
.art-card { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; }
.art-back { fill: var(--bg-soft); }
.art-line { fill: var(--muted); opacity: .55; }
.art-faint { opacity: .22; }
.art-plus-bg { fill: var(--accent); }
.art-plus { stroke: var(--on-accent); stroke-width: 3.5; stroke-linecap: round; fill: none; }

/* Karten (Katalog, Verwaltung) */
.cards, .plans, .rows, .checks { list-style: none; margin: 0; padding: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 32px 0 24px; }
.card { display: flex; flex-direction: column; gap: 6px; height: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.card-link { color: var(--ink); text-decoration: none; transition: transform var(--speed) ease, box-shadow var(--speed) ease, border-color var(--speed) ease; }
.card-link:hover { color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.card-title { font-size: 1.125rem; font-weight: 600; margin-top: 10px; }
.card-text { color: var(--muted); flex: 1; }
.card-price { font-weight: 600; margin-top: 10px; }
.badge { width: 52px; height: 52px; display: inline-grid; place-items: center; flex: none; border-radius: 16px; background: var(--info-bg); color: var(--info); }
.badge-sm { width: 40px; height: 40px; border-radius: 12px; }
.badge-sm .icon { width: 20px; height: 20px; }
.badge-lg { width: 64px; height: 64px; border-radius: 20px; }
.badge-lg .icon { width: 30px; height: 30px; }
.fine { font-size: .875rem; }
.back { margin-bottom: 20px; }
.back a::before { content: "‹ "; }
.service-head { display: flex; gap: 20px; align-items: center; margin-bottom: 8px; }
.service-head h1 { margin-bottom: 6px; }
.service-head .lead { margin: 0; }

/* Pakete */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin: 32px 0 24px; }
.plan { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.plan-beliebt { border-color: var(--accent); box-shadow: var(--shadow); }
.plan h2 { font-size: 1.25rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tag { font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 980px; background: var(--info-bg); color: var(--info); }
.plan-price { display: flex; flex-direction: column; gap: 2px; margin: 8px 0 16px; color: var(--muted); }
.plan-price strong { color: var(--ink); font-size: 1.25rem; }
.plan-save { font-size: .875rem; color: var(--ok); font-weight: 600; }
.checks { display: grid; gap: 8px; flex: 1; align-content: start; margin-bottom: 16px; }
.checks li { display: flex; gap: 8px; align-items: flex-start; }
.checks .icon { color: var(--ok); margin-top: 3px; }
.plan-action { margin: 8px 0 0; }

/* Listen (Bestellungen) */
.rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 24px 0 16px; }
.row { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 18px; color: var(--ink); text-decoration: none; transition: border-color var(--speed) ease, background-color var(--speed) ease; }
a.row:hover { color: var(--ink); border-color: var(--accent); }
.row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.row-side { display: flex; align-items: center; gap: 12px; flex: none; }
.row-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-form { display: flex; gap: 8px; margin: 0; flex: none; }
.input { min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); font: inherit; min-width: 0; }
.block { margin-top: 32px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.cta { margin-top: 24px; }
.toolbar { margin-top: 24px; }

/* Detail */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin: 24px 0 16px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px 24px; margin: 0; }
.facts dt { color: var(--muted); font-size: .875rem; margin-bottom: 2px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.flash-ok { background: var(--ok-bg); }
.flash-err { background: var(--err-bg); }

/* Kennzahlen der Übersicht */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 8px 0 8px; }
.tile { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; color: var(--ink); text-decoration: none; }
.tile-link { transition: border-color var(--speed) ease; }
.tile-link:hover { color: var(--ink); border-color: var(--accent); }
.tile-icon { width: 44px; height: 44px; display: grid; place-items: center; flex: none; border-radius: 14px; background: var(--info-bg); color: var(--info); }
.tile-body { display: flex; flex-direction: column; min-width: 0; }
.tile-label { color: var(--muted); font-size: .875rem; }
.tile-value { font-size: 1.5rem; font-weight: 600; line-height: 1.25; }
.tile-hint { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }

/* Formulare */
.form { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend { font-weight: 600; padding: 0; }
.opt { font-weight: 400; color: var(--muted); }
.field .input { width: 100%; }
.input-area { padding: 10px 14px; min-height: 110px; resize: vertical; }
select.input { appearance: auto; }
.hint { margin: 0; font-size: .875rem; color: var(--muted); }
.err { margin: 0; font-size: .875rem; color: var(--err); font-weight: 600; }
.field-err .input { border-color: var(--err); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field-row-plz { grid-template-columns: 140px 1fr; }
.choice { gap: 8px; }
.choice legend { margin-bottom: 8px; }
.choice .choice-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-weight: 400; transition: border-color var(--speed) ease, background-color var(--speed) ease; }
.choice .choice-item:hover { border-color: var(--accent); }
.choice .choice-item:has(input:checked) { border-color: var(--accent); background: var(--info-bg); }
.choice-item input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.choice-item span { display: flex; flex-direction: column; }
.choice-text { color: var(--muted); font-size: .875rem; }
.check { display: flex; gap: 12px; align-items: flex-start; margin: 8px 0 20px; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.errors { background: var(--err-bg); border-radius: var(--radius-sm); padding: 16px 20px; margin: 16px 0; }
.errors h2 { color: var(--err); font-size: 1rem; }
.errors ul { margin: 6px 0 0; padding-left: 20px; }
.form-actions { margin: 24px 0 8px; }
.form-back { margin: 0; }
.price-fix { margin-bottom: 18px; color: var(--muted); }
.price-fix strong { color: var(--ink); font-size: 1.25rem; }
.panel h2 { margin-bottom: 16px; }
.panel .facts + p { margin-top: 16px; }
.panel .facts + h2 { margin-top: 28px; margin-bottom: 6px; }
.address { margin: 0; }
.status-line { margin: 20px 0 0; }
.quiet-action { margin-top: 24px; }
.quiet-action a { color: var(--muted); }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover { background: var(--err); color: #fff; filter: brightness(.92); }
html[data-theme="dark"] .btn-danger { color: #1a0503; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .btn-danger { color: #1a0503; } }

/* Beträge */
.sum { width: 100%; max-width: 360px; margin: 20px 0 0 auto; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.sum th { text-align: left; font-weight: 400; color: var(--muted); padding: 4px 0; }
.sum td { text-align: right; padding: 4px 0; white-space: nowrap; }
.sum-total th, .sum-total td { border-top: 1px solid var(--border); padding-top: 10px; font-weight: 600; font-size: 1.125rem; color: var(--ink); }

/* Suche, Tabellen, einfache Listen */
.search { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 8px; }
.search .input { flex: 1; min-width: 180px; }
.table-wrap { overflow-x: auto; margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.plain { margin: 12px 0 0; padding-left: 20px; }
.plain li { margin-bottom: 6px; }

/* Skeleton: erscheint, wenn die nächste Seite länger als einen Augenblick braucht (portal.js) */
.skeleton { animation: sk-in var(--speed) ease both; }
.sk { background: linear-gradient(90deg, var(--surface-hover) 25%, var(--surface) 50%, var(--surface-hover) 75%); background-size: 200% 100%; border-radius: var(--radius-sm); animation: sk-wave 1.4s linear infinite; }
.sk-title { height: 40px; width: min(320px, 70%); margin-bottom: 32px; }
.sk-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.sk-tile { height: 96px; border-radius: var(--radius); }
.sk-block { height: 280px; border-radius: var(--radius); }
@keyframes sk-wave { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes sk-in { from { opacity: 0; } to { opacity: 1; } }

/* Fusszeile */
.foot { padding: 24px; text-align: center; color: var(--muted); font-size: .875rem; }
.foot p { margin: 0 0 4px; }
.foot a { color: var(--muted); }

/* Schmal (ab 375 px nutzbar) */
@media (max-width: 720px) {
  .top-inner { padding: 8px 16px; gap: 4px 12px; }
  .einsicht-inner { padding: 10px 16px; }
  .brand-sub { display: none; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .nav a { padding: 0 12px; }
  .main { padding: 32px 16px 56px; }
  .notice { grid-template-columns: auto 1fr; padding: 16px; }
  .notice-actions { grid-column: 1 / -1; }
  .notice-actions, .notice-actions form { width: 100%; }
  .notice-actions .btn { width: 100%; }
  .empty { padding: 40px 16px 48px; }
  .sk-row { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .field-row-plz { grid-template-columns: 110px 1fr; }
  .sum { max-width: none; }
  .row { flex-wrap: wrap; }
  .row-side { width: 100%; justify-content: space-between; padding-left: 56px; }
  .row-form { width: 100%; }
  .row-form .input { flex: 1; }
  .service-head { align-items: flex-start; gap: 14px; }
}

/* Bewegung nur für Zustandswechsel, und gar nicht, wenn das System es so wünscht */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Bexio-Abgleich */
.job { flex-wrap: wrap; }
.job-err { color: var(--err); font-size: .875rem; margin-top: 4px; overflow-wrap: anywhere; }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; align-items: center; }
.job-actions form { margin: 0; }
