:root {
    --bg: #0f172a;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #0f766e;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #ca8a04;
    --shadow: 0 18px 50px rgba(15, 23, 42, .12);
    --radius: 18px;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body.admin-body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, rgba(37, 99, 235, .17), transparent 34rem), #eef2f7;
    color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 24px;
    padding: 14px 28px;
    background: rgba(15, 23, 42, .94);
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
    backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: -.02em; }
.brand a { color: #fff; text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center; color: #ef4444; filter: drop-shadow(0 0 8px rgba(239,68,68,.8)); }
.topnav { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.topnav a { color: rgba(255,255,255,.82); font-weight: 700; font-size: 14px; }
.topnav a:hover { color: #fff; text-decoration: none; }
.user-pill { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.08); font-size: 13px; font-weight: 800; }
.user-pill span { font-size: 11px; font-weight: 600; color: rgba(255,255,255,.62); }
.container { width: min(1480px, calc(100% - 42px)); margin: 28px auto 48px; }
.footer { width: min(1480px, calc(100% - 42px)); margin: 24px auto; color: var(--muted); display: flex; justify-content: space-between; font-size: 13px; }
.hero-panel, .page-heading {
    border-radius: 28px;
    padding: 30px;
    background: linear-gradient(135deg, #111827, #1d4ed8 55%, #0f766e);
    color: #fff;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}
.hero-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.page-heading { background: linear-gradient(135deg, #111827, #1e293b); }
.page-heading.with-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.page-heading h1, .hero-panel h1 { margin: 0; font-size: clamp(30px, 4vw, 54px); line-height: .95; letter-spacing: -.05em; }
.page-heading p, .hero-panel p { margin: 10px 0 0; color: rgba(255,255,255,.78); max-width: 760px; }
.eyebrow, .kicker { margin: 0 0 8px; text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 900; color: #60a5fa; }
.card {
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(226,232,240,.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 22px;
}
.auth-card { min-height: 68vh; display: grid; grid-template-columns: 1.15fr .85fr; gap: 26px; align-items: center; }
.auth-card h1 { margin: 0; font-size: clamp(38px, 6vw, 76px); line-height: .9; letter-spacing: -.06em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.btn, button.btn {
    appearance: none;
    border: 0;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    font-weight: 900;
    cursor: pointer;
    text-decoration: none !important;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 10px 24px rgba(37,99,235,.28); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.secondary { background: #e0f2fe; color: #075985; }
.btn.ghost { background: #f1f5f9; color: #0f172a; }
.btn.tiny { padding: 7px 10px; font-size: 12px; border-radius: 9px; }
.hero-actions, .form-actions, .export-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-grid { display: grid; gap: 16px; }
.form-grid.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.compact-form { max-width: 520px; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 900; color: #334155; }
input, select, textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
    color: var(--text);
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
textarea { resize: vertical; }
.wide { grid-column: 1 / -1; }
.divider-title { padding-top: 10px; border-top: 1px solid var(--border); margin: 6px 0 0; }
.switches { display: grid; gap: 8px; align-content: end; }
.switches label { display: flex; align-items: center; gap: 8px; }
.switches input { width: auto; }
.inline-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.alert { padding: 13px 15px; border-radius: 14px; margin-bottom: 16px; font-weight: 800; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 22px; }
.stat-card { background: #fff; border-radius: 20px; padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.stat-card span { color: var(--muted); font-weight: 900; text-transform: uppercase; letter-spacing: .09em; font-size: 12px; }
.stat-card strong { display: block; font-size: 44px; line-height: 1; margin: 10px 0 6px; letter-spacing: -.04em; }
.stat-card small { color: var(--muted); }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-title-row h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.table-wrap { overflow: auto; border-radius: 14px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: #fff; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: #475569; background: #f8fafc; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafc; }
.empty { text-align: center; color: var(--muted); padding: 32px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; font-weight: 900; }
.actions.stacked { flex-direction: column; gap: 6px; }
.status { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 900; text-transform: uppercase; }
.status.draft { background: #f1f5f9; color: #475569; }
.status.active { background: #dcfce7; color: #166534; }
.status.finished { background: #dbeafe; color: #1d4ed8; }
.status.archived, .status.withdrawn { background: #fee2e2; color: #991b1b; }
.search-row { display: flex; gap: 10px; margin-bottom: 16px; }
.search-row input { flex: 1; }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pill { border: 0; border-radius: 999px; padding: 9px 13px; background: #f1f5f9; color: #334155; font-weight: 900; cursor: pointer; }
.pill.active { background: var(--primary); color: #fff; }
.copy-input { font-size: 12px; min-width: 280px; background: #f8fafc; color: #475569; }
.copy-input.large { min-width: 100%; font-weight: 800; }
.kiosk-link-box { display: grid; gap: 10px; grid-template-columns: auto 1fr auto; align-items: center; padding: 14px; border-radius: 14px; background: #f8fafc; border: 1px solid var(--border); }
.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-two.unequal { grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); }
.live-card { background: linear-gradient(135deg, #eff6ff, #ecfeff); }
.badge { padding: 8px 11px; background: #eff6ff; color: #1d4ed8; border-radius: 999px; font-weight: 900; font-size: 13px; }
.series-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.series-grid small { color: var(--muted); font-weight: 700; }
.shot-input { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-weight: 800; }

.score-count-editor { margin-top: 10px; }
.compact-score-table th, .compact-score-table td { text-align: center; padding: 8px 6px; }
.compact-score-table th:first-child, .compact-score-table td:first-child { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; }
.count-input { width: 56px; text-align: center; font-weight: 900; font-size: 15px; padding: 8px 6px; border-radius: 10px; }
.count-input:focus { box-shadow: 0 0 0 4px rgba(37,99,235,.14); }
.shots-count, .series-total { font-size: 16px; font-weight: 1000; }
.score-row-warning { background: #fff7ed !important; outline: 2px solid #fb923c; }

.hint { color: var(--muted); background: #f8fafc; border: 1px dashed #cbd5e1; padding: 12px; border-radius: 12px; }
.score-table th, .score-table td { white-space: nowrap; }
.score-big { font-size: 22px; font-weight: 1000; color: #0f172a; }
.series-mini { display: flex; gap: 5px; flex-wrap: wrap; }
.series-mini span { min-width: 34px; text-align: center; border-radius: 8px; background: #f1f5f9; padding: 4px 6px; font-weight: 900; }
.selected-row { outline: 3px solid rgba(37,99,235,.18); background: #eff6ff !important; }
.mini-form { display: grid; grid-template-columns: repeat(3, 82px); gap: 6px; min-width: 280px; }
.mini-form input, .mini-form select { padding: 7px 8px; font-size: 12px; border-radius: 8px; }
.link-danger { border: 0; background: transparent; color: var(--danger); padding: 0; font: inherit; font-weight: 900; cursor: pointer; }
.link-danger:hover { text-decoration: underline; }
@media (max-width: 980px) {
    .topbar { flex-wrap: wrap; }
    .topnav { order: 3; width: 100%; overflow: auto; margin-left: 0; }
    .auth-card, .grid-two.unequal, .grid-two, .form-grid.two-cols, .stat-grid { grid-template-columns: 1fr; }
    .hero-panel, .page-heading.with-actions { flex-direction: column; align-items: flex-start; }
    .series-grid { grid-template-columns: 1fr; }
    .inline-fields { grid-template-columns: 1fr; }
    .kiosk-link-box { grid-template-columns: 1fr; }
    .container { width: min(100% - 24px, 1480px); }
}

/* Entrada de puntuaciones tipo Excel */
.excel-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 10px 0 8px;
    font-size: 12px;
    color: #475569;
    font-weight: 800;
}
.excel-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    background: #dcfce7;
    color: #166534;
    font-weight: 1000;
}
.excel-score-grid {
    border: 1px solid #94a3b8;
    border-radius: 10px;
    overflow: auto;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(148,163,184,.2);
}
.excel-score-table {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
    table-layout: fixed;
}
.excel-score-table th,
.excel-score-table td {
    border: 1px solid #cbd5e1;
    padding: 0;
    height: 34px;
    vertical-align: middle;
    background: #fff;
}
.excel-score-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    height: 32px;
    background: #e2e8f0;
    color: #0f172a;
    text-align: center;
    font-size: 11px;
    letter-spacing: .04em;
}
.excel-score-table th:first-child,
.excel-score-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    width: 92px;
    min-width: 92px;
    padding: 0 8px;
    background: #f8fafc;
    text-align: left;
    font-size: 12px;
}
.excel-score-table thead th:first-child {
    z-index: 5;
    background: #cbd5e1;
}
.excel-score-table th:nth-last-child(2),
.excel-score-table th:last-child,
.excel-score-table td:nth-last-child(2),
.excel-score-table td:last-child {
    width: 72px;
    min-width: 72px;
    text-align: center;
    font-weight: 1000;
    background: #f8fafc;
}
.excel-score-table td[data-col],
.excel-score-table th[data-col] {
    width: 64px;
    min-width: 64px;
    text-align: center;
}
.excel-cell.count-input {
    width: 100%;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 0;
    text-align: center;
    font-size: 15px;
    font-weight: 900;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: transparent;
    color: #0f172a;
    outline: none;
    box-shadow: none;
}
.excel-cell.count-input:focus,
.excel-cell.excel-active-cell {
    background: #eff6ff;
    box-shadow: inset 0 0 0 3px #2563eb;
}
.excel-score-table .excel-active-row td {
    background: #f8fbff;
}
.excel-score-table .excel-active-row td:first-child {
    background: #dbeafe;
    color: #1d4ed8;
}
.excel-score-table .excel-active-col {
    background: #eef2ff !important;
}
.excel-score-table .excel-active-row .excel-active-col {
    background: #eff6ff !important;
}
.excel-score-table .score-row-complete td:first-child {
    border-left: 5px solid #22c55e;
}
.excel-score-table .score-row-warning td:first-child {
    border-left: 5px solid #f97316;
}
.excel-score-table .shots-count,
.excel-score-table .series-total {
    font-size: 14px;
}
@media (max-width: 980px) {
    .excel-toolbar { gap: 6px; }
    .excel-toolbar span:not(.excel-pill) { display: none; }
}

/* v9: gestion de tipos y nombres de series */
.series-label-box {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
    background: #f8fafc;
}
.compact-title-row { margin-bottom: 10px; }
.compact-title-row h2 { font-size: 18px; }
.series-label-table th,
.series-label-table td { padding: 8px 10px; vertical-align: middle; }
.series-label-table th:first-child,
.series-label-table td:first-child { width: 70px; text-align: center; }
.series-label-table input { padding: 8px 10px; border-radius: 9px; }
.excel-score-table td:first-child small {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    margin-top: 2px;
}
