/* PAPA Garden POS — pine forest + ember (the grill) · big touch targets for phone and iPad */
:root {
  --bg: #eef2ee;
  --surface: #ffffff;
  --surface-2: #f5f8f5;
  --ink: #17201a;
  --muted: #5c6b60;
  --line: #d3ddd5;
  --pine: #1f3d2b;
  --pine-ink: #ffffff;
  --ember: #c9561f;
  --ember-soft: #fbe7dc;
  --good: #1f7a45;
  --warn: #a86400;
  --bad: #b3261e;
  --font: "Anuphan", "Leelawadee UI", "Thonburi", "Noto Sans Thai", system-ui, sans-serif;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1511; --surface: #16211a; --surface-2: #1c2a21; --ink: #e6eee8; --muted: #9db0a2; --line: #2b3b30;
    --pine: #3f7a55; --pine-ink: #ffffff; --ember: #f07a44; --ember-soft: #3a2418;
    --good: #5cc28a; --warn: #e2a53b; --bad: #ff8a80; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1511; --surface: #16211a; --surface-2: #1c2a21; --ink: #e6eee8; --muted: #9db0a2; --line: #2b3b30;
  --pine: #3f7a55; --pine-ink: #ffffff; --ember: #f07a44; --ember-soft: #3a2418;
  --good: #5cc28a; --warn: #e2a53b; --bad: #ff8a80; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-height: 48px;
}
input:focus-visible, button:focus-visible { outline: 3px solid var(--ember); outline-offset: 2px; }
label, .label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; letter-spacing: .02em; }
h1, h2, h3 { margin: 0 0 8px; text-wrap: balance; }
h2 { font-size: 20px; }
.num, .total { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.msg { min-height: 1.4em; margin: 10px 0 0; color: var(--bad); }
.msg.ok { color: var(--good); }

.screen { min-height: 100%; }
.center { display: grid; place-items: center; padding: 24px 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.narrow { width: 100%; max-width: 380px; }
.brand { font-weight: 700; font-size: 26px; color: var(--pine); letter-spacing: -.01em; }
.brand span { color: var(--ember); }
.brand.small { font-size: 18px; color: var(--pine-ink); white-space: nowrap; }
@media (max-width: 420px) { .brand.small { font-size: 15px; } .topbar { gap: 8px; } }

.btn { border: 0; border-radius: 10px; padding: 12px 18px; min-height: 48px; cursor: pointer; font-weight: 600; background: var(--surface-2); }
.btn.primary { background: var(--ember); color: #fff; }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.block { width: 100%; margin-top: 14px; }
.btn.big { min-height: 60px; font-size: 18px; }

/* PIN */
.pin-dots { display: flex; gap: 12px; justify-content: center; margin: 18px 0; min-height: 18px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.pin-dots i.on { background: var(--ember); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-pad button { min-height: 64px; font-size: 24px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); font-variant-numeric: tabular-nums; }
.pin-pad button.go { background: var(--pine); color: var(--pine-ink); font-size: 18px; }

/* top bar */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--pine); color: var(--pine-ink);
}
.topbar .me { margin-left: auto; font-size: 14px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar .btn.ghost { color: var(--pine-ink); border-color: rgba(255,255,255,.35); }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.16); white-space: nowrap; }
.chip.wait { background: var(--warn); color: #fff; }
.tabs { display: flex; gap: 4px; padding: 8px 16px 0; overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 10px 12px; white-space: nowrap; flex: 0 0 auto; border-radius: 10px 10px 0 0; font-weight: 600; color: var(--muted); min-height: 44px; cursor: pointer; }
.tab.active { background: var(--surface); color: var(--ink); }
.tabpane { padding: 0 16px 32px; }
.tabpane > .panel, #shiftBox, #ownerBox { margin-top: 0; }

.banner { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; background: var(--ember-soft); border: 1px solid var(--ember); border-radius: var(--r); padding: 14px; margin: 12px 0; }
.banner .row { display: flex; gap: 8px; }
.banner input { width: 160px; }

/* sell */
.sell-grid { display: grid; gap: 14px; margin-top: 12px; }
@media (min-width: 740px) { .sell-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } .cart { position: sticky; top: 112px; } }
.catalog, .cart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.chips button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 8px 14px; min-height: 40px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.chips button.on { background: var(--pine); color: var(--pine-ink); border-color: var(--pine); }
.guest { margin: 10px 0; }
.seg { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; }
.seg button { flex: 1 0 auto; border: 1px solid var(--line); background: var(--surface-2); padding: 8px 12px; border-radius: 10px; min-height: 42px; font-weight: 600; cursor: pointer; }
.seg button.on { border-color: var(--ember); background: var(--ember-soft); }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.item { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 12px; text-align: left; min-height: 76px; cursor: pointer; display: grid; gap: 6px; }
.item b { font-weight: 600; line-height: 1.25; }
.item .prices { display: flex; flex-wrap: wrap; gap: 6px; }
.item .p { font-variant-numeric: tabular-nums; color: var(--ember); font-weight: 700; }
.item .p.alt { border: 1px solid var(--ember); border-radius: 8px; padding: 0 6px; }
.cart-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.cart-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.cart-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.cart-list .name { font-weight: 600; overflow-wrap: anywhere; }
.cart-list .qty { display: flex; align-items: center; gap: 6px; }
.cart-list .qty button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); font-size: 18px; cursor: pointer; }
.cart-list .price { width: 110px; min-height: 40px; padding: 6px 10px; text-align: right; font-variant-numeric: tabular-nums; }
.cart-list .empty { color: var(--muted); border-style: dashed; display: block; text-align: center; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: 10px; font-weight: 700; }
.total { font-size: 28px; color: var(--pine); }
.methods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.method { border: 2px solid var(--line); background: var(--surface-2); border-radius: 12px; min-height: 52px; font-weight: 700; cursor: pointer; }
.method.on { border-color: var(--pine); background: var(--pine); color: var(--pine-ink); }

/* shift + owner */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin: 12px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.card .k { font-size: 13px; color: var(--muted); }
.card .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card.key { border-color: var(--pine); }
.diff-ok { color: var(--good); } .diff-bad { color: var(--bad); }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.list .row { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); align-items: center; }
.list .row:first-child { border-top: 0; }
.list .row.void { opacity: .5; text-decoration: line-through; }
.list .row .t { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.list .row .a { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.list .row .sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.tag { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); margin-left: 6px; }
.section { margin-top: 18px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; min-width: 560px; }
th, td { padding: 8px 10px; border-top: 1px solid var(--line); text-align: left; font-size: 14px; }
th { font-size: 12px; color: var(--muted); border-top: 0; }
td input { min-height: 38px; padding: 6px 8px; }
td input.n { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.form-row > * { flex: 1 1 140px; min-width: 0; }
.form-row .btn { flex: 0 0 auto; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 20; max-width: calc(100% - 32px); }
@media (prefers-reduced-motion: no-preference) { .toast { transition: opacity .2s; } }
select { font: inherit; color: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-height: 44px; }
td select { min-height: 38px; padding: 6px 8px; }
td input:not(.n):not([type="checkbox"]) { min-width: 150px; }
td select { min-width: 110px; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; }

/* stays · split payments · photos · day summary */
.chips button.mine { border-color: var(--ember); }
.chips button.add { border-style: dashed; color: var(--ember); }
.pay-rows { display: grid; gap: 8px; margin-bottom: 10px; }
.pay-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.pay-row .pm { font-weight: 700; min-width: 92px; }
.pay-row input { width: 120px; min-height: 40px; padding: 6px 10px; text-align: right; }
.pay-row .rest { font-variant-numeric: tabular-nums; color: var(--muted); }
.photo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.photo.busy { opacity: .5; pointer-events: none; }
.photo-btn { min-height: 40px; padding: 6px 12px; border: 1px dashed var(--ember); color: var(--ember); background: transparent; }
.thumb { width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface) center/cover no-repeat; cursor: pointer; font-weight: 700; color: var(--good); }
.photo-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.seg button.on { border-color: var(--ember); background: var(--ember-soft); }
.tag.warn { background: var(--ember-soft); border-color: var(--ember); color: var(--bad); }
.tag.ok { color: var(--good); }
.linkish { border: 0; background: none; padding: 2px 6px; color: var(--pine); text-decoration: underline; cursor: pointer; font-size: 13px; min-height: 32px; }
.linkish.strong { color: var(--ember); font-weight: 700; }
.stay-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--r); padding: 12px; margin-bottom: 10px; }
.stay-card.st-in { border-left-color: var(--pine); }
.stay-card.st-booked { border-left-color: var(--warn); }
.stay-card.st-out { opacity: .65; }
.stay-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.stay-head strong { font-size: 17px; }
.stay-head .a { font-weight: 700; font-size: 18px; text-align: right; }
.stay-head .sub, .stay-card .sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.stay-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.stay-detail:not(:empty) { margin-top: 10px; }
.day-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0; }
.checks h2 { margin-bottom: 6px; }
.checks ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.checks.has { border-color: var(--ember); background: var(--ember-soft); }
.checks.clean h2 { color: var(--good); }
.viewer { border: 0; border-radius: 12px; padding: 10px; max-width: min(96vw, 900px); background: var(--surface); color: var(--ink); }
.viewer::backdrop { background: rgba(0, 0, 0, .7); }
.viewer img { display: block; max-width: 100%; max-height: 80vh; margin-top: 8px; }
#vatSeg, #paySeg { flex-wrap: wrap; overflow: visible; }
#vatSeg button, #paySeg button { flex: 1 1 auto; }
.item.new-item { border-style: dashed; align-content: start; cursor: default; }
.item.new-item input { min-height: 40px; padding: 6px 10px; }
.item.new-item .keep { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; }
.item.new-item .row-btns { display: flex; gap: 6px; }
tr.unreviewed td { background: var(--ember-soft); }
.photo.multi .thumb-wrap { position: relative; display: inline-block; }
.photo.multi .x { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; font-weight: 700; line-height: 1; cursor: pointer; }
.pin-dlg { width: min(92vw, 380px); }
.pin-dlg h2 { margin-top: 4px; }
.row-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.list .row .row-btns { margin-top: 0; justify-content: flex-end; }
@media (max-width: 420px) { #pinBtn { padding: 6px 8px; font-size: 13px; } }
.date-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.date-row label { margin: 0; white-space: nowrap; }
.date-row input { width: auto; flex: 1; min-height: 42px; }
.back-note { margin: 6px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--ember-soft); border: 1px solid var(--ember); font-size: 13px; }
.day-pick { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ink); font-size: 15px; }
.day-pick input { width: auto; min-height: 40px; padding: 4px 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 420px) { .day-pick strong { display: none; } }
#soundBtn { padding: 6px 10px; }
@media (max-width: 420px) { #soundBtn { padding: 6px 6px; } .topbar .me { display: none; } }
.topbar .btn { white-space: nowrap; flex: 0 0 auto; }
.topbar { overflow: hidden; }
@media (max-width: 420px) { #pinBtn .long { display: none; } .topbar { gap: 6px; padding: 10px 12px; } .chip { padding: 3px 8px; } }
