:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1d2433;
  --muted: #5d6677;
  --line: #dfe3ea;
  --brand: #1f3a5f;
  --brand-2: #2c5282;
  --ok: #1e7b4a;
  --ok-bg: #e6f4ec;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --warn-bg: #fff6e0;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161d; --card: #1b212b; --text: #e8ecf2; --muted: #a2acbb; --line: #2c3543;
    --brand: #8fb4e8; --brand-2: #a9c6ef; --ok: #6fd39d; --ok-bg: #173126; --bad: #ff8a80; --bad-bg: #3a1d1b; --warn-bg: #3a3220;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand-2); }
h1 { font-size: 1.4rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
.muted { color: var(--muted); font-size: .92rem; }
.hidden { display: none !important; }

.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: 100%; }
.narrow { max-width: 420px; }
.brand { font-weight: 700; color: var(--brand); letter-spacing: .02em; margin-bottom: 14px; }

label { display: block; font-size: .9rem; font-weight: 600; margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit;
  background: var(--card); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.code-input { font-size: 1.6rem; letter-spacing: .4em; text-align: center; }
button {
  font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 11px 16px; cursor: pointer;
  background: var(--brand); color: #fff;
}
@media (prefers-color-scheme: dark) { button { color: #0e1420; } }
button.secondary { background: transparent; color: var(--brand-2); border: 1px solid var(--line); }
button.danger { background: var(--bad); color: #fff; }
button.small { padding: 6px 10px; font-size: .88rem; }
button:disabled { opacity: .55; cursor: default; }
.full { width: 100%; margin-top: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 0 auto; }
.grow { flex: 1 1 200px !important; }

.msg { border-radius: 8px; padding: 10px 12px; margin-top: 12px; font-size: .93rem; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.bad { background: var(--bad-bg); color: var(--bad); }
.msg.warn { background: var(--warn-bg); }

/* Área interna */
.top { background: var(--brand); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
@media (prefers-color-scheme: dark) { .top { background: #1b2a40; } }
.top .who { font-size: .9rem; opacity: .9; }
.top button { background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff; padding: 6px 10px; }
.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--card); overflow-x: auto; }
.tabs button { background: transparent; color: var(--muted); border-radius: 0; border-bottom: 3px solid transparent; padding: 12px 14px; }
.tabs button.active { color: var(--text); border-bottom-color: var(--brand-2); }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.section { margin-bottom: 16px; }

table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--bg); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.qr { display: block; margin: 12px auto; width: 220px; height: 220px; background: #fff; border-radius: 8px; }
.secret { font-family: ui-monospace, Consolas, monospace; word-break: break-all; background: var(--bg); padding: 8px; border-radius: 6px; }
.codes { columns: 2; font-family: ui-monospace, Consolas, monospace; background: var(--bg); padding: 12px; border-radius: 8px; }
.linkbox { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; word-break: break-all; background: var(--bg); padding: 10px; border-radius: 6px; }

/* Catálogo do cliente */
.small { font-size: .8rem; }
.search-bar input { font-size: 1.05rem; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.chip { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 99px; padding: 7px 14px; font-weight: 500; white-space: nowrap; }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
@media (prefers-color-scheme: dark) { .chip.active { color: #0e1420; } }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.product h3 { font-size: 1rem; margin: 4px 0 6px; }
.product .price { font-size: 1.15rem; font-weight: 700; color: var(--brand); margin-bottom: 8px; }
.variants { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.variants li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.variants li span:first-child { flex: 1; }
@media (max-width: 480px) { main { padding: 12px; } .card { padding: 14px; } }

/* Navegação do cliente */
.topnav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.topnav a { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 6px; opacity: .85; font-weight: 600; font-size: .93rem; }
.topnav a.active { background: rgba(255,255,255,.16); opacity: 1; }
a.button { display: inline-block; background: var(--brand); color: #fff; text-decoration: none; font-weight: 600; border-radius: 8px; padding: 11px 16px; }
@media (prefers-color-scheme: dark) { a.button { color: #0e1420; } }
.center-text { text-align: center; }
.center-row { justify-content: center; }
.big { font-size: 1.4rem; font-weight: 700; }
.total-line { font-size: 1.15rem; text-align: right; margin: 12px 0 4px; }

/* Quantidade */
.stepper { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.stepper button { width: 34px; padding: 6px 0; font-size: 1.05rem; }
input.qty { width: 64px; padding: 7px 4px; text-align: center; }
.variants li { align-items: center; }

/* Barra do carrinho (fixa embaixo) */
body.has-cartbar main { padding-bottom: 96px; }
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(0,0,0,.08); padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; z-index: 10; }
.cartbar #cartTotal { font-size: 1.15rem; font-weight: 700; color: var(--brand); }

/* Pedidos */
.orders { display: grid; gap: 10px; }
.order-row { text-align: left; color: var(--text); background: var(--card); font-weight: 400; width: 100%; }
.order-row .price { font-size: 1.1rem; font-weight: 700; color: var(--brand); margin-top: 4px; }
.badge.st-aguardando { background: var(--warn-bg); color: #8a5a00; }
.badge.st-aprovado { background: #e3edfb; color: #1f4f96; }
.badge.st-pronto { background: var(--ok-bg); color: var(--ok); }
.badge.st-retirado { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.badge.st-cancelado { background: var(--bad-bg); color: var(--bad); }
@media (prefers-color-scheme: dark) { .badge.st-aguardando { color: #f3c969; } .badge.st-aprovado { background: #1d2d45; color: #9cc2f5; } }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 3px solid var(--line); padding: 4px 0 12px 12px; }
.timeline li:last-child { border-left-color: var(--brand-2); }

/* Sininho da equipe */
.bell { position: relative; background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff; padding: 6px 10px; }
.bell .count { background: #e5484d; color: #fff; border-radius: 99px; padding: 0 7px; font-size: .8rem; margin-left: 4px; }
.tabs .count { background: #e5484d; color: #fff; border-radius: 99px; padding: 0 7px; font-size: .78rem; margin-left: 4px; }
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--brand); color: #fff; padding: 12px 16px; border-radius: 10px; z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
@media (max-width: 560px) { .top { flex-wrap: wrap; } th, td { padding: 8px 6px; } input.qty { width: 54px; } }

.row > select { width: auto; flex: 0 1 auto; }

.check { width: 18px; height: 18px; }
tr.removed td { color: var(--muted); text-decoration: line-through; }
tr.removed td input, tr.removed td button { text-decoration: none; }
.right { text-align: right; }

/* Sininho do cliente */
.bell-wrap { position: relative; }
.bell-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(360px, 90vw); max-height: 70vh; overflow-y: auto; background: var(--card);
  color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); z-index: 30; padding: 8px; }
.bell-title { font-weight: 700; padding: 6px 8px; }
.bell-item { display: block; color: var(--text); text-decoration: none; padding: 8px; border-radius: 8px; border-bottom: 1px solid var(--line); }
.bell-item:hover { background: var(--bg); }
.bell-item.unread { background: var(--warn-bg); }
.req { color: var(--muted); }
.topnav a.bell-item { color: var(--text); opacity: 1; font-weight: 400; font-size: .93rem; padding: 8px; border-radius: 8px; }

/* App instalável */
.install { border-color: var(--brand-2); }
.install-icon { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line); }
.install-steps { margin: 10px 0; padding-left: 22px; }
.install-steps li { margin: 6px 0; }
.ios-share { display: inline-block; border: 1.5px solid currentColor; border-radius: 3px; padding: 0 4px; font-size: .8rem; }
.app-logo { width: 96px; height: 96px; border-radius: 20px; margin-bottom: 8px; }
