/* ==========================================================================
   SEPA-Portal – Hausverwaltung Müller GmbH
   --------------------------------------------------------------------------
   Verbindliches CI der HVM (Skill hvm-ci, Abschnitt 2 und 3):
   Farben aus dem Logo abgeleitet, Schrift system-ui/Helvetica Neue/Arial.
   Die HVM-Kennlinie (vierfarbiges Band) und die Fußzeile mit den
   handelsrechtlichen Pflichtangaben werden zentral in app/layout.php
   ausgegeben und hier gestylt.
   ========================================================================== */
:root {
    /* Verbindliche HVM-CI-Farben (Skill hvm-ci, Abschnitt 2) */
    --hvm-orange: #E6A83C;        /* Akzent: Kennlinie, Betreffmarker, Hervorhebungen */
    --hvm-anthracite: #87888A;    /* Überschriften, Sekundärtext, Fußzeile, Infoblock */
    --hvm-midgray: #9C9D9F;       /* Trennlinien, Falz-/Lochmarken, Nebenelemente */
    --hvm-lightgray: #D7D8DA;     /* Flächen, alternierende Tabellenzeilen */
    --hvm-outlinegray: #ECECEC;   /* Wasserzeichen Hausumriss */
    --hvm-black: #1A1A1A;         /* Textschwarz: Fließtext, Wortmarke */

    /* UI-Ableitung für Flächen mit hellem Text (kein CI-Wert, nur Kontrast-
       Absicherung für Buttons/Kopfzeile: gleicher Farbton, dunkler getönt) */
    --hvm-anthracite-surface: #5B5C5E;
    --hvm-anthracite-surface-dark: #47484A;
    --hvm-orange-dark: #CC8F26;

    --color-text: var(--hvm-black);
    --color-text-muted: var(--hvm-anthracite);
    --color-bg: #F7F7F7;
    --color-surface: #ffffff;
    --color-border: var(--hvm-lightgray);

    --color-success: #1e7e4a;
    --color-success-bg: #e3f3ea;
    --color-info: #1d5f8a;
    --color-info-bg: #e3eef5;
    --color-danger: #a12622;
    --color-danger-bg: #f8e7e6;
    --color-neutral: var(--hvm-anthracite);
    --color-neutral-bg: var(--hvm-lightgray);

    /* HVM-CI Abschnitt 3: HTML/Web-Schrift */
    --font-family: system-ui, "Helvetica Neue", Arial, sans-serif;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(26, 26, 26, 0.08);

    /* HVM-Kennlinie: vier Segmente, Übergänge bei 40 / 60 / 67,5 % */
    --hvm-kennlinie: linear-gradient(
        to right,
        var(--hvm-anthracite) 0%, var(--hvm-anthracite) 40%,
        var(--hvm-midgray) 40%, var(--hvm-midgray) 60%,
        var(--hvm-orange) 60%, var(--hvm-orange) 67.5%,
        var(--hvm-lightgray) 67.5%, var(--hvm-lightgray) 100%
    );
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-family);
    font-size: 15px;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--hvm-anthracite); }
a:hover { color: var(--hvm-black); }

/* --- HVM-Kennlinie (Abschnitt 5.1 und 9) --- */
.hvm-kennlinie {
    height: 4px;
    width: 100%;
    background: var(--hvm-kennlinie);
    flex-shrink: 0;
}
.hvm-kennlinie-footer { height: 3px; }

/* --- Header --- */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 32px;
    min-height: 68px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--hvm-black);
    padding: 10px 0;
}
.brand-logo { height: 40px; width: auto; }
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--hvm-anthracite-surface);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 600; font-size: 15px; color: var(--hvm-black); }
.brand-sub { font-size: 12px; color: var(--hvm-anthracite); }

.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a {
    color: var(--hvm-anthracite);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    border-bottom: 2px solid transparent;
}
.main-nav a:hover {
    color: var(--hvm-black);
    border-bottom-color: var(--hvm-orange);
}

.user-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}
.user-email { color: var(--hvm-black); }
.user-role {
    background: var(--hvm-lightgray);
    color: var(--hvm-anthracite);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

/* --- Main --- */
.site-main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 24px 48px;
}

h1 { font-size: 22px; margin: 0 0 4px; color: var(--hvm-anthracite); font-weight: 700; }
h2 { font-size: 17px; margin: 0 0 12px; color: var(--hvm-anthracite); font-weight: 700; }
.page-sub { color: var(--color-text-muted); margin: 0 0 24px; font-size: 14px; }

/* --- Karten --- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    border-top: 3px solid var(--hvm-orange);
    padding: 18px 20px;
}
.stat-value { font-size: 26px; font-weight: 700; color: var(--hvm-black); }
.stat-label { font-size: 13px; color: var(--color-text-muted); margin-top: 4px; }

/* --- Tabellen --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--hvm-anthracite);
    font-weight: 700;
    background: var(--hvm-outlinegray);
}
tr:hover td { background: #fafafa; }
td.num, th.num { text-align: right; white-space: nowrap; }

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-info    { background: var(--color-info-bg);    color: var(--color-info); }
.badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger); }
.badge-neutral { background: var(--color-neutral-bg); color: var(--hvm-anthracite); }

/* --- Buttons ---
   Primäraktion in HVM Orange (Akzentfarbe) mit Textschwarz für sicheren
   Kontrast; Orange wird laut CI nie für Fließtext verwendet, hier als
   UI-Hervorhebung auf Buttons ist das die vorgesehene Verwendung. */
.btn {
    display: inline-block;
    padding: 9px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--hvm-orange);
    background: var(--hvm-orange);
    color: var(--hvm-black);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}
.btn:hover { background: var(--hvm-orange-dark); border-color: var(--hvm-orange-dark); }
.btn-secondary {
    background: var(--color-surface);
    color: var(--hvm-anthracite);
    border-color: var(--hvm-midgray);
    font-weight: 600;
}
.btn-secondary:hover { background: var(--hvm-outlinegray); color: var(--hvm-black); }
.btn-danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: #fff;
}
.btn-danger:hover { background: #7f1e1b; }
.btn-ghost {
    background: transparent;
    border-color: var(--hvm-midgray);
    color: var(--hvm-anthracite);
    font-weight: 400;
}
.btn-ghost:hover { background: var(--hvm-outlinegray); color: var(--hvm-black); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
button.linklike {
    background: none;
    border: none;
    color: var(--hvm-anthracite);
    cursor: pointer;
    padding: 0;
    font: inherit;
    text-decoration: underline;
}
button.linklike:hover { color: var(--hvm-black); }

/* --- Formulare --- */
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 4px; color: var(--hvm-anthracite); }
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], select, textarea {
    width: 100%;
    max-width: 480px;
    padding: 9px 12px;
    border: 1px solid var(--hvm-midgray);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--hvm-black);
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--hvm-orange);
    outline-offset: 0;
    border-color: var(--hvm-orange);
}
.form-actions { margin-top: 20px; display: flex; gap: 10px; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; }
.inline-form input[type="date"] { width: auto; padding: 5px 8px; font-size: 13px; }
.hint { font-size: 13px; color: var(--color-text-muted); margin-top: 6px; }

/* --- Flash-Meldungen --- */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid transparent;
}
.flash-success { background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success); }
.flash-error   { background: var(--color-danger-bg);  color: var(--color-danger);  border-color: var(--color-danger); }
.flash-info    { background: var(--color-info-bg);    color: var(--color-info);    border-color: var(--color-info); }

/* --- Auth-Seiten (Login, Registrierung, Einladung) ---
   Dezentes Hausumriss-Wasserzeichen im Hintergrund, analog zum
   Briefbogen-CI (Abschnitt 5.2), in Umrissgrau, hinter dem Inhalt. */
.auth-page {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.auth-page::before {
    content: "";
    position: absolute;
    right: -60px;
    bottom: -60px;
    width: 420px;
    height: 340px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 160'%3E%3Cpath d='M10 90 L100 15 L190 90 M30 90 V150 H170 V90' fill='none' stroke='%23ECECEC' stroke-width='9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
}
.auth-wrap {
    max-width: 420px;
    width: 100%;
    margin: 48px auto;
    position: relative;
}
.auth-wrap .card { padding: 32px; }
.auth-title { text-align: center; margin-bottom: 8px; color: var(--hvm-anthracite); }
.auth-sub { text-align: center; color: var(--color-text-muted); font-size: 14px; margin-bottom: 20px; }
.auth-wrap input { max-width: 100%; }
.auth-wrap .btn { width: 100%; margin-top: 20px; }
.auth-links { text-align: center; margin-top: 16px; font-size: 14px; }

/* --- Onboarding --- */
.steps { list-style: none; padding: 0; margin: 0; }
.steps li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--color-border);
}
.steps li:last-child { border-bottom: none; }
.step-status {
    width: 26px; height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--hvm-lightgray);
    color: var(--hvm-anthracite);
}
.step-done { background: var(--color-success-bg); color: var(--color-success); }

/* --- Footer --- */
.site-footer {
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    margin-top: auto;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--hvm-anthracite);
    text-align: center;
}

code.copy {
    background: var(--hvm-outlinegray);
    color: var(--hvm-black);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 13px;
    word-break: break-all;
}

@media (max-width: 720px) {
    .header-inner { gap: 12px; padding-bottom: 10px; }
    .user-menu { margin-left: 0; flex-wrap: wrap; }
}

/* ==========================================================================
   Produktauftritt "Lexware-Einzug" (alle Firmen ohne HVM-CI). Betreiber:
   Müller Holding AG. Eigene, zurückhaltende Gestaltung: Senfgold als Akzent,
   Anthrazit für Überschriften, keine fremden CI-Elemente.
   ========================================================================== */
body.theme-product {
    --hvm-orange: #E3AC48;
    --hvm-orange-dark: #C9932F;
    --hvm-anthracite: #2E2D2E;
    --hvm-anthracite-surface: #2E2D2E;
    --hvm-midgray: #9F9F9F;
    --hvm-lightgray: #E8E6E1;
    --hvm-outlinegray: #F3F1EC;
    --color-text-muted: #6B6B6B;
    --color-bg: #FBF9F4;
    --font-family: Carlito, Calibri, "Segoe UI", system-ui, sans-serif;
}
body.theme-product .btn { color: #2E2D2E; }
body.theme-product h1, body.theme-product h2 { color: #2E2D2E; }
body.theme-product .stat-card { border-top-color: #E3AC48; }
body.theme-product th { background: #F3F1EC; color: #6B6B6B; }
.brand-seam { height: 1px; background: #DDDBD6; position: relative; flex-shrink: 0; }
.brand-seam span { position: absolute; left: 0; top: -1px; height: 3px; width: 140px; background: #E3AC48; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: #E3AC48; display: inline-block; flex-shrink: 0; }
.nav-admin { font-weight: 700; }

/* --- Auth-Erweiterungen (2FA, Registrierung) --- */
.auth-wide { max-width: 620px; }
.code-input { font-size: 22px; letter-spacing: 4px; font-family: "Courier New", monospace; text-align: center; max-width: 260px; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin: 12px 0 20px; }
.recovery-codes code { display: block; background: var(--hvm-outlinegray); padding: 8px 10px; border-radius: 4px; font-size: 15px; text-align: center; letter-spacing: 1px; }
.setup-steps { padding-left: 20px; margin: 0 0 16px; }
.setup-steps li { margin-bottom: 12px; }
.qr-box { width: 196px; height: 196px; margin: 10px 0; background: #fff; border: 1px solid var(--color-border); padding: 4px; }
.qr-box img, .qr-box canvas { display: block; }
.checkbox-label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 14px; color: var(--color-text); margin: 14px 0; }
.checkbox-label input { margin-top: 3px; }
.inline-check { font-weight: 400; font-size: 13px; margin: 0; display: inline-flex; gap: 4px; align-items: center; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row > div { flex: 1 1 200px; }
.form-row input { max-width: 100%; }
.badge-warn { background: #FBF0D9; color: #8A5A00; }
.placeholder { color: var(--color-danger); font-weight: 600; }
.breadcrumb { font-size: 13px; color: var(--color-text-muted); margin: 0 0 8px; }
.check-list { list-style: none; padding: 0; margin: 0 0 12px; }
.check-list li { padding: 6px 0 6px 26px; position: relative; }
.check-list li::before { content: "\2713"; position: absolute; left: 0; color: var(--hvm-orange); font-weight: 700; }
.check-list.plain li::before { content: "\2022"; }
.table-sm { font-size: 13px; }
.table-sm th, .table-sm td { padding: 6px 8px; }

/* --- Footer mit Betreiberangaben --- */
.footer-legal { border-top: 1px solid var(--color-border); }
.footer-legal a { color: var(--hvm-anthracite); }
.footer-disclaimer { color: var(--color-text-muted); }
