/* Resultados Lotería Santa Lucía — versión 2 */
:root {
    --ink: #344760;
    --ink-strong: #20334d;
    --muted: #66758a;
    --line: #d7dfe8;
    --soft: #f5f7fa;
    --white: #ffffff;
    --primary: #0b7ff5;
    --primary-dark: #0668ca;
    --secondary: #6e7883;
    --success: #147a43;
    --success-bg: #eaf7ef;
    --warning: #8a5b00;
    --warning-bg: #fff6dc;
    --error: #a62d36;
    --error-bg: #fff0f1;
    --radius: 16px;
    --shadow: 0 10px 28px rgba(25, 48, 77, .08);
    --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: #fff;
    line-height: 1.55;
    overflow-x: hidden;
}
img {
    max-width: 100%;
    height: auto;
}
a { color: var(--primary-dark); }
button, input { font: inherit; }
.wrap { width: min(calc(100% - 36px), var(--max)); margin-inline: auto; }
.page-space { padding-block: 38px 56px; }

.skip-link {
    position: absolute;
    left: 12px;
    top: -80px;
    z-index: 1000;
    padding: 10px 14px;
    background: #000;
    color: #fff;
    border-radius: 8px;
}
.skip-link:focus { top: 12px; }

.site-header {
    background: linear-gradient(135deg, #f8fbff, #eef5fd);
    border-bottom: 1px solid var(--line);
    padding: 42px 0;
}
.site-header.compact { padding: 28px 0; }
.header-inner { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.site-header h1 { margin: 4px 0 8px; color: var(--ink-strong); font-size: clamp(2rem, 4vw, 3.3rem); line-height: 1.05; }
.header-copy { margin: 0; color: var(--muted); font-size: 1.05rem; }
.eyebrow {
    margin: 0;
    color: var(--primary-dark);
    font-weight: 750;
    font-size: .82rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.back-link { display: inline-block; margin-bottom: 18px; font-weight: 650; text-decoration: none; }

h1, h2, h3 { color: var(--ink-strong); }
h2 { margin: 4px 0 8px; line-height: 1.2; }
h3 { margin: 4px 0; }
p { margin-top: .4rem; }

.intro-card, .search-card, .admin-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.intro-card {
    display: grid;
    grid-template-columns: 1fr minmax(260px, 380px);
    gap: 32px;
    align-items: end;
    padding: 26px;
    margin-bottom: 34px;
}
.filter-box { display: grid; gap: 7px; }
.filter-box.small { min-width: 260px; }
.filter-box label, .stack-form label { font-weight: 700; color: var(--ink-strong); }
input[type="text"], input[type="search"], input[type="password"], input[type="file"] {
    width: 100%;
    border: 1px solid #c8d2de;
    border-radius: 9px;
    padding: 12px 14px;
    background: #fff;
    color: var(--ink-strong);
}
input:focus, button:focus, a:focus {
    outline: 3px solid rgba(11,127,245,.24);
    outline-offset: 2px;
}
.draw-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}
.draw-grid > * { min-width: 0; }
.draw-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
    min-height: 280px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 8px 20px rgba(25,48,77,.05);
}
.draw-type { margin: 0; color: var(--primary-dark); font-weight: 700; }
.draw-card h3 { font-size: 1.55rem; }
.meta-list { margin: 20px 0 0; display: grid; gap: 12px; }
.meta-list div { display: grid; gap: 2px; }
.meta-list dt { color: var(--muted); font-size: .85rem; }
.meta-list dd { margin: 0; font-weight: 650; color: var(--ink-strong); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 18px;
    border: 0;
    border-radius: 9px;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.secondary { background: var(--secondary); color: #fff; }
.btn.full { width: 100%; }

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 22px;
    margin: 36px 0 18px;
}
.list-heading { align-items: center; }

.search-card { padding: 26px; }
.search-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto;
    gap: 12px;
    margin-top: 18px;
}
.search-form input { min-height: 50px; }
.helper { color: var(--muted); font-size: .92rem; }

.result-box {
    margin-top: 20px;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--line);
}
.result-box.success { background: var(--success-bg); border-color: #b9dfc7; }
.result-box.error { background: var(--error-bg); border-color: #efbec3; color: var(--error); }
.result-box.neutral { background: var(--soft); }
.result-kicker { margin: 0 0 8px; font-weight: 750; color: var(--success); }
.result-prize { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.result-number { font-size: 2rem; letter-spacing: .05em; color: var(--ink-strong); }
.result-amount { font-size: 1.35rem; font-weight: 800; }
.status-text { font-weight: 700; }
.seller { margin-bottom: 0; }

.major-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.major-card {
    border-radius: 14px;
    padding: 20px;
    background: #f7fbff;
    border: 1px solid #cfe4fb;
}
.major-card p { margin: 0 0 6px; color: var(--primary-dark); font-weight: 750; }
.major-card strong { display: block; font-size: 1.75rem; letter-spacing: .05em; }
.major-card span { display: block; font-size: 1.15rem; font-weight: 800; }
.major-card small { display: inline-block; margin-top: 8px; color: var(--muted); font-weight: 700; }

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.results-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
.results-table th, .results-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #e7ecf1;
    white-space: nowrap;
}
.results-table th {
    position: sticky;
    top: 0;
    background: #f7f9fb;
    color: var(--ink-strong);
    font-size: .85rem;
    z-index: 1;
}
.results-table tbody tr:last-child td { border-bottom: 0; }
.results-table tbody tr:hover { background: #fbfdff; }
.ticket { font-variant-numeric: tabular-nums; letter-spacing: .05em; font-weight: 750; }
.pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e8f2ff;
    color: #075fae;
    font-weight: 800;
    font-size: .8rem;
}

.notice, .empty-state, .expired-state {
    margin-top: 34px;
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--soft);
}
.secondary-notice { background: #fff; }
.empty-state, .expired-state { text-align: center; padding-block: 48px; }
.empty-inline { padding: 16px; background: var(--soft); border-radius: 10px; }
.site-footer {
    border-top: 1px solid var(--line);
    background: #f7f9fb;
    color: var(--muted);
    padding: 28px 0;
    font-size: .9rem;
}
.sr-only {
    position: absolute!important;
    width: 1px!important;
    height: 1px!important;
    padding: 0!important;
    margin: -1px!important;
    overflow: hidden!important;
    clip: rect(0,0,0,0)!important;
    white-space: nowrap!important;
    border: 0!important;
}

/* Administración */
.admin-body { background: #f5f7fa; }
.admin-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 16px 0;
}
.admin-nav { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.admin-nav nav { display: flex; flex-wrap: wrap; gap: 18px; }
.admin-nav nav a { font-weight: 700; text-decoration: none; }
.admin-main { padding-block: 34px 56px; }
.admin-hero { margin-bottom: 24px; }
.admin-hero h1 { margin-bottom: 4px; }
.admin-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; margin-bottom: 22px; }
.admin-card { padding: 24px; margin-bottom: 22px; }
.admin-card.narrow { max-width: 620px; margin-inline: auto; }
.stack-form { display: grid; gap: 16px; margin-top: 20px; }
.stack-form label { display: grid; gap: 7px; }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; }
.steps { margin: 0; padding-left: 1.2rem; }
.steps li + li { margin-top: 8px; }
.flash {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
}
.flash.success { background: var(--success-bg); border-color: #b9dfc7; color: #16673c; }
.flash.warning { background: var(--warning-bg); border-color: #efd895; color: var(--warning); }
.flash.error { background: var(--error-bg); border-color: #efbec3; color: var(--error); }
.requirements { display: grid; gap: 8px; margin: 20px 0; }
.requirement { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 8px; }
.requirement.ok { background: var(--success-bg); }
.requirement.bad { background: var(--error-bg); }
.summary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0,1fr));
    gap: 12px;
    margin: 20px 0 22px;
}
.summary-stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
}
.summary-stat span { display: block; color: var(--muted); font-size: .8rem; }
.summary-stat strong { display: block; margin-top: 4px; color: var(--ink-strong); font-size: 1.05rem; }
.badge {
    display: inline-flex;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
}
.badge.active { background: var(--success-bg); color: var(--success); }
.badge.expired { background: #eceff3; color: #5d6670; }
.check-row {
    display: flex!important;
    grid-template-columns: none!important;
    gap: 10px!important;
    align-items: flex-start;
}
.check-row input { width: auto; margin-top: 4px; }

@media (max-width: 900px) {
    .draw-grid, .major-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .intro-card, .admin-grid { grid-template-columns: 1fr; }
    .summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 620px) {
    .wrap { width: min(calc(100% - 24px), var(--max)); }
    .site-header { padding: 30px 0; }
    .header-inner, .section-heading, .admin-nav { align-items: flex-start; flex-direction: column; }
    .draw-grid, .major-grid, .summary-grid { grid-template-columns: 1fr; }
    .search-form { grid-template-columns: 1fr; }
    .filter-box.small { min-width: 0; width: 100%; }
    .draw-card { min-height: 0; }
    .results-table th, .results-table td { padding: 10px 9px; font-size: .9rem; }
}

/* ===== Identidad institucional / versión de producción ===== */
:root {
    --brand-purple: #7859a6;
    --brand-purple-dark: #5f438c;
    --brand-purple-soft: #f2eef8;
    --brand-black: #1b1b1b;
    --brand-red: #c8202f;
    --primary: var(--brand-purple);
    --primary-dark: var(--brand-purple-dark);
    --ink: #3f4350;
    --ink-strong: var(--brand-black);
}

body { background: #fff; }

.site-header.institutional-header {
    background: linear-gradient(135deg, #ffffff 0%, var(--brand-purple-soft) 68%, #ebe4f4 100%);
    border-top: 6px solid var(--brand-black);
    border-bottom: 1px solid #ddd5e7;
    padding: 28px 0;
}
.site-header.institutional-header.compact { padding: 20px 0; }
.brand-header {
    display: flex;
    align-items: center;
    gap: clamp(22px, 5vw, 52px);
}
.brand-logo-link { flex: 0 0 auto; display: block; line-height: 0; }
.brand-logo {
    display: block;
    width: clamp(125px, 16vw, 185px);
    height: auto;
    border-radius: 18px;
    background: #fff;
}
.brand-logo.compact-logo { width: clamp(100px, 12vw, 138px); }
.brand-copy { min-width: 0; }
.site-header.institutional-header h1 {
    color: var(--brand-black);
    max-width: 860px;
}
.site-header.institutional-header .eyebrow { color: var(--brand-purple-dark); }
.site-header.institutional-header .back-link { color: var(--brand-black); }

.btn.primary { background: var(--brand-purple); }
.btn.primary:hover { background: var(--brand-purple-dark); }
input:focus, button:focus, a:focus { outline-color: rgba(120, 89, 166, .28); }

.intro-card { border-top: 4px solid var(--brand-purple); }
.draw-card { border-top: 4px solid var(--brand-purple); }
.draw-card:hover { box-shadow: 0 12px 28px rgba(44, 30, 67, .11); transform: translateY(-1px); }
.type-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .055em;
    margin-bottom: 10px;
}
.type-badge.ordinario { background: var(--brand-purple-soft); color: var(--brand-purple-dark); }
.type-badge.extraordinario { background: #f7eeee; color: #8e1721; border: 1px solid #ecc7cb; }

.result-box.success {
    background: #f5f0fa;
    border-color: #d6c6e8;
    border-left: 5px solid var(--brand-purple);
}
.result-kicker { color: var(--brand-purple-dark); font-size: 1.05rem; }
.result-number { color: var(--brand-black); }
.pill { background: #eee7f6; color: var(--brand-purple-dark); }
.code-meaning { color: var(--muted); font-weight: 650; }
.whole-ticket-note, .prize-general-note {
    margin-top: 18px;
    padding: 12px 14px;
    background: #fff;
    border-left: 4px solid var(--brand-red);
    border-radius: 6px;
    color: var(--brand-black);
}
.prize-general-note { border: 1px solid #e3d8ed; border-left: 4px solid var(--brand-red); }

.major-card {
    background: var(--brand-purple-soft);
    border-color: #d9cce8;
}
.major-card p { color: var(--brand-purple-dark); }

.nomenclature-section { margin-top: 42px; }
.nomenclature-details {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.nomenclature-details > summary {
    cursor: pointer;
    padding: 18px 22px;
    font-weight: 800;
    color: var(--brand-black);
    background: var(--brand-purple-soft);
    list-style-position: inside;
}
.nomenclature-details[open] > summary { border-bottom: 1px solid #ded4e8; }
.basic-codes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    padding: 18px 22px 0;
}
.basic-codes span { color: var(--ink); }
.nomenclature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    padding: 20px 22px;
}
.nomenclature-card {
    border: 1px solid #ddd5e7;
    border-radius: 12px;
    overflow: hidden;
}
.nomenclature-card h3 {
    margin: 0;
    padding: 12px 14px;
    background: var(--brand-black);
    color: #fff;
    font-size: 1rem;
}
.nomenclature-card dl { margin: 0; }
.nomenclature-card dl > div {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid #ece8f0;
}
.nomenclature-card dl > div:last-child { border-bottom: 0; }
.nomenclature-card dt { color: var(--brand-purple-dark); font-weight: 850; }
.nomenclature-card dd { margin: 0; }
.nomenclature-notes {
    padding: 2px 22px 18px;
    border-top: 1px solid #eee9f2;
    font-size: .92rem;
}
.nomenclature-notes p { margin-bottom: 0; }

.historical-card {
    background: #f7f5f8;
    border-top: 5px solid var(--brand-black);
}
.historical-card .eyebrow { color: var(--brand-purple-dark); }

.site-footer { border-top: 4px solid var(--brand-purple); background: var(--brand-black); color: #ddd; }
.site-footer a { color: #fff; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; align-items: center; }

.admin-header { border-top: 5px solid var(--brand-purple); }
.badge.active { background: #eaf7ef; color: #147a43; }
.badge.expired { background: #f1f1f1; color: #666; }

@media (max-width: 900px) {
    .nomenclature-grid { grid-template-columns: 1fr; }
    .brand-header { align-items: flex-start; }
}

@media (max-width: 680px) {
    .brand-header { flex-direction: column; gap: 16px; }
    .brand-logo { width: 118px; }
    .brand-logo.compact-logo { width: 96px; }
    .site-header.institutional-header { padding: 20px 0; }
    .footer-inner { flex-direction: column; align-items: flex-start; }
    .nomenclature-grid { padding: 14px; }
    .basic-codes { padding: 16px 14px 0; }
    .nomenclature-notes { padding: 2px 14px 16px; }
    .nomenclature-card dl > div { grid-template-columns: 78px 1fr; }
    .code-meaning { flex-basis: 100%; }
}


/* ============================================================
   Imágenes oficiales de cachitos — V6
   ============================================================ */
.draw-card.has-cachito { padding: 0; overflow: hidden; }
.draw-card.has-cachito .draw-card-content { padding: 0 22px; }
.draw-card.has-cachito > .btn { margin: 0 22px 22px; width: calc(100% - 44px); }
.draw-cachito-thumb-link {
    display: block;
    background: #f2f4f7;
    border-bottom: 1px solid var(--line);
    line-height: 0;
    overflow: hidden;
}
.draw-cachito-thumb {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: auto;
    object-fit: contain;
    object-position: center;
    background: #fff;
}
.cachito-hero-card {
    margin-bottom: 28px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}
.cachito-hero-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 720px;
    object-fit: contain;
    object-position: center;
    background: #fff;
}
.cachito-hero-caption {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 14px 18px;
    border-top: 1px solid var(--line);
    background: #fafbfc;
}
.cachito-hero-caption strong { color: var(--ink-strong); }
.cachito-hero-caption span { color: var(--muted); font-size: .92rem; text-align: right; }
.cachito-admin-cell { min-width: 260px; }
.cachito-upload-form { display: grid; grid-template-columns: 1fr auto; gap: 7px; align-items: center; margin-top: 7px; }
.cachito-upload-form input[type="file"] { padding: 7px; font-size: .8rem; }
.btn.mini { min-height: 36px; padding: 6px 10px; font-size: .82rem; }
.image-status { display: inline-block; font-size: .82rem; font-weight: 750; }
.image-status.has-image { color: var(--success); }
.image-status.no-image { color: var(--muted); }
.optional-label { color: var(--muted); font-weight: 500; }
.cachito-preview-card { text-align: center; }
.cachito-preview-image { display: block; max-width: 820px; width: 100%; height: auto; margin: 14px auto 0; border-radius: 12px; border: 1px solid var(--line); }
@media (max-width: 720px) {
    .cachito-hero-caption { display: grid; }
    .cachito-hero-caption span { text-align: left; }
    .cachito-upload-form { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .draw-card,
    .search-card,
    .intro-card,
    .notice,
    .cachito-hero-card {
        max-width: 100%;
        overflow: hidden;
    }
    .draw-cachito-thumb {
        max-height: 220px;
        object-fit: contain;
    }
    .cachito-hero-image {
        max-height: none;
    }
    .cachito-hero-caption {
        padding: 12px 14px;
    }
}
