/* CoastNav – Admin-Uebersicht am PC (admin.html, js/admin/page.js)
   Farben, Abstaende, Typo aus tokens.css (hell/dunkel), Knoepfe/Felder aus components.css.
   Breit gedacht (PC), geht aber bis 360 px herunter. */

html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: var(--c-bg);
  color: var(--c-text);
  font: var(--fw-regular) var(--fs-md)/var(--lh-md) var(--font);
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; }

/* Ampelfarben je Stufe – eine Stelle fuer Punkt, Plakette, Balken, Rahmen */
[data-level] { --lv: var(--c-text-3); --lv-bg: var(--c-surface-2); }
[data-level="ok"] { --lv: var(--c-ok); --lv-bg: var(--c-ok-bg); }
[data-level="warn"] { --lv: var(--c-warn); --lv-bg: var(--c-warn-bg); }
[data-level="alarm"] { --lv: var(--c-danger); --lv-bg: var(--c-danger-bg); }
[data-level="info"] { --lv: var(--c-accent); --lv-bg: var(--c-info-bg); }

/* ── Kopf ─────────────────────────────────────────────────────────── */
.adm-header {
  position: sticky; top: 0; z-index: var(--z-header);
  height: 56px; box-sizing: border-box; padding: 0 16px 0 8px;
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--c-header); color: var(--c-on-header);
}
.adm-hbtn {
  min-width: 40px; height: 40px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  border: 0; border-radius: var(--r-md); background: transparent; color: inherit;
  font: inherit; cursor: pointer; text-decoration: none;
}
.adm-hbtn--text { padding: 0 var(--sp-3); border: 1px solid rgb(255 255 255 / .45); font-size: var(--fs-sm); }
.adm-hbtn:hover { background: rgb(255 255 255 / .12); }
.adm-hbtn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.adm-hbtn[hidden] { display: none; }
.adm-logo { display: block; flex-shrink: 0; }
.adm-title { font: 700 21px/1 'Bricolage Grotesque', 'Bricolage Grotesque Fallback', var(--font); letter-spacing: .2px; }
.adm-stamp { font-size: var(--fs-sm); opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.adm-spacer { flex: 1; }

/* ── Seite ────────────────────────────────────────────────────────── */
.adm-main { max-width: 1440px; margin: 0 auto; padding: var(--sp-6) var(--sp-6) var(--sp-8); box-sizing: border-box; }
.adm-page { display: flex; flex-direction: column; gap: var(--sp-6); }
.adm-busy { color: var(--c-text-3); padding: var(--sp-8) 0; text-align: center; }

.adm-card {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg);
  box-shadow: var(--sh-1), var(--surface-outline);
  padding: var(--sp-5); box-sizing: border-box;
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.adm-card__title, .adm-section-title {
  font: 700 var(--fs-lg)/var(--lh-lg) 'Bricolage Grotesque', 'Bricolage Grotesque Fallback', var(--font);
}
.adm-section-title { margin-bottom: var(--sp-3); }
.adm-sub { font: var(--fw-bold) var(--fs-sm)/var(--lh-sm) var(--font); color: var(--c-text-2); text-transform: uppercase; letter-spacing: .04em; }
.adm-note { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--c-text-3); }
.adm-foot { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--c-text-3); text-align: center; }

.adm-banner {
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  background: var(--lv-bg); color: var(--lv); border: 1px solid var(--lv);
  font-weight: var(--fw-bold);
}

/* ── Oben: Zusammenfassung + Zum Pruefen ─────────────────────────── */
.adm-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: var(--sp-5); align-items: start; }
.adm-sum { border-left: 6px solid var(--lv); }
.adm-sum__head { font: 700 var(--fs-2xl)/var(--lh-2xl) 'Bricolage Grotesque', 'Bricolage Grotesque Fallback', var(--font); color: var(--lv); }
.adm-counts { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); color: var(--c-text-2); }
.adm-count { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.adm-sum__lines { list-style: none; display: flex; flex-direction: column; gap: var(--sp-2); }
.adm-sum__lines li {
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--c-surface-2);
  font-size: var(--fs-sm); line-height: var(--lh-sm); overflow-wrap: anywhere;
}
.adm-review { align-self: flex-start; text-decoration: none; }

/* ── Nutzer-Kacheln ──────────────────────────────────────────────── */
/* 6 Kacheln: 6 / 3 / 2 je Zeile – nie eine allein in der letzten Zeile */
.adm-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-2); }
@media (min-width: 1180px) { .adm-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.adm-tile {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg);
  box-shadow: var(--sh-1), var(--surface-outline); padding: var(--sp-4);
  display: flex; flex-direction: column; gap: 2px;
}
.adm-tile__label { font-size: var(--fs-sm); color: var(--c-text-2); font-weight: var(--fw-bold); }
.adm-tile__value {
  font: 700 32px/1.15 'Bricolage Grotesque', 'Bricolage Grotesque Fallback', var(--font);
  font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap;
}
.adm-tile__sub { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--c-text-3); }
.adm-trend { font: var(--fw-bold) var(--fs-sm)/1 var(--font); padding: 3px 6px; border-radius: var(--r-pill); }
.adm-trend[data-dir="up"] { color: var(--c-ok); background: var(--c-ok-bg); }
.adm-trend[data-dir="down"] { color: var(--c-danger); background: var(--c-danger-bg); }

/* ── Spalten (Karten fliessen wie ein Mauerwerk) ─────────────────── */
.adm-cols { columns: 3 360px; column-gap: var(--sp-5); }
.adm-cols > .adm-card { break-inside: avoid; margin-bottom: var(--sp-5); }

/* Tabelle mit Zahlen rechts */
.adm-table { width: 100%; border-collapse: collapse; }
.adm-row th { text-align: left; font-weight: var(--fw-regular); padding: 7px 0; vertical-align: top; }
.adm-row td { padding: 7px 0 7px var(--sp-3); vertical-align: top; }
.adm-row + .adm-row > * { border-top: 1px solid var(--c-border); }
.adm-row--sub th { padding-left: var(--sp-4); color: var(--c-text-2); }
.adm-row__title { display: block; }
.adm-row__text { display: block; font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--c-text-3); }
.adm-num { text-align: right; font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Eintraege mit Ampel */
.adm-items { list-style: none; display: flex; flex-direction: column; }
.adm-item { display: flex; gap: var(--sp-3); padding: 9px 0; }
.adm-item + .adm-item { border-top: 1px solid var(--c-border); }
.adm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lv); flex-shrink: 0; }
.adm-item > .adm-dot { margin-top: 6px; }
.adm-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.adm-item__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.adm-item__title { font-weight: var(--fw-bold); }
.adm-item__text { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--c-text-2); overflow-wrap: anywhere; }
.adm-item__hint { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--c-text-3); }
.adm-item[data-level="warn"] .adm-item__hint, .adm-item[data-level="alarm"] .adm-item__hint { color: var(--lv); }
.adm-badge {
  flex-shrink: 0; padding: 2px 8px; border-radius: var(--r-pill);
  font: 700 11px/16px var(--font); letter-spacing: .04em;
  color: var(--lv); background: var(--lv-bg); border: 1px solid var(--lv);
}
.adm-gauge { height: 6px; border-radius: var(--r-pill); background: var(--c-surface-3); overflow: hidden; margin-top: 2px; }
.adm-gauge__fill { display: block; height: 100%; border-radius: inherit; background: var(--lv); }
.adm-item[data-level="ok"] .adm-gauge__fill, .adm-item[data-level="info"] .adm-gauge__fill { background: var(--c-accent); }

/* Balken „Wo geplant wird“ */
.adm-bars { display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-2) var(--sp-3); align-items: center; }
.adm-bar { display: contents; }
.adm-bar__label { font-size: var(--fs-sm); }
.adm-bar__track { height: 10px; border-radius: var(--r-pill); background: var(--c-surface-3); overflow: hidden; }
.adm-bar__fill { display: block; height: 100%; border-radius: inherit; background: var(--c-teal); }

.adm-list { padding-left: 1.2em; display: flex; flex-direction: column; gap: var(--sp-2); font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--c-text-2); }

/* ── Anmelden / Code ─────────────────────────────────────────────── */
.adm-gate { display: flex; justify-content: center; padding-top: var(--sp-7); }
.adm-gate__card { width: 100%; max-width: 620px; gap: var(--sp-4); padding: var(--sp-6); }
.adm-gate__card > .ui-btn { align-self: flex-start; text-decoration: none; }
.adm-gate__title { font: 700 var(--fs-2xl)/var(--lh-2xl) 'Bricolage Grotesque', 'Bricolage Grotesque Fallback', var(--font); }
.adm-lead { color: var(--c-text-2); }
.adm-steps { list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: var(--sp-5); }
.adm-steps > li { counter-increment: step; position: relative; padding-left: 44px; display: flex; flex-direction: column; gap: var(--sp-3); }
.adm-steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c-navy); color: #fff; font-weight: 700;
}
.adm-step__title { font: var(--fw-bold) var(--fs-lg)/30px var(--font); }
.adm-setup { display: flex; gap: var(--sp-5); align-items: flex-start; flex-wrap: wrap; }
.adm-setup > div { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: var(--sp-3); font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--c-text-2); }
.adm-setup a { color: var(--c-accent); font-weight: var(--fw-bold); }
/* QR immer schwarz auf weiss, gross genug fuers Handy (auch im dunklen Design) */
.adm-qr { width: 232px; max-width: 100%; aspect-ratio: 1; background: #fff; border-radius: var(--r-md); border: 1px solid var(--c-border); flex-shrink: 0; overflow: hidden; }
.adm-qr svg, .adm-qr img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.adm-secret { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-1); }
.adm-secret code { font: 600 var(--fs-sm)/1.4 ui-monospace, Consolas, monospace; letter-spacing: .08em; overflow-wrap: anywhere; color: var(--c-text); }
.adm-label { font: var(--fw-bold) var(--fs-sm)/var(--lh-sm) var(--font); color: var(--c-text-2); }
.adm-codeform { display: flex; flex-direction: column; gap: var(--sp-2); }
.adm-codeform__row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.adm-code { width: 11ch; font: 700 22px/1 ui-monospace, Consolas, monospace; letter-spacing: .15em; text-align: center; }
.adm-error { color: var(--c-danger); font-weight: var(--fw-bold); }

/* ── Yachtcharter · Partner (js/admin/page.js partnerSection) ─────── */
.adm-scroll { overflow-x: auto; }
.adm-ptable, .adm-ctable { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.adm-ctable { min-width: 760px; }
.adm-ptable thead th, .adm-ctable thead th {
  text-align: left; padding: 0 var(--sp-3) 6px 0; white-space: nowrap;
  font: var(--fw-bold) var(--fs-xs)/var(--lh-xs) var(--font); color: var(--c-text-3);
}
.adm-ptable tbody > tr > *, .adm-ctable tbody > tr > * {
  text-align: left; font-weight: var(--fw-regular); padding: 9px var(--sp-3) 9px 0; vertical-align: top;
  border-top: 1px solid var(--c-border);
}
.adm-ptable tbody > tr > .adm-num { text-align: right; padding-right: var(--sp-5); font-weight: var(--fw-bold); }
.adm-ptable .adm-row__title { font-weight: var(--fw-bold); }
.adm-prow[data-on="0"] { color: var(--c-text-3); }
.adm-pstate { font: var(--fw-bold) var(--fs-xs)/1 var(--font); padding: 3px 7px; border-radius: var(--r-pill); color: var(--c-ok); background: var(--c-ok-bg); vertical-align: 1px; }
.adm-pstate[data-on="0"] { color: var(--c-text-3); background: var(--c-surface-3); }
.adm-pportal .ui-btn { text-decoration: none; margin-bottom: 4px; white-space: nowrap; }
.adm-cwhen { white-space: nowrap; font-variant-numeric: tabular-nums; }
.adm-csub { white-space: nowrap; }
.adm-csub code { font: 600 var(--fs-sm)/1.4 ui-monospace, Consolas, monospace; color: var(--c-text); user-select: all; }
.adm-copy {
  margin-left: 6px; padding: 1px 7px; border: 1px solid var(--c-border); border-radius: var(--r-sm);
  background: none; color: var(--c-text-2); font: var(--fs-xs)/var(--lh-xs) var(--font); cursor: pointer;
}
.adm-copy:hover { background: var(--c-surface-2); }
.adm-copy:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.adm-partners > .adm-sub { margin-top: var(--sp-3); }

/* ── schmal ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .adm-top { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .adm-main { padding: var(--sp-4) var(--sp-4) var(--sp-7); }
  .adm-header { padding-right: 8px; gap: var(--sp-2); }
  .adm-stamp { display: none; }
  .adm-hbtn--text span { display: none; }
  .adm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-tile__value { font-size: 26px; }
  .adm-gate { padding-top: 0; }
  .adm-gate__card { padding: var(--sp-5); }
}

/* Reiter „Designer“: Design-Werkzeug im Rahmen (tools/design) */
.adm-design { display: flex; flex-direction: column; gap: 10px; }
.adm-design__bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.adm-design__bar [aria-pressed="true"] { outline: 2px solid currentColor; outline-offset: 1px; }
.adm-design__neu { margin-left: auto; font-size: 14px; }
.adm-design__frame { width: 100%; height: calc(100vh - 190px); min-height: 560px; border: 1px solid rgba(127, 127, 127, .3); border-radius: 12px; background: #0b141c; }
