/* Cockpit Bois et Feu */
:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #1f1a15;
  --muted: #6d6358;
  --line: #e2d9cd;
  --bar: #38311e;            /* Bois & Feu – marron foncé (Charte 2024) */
  --bar-ink: #ffffff;
  --accent: #38311e;
  --accent-ink: #ffffff;
  --ochre: #d2911c;          /* Akzent aus der Charte (Papeterie, Textil) */
  --ok: #2f7d4f;
  --warn: #b7791f;
  --bad: #b3261e;
  --chip: #efe6da;
  --radius: 14px;
  --tap: 52px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17130f;
    --card: #221c17;
    --ink: #f1e9df;
    --muted: #b3a798;
    --line: #3a3029;
    --bar: #0f0c09;
    --bar-ink: #f1e9df;
    --accent: #d2911c;
    --accent-ink: #1b160d;
    --chip: #2e261f;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }

/* Kopfleiste */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 6px;
  background: var(--bar); color: var(--bar-ink);
  padding: calc(env(safe-area-inset-top) + 6px) 8px 6px;
  min-height: 56px;
}
.bar button { background: none; border: 0; color: inherit; min-width: 44px; min-height: 44px; border-radius: 10px; }
.bar button:active { background: rgba(255,255,255,.12); }
.bar-back { font-size: 32px; line-height: 1; }
.bar-menu { font-size: 22px; }
.bar-logo { width: 40px; height: 40px; margin-left: 4px; flex: none; }
.bar-title { flex: 1; font-weight: 650; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 6px; }
.sync { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 0 8px; opacity: .9; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #8a8178; flex: none; }
.dot.ok { background: #4cc27a; }
.dot.busy { background: #f2b84b; animation: pulse 1s infinite; }
.dot.bad { background: #ef5b4c; }
@keyframes pulse { 50% { opacity: .35; } }

main { max-width: 680px; margin: 0 auto; padding: 12px 12px 40px; }

/* Suche */
.search {
  position: sticky; top: 62px; z-index: 5;
  background: var(--bg); padding: 4px 0 10px;
}
.search input {
  width: 100%; height: 56px; padding: 0 16px;
  border: 2px solid var(--line); border-radius: var(--radius);
  background: var(--card); font-size: 19px;
}
.search input:focus { outline: none; border-color: var(--ochre); }
.hint { color: var(--muted); font-size: 14px; margin: 4px 4px 10px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; min-height: 64px; text-align: left; width: 100%; cursor: pointer;
}
.item:active { transform: scale(.995); background: var(--chip); }
.item .main { flex: 1; min-width: 0; }
.item .name { font-weight: 650; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .side { text-align: right; font-size: 14px; color: var(--muted); flex: none; }
.item .side b { color: var(--ink); font-weight: 600; display: block; font-size: 15px; }

/* Kundenkarte */
.card-head { padding: 6px 4px 12px; }
.card-head h1 { font-size: 26px; line-height: 1.15; margin: 0 0 4px; }
.card-head .town { font-size: 18px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { background: var(--chip); border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.chip.warn { background: #f6e3bf; color: #6b4a0e; }
.chip.bad { background: #f5d2cf; color: #7a1a14; }
@media (prefers-color-scheme: dark) {
  .chip.warn { background: #4a3a17; color: #f3d9a4; }
  .chip.bad { background: #4d1f1b; color: #f4c2bd; }
}

.box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px;
}
.box h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.last { font-size: 22px; font-weight: 650; line-height: 1.25; }
.last small { display: block; font-size: 15px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.estimate { font-size: 13px; color: var(--ochre); font-weight: 600; }

.phones { display: flex; flex-direction: column; gap: 8px; }
.phone {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: var(--tap); padding: 0 14px; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; font-size: 20px; font-weight: 650;
}
.phone.other { background: var(--chip); color: var(--ink); }
.phone small { font-size: 13px; font-weight: 500; opacity: .85; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; white-space: pre-wrap; }

.hist { display: flex; flex-direction: column; }
.hist .row { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 15px; }
.hist .row:first-child { border-top: 0; }
.hist .date { color: var(--muted); width: 88px; flex: none; }
.hist .what { flex: 1; }
.hist .what small { display: block; color: var(--muted); font-size: 13px; }
.hist .amt { font-weight: 600; flex: none; }

textarea { width: 100%; min-height: 90px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px; border-radius: 12px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-weight: 650; font-size: 17px; cursor: pointer;
}
.btn.ghost { background: var(--chip); color: var(--ink); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 15px; }
.btn.wide { width: 100%; }
.row-btns .btn.wide + .btn.wide { margin-top: 0; }
.btn:disabled { opacity: .5; }
.row-btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* Formulare (Kopplung) */
.form { display: flex; flex-direction: column; gap: 10px; }
.form label { font-size: 14px; color: var(--muted); }
.form input { height: 52px; padding: 0 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); font-size: 18px; }
.form input:focus { outline: none; border-color: var(--ochre); }
.err { color: var(--bad); font-size: 15px; min-height: 1.2em; }
.center { text-align: center; }
.qr { display: flex; justify-content: center; margin: 10px 0; }
.qr img, .qr canvas { width: 240px; height: 240px; image-rendering: pixelated; background: #fff; padding: 10px; border-radius: 12px; }
.code { font: 700 34px/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; text-align: center; margin: 6px 0; }
.muted { color: var(--muted); }
.lead { font-size: 18px; }

/* Menü */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet .panel { background: var(--card); width: 100%; max-width: 680px; border-radius: 18px 18px 0 0; padding: 10px 12px calc(16px + env(safe-area-inset-bottom)); }
.sheet .panel button { display: block; width: 100%; text-align: left; background: none; border: 0; min-height: var(--tap); padding: 0 12px; border-radius: 10px; font-size: 18px; }
.sheet .panel button:active { background: var(--chip); }
.sheet .info { padding: 8px 12px 12px; color: var(--muted); font-size: 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 15px; max-width: 90vw; }
.toast[hidden] { display: none; }

/* Anruf auf dem Geschäftshandy */
.ring { position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 9; background: var(--ochre); color: #1f1a15;
  padding: 10px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.ring[hidden] { display: none; }
.ring .who { flex: 1 1 200px; min-width: 0; }
.ring .who b { display: block; font-size: 17px; }
.ring .who span { font-size: 14px; }
.ring button { min-height: 44px; border: 0; border-radius: 10px; padding: 0 14px; font-size: 15px; font-weight: 600;
  background: #1f1a15; color: #fff; }
.ring button.x { background: transparent; color: #1f1a15; font-size: 22px; padding: 0 8px; }
.ring.live { background: #e7c27a; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

.check { border-color: #e7cf9f; background: #fdf7ea; }
.check ul { margin: 0; padding-left: 18px; font-size: 15px; }
.check li { margin: 2px 0; }
@media (prefers-color-scheme: dark) { .check { border-color: #5a4720; background: #2a2214; } }

/* Preisliste */
.prices { width: 100%; border-collapse: collapse; font-size: 16px; }
.prices th, .prices td { padding: 9px 4px; border-top: 1px solid var(--line); text-align: right; }
.prices thead td { border-top: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.prices th { text-align: left; font-weight: 650; }
.prices th small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.prices td { font-variant-numeric: tabular-nums; font-weight: 600; }
.small { font-size: 13px; margin-top: 8px; }
.kv-row { display: flex; justify-content: space-between; padding: 6px 0; }

/* Aufträge */
.actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.btn.big { min-height: 64px; flex-direction: column; gap: 0; font-size: 18px; line-height: 1.2; padding: 8px 16px; }
.btn.big small { font-weight: 500; font-size: 14px; opacity: .85; }
.btn.danger { color: var(--bad); }
.card-head.compact h1 { font-size: 22px; }
.warn-t { color: var(--warn); }
.seg { display: flex; gap: 6px; }
.seg.wrap { flex-wrap: wrap; }
.seg button {
  flex: 1 1 auto; min-height: 44px; padding: 0 12px; border-radius: 10px;
  border: 2px solid var(--line); background: var(--card); font-size: 15px; font-weight: 600; cursor: pointer;
  position: relative;
}
.seg.lens button { flex: 1 1 0; min-height: 52px; font-size: 18px; padding: 0 4px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.seg button i { position: absolute; left: 0; right: 0; bottom: 1px; font-style: normal; font-size: 10px; font-weight: 500; opacity: .75; }
.oline { display: flex; flex-direction: column; gap: 10px; }
.oline .lhead { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.oline .x { background: none; border: 0; font-size: 18px; min-width: 40px; min-height: 36px; color: var(--muted); cursor: pointer; }
.oline .lsum { font-size: 18px; font-weight: 650; }
.qty { display: flex; align-items: center; gap: 10px; }
.qty button {
  width: 60px; height: 56px; flex: none; border-radius: 12px; border: 0;
  background: var(--chip); font-size: 30px; font-weight: 600; line-height: 1; cursor: pointer;
}
.qty button:active { background: var(--line); }
.qty .qv { flex: 1; text-align: center; font-size: 20px; font-weight: 650; }
.lprice { color: var(--muted); font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }
.lprice b { color: var(--ink); }
.lprice small { display: block; font-size: 12px; }
.warns { display: flex; flex-wrap: wrap; gap: 6px; }
.warns span { border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.warns .w { background: #f6e3bf; color: #6b4a0e; }
.warns .i { background: var(--chip); color: var(--muted); }
@media (prefers-color-scheme: dark) { .warns .w { background: #4a3a17; color: #f3d9a4; } }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 6px; font-size: 18px; }
.total b { font-size: 24px; }
.two { display: flex; gap: 8px; }
.two label { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.two input { width: 100%; min-width: 0; }
.form textarea { min-height: 60px; }
.form details input { width: 100%; margin-top: 8px; }
.savebar { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 20px; }
.opill {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  background: var(--ochre); color: #1b160d; border: 0; border-radius: var(--radius);
  min-height: 52px; padding: 0 16px; font-size: 17px; font-weight: 650; margin-bottom: 10px; cursor: pointer;
}
.opill b { background: rgba(255,255,255,.55); border-radius: 999px; padding: 2px 10px; }
.addc { margin-top: 12px; }
.item.order .town { color: var(--muted); font-weight: 400; font-size: 15px; }
.item .sub.wish { color: var(--ochre); }
.item .small-name { font-size: 16px; white-space: normal; }
.hist .row.tap { cursor: pointer; }
.two { display: grid; grid-template-columns: 1fr 1fr; }
.two label { min-width: 0; }
.two input { padding: 0 8px; font-size: 16px; }
/* Rangement-Schalter und Zubehör */
.toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0 12px;
  border-radius: 10px; border: 2px solid var(--line); background: var(--card); font-size: 16px; font-weight: 600; cursor: pointer; text-align: left;
}
.toggle small { color: var(--muted); font-weight: 500; margin-left: auto; }
.toggle .box-c { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.toggle.on { border-color: var(--accent); }
.toggle.on .box-c { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.acc .accrow { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.acc .accrow:first-of-type { border-top: 0; }
.acc .an { flex: 1; font-weight: 650; }
.acc .an small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.qty.small button { width: 48px; height: 46px; font-size: 26px; }
.qty.small .qv { min-width: 36px; font-size: 19px; }
.small-gap { margin-top: 10px; }
.motto { font-style: italic; font-weight: 650; color: var(--ochre); text-align: center; padding: 4px 0 12px; font-size: 18px; }
.seg.cal button { min-height: 40px; font-size: 14px; font-weight: 500; }
.acc .extra { border-top: 1px solid var(--line); padding: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.acc .extra input { height: 46px; padding: 0 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--card); font-size: 16px; width: 100%; }
.acc .extra .x { flex: 0 0 auto; min-width: 44px; border: 0; background: none; color: var(--muted); }
.acc .xamt { display: flex; align-items: center; gap: 8px; }
.acc .xamt input { width: 140px; text-align: right; font-weight: 650; font-size: 18px; }
.acc #addextra { margin-top: 8px; }
.perf { background: #f3e3c3; color: #38311e; font-weight: 700; text-align: center; border-radius: 10px; padding: 10px; margin-bottom: 12px; font-size: 16px; }
/* Planung */
.form select { height: 52px; padding: 0 10px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); font-size: 17px; width: 100%; }
.plan #unplan { align-self: flex-start; }
.err-t { color: var(--bad); font-weight: 600; }
.calok { color: var(--ok); font-weight: 600; font-size: 13px; }
.hint.day { font-weight: 650; color: var(--ink); margin-top: 14px; }
.item .slot { flex: none; width: 54px; font-weight: 700; font-size: 17px; text-align: center; }
.item .slot small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.bar-home { display: inline-flex; align-items: center; justify-content: center; }
/* Rappels */
.item.cb { flex-direction: column; align-items: stretch; cursor: default; }
.item.cb .cbact { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.item.cb .cbact .btn { min-height: 40px; padding: 0 12px; font-size: 14px; text-decoration: none; }
.opill.cbpill { background: var(--accent); color: var(--accent-ink); }
.opill.cbpill b { background: rgba(255,255,255,.25); }
/* Historique: Kontakte */
.hist .row.contact .what { color: var(--ink); }
.hist .row .ic { display: inline-block; width: 18px; color: var(--muted); }
/* Paiement */
.pay .kv-row.due { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; font-size: 17px; }
.pay .kv-row.due.open b { color: var(--bad); }
.pay .kv-row.due.ok b { color: var(--ok); }
.pay details summary { cursor: pointer; padding: 6px 0; }
.pay details[open] { display: flex; flex-direction: column; gap: 10px; }
.sheet .panel.form { display: flex; flex-direction: column; gap: 10px; }
.sheet .panel.form input, .sheet .panel.form textarea { height: auto; min-height: 48px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 17px; width: 100%; }
.sheet .panel.form .seg button { display: inline-flex; width: auto; justify-content: center; border: 2px solid var(--line); }
.sheet .panel.form .seg button.on { background: var(--accent); color: var(--accent-ink); }
.sheet .panel.form .btn { display: inline-flex; justify-content: center; text-align: center; background: var(--accent); color: var(--accent-ink); }
