/* SmartWelt – Stylesheet (Quelle: resources/css/app.css, Build kopiert nach Web/css/app.css) */

/* Work Sans, selbst gehostet (SIL Open Font License, siehe Web/fonts/OFL-Work-Sans.txt) */
@font-face {
    font-family: 'Work Sans';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/work-sans-latin-wght-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Work Sans';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/work-sans-latin-ext-wght-normal.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --bg: #faf8f5;
    --orange: #fa4616;
    --orange-dark: #c7340c;
    --text: #171412;
    --line: #e8e3dd;
    --white: #fff;
    --green: #21805a;
    --green-soft: #e6f2ec;
    --muted: #645c55;
    --control-border: #8f857c;
    --green-text: #1a6b4b;
    --icon-bg: #fdf0ea;
    --error: #b3261e;
    --error-soft: #fcebea;
    --radius: 14px;
    --radius-small: 8px;
    --content: 1240px;
    --gutter: clamp(16px, 4vw, 40px);
    --font: 'Work Sans', Arial, sans-serif;
    --focus: 0 0 0 3px var(--white), 0 0 0 6px var(--orange);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
}

main { flex: 1 0 auto; }

img, svg { max-width: 100%; }

a { color: inherit; text-decoration-color: var(--orange); text-underline-offset: 3px; }
a:hover { color: var(--orange-dark); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 16px; top: -100px; z-index: 100;
    background: var(--text); color: var(--white); padding: 10px 16px; border-radius: var(--radius-small);
}
.skip-link:focus { top: 16px; }

.container { width: 100%; max-width: calc(var(--content) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Typografie ---------- */
.eyebrow {
    margin: 0 0 8px;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted);
}
.eyebrow--light { color: var(--text); }
.dot { color: var(--orange); }
.dot--light { color: var(--text); }
.muted { color: var(--muted); }

.page-head { padding: 24px 0 8px; }
.page-head--row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-title, .section__title, .hero__title, .login__headline, .login__title {
    margin: 0;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.08;
}
.page-title { font-size: clamp(2rem, 4vw, 3rem); }
.page-intro { max-width: 70ch; margin: 12px 0 0; color: var(--muted); font-size: 1.0625rem; }

.section { padding: 40px 0 8px; }
.section__head { margin-bottom: 20px; }
.section__head--row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; }
.section__title { font-size: clamp(1.625rem, 3vw, 2.25rem); }
.section__lead { margin: 8px 0 0; color: var(--muted); }

/* ---------- Marke ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 1.25rem; letter-spacing: -.01em; }
.brand__mark { color: var(--orange); flex: none; }
.brand__dot { fill: var(--text); }
.brand__name { font-weight: 500; }
.brand__name strong { font-weight: 700; }

/* ---------- Buttons ---------- */
.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 10px 20px;
    border: 1.5px solid transparent; border-radius: 999px;
    font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none;
    cursor: pointer; transition: background-color .15s, color .15s, border-color .15s;
}
.button--primary { background: var(--text); color: var(--white); }
.button--primary:hover { background: var(--orange-dark); color: var(--white); }
.button--secondary { background: var(--white); color: var(--text); border-color: var(--text); }
.button--secondary:hover { border-color: var(--orange-dark); color: var(--orange-dark); }
.button--ghost { background: transparent; color: var(--text); border-color: var(--control-border); }
.button--ghost:hover { border-color: var(--text); color: var(--text); }
.button--small { min-height: 44px; padding: 8px 16px; font-size: .9375rem; }
.button--block { width: 100%; }
.button:disabled { opacity: .55; cursor: progress; }

/* ---------- Formulare ---------- */
.form { display: grid; gap: 16px; }
.form--grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); align-items: start; }
.field { display: grid; gap: 6px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: .9375rem; }
.field__hint { margin: 0; font-size: .8125rem; color: var(--muted); }
.field__error { margin: 0; font-size: .875rem; color: var(--error); font-weight: 500; }
input[type=text], input:not([type]), input[type=email], input[type=password], input[type=url], input[type=number], select, textarea {
    width: 100%; min-height: 44px; padding: 10px 12px;
    border: 1.5px solid var(--control-border); border-radius: var(--radius-small);
    background: var(--white); color: var(--text); font: inherit;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--text); box-shadow: var(--focus); }
input[aria-invalid=true] { border-color: var(--error); background: var(--error-soft); }
.field--check { display: flex; align-items: center; gap: 10px; align-self: end; min-height: 44px; }
input[type=checkbox] { width: 22px; height: 22px; margin: 0; accent-color: var(--green); flex: none; }
.form__actions { grid-column: 1 / -1; display: flex; gap: 12px; }

.flash { margin: 16px 0 0; padding: 12px 16px; border-radius: var(--radius-small); background: var(--green-soft); color: #165c40; font-weight: 500; }
.flash--error { background: var(--error-soft); color: var(--error); }
.flash ul { margin: 6px 0 0; padding-left: 20px; }

/* ---------- Login ---------- */
.page-login { background: var(--white); }
.login { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.login__claim {
    position: relative; overflow: hidden;
    background: var(--orange); color: var(--white);
    padding: 48px var(--gutter);
    display: flex; align-items: flex-end;
    min-height: 320px;
}
.login__orbit { position: absolute; width: min(110%, 640px); right: -22%; top: -18%; color: var(--white); pointer-events: none; }
.login__claim-inner { position: relative; max-width: 560px; }
.login__headline { font-size: clamp(2.5rem, 6vw, 4.5rem); }
.login__headline .dot { color: var(--text); }
.login__lead { margin: 20px 0 0; max-width: 40ch; color: var(--text); font-size: 1.125rem; font-weight: 500; }
.login__panel { display: flex; align-items: center; justify-content: center; padding: 48px var(--gutter); }
.login__form-wrap { width: 100%; max-width: 400px; }
.login__brand { margin-bottom: 40px; }
.login__title { font-size: 2rem; margin-bottom: 8px; }
.login__form-wrap .form { margin-top: 28px; }
.login__hint { font-size: .875rem; margin-top: 24px; }

@media (max-width: 899px) {
    .login__claim { padding-top: 150px; min-height: 0; }
    .login__orbit { width: 260px; right: -80px; top: -110px; opacity: .6; }
}

@media (min-width: 900px) {
    .login { grid-template-columns: 1.15fr 1fr; }
    .login__claim { padding: 64px; min-height: 100vh; }
    .login__orbit { width: 720px; right: -200px; top: -120px; }
}

/* ---------- Kopfzeile ---------- */
.topbar { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar__inner { display: flex; align-items: center; gap: 16px 32px; min-height: 72px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.topbar__brand { text-decoration: none; }
.topbar__nav { display: flex; gap: 24px; flex: 1 1 auto; }
.topbar__link { text-decoration: none; font-weight: 500; padding: 10px 0; border-bottom: 2px solid transparent; }
.topbar__link.is-active { border-bottom-color: var(--orange); }
.topbar__user { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.topbar__user form { margin: 0; }
.topbar__name { font-weight: 500; color: var(--muted); }

@media (max-width: 599px) {
    .topbar__nav { order: 3; flex-basis: 100%; }
    .topbar__name { display: none; }
}

/* ---------- Brotkrumen ---------- */
.breadcrumb { padding-top: 24px; font-size: .875rem; color: var(--muted); }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0; padding: 0; list-style: none; }
.breadcrumb li + li::before { content: '/'; margin-right: 8px; color: #b3aaa1; }
.breadcrumb a { color: var(--muted); }
.breadcrumb [aria-current] { color: var(--text); font-weight: 500; }

/* ---------- Hero ---------- */
.hero {
    position: relative; overflow: hidden;
    margin-top: 16px; padding: clamp(32px, 6vw, 64px);
    border-radius: calc(var(--radius) + 6px);
    background: var(--orange); color: var(--white);
    display: grid; align-items: center; min-height: 260px;
}
.hero__text { position: relative; z-index: 1; max-width: 640px; }
.hero__title { font-size: clamp(2.25rem, 5vw, 3.75rem); }
.hero__lead { margin: 16px 0 0; max-width: 46ch; color: var(--text); font-size: 1.125rem; font-weight: 500; }
.hero__orbit { position: absolute; width: 420px; right: -90px; top: 50%; transform: translateY(-50%); color: var(--white); pointer-events: none; }
@media (max-width: 699px) {
    .hero { padding-top: 112px; }
    .hero__orbit { width: 220px; right: -70px; top: -96px; transform: none; opacity: .55; }
}

.preview-bar { background: var(--text); color: var(--white); padding: 10px 0; font-size: .9375rem; }

/* ---------- Kacheln ---------- */
.tiles { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.tile {
    position: relative; display: flex; flex-direction: column; gap: 6px;
    min-height: 220px; padding: 24px;
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--text); text-decoration: none;
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tile--link:hover { border-color: var(--orange); transform: translateY(-2px); box-shadow: 0 10px 30px -18px rgba(23, 20, 18, .45); color: var(--text); }
.tile--link:focus-visible { border-radius: var(--radius); }
.tile__head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.tile__icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--icon-bg); color: var(--orange-dark); }
.tile__icon .icon { width: 26px; height: 26px; }
.tile__number { font-size: .875rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.tile__type { font-size: .75rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.tile__title { font-size: 1.375rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.tile__text { color: var(--muted); font-size: .9375rem; }
.tile__action { margin-top: auto; padding-top: 12px; font-weight: 600; }
.tile--link .tile__action { color: var(--orange-dark); }
.tile__action--pending { display: inline-flex; align-self: flex-start; padding: 4px 10px; border-radius: 999px; background: var(--bg); border: 1px dashed var(--control-border); color: var(--muted); font-size: .875rem; }
.tile--pending { background: #fdfcfa; }

.empty { color: var(--muted); padding: 16px 0; list-style: none; }
.customer-list { padding: 0; margin: 24px 0; list-style: none; }

/* ---------- Plattformverwaltung ---------- */
.jumpnav {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px;
    padding: 8px; background: var(--white); border: 1px solid var(--line); border-radius: 999px; width: fit-content; max-width: 100%;
}
.jumpnav a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 999px; text-decoration: none; font-weight: 600; }
.jumpnav a:hover { background: var(--bg); color: var(--text); }
.jumpnav span { font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.admin-section { scroll-margin-top: 96px; }

.disclosure > summary { list-style: none; width: fit-content; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after { content: '+'; font-weight: 400; margin-left: 4px; }
.disclosure[open] > summary::after { content: '–'; }
.disclosure__body { margin-top: 16px; padding: 20px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.disclosure--row .disclosure__body { background: var(--bg); }

.rows { margin: 20px 0 0; padding: 0; list-style: none; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.row { padding: 16px 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.row:first-child { border-top: 0; }
.row__main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; flex: 1 1 420px; min-width: 0; }
.row__title { font-weight: 600; }
.row__meta { color: var(--muted); font-size: .875rem; }
.row__icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--icon-bg); color: var(--orange-dark); flex: none; }
.row__link { margin-left: auto; gap: 6px; font-weight: 600; text-decoration: none; color: var(--orange-dark); min-height: 44px; display: inline-flex; align-items: center; }
.row__link:hover { text-decoration: underline; }
.row .disclosure--row { flex: 0 0 auto; }
.row .disclosure--row[open] { flex-basis: 100%; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8125rem; font-weight: 600; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--active { background: var(--green-soft); color: var(--green-text); }
.badge--active::before { background: var(--green); }
.badge--inactive { background: #f1eeea; color: var(--muted); }
.eyebrow .badge { letter-spacing: 0; text-transform: none; margin-left: 8px; }

.icon-picker { display: flex; align-items: center; gap: 12px; }
.icon-picker__preview { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--icon-bg); color: var(--orange-dark); flex: none; }
.icon-picker select { flex: 1; min-width: 0; }

/* Freischaltungszeilen */
.row--entitlement { display: block; }
.entitlement {
    display: grid; gap: 12px 20px; align-items: center;
    grid-template-columns: 1fr;
}
.entitlement__name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.entitlement__name > span:last-child { display: grid; }
.entitlement__check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.entitlement__check label { font-weight: 500; }
.entitlement__shared { color: var(--muted); font-size: .9375rem; word-break: break-all; }
.entitlement__actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.entitlement__status { font-size: .875rem; font-weight: 500; color: var(--muted); }
.entitlement__status[data-state=saved] { color: var(--green); }
.entitlement__status[data-state=dirty], .entitlement__status[data-state=pending] { color: #8a4b00; }
.entitlement__status[data-state=error] { color: var(--error); }
@media (min-width: 1024px) {
    .entitlement { grid-template-columns: minmax(200px, 1.1fr) 150px minmax(240px, 2fr) minmax(220px, auto); }
}

.footer { padding: 40px 0; margin-top: 56px; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }

/* Erhöhter Kontrast (Systemeinstellung) */
@media (prefers-contrast: more) {
    :root { --muted: #3f3934; --line: #8f857c; --control-border: #4a433d; }
    .tile, .rows, .disclosure__body, .jumpnav { border-color: var(--control-border); }
    .login__orbit, .hero__orbit { opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}

/* Übergabeseite Direktanmeldung */
.sso { min-height: 100vh; display: grid; place-items: center; padding: 24px var(--gutter); }
.sso__box { max-width: 440px; display: grid; gap: 16px; text-align: left; }
.sso__title { margin: 16px 0 0; font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.sso form { margin-top: 8px; }

/* Einrichtungshinweis Neos-Direktanmeldung (Kundendetail) */
.neos-setup { margin-top: 12px; }
.neos-setup > summary { cursor: pointer; font-weight: 600; font-size: .9375rem; min-height: 44px; display: inline-flex; align-items: center; color: var(--orange-dark); }
.neos-setup__body { margin-top: 8px; padding: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-small); display: grid; gap: 10px; }
.neos-setup__code { margin: 0; padding: 12px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-small); font-size: .8125rem; white-space: pre-wrap; word-break: break-all; }
.neos-setup code { font-size: .875em; }
