/* RifAI — clean, light, blue accent */
:root {
    --bg: #ffffff;
    --bg-2: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --border: #e5eaf2;
    --border-2: #cbd5e1;
    --text: #0f172a;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --accent: #2563eb;
    --accent-2: #3b82f6;
    --accent-3: #1d4ed8;
    --accent-soft: #eff6ff;
    --accent-softer: #f5f9ff;
    --success: #16a34a;
    --success-soft: #dcfce7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --warning: #d97706;
    --warning-soft: #ffedd5;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow:    0 4px 12px -2px rgba(15, 23, 42, .08), 0 2px 4px -2px rgba(15, 23, 42, .04);
    --shadow-lg: 0 14px 32px -6px rgba(15, 23, 42, .12), 0 6px 12px -6px rgba(15, 23, 42, .08);
    --ring: 0 0 0 3px rgba(37, 99, 235, .15);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    /* iOS Safari: previne double-tap zoom */
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
}
/* iOS: input com font-size >= 16px previne auto-zoom no foco */
input, select, textarea { font-size: 16px; }
@media (min-width: 640px) {
    .form input, .form textarea, .form select { font-size: 14px; }
}

a { color: var(--accent); text-decoration: none; transition: color .12s; }
a:hover { color: var(--accent-3); }

svg.icon { display: inline-block; vertical-align: -3px; flex-shrink: 0; }

/* ---------- Logo (animação idle + hover) ---------- */
.logo-svg { display: block; transition: transform .3s cubic-bezier(.4, 0, .2, 1); }
.brand:hover .logo-svg { transform: rotate(-6deg) scale(1.08); }
.logo-idle { animation: logo-float 5s ease-in-out infinite; }
@keyframes logo-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-2px); }
}

/* ---------- Page load bar (NProgress-style) ---------- */
#pageload-bar {
    position: fixed; top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8, #60a5fa, #3b82f6);
    background-size: 300% 100%;
    transform: scaleX(0); transform-origin: 0 0;
    z-index: 10000;
    transition: transform .3s ease, opacity .3s;
    pointer-events: none;
    box-shadow: 0 0 14px rgba(59, 130, 246, .65), 0 0 6px rgba(37, 99, 235, .8);
}
#pageload-bar.active { animation: bar-shimmer 1.4s linear infinite; }
@keyframes bar-shimmer {
    0%   { background-position: 0% 0; }
    100% { background-position: 300% 0; }
}

/* ---------- Page fade-in (aplicado no main/hero/auth, NÃO no body — quebraria o grid do has-sidebar) ---------- */
.hero, .auth-shell, .content, .public-shell {
    animation: page-fade .35s ease both;
}
@keyframes page-fade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

/* ---------- Stagger pra cards e KPIs ---------- */
.feat, .raffle-card, .kpi {
    animation: card-rise .4s cubic-bezier(.34, 1.2, .64, 1) both;
    animation-delay: var(--delay, 0s);
}
@keyframes card-rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

/* ---------- Topnav / hero (home pública) ---------- */
.hero {
    position: relative;
    overflow: hidden;
    padding: 24px clamp(20px, 5vw, 64px) 96px;
    background:
        radial-gradient(ellipse 70% 50% at 50% 0%, rgba(59, 130, 246, .08), transparent 70%),
        linear-gradient(180deg, #fbfdff 0%, #ffffff 60%);
}
.topnav {
    display: flex; align-items: center; justify-content: space-between;
    max-width: 1180px; margin: 0 auto 72px;
}
.brand {
    display: inline-flex; align-items: center; gap: 10px;
    color: var(--text); font-weight: 700; font-size: 18px;
    letter-spacing: -.01em;
}
.brand-mark {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: 9px;
}
.brand-mark svg { display: block; }
.nav-actions { display: flex; gap: 8px; align-items: center; }

.hero-content { max-width: 880px; margin: 0 auto; text-align: center; }
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    border-radius: 100px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 13px; font-weight: 500;
    border: 1px solid rgba(37, 99, 235, .18);
    margin-bottom: 28px;
}
.hero-content h1 {
    font-size: clamp(36px, 5.5vw, 60px);
    font-weight: 700; letter-spacing: -0.03em;
    line-height: 1.05; margin: 0 0 20px;
    color: var(--text);
}
.grad {
    background: linear-gradient(135deg, var(--accent-2) 0%, var(--accent-3) 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: 18px; color: var(--muted); max-width: 600px; margin: 0 auto 36px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 64px; }
.hero-stats {
    display: flex; gap: 56px; justify-content: center; flex-wrap: wrap;
    padding-top: 40px; border-top: 1px solid var(--border);
}
.hero-stats > div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hero-stats b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.hero-stats span { color: var(--muted); font-size: 13px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 500; font-size: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .12s, box-shadow .12s, background .15s, color .15s, border-color .15s;
    text-decoration: none; font-family: inherit;
    line-height: 1.2;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-lg { padding: 14px 26px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary {
    background: linear-gradient(135deg, var(--accent-2) 0%, var(--accent-3) 100%);
    color: white;
    box-shadow: 0 4px 12px -2px rgba(37, 99, 235, .35);
    position: relative; overflow: hidden;
}
.btn-primary::before {
    content: '';
    position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
    transition: left .55s ease;
}
.btn-primary:hover {
    color: white;
    box-shadow: 0 10px 24px -4px rgba(37, 99, 235, .55);
}
.btn-primary:hover::before { left: 100%; }
.btn-ghost {
    background: white;
    border-color: var(--border-2);
    color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--muted-2); }
.btn-danger {
    background: white; border-color: #fca5a5; color: var(--danger);
}
.btn-danger:hover { background: var(--danger-soft); }

/* ---------- Features (home) ---------- */
.features {
    max-width: 1100px; margin: 0 auto;
    padding: 96px clamp(20px, 5vw, 64px);
    display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px;
}
.feat {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.feat:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-2); }
.feat-ico {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    margin-bottom: 16px;
}
.feat h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.feat p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

/* ---------- Footer ---------- */
.foot {
    border-top: 1px solid var(--border);
    padding: 32px clamp(20px, 5vw, 64px);
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
    color: var(--muted); font-size: 13px;
    background: var(--bg-2);
}
.muted { color: var(--muted); }

/* ---------- Flash ---------- */
.flash {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    padding: 12px 20px; border-radius: var(--radius-sm); font-weight: 500;
    z-index: 9999; box-shadow: var(--shadow-lg);
    animation: flash-in .25s ease;
    max-width: 90vw; font-size: 14px;
    border: 1px solid;
}
.flash-success { background: var(--success-soft); color: var(--success); border-color: rgba(22, 163, 74, .25); }
.flash-error   { background: var(--danger-soft);  color: var(--danger);  border-color: rgba(220, 38, 38, .25); }
@keyframes flash-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Error pages ---------- */
.errpage {
    min-height: 70vh;
    display: grid; place-items: center; text-align: center;
    padding: 40px 20px;
}
.errpage h1 {
    font-size: 84px; margin: 0;
    background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
    -webkit-background-clip: text; background-clip: text; color: transparent;
    font-weight: 800; letter-spacing: -.05em;
}
.errpage p { color: var(--muted); margin: 8px 0 24px; }

/* ---------- Auth pages ---------- */
.auth-shell {
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center;
    padding: 32px 20px;
    background:
        radial-gradient(ellipse 50% 30% at 50% 0%, rgba(37, 99, 235, .06), transparent 70%),
        linear-gradient(180deg, #fbfdff 0%, var(--bg) 60%);
}
.brand-back { margin-bottom: 36px; }
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    width: 100%; max-width: 440px;
    box-shadow: var(--shadow-sm);
}
.auth-card h1 { margin: 0 0 8px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.auth-card .muted { font-size: 14px; margin: 0 0 24px; }
.auth-foot {
    margin-top: 20px; padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center; font-size: 14px;
    color: var(--muted);
}
.auth-foot a { margin-left: 6px; font-weight: 500; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 13px; font-weight: 500; color: var(--text);
}
.form input, .form textarea, .form select {
    background: white;
    border: 1px solid var(--border-2);
    color: var(--text);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.form input:hover, .form textarea:hover, .form select:hover {
    border-color: var(--muted-2);
}
.form input:focus, .form textarea:focus, .form select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}
.form input::placeholder, .form textarea::placeholder { color: var(--muted-2); }
.form small { font-size: 12px; color: var(--muted); font-weight: 400; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Sidebar layout (painel/admin) ---------- */
body.has-sidebar {
    display: grid; grid-template-columns: 252px 1fr; min-height: 100vh;
    background: var(--bg-2);
}
.sidebar {
    background: white;
    border-right: 1px solid var(--border);
    padding: 18px 14px;
    display: flex; flex-direction: column; gap: 10px;
    position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { padding: 6px 8px; margin-bottom: 12px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-sm);
    color: var(--muted); font-size: 14px; font-weight: 500;
    transition: background .12s, color .12s;
}
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav a:hover { background: var(--surface-2); color: var(--text); }
.sidebar-nav a.active {
    background: var(--accent-soft);
    color: var(--accent-3);
}
.sidebar-foot {
    padding-top: 12px; border-top: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 8px;
}
.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 6px;
}
.user-chip .avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
    color: white; font-weight: 700;
    display: grid; place-items: center;
    font-size: 14px;
}
.user-chip b { font-size: 13px; display: block; line-height: 1.2; }
.user-chip small { font-size: 11px; color: var(--muted); text-transform: capitalize; }

.content {
    padding: 28px clamp(20px, 4vw, 40px);
    max-width: 1300px;
    background: var(--bg-2);
}
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 28px; gap: 12px; flex-wrap: wrap;
}
.page-header h1 { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.page-actions { display: flex; gap: 8px; }

/* ---------- KPIs ---------- */
.kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px; margin-bottom: 22px;
}
.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 18px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}
.kpi-label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }

/* ---------- Empty state ---------- */
.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border-2);
    padding: 48px 24px;
    border-radius: var(--radius);
    text-align: center;
}
.empty-state h2 { margin: 0 0 8px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.empty-state p { margin: 0 0 20px; color: var(--muted); }
.empty-ico {
    width: 64px; height: 64px; margin: 0 auto 14px;
    border-radius: 18px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid; place-items: center;
    animation: ico-pulse 2.6s ease-in-out infinite;
}
@keyframes ico-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(59, 130, 246, .25); }
    50%      { transform: scale(1.04); box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
}

/* ---------- Grupos por status ---------- */
.raffle-group { margin-bottom: 28px; }
.raffle-group-head {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 10px;
}
.raffle-group-head h3 {
    margin: 0; font-size: 13px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 8px;
    text-transform: uppercase; letter-spacing: .04em;
}
.raffle-group-head .badge { text-transform: none; letter-spacing: 0; }

/* ---------- Raffle cards (listagem) ---------- */
.raffle-list {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px;
}
.raffle-card-cover {
    margin: -18px -18px 12px;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--surface-2);
}
.raffle-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.raffle-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex; flex-direction: column; gap: 10px;
    color: var(--text);
    box-shadow: var(--shadow-xs);
    transition: transform .14s, box-shadow .14s, border-color .14s;
}
.raffle-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-2);
    box-shadow: var(--shadow);
    color: var(--text);
}
.raffle-card-head { display: flex; align-items: center; justify-content: space-between; }
.raffle-card h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.raffle-card-stats {
    display: flex; gap: 18px; margin-top: 4px;
    padding-top: 12px; border-top: 1px solid var(--border);
}
.raffle-card-stats > div { display: flex; flex-direction: column; }
.raffle-card-stats b { font-size: 15px; font-weight: 600; }
.raffle-card-stats span { font-size: 11px; color: var(--muted); }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 100px;
    font-size: 12px; font-weight: 600;
    background: var(--surface-2); color: var(--muted);
    border: 1px solid var(--border);
}
.badge-lg { padding: 5px 14px; font-size: 13px; }
.badge-draft     { background: var(--warning-soft); color: var(--warning); border-color: rgba(217, 119, 6, .25); }
.badge-active    { background: var(--success-soft); color: var(--success); border-color: rgba(22, 163, 74, .25); }
.badge-closed    { background: var(--accent-soft);  color: var(--accent);  border-color: rgba(37, 99, 235, .22); }
.badge-cancelled { background: var(--danger-soft);  color: var(--danger);  border-color: rgba(220, 38, 38, .22); }
.badge-success   { background: var(--success-soft); color: var(--success); border-color: rgba(22, 163, 74, .25); }
.small { font-size: 12px; }

/* ---------- Rifa header (página de detalhe) ---------- */
.rifa-header {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    margin-bottom: 22px; padding: 16px 18px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}
.rifa-meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.rifa-meta b { color: var(--text); font-weight: 600; }

/* ---------- Form wide / sections ---------- */
.form-wide { max-width: 760px; }
.form-section {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin: 0 0 16px;
    display: flex; flex-direction: column; gap: 14px;
    box-shadow: var(--shadow-xs);
}
.form-section legend {
    padding: 0 8px; font-weight: 600; font-size: 13px;
    color: var(--accent); text-transform: uppercase; letter-spacing: .04em;
}
.form-actions {
    display: flex; gap: 8px; justify-content: flex-end;
    margin-top: 4px;
}
textarea { resize: vertical; min-height: 80px; font-family: inherit; }

/* ---------- Radio cards (escolha de modalidade) ---------- */
.radio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.radio-card {
    background: white;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    cursor: pointer;
    display: flex; gap: 10px; align-items: flex-start;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.radio-card input[type="radio"] { margin-top: 3px; accent-color: var(--accent); }
.radio-card:hover { border-color: var(--muted-2); }
.radio-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-softer);
    box-shadow: var(--ring);
}
.radio-card b { display: block; font-size: 14px; }
.radio-card p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
@media (max-width: 520px) { .radio-grid { grid-template-columns: 1fr; } }

/* ---------- Block / section em show ---------- */
.block {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px 22px; margin-bottom: 16px;
    box-shadow: var(--shadow-xs);
}
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.block h3 { margin: 0 0 10px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.danger-zone { border-color: rgba(220, 38, 38, .2); }
.danger-zone h3 { color: var(--danger); }

/* ---------- Prizes ---------- */
.prize-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.prize-row {
    display: grid; grid-template-columns: 64px 1fr auto auto;
    gap: 12px; align-items: center;
    background: var(--bg-2); border: 1px solid var(--border);
    padding: 10px 14px; border-radius: var(--radius-sm);
}
.prize-num {
    background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
    color: white; font-weight: 700;
    text-align: center; padding: 8px 0; border-radius: var(--radius-xs);
    font-size: 14px;
    box-shadow: 0 2px 6px -1px rgba(37, 99, 235, .35);
    display: flex; align-items: center; justify-content: center;
    min-height: 36px;
}
.prize-num-secret {
    background: linear-gradient(135deg, var(--muted-2), var(--muted));
    box-shadow: 0 2px 6px -1px rgba(100, 116, 139, .3);
}
.prize-num-secret svg { width: 18px; height: 18px; }
.prize-info b { font-size: 14px; }
.prize-info p { margin: 2px 0 0; color: var(--muted); }
.prize-value { font-weight: 600; color: var(--accent); font-size: 14px; }
.prize-form {
    background: var(--bg-2); border: 1px dashed var(--border-2);
    padding: 16px 18px; border-radius: var(--radius-sm);
}
.prize-form .form-row { grid-template-columns: 120px 1fr 140px; }
@media (max-width: 640px) {
    .prize-form .form-row { grid-template-columns: 1fr; }
    .prize-row { grid-template-columns: 56px 1fr auto; }
    .prize-row .prize-state { grid-column: 2 / 4; justify-self: end; }
}

/* ---------- Modal de confirmação ---------- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .4);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: grid; place-items: center;
    animation: backdrop-in .18s ease;
    padding: 20px;
}
.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 28px;
    max-width: 420px; width: 100%;
    box-shadow: 0 30px 80px -10px rgba(15, 23, 42, .3), 0 4px 14px rgba(37, 99, 235, .1);
    animation: card-in .32s cubic-bezier(.34, 1.4, .64, 1) both;
    transform-origin: center;
}
.modal-card.closing { animation: card-out .18s ease both; }
@keyframes card-out {
    to { opacity: 0; transform: scale(.96) translateY(4px); }
}
.modal-card .modal-ico {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: var(--danger-soft);
    color: var(--danger);
    display: grid; place-items: center;
    margin: 0 0 16px;
    animation: ico-pulse 1.6s ease-in-out infinite;
}
.modal-card h2 { margin: 0 0 8px; font-size: 17px; font-weight: 600; }
.modal-card p { margin: 0 0 22px; color: var(--muted); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal-backdrop.closing { animation: backdrop-out .15s ease both; }
@keyframes backdrop-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-out { to   { opacity: 0; } }
@keyframes card-in {
    0%   { opacity: 0; transform: translateY(16px) scale(.92); }
    100% { opacity: 1; transform: none; }
}

/* ---------- Inputs com micro-animation no focus ---------- */
.form input, .form textarea, .form select { will-change: border-color, box-shadow, transform; }
.form input:focus, .form textarea:focus { transform: translateY(-1px); }

/* ---------- Sidebar links com micro-deslocamento ---------- */
.sidebar-nav a {
    position: relative;
    transition: background .15s, color .15s, padding-left .15s;
}
.sidebar-nav a:hover { padding-left: 14px; }
.sidebar-nav a.active::before {
    content: '';
    position: absolute; left: 0; top: 8px; bottom: 8px;
    width: 3px; border-radius: 0 3px 3px 0;
    background: var(--accent);
}

/* ---------- Layout público ---------- */
.public-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px clamp(16px, 4vw, 40px);
    background: white; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(8px); background: rgba(255,255,255,.92);
}
.public-shell {
    max-width: 980px; margin: 0 auto;
    padding: 32px clamp(16px, 4vw, 40px);
}

/* ---------- Rifa pública (hero + stats) ---------- */
.rifa-public { display: flex; flex-direction: column; gap: 16px; }
.rifa-hero {
    background: linear-gradient(160deg, var(--accent-softer) 0%, white 60%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 30px;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.rifa-hero h1 { font-size: clamp(22px, 4vw, 32px); margin: 12px 0 8px; font-weight: 700; letter-spacing: -.02em; }
.rifa-lede { color: var(--muted); margin: 0 0 20px; max-width: 700px; }

/* Versão com imagem grande */
.rifa-hero-img {
    padding: 0;
    background: white;
}
.rifa-hero-img .rifa-hero-info { padding: 24px 28px; }
.rifa-hero-photo {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
}
.rifa-hero-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rifa-hero-shade {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,.78) 100%);
}
.hero-badge {
    position: absolute; top: 16px; left: 16px; z-index: 2;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(8px);
}
.hero-prize-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 28px 30px 24px;
    color: white;
    z-index: 2;
}
.hero-prize-overlay small {
    display: block; text-transform: uppercase;
    font-size: 11px; letter-spacing: .08em; font-weight: 600;
    opacity: .85; margin-bottom: 4px;
}
.hero-prize-overlay h2 {
    margin: 0; font-size: clamp(20px, 4vw, 32px);
    font-weight: 700; letter-spacing: -.02em;
    text-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.hero-prize-overlay span {
    display: inline-block; margin-top: 6px;
    font-size: 13px; opacity: .85;
    background: rgba(255,255,255,.15);
    padding: 3px 10px; border-radius: 100px;
    backdrop-filter: blur(6px);
}

.hero-share { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.prize-spotlight {
    display: inline-flex; align-items: center; gap: 14px;
    background: white; border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 18px; margin-bottom: 18px;
    box-shadow: var(--shadow-xs);
}
.prize-spotlight-ico {
    width: 40px; height: 40px; border-radius: 10px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #d97706;
    display: grid; place-items: center;
}
.prize-spotlight small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.prize-spotlight b { font-size: 16px; font-weight: 700; }

.rifa-stats { display: flex; gap: 32px; margin: 18px 0 14px; flex-wrap: wrap; }
.rifa-stats > div small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 600; letter-spacing: .04em; margin-bottom: 4px; }
.rifa-stats > div b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }

.progress {
    height: 8px; background: var(--surface-2); border-radius: 100px; overflow: hidden;
    margin-bottom: 6px;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-2), var(--accent-3));
    border-radius: inherit;
    transition: width .6s cubic-bezier(.4, 0, .2, 1);
    animation: progress-glow 2.4s ease-in-out infinite;
}
@keyframes progress-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, .4); }
    50%      { box-shadow: 0 0 10px 2px rgba(59, 130, 246, .35); }
}

/* ---------- Grid de números (modo choose) ---------- */
.buy-summary {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: var(--accent-softer); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px; margin-bottom: 14px;
    position: sticky; top: 70px; z-index: 5;
}
.buy-summary b { font-weight: 700; }
.buy-summary .btn { margin-left: auto; }

.number-grid {
    display: grid; gap: 4px;
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    max-height: 540px; overflow-y: auto;
    padding: 2px;
}
.num-cell {
    height: 42px;
    border: 1px solid var(--border-2);
    background: white;
    border-radius: var(--radius-xs);
    font-weight: 600; font-size: 13px;
    cursor: pointer;
    transition: all .14s;
    color: var(--text);
    font-family: inherit;
}
.num-cell.available:hover { border-color: var(--accent); background: var(--accent-softer); transform: translateY(-1px); }
.num-cell.selected,
.num-cell.selected:hover {
    background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
    border-color: var(--accent-3);
    color: white;
    box-shadow: 0 4px 10px -2px rgba(37, 99, 235, .5);
    transform: translateY(-1px);
}
.num-cell.selected:hover {
    box-shadow: 0 6px 14px -2px rgba(37, 99, 235, .65);
    transform: translateY(-2px);
}
.num-cell.paid     { background: var(--surface-2); color: var(--muted-2); cursor: not-allowed; opacity: .5; text-decoration: line-through; }
.num-cell.reserved { background: var(--warning-soft); color: var(--warning); cursor: not-allowed; opacity: .7; }

/* ---------- Qty selector (modo random) ---------- */
.qty-selector { display: flex; flex-direction: column; gap: 14px; }
.qty-selector label { font-size: 14px; font-weight: 500; color: var(--text); }
.qty-controls { display: flex; gap: 6px; align-items: stretch; flex-wrap: wrap; }
.qty-btn {
    background: white; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
    padding: 8px 14px; font-weight: 600; cursor: pointer;
    transition: all .15s; font-family: inherit; color: var(--text);
    min-width: 52px;
}
.qty-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
#qtyInput {
    flex: 1; min-width: 100px; max-width: 160px;
    padding: 10px 14px; font-size: 18px; text-align: center; font-weight: 700;
    border: 1px solid var(--border-2); border-radius: var(--radius-sm);
    background: white; color: var(--text);
}
#qtyInput:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.qty-shortcuts { display: flex; gap: 6px; flex-wrap: wrap; }
.qty-pick {
    padding: 6px 12px; background: var(--accent-softer); color: var(--accent);
    border: 1px solid rgba(37, 99, 235, .2); border-radius: 100px;
    font-size: 13px; cursor: pointer; font-family: inherit;
    transition: all .15s;
}
.qty-pick:hover { background: var(--accent-soft); transform: translateY(-1px); }
.qty-total {
    background: var(--surface-2); border-radius: var(--radius-sm);
    padding: 14px 18px; font-size: 15px; color: var(--muted);
    margin-top: 6px;
}
.qty-total b { color: var(--text); font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-left: 8px; }

/* ---------- Página do pedido ---------- */
.order-page { display: flex; flex-direction: column; gap: 16px; }
.order-head { display: flex; align-items: center; gap: 14px; justify-content: space-between; flex-wrap: wrap; }
.order-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }

.order-success {
    background: linear-gradient(160deg, var(--success-soft) 0%, white 70%);
    border: 1px solid rgba(22, 163, 74, .3);
    border-radius: var(--radius);
    padding: 32px; text-align: center;
}
.success-ico {
    width: 72px; height: 72px; border-radius: 50%;
    background: white; color: var(--success);
    display: grid; place-items: center; margin: 0 auto 12px;
    box-shadow: 0 8px 20px -6px rgba(22, 163, 74, .35);
    animation: success-pop .5s cubic-bezier(.34, 1.6, .64, 1) both;
}
@keyframes success-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.order-success h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.02em; }

.prize-celebrate {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #fbbf24;
    border-radius: var(--radius);
    padding: 28px; text-align: center;
    animation: celebrate 1s ease-in-out infinite alternate;
}
@keyframes celebrate {
    0%   { box-shadow: 0 0 0 0 rgba(251, 191, 36, .4); }
    100% { box-shadow: 0 0 30px 4px rgba(251, 191, 36, .55); }
}
.celebrate-ico {
    width: 80px; height: 80px; border-radius: 50%;
    background: white; color: #d97706;
    display: grid; place-items: center; margin: 0 auto 12px;
    animation: trophy-bounce 1.2s ease-in-out infinite;
}
@keyframes trophy-bounce {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50%      { transform: translateY(-6px) rotate(3deg); }
}
.prize-celebrate h2 { margin: 0; font-size: 20px; color: #92400e; letter-spacing: -.01em; }

.quota-grid {
    display: grid; gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}
.quota-cell {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 10px 14px;
    display: flex; align-items: center; gap: 10px;
}
.quota-cell b { font-size: 16px; color: var(--muted); font-weight: 700; }
.quota-cell.this-order,
.quota-cell:not(.quota-cell-sm) {
    background: var(--accent-softer); border-color: rgba(37, 99, 235, .25);
}
.quota-cell.this-order b,
.quota-cell:not(.quota-cell-sm) b { color: var(--accent); }
.quota-cell-sm { padding: 8px 12px; }
.quota-cell-sm b { font-size: 14px; }
.quota-cell.won {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-color: #fbbf24;
}
.quota-cell.won b { color: #92400e; }
.quota-prize { font-size: 12px; color: #92400e; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

.dot-this {
    display: inline-block; width: 10px; height: 10px;
    border-radius: 50%; background: var(--accent);
    vertical-align: -1px; margin-right: 4px;
}

.cta-buy-more {
    display: flex; flex-direction: column; gap: 8px;
    margin-top: 18px;
}

.payment-block .pix-area {
    display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start;
}
@media (max-width: 640px) { .payment-block .pix-area { grid-template-columns: 1fr; } }
.pix-qr {
    width: 220px; height: 220px; image-rendering: pixelated;
    background: white; padding: 10px; border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
#pixCode {
    width: 100%; font-family: 'Menlo', ui-monospace, monospace; font-size: 12px;
    background: var(--surface-2); border: 1px solid var(--border);
    padding: 10px; border-radius: var(--radius-sm); margin-bottom: 8px;
    color: var(--text);
}

.dev-notice {
    background: var(--warning-soft); color: #92400e;
    border: 1px solid rgba(217, 119, 6, .3);
    border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 16px;
}
.dev-notice b { display: block; margin-bottom: 4px; }

/* ---------- MP integration card ---------- */
.mp-connected, .mp-fallback {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 16px; border-radius: var(--radius-sm);
    border: 1px solid;
    margin-bottom: 4px;
}
.mp-connected { background: var(--success-soft); border-color: rgba(22, 163, 74, .3); }
.mp-fallback  { background: var(--warning-soft); border-color: rgba(217, 119, 6, .3); }
.mp-connected b, .mp-fallback b { display: block; font-size: 14px; color: var(--text); }
.mp-connected small, .mp-fallback small { display: block; font-size: 12px; }
.mp-connected-ico, .mp-fallback-ico {
    width: 40px; height: 40px; border-radius: 10px;
    display: grid; place-items: center; flex-shrink: 0;
}
.mp-connected-ico { background: white; color: var(--success); }
.mp-fallback-ico  { background: white; color: var(--warning); }

.order-resume { list-style: none; padding: 0; margin: 0; }
.order-resume li {
    display: flex; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px dashed var(--border);
    color: var(--muted);
}
.order-resume li.total { border-bottom: none; padding-top: 14px; font-size: 16px; }
.order-resume li.total b { color: var(--accent); font-size: 20px; font-weight: 700; }
.order-resume b { color: var(--text); }

.back-link { margin-top: 8px; }

.prize-row.revealed { opacity: .55; }
.prizes-public h3 { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Prize chips (compacto, foto pequena, click pra ampliar) ---------- */
.prize-chips {
    display: grid; gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    margin-top: 14px;
}
.prize-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    background: white; border: 1px solid var(--border);
    border-radius: 100px;
    transition: transform .12s, box-shadow .12s, border-color .12s;
}
.prize-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-xs); border-color: var(--border-2); }
.prize-chip.revealed { opacity: .5; }

.prize-chip-thumb {
    width: 38px; height: 38px; flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: var(--surface-2);
    border: 2px solid white;
    box-shadow: 0 0 0 1px var(--border);
    cursor: pointer;
    padding: 0;
    transition: transform .15s, box-shadow .15s;
}
.prize-chip-thumb[data-zoom]:hover { transform: scale(1.08); box-shadow: 0 0 0 2px var(--accent); }
.prize-chip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prize-chip-empty {
    width: 100%; height: 100%;
    display: grid; place-items: center;
    color: var(--muted-2);
    background: linear-gradient(135deg, var(--accent-softer), white);
}

.prize-chip-info {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 1px;
    line-height: 1.25;
}
.prize-chip-info b {
    font-size: 13px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prize-chip-value {
    font-size: 12px; font-weight: 700; color: var(--accent);
}

.prize-chip-num {
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
    color: white; font-weight: 700; font-size: 11px;
    padding: 3px 9px; border-radius: 100px;
    display: inline-flex; align-items: center; gap: 3px;
}
.prize-chip-num.secret {
    background: linear-gradient(135deg, var(--muted-2), var(--muted));
}
.prize-chip .badge {
    font-size: 10px; padding: 2px 8px;
}

/* ---------- Lightbox de imagem ---------- */
.lightbox-backdrop {
    background: rgba(0, 0, 0, .85);
    backdrop-filter: blur(8px);
}
.lightbox-card {
    position: relative;
    max-width: 90vw; max-height: 90vh;
    animation: card-in .25s cubic-bezier(.34, 1.4, .64, 1) both;
}
.lightbox-card img {
    max-width: 90vw; max-height: 80vh;
    display: block;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.lightbox-card .checkout-close {
    position: absolute; top: -12px; right: -12px;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
    z-index: 2;
}
.lightbox-title {
    margin-top: 14px;
    text-align: center;
    color: white;
    font-size: 15px;
    font-weight: 600;
}
@media (max-width: 640px) {
    .lightbox-card { max-width: 100vw; padding: 0 12px; }
    .lightbox-card img { max-width: 100%; }
    .lightbox-card .checkout-close { top: 4px; right: 16px; }
}

/* ---------- Resultado / encerramento ---------- */
.closed-result {
    background: linear-gradient(135deg, var(--accent-softer) 0%, white 70%);
    border: 1px solid rgba(37, 99, 235, .2);
}
.closed-result h3 { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); }
.result-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px; margin-top: 12px;
}
.result-grid > div small { display: block; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; font-weight: 600; margin-bottom: 4px; }
.result-grid > div b { display: block; font-size: 18px; font-weight: 700; }
.result-number {
    background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
    -webkit-background-clip: text; background-clip: text; color: transparent;
    font-size: 28px !important;
}

.public-result-banner {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fbbf24;
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    box-shadow: 0 4px 20px -4px rgba(251, 191, 36, .35);
    animation: card-rise .5s cubic-bezier(.34, 1.2, .64, 1) both;
}
.public-result-banner h2 { margin: 0 0 4px; color: #92400e; font-size: 20px; }
.public-result-banner .result-number { font-size: 32px !important; vertical-align: -2px; }

.raffle-card.won-main {
    background: linear-gradient(135deg, #fef3c7 0%, white 60%);
    border-color: #fbbf24;
    box-shadow: 0 6px 16px -4px rgba(251, 191, 36, .35);
}
.raffle-card.has-sub:not(.won-main) {
    background: linear-gradient(135deg, var(--success-soft) 0%, white 60%);
    border-color: rgba(22, 163, 74, .3);
}

/* ---------- Minhas rifas (área buyer pública) ---------- */
.my-raffles { display: flex; flex-direction: column; gap: 22px; }
.my-head h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -.02em; font-weight: 700; }
.my-head p { margin: 0; }

.raffle-list-wide {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.prize-celebrate.compact {
    display: flex; gap: 16px; align-items: center; text-align: left;
    padding: 16px 22px;
}
.prize-celebrate.compact .celebrate-ico {
    width: 56px; height: 56px; margin: 0;
}
.prize-celebrate.compact b { display: block; color: #92400e; font-size: 16px; }
.prize-celebrate.compact small { display: block; color: #b45309; }

/* ---------- Filter bar (vendas, etc) ---------- */
.filter-bar {
    display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-xs);
}
.filter-bar label {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 12px; font-weight: 500; color: var(--muted);
    flex: 1; min-width: 180px;
}
.filter-bar label.search-input { flex: 2; min-width: 240px; }
.search-wrap {
    position: relative;
    display: flex; align-items: center;
}
.search-wrap svg { position: absolute; left: 11px; color: var(--muted-2); pointer-events: none; }
.search-wrap input {
    width: 100%; padding: 9px 12px 9px 36px;
    background: white; border: 1px solid var(--border-2);
    border-radius: var(--radius-sm); font-size: 14px; color: var(--text);
    font-family: inherit;
}
.search-wrap input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.filter-bar select {
    background: white; border: 1px solid var(--border-2);
    color: var(--text); padding: 9px 12px;
    border-radius: var(--radius-sm); font-size: 14px;
    font-family: inherit; cursor: pointer;
}
.filter-bar select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.filter-bar > .btn { align-self: stretch; min-width: 100px; }

/* ---------- Buyer link na tabela ---------- */
.buyer-link {
    color: var(--text); font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed var(--border-2);
    transition: color .15s, border-color .15s;
}
.buyer-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Customer page (detalhes) ---------- */
.customer-head {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    margin-bottom: 18px; padding: 18px 22px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-xs);
}
.customer-avatar {
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
    color: white; font-weight: 700; font-size: 22px;
    display: grid; place-items: center;
}
.customer-info h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.customer-info p { margin: 4px 0 0; }
.data-pairs {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px; margin-top: 4px;
}
.data-pairs > div small { display: block; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.data-pairs > div b { font-size: 14px; word-break: break-word; }

.customer-orders-row {
    grid-template-columns: 100px 2fr 1.5fr 110px 100px;
    align-items: start;
}
@media (max-width: 900px) {
    .customer-orders-row { grid-template-columns: 1fr 1fr; }
    .customer-orders-row.dt-head { display: none; }
}

/* Sales row tem 7 colunas */
.sales-row {
    grid-template-columns: 100px 1.5fr 1.3fr 1.4fr 110px 110px 100px;
    align-items: start;
}
.sales-row b { display: block; font-weight: 600; }
.sales-row small { font-size: 11px; }
.qty-cell b { font-size: 14px; margin-bottom: 4px; }
.num-chips {
    display: flex; flex-wrap: wrap; gap: 3px;
    max-width: 240px;
}
.num-chip {
    display: inline-block;
    padding: 1px 7px;
    font-size: 10px; font-weight: 700;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 100px;
    line-height: 1.5;
}
.num-chip-more {
    background: var(--surface-2);
    color: var(--muted);
    cursor: help;
}
@media (max-width: 900px) {
    .sales-row { grid-template-columns: 1fr 1fr; }
    .sales-row.dt-head { display: none; }
    .num-chips { max-width: 100%; }
}

/* ---------- Data table (listas admin) ---------- */
.data-table {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.dt-row {
    display: grid;
    grid-template-columns: 1.5fr 1.8fr 0.8fr 1.2fr 1fr 1fr 0.6fr;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    align-items: center;
    gap: 12px;
    animation: card-rise .4s cubic-bezier(.34, 1.2, .64, 1) both;
    animation-delay: var(--delay, 0s);
}
.dt-row:last-child { border-bottom: none; }
.dt-row.dt-head {
    background: var(--surface-2);
    font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
    font-weight: 600; color: var(--muted);
    animation: none;
}
.dt-row > span small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.dt-row code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-family: 'Menlo', ui-monospace, monospace; font-size: 11px; }
.mono { font-family: 'Menlo', ui-monospace, monospace; font-size: 11px; word-break: break-all; }

@media (max-width: 900px) {
    .dt-row { grid-template-columns: 1fr 1fr; }
    .dt-row.dt-head { display: none; }
    .dt-row > span:first-child { font-weight: 600; }
}

/* ---------- Checkout Modal Multi-Step ---------- */
.modal-checkout { padding: 0; align-items: center; }
.modal-checkout .checkout-card {
    background: var(--surface);
    border-radius: var(--radius);
    width: 100%; max-width: 540px;
    max-height: 92vh;
    max-height: 92dvh;
    display: flex; flex-direction: column;
    min-height: 0;
    overflow: hidden;
    box-shadow: 0 30px 80px -10px rgba(15, 23, 42, .3);
    animation: card-in .3s cubic-bezier(.34, 1.4, .64, 1) both;
}
.modal-checkout .checkout-card.closing { animation: card-out .18s ease both; }
.checkout-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
    gap: 12px;
}
.checkout-stepper { display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap; }
.step-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 100px;
    font-size: 12px; font-weight: 600;
    background: var(--surface-2); color: var(--muted-2);
    transition: background .2s, color .2s, transform .2s;
}
.step-pill.active { background: var(--accent); color: white; transform: scale(1.05); }
.step-pill.done   { background: var(--success-soft); color: var(--success); }
.step-num {
    width: 18px; height: 18px;
    background: rgba(255,255,255,.25);
    border-radius: 50%; display: grid; place-items: center;
    font-size: 11px;
}
.step-pill.done .step-num { background: var(--success); color: white; }
.step-pill:not(.active):not(.done) .step-num { background: var(--border-2); color: white; }
.step-connector { height: 2px; flex: 1; background: var(--border); min-width: 8px; max-width: 24px; }

.checkout-close {
    background: transparent; border: none; cursor: pointer;
    width: 32px; height: 32px; border-radius: 50%;
    color: var(--muted); font-size: 22px;
    display: grid; place-items: center;
    transition: background .15s;
}
.checkout-close:hover { background: var(--surface-2); color: var(--text); }

.checkout-body {
    padding: 22px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
    transition: opacity .15s;
}
.checkout-body.fading { opacity: 0; }
.checkout-body .form { gap: 12px; }
.checkout-body h4 { margin: 16px 0 10px; font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.checkout-foot {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    gap: 10px;
    background: var(--surface);
    flex-shrink: 0;
}
.checkout-err {
    background: var(--danger-soft); color: var(--danger);
    border: 1px solid rgba(220, 38, 38, .25);
    padding: 10px 14px; border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 14px;
    animation: card-rise .25s cubic-bezier(.34, 1.4, .64, 1) both;
}

/* Auth tabs */
.auth-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--radius-sm); margin-bottom: 18px; }
.auth-tab {
    flex: 1; padding: 10px 12px;
    background: transparent; border: none; border-radius: var(--radius-xs);
    cursor: pointer; font-size: 14px; font-weight: 500;
    color: var(--muted); font-family: inherit;
    transition: all .15s;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active { background: white; color: var(--accent); box-shadow: var(--shadow-xs); }

/* Offers */
.offers-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.offer-card {
    display: grid; grid-template-columns: 24px 1fr auto;
    gap: 14px; align-items: center;
    padding: 14px 16px;
    background: white; border: 1px solid var(--border-2);
    border-radius: var(--radius-sm); cursor: pointer;
    transition: border-color .15s, background .15s, transform .12s;
}
.offer-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.offer-card.checked {
    border-color: var(--accent);
    background: var(--accent-softer);
    box-shadow: var(--ring);
}
.offer-card input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
.offer-text b { display: block; font-size: 14px; }
.offer-text small { display: block; font-size: 12px; }
.offer-price { font-size: 16px; font-weight: 700; color: var(--accent); }

/* Review */
.review-card {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 16px 18px;
}
.review-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.review-line:last-child { border-bottom: none; }
.review-line.total { font-size: 16px; padding-top: 12px; margin-top: 4px; border-top: 2px solid var(--border-2); border-bottom: none; }
.review-line.total b { font-size: 22px; font-weight: 700; color: var(--accent); }
.review-line.muted { color: var(--muted); font-size: 13px; }
.review-line span { color: var(--muted); }
.review-line b { color: var(--text); font-weight: 600; }

.pay-method-title { margin-top: 18px !important; }
.pay-methods { display: flex; flex-direction: column; gap: 8px; }
.pay-method {
    display: grid; grid-template-columns: 20px 40px 1fr;
    gap: 14px; align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    background: white; cursor: pointer;
    transition: all .15s;
}
.pay-method:not(.disabled):hover { border-color: var(--accent); transform: translateY(-1px); }
.pay-method.checked { border-color: var(--accent); background: var(--accent-softer); box-shadow: var(--ring); }
.pay-method.disabled { opacity: .55; cursor: not-allowed; }
.pay-method input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; }
.pay-method-ico {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent);
    border-radius: 10px;
}
.pay-method b { display: block; font-size: 14px; }
.pay-method small { display: block; font-size: 12px; }

.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spinner-rot .7s linear infinite;
    vertical-align: -2px; margin-right: 6px;
}
@keyframes spinner-rot { to { transform: rotate(360deg); } }

/* ---------- Image uploads no painel ---------- */
.image-uploads {
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.image-upload-slot {
    display: flex; flex-direction: column; gap: 8px;
    background: var(--bg-2); border: 1px solid var(--border);
    padding: 14px; border-radius: var(--radius-sm);
}
.image-upload-slot small { font-weight: 600; }
.img-preview {
    aspect-ratio: 16/10;
    border-radius: var(--radius-xs);
    overflow: hidden;
    background: white;
    display: grid; place-items: center;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-preview.img-empty { color: var(--muted-2); background: var(--surface-2); }
.img-upload-form { margin: 0; }
.img-upload-form .btn { cursor: pointer; }

/* ---------- Sub-prêmios com foto ---------- */
.prize-row-img {
    grid-template-columns: 60px 60px 1fr auto auto;
}
.prize-thumb {
    width: 60px; height: 60px; border-radius: var(--radius-xs);
    overflow: hidden; background: var(--surface-2);
    display: grid; place-items: center;
}
.prize-thumb img { width: 100%; height: 100%; object-fit: cover; }
.prize-thumb-empty { color: var(--muted-2); }
@media (max-width: 640px) {
    .prize-row-img { grid-template-columns: 50px 50px 1fr; }
    .prize-row-img .prize-value, .prize-row-img .prize-state { grid-column: 1 / 4; justify-self: end; }
}

/* ---------- Offer rows no painel organizer ---------- */
.offer-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.offer-row {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-2); border: 1px solid var(--border);
    padding: 10px 14px; border-radius: var(--radius-sm);
    gap: 12px;
}
.offer-row .offer-info b { font-size: 14px; }
.offer-row .offer-info small { display: block; font-size: 12px; }

/* Mobile-first do modal checkout
   IMPORTANTE: position:sticky tem bug em scroll containers no Safari iOS.
   Estratégia: o card é fixed full-screen, scrolla por inteiro, footer fica
   no FIM do scroll. Padding-bottom generoso garante alcance com teclado aberto. */
@media (max-width: 640px) {
    .modal-checkout {
        padding: 0;
        align-items: stretch;
        overflow: hidden;
    }
    .modal-checkout .checkout-card {
        max-width: 100%;
        max-height: none;
        border-radius: 0;
        width: 100%;
        height: auto;
        min-height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        background: var(--surface);
    }
    .checkout-head {
        padding: 12px 16px;
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
        position: static;
    }
    .step-label { display: none; }
    .step-pill { padding: 4px 6px; }
    .checkout-body {
        padding: 18px 16px 24px;
        overflow: visible;
        flex: none;
    }
    .checkout-foot {
        padding: 16px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        position: static;
        box-shadow: none;
    }
    .checkout-foot .btn { flex: 1; min-height: 48px; }
}

/* ---------- Mobile sidebar ---------- */
@media (max-width: 768px) {
    body.has-sidebar { grid-template-columns: 1fr; }
    .sidebar {
        position: relative; height: auto;
        border-right: none; border-bottom: 1px solid var(--border);
        flex-direction: row; flex-wrap: wrap; align-items: center;
        padding: 12px 16px; gap: 8px;
    }
    .sidebar-brand { margin: 0; }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; flex: unset; gap: 2px; }
    .sidebar-nav a { padding: 6px 10px; font-size: 13px; }
    .sidebar-nav a svg { width: 16px; height: 16px; }
    .sidebar-foot { flex-direction: row; align-items: center; padding-top: 0; border-top: none; margin-left: auto; gap: 6px; }
}

@media (max-width: 640px) {
    .topnav { margin-bottom: 48px; }
    .hero-stats { gap: 28px; }
    .hero-stats b { font-size: 22px; }
}
