/* ==========================================================================
   VariVan Bestellformular
   Palette aus dem Logo: Grau 505050, Rot C01830, Gelb FCC000,
   Grün 00903C, Blau 1890CC
   ========================================================================== */

:root {
    --grau:        #505050;
    --grau-hell:   #7a7a7a;
    --linie:       #d4d4d4;
    --linie-fein:  #e8e8e8;
    --rot:         #c01830;
    --gelb:        #fcc000;
    --gruen:       #00903c;
    --blau:        #1890cc;
    --eingabe-bg:  #fffaeb;
    --flaeche:     #f6f6f6;
    --papier:      #ffffff;

    --breite:      62rem;
    --radius:      2px;
}

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

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

body {
    margin: 0;
    background: var(--flaeche);
    color: var(--grau);
    font: 400 16px/1.55 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

h1, h2 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--grau);
}

a { color: var(--rot); }
a:hover { text-decoration: none; }

:focus-visible {
    outline: 2px solid var(--blau);
    outline-offset: 2px;
}

/* Nur fuer Screenreader */
.vh {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Honeypot */
.hp {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px; height: 1px;
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   Statischer Kopf
   -------------------------------------------------------------------------- */
.kopf {
    background: var(--papier);
    border-bottom: 1px solid var(--linie);
}

.kopf__innen {
    max-width: var(--breite);
    margin: 0 auto;
    padding: 1.75rem 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.kopf__titel {
    margin: 0;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 300;
    line-height: 1.1;
    color: var(--grau);
}

.kopf__marke {
    text-align: right;
    max-width: 20rem;
}

.kopf__logo {
    display: block;
    width: 100%;
    max-width: 17rem;
    height: auto;
    margin-left: auto;
}

.kopf__claim {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    line-height: 1.35;
    color: var(--grau-hell);
}

/* Farbband greift die vier Rautenfarben des Logos auf */
.kopf__band {
    height: 3px;
    background: linear-gradient(to right,
        var(--rot)   0 25%,
        var(--gelb)  25% 50%,
        var(--gruen) 50% 75%,
        var(--blau)  75% 100%);
}

/* --------------------------------------------------------------------------
   Funktionsteil
   -------------------------------------------------------------------------- */
.inhalt {
    max-width: var(--breite);
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

.block {
    background: var(--papier);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 0 0 1.5rem;
}

.block__kopf {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.block__kopf h1 { font-size: 1.25rem; }

.block__titel {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
}

.datum {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--grau-hell);
}

/* Felder ------------------------------------------------------------------ */
.raster {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
}

.feld { margin: 0; grid-column: span 3; }
.feld--breit { grid-column: span 6; }
.feld--plz   { grid-column: span 2; }
.feld--ort   { grid-column: span 4; }

.feld label,
.check label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.pflicht { color: var(--rot); }

input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
    width: 100%;
    font: inherit;
    color: inherit;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    background: var(--eingabe-bg);
}

textarea { resize: vertical; }

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
    border-color: var(--rot);
    background: #fff5f6;
}

.feld__fehler {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8125rem;
    color: var(--rot);
}

.feld__fehler--block { margin: 0.75rem 0 0; }

/* Tabelle ----------------------------------------------------------------- */
.tabelle-huelle { overflow-x: auto; }

.bestellung {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
    font-variant-numeric: tabular-nums;
}

.bestellung th {
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--grau);
    white-space: nowrap;
}

.bestellung td {
    padding: 0.6rem;
    border-bottom: 1px solid var(--linie-fein);
    vertical-align: top;
}

.s-pos { width: 3rem;  text-align: center; }
.s-anz { width: 5.5rem; text-align: center; }
.s-ep  { width: 7rem;  text-align: right; white-space: nowrap; }
.s-ges { width: 8rem;  text-align: right; white-space: nowrap; }

th.s-ep, th.s-ges, th.s-anz, th.s-pos { text-align: inherit; }
th.s-ep, th.s-ges { text-align: right; }
th.s-anz, th.s-pos { text-align: center; }

.mengentext { color: var(--grau-hell); }

input.menge {
    width: 100%;
    max-width: 4.5rem;
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-align: center;
    padding: 0.4rem 0.3rem;
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    background: var(--eingabe-bg);
    color: inherit;
}

.zeile--versand td { color: var(--grau-hell); }
.zeile--versand .menge-versand { font-weight: 600; color: var(--grau); }

.bestellung tfoot td {
    border-bottom: 0;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

.bestellung tfoot .s-label { text-align: right; }

.bestellung tfoot tr:first-child td {
    border-top: 1px solid var(--grau);
}

.zeile--brutto td {
    font-size: 1.0625rem;
    font-weight: 700;
    border-top: 2px solid var(--grau);
}

.zeile--brutto .s-ges { color: var(--rot); }

.hinweis {
    margin: 1rem 0 0;
    font-size: 0.8125rem;
    color: var(--grau-hell);
}

/* Abschluss --------------------------------------------------------------- */
.check {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.6rem;
    align-items: start;
    margin: 1.25rem 0 0;
}

.check input { margin-top: 0.35rem; width: 1.1rem; height: 1.1rem; }

.check label {
    font-weight: 400;
    font-size: 0.9375rem;
    margin: 0;
}

.zahlung {
    margin: 1.25rem 0 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--linie-fein);
    font-size: 0.9375rem;
}

.turnstile { margin: 1.25rem 0 0; }

.aktion { margin: 1.5rem 0 0; }

.knopf {
    font: 600 1rem/1 inherit;
    color: #fff;
    background: var(--rot);
    border: 0;
    border-radius: var(--radius);
    padding: 0.85rem 1.75rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.knopf:hover { background: #a3142a; }
.knopf:active { background: #8d1124; }

/* Meldungen --------------------------------------------------------------- */
.meldung {
    background: var(--papier);
    border: 1px solid var(--linie);
    border-left: 4px solid var(--grau);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin: 0 0 1.5rem;
}

.meldung p:first-child { margin-top: 0; }
.meldung p:last-child { margin-bottom: 0; }

.meldung--fehler { border-left-color: var(--rot); }
.meldung--fehler ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.meldung--fehler li { margin: 0.2rem 0; }

.meldung--ok { border-left-color: var(--gruen); }
.meldung--ok h1 { font-size: 1.375rem; margin-bottom: 0.75rem; }

/* --------------------------------------------------------------------------
   Statischer Fuss
   -------------------------------------------------------------------------- */
.fuss {
    background: var(--papier);
    border-top: 1px solid var(--linie);
    padding: 1.75rem 1.5rem 2.25rem;
}

.fuss__recht,
.fuss__firma {
    max-width: var(--breite);
    margin: 0 auto;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--grau-hell);
}

.fuss__recht p { margin: 0 0 0.35rem; }

.fuss__firma {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--linie-fein);
}

.fuss__firma strong { color: var(--grau); }
.fuss__firma a { color: var(--grau-hell); }

/* --------------------------------------------------------------------------
   Mobil: Tabelle wird zu Bloecken
   -------------------------------------------------------------------------- */
@media (max-width: 40rem) {
    .kopf__innen { flex-direction: column; align-items: flex-start; }
    .kopf__marke { text-align: left; }
    .kopf__logo { margin-left: 0; }

    .feld,
    .feld--plz,
    .feld--ort { grid-column: span 6; }

    .block { padding: 1.25rem 1rem; }

    .bestellung thead { display: none; }

    /* Jede Position wird ein Block: Pos-Nummer, Beschreibung, dann die Zahlenzeile. */
    .bestellung tbody tr {
        display: grid;
        grid-template-columns: 6rem 6.5rem 1fr;
        gap: 0.15rem 0.5rem;
        padding: 0.9rem 0;
        border-bottom: 1px solid var(--linie-fein);
    }

    .bestellung tbody td {
        padding: 0;
        border: 0;
        width: auto;
        text-align: left;
    }

    .bestellung tbody .s-pos {
        grid-area: 1 / 1 / 2 / 4;
        font-size: 0.75rem;
        color: var(--grau-hell);
    }

    .bestellung tbody .s-pos::before { content: "Pos. "; }

    .bestellung tbody .s-txt {
        grid-area: 2 / 1 / 3 / 4;
        margin-bottom: 0.6rem;
    }

    .bestellung tbody .s-anz { grid-area: 3 / 1 / 4 / 2; }
    .bestellung tbody .s-ep  { grid-area: 3 / 2 / 4 / 3; color: var(--grau-hell); }
    .bestellung tbody .s-ges { grid-area: 3 / 3 / 4 / 4; text-align: right; font-weight: 600; }

    .bestellung tbody .s-anz,
    .bestellung tbody .s-ep,
    .bestellung tbody .s-ges { font-size: 0.875rem; align-self: end; }

    .bestellung tbody .s-anz::before,
    .bestellung tbody .s-ep::before {
        display: block;
        font-size: 0.75rem;
        font-weight: 400;
        color: var(--grau-hell);
    }

    .bestellung tbody .s-anz::before { content: "Anzahl"; }
    .bestellung tbody .s-ep::before  { content: "Einzelpreis"; }

    input.menge { max-width: 5rem; }

    /* Summenzeilen: Bezeichnung links, Betrag rechts */
    .bestellung tfoot tr {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        padding: 0.4rem 0;
    }

    .bestellung tfoot td { padding: 0; width: auto; }
    .bestellung tfoot .s-label { text-align: left; }
}

/* --------------------------------------------------------------------------
   Druck
   -------------------------------------------------------------------------- */
@media print {
    body { background: #fff; font-size: 11pt; }
    .kopf, .fuss, .block { border-color: #999; }
    .block { break-inside: avoid; page-break-inside: avoid; }
    .turnstile, .aktion, .hinweis, .hp { display: none; }
    input, textarea { background: #fff; border-color: #999; }
    a { color: inherit; text-decoration: none; }
    .kopf__band { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Bewegungsreduktion */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
