:root {
  --bg: #0c0b0a; --surface: #15130f; --card: #1c1915; --card-2: #24201a; --line: #2d2822; --line-2: #3a332b;
  --text: #f4ede2; --muted: #a79d8f; --gold: #d9a441; --gold-2: #f0c468; --red: #e5352f; --red-2: #ff6b61; --green: #3ddc84; --blue: #5cc4d0; --violet: #b094ff; --rose: #ff8aa0; --orange: #ff9a3d;
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181;
  --display: 'Alfa Slab One', 'Impact', serif; --body: 'Inter', system-ui, sans-serif; --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); line-height: 1.45; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .tiny { font-size: .78rem; } .mono { font-variant-numeric: tabular-nums; } .right { text-align: right; } .center { text-align: center; }
.pos { color: var(--green); } .neg { color: var(--red-2); } .gold { color: var(--gold-2); }
h1, h2, h3 { margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; font-size: .9rem; color: #111; background: #e9e2d6; cursor: pointer; white-space: nowrap; transition: filter .12s, transform .1s; }
.btn:hover { filter: brightness(1.07); } .btn:active { transform: scale(.98); }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1a1408; }
.btn-green { background: var(--green); color: #06250f; }
.btn-red { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line-2); }
.btn-ghost:hover { background: rgba(255,255,255,.05); }
.btn-sm { padding: 7px 12px; font-size: .82rem; } .btn-xs { padding: 5px 9px; font-size: .75rem; border-radius: 8px; } .btn-lg { padding: 13px 20px; font-size: 1rem; } .btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { background: transparent; border: 0; color: var(--text); width: 36px; height: 36px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: rgba(255,255,255,.07); }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(217,164,65,.18), transparent 60%); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 30px 26px; width: min(400px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.login-card img { margin: 0 auto; border-radius: 20px; }
.login-card h1 { font-family: var(--display); font-weight: 400; font-size: 1.6rem; }
.login-card p { margin: 0; }
.login-card label { text-align: left; font-size: .8rem; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.err { color: var(--red-2); font-size: .85rem; min-height: 1.2em; }

/* layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; color: var(--text); padding: 4px 8px; }
.side-brand img { border-radius: 10px; }
.side-brand span { display: flex; flex-direction: column; line-height: 1.05; }
.side-brand b { font-family: var(--display); font-weight: 400; font-size: 1.1rem; }
.side-brand small { color: var(--gold); font-size: .65rem; text-transform: uppercase; letter-spacing: .18em; font-weight: 700; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: .92rem; }
.side-nav a i { font-style: normal; width: 22px; text-align: center; }
.side-nav a:hover { background: rgba(255,255,255,.04); color: var(--text); }
.side-nav a.active { background: rgba(217,164,65,.14); color: var(--gold-2); }
.nbadge { margin-left: auto; background: var(--red); color: #fff; font-size: .7rem; font-weight: 800; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.side-foot { display: flex; flex-direction: column; gap: 6px; }
.content { padding: 22px 26px 40px; min-width: 0; }
.bottom-nav { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .content { padding: 14px 14px 90px; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: rgba(21,19,15,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 40; }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: .66rem; font-weight: 600; padding: 4px 0; position: relative; }
  .bottom-nav a i { font-style: normal; font-size: 1.25rem; }
  .bottom-nav a.active { color: var(--gold-2); }
  .bottom-nav .nbadge { position: absolute; top: 0; right: 18%; margin: 0; }
}

/* page */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-family: var(--display); font-weight: 400; font-size: 1.6rem; }
.page-head p { margin: 2px 0 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card h3 { font-size: .95rem; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h3 small { font-weight: 500; color: var(--muted); font-size: .78rem; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi .l { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.kpi .v { font-family: var(--display); font-weight: 400; font-size: clamp(1.05rem, 1.6vw, 1.45rem); overflow-wrap: anywhere; margin: 4px 0 2px; color: #fff; }
.kpi .d { font-size: .75rem; font-weight: 600; }
.kpi.hi { background: linear-gradient(135deg, #2a2114, var(--card)); border-color: rgba(217,164,65,.4); }
.kpi.hi .v { color: var(--gold-2); }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.quick .q { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.quick .q b { display: block; font-size: 1.1rem; }
.quick .q small { color: var(--muted); }
@media (max-width: 600px) { .quick { grid-template-columns: 1fr; } }

/* filtros de periodo */
.period { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.period .seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.period .seg button { background: transparent; border: 0; color: var(--muted); padding: 8px 12px; font-weight: 600; font-size: .82rem; cursor: pointer; }
.period .seg button.active { background: var(--gold); color: #1a1408; }
.period input[type=date] { background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 7px 10px; color-scheme: dark; font-size: .85rem; }

/* chart */
.chart { width: 100%; height: 220px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .bar { fill: var(--gold); rx: 3; transition: opacity .15s; }
.chart .bar:hover { opacity: .8; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .line { fill: none; stroke: var(--c2); stroke-width: 2; stroke-linejoin: round; }
.chart .dot { fill: var(--c2); stroke: var(--card); stroke-width: 2; }
.tip { position: absolute; pointer-events: none; background: #0f0d0a; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; font-size: .78rem; white-space: nowrap; transform: translate(-50%, -110%); z-index: 5; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.tip b { color: var(--gold-2); }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: center; font-size: .82rem; }
.hbar img { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; }
.hbar .meta { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.hbar .meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 8px; background: var(--surface); border-radius: 4px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--c1); border-radius: 4px; }
.hbar.c2 .track i { background: var(--c2); } .hbar.c3 .track i { background: var(--c3); } .hbar.c4 .track i { background: var(--c4); } .hbar.c5 .track i { background: var(--c5); }
.funnel { display: flex; flex-direction: column; gap: 6px; }
.funnel .step { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: .82rem; }
.funnel .step .bar { height: 26px; background: linear-gradient(90deg, var(--c2), rgba(92,196,208,.35)); border-radius: 6px; display: flex; align-items: center; padding: 0 10px; font-weight: 700; color: #08242a; min-width: 60px; }
.funnel .step .pct { color: var(--muted); font-size: .75rem; min-width: 56px; text-align: right; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* tabelas */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; background: var(--surface); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.025); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: #111; }
.prod-cell { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.prod-cell b { display: block; font-weight: 600; line-height: 1.25; }
.prod-cell small { color: var(--muted); }
.tag { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.tag.novo { background: rgba(92,196,208,.15); color: var(--blue); border-color: rgba(92,196,208,.4); }
.tag.em_atendimento { background: rgba(217,164,65,.15); color: var(--gold-2); border-color: rgba(217,164,65,.4); }
.tag.vendido, .tag.concluida, .tag.ok { background: rgba(61,220,132,.14); color: var(--green); border-color: rgba(61,220,132,.4); }
.tag.cancelado, .tag.cancelada, .tag.off { background: rgba(229,53,47,.14); color: var(--red-2); border-color: rgba(229,53,47,.4); }
.tag.low { background: rgba(255,154,61,.15); color: var(--orange); border-color: rgba(255,154,61,.4); }
.stock-pill { font-weight: 800; }
.stock-pill.zero { color: var(--red-2); } .stock-pill.low { color: var(--orange); }
.sizes-inline { display: flex; gap: 4px; flex-wrap: wrap; }
.sizes-inline span { font-size: .7rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; color: var(--muted); }
.sizes-inline span.zero { opacity: .4; text-decoration: line-through; }
.sizes-inline span.low { border-color: rgba(255,154,61,.5); color: var(--orange); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty .big { font-size: 2.6rem; }

/* forms */
.form { display: grid; gap: 12px; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.form label, .field { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.form input, .form select, .form textarea, .input { background: var(--surface); border: 1px solid var(--line-2); color: var(--text); border-radius: 10px; padding: 9px 11px; font-size: .9rem; outline: 0; width: 100%; color-scheme: dark; }
.form input:focus, .form select:focus, .form textarea:focus, .input:focus { border-color: var(--gold); }
.form textarea { min-height: 80px; resize: vertical; }
.form .check { flex-direction: row; align-items: center; gap: 8px; font-size: .9rem; color: var(--text); }
.form .check input { width: auto; }
.form h4 { margin: 8px 0 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); }
.hint { font-size: .74rem; color: var(--muted); font-weight: 400; }
.variants { display: flex; flex-direction: column; gap: 6px; }
.variant { display: grid; grid-template-columns: 1fr 1fr 1fr 90px 32px; gap: 6px; align-items: center; }
.variant input { padding: 7px 9px; font-size: .85rem; }
.imgs { display: flex; gap: 8px; flex-wrap: wrap; }
.imgs .im { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); cursor: grab; }
.imgs .im img { width: 100%; height: 100%; object-fit: cover; }
.imgs .im button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; font-size: .75rem; cursor: pointer; }
.imgs .im.main::after { content: 'capa'; position: absolute; bottom: 0; left: 0; right: 0; background: rgba(217,164,65,.9); color: #1a1408; font-size: .62rem; text-align: center; font-weight: 800; }
.imgs .add { width: 84px; height: 84px; border-radius: 10px; border: 1px dashed var(--line-2); background: transparent; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .7rem; gap: 2px; }
.imgs .add:hover { border-color: var(--gold); color: var(--gold); }
.preview-price { background: var(--surface); border: 1px dashed rgba(217,164,65,.5); border-radius: 10px; padding: 10px 12px; font-size: .85rem; }
.preview-price s { color: var(--muted); } .preview-price b { font-family: var(--display); font-weight: 400; font-size: 1.3rem; color: #fff; margin: 0 8px; }
.preview-price .off { background: var(--red); color: #fff; font-weight: 800; font-size: .72rem; padding: 2px 6px; border-radius: 6px; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.7); display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(3px); }
.modal-card { background: var(--surface); width: 100%; max-height: 94vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); position: relative; animation: up .25s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform: translateY(30px); opacity: 0 } }
@media (min-width: 760px) { .modal { align-items: center; padding: 20px; } .modal-card { max-width: 760px; border-radius: 20px; max-height: 90vh; } }
.modal-card.narrow { max-width: 480px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.modal-head h2 { font-size: 1.15rem; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.snack { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #f4ede2; color: #111; padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: .88rem; z-index: 90; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: up .25s; max-width: calc(100% - 30px); text-align: center; }
.snack.err { background: var(--red); color: #fff; }

/* pedidos */
.orders { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.order { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.order.novo { border-color: rgba(92,196,208,.5); box-shadow: 0 0 0 1px rgba(92,196,208,.15); }
.order .oh { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.order .oh b { font-family: var(--display); font-weight: 400; letter-spacing: .04em; }
.order ul { margin: 0; padding: 0; list-style: none; font-size: .85rem; display: flex; flex-direction: column; gap: 3px; }
.order li { display: flex; justify-content: space-between; gap: 8px; }
.order .ot { display: flex; justify-content: space-between; font-weight: 800; border-top: 1px dashed var(--line); padding-top: 6px; }
.order .oa { display: flex; gap: 6px; flex-wrap: wrap; }
.order .meta { font-size: .74rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }

/* clientes */
.cust-row td:first-child b { display: block; }
.wa-link { color: var(--green); font-weight: 600; }
.search-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search-row .input { max-width: 320px; }
.more-list { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.more-list a { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; color: var(--text); font-weight: 600; display: flex; align-items: center; gap: 10px; }
.sale-items { font-size: .78rem; color: var(--muted); }
.cart-build { display: flex; flex-direction: column; gap: 6px; }
.cart-build .ci { display: grid; grid-template-columns: 1fr 70px 100px 30px; gap: 6px; align-items: center; font-size: .85rem; }
.pick-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.pick-list button { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 8px; background: transparent; border: 0; border-bottom: 1px solid var(--line); color: var(--text); padding: 8px 10px; text-align: left; cursor: pointer; font-size: .85rem; }
.pick-list button:hover { background: rgba(255,255,255,.04); }
.pick-list button small { color: var(--muted); }
.alert { background: rgba(255,154,61,.12); border: 1px solid rgba(255,154,61,.4); color: #ffd3a8; padding: 10px 12px; border-radius: 10px; font-size: .85rem; }
.alert.info { background: rgba(92,196,208,.1); border-color: rgba(92,196,208,.35); color: #c9eef2; }
.login-card input { background: var(--surface); border: 1px solid var(--line-2); color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: .95rem; outline: 0; }
.login-card input:focus { border-color: var(--gold); }
td .sizes-inline { min-width: 210px; max-width: 320px; margin-top: 4px; }
