:root {
    --ink: #2e2822;
    --ink-soft: #554b41;
    --sand: #f7c95d;
    --amber: #e6981b;
    --cream: #f5f4f0;
    --paper: #fffdf8;
    --line: #ded6c8;
    --success: #2f6f4e;
    --danger: #a11616;
    --warning: #9a5d00;
    --admin-head: #29363e;
    --admin-bg: #edf1f5;
    --admin-line: #cbd5e1;
    --radius: 14px;
    color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--cream);
    font-family: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }

.site-footer,
.public-main {
    width: min(1180px, calc(100% - 32px));
    margin-inline: auto;
}

.public-main { padding-block: 34px 56px; }

.success-hero h1 { max-width: 720px; margin: 10px auto 14px; font-size: clamp(2rem, 5vw, 4rem); line-height: 1.02; letter-spacing: -.035em; }

.order-layout, .success-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.panel, .aside-card, .aside-note { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 13px 30px rgba(46,40,34,.08); }
.order-submitting { overflow: hidden; }
.order-loading-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; background: rgba(46,40,34,.6); cursor: wait; }
.order-loading-overlay[hidden] { display: none; }
.order-loading-message { display: grid; justify-items: center; gap: 20px; width: min(420px, 100%); padding: 32px 24px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--paper); box-shadow: 0 16px 50px rgba(0,0,0,.2); text-align: center; outline: none; }
.order-loading-message strong { font-size: 1.1rem; }
.order-loading-spinner { width: 42px; height: 42px; border: 4px solid var(--line); border-top-color: var(--amber); border-radius: 50%; animation: order-loading-spin .8s linear infinite; }
@keyframes order-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .order-loading-spinner { animation: none; } }
.order-form, .payment-panel, .order-summary { padding: clamp(20px, 4vw, 38px); }

.panel-heading { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 24px; }
.panel-heading > span, .step-number {
    flex: 0 0 auto; width: 34px; height: 34px; display: inline-grid; place-items: center;
    color: var(--ink); background: var(--sand); border-radius: 50%; font-weight: 800; font-size: .8rem;
}
.panel-heading h2 { margin: 0; font-size: 1.25rem; line-height: 1.2; }
.panel-heading p { margin: 3px 0 0; color: #756b61; font-size: .9rem; }
.panel-heading.subsection { margin-top: 36px; padding-top: 30px; border-top: 1px solid var(--line); }

.form-grid { display: grid; gap: 18px; }
.form-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: grid; gap: 7px; font-weight: 700; font-size: .92rem; }
.field > span small { color: #756b61; font-weight: 400; }
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], input[type="date"], input[type="url"], select, textarea {
    width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #cfc5b7; border-radius: 7px; color: var(--ink); background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(230,152,27,.22); border-color: var(--amber); }
.quantity-control { display: grid; grid-template-columns: 46px minmax(70px, 1fr) 46px; max-width: 210px; }
.quantity-control input { min-width: 0; border-radius: 0; border-inline: 0; text-align: center; font-weight: 800; font-size: 1.05rem; appearance: textfield; }
.quantity-control input::-webkit-inner-spin-button, .quantity-control input::-webkit-outer-spin-button { margin: 0; appearance: none; }
.quantity-control button { min-height: 46px; border: 1px solid #cfc5b7; color: var(--ink); background: #fff8e8; font-size: 1.35rem; font-weight: 800; line-height: 1; }
.quantity-control button:first-child { border-radius: 7px 0 0 7px; }
.quantity-control button:last-child { border-radius: 0 7px 7px 0; }
.quantity-control button:hover:not(:disabled) { background: var(--sand); }
.quantity-control button:focus-visible { position: relative; z-index: 1; outline: 3px solid rgba(230,152,27,.28); }
.quantity-control button:disabled { color: #a69d91; background: #f2eee8; cursor: not-allowed; }
.quantity-hint { color: #756b61; font-weight: 400; }
.product-order-row { display: grid; grid-template-columns: minmax(170px, 1fr) 210px minmax(130px, .65fr); gap: 22px; align-items: start; }
.product-identification { display: grid; align-content: start; }
.product-identification > span, .selection-total > span { color: #756b61; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.product-identification > strong { margin-top: 5px; font-size: 1.12rem; }
.product-identification > small { margin-top: 3px; color: #756b61; }
.selection-total { display: grid; justify-items: end; padding-top: 1px; }
.selection-total strong { margin-top: 5px; font-size: 1.45rem; white-space: nowrap; }

.payment-options { display: grid; gap: 10px; margin: 36px 0 0; padding: 30px 0 0; border: 0; border-top: 1px solid var(--line); }
.payment-options legend { display: flex; align-items: center; gap: 13px; margin-bottom: 14px; padding: 0; font-size: 1.22rem; }
.payment-card { display: flex; gap: 12px; align-items: flex-start; padding: 15px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.payment-card:has(input:checked) { border-color: var(--amber); background: #fff8e8; box-shadow: 0 0 0 2px rgba(230,152,27,.12); }
.payment-card input { margin-top: 4px; accent-color: var(--amber); }
.payment-card span { display: grid; gap: 2px; }
.payment-card small { color: #756b61; }

.consents { display: grid; gap: 10px; margin-top: 24px; }
.consents label { display: flex; align-items: flex-start; gap: 10px; font-size: .91rem; }
.consents input { margin-top: 4px; accent-color: var(--amber); }
.consents a { text-decoration-thickness: 1px; text-underline-offset: 2px; }

.submit-bar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 28px -38px -38px; padding: 20px 38px; border-radius: 0 0 var(--radius) var(--radius); background: #f7f1e6; border-top: 1px solid var(--line); }
.submit-bar > div { display: grid; }
.submit-bar small { color: #756b61; }
.submit-bar strong { font-size: 1.55rem; }

.primary-button, .secondary-button, .danger-button {
    min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 18px;
    border: 1px solid #d38912; border-radius: 7px; color: #1f1608; background: var(--amber); font-weight: 800; text-decoration: none;
}
.primary-button:hover { background: var(--sand); }
.primary-button:focus-visible, .secondary-button:focus-visible, .danger-button:focus-visible { outline: 3px solid rgba(230,152,27,.35); outline-offset: 2px; }
.full-button { width: 100%; }
.secondary-button { background: #fff; border-color: #b8b0a5; font-weight: 650; }
.danger-button { color: #fff; background: var(--danger); border-color: var(--danger); }

.order-aside { display: grid; gap: 12px; position: sticky; top: 20px; }
.aside-card { display: flex; gap: 13px; padding: 18px; }
.aside-number { flex: 0 0 auto; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--amber); color: #8c5700; border-radius: 50%; font-weight: 800; font-size: .78rem; }
.aside-card p, .aside-note p { margin: 4px 0 0; color: #756b61; font-size: .9rem; }
.aside-note { padding: 20px; color: #fff; background: var(--ink); border-color: var(--ink); }
.aside-note p { color: #e5ddd2; }
.aside-photo { overflow: hidden; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 13px 30px rgba(46,40,34,.08); }
.aside-photo img { width: 100%; display: block; object-fit: cover; }
.aside-photo-product img { max-height: 300px; object-position: center 61%; }
.aside-photo figcaption { padding: 11px 13px; color: #756b61; font-size: .84rem; }
.workshop-feature { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .7fr); gap: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink); color: #fff; box-shadow: 0 13px 30px rgba(46,40,34,.08); }
.workshop-hero { margin-bottom: 24px; }
.workshop-feature img { width: 100%; height: auto; display: block; align-self: center; }
.workshop-hero img { height: 100%; aspect-ratio: 8 / 5; object-fit: cover; object-position: center; }
.workshop-feature > div { display: grid; align-content: center; padding: clamp(24px, 4vw, 44px); }
.workshop-feature span { color: var(--sand); font-size: .76rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.workshop-feature h1 { margin: 8px 0 10px; font-size: 1.5rem; line-height: 1.12; }
.workshop-feature p { margin: 0; color: #e5ddd2; }

.closed-panel { display: flex; align-items: flex-start; gap: 16px; padding: 28px; }
.closed-panel h2 { margin: 0; }
.closed-panel p { margin: 5px 0 0; }
.status-dot { width: 14px; height: 14px; margin-top: 8px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 6px #fff0ce; }
.honeypot { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.field-error { color: var(--danger); font-weight: 650; font-size: .84rem; }
.form-error { margin-bottom: 18px; padding: 12px; border-left: 4px solid var(--danger); background: #fff1f1; }

.success-hero { padding: clamp(30px, 6vw, 60px); margin-bottom: 24px; border-radius: var(--radius); color: #fff; background: var(--ink); text-align: center; }
.success-hero h1 { margin-inline: auto; }
.success-hero p { margin: 0; color: #ece4da; font-size: 1.05rem; }
.success-icon { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; color: var(--ink); background: var(--sand); font-size: 1.75rem; font-weight: 900; }
.payment-details, .order-summary dl { display: grid; gap: 0; margin: 0 0 22px; }
.payment-details > div, .order-summary dl > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.payment-details dt, .order-summary dt { color: #756b61; }
.payment-details dd, .order-summary dd { margin: 0; overflow-wrap: anywhere; }
.payment-hint { margin: 18px 0 0; color: #756b61; font-size: .9rem; }
.order-summary p { margin-bottom: 0; }

.flash { margin-bottom: 18px; padding: 12px 15px; border: 1px solid; border-radius: 8px; background: #fff; }
.flash-success { color: #245b40; border-color: #8bc3a5; background: #edf8f1; }
.flash-error { color: #841313; border-color: #d5a2a2; background: #fff1f1; }
.flash-warning { color: #7b4b00; border-color: #e3bf72; background: #fff8e8; }
.public-page .flash-warning { margin-bottom: 24px; padding: 20px 22px; border: 2px solid #9a5d00; border-left-width: 8px; background: #fff0c2; color: #603900; font-size: 1.05rem; font-weight: 700; box-shadow: 0 6px 18px rgba(154,93,0,.15); }

.site-footer { display: flex; justify-content: space-between; gap: 24px; padding-block: 26px 38px; border-top: 1px solid #d6cec2; color: #675d53; font-size: .88rem; }
.site-footer > div { display: grid; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
.legal-page { padding: clamp(24px, 5vw, 52px); }
.legal-hero h1 { margin-top: 0; font-size: 1.5rem; }
.legal-hero .secondary-button { justify-self: start; margin-top: 18px; }
.legal-copy { max-width: 850px; white-space: normal; overflow-wrap: anywhere; }

/* Eigenständiges Backoffice in der visuellen Richtung des OT51-Ticketsystems. */
.admin-page { background: var(--admin-bg); color: #12213a; }
.admin-shell { width: min(1480px, calc(100% - 40px)); margin: 0 auto 32px; background: #fff; border: 1px solid var(--admin-line); box-shadow: 0 16px 38px rgba(18,33,58,.14); }
.admin-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; color: #fff; background: var(--admin-head); border-bottom: 4px solid #d7c39d; }
.admin-header > div:first-child { display: grid; }
.admin-brand { color: #fff; text-decoration: none; font-size: 1.16rem; font-weight: 800; }
.admin-context { color: #d8e0ea; font-size: .86rem; }
.admin-user { color: #d8e0ea; font-size: .9rem; }
.admin-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0; padding: 0 14px; border-bottom: 1px solid var(--admin-line); background: #f7f9fb; }
.admin-nav a, .nav-button { display: inline-flex; min-height: 44px; align-items: center; padding: 8px 11px; border: 0; color: #334155; background: transparent; text-decoration: none; }
.admin-nav a:hover, .nav-button:hover { background: #e7edf3; }
.admin-nav form { margin-left: auto; }
.admin-content { padding: 24px; }
.admin-content h1 { margin: 0 0 20px; font-size: 1.55rem; }
.admin-content h2 { font-size: 1.12rem; }
.admin-card { border: 1px solid var(--admin-line); background: #fff; }
.admin-card + .admin-card { margin-top: 20px; }
.admin-card-header { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 12px 15px; background: #dfe6ee; border-bottom: 1px solid #b4c0cf; }
.admin-card-header h2 { margin: 0; }
.admin-card-body { padding: 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat-card { padding: 14px; border: 1px solid var(--admin-line); background: #f8fafc; }
.stat-card small { display: block; color: #64748b; }
.stat-card strong { display: block; margin-top: 4px; font-size: 1.55rem; }
.filter-form, .settings-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.filter-form .field { font-size: .82rem; }
.filter-actions, .admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th, .admin-table td { padding: 10px 11px; border-bottom: 1px solid #e3e9f0; text-align: left; vertical-align: top; }
.admin-table th { background: #f1f5f9; color: #46566d; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.admin-table tr:hover td { background: #fbfdff; }
.admin-table a { color: #245b93; font-weight: 700; }
.status-badge { display: inline-flex; padding: 3px 7px; border: 1px solid #cbd5e1; background: #eef2f6; font-size: .78rem; white-space: nowrap; }
.status-bezahlt, .status-abholbereit, .status-abgeholt { color: #245b40; border-color: #a9cbb8; background: #edf8f1; }
.status-zahlung_offen { color: #7b4b00; border-color: #e3bf72; background: #fff8e8; }
.status-storniert { color: #841313; border-color: #d5a2a2; background: #fff1f1; }
.bulk-bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 15px; border-top: 1px solid var(--admin-line); background: #f7f9fb; }
.bulk-bar select { width: auto; min-width: 190px; min-height: 40px; }
.admin-button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 7px 11px; border: 1px solid var(--admin-line); border-radius: 0; color: #12213a; background: #fff; text-decoration: none; }
.admin-button.primary { color: #fff; border-color: var(--admin-head); background: var(--admin-head); }
.admin-button.danger { color: #fff; border-color: var(--danger); background: var(--danger); }
.admin-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; margin: 0; }
.detail-list > div { padding: 10px 0; border-bottom: 1px solid #e3e9f0; }
.detail-list dt { color: #64748b; font-size: .82rem; }
.detail-list dd { margin: 2px 0 0; font-weight: 650; overflow-wrap: anywhere; }
.timeline { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.timeline li { padding-left: 14px; border-left: 3px solid #d7c39d; }
.timeline small { color: #64748b; }
.settings-section { padding: 18px; border: 1px solid var(--admin-line); }
.settings-section + .settings-section { margin-top: 16px; }
.settings-section h2 { margin: 0 0 14px; }
.settings-grid .span-2 { grid-column: span 2; }
.settings-grid .span-4 { grid-column: 1 / -1; }
.checkbox-field { display: flex; align-items: center; gap: 9px; min-height: 46px; }
.checkbox-field input { accent-color: var(--admin-head); }
.station-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.login-wrap { width: min(460px, calc(100% - 32px)); margin: 9vh auto; }
.login-wrap .admin-shell { width: 100%; margin: 0; }
.login-form { display: grid; gap: 16px; padding: 24px; }
.login-form h1 { margin: 0; }
.muted { color: #64748b; }
.empty-state { padding: 30px; text-align: center; color: #64748b; }
.print-sheet { padding: 8px; }
.print-sheet-head { display: flex; justify-content: space-between; gap: 30px; align-items: flex-end; padding-bottom: 16px; border-bottom: 3px solid #29363e; }
.print-sheet-head h1 { margin: 4px 0 0; }
.print-table .check-cell { font-size: 1.35rem; }

@media (max-width: 900px) {
    .order-layout, .success-layout, .admin-detail-grid { grid-template-columns: 1fr; }
    .order-aside { position: static; grid-template-columns: repeat(3, 1fr); }
    .aside-note { grid-column: 1 / -1; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .filter-form, .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settings-grid .span-4 { grid-column: 1 / -1; }
    .station-grid { grid-template-columns: 1fr; }
    .product-order-row { grid-template-columns: minmax(160px, 1fr) 210px; }
    .selection-total { grid-column: 1 / -1; justify-items: start; padding-top: 4px; }
    .workshop-feature { grid-template-columns: 1fr; }
    .workshop-feature img { width: 100%; }
}

@media (max-width: 620px) {
    .public-main { padding-top: 20px; }
    .form-grid.two-columns, .detail-list { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .product-order-row { grid-template-columns: 1fr 1fr; gap: 16px 12px; }
    .product-identification { grid-column: 1 / -1; }
    .quantity-control { max-width: 100%; grid-template-columns: 42px minmax(54px, 1fr) 42px; }
    .selection-total { grid-column: auto; justify-items: end; padding-top: 22px; }
    .submit-bar { margin: 28px -20px -20px; padding: 18px 20px; align-items: stretch; flex-direction: column; }
    .order-aside { grid-template-columns: 1fr; }
    .aside-note { grid-column: auto; }
    .site-footer { flex-direction: column; }
    .payment-details > div, .order-summary dl > div { grid-template-columns: 1fr; gap: 2px; }
    .admin-shell { width: 100%; margin: 0; border-inline: 0; }
    .admin-header { align-items: flex-start; }
    .admin-user { display: none; }
    .admin-content { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-form, .settings-grid { grid-template-columns: 1fr; }
    .settings-grid .span-2, .settings-grid .span-4 { grid-column: auto; }
    .bulk-bar { align-items: stretch; flex-direction: column; }
    .bulk-bar select { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
    @page { size: A4 portrait; margin: 12mm; }
    body.admin-page { background: #fff; color: #000; }
    .admin-shell { width: 100%; margin: 0; border: 0; box-shadow: none; }
    .admin-header, .admin-nav, .no-print, .flash { display: none !important; }
    .admin-content { padding: 0; }
    .print-sheet { padding: 0; }
    .admin-table th, .admin-table td { padding: 7px; border-color: #777; }
    .admin-table tr:hover td { background: transparent; }
}

.admin-mail-warning { border-left: 6px solid #9a5d00; padding: 18px; }
.admin-mail-warning a { display: block; margin-top: 8px; font-weight: 700; }
/* Versandstatus direkt an der Bestellnummer, ohne zusätzliche Tabellenspalte. */
.order-number-link { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.mail-indicator { display: inline-block; width: 12px; height: 12px; border: 1px solid rgba(0,0,0,.25); border-radius: 50%; flex: 0 0 12px; }
.mail-indicator-sent { background: #238342; }
.mail-indicator-failed { background: #c32929; }
.mail-indicator-pending { background: #e4a113; }
