:root {
  --bg: #090b12; --card: #0f1220; --card2: #151a2c; --line: #232944; --text: #eef0f8; --muted: #8f96b3;
  --accent: #6c5ce7; --green: #12b37a; --green-d: #0e9566; --orange: #f5a524; --red: #f0506e; --blue: #4aa3ff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* senão .card { display: flex } mostra o que devia estar escondido */
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
body { background-image: radial-gradient(circle at 1px 1px, #161a2b 1px, transparent 0); background-size: 22px 22px; }
.wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px 14px; }
.card { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 28px 24px 22px; box-shadow: 0 20px 60px #0008; display: flex; flex-direction: column; gap: 14px; transition: border-color .6s, box-shadow .6s; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* topo: marca + idioma */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -8px 0 2px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; letter-spacing: .3px; white-space: nowrap; }
.brand b { color: #a99cff; font-weight: 800; }
.logo { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; color: #fff; background: linear-gradient(135deg, #6c5ce7, #12b37a); box-shadow: 0 4px 14px #6c5ce755; }
.langs { display: flex; gap: 2px; background: var(--card2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.langs button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 700; padding: 4px 9px; border-radius: 999px; cursor: pointer; }
.langs button:hover { color: var(--text); }
.langs button.on { background: var(--accent); color: #fff; }
h1 { margin: 0; font-size: 24px; text-align: center; letter-spacing: .2px; }
h2 { margin: 0; font-size: 21px; }
p { margin: 0; }
.muted { color: var(--muted); } .center { text-align: center; } .small { font-size: 13px; }
.warn-text { color: #f5a524; } .ok-text { color: #12b37a; }
small { font-size: 12px; color: var(--muted); }
b { font-weight: 650; }

/* campos e botões */
.field-label { display: block; font-weight: 700; font-size: 12.5px; letter-spacing: .4px; margin-bottom: 8px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #6c5ce733; }
form { display: flex; flex-direction: column; gap: 10px; }
.hint { font-size: 12.5px; color: var(--muted); background: #ffffff08; border-radius: 10px; padding: 9px 11px; }
.error { color: var(--red); font-size: 13.5px; min-height: 0; }
.error:empty { display: none; }
.btn { display: block; text-align: center; text-decoration: none; border: 0; border-radius: 14px; padding: 15px 16px; font: inherit; font-weight: 700; cursor: pointer; width: 100%; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn-light { background: #f1f2f7; color: #14172a; }
.btn-light:hover { background: #fff; }
.btn-dark { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.btn-dark:hover { border-color: var(--accent); }
.btn-green { background: var(--green); color: #fff; box-shadow: 0 8px 24px #12b37a40; }
.btn-green:hover:not(:disabled) { background: var(--green-d); }
.link { background: none; border: 0; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; letter-spacing: .4px; cursor: pointer; padding: 6px; text-align: center; width: 100%; }
.link:hover { color: var(--text); }
.link.subtle { font-weight: 400; text-transform: none; font-size: 12.5px; opacity: .7; }

/* faixas de aviso */
.banner { border-radius: 12px; padding: 11px 13px; font-size: 13.5px; border: 1px solid transparent; }
.banner.info { background: #4aa3ff14; border-color: #4aa3ff40; color: #bcdcff; }
.banner.warn { background: #f5a52414; border-color: #f5a52455; color: #ffd48a; }
.banner.error { background: #f0506e14; border-color: #f0506e55; color: #ffb3c0; }
.banner.ok { background: #12b37a18; border-color: #12b37a55; color: #9df0cf; }

/* ícones grandes */
.icon { width: 70px; height: 70px; border-radius: 50%; margin: 6px auto 0; display: grid; place-items: center; font-size: 32px; font-weight: 800; }
.icon.ok { background: linear-gradient(135deg, #12b37a, #0b8a5c); box-shadow: 0 0 0 10px #12b37a1c; }
.icon.warn { background: linear-gradient(135deg, #f5a524, #d97706); box-shadow: 0 0 0 10px #f5a5241c; }
.icon.bad { background: linear-gradient(135deg, #f0506e, #be2a47); box-shadow: 0 0 0 10px #f0506e1c; }
.code { text-align: center; font: 700 22px ui-monospace, Consolas, monospace; letter-spacing: 2px; background: var(--card2); border: 1px dashed var(--line); border-radius: 12px; padding: 14px; user-select: all; }

/* produto */
.product-line, .delivered-card { display: flex; align-items: center; gap: 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.product-line div, .delivered-card div { display: flex; flex-direction: column; }
img.item { width: 46px; height: 46px; object-fit: contain; border-radius: 10px; background: #0b0e19; padding: 4px; }
.delivered-card { margin-top: 6px; }

/* confirmar usuário */
.confirm { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0 6px; text-align: center; }
img.avatar { width: 56px; height: 56px; border-radius: 14px; background: #0b0e19; object-fit: cover; border: 1px solid var(--line); }
img.avatar.big { width: 84px; height: 84px; border-radius: 18px; }
img.avatar.small { width: 40px; height: 40px; border-radius: 10px; }

/* entregador -> pacote -> destinatário */
.party { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.party .who { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; min-width: 0; }
.party .who b { font-size: 12.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.party .pack { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 120px; text-align: center; }
.pack-box { position: relative; width: 86px; height: 70px; border-radius: 16px; background: var(--card2); border: 1px solid var(--line); display: grid; place-items: center; }
.pack-box img.item { width: 56px; height: 56px; }
.badge { position: absolute; top: -9px; right: -9px; background: var(--accent); border-radius: 999px; min-width: 24px; height: 24px; display: grid; place-items: center; font-size: 12px; font-weight: 800; padding: 0 6px; }

/* caixas numeradas */
.box { display: flex; gap: 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 14px; padding: 13px; }
.box.dim { opacity: .6; }
.box p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.box.dim .num { background: #2a3052; }

/* amizade */
.profile { display: flex; align-items: center; gap: 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; color: inherit; text-decoration: none; }
.profile div { flex: 1; display: flex; flex-direction: column; }
.profile:hover { border-color: var(--accent); }

/* é a sua vez */
.turn { display: flex; flex-direction: column; gap: 12px; }
.turn h1 { color: #9df0cf; }
.turn ol { margin: 0; padding: 0 0 0 20px; display: flex; flex-direction: column; gap: 9px; }
.timer { font: 700 18px ui-monospace, Consolas, monospace; color: var(--text); }

/* aguardando */
.wait { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 14px 6px; background: var(--card2); border: 1px solid var(--line); border-radius: 14px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #2a3052; border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* passos */
.steps { display: flex; justify-content: space-between; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); margin-top: 4px; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.step .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: #1a1f35; color: var(--muted); border: 1px solid var(--line); }
.step .label { font-size: 11px; color: var(--muted); font-weight: 600; }
.step.now .dot { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 0 0 5px #6c5ce733; }
.step.now .label { color: var(--text); }
.step.done .dot { background: var(--green); color: #fff; border-color: var(--green); }
.step.done .label { color: #7fe3bc; }

/* entrega concluída */
.card.celebrate { border-color: #12b37a66; background: radial-gradient(120% 60% at 50% 0%, #12b37a30, transparent 62%), var(--card); box-shadow: 0 20px 60px #0008, 0 0 90px #12b37a2e; }
.icon.big { width: 84px; height: 84px; font-size: 40px; }
.icon.pop { animation: pop .7s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.delivered-card .pack-box { display: grid; flex: none; width: 70px; height: 62px; }
.delivered-card .pack-box img.item { width: 48px; height: 48px; }
.who-name { color: #7fe3bc; font-weight: 700; }
.rate { text-align: center; background: #12b37a14; border: 1px solid #12b37a40; border-radius: 14px; padding: 14px 14px 13px; }
.stars { font-size: 22px; letter-spacing: 5px; color: #ffd166; text-shadow: 0 0 12px #ffd16666; }
.rate p { color: #9df0cf; font-size: 13.5px; font-weight: 600; margin-top: 6px; }

/* confete e emojis (criados pelo entrega.js) */
.fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.confetti { position: absolute; top: -16px; left: var(--x); width: 8px; height: 14px; background: var(--c); border-radius: 2px; animation: fall var(--d) cubic-bezier(.25, .6, .4, 1) var(--delay) both; }
.confetti.dot { width: 7px; height: 7px; border-radius: 50%; }
@keyframes fall {
  from { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
  to { transform: translate3d(var(--drift), 108vh, 0) rotate(var(--r)); opacity: .85; }
}
.emoji { position: absolute; bottom: -70px; left: var(--x); font-size: calc(26px * var(--s)); line-height: 1; animation: rise var(--d) ease-out var(--delay) both; }
@keyframes rise {
  0% { transform: translateY(0) rotate(-10deg); opacity: 0; }
  12% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(-118vh) rotate(12deg); opacity: 0; }
}
.emoji.calm { bottom: auto; top: var(--y); animation: twinkle var(--d) ease-in-out var(--delay) both; }
@keyframes twinkle { 0%, 100% { opacity: 0; } 25%, 70% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .icon.pop { animation: none; } }

/* ===================================================== admin */
body.admin .wrap, body.admin { display: block; }
.admin-shell { max-width: 1100px; margin: 0 auto; padding: 14px; }
.admin-shell header { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-shell nav { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.admin-shell nav button, .abtn { background: var(--card2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 8px 13px; font: inherit; font-size: 13.5px; cursor: pointer; }
.admin-shell nav button.on { background: var(--accent); border-color: var(--accent); }
.abtn.green { background: var(--green); border-color: var(--green); }
.abtn.red { background: #5a2332; border-color: #8a3347; }
.abtn:disabled { opacity: .5; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.panel h3 { margin: 0 0 10px; font-size: 15px; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 22px; }
.stat small { color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; background: #232944; }
.pill.ok { background: #12b37a30; color: #7fe3bc; } .pill.warn { background: #f5a52430; color: #ffd48a; }
.pill.bad { background: #f0506e30; color: #ffb3c0; } .pill.info { background: #4aa3ff30; color: #bcdcff; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); flex: 1; min-width: 140px; }
.row > label.check { flex-direction: row; align-items: center; gap: 8px; min-width: 0; flex: none; padding-bottom: 12px; }
.row input[type=checkbox] { width: auto; }
textarea.links { min-height: 140px; font: 12px ui-monospace, Consolas, monospace; }
.login-box { max-width: 340px; margin: 14vh auto 0; }
input.narrow { width: 110px; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: #1e2340; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; z-index: 10; }
.toast.err { border-color: var(--red); }
.hl { outline: 2px solid var(--orange); }
