/* ============================================================
   CREDENCIAMENTO — Design System base (mobile-first)
   ============================================================ */

:root {
    --primary: #128C4B;        /* verde Credenza (AA sobre branco) */
    --primary-dark: #0B6B38;
    --primary-soft: #E7F7EE;
    --noite: #0E2A24;           /* verde-noite do topo */
    --zap: #25D366;
    --success: #16a34a;
    --success-soft: #f0fdf4;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --info: #2563eb;

    --bg: #EFF4F1;
    --surface: #ffffff;
    --text: #12211C;
    --text-muted: #52655C;
    --border: #D9E4DE;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .07), 0 8px 24px rgba(15, 23, 42, .06);
    --shadow-lg: 0 10px 40px rgba(15, 23, 42, .14);

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }

.muted { color: var(--text-muted); font-size: .9rem; }

/* ---------- Layout ---------- */

.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 1rem;
}

.page-head { margin: .5rem 0 1.25rem; }

.grid { display: grid; gap: 1rem; }
@media (min-width: 700px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 480px) and (max-width: 699px) {
    .grid-4 { grid-template-columns: 1fr 1fr; }
}

.progress {
    background: var(--border);
    border-radius: 999px;
    height: 7px;
    margin-top: .45rem;
    overflow: hidden;
}
.progress-bar {
    background: var(--primary);
    height: 100%;
    border-radius: 999px;
    transition: width .4s ease;
}

.stack > * + * { margin-top: 1rem; }

/* ---------- Topbar ---------- */

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: .6rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    color: var(--text);
    font-size: 1.02rem;
}
.brand:hover { text-decoration: none; }

.brand-badge {
    background: var(--primary-soft);
    border-radius: 10px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    font-size: 1.05rem;
}

.topnav {
    display: flex;
    gap: .25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.topnav a {
    color: var(--text-muted);
    padding: .45rem .7rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: .92rem;
    white-space: nowrap;
}
.topnav a:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }

.topbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.user-name { font-size: .88rem; color: var(--text-muted); display: none; }
@media (min-width: 600px) { .user-name { display: inline; } }

/* ---------- Cards ---------- */

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

.stat-card { display: flex; flex-direction: column; gap: .15rem; }
.stat-label { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1.1; }

/* ---------- Formulários ---------- */

.field { display: flex; flex-direction: column; gap: .35rem; }

.field label { font-weight: 600; font-size: .92rem; }

.field input,
.field select,
.field textarea {
    font: inherit;
    padding: .8rem .9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    width: 100%;
    min-height: 48px; /* alvo de toque */
    transition: border-color .15s, box-shadow .15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}

.field .field-error { color: var(--danger); font-size: .85rem; }
.field.has-error input { border-color: var(--danger); }

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    font-size: .9rem;
}
.checkbox-row input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-top: .1rem;
    accent-color: var(--primary);
    flex-shrink: 0;
}

/* ---------- Botões ---------- */

.btn {
    font: inherit;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    padding: .7rem 1.1rem;
    min-height: 46px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    transition: background .15s, transform .05s;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); }

.btn-lg { min-height: 56px; font-size: 1.05rem; padding: .9rem 1.4rem; }
.btn-sm { min-height: 38px; padding: .4rem .8rem; font-size: .88rem; }
.btn-block { width: 100%; }

.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Alerts ---------- */

.alert {
    padding: .85rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .93rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); color: #14532d; border-color: #bbf7d0; }
.alert-error   { background: var(--danger-soft);  color: #7f1d1d; border-color: #fecaca; }
.alert-warning { background: var(--warning-soft); color: #78350f; border-color: #fde68a; }

/* ---------- Badges de status ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
}
.badge-green  { background: var(--success-soft); color: var(--success); }
.badge-blue   { background: var(--primary-soft); color: var(--primary); }
.badge-red    { background: var(--danger-soft);  color: var(--danger); }
.badge-gray   { background: #f1f5f9; color: var(--text-muted); }
.badge-yellow { background: var(--warning-soft); color: var(--warning); }

/* ---------- Toasts ---------- */

#toast-root {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: .5rem;
    z-index: 200;
    width: min(92vw, 420px);
}

.toast {
    background: #0f172a;
    color: #fff;
    padding: .8rem 1rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: .92rem;
    animation: toast-in .25s ease;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Skeleton loading ---------- */

.skeleton {
    background: linear-gradient(90deg, #e8eaf1 25%, #f3f4f9 50%, #e8eaf1 75%);
    background-size: 200% 100%;
    animation: shimmer 1.3s infinite;
    border-radius: var(--radius-sm);
    min-height: 1rem;
}
@keyframes shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* ---------- Login (guest) ---------- */

.guest-body-old-unused {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--primary) 0%, #7c3aed 100%);
    padding: 1rem;
}

.guest-main { width: 100%; max-width: 400px; }

.auth-card { padding: 1.75rem 1.5rem; box-shadow: var(--shadow-lg); }

.auth-head { text-align: center; margin-bottom: 1.25rem; }
.auth-head h1 { font-size: 1.3rem; }

.auth-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto .6rem;
    background: var(--primary-soft);
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 1.6rem;
}

/* ---------- Tabelas (usadas nas próximas etapas) ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
    background: var(--surface);
}
.table th, .table td {
    text-align: left;
    padding: .7rem .8rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.table tbody tr:hover { background: #fafbff; }


/* ---------- Formulário do evento: abas, uploads e barra de salvar ---------- */

.tabs {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}
.tab-btn {
    font: inherit;
    font-weight: 600;
    font-size: .93rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: .65rem .9rem;
    cursor: pointer;
    color: var(--muted);
    margin-bottom: -2px;
    border-radius: 8px 8px 0 0;
}
.tab-btn:hover { color: var(--text); background: var(--bg); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.event-form input[type="color"] { height: 48px; padding: .3rem; width: 100%; }

.img-preview {
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg);
    margin-bottom: .5rem;
}
.img-preview img { max-height: 130px; max-width: 100%; object-fit: contain; display: block; }
.img-preview.wide img { max-height: 110px; width: 100%; object-fit: cover; }
.img-preview .img-placeholder { display: none; color: var(--muted); font-size: .85rem; }
.img-preview.empty .img-placeholder { display: block; }
.upload-status { display: block; font-size: .85rem; margin-top: .3rem; min-height: 1.1em; }

.form-savebar {
    position: sticky;
    bottom: 0;
    margin-top: 1.25rem !important; /* v3.31.1: respiro entre o último card e a barra */
    background: var(--card, #fff);
    border-top: 1.5px solid var(--border);
    padding: .8rem 1rem;
    margin: 0 -.25rem;
    display: flex;
    gap: .75rem;
    align-items: center;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, .06);
    z-index: 20;
}


/* ---------- Prévia ao vivo do hotsite (form do evento) ---------- */

.hero-preview {
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 1rem .9rem 1.1rem;
    max-width: 380px;
    margin: 0 auto;
    font-size: .72rem;
    transition: background .15s;
}
.hero-preview .pv-topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; margin-bottom: .7rem; }
.hero-preview .pv-daymonth { font-size: 1.15rem; font-weight: 900; line-height: 1; }
.hero-preview .pv-weekday { font-size: .6rem; font-weight: 700; letter-spacing: .05em; margin-top: .15rem; }
.hero-preview .pv-time { font-size: .6rem; font-weight: 800; letter-spacing: .04em; margin-top: .1rem; }
.hero-preview .pv-logo { max-height: 42px; max-width: 40%; object-fit: contain; }
.hero-preview .pv-banner { position: relative; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 6px 16px rgba(0,0,0,.15); }
.hero-preview .pv-banner img { display: block; width: 100%; max-height: 130px; object-fit: cover; }
.hero-preview .pv-chip { background: #1e293b; color: #fff; font-size: .55rem; font-weight: 700; letter-spacing: .04em; padding: .25rem .55rem; border-radius: 999px; display: inline-block; }
.hero-preview .pv-chip-overlay { position: absolute; top: .45rem; left: .45rem; }
.hero-preview .pv-title-small { text-align: center; font-size: .95rem; font-weight: 900; letter-spacing: .04em; margin: .8rem 0 0; }
.hero-preview .pv-title-big { text-align: center; font-size: 1.55rem; font-weight: 900; line-height: 1.05; margin: .1rem 0 0; }
.hero-preview .pv-badge-wrap { text-align: center; margin-top: .5rem; }
.hero-preview .pv-badge { display: inline-block; font-size: .58rem; font-weight: 800; letter-spacing: .05em; padding: .3rem .7rem; border-radius: 999px; box-shadow: 0 3px 8px rgba(0,0,0,.15); }
.hero-preview .pv-message { background: rgba(17,24,39,.78); color: #fff; text-align: center; font-size: .58rem; font-weight: 600; letter-spacing: .03em; line-height: 1.5; border-radius: 9px; padding: .55rem .7rem; margin: .8rem auto 0; max-width: 290px; }
.hero-preview .pv-description { text-align: center; font-size: .65rem; line-height: 1.5; margin: .6rem auto 0; max-width: 300px; }
.hero-preview .pv-card { background: #fff; border-radius: 11px; padding: .8rem .8rem .9rem; margin-top: .9rem; box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.hero-preview .pv-form-title { text-align: center; font-weight: 800; font-size: .8rem; margin: 0 0 .6rem; color: #111827; }
.hero-preview .pv-field { border: 1px solid #e2e8f0; border-radius: 6px; height: 20px; margin-bottom: .45rem; background: #fafafa; }
.hero-preview .pv-button { display: block; width: 100%; border: none; font-weight: 800; font-size: .68rem; padding: .55rem; border-radius: 8px; cursor: default; }
.hero-preview .pv-footlogo { display: block; margin: .9rem auto 0; max-height: 44px; max-width: 55%; object-fit: contain; }


/* ==================== Tema Credenza — topo ==================== */
.topbar { background: var(--noite); border-bottom: none; }
.brand { color: #fff; }
.brand-badge { background: var(--zap); color: #062816; }
.brand-dot { color: var(--zap); font-weight: 800; margin-left: 1px; }
.topnav a { color: rgba(255,255,255,.72); }
.topnav a:hover { background: rgba(255,255,255,.09); color: #fff; }
.topnav a.active { background: rgba(37,211,102,.16); color: var(--zap); }
.topbar-user { color: rgba(255,255,255,.75); }
.topbar-user a, .topbar-user .btn { color: #fff; border-color: rgba(255,255,255,.3); }
.topbar-user .btn:hover { background: rgba(255,255,255,.1); }

/* ==================== Aviso de instalação do PWA ==================== */
.pwa-banner {
    position: fixed;
    left: 12px; right: 12px; bottom: 12px;
    z-index: 60;
    background: var(--noite);
    color: #fff;
    border-radius: 14px;
    padding: .9rem 1rem;
    display: flex;
    align-items: center;
    gap: .8rem;
    box-shadow: 0 16px 40px rgba(0,0,0,.35);
}
.pwa-banner p { margin: 0; font-size: .88rem; line-height: 1.4; flex: 1; }
.pwa-banner .btn { background: var(--zap); color: #062816; font-weight: 800; padding: .55rem 1rem; white-space: nowrap; }
.pwa-banner .pwa-close {
    background: none; border: 0; color: rgba(255,255,255,.6);
    font-size: 1.3rem; line-height: 1; cursor: pointer; padding: .2rem .4rem;
}
@media (min-width: 821px) { .pwa-banner { display: none; } }

/* Topo em uma linha; nav rola horizontalmente quando faltar espaço */
.topbar-inner { flex-wrap: nowrap; gap: .9rem; }
.topnav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav a { white-space: nowrap; padding: .45rem .7rem; }
.topbar-user { flex-shrink: 0; white-space: nowrap; }
.brand { flex-shrink: 0; }

.topbar-gear { font-size: 1.15rem; text-decoration: none; padding: .3rem .45rem; border-radius: 8px; }
.topbar-gear:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.pwa-banner [hidden] { display: none !important; }
.pwa-banner[hidden] { display: none !important; }


/* ==================== Login Credenza ==================== */
.guest-body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: radial-gradient(1000px 600px at 50% -10%, #17453A 0%, var(--noite) 55%);
}
.auth-brand {
    text-align: center;
    color: #fff;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    text-transform: lowercase;
    margin-bottom: 1.1rem;
}
.auth-card { border: none; }

/* Wordmark do topo (padrão da marca) */
.brand-word {
    text-transform: lowercase;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.03em;
}

/* Elementos ocultos nunca reservam espaço (canvas, banners etc.) */
[hidden] { display: none !important; }
/* Cards lado a lado com alturas independentes — sem espaço morto no vazio */
.grid { align-items: start; }
.grid > .card { align-self: stretch; }
.grid-2 > .card { align-self: start; }

/* ==================== Edição de evento ==================== */
.event-form { margin: 0 auto; }
.event-form .card { padding: 1.5rem 1.6rem; }
.event-form .card > h2:first-child,
.event-form .card .stack > h2:first-child {
    font-size: 1.02rem;
    padding-bottom: .7rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.1rem;
}
.tabs { gap: .25rem; border-bottom: 1px solid var(--border); }
.tab-btn { font-weight: 700; padding: .65rem .9rem; border-bottom-width: 3px; }
.tab-btn.active { background: var(--primary-soft); border-radius: 8px 8px 0 0; }
.check-highlight {
    background: var(--primary-soft);
    border: 1px solid #BFE8CF;
    border-radius: 10px;
    padding: .85rem 1rem;
}

/* Topo com muitos itens (seletor de organização): menu mais compacto antes de rolar */
@media (max-width: 1440px) { .topnav a { padding: .45rem .5rem; font-size: .88rem; } }

/* Itens de grid não crescem além da coluna (canvas dos gráficos do painel estourava a largura) */
.grid > * { min-width: 0; }
.grid canvas { max-width: 100%; }
