:root {
  --bg: #f4f3ef; --surface: #ffffff; --surface-2: #ecebe6; --text: #1c1c1a; --muted: #6b6a65;
  --border: #dedcd5; --accent: #2f6f5e; --accent-text: #ffffff; --danger: #b3261e; --ok: #2f6f5e;
  --shadow: 0 8px 28px rgba(0,0,0,.14);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141514; --surface: #1f211f; --surface-2: #2a2c29; --text: #ecebe6; --muted: #a3a29c;
    --border: #353733; --accent: #63b8a0; --accent-text: #0c1915; --danger: #f2857c; --ok: #63b8a0;
    --shadow: 0 8px 28px rgba(0,0,0,.5);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }

/* header */
.bar { position: sticky; top: 0; z-index: 10; background: var(--surface);
  border-bottom: 1px solid var(--border); padding: 12px 0 10px; }
.bar .title { font-size: 20px; font-weight: 700; margin: 0; line-height: 1.2; word-break: break-word; }
.bar .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.bar .row { display: flex; align-items: center; gap: 10px; }
.bar .row > :first-child { flex: 1; min-width: 0; }
.search { margin-top: 10px; }

/* controls */
button, .btn { font: inherit; font-size: 15px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); padding: 10px 14px; border-radius: 10px; cursor: pointer; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.danger { color: var(--danger); }
.ghost { border-color: transparent; background: transparent; }
.small { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.block { width: 100%; }
input, textarea, select { font: inherit; font-size: 16px; width: 100%; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; min-height: 80px; }
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 13px; font-weight: normal; }

/* list */
main { padding-top: 12px; padding-bottom: calc(110px + var(--safe-b)); }
.totals { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.card { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px; margin-bottom: 10px; width: 100%; text-align: left; min-height: 0; }
.thumb { flex: none; width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 22px; }
.card .body { flex: 1; min-width: 0; }
.card .desc { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card .meta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .qta { flex: none; font-weight: 700; font-size: 17px; padding-left: 4px; }
.empty { text-align: center; color: var(--muted); padding: 56px 16px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* floating action button */
.fab { position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + var(--safe-b)); padding: 14px 26px; border-radius: 999px; font-size: 17px;
  box-shadow: var(--shadow); min-height: 54px; }

/* bottom sheet editor */
dialog.sheet { border: none; padding: 0; margin: auto auto 0; width: 100%; max-width: 640px; max-height: 94dvh;
  border-radius: 18px 18px 0 0; background: var(--surface); color: var(--text); overflow: hidden; }
dialog.sheet[open] { display: flex; flex-direction: column; animation: up .2s ease-out; }
dialog::backdrop { background: rgba(0,0,0,.5); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet .head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--border); }
.sheet .head h2 { font-size: 17px; margin: 0; }
.sheet .content { padding: 16px; overflow-y: auto; flex: 1; }
.sheet .foot { display: flex; gap: 8px; padding: 12px 16px calc(12px + var(--safe-b));
  border-top: 1px solid var(--border); background: var(--surface); }
.sheet .foot button { flex: 1; }
@media (min-width: 700px) {
  dialog.sheet { margin: auto; border-radius: 18px; }
}

/* photo picker */
.photo { border: 2px dashed var(--border); border-radius: 14px; padding: 14px; text-align: center; background: var(--bg); }
.photo img { display: block; width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; margin-bottom: 10px; }
.photo .btns { display: flex; gap: 8px; }
.photo .btns > * { flex: 1; }

/* quantity stepper */
.stepper { display: flex; gap: 8px; align-items: stretch; }
.stepper button { width: 54px; flex: none; font-size: 22px; padding: 0; }
.stepper input { text-align: center; font-size: 18px; font-weight: 700; }

/* toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--safe-b)); z-index: 100;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

dialog.viewer { border: none; padding: 0; background: transparent; max-width: 100vw; max-height: 100dvh; }
dialog.viewer img { max-width: 100vw; max-height: 100dvh; display: block; }

/* tabs (admin) */
.tabs { display: flex; gap: 6px; margin-top: 10px; }
.tabs button { flex: 1; min-height: 40px; background: var(--surface-2); border-color: transparent; }
.tabs button.active { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chip { white-space: nowrap; border-radius: 999px; padding: 6px 12px; background: var(--surface-2);
  border: 1px solid transparent; font-size: 14px; min-height: 34px; }
.chip.active { background: var(--accent); color: var(--accent-text); }
.room-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.room-card h3 { margin: 0; font-size: 17px; }
.room-card .stats { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.room-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.room-card .actions > * { flex: 1 1 auto; }
.section-title { font-size: 15px; margin: 18px 0 8px; display: flex; justify-content: space-between; }
.section-title span { color: var(--muted); font-weight: normal; font-size: 14px; }
.login { max-width: 360px; margin: 18vh auto 0; padding: 0 16px; }
