:root {
  --bg: #0c0c0e;
  --card: #17171b;
  --card2: #202026;
  --line: #2c2c33;
  --txt: #f3efe9;
  --mut: #9a948c;
  --cobre: #d08b5b;
  --ouro: #e9b77d;
  --grad: linear-gradient(135deg, #f0c48e 0%, #d08b5b 55%, #a8613a 100%);
  --ok: #5cc98a;
  --warn: #e8b04a;
  --bad: #ef6b6b;
  --r: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--txt); }
body {
  font: 15px/1.4 Montserrat, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: .2px; }
h2 { font-size: 13px; margin: 22px 0 8px; color: var(--mut); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.mut { color: var(--mut); }
.small { font-size: 12.5px; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.gold { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.right { text-align: right; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#app { max-width: 640px; margin: 0 auto; padding: 0 16px calc(96px + var(--safe-b)); }
.splash { height: 100dvh; display: grid; place-items: center; }
.splash img { width: 96px; border-radius: 50%; opacity: .8; }

/* topo */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; align-items: center; gap: 10px; padding: calc(14px + env(safe-area-inset-top, 0px)) 0 12px;
}
.top .back { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--card); }
.top .back svg { width: 20px; height: 20px; }
.top .logo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat .lbl { font-size: 12px; color: var(--mut); }
.stat .val { font-size: 20px; font-weight: 700; margin-top: 4px; }
.stat.big { grid-column: span 2; }
.stat.big .val { font-size: 26px; }

.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .t { font-weight: 600; }
.item .s { font-size: 12.5px; color: var(--mut); }
.item .v { font-weight: 700; text-align: right; white-space: nowrap; }
a.item:active, button.item:active { background: var(--card2); }
.thumb { width: 46px; height: 46px; border-radius: 10px; background: var(--card2); object-fit: cover; flex: none;
  display: grid; place-items: center; color: var(--mut); font-weight: 700; font-size: 16px; }
.empty { padding: 28px 14px; text-align: center; color: var(--mut); }

.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--card2); color: var(--mut); font-weight: 600; }
.badge.bad { background: #ef6b6b22; color: var(--bad); }
.badge.warn { background: #e8b04a22; color: var(--warn); }
.badge.ok { background: #5cc98a22; color: var(--ok); }
.badge.gold { background: #d08b5b26; color: var(--ouro); -webkit-text-fill-color: var(--ouro); }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--txt); padding: 8px 14px;
  border-radius: 30px; font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.chip.on { background: var(--grad); color: #1b120b; border-color: transparent; font-weight: 700; }

/* forms */
label.f { display: block; margin-top: 12px; }
label.f > span { display: block; font-size: 12.5px; color: var(--mut); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--txt); background: var(--card2);
  border: 1px solid var(--line); border-radius: 11px; padding: 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--cobre); }
input[type=date] { min-height: 46px; }
textarea { min-height: 70px; resize: vertical; }
.search { position: relative; }
.search input { padding-left: 40px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--mut); }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 12px;
  padding: 14px; font: inherit; font-weight: 700; font-size: 15.5px; cursor: pointer; background: var(--card2); color: var(--txt); }
.btn.pri { background: var(--grad); color: #1b120b; }
.btn.danger { background: #ef6b6b1f; color: var(--bad); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { width: auto; padding: 9px 14px; font-size: 13.5px; border-radius: 10px; }
.btn:disabled { opacity: .5; }
.btns { display: flex; gap: 10px; margin-top: 16px; }
.btns .btn { flex: 1; }

svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.fab { position: fixed; right: max(16px, calc(50% - 304px)); bottom: calc(86px + var(--safe-b)); width: 56px; height: 56px; border-radius: 50%;
  background: var(--grad); color: #1b120b; display: grid; place-items: center; box-shadow: 0 6px 20px #0008; z-index: 6; border: 0; }
.fab svg { width: 26px; height: 26px; stroke-width: 2.4; }

/* qty stepper */
.qty { display: flex; align-items: center; background: var(--card2); border-radius: 10px; }
.qty button { width: 34px; height: 34px; border: 0; background: none; color: var(--txt); font-size: 20px; cursor: pointer; }
.qty span { min-width: 22px; text-align: center; font-weight: 700; }

/* tabs */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around;
  background: #0c0c0ef2; backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); }
#tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--mut); padding: 4px 0; font-weight: 500; }
#tabs a svg { width: 23px; height: 23px; }
#tabs a.on { color: var(--ouro); }
#tabs .tab-main span { width: 48px; height: 48px; margin-top: -20px; border-radius: 50%; background: var(--grad); color: #1b120b;
  display: grid; place-items: center; box-shadow: 0 4px 16px #d08b5b55; }
#tabs .tab-main span svg { width: 26px; height: 26px; stroke-width: 2.6; }

/* sheet (modal de baixo) */
#sheet-wrap { position: fixed; inset: 0; z-index: 20; background: #000a; display: flex; align-items: flex-end; justify-content: center; }
#sheet { width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto; background: var(--card); border-radius: 20px 20px 0 0;
  padding: 10px 16px calc(20px + var(--safe-b)); border-top: 1px solid var(--line); animation: up .18s ease-out; }
#sheet::before { content: ''; display: block; width: 40px; height: 4px; background: var(--line); border-radius: 4px; margin: 0 auto 12px; }
#sheet h3 { margin: 0 0 6px; font-size: 18px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + var(--safe-b)); z-index: 30;
  background: #2a2a30; border: 1px solid var(--line); padding: 11px 18px; border-radius: 30px; font-weight: 600; font-size: 14px;
  max-width: calc(100% - 32px); box-shadow: 0 6px 24px #0009; }
#toast.err { background: #3a1d1f; border-color: #ef6b6b66; }

/* login */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding-bottom: 40px; }
.login img { width: 190px; height: 190px; border-radius: 50%; object-fit: cover; margin: 0 auto 18px; display: block; box-shadow: 0 10px 40px #d08b5b2a; }

/* venda */
.cart-line { padding: 10px 14px; border-top: 1px solid var(--line); }
.cart-line:first-child { border-top: 0; }
.cart-line input { padding: 8px 10px; font-size: 15px; width: 110px; }
.total-bar { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 2px 4px; }
.total-bar .val { font-size: 26px; font-weight: 700; }
.parc-row { display: grid; grid-template-columns: 34px 1fr 110px; gap: 8px; align-items: center; margin-top: 8px; }
.parc-row input { padding: 9px 10px; font-size: 15px; }
.parc-row b { color: var(--mut); font-size: 13px; text-align: center; }
.results { max-height: 300px; overflow-y: auto; margin-top: 8px; }

.foto-pick { display: flex; gap: 14px; align-items: center; margin-top: 6px; }
.foto-pick .thumb { width: 84px; height: 84px; border-radius: 14px; }
.sep { height: 1px; background: var(--line); margin: 14px 0; }
.kv { display: flex; justify-content: space-between; padding: 4px 0; }
