/* Scanvest-Planungsportal – Gestaltung nach Konfigurator_Bausteinbibliothek.md (Tokens aus dem NGRS-Planer) */
:root {
  --bg: #F5F7F8; --surface: #FFFFFF; --surface-2: #EEF2F3; --surface-3: #E4E9EB;
  --border: #D8DFE2; --border-strong: #B9C3C8;
  --text: #16221F; --text-muted: #57676C; --text-faint: #8A979B;
  --accent: #0E7480; --accent-strong: #0A565F; --accent-soft: #E1F0F1; --accent-contrast: #FFFFFF;
  --ok: #2B7A4B; --ok-soft: #E4F3E9; --warn: #A66A0A; --warn-soft: #FBEEDD; --bad: #A8332B; --bad-soft: #FBE7E5;
  --red: #A8232F;
  --shadow: 0 1px 2px rgba(20,30,32,.06), 0 4px 16px rgba(20,30,32,.05);
  --shadow-hover: 0 2px 4px rgba(20,30,32,.08), 0 14px 32px rgba(20,30,32,.12);
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1618; --surface: #172124; --surface-2: #1E2B2E; --surface-3: #263639;
    --border: #2D3D41; --border-strong: #46595E;
    --text: #E8EEEF; --text-muted: #A3B3B8; --text-faint: #75878C;
    --accent: #3FB0BD; --accent-strong: #7FD0D9; --accent-soft: #143A40; --accent-contrast: #06191C;
    --ok: #6CCB91; --ok-soft: #153322; --warn: #E3AB55; --warn-soft: #3A2A10; --bad: #F08B83; --bad-soft: #3B1B18;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3); --shadow-hover: 0 14px 32px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1618; --surface: #172124; --surface-2: #1E2B2E; --surface-3: #263639;
  --border: #2D3D41; --border-strong: #46595E;
  --text: #E8EEEF; --text-muted: #A3B3B8; --text-faint: #75878C;
  --accent: #3FB0BD; --accent-strong: #7FD0D9; --accent-soft: #143A40; --accent-contrast: #06191C;
  --ok: #6CCB91; --ok-soft: #153322; --warn: #E3AB55; --warn-soft: #3A2A10; --bad: #F08B83; --bad-soft: #3B1B18;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3); --shadow-hover: 0 14px 32px rgba(0,0,0,.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-contrast); padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip-link:focus { left: 8px; }

.shell { max-width: 1320px; margin: 0 auto; padding: 0 28px 24px; }

/* Kopfbereich */
.portal-header { display: flex; align-items: center; gap: 28px; padding: 16px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.brand { flex: 0 0 auto; }
.brand-logo { height: 46px; width: auto; border-radius: 6px; background: #fff; }
.topnav { display: flex; gap: 4px; flex: 1 1 360px; min-width: 0; flex-wrap: wrap; }
.topnav a { padding: 9px 14px; border-radius: 8px; color: var(--text-muted); font-size: 14px; font-weight: 500; }
.topnav a:hover { background: var(--surface-2); color: var(--text); }
.topnav a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.header-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }
.account-switch { display: flex; flex-direction: column; gap: 2px; }
.account-label { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
select { font: inherit; font-size: 13px; padding: 7px 28px 7px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); max-width: 270px; }
.preview-strip { display: flex; gap: 10px; align-items: center; margin-top: 12px; padding: 9px 14px; font-size: 13px; background: var(--warn-soft); color: var(--warn); border-radius: 8px; }
.preview-strip .dot { font-size: 10px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 14px var(--sans); padding: 10px 18px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { width: 40px; height: 40px; padding: 0; font-size: 18px; }

/* Seitenkopf */
main { display: block; padding-top: 30px; min-height: 60vh; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; margin-bottom: 30px; flex-wrap: wrap; }
.page-head > div:first-child { flex: 1 1 420px; min-width: 0; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--red); margin-bottom: 12px; }
:root[data-theme="dark"] .eyebrow { color: #E5707A; }
h1 { font-size: clamp(28px, 4.2vw, 46px); line-height: 1.08; letter-spacing: -.02em; max-width: 780px; }
.lead { margin-top: 14px; color: var(--text-muted); max-width: 660px; font-size: 16px; line-height: 1.6; }
.head-img { width: 220px; height: 132px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.who { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 260px; }
.who small { display: block; color: var(--text-muted); font-size: 12px; }
.who-count { grid-column: 1 / -1; font-size: 11px; color: var(--ok); }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: var(--accent-contrast); font-size: 12px; font-weight: 700; }
.crumbs { font-size: 12px; margin-bottom: 14px; }
.crumbs a { color: var(--accent-strong); }
.crumbs a:hover, .link:hover { text-decoration: underline; }
.link { color: var(--accent-strong); font-weight: 600; font-size: 14px; }

.section { margin-top: 38px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2, .panel h2 { font-size: 20px; letter-spacing: -.01em; }
.hint { margin-top: 20px; color: var(--text-muted); font-size: 14px; }

/* Einsatzbereich-Kacheln */
.area-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.area-tile { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s, border-color .18s; }
.area-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--border-strong); }
.area-media { aspect-ratio: 5 / 3; background: var(--bild) center / cover no-repeat, var(--surface-3); }
.area-body { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; flex: 1; }
.area-body h3 { font-size: 16px; line-height: 1.25; padding-right: 28px; }
.area-body p { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.area-nr { position: absolute; right: 18px; top: 16px; font-size: 11px; color: var(--text-faint); }
.area-count { margin-top: auto; padding-top: 8px; font-size: 12px; color: var(--accent-strong); font-weight: 600; }
.area-grid .area-tile:first-child { grid-column: span 2; }
.area-grid .area-tile:first-child .area-media { aspect-ratio: 10 / 3; }

/* Werkzeugkarten */
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.tool-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); transition: box-shadow .2s, border-color .2s; }
.tool-card:hover, .tool-card:focus-within { box-shadow: var(--shadow-hover); border-color: var(--accent); }
/* Einheitliche 2:1-Bildbühnen. Produktgruppen bleiben vollständig sichtbar; ICX beschneidet nur den weißen Rand, Aufzug nutzt einen Architektur-Ausschnitt. */
.tool-media { aspect-ratio: 2 / 1; background: radial-gradient(ellipse at 35% 20%, #fff 10%, #f4f9fa 55%, #dcecee 100%); overflow: hidden; border-bottom: 1px solid var(--border); }
.tool-media img { display: block; width: 100%; height: 100%; padding: 12px 18px; object-fit: contain; mix-blend-mode: multiply; }
.tool-card[data-tool-card="icx"] .tool-media img { object-fit: cover; padding: 0; }
.tool-card[data-tool-card="liftall"] .tool-media img { object-fit: cover; padding: 0; mix-blend-mode: normal; }
.direct-entry { margin-top: 24px; }
.tool-body > p { flex: 1; }
.tool-body { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 20px; flex: 1; }
.tool-body h3 { font-size: 20px; letter-spacing: -.01em; }
.tool-body p { font-size: 14px; color: var(--text-muted); }
.tool-body .tool-areas { font-size: 12px; color: var(--text-faint); margin-top: auto; padding-top: 4px; }
.tool-body .btn { margin-top: 6px; }
.tool-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.tag-muted { background: var(--surface-2); color: var(--text-muted); font-weight: 500; }
.access-note { font-size: 11px; color: var(--ok); }
.tool-card.is-locked .access-note { color: var(--text-faint); }
.tool-card.is-locked .tool-media { filter: grayscale(1); opacity: .55; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px; }
.chip { padding: 7px 14px; border-radius: 999px; font-size: 13px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); }
.chip:hover { background: var(--surface-2); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); font-weight: 600; }

/* Panels, Zeilen */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel h2 { margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 6px; border-top: 1px solid var(--border); border-radius: 8px; }
.row:first-of-type { border-top: 0; }
a.row:hover { background: var(--surface-2); }
.row.is-locked { opacity: .55; }
.mini-media { width: 46px; height: 46px; border-radius: 9px; background: #fff; border: 1px solid var(--border); display: grid; place-items: center; padding: 4px; flex-shrink: 0; }
.mini-media { overflow: hidden; }
.mini-media img { width: 100%; height: 100%; object-fit: contain; }
.row-copy { flex: 1; min-width: 0; }
.row-copy b { display: block; font-size: 14px; }
.row-copy small { color: var(--text-muted); font-size: 12px; }
.row-time { font-size: 11px; color: var(--text-faint); }
.empty { padding: 20px; border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--text-muted); font-size: 13px; line-height: 1.6; background: var(--surface-2); }
.empty b { display: block; color: var(--text); margin-bottom: 4px; font-size: 14px; }

/* Rollen & Freigaben */
.notice { padding: 16px 20px; background: var(--warn-soft); color: var(--warn); border-radius: 10px; font-size: 14px; line-height: 1.6; }
.role-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.role-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.role-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.role-card h3 { font-size: 16px; }
.role-card p { font-size: 13px; color: var(--text-muted); flex: 1; }
.role-card .mono { font-size: 11px; color: var(--accent-strong); }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.plain .ok { color: var(--ok); font-size: 12px; margin-left: 8px; }
.plain .no { color: var(--text-faint); font-size: 12px; margin-left: 8px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.grant { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 14px; }
.grant th, .grant td { padding: 12px 16px; text-align: left; border-top: 1px solid var(--border); }
.grant thead th { border-top: 0; font-size: 12px; color: var(--text-muted); background: var(--surface-2); font-weight: 600; }
.grant th[scope="row"] small { display: block; font-weight: 400; color: var(--text-muted); font-size: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-family: var(--mono); color: var(--text-muted); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.check input:disabled { opacity: .5; }

.portal-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-faint); }
.portal-footer a { color: var(--text-muted); text-decoration: underline; }

/* Rahmenseite (werkzeug.html) */
body.frame-page { display: flex; flex-direction: column; height: 100vh; }
.frame-bar { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.frame-bar .brand-logo { height: 32px; }
.frame-title { font-weight: 600; font-size: 14px; }
.frame-title small { color: var(--text-muted); font-weight: 400; margin-left: 8px; font-family: var(--mono); font-size: 12px; }
.frame-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.frame-note { font-size: 11px; color: var(--warn); font-family: var(--mono); }
.frame-host { flex: 1; min-height: 0; background: var(--surface-3); }
.frame-host iframe { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.frame-msg { max-width: 560px; margin: 60px auto; padding: 0 20px; display: grid; gap: 16px; }
.frame-msg h1 { font-size: 28px; }

@media (max-width: 1100px) {
  .area-grid { grid-template-columns: repeat(3, 1fr); }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .role-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .shell { padding: 0 16px 20px; }
  .portal-header { gap: 12px; }
  .brand-logo { height: 38px; }
  .topnav { order: 3; flex-basis: 100%; gap: 2px; }
  .topnav a { padding: 8px 10px; font-size: 13px; }
  .account-label { display: none; }
  select { max-width: 190px; }
  .area-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .area-grid .area-tile:first-child { grid-column: span 2; }
  .area-grid .area-tile:first-child .area-media { aspect-ratio: 5 / 2; }
  .tool-grid, .two-col { grid-template-columns: 1fr; }
  .head-img { display: none; }
  .who { min-width: 0; width: 100%; }
  main { padding-top: 22px; }
}
@media (max-width: 480px) {
  .area-grid { grid-template-columns: 1fr; }
  .area-grid .area-tile:first-child { grid-column: auto; }
  .role-grid { grid-template-columns: 1fr; }
  .area-media { aspect-ratio: 16 / 7; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Anmeldung, Formulare, Konto (Portal mit echter Anmeldung) ---------- */
.kontobox { display: inline-flex; align-items: center; gap: 10px; }
.kontobox .konto-text { display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; }
.kontobox small { color: var(--text-muted); font-size: 11px; }
.kontobox .avatar { width: 32px; height: 32px; font-size: 11px; }
.feld { display: grid; gap: 6px; margin-bottom: 16px; font-size: 14px; font-weight: 600; }
.feld small { font-weight: 400; color: var(--text-muted); }
.feld input, .feld select, .feld textarea { font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text); width: 100%; }
.feld input:focus, .feld select:focus, .feld textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.fehlerzeile { color: var(--bad); background: var(--bad-soft); padding: 10px 14px; border-radius: 9px; font-size: 14px; margin: 0 0 14px; }
.erfolg { color: var(--ok); background: var(--ok-soft); padding: 10px 14px; border-radius: 9px; font-size: 14px; margin: 0 0 14px; }
.panel.schmal { max-width: 520px; }
h3.unter { font-size: 15px; margin: 18px 0 8px; }
body.login-seite { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-box { width: min(480px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px 30px 24px; box-shadow: var(--shadow); }
.login-box h1 { font-size: 30px; margin-bottom: 8px; }
.login-box .lead { font-size: 14px; margin: 0 0 22px; }
.login-logo { height: 40px; margin-bottom: 20px; }
.login-box .btn { width: 100%; margin-top: 4px; }
.login-box .hint { font-size: 12px; margin-top: 16px; }
[hidden] { display: none !important; }
