@import url('https://fonts.googleapis.com/css2?family=Rye&family=Oswald:wght@500;600&display=swap');

:root {
  --ink: #120e0b;
  --ink-2: #1e1813;
  --leather: #a0673a;
  --leather-dk: #7d4d28;
  --cream: #efe6d6;
  --paper: #faf6ee;
  --line: #ddd0ba;
  --muted: #7a6a57;
  --green: #2f7a3a;
  --red: #b23a2a;
  --gold: #c99a3d;
  --radius: 12px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
html { background: var(--cream); }
body { min-height: 100vh; }
html:has(body.client), html:has(body.login) { background: var(--ink); }
body {
  font: 18px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--cream); color: var(--ink);
}
h1, h2, h3 { font-family: 'Rye', Georgia, serif; font-weight: 400; margin: 0 0 .4em; letter-spacing: .5px; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 19px; }
a { color: var(--leather-dk); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.r { text-align: right; }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  font: 600 17px/1 'Oswald', Arial, sans-serif; letter-spacing: 1px; text-transform: uppercase;
  border: 2px solid var(--ink); background: #fff; color: var(--ink);
  padding: 14px 18px; border-radius: var(--radius); cursor: pointer; min-height: 52px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; }
.btn-primary { background: var(--leather); border-color: var(--leather); color: #fff; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn-xl { width: 100%; min-height: 66px; font-size: 21px; }
.btn-small { min-height: 38px; padding: 8px 12px; font-size: 14px; }
.btn-block { width: 100%; }

/* ---------- Inputs ---------- */
.big-label { display: block; font: 600 15px 'Oswald', Arial, sans-serif; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.big-input, select.big-input, textarea.big-input {
  display: block; width: 100%; margin-top: 6px; font: 20px/1.3 -apple-system, Arial, sans-serif; color: var(--ink);
  border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff; min-height: 58px;
  text-transform: none; letter-spacing: 0;
}
.big-input:focus { outline: none; border-color: var(--leather); }
textarea.big-input { min-height: 90px; resize: vertical; }
select.big-input { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='12'%3E%3Cpath d='M1 1l8 9 8-9' stroke='%23120e0b' stroke-width='3' fill='none'/%3E%3C/svg%3E") no-repeat right 16px center; padding-right: 48px; }

/* ---------- Login ---------- */
body.login { background: var(--ink); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-logo { width: 240px; max-width: 70%; border-radius: 8px; margin-bottom: 24px; }
.login .big-label { color: var(--cream); text-align: left; }
.error { background: var(--red); color: #fff; padding: 10px; border-radius: 8px; }

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--ink); color: var(--cream);
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 3px solid var(--leather);
}
.topbar .back { background: none; border: 0; color: var(--cream); font: 600 18px 'Oswald', sans-serif; letter-spacing: 1px; min-height: 44px; padding: 0 8px 0 0; cursor: pointer; }
.topbar .title { font-family: 'Rye', serif; font-size: 20px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .hat { height: 34px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 18px 16px 120px; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 16px; }
.stack > * + * { margin-top: 12px; }

/* Home */
.home-logo { display: block; width: 180px; margin: 4px auto 18px; border-radius: 10px; }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  background: var(--paper); border: 2px solid var(--ink); border-radius: 16px; min-height: 120px; padding: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  font: 600 19px 'Oswald', sans-serif; letter-spacing: 1px; text-transform: uppercase; color: var(--ink); text-decoration: none;
}
.tile .ico { font-size: 34px; line-height: 1; }
.tile.big { grid-column: 1 / -1; background: var(--leather); border-color: var(--leather); color: #fff; min-height: 110px; font-size: 24px; }
.tile.dark { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.job { background: #fff; border: 2px solid var(--ink); border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; }
.job-head { display: flex; align-items: center; gap: 12px; }
.job-head .name { font-weight: 700; font-size: 20px; }
.job-head .sub { color: var(--muted); font-size: 15px; }
.job-head .main { flex: 1; min-width: 0; }
.job-head .amt { font: 600 22px 'Oswald', sans-serif; }
.job-num { width: 38px; height: 38px; border-radius: 50%; background: var(--leather); color: #fff; font: 600 18px 'Oswald', sans-serif; display: flex; align-items: center; justify-content: center; flex: none; }
.job-items { margin: 12px 0 0; padding: 12px 0 0; border-top: 1px dashed var(--line); list-style: none; font-size: 18px; }
.job-items li { padding: 3px 0; }
.job-note { background: #fff4dc; border-radius: 8px; padding: 8px 10px; margin-top: 8px; font-size: 16px; }
.job-btns { display: grid; grid-template-columns: 1fr 2.2fr; gap: 10px; margin-top: 14px; }
.job-btns .btn-xl { min-height: 60px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.stat { background: var(--ink); color: var(--cream); border-radius: 14px; padding: 14px; cursor: pointer; }
.stat b { display: block; font: 600 28px 'Oswald', sans-serif; color: #fff; }
.stat span { font-size: 14px; color: #c9b8a0; }

/* Lists */
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.seg button { font: 600 14px 'Oswald', sans-serif; letter-spacing: .5px; text-transform: uppercase; border: 2px solid var(--ink); background: #fff; border-radius: 10px; min-height: 46px; cursor: pointer; }
.seg button.on { background: var(--ink); color: var(--cream); }
.row {
  display: flex; align-items: center; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer; text-decoration: none; color: inherit;
}
.row .main { flex: 1; min-width: 0; }
.row .name { font-weight: 700; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { color: var(--muted); font-size: 15px; }
.row .amt { font: 600 21px 'Oswald', sans-serif; text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

.pill { display: inline-block; font: 600 12px 'Oswald', sans-serif; letter-spacing: 1px; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; margin-right: 4px; vertical-align: middle; }
.p-open { background: #e3d6bf; color: var(--ink); }
.p-ready { background: var(--gold); color: var(--ink); }
.p-picked_up { background: #d6d6d6; color: #444; }
.p-paid { background: var(--green); color: #fff; }
.p-unpaid { background: #fff; color: var(--red); border: 1.5px solid var(--red); }
.p-zelle { background: #6d1ed4; color: #fff; }

/* Invoice editor */
.line {
  background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px;
}
.line-top { display: flex; gap: 10px; align-items: flex-start; }
.line-desc { flex: 1; font-size: 18px; font-weight: 600; border: 0; padding: 6px 0; width: 100%; background: transparent; font-family: inherit; }
.line-desc:focus { outline: none; border-bottom: 2px solid var(--leather); }
.line-x { background: none; border: 0; font-size: 28px; color: var(--red); cursor: pointer; line-height: 1; min-width: 40px; min-height: 40px; }
.line-bottom { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.qty { display: flex; align-items: center; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; }
.qty button { width: 48px; height: 46px; border: 0; background: var(--ink); color: #fff; font-size: 24px; cursor: pointer; }
.qty input { width: 54px; height: 46px; border: 0; text-align: center; font-size: 20px; font-weight: 700; }
.price { display: flex; align-items: center; border: 2px solid var(--line); border-radius: 10px; padding: 0 10px; height: 50px; background: #fff; }
.price span { font-size: 20px; color: var(--muted); }
.price input { width: 80px; border: 0; font-size: 20px; font-weight: 700; padding: 0 4px; height: 44px; }
.price input:focus { outline: none; }
.price.need-price { border-color: var(--leather); background: #fff6ec; box-shadow: 0 0 0 3px rgba(160,103,58,.18); }
.price.need-price input { background: transparent; }
.line-total { margin-left: auto; font: 600 22px 'Oswald', sans-serif; }

.totalbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--ink); color: #fff;
  padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 3px solid var(--leather);
}
.totalbar .inner { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 14px; }
.totalbar .t { flex: 1; font: 600 15px 'Oswald', sans-serif; letter-spacing: 1px; color: #c9b8a0; text-transform: uppercase; }
.totalbar .t b { display: block; font-size: 30px; color: #fff; letter-spacing: 0; }
.totalbar .btn { min-width: 170px; }

.cust-pick { display: flex; align-items: center; gap: 12px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 14px 16px; }
.cust-pick .main { flex: 1; }
.results .row { background: #fff; }

/* Invoice view */
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.inv-total { font: 600 40px 'Oswald', sans-serif; line-height: 1; }
table.items { width: 100%; border-collapse: collapse; margin: 12px 0 0; font-size: 17px; }
table.items td { padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.items tr.sub td { color: var(--muted); }
table.items tr.total td { font: 600 22px 'Oswald', sans-serif; border-bottom: 0; padding-top: 12px; }
.actions { display: grid; gap: 12px; margin: 16px 0; }
.actions-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.banner { border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; font-weight: 600; }
.banner.zelle { background: #6d1ed4; color: #fff; }
.banner.ok { background: #e2f1e3; color: var(--green); border: 1px solid #b7dcba; }
.banner.warn { background: #fff4dc; color: #7a5200; border: 1px solid #f0d79a; }
.log { font-size: 14px; color: var(--muted); }
.log div { padding: 4px 0; border-bottom: 1px dashed var(--line); }

/* Modal sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--paper); width: 100%; max-width: 560px; border-radius: 20px 20px 0 0; padding: 22px 18px; padding-bottom: max(22px, env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto; }
@media (min-width: 600px) { .sheet-bg { align-items: center; } .sheet { border-radius: 20px; } }
.check { display: flex; align-items: center; gap: 14px; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; font-size: 18px; cursor: pointer; }
.check input { width: 26px; height: 26px; accent-color: var(--leather); }
.check .sub { display: block; font-size: 14px; color: var(--muted); }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.toast { position: fixed; left: 50%; top: 80px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; padding: 14px 20px; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,.3); max-width: 90vw; }

/* Settings */
.set-section { margin-bottom: 18px; }
.status-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--red); flex: none; }
.dot.on { background: var(--green); }
.qr-prev { max-width: 160px; border: 1px solid var(--line); border-radius: 8px; display: block; margin: 8px 0; }
.svc-cat { font: 600 14px 'Oswald', sans-serif; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }

/* ---------- Client invoice page ---------- */
body.client { background: var(--ink); min-height: 100vh; }
.client-head { text-align: center; padding: 18px 0 8px; }
.client-head img { width: 190px; border-radius: 8px; }
.client-main { max-width: 520px; margin: 0 auto; padding: 8px 14px 40px; }
.client .card { background: var(--paper); }
.eyebrow { font: 600 14px 'Oswald', sans-serif; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.inv-top { display: flex; justify-content: space-between; align-items: flex-start; }
.inv-top h1 { font-size: 34px; margin: 0; }
.status-pill { font: 600 13px 'Oswald', sans-serif; letter-spacing: 1px; text-transform: uppercase; padding: 6px 10px; border-radius: 8px; background: #e3d6bf; }
.status-pill.st-ready { background: var(--gold); }
.zelle-steps { padding-left: 22px; margin: 8px 0 16px; }
.zelle-steps li { margin-bottom: 14px; }
.copy-row { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px dashed var(--leather); border-radius: 10px; padding: 8px 10px; margin-top: 6px; }
.copy-val { flex: 1; font-weight: 700; font-size: 18px; word-break: break-all; }
.qr { text-align: center; margin-bottom: 16px; }
.qr img { width: 200px; max-width: 70%; border-radius: 10px; border: 1px solid var(--line); }
.note { background: #f3ead9; padding: 10px 12px; border-radius: 8px; }
.ok-msg { color: var(--green); font-weight: 700; text-align: center; }
.paid-card { text-align: center; }
.paid-stamp { display: inline-block; font: 600 34px 'Oswald', sans-serif; letter-spacing: 6px; color: var(--green); border: 4px solid var(--green); border-radius: 10px; padding: 4px 18px; transform: rotate(-4deg); margin: 6px 0 4px; }
.client-foot { color: #c9b8a0; text-align: center; font-size: 14px; }
.client-foot a { color: var(--cream); }
