/* =====================================================================
   Markttag – Currywurst & Pommes
   Designkonzept: der Bestellzettel eines Imbissstands – ein Ticket mit
   perforiertem Rand, eine ruhige Serifenschrift für Datum/Summe, sonst
   funktional und schnell bedienbar. Keine Gradients, kein Glassmorphism,
   keine Card-Soup.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg:          #F6F1E7;
    --bg-alt:      #EFE7D6;
    --surface:     #FFFFFF;
    --ink:         #2A241D;
    --ink-soft:    #756B5B;
    --curry:       #C97F0A;
    --curry-dark:  #9C630A;
    --tomato:      #B23A2E;
    --line:        #DED2B8;
    --paid:        #4B7A54;
    --paid-bg:     #E7EFE6;
    --open-bg:     #F6EAD9;
    --danger:      #B23A2E;
    --radius:      10px;
    --font-display: 'Fraunces', Georgia, serif;
    --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --shadow-soft:  0 1px 2px rgba(42, 36, 29, 0.06);
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0 0 0.3em; line-height: 1.15; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 0.8em; }

a { color: var(--curry-dark); }

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

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------------------------------
   Layout
   ------------------------------------------------------------------ */

.page {
    max-width: 480px;
    margin: 0 auto;
    padding: 24px 18px 140px;
    min-height: 100vh;
}

.page-wide {
    max-width: 1080px;
    padding: 24px 20px 60px;
}

.eyebrow {
    color: var(--ink-soft);
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.top-bar nav a {
    margin-left: 14px;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--ink-soft);
}
.top-bar nav a:hover { color: var(--curry-dark); }

/* ---------------------------------------------------------------------
   Ticket / Bestellzettel-Karte
   ------------------------------------------------------------------ */

.ticket {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px 22px 8px;
    box-shadow: var(--shadow-soft);
    position: relative;
}

.ticket-perforation {
    border: none;
    border-top: 2px dashed var(--line);
    margin: 18px -22px;
}

.ticket-header .datum {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
}

.ticket-header .fuer {
    color: var(--ink-soft);
    font-size: 0.95rem;
    margin-top: 4px;
}

/* ---------------------------------------------------------------------
   Produkt-Stepper
   ------------------------------------------------------------------ */

.produkt-zeile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}
.produkt-zeile:last-of-type { border-bottom: none; }

.produkt-label {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 500;
}
.produkt-icon { font-size: 1.3rem; }
.produkt-preis { color: var(--ink-soft); font-size: 0.85rem; }

.stepper {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stepper button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--bg-alt);
    color: var(--ink);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}
.stepper button:hover { background: var(--curry); color: #fff; border-color: var(--curry); }
.stepper button:active { transform: scale(0.96); }

.stepper .menge {
    min-width: 34px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-size: 1.15rem;
    font-weight: 600;
}

/* ---------------------------------------------------------------------
   Zahlungsart
   ------------------------------------------------------------------ */

.zahlungsart {
    display: flex;
    gap: 10px;
    margin: 18px 0 6px;
}

.zahlungsart label {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    color: var(--ink-soft);
}

.zahlungsart input { position: absolute; opacity: 0; pointer-events: none; }

.zahlungsart input:checked + span {
    color: var(--ink);
}

.zahlungsart label:has(input:checked) {
    border-color: var(--curry);
    background: var(--open-bg);
    color: var(--ink);
}

.paypal-hinweis {
    background: var(--bg-alt);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 0.9rem;
    color: var(--ink-soft);
    margin-bottom: 8px;
    word-break: break-word;
}

/* ---------------------------------------------------------------------
   Sticky Summenleiste
   ------------------------------------------------------------------ */

.summenleiste {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 8px rgba(42, 36, 29, 0.06);
}

.summenleiste-inner {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.summenleiste .betrag {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------
   Buttons & Formulare
   ------------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--radius);
    padding: 13px 20px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    text-decoration: none;
    background: var(--curry);
    color: #fff;
    white-space: nowrap;
}
.btn:hover { background: var(--curry-dark); }
.btn:disabled { background: var(--line); color: var(--ink-soft); cursor: not-allowed; }

.btn-secondary {
    background: var(--bg-alt);
    color: var(--ink);
    border: 1px solid var(--line);
}
.btn-secondary:hover { background: var(--line); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8f2e24; }

.btn-small { padding: 7px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; }

.field {
    margin-bottom: 16px;
}
.field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.92rem;
}
.field input[type="text"],
.field input[type="date"],
.field input[type="time"],
.field input[type="number"],
.field input[type="password"],
.field select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font-body);
    background: var(--surface);
    color: var(--ink);
}
.field input:focus, .field select:focus { border-color: var(--curry); }
.field-hint { color: var(--ink-soft); font-size: 0.85rem; margin-top: 4px; }

.alert {
    padding: 13px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 0.95rem;
}
.alert-error   { background: #F6E4E1; color: #7A2A20; }
.alert-info    { background: var(--bg-alt); color: var(--ink); }
.alert-success { background: var(--paid-bg); color: #33553B; }

/* ---------------------------------------------------------------------
   Badges
   ------------------------------------------------------------------ */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge-bezahlt { background: var(--paid-bg); color: var(--paid); }
.badge-offen   { background: var(--open-bg); color: var(--curry-dark); }

/* ---------------------------------------------------------------------
   Admin: Dashboard-Kacheln
   ------------------------------------------------------------------ */

.kennzahlen {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin: 20px 0 28px;
}

.kennzahl {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
}
.kennzahl .zahl {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 600;
    display: block;
}
.kennzahl .label { color: var(--ink-soft); font-size: 0.85rem; }

/* ---------------------------------------------------------------------
   Admin: Tabellen
   ------------------------------------------------------------------ */

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow-x: auto;
}

table.datentabelle {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}

table.datentabelle th, table.datentabelle td {
    text-align: left;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.datentabelle th {
    color: var(--ink-soft);
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}
table.datentabelle th:hover { color: var(--ink); }

table.datentabelle tbody tr:last-child td { border-bottom: none; }
table.datentabelle tbody tr:hover { background: var(--bg); }

.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.toolbar input[type="search"] {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-family: var(--font-body);
    min-width: 200px;
}

.pill-toggle {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.pill-toggle a {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    text-decoration: none;
    color: var(--ink-soft);
    font-size: 0.85rem;
}
.pill-toggle a.aktiv { background: var(--curry); border-color: var(--curry); color: #fff; }

/* ---------------------------------------------------------------------
   Export / Copy-Text
   ------------------------------------------------------------------ */

.export-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.export-tabs a.aktiv {
    background: var(--curry) !important;
    border-color: var(--curry) !important;
    color: #fff !important;
}
.export-tabs a:not(.aktiv) {
    background: var(--bg-alt) !important;
    color: var(--ink) !important;
    border: 1px solid var(--line) !important;
}

.copy-box {
    position: relative;
}
.copy-box textarea {
    width: 100%;
    min-height: 320px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.88rem;
    line-height: 1.6;
    background: var(--surface);
    color: var(--ink);
    resize: vertical;
}

/* ---------------------------------------------------------------------
   Login
   ------------------------------------------------------------------ */

.login-wrap {
    max-width: 360px;
    margin: 12vh auto 0;
    padding: 0 18px;
}

/* ---------------------------------------------------------------------
   Utility
   ------------------------------------------------------------------ */

.muted { color: var(--ink-soft); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--ink-soft);
}
.empty-state h2 { color: var(--ink); }

/* ---------------------------------------------------------------------
   Print
   ------------------------------------------------------------------ */

@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
    .table-wrap { border: none; }
}
