:root {
  --primary: #5b3df5;
  --primary-dark: #4329d1;
  --primary-soft: #eeeaff;
  --primary-alt: #8b5cf6;
  --accent: #ffc93c;
  --ink: #1d1b2e;
  --muted: #6b6880;
  --line: #e7e5f0;
  --bg: #f6f5fb;
  --card: #ffffff;
  --ok: #14a38b;
  --ok-soft: #e1f6f2;
  --warn: #c77700;
  --warn-soft: #fff3d6;
  --danger: #d93a4a;
  --danger-soft: #fde7e9;
  --info: #2563eb;
  --info-soft: #e3ecff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(29, 27, 46, 0.06), 0 4px 16px rgba(29, 27, 46, 0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; font-weight: 900; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.container { max-width: 1080px; margin: 0 auto; padding: 16px 16px 96px; }
.loading { padding: 48px 0; text-align: center; color: var(--muted); }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--primary); color: #fff; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15); }
.topbar { padding-top: env(safe-area-inset-top); }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); display: flex; align-items: center; gap: 12px; }
.brand { color: #fff; font-weight: 900; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.brand span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-logo { border-radius: 10px; width: 34px; height: 34px; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.install-btn { border: 0; background: rgba(255, 255, 255, 0.16); cursor: pointer; font: inherit; }
.install-btn[hidden] { display: none; }
.icon-btn { position: relative; color: #fff; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; font-size: 1.2rem; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.14); }
.badge { position: absolute; top: 2px; right: 0; background: var(--accent); color: var(--ink); font-size: 0.7rem; font-weight: 900; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.pill-link { color: var(--primary); background: #fff; padding: 7px 14px; border-radius: 999px; font-weight: 800; font-size: 0.875rem; white-space: nowrap; }

/* Hero */
.hero { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-alt) 100%); color: #fff; border-radius: 24px; padding: 24px; margin-bottom: 20px; position: relative; overflow: hidden; }
.hero h1 { font-size: 1.7rem; }
.hero p { opacity: 0.92; max-width: 520px; }
.search { display: flex; gap: 8px; margin-top: 12px; max-width: 520px; }
.search input { flex: 1; border: 0; border-radius: 12px; padding: 12px 14px; font: inherit; }

.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 24px 0 12px; }

/* Grids e cards */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-pad { padding: 16px; }
.store-card { display: block; color: inherit; transition: transform 0.15s; }
.store-card:hover { transform: translateY(-2px); }
.store-cover { aspect-ratio: 16 / 10; display: grid; place-items: center; font-size: 3rem; background-size: cover; background-position: center; position: relative; }
.store-cover .emoji-chip { position: absolute; left: 10px; bottom: -18px; width: 44px; height: 44px; border-radius: 14px; background: #fff; display: grid; place-items: center; font-size: 1.5rem; box-shadow: var(--shadow); }
.store-card .body { padding: 24px 12px 12px; }
.store-card h3 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.product-card { display: flex; flex-direction: column; }
.product-img { aspect-ratio: 1; background: var(--primary-soft); display: grid; place-items: center; font-size: 2.6rem; overflow: hidden; }
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product-card .name { font-weight: 800; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-weight: 900; color: var(--primary); font-size: 1.1rem; }
.product-card .btn { margin-top: auto; }
.store-tag { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Store header */
.store-head { border-radius: 24px; padding: 20px; color: #fff; margin-bottom: 16px; display: flex; gap: 16px; align-items: center; }
.store-head .big-emoji { width: 72px; height: 72px; border-radius: 20px; background: #fff; display: grid; place-items: center; font-size: 2.4rem; flex: none; }
.store-head h1 { margin: 0; }
.store-head p { margin: 4px 0 0; opacity: 0.92; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { background: rgba(255, 255, 255, 0.22); padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }

/* Buttons */
.btn { appearance: none; border: 0; border-radius: 12px; padding: 11px 16px; font: inherit; font-weight: 800; cursor: pointer; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 7px 12px; font-size: 0.875rem; border-radius: 10px; }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-ghost:hover { filter: brightness(0.96); }
.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-outline:hover { background: #fff; border-color: #cfcbe0; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #f9d3d7; }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #0f8a75; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Forms */
.form { display: grid; gap: 14px; }
.field label { display: block; font-weight: 800; font-size: 0.9rem; margin-bottom: 5px; }
.field .hint { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { min-height: 80px; resize: vertical; }
.two { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }

/* Tabs */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 2px; scrollbar-width: none; }
.tabs a { padding: 9px 14px; border-radius: 999px; background: #fff; color: var(--ink); font-weight: 800; white-space: nowrap; box-shadow: var(--shadow); font-size: 0.92rem; }
.tabs a.active { background: var(--ink); color: #fff; }

/* Stats */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat .label { font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.stat .value { font-size: 1.45rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat.hl { background: var(--ink); color: #fff; }
.stat.hl .label { color: #c9c6dc; }

/* Lists */
.list { display: grid; gap: 10px; }
.row { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; gap: 12px; align-items: center; }
.row .grow { flex: 1; min-width: 0; }
.thumb { width: 56px; height: 56px; border-radius: 12px; background: var(--primary-soft); display: grid; place-items: center; font-size: 1.5rem; overflow: hidden; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 800; white-space: nowrap; }
.st-aguardando { background: var(--warn-soft); color: var(--warn); }
.st-pago { background: var(--info-soft); color: var(--info); }
.st-entregue { background: var(--ok-soft); color: var(--ok); }
.st-cancelado { background: var(--danger-soft); color: var(--danger); }

.order-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.order-card + .order-card { margin-top: 12px; }
.order-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.items { margin: 10px 0; padding: 10px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); display: grid; gap: 4px; font-size: 0.95rem; }
.items div { display: flex; justify-content: space-between; gap: 12px; }
.total-line { display: flex; justify-content: space-between; font-weight: 900; font-size: 1.1rem; }
.alert { padding: 10px 12px; border-radius: 12px; font-size: 0.9rem; font-weight: 700; margin: 8px 0; }
.alert-warn { background: var(--warn-soft); color: #8a5300; }
.alert-info { background: var(--info-soft); color: #1d4ed8; }
.alert-ok { background: var(--ok-soft); color: #0b7a67; }

/* Pix */
.pix-box { display: grid; gap: 12px; justify-items: center; text-align: center; background: var(--primary-soft); border-radius: var(--radius); padding: 16px; margin-top: 10px; }
.pix-box img { width: 220px; height: 220px; background: #fff; border-radius: 12px; padding: 8px; }
.copy-field { display: flex; gap: 6px; width: 100%; }
.copy-field input { font-size: 0.8rem; font-family: ui-monospace, monospace; }

/* Qty stepper */
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.qty button { border: 0; background: transparent; width: 34px; height: 34px; font-size: 1.1rem; font-weight: 900; cursor: pointer; color: var(--primary); }
.qty span { min-width: 28px; text-align: center; font-weight: 800; }

.pay-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.pay-opt { flex: 1; min-width: 130px; border: 2px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; font-weight: 800; display: flex; align-items: center; gap: 8px; background: #fff; }
.pay-opt input { width: auto; accent-color: var(--primary); }
.pay-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .big { font-size: 3rem; }

.layout-2 { display: grid; gap: 16px; }
@media (min-width: 860px) { .layout-2 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; } .sticky { position: sticky; top: 76px; } }

/* Toast & modal */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(160px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; z-index: 100; transition: transform 0.25s; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
.modal { position: fixed; inset: 0; background: rgba(29, 27, 46, 0.5); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 20px; padding: 20px; width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.x { border: 0; background: var(--bg); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 1.1rem; }

.img-picker { display: flex; gap: 12px; align-items: center; }
.img-picker .thumb { width: 84px; height: 84px; }

.credential { background: var(--ink); color: #fff; border-radius: 14px; padding: 16px; font-size: 1.05rem; }
.credential b { color: var(--accent); font-size: 1.3rem; }

table.simple { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.simple th, table.simple td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
table.simple th { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
table.simple td.num, table.simple th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.rank { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 900; background: var(--bg); }
.rank-1 { background: #ffd54a; }
.rank-2 { background: #dfe3ea; }
.rank-3 { background: #f2c49b; }

.login-wrap { max-width: 420px; margin: 24px auto; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #fff; padding: 4px; border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 16px; }
.seg button { border: 0; background: transparent; padding: 10px; border-radius: 10px; font: inherit; font-weight: 800; cursor: pointer; color: var(--muted); }
.seg button.active { background: var(--primary); color: #fff; }

.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-bar button { border: 1.5px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 999px; font: inherit; font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.filter-bar button.active { border-color: var(--ink); background: var(--ink); color: #fff; }

@media (max-width: 420px) {
  .two { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.4rem; }
  .pill-link { padding: 6px 10px; }
}
.badge[hidden] { display: none; }

/* Logo da loja */
.logo-img { width: 100%; height: 100%; object-fit: contain; background: #fff; border-radius: inherit; display: block; }
.mini-logo { width: 1.3em; height: 1.3em; object-fit: contain; background: #fff; border-radius: 6px; display: inline-block; vertical-align: -0.25em; }
.emoji-chip, .store-head .big-emoji, .thumb { overflow: hidden; }
.logo-thumb { background: #fff; border: 1.5px dashed var(--line); }

/* PWA */
.install-card { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 16px; }
.install-card img { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.install-card .grow { flex: 1; min-width: 0; }
.ios-steps { display: grid; gap: 12px; margin: 8px 0 4px; padding: 0; list-style: none; counter-reset: s; }
.ios-steps li { display: flex; gap: 12px; align-items: center; font-weight: 700; }
.ios-steps li::before { counter-increment: s; content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; flex: none; font-weight: 900; }
.ios-key { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
@media (display-mode: standalone) { .hide-in-app { display: none !important; } }

/* ================= Responsividade (celulares pequenos e fonte aumentada) ================= */
/* Itens de grid/flex podem encolher: nomes longos não esticam a página para fora da tela */
.layout-2, .list { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .layout-2 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.layout-2 > *, .list > *, .stats > *, .grid > *, .two > *, .form > *, .pay-opts > *, .field { min-width: 0; }
.grow { min-width: 0; }
input, select, textarea { min-width: 0; max-width: 100%; }
img, svg { max-width: 100%; }
/* textos sem espaço (e-mail, chave Pix, nomes enormes) quebram em vez de vazar */
h1, h2, h3, p, .alert, .small, .hint, td, .items span:first-child, .order-head, .store-head p { overflow-wrap: anywhere; }
/* valores nunca quebram no meio ("R$ 9,0 / 0") */
.items div span:last-child, .total-line span:last-child, .price, .stat .value { white-space: nowrap; }
.items div span:last-child { flex: none; }

/* Linhas com botões: quando falta espaço, os botões descem para a linha de baixo */
.row { flex-wrap: wrap; }
.row .grow { flex: 1 1 100px; }
.row > .btn-row { margin-left: auto; }
.btn { max-width: 100%; }

/* Pix: QR Code e código copia-e-cola sempre dentro da tela */
.pix-box { grid-template-columns: minmax(0, 1fr); }
.pix-box > * { max-width: 100%; min-width: 0; }
.pix-box img { width: min(220px, 100%); height: auto; aspect-ratio: 1 / 1; }
.copy-field { width: 100%; }
.copy-field input { flex: 1 1 auto; width: auto; }
.copy-field .btn { flex: none; }

/* Números do painel se ajustam à largura */
.stat .value { font-size: clamp(1rem, 5vw, 1.45rem); }

/* Cartões de produto: nome com até 3 linhas e botão que não quebra */
.product-card .name { -webkit-line-clamp: 3; }
.product-card .btn { white-space: nowrap; padding-left: 8px; padding-right: 8px; }

/* Carrinho: quantidade nunca some */
.qty { flex: none; }

/* Tabelas (ranking): mais compactas no celular */
@media (max-width: 520px) {
  table.simple { font-size: 0.82rem; }
  table.simple th, table.simple td { padding: 8px 5px; }
  .rank { width: 24px; height: 24px; font-size: 0.8rem; }
}

/* Topo em telas estreitas */
@media (max-width: 400px) {
  .topbar-inner { gap: 6px; }
  .top-actions { gap: 2px; }
  .icon-btn { width: 36px; height: 36px; font-size: 1.1rem; }
  .pill-link { padding: 6px 10px; font-size: 0.8rem; }
  .container { padding-left: 12px; padding-right: 12px; }
  .card-pad, .order-card, .hero { padding: 14px; }
  .store-head { padding: 16px; gap: 12px; }
  .store-head .big-emoji { width: 56px; height: 56px; font-size: 1.9rem; border-radius: 16px; }
  .modal { padding: 8px; }
  .modal-card { padding: 16px; }
}
@media (max-width: 360px) {
  #brand-name { display: none; }
  .grid { gap: 8px; }
  .product-card .body { padding: 8px 10px 10px; }
}

/* Cards de aviso (notificações, instalar app): o botão desce quando falta espaço */
.install-card { flex-wrap: wrap; }
.install-card .grow { flex: 1 1 170px; }
.install-card > .btn { margin-left: auto; }

/* Nomes em listas e títulos: até 2 linhas antes das reticências */
.grow > .ellipsis, h1.ellipsis {
  white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Aviso flutuante não fica "escondido" ocupando espaço fora da tela */
.toast:not(.show) { visibility: hidden; }


/* ================= Foto do produto ampliada ================= */
.zoomable { border: 0; padding: 0; margin: 0; width: 100%; cursor: zoom-in; position: relative; font: inherit; }
.zoomable::after { content: '🔍'; position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.92); display: grid; place-items: center; font-size: 0.85rem; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); }
.zoomable:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
body.no-scroll { overflow: hidden; }

.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(12, 11, 20, 0.97); display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); animation: lb-in 0.18s ease-out; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lb-close { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); z-index: 2;
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 1.2rem; cursor: pointer; }
.lb-close:hover { background: rgba(255, 255, 255, 0.28); }
.lb-stage { flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 56px 12px 8px; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; user-select: none; -webkit-user-drag: none; }
.lb-stage img.can-zoom { cursor: zoom-in; }
/* tamanho real: a foto passa a ter o tamanho original e dá para arrastar */
.lb-stage.zoomed { overflow: auto; display: block; padding: 0; -webkit-overflow-scrolling: touch; }
.lb-stage.zoomed img { max-width: none; max-height: none; border-radius: 0; cursor: zoom-out; }
.lb-hint { text-align: center; color: rgba(255, 255, 255, 0.75); font-size: 0.82rem; font-weight: 700; padding: 0 12px 8px; }
.lb-hint[hidden] { display: none; }
.lb-info { background: #fff; border-radius: 20px 20px 0 0; padding: 16px; display: flex; gap: 12px; align-items: flex-end; max-height: 40vh; overflow-y: auto; }
.lb-text { flex: 1; min-width: 0; display: grid; gap: 4px; }
.lb-name { font-size: 1.1rem; line-height: 1.25; overflow-wrap: anywhere; }
.lb-desc { margin: 0; white-space: pre-line; }
.lb-info .btn { flex: none; }
@media (min-width: 700px) {
  .lb-info { margin: 0 auto 16px; border-radius: 20px; width: min(640px, calc(100% - 32px)); }
}
@media (max-width: 360px) {
  .lb-info { flex-direction: column; align-items: stretch; }
}

/* ================= Ranking do professor ================= */
/* Celular: cartões. Tablet/computador: tabela */
.rank-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.rank-table { display: none; }
@media (min-width: 640px) {
  .rank-list { display: none; }
  .rank-table { display: block; }
}
/* na tabela, nomes e valores não quebram letra por letra */
.rank-table td b { overflow-wrap: normal; }
.rank-table td.num { white-space: nowrap; }

.rank-card { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 10px; }
.rank-card.podium { border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); background: color-mix(in srgb, var(--primary-soft) 45%, #fff); }
.rank-head { display: flex; align-items: center; gap: 10px; }
.rank-head .rank { flex: none; width: 34px; height: 34px; font-size: 1rem; }
.rank-head .rank.medal { background: none; font-size: 1.7rem; }
.rank-name { display: block; line-height: 1.25; overflow-wrap: break-word; }
/* 4 números em 2 colunas: rótulo em cima, valor embaixo (cabe até em 280px e com fonte grande) */
.rank-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.rank-metrics div { background: var(--bg); border-radius: 10px; padding: 6px 10px; display: grid; gap: 1px; min-width: 0; }
.rank-metrics span { font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.rank-metrics b { font-size: 1rem; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: normal; }
@media (max-width: 380px) {
  .rank-metrics div { padding: 6px 8px; }
  .rank-metrics b { font-size: 0.9rem; }
}
.rank-metrics div.on { background: var(--primary); }
.rank-metrics div.on span { color: rgba(255, 255, 255, 0.85); }
.rank-metrics div.on b { color: #fff; }
