:root {
    --bg-color: #000000;
    --card-bg: #1c1c1e;
    --card-inner: #2c2c2e;
    --text-main: #ffffff;
    --text-muted: #8e8e93;
    --accent-green: #30d158;
    --accent-blue: #0a84ff;
    --accent-red: #ff3b30;
    --border-radius: 16px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.app-container {
    width: 100%;
    max-width: 600px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

header h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

header .version-badge {
    background: #2c2c2e;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
}

/* Navigation Pills */
nav {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    background: #1c1c1e;
    padding: 6px;
    border-radius: 12px;
    margin-bottom: 24px;
}

nav button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 4px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
}

nav button.active {
    background: #2c2c2e;
    color: #ffffff;
}

nav button.active.status-green {
    background: var(--accent-green);
    color: #000000;
}

/* Finanzen-Aufklapper in der Tab-Leiste: der Wrapper füllt seine
   Rasterzelle, der Knopf erbt die Tab-Optik über "nav button", und das
   Menü klappt unter der Zelle auf. */
nav .menu { position: relative; }
nav .menu > button { width: 100%; }
nav .menu-items { right: 0; left: auto; }

/* Main Content Area */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #333;
}

.card-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-crm {
    background: var(--accent-blue);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
}

.badge-green {
    background: var(--accent-green);
    color: black;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
}

.badge-blue {
    background: var(--accent-blue);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
}

/* Recording UI */
.recording-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px 0;
}

/* Premium Recording UI */
.main-mic-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 50px 20px;
}

.mic-container {
    position: relative;
    width: 120px;
    height: 120px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
    margin-bottom: 20px;
}

.mic-container .mic-svg {
    width: 45px;
    height: 45px;
    color: #000;
    position: relative;
    z-index: 3;
}

.mic-ring {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    z-index: 1;
    transition: all 0.4s ease;
}

.mic-container.recording {
    background: #ff3b30;
    transform: scale(1.1);
}

.mic-container.recording .mic-svg {
    color: #fff;
}

.mic-container.recording .mic-ring {
    animation: ripple 1.5s infinite;
    background: rgba(255, 59, 48, 0.3);
}

@keyframes ripple {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.8); opacity: 0; }
}

.status-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 10px;
}

.progress-wrapper {
    width: 100%;
    margin-top: 30px;
}

.progress-bar {
    height: 6px;
    background: #2c2c2e;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: var(--accent-green);
    transition: width 0.4s ease;
}

.progress-status {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

/* Terminal Output Colors */
.event-log {
    background: #000000;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    max-height: 200px;
    overflow-y: auto;
    color: var(--accent-blue); /* Terminal-Blau */
    box-shadow: inset 0 0 20px rgba(10, 132, 255, 0.05);
    position: relative;
    overflow-x: hidden;
}

.event-item.info {
    color: var(--accent-blue);
}

.event-item.system {
    color: #0070e0;
    opacity: 0.8;
}

/* Side-by-Side Layout for Address and Terminal */
.address-terminal-container {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.address-terminal-container .editable-area {
    flex: 1;
}

.terminal-mini {
    flex: 1;
    max-width: 50%;
    height: 120px;
    font-size: 11px;
    margin-bottom: 0 !important;
}

/* Scanline Effekt Update für Blau */
.event-log::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(0, 0, 255, 0.06), rgba(0, 100, 255, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 10;
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
}

.event-item.error {
    color: #ff3b30;
    font-weight: bold;
}

/* Scrollbar für Terminal */
.event-log::-webkit-scrollbar {
    width: 6px;
}
.event-log::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

/* Form Elements */
.content-area {
    background: var(--card-inner);
    border-radius: 12px;
    padding: 15px;
    font-size: 14px;
    line-height: 1.5;
    min-height: 80px;
}

.item-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-row {
    background: var(--card-inner);
    padding: 12px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    font-weight: 700;
    font-size: 18px;
}
.total-value { color: var(--accent-green); }

.mic-container.green {
    background: var(--accent-green);
}

.mic-container.green .mic-svg {
    color: #000000;
}

.mic-container.green:hover {
    transform: scale(1.08);
    background: #28b84d;
}

.green-ring {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    background: rgba(48, 209, 88, 0.2);
    z-index: 1;
    transition: all 0.4s ease;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    width: 100%;
}

.button-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mic-container.orange {
    background: var(--accent-orange, #ff9500);
}

.mic-container.orange .mic-svg {
    color: #000000;
}

.mic-container.orange:hover {
    transform: scale(1.08);
    background: #ffaa33;
}

.orange-ring {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    background: rgba(255, 149, 0, 0.2);
    z-index: 1;
    transition: all 0.4s ease;
}

.mic-container.small {
    width: 65px;
    height: 65px;
    margin-bottom: 8px;
    margin-top: 0;
}

.mic-container.small .mic-svg {
    width: 28px;
    height: 28px;
}

.mic-container.blue {
    background: #0a84ff;
}

.mic-container.blue .mic-svg {
    color: #ffffff;
}

.mic-container.blue:hover {
    transform: scale(1.08);
    background: #0070e0;
}

.blue-ring {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    background: rgba(10, 132, 255, 0.2);
    z-index: 1;
    transition: all 0.4s ease;
}

/* Editable Elements Styles */
.editable-area {
    width: 100%;
    background: var(--card-inner);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 15px;
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--text-main);
    line-height: 1.5;
    resize: vertical;
    transition: all 0.2s ease;
}

.editable-area:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: #1c1c1e;
    box-shadow: 0 0 10px rgba(10, 132, 255, 0.1);
}

/* Missing Data Highlighting */
.missing-data {
    border: 1px solid rgba(255, 69, 58, 0.5) !important;
    background: rgba(255, 69, 58, 0.05) !important;
    box-shadow: 0 0 10px rgba(255, 69, 58, 0.2);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 5px rgba(255, 69, 58, 0.2); }
    50% { box-shadow: 0 0 15px rgba(255, 69, 58, 0.4); }
    100% { box-shadow: 0 0 5px rgba(255, 69, 58, 0.2); }
}

.price-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.item-qty { width: 60px; text-align: center; }
.item-label { flex: 3; }
.item-price { width: 100px; text-align: right; }

.item-row input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 14px;
    width: 100%;
}

/* Löschknopf einer Position: zurückhaltend, bis der Zeiger drüber ist -
   er steht in jeder Zeile und soll das Bild nicht dominieren. */
.item-row .item-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    padding: 4px 6px;
    cursor: pointer;
    flex: 0 0 auto;
}
.item-row .item-delete:hover { color: #ff453a; }

/* Options-Schalter je Zeile ("auf Wunsch", BAMAG-Offertmodul). */
.item-row .item-opt {
    background: none;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    border-radius: 6px;
    padding: 3px 5px;
    cursor: pointer;
    flex: 0 0 auto;
}
.item-row.optional-row .item-opt {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* Kundenvorschläge unter dem Adressblock (aus /api/customers). */
.customer-suggest {
    margin-top: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: var(--card-inner);
    max-height: 190px;
    overflow-y: auto;
}
.customer-suggest-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 13px;
    padding: 8px 10px;
    cursor: pointer;
}
.customer-suggest-item:last-child { border-bottom: none; }
.customer-suggest-item:hover { background: rgba(10, 132, 255, 0.12); }
.customer-suggest-item span { color: var(--text-muted); font-size: 11px; }

/* Treffer-Punkt: GRÜN = Katalogtreffer (Code im Tooltip), ORANGE = NEU
   (wird beim Bestätigen gelernt). Seit 30.08. ein FARBPUNKT statt der
   96px-Code-Pille (Meier-Feedback: "Position ist zu klein") - der Platz
   gehört der Beschreibung, die Bedeutung steht in der Legende darunter. */
.item-row .item-match {
    flex: 0 0 auto;
    width: 14px;
    text-align: center;
    font-size: 11px;
    cursor: help;
}

/* Telefon (Feedback 30.08.): die festen Zahlenfelder frassen die ganze
   Zeilenbreite, die Beschreibung war UNSICHTBAR. Auf schmalen Schirmen
   bekommt sie ihre eigene volle Zeile über den Zahlen. */
@media (max-width: 560px) {
    .item-row .item-desc {
        flex: 1 1 100%;
        order: -1;
        margin: 0 0 6px 0;
    }
    .items-head .ih-label { display: none; }
}

/* Beschreibung + Code-Unterzeile (Roberto 09.09.): der Code steht klein
   und gedämpft UNTER der Beschreibung - keine neue Spalte, die Meier-
   Klage vom 30.08. (Pille frass die Breite) bleibt gelöst. */
.item-desc {
    flex: 3;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}
.item-desc .item-label { flex: 0 0 auto; }
/* Doppelte Artikelnummer auf der Offerte (Roberto/Ruedi 09.10.): Zeile und
   Code orange, Hinweis über der Liste - warnen, nicht sperren (man in the loop). */
.item-row.dup-row { box-shadow: inset 3px 0 0 #ff9f0a; }
.item-row.dup-row .item-code { color: #ff9f0a; font-weight: 700; }
.dup-warning {
    display: none;
    margin: 0 0 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 159, 10, 0.12);
    border: 1px solid rgba(255, 159, 10, 0.45);
    color: #ffb340;
    font-size: 12px;
}
.item-code {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    line-height: 1.1;
    margin-top: 2px;
    min-height: 11px;
}
/* Katalog-Vorschläge unter dem Beschreibungsfeld */
.item-suggest {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    margin-top: 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: var(--card-inner);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    max-height: 220px;
    overflow-y: auto;
}

/* Legende unter den Positionen - erklärt die Farbpunkte. */
.items-legend {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}
.items-legend .dot-matched { color: var(--accent-green); }
.items-legend .dot-new { color: var(--accent-orange, #ff9500); }

/* Spaltenkopf über den Positionen: gleiche festen Breiten wie die Felder
   der Zeilen (.item-qty 50, .item-unit 48, .item-price 80, .item-total 84,
   Badge 96 + OPT + Löschknopf als Leerraum rechts). */
.items-head {
    display: flex;
    align-items: center;
    padding: 0 12px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.items-head .ih-label { flex-grow: 1; margin-right: 10px; }
.items-head .ih-qty { width: 50px; text-align: center; }
.items-head .ih-unit { width: 48px; text-align: center; }
.items-head .ih-price { width: 80px; text-align: right; }
.items-head .ih-total { width: 84px; text-align: right; }
/* Punkt (14) + OPT + Löschknopf - schmaler seit dem Farbpunkt (30.08.). */
.items-head .ih-actions { width: 82px; }
.item-row .item-match.matched { color: var(--accent-green); }
.item-row .item-match.new { color: var(--accent-orange, #ff9500); }
/* Optionale Zeilen sichtbar "nebenläufig": dabei, aber nicht in der Summe. */
.item-row.optional-row .item-label,
.item-row.optional-row .item-qty,
.item-row.optional-row .item-unit,
.item-row.optional-row .item-match,
.item-row.optional-row .item-price,
.item-row.optional-row .item-total {
    opacity: 0.55;
    font-style: italic;
}

/* Rückfrage "als neuen Preis übernehmen". Erscheint nur, wenn der Preis einer
   Katalogposition geändert wurde - sonst wäre sie bei jeder Zeile im Weg. */
.price-learn {
    flex-basis: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
}

.price-learn input[type="checkbox"] {
    width: auto !important;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

/* Die Zeile muss umbrechen dürfen, damit die Rückfrage darunter Platz hat. */
.item-row {
    flex-wrap: wrap;
}

/* Diktierter Preis statt Katalogpreis. Bewusst auffällig: eine verhörte Zahl
   landet sonst ungeprüft auf der Offerte. */
.price-spoken {
    color: var(--accent-green) !important;
    font-weight: 700;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}

/* Dritter Zustand (CATALOG-AND-QUOTES-DESIGN.md §6): Position erkannt, aber
   noch ohne Preis. Muss nach "hier fehlt etwas" aussehen - nicht nach 0.00,
   das wie ein gewolltes Gratisangebot durchginge. */
.price-unpriced {
    border: 1px dashed var(--accent-yellow, #ffd60a) !important;
    background: rgba(255, 214, 10, 0.08) !important;
}

.item-qty {
    width: 50px !important;
    color: var(--accent-blue) !important;
    font-weight: 700;
    text-align: center;
}

.item-label {
    flex-grow: 1;
    /* Seit 28.08. steht die Beschreibung VORNE (Lesefolge einer Offert-
       zeile: Beschreibung, Menge × Einheit × Ansatz = Betrag) - der
       Abstand gehört darum nur noch nach rechts. */
    margin: 0 10px 0 0;
}

.item-price {
    width: 80px !important;
    text-align: right;
    font-weight: 600;
}

/* Zeilenbetrag (Menge × Ansatz), reine Anzeige - calculateTotal() schreibt
   ihn. Feste Breite wie die übrigen Zahlenfelder, sonst erbt das Feld die
   100% aus ".item-row input" und bricht auf eine eigene Zeile um. */
.item-total {
    width: 84px !important;
    flex: 0 0 auto;
    text-align: right;
    font-weight: 700;
    color: var(--accent-green) !important;
    pointer-events: none;
}

/* Einheit und Dauer-Faktor brauchen wie Menge und Preis eine feste Breite:
   ohne eigene Regel erbt das Feld die 100% aus ".item-row input" und rutscht
   wegen flex-wrap auf eine eigene Zeile - die Position zerfällt in Stapel. */
.item-unit {
    width: 48px !important;
    flex: 0 0 auto;
    text-align: center;
    color: var(--text-muted);
}

.item-factor {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
}

.item-times {
    color: var(--text-muted);
    font-size: 12px;
}

.item-hours {
    width: 36px !important;
    text-align: center;
    color: var(--accent-blue);
    font-weight: 700;
}

.btn-mini-save {
    background: rgba(10, 132, 255, 0.1);
    border: 1px solid rgba(10, 132, 255, 0.3);
    color: var(--accent-blue);
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-mini-save:hover {
    background: var(--accent-blue);
    color: white;
}

.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid #333;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 12px;
    cursor: pointer;
    margin-top: 10px;
}

/* Admin Dashboard */
.admin-dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 10px;
}

.metric-item {
    background: var(--card-inner);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.metric-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.metric-value {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.status-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.status-pill {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.status-pill.green { background: rgba(48, 209, 88, 0.1); color: var(--accent-green); border: 1px solid rgba(48, 209, 88, 0.3); }
.status-pill.blue { background: rgba(10, 132, 255, 0.1); color: var(--accent-blue); border: 1px solid rgba(10, 132, 255, 0.3); }

/* ==========================================================================
   Simulationsblock (Bexio-Attrappe)
   ==========================================================================
   Muss sich sichtbar vom Rest abheben. Ein Platzhalter, der aussieht wie eine
   echte Funktion, ist gefaehrlicher als gar keiner - jemand glaubt sonst, seine
   Buchhaltung sei nachgefuehrt. Deshalb gestrichelter Rahmen, gedaempfte
   Farben und ein Warnton statt der ueblichen Akzentfarbe. */
.sim-block {
    margin-top: 20px;
    padding: 14px;
    border: 1px dashed rgba(255, 214, 10, 0.45);
    border-radius: var(--border-radius);
    background: rgba(255, 214, 10, 0.04);
}

.sim-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.sim-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 214, 10, 0.15);
    color: #ffd60a;
    border: 1px solid rgba(255, 214, 10, 0.35);
}

.sim-note {
    font-size: 11px;
    color: var(--text-muted);
}

/* Terminal-Optik wie beim CRM-Abgleich - signalisiert "technische Ausgabe",
   nicht "Beleg". */
.sim-terminal {
    margin-top: 12px;
    padding: 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.35);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    line-height: 1.7;
    color: #8fbf8f;
    max-height: 180px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.sim-terminal .sim-line-warn { color: #ffd60a; }

/* ==========================================================================
   Zahlungs-QR
   ==========================================================================
   Der Code braucht eine helle Ruhezone. Auf dem dunklen Grund der Anwendung
   liest ihn manche Handykamera gar nicht - deshalb sitzt er bewusst auf einer
   weissen Kachel und sieht dadurch "wie aufgeklebt" aus. Das ist richtig so:
   es ist ein Stueck Papier auf dem Bildschirm. */
.qr-block {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--card-inner);
    text-align: center;
}

.qr-title {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.qr-tile {
    display: inline-block;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    line-height: 0;
}

.qr-tile img {
    width: 180px;
    height: 180px;
    display: block;
}

.qr-hint {
    margin-top: 8px;
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--text-muted);
    word-break: break-all;
}

.qr-missing {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--card-inner);
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

.qr-missing a {
    display: inline-block;
    margin-top: 8px;
    padding: 10px 16px;      /* fingerbreit - draussen, am Handy, mit Handschuh */
    background: var(--card-inner);
    border-radius: 8px;
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 13px;
}

/* Vollbild zum Scannen */
.qr-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
}

.qr-overlay[hidden] { display: none; }

.qr-overlay img {
    width: min(80vw, 80vh);
    height: min(80vw, 80vh);
}

.qr-overlay-caption {
    color: #000;
    font-size: 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    text-align: center;
}

/* Hinweis auf fehlende Bankangaben. Angebot, keine Fehlermeldung - deshalb
   ruhige Farben und kein Warnton. Wer seit zwanzig Jahren bar kassiert, soll
   nicht den Eindruck bekommen, etwas falsch gemacht zu haben. */
.setup-notice {
    background: var(--card-bg);
    border: 1px solid var(--card-inner);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 16px;
}

.setup-question { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.setup-body { font-size: 13px; color: var(--text-muted); }

.setup-missing {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.5;
}

.setup-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

/* Fingerbreit: wird draussen am Handy bedient, manchmal mit Handschuh. */
.setup-button {
    display: inline-block;
    padding: 12px 18px;
    background: var(--accent-blue);
    color: #fff;
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.setup-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-family);
    font-size: 13px;
    cursor: pointer;
    padding: 8px 4px;
}

.setup-cash {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

/* "Weiter mit RE-..." - der Weg zurueck zu einer offenen Rechnung. */
.resume-bar { margin-bottom: 16px; }

.resume-bar button {
    width: 100%;
    padding: 14px;
    background: var(--card-inner);
    border: 1px solid var(--accent-green);
    border-radius: var(--border-radius);
    color: var(--accent-green);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* In der Rechnungsliste ist die Kachel nur Anzeige - ohne Vollbild waere ein
   Zeigefinger-Cursor ein Versprechen, das der Klick nicht einloest. */
.qr-tile.qr-static { cursor: default; }

/* ==========================================================================
   Sprachnotizen (01.09.): Karte auf dem Auftrags-Tab und Ausklapp-Bereich
   auf der Kundenseite teilen sich diese Klassen.
   ========================================================================== */
.note-item {
    background: var(--card-inner, rgba(255,255,255,0.05));
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
}
.note-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.note-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 6px;
}
.note-delete:hover { color: #ff453a; }
.note-text { min-height: 60px; width: 100%; }
.note-audio { width: 100%; height: 32px; margin-top: 6px; }
.note-hint { font-size: 12px; color: var(--text-muted); font-style: italic; }
.note-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.note-state { font-size: 12px; color: var(--text-muted); }

/* Zeilenrabatt (Design §11, 18.09.): das %-Feld existiert in jeder Zeile,
   ist aber nur sichtbar, wenn der Betrieb den Schalter hat (body.line-discount,
   gesetzt aus profile.line_discount_enabled). Ohne Schalter ändert sich
   für niemanden etwas. */
.item-disc, .items-head .ih-disc { display: none; }
body.line-discount .item-disc {
    display: inline-block;
    width: 46px !important;
    flex: 0 0 auto;
    text-align: right;
    color: var(--text-muted);
}
body.line-discount .items-head .ih-disc {
    display: inline-block;
    width: 46px;
    text-align: right;
}
.item-row.optional-row .item-disc { opacity: 0.55; font-style: italic; }

/* Standardtexte auf der Offerte: eine Haken-Liste, je Zeile Titel + erste
   Zeile des Textes als Hinweis. */
.text-block-list { display: flex; flex-direction: column; gap: 6px; }
.text-block-list label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}
.text-block-list input[type="checkbox"] {
    width: auto !important;
    margin-top: 3px;
    accent-color: var(--accent-blue);
}
.text-block-list .tb-preview {
    color: var(--text-muted);
    font-size: 11px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 520px;
}
