/* Jade Vines — styles. Brand colors arrive as CSS variables from the
   server config (one branding place); these are the fallbacks. */
:root {
  --primary: #1d5c46; --primary-dark: #123c2d; --accent: #c9a227;
  --cream: #faf6ee; --ink: #1c2420; --danger: #b3261e;
  --card: #ffffff; --line: #e3ddd0; --muted: #5c665f;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--cream); color: var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.boot { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* ── top bar + dropdown (Dropdown Rule: panel anchored under the bar,
   scrolls internally, page behind never grows) ── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .5rem;
  background: var(--primary); color: #fff;
  padding: calc(.5rem + env(safe-area-inset-top)) .75rem .5rem;
}
.wordmark { font-size: 1.3rem; font-weight: 700; letter-spacing: .02em; color: #fff; text-decoration: none; white-space: nowrap; }
.wordmark .vine { color: var(--accent); }
.topbar .spacer { flex: 1; }
.iconbtn {
  min-width: 44px; min-height: 44px; border: 0; border-radius: 10px;
  background: rgba(255,255,255,.12); color: #fff; font-size: 1.05rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem; padding: 0 .6rem;
}
.iconbtn .count { background: var(--accent); color: #231a00; border-radius: 999px; min-width: 1.3rem; height: 1.3rem; font-size: .8rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.menuwrap { position: relative; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + .4rem); width: min(84vw, 320px);
  max-height: min(70vh, 560px); overflow-y: auto;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0,0,0,.28); padding: .4rem; z-index: 60;
}
.dropdown a, .dropdown button.row {
  display: flex; width: 100%; align-items: center; gap: .6rem; text-align: left;
  padding: .8rem .7rem; border: 0; background: none; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-size: 1rem; min-height: 44px;
}
.dropdown a:hover, .dropdown button.row:hover { background: var(--cream); }
.dropdown .sep { border-top: 1px solid var(--line); margin: .35rem 0; }
.dropdown .who { padding: .5rem .7rem; color: var(--muted); font-size: .9rem; }
.dropdown .ver { padding: .4rem .7rem; color: var(--muted); font-size: .8rem; }

main { max-width: 1060px; margin: 0 auto; padding: 1rem .9rem 5.5rem; }
.tagline { color: var(--primary-dark); font-style: italic; text-align: center; margin: .2rem 0 1rem; }
h1 { font-size: 1.5rem; margin: .4rem 0 .8rem; }
h2 { font-size: 1.15rem; margin: 1.2rem 0 .5rem; }
a { color: var(--primary); }

/* ── catalog ── */
.controls { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .9rem; }
.controls input[type="search"], .controls select {
  min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 .7rem; background: #fff;
}
.controls input[type="search"] { flex: 1 1 180px; }
.checkline { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; }
.checkline input { width: 22px; height: 22px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.pcard img, .pimg { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #efe9db; display: block; }
.pimg { display: flex; align-items: center; justify-content: center; font-size: 2.4rem; }
.pcard .pbody { padding: .6rem .7rem .8rem; display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.pcard .pname { font-weight: 650; }
.pcard .psize, .pcard .pcat { color: var(--muted); font-size: .88rem; }
.pcard .pprice { font-weight: 700; margin-top: auto; }
.pcard .low { color: var(--danger); font-size: .85rem; font-weight: 600; }
.pcard .out { color: var(--muted); font-size: .85rem; }

/* ── buttons & forms ── */
.btn {
  min-height: 44px; border-radius: 10px; border: 1px solid var(--primary);
  background: var(--primary); color: #fff; padding: .55rem 1rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none;
}
.btn.secondary { background: #fff; color: var(--primary); }
.btn.gold { background: var(--accent); border-color: var(--accent); color: #231a00; }
.btn.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn.small { min-height: 38px; padding: .3rem .7rem; font-weight: 500; }
.btn:disabled { opacity: .5; }
.btnrow { display: flex; flex-wrap: wrap; gap: .5rem; margin: .7rem 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; margin-bottom: .9rem; }
label.f { display: block; margin: .65rem 0; font-weight: 550; }
label.f input, label.f select, label.f textarea {
  display: block; width: 100%; margin-top: .3rem; min-height: 44px;
  border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; background: #fff; font-weight: 400;
}
label.f textarea { min-height: 88px; }
.passwrap { position: relative; }
.passwrap input { padding-right: 5.2rem; }
.passwrap .toggle {
  position: absolute; right: .3rem; top: 50%; transform: translateY(-50%);
  min-height: 38px; border: 0; background: none; color: var(--primary); font-weight: 600; padding: 0 .6rem;
}
.notice { border: 1px solid var(--accent); background: #fdf6dd; border-radius: 12px; padding: .8rem .9rem; margin: .8rem 0; }
.error { border: 1px solid var(--danger); background: #fdecea; border-radius: 12px; padding: .8rem .9rem; margin: .8rem 0; }
.ok { border: 1px solid var(--primary); background: #e9f4ee; border-radius: 12px; padding: .8rem .9rem; margin: .8rem 0; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 2.2rem 1rem; }
table.list { width: 100%; border-collapse: collapse; }
table.list td, table.list th { padding: .55rem .4rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.pill { display: inline-block; border-radius: 999px; padding: .1rem .6rem; font-size: .82rem; font-weight: 650; background: #e9f4ee; color: var(--primary-dark); }
.pill.warn { background: #fdecea; color: var(--danger); }
.pill.gold { background: #fdf6dd; color: #6d5410; }

/* ── dashboard doors ── */
.doors { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.door { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; text-decoration: none; color: var(--ink); }
.door .n { font-size: 1.9rem; font-weight: 750; color: var(--primary); display: block; }
.door .l { color: var(--muted); }

/* ── sheets (cart / dialogs) — one layer at a time, Back closes ── */
.sheetwrap { position: fixed; inset: 0; background: rgba(10, 20, 15, .45); z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--cream); width: min(680px, 100%); max-height: 92vh; overflow-y: auto;
  border-radius: 18px 18px 0 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
}
@media (min-width: 720px) { .sheetwrap { align-items: center; } .sheet { border-radius: 18px; } }
.sheet h2 { margin-top: 0; }
.cartline { display: flex; gap: .6rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.cartline .grow { flex: 1; }
.qtybtn { min-width: 40px; min-height: 40px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 1.1rem; }

/* ── floating report button (fleet pattern: draggable, hideable) ── */
.reportbtn {
  position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 65;
  background: var(--primary-dark); color: #fff; border: 0; border-radius: 999px;
  min-height: 48px; padding: .6rem 1.1rem; font-weight: 650; box-shadow: 0 8px 24px rgba(0,0,0,.3);
  touch-action: none;
}
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(5.2rem + env(safe-area-inset-bottom));
  background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 12px; z-index: 90; max-width: 92vw; text-align: center;
}
footer.appfoot { text-align: center; color: var(--muted); font-size: .85rem; padding: 1rem .5rem 2rem; }
.detailimg { width: 100%; max-height: 380px; object-fit: cover; border-radius: 14px; background: #efe9db; }
