/* Design-Tokens
   Idee: die App lebt zwischen Theke und Thermodrucker - die Bon-Ästhetik
   (Monospace, Perforation, Papierkante) ist das Signaturelement, der Rest
   bleibt ruhig und funktional für Nutzung auf dem Handy in wechselndem Licht. */
:root {
    --bg: #14181c;
    --surface: #1f262d;
    --surface-raised: #262e36;
    --border: #333d47;
    --text: #f2efe9;
    --text-muted: #8b94a0;
    --accent: #e8a23d;
    --accent-text: #1a1408;
    --success: #4caf6d;
    --danger: #e1544c;
    --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
    --font-body: 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }

.app-shell { max-width: 480px; margin: 0 auto; padding: 16px 16px 96px; min-height: 100vh; }
.app-shell.wide { max-width: 900px; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.topbar .who { font-size: .85rem; color: var(--text-muted); }
.topbar a.logout { color: var(--text-muted); font-size: .85rem; text-decoration: none; }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; margin-bottom: 12px;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 16px 20px; font-size: 1.05rem; font-weight: 600;
    border-radius: var(--radius); border: none; cursor: pointer;
    background: var(--accent); color: var(--accent-text);
    font-family: var(--font-body); text-decoration: none;
    min-height: 52px; /* Touch-Target */
}
.btn:active { transform: scale(0.98); }
.btn.secondary { background: var(--surface-raised); color: var(--text); border: 1px solid var(--border); }
.btn.success { background: var(--success); color: #08160c; }
.btn.danger { background: var(--danger); color: #2a0806; }
.btn.small { width: auto; padding: 10px 16px; font-size: .9rem; min-height: 40px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

label { display: block; font-size: .85rem; color: var(--text-muted); margin: 12px 0 6px; }
input, select, textarea {
    width: 100%; padding: 14px; font-size: 1.05rem; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg); color: var(--text);
    font-family: var(--font-body);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* PIN-Eingabe: große, klar getrennte Ziffern-Boxen für schnelle Eingabe am Handy */
.pin-input { display: flex; gap: 8px; }
.pin-input input {
    text-align: center; font-family: var(--font-mono); font-size: 1.6rem;
    letter-spacing: 0.3em; padding: 14px 0;
}

table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 500; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600;
}
.badge.offen { background: #3a3020; color: var(--accent); }
.badge.in_arbeit { background: #223247; color: #6fb1e8; }
.badge.fertig { background: #1f3a28; color: var(--success); }
.badge.abgeholt { background: #2a2a2a; color: var(--text-muted); }
.badge.storniert { background: #3a2222; color: var(--danger); }
.badge.pending { background: #3a3020; color: var(--accent); }
.badge.printed { background: #1f3a28; color: var(--success); }
.badge.failed { background: #3a2222; color: var(--danger); }

/* Bon-Vorschau: bewusst wie ein echter Kassenbon gesetzt - Monospace, gezackte Kante,
   das wiederkehrende Signaturelement der App. */
.receipt {
    background: #fdfaf3; color: #1a1a1a; font-family: var(--font-mono);
    padding: 18px 16px; border-radius: 4px; font-size: .85rem; line-height: 1.5;
    position: relative;
}
.receipt::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -8px; height: 16px;
    background: linear-gradient(135deg, transparent 50%, var(--bg) 50%), linear-gradient(-135deg, transparent 50%, var(--bg) 50%);
    background-size: 16px 16px; background-position: bottom;
}
.receipt .r-title { font-weight: 700; font-size: 1rem; text-align: center; margin-bottom: 8px; }
.receipt .r-divider { border-top: 1px dashed #999; margin: 8px 0; }
.receipt .r-item { display: flex; justify-content: space-between; }
.receipt .r-note { color: #666; font-size: .8rem; padding-left: 12px; }

.empty-state { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 8px; }

.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 12px; font-size: .9rem; }
.flash.error { background: #3a2222; color: #ff9c94; }
.flash.success { background: #1f3a28; color: #9ee6b3; }

.nav-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.nav-tabs a {
    flex: 1; text-align: center; padding: 10px; border-radius: var(--radius);
    background: var(--surface); color: var(--text-muted); text-decoration: none; font-size: .85rem;
    border: 1px solid var(--border);
}
.nav-tabs a.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.table-chip {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); text-decoration: none; color: var(--text); margin-bottom: 10px;
}
.table-chip .num { font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700; }

.order-number { font-family: var(--font-mono); color: var(--accent); }

/* Icon-Tap-Bestelloberfläche: große, antippbare Kacheln statt Listenzeilen */
.product-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px;
}
.product-tile {
    position: relative; background: var(--surface-raised); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.product-tile.has-qty { border-color: var(--accent); }
.tile-tap {
    width: 100%; background: none; border: none; color: var(--text); cursor: pointer;
    padding: 14px 8px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px;
    font-family: var(--font-body); min-height: 92px;
}
.tile-icon { font-size: 1.8rem; line-height: 1; }
.tile-name { font-size: .82rem; font-weight: 600; text-align: center; line-height: 1.2; }
.tile-price { font-size: .75rem; color: var(--text-muted); }
.tile-qty-badge {
    position: absolute; top: 6px; right: 6px; background: var(--accent); color: var(--accent-text);
    border-radius: 999px; min-width: 22px; height: 22px; display: none; align-items: center;
    justify-content: center; font-size: .8rem; font-weight: 700; padding: 0 5px;
}
.product-tile.has-qty .tile-qty-badge { display: flex; }
.tile-actions { display: flex; border-top: 1px solid var(--border); }
.tile-actions button {
    flex: 1; background: var(--surface); border: none; color: var(--text-muted); padding: 8px 0;
    font-size: .82rem; font-weight: 600; cursor: pointer; font-family: var(--font-body);
}
.tile-actions button:first-child { border-right: 1px solid var(--border); }
.tile-actions button.plus5 { color: var(--accent); }

/* Mehrstufiger Bestellablauf */
.wizard-screen { display: none; }
.wizard-screen.active { display: block; }
.big-choice-btn {
    display: block; width: 100%; padding: 24px 16px; margin-bottom: 12px; text-align: center;
    font-size: 1.15rem; font-weight: 700; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface); color: var(--text); cursor: pointer; font-family: var(--font-body);
}
.big-choice-btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.back-btn {
    width: 100%; padding: 20px; font-size: 1.15rem; font-weight: 700; margin-bottom: 16px;
    background: var(--surface-raised); color: var(--text); border: 2px solid var(--border);
    border-radius: var(--radius); cursor: pointer; font-family: var(--font-body);
}
.category-tile {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    padding: 18px 16px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text); font-size: 1.05rem; font-weight: 600;
    cursor: pointer; font-family: var(--font-body);
}
.category-tile.favorites { border-color: var(--accent); color: var(--accent); }
.cart-bar {
    position: sticky; bottom: 0; background: var(--surface-raised); border-top: 1px solid var(--border);
    padding: 12px 16px; margin: 16px -16px -16px; display: flex; justify-content: space-between; align-items: center;
}
.deckel-chip {
    display: inline-block; background: var(--surface-raised); border: 1px solid var(--border);
    border-radius: 999px; padding: 6px 14px; font-size: .85rem; color: var(--text-muted); margin-bottom: 12px;
}

@media (min-width: 640px) {
    .app-shell { padding-top: 24px; }
}
