:root {
    --sky: #eef5fb;
    --mint: #e4f0e8;
    --sage: #b9c6a4;
    --sage-deep: #9aab7e;
    --brown: #6b4a32;
    --taken: #6a4a33;
    --wood: #5e4e37;
    --text: #4a3228;
    --peach: #f6d4c4;
    --peach-deep: #e8b89e;
    --paper: #fffdf8;
    --white: #ffffff;
    --shadow: 0 12px 30px rgba(74, 50, 40, 0.12);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    font-family: Nunito, "Segoe UI", sans-serif;
    color: var(--text);
    background-color: #c5d6c6;
    background-image: url("../img/fundo-site.png");
    background-repeat: no-repeat;
    background-position: center top;
    background-size: cover;
    background-attachment: fixed;
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 22vh 16px 48px;
}

.event-bar {
    background: rgba(255, 253, 248, .82);
    border-radius: 24px;
    padding: 14px 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.hero-kicker {
    margin: 0 0 4px;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-size: 12px;
}

.hero-meta, .hero-place {
    margin: 6px 0 0;
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin: 16px 0;
}

.nav-link,
.btn {
    border: 0;
    border-radius: 999px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    color: var(--text);
    background: var(--white);
}

.nav-link.is-active,
.btn-primary {
    background: var(--peach);
    color: var(--brown-dark, var(--text));
}

.btn-secondary { background: #efe3d4; }
.btn-ghost { background: transparent; }
.btn-danger { background: #f3d5d0; }
.btn-small { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.logout-form { margin-left: auto; }

.flash {
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-weight: 700;
}
.flash-ok { background: #dcead3; }
.flash-error { background: #f7d9d4; }

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

.stat-card {
    background: var(--paper);
    border-radius: 20px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.stat-card span { display: block; font-size: 13px; }
.stat-card strong { font-size: 34px; line-height: 1.1; }
.stat-card small { color: #7a5a4a; }

.panel {
    background: rgba(255, 253, 248, .86);
    border-radius: 28px;
    padding: 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}

.cartela-panel {
    background: rgba(255, 253, 248, .72);
}

.panel-head { margin-bottom: 14px; }
.panel-head p { margin: 8px 0 0; }
.panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.pill {
    display: inline-block;
    margin: 0;
    background: var(--peach);
    border-radius: 999px;
    padding: 8px 18px;
    font-size: 18px;
}

.table-wrap { overflow-x: auto; }

.gift-table {
    width: 100%;
    border-collapse: collapse;
}

.gift-table th,
.gift-table td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid #eadfd3;
    vertical-align: middle;
}

.gift-table tr.is-done td { opacity: .62; }

.bar {
    height: 10px;
    background: #efe6da;
    border-radius: 999px;
    overflow: hidden;
    min-width: 90px;
}

.bar span {
    display: block;
    height: 100%;
    background: var(--sage-deep);
}

.cartela-sheet {
    position: relative;
    width: min(540px, 100%);
    margin: 0 auto;
    aspect-ratio: 1080 / 1920;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    background: #d7e4d6;
    container-type: inline-size;
}

.cartela-bg {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.cartela-overlay {
    position: absolute;
    left: 12%;
    right: 12%;
    top: 34%;
    bottom: 11%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 0;
}

.cartela-prize {
    text-align: center;
    font-weight: 800;
    margin: 0;
    font-size: clamp(11px, 3.4cqi, 16px);
    color: var(--text);
    text-shadow: 0 1px 0 rgba(255,255,255,.7);
    flex: 0 0 auto;
}

.cartela-card {
    width: 100%;
    max-height: 100%;
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .55);
    border-radius: 22px;
    padding: 10px 8px;
}

.cartela-grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    grid-template-rows: repeat(15, minmax(0, 1fr));
    gap: 3px;
    height: 100%;
    width: auto;
    aspect-ratio: 10 / 15;
    max-width: 100%;
    max-height: 100%;
}

.bola {
    aspect-ratio: 1;
    width: 82%;
    height: auto;
    max-height: 82%;
    margin: auto;
    border: 0;
    border-radius: 50%;
    background: var(--sage);
    color: #fff;
    font: inherit;
    font-weight: 800;
    font-size: clamp(7px, 2.8cqi, 12px);
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: inset 0 -2px 0 rgba(74, 50, 40, .12);
    padding: 0;
    line-height: 1;
}

.bola.ocupado { background: var(--taken); cursor: default; }
.bola.disponivel:hover { filter: brightness(1.05); transform: scale(1.04); }

.legend { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.dot-free { background: var(--sage); }
.dot-taken { background: var(--taken); }

.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

input, select {
    font: inherit;
    color: var(--text);
    border: 1px solid #ddcfc2;
    border-radius: 14px;
    padding: 10px 12px;
    background: #fff;
    width: 100%;
}

.filters input, .filters select { width: auto; min-width: 180px; flex: 1; }

label {
    display: grid;
    gap: 6px;
    font-weight: 800;
    margin-bottom: 12px;
}

.empty {
    background: #f4eee6;
    border-radius: 16px;
    padding: 18px;
}

.num-chip {
    display: inline-grid;
    place-items: center;
    min-width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--taken);
    color: #fff;
    font-weight: 800;
}

.status {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 800;
    font-size: 13px;
}
.status-ok { background: #dcead3; }
.status-wait { background: var(--peach); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; }

.site-footer {
    text-align: center;
    margin-top: 12px;
    color: #6d5346;
}

.modal {
    border: 0;
    padding: 0;
    background: transparent;
}
.modal::backdrop { background: rgba(74, 50, 40, .45); }
.modal-card {
    width: min(460px, 100vw - 24px);
    background: var(--paper);
    border-radius: 24px;
    padding: 22px;
    box-shadow: var(--shadow);
}
.modal-help { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.modal-empty { background: #f7e6d8; padding: 10px 12px; border-radius: 12px; }

.login-wrap {
    max-width: 460px;
    margin: 0 auto;
    padding: 22vh 16px 40px;
}
.login-card { width: 100%; }

.print-toolbar {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 16px;
}

.print-body .cartela-sheet {
    width: min(540px, 92vw);
    margin: 0 auto 32px;
}

.art-grid .bola { cursor: default; }

@media (max-width: 800px) {
    .stats { grid-template-columns: 1fr; }
    .cartela-grid { gap: 3px; }
    .bola { font-size: 10px; }
    .gift-table thead { display: none; }
    .gift-table tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px;
        padding: 12px 0;
        border-bottom: 1px solid #eadfd3;
    }
    .gift-table td {
        border: 0;
        padding: 4px 0;
    }
    .gift-table td[data-label="Presente"],
    .gift-table td[data-label="Ações"] {
        grid-column: 1 / -1;
    }
    .gift-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        text-transform: uppercase;
        opacity: .7;
    }
}

@media print {
    .print-toolbar, .nav, .site-footer { display: none !important; }
    body.print-body { background: #fff; }
    .print-body .cartela-sheet {
        width: 100%;
        max-width: 420px;
        box-shadow: none;
        margin: 0 auto;
    }
}
