:root {
    --bg: #0b1020;
    --bg-soft: #121a30;
    --panel: rgba(17, 24, 39, 0.72);
    --panel-solid: #12192c;
    --panel-2: rgba(255,255,255,0.06);
    --text: #eef2ff;
    --muted: #9fb0d0;
    --line: rgba(255,255,255,0.1);
    --primary: #ff6b57;
    --primary-2: #ff8a65;
    --accent: #7c5cff;
    --success: #22c55e;
    --warning: #facc15;
    --danger: #ef4444;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

html[data-theme="light"] {
    --bg: #edf3ff;
    --bg-soft: #dfe8fb;
    --panel: rgba(255,255,255,0.88);
    --panel-solid: #ffffff;
    --panel-2: rgba(15, 23, 42, 0.04);
    --text: #0f172a;
    --muted: #475569;
    --line: rgba(15, 23, 42, 0.08);
    --primary: #f45d48;
    --primary-2: #ff8a65;
    --accent: #6d5efc;
    --shadow: 0 18px 35px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    min-height: 100vh;
    font-family: Inter, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 0% 20%, rgba(124,92,255,0.22), transparent 25%),
        radial-gradient(circle at 100% 0%, rgba(255,107,87,0.18), transparent 28%),
        linear-gradient(140deg, var(--bg) 0%, var(--bg-soft) 55%, var(--bg) 100%);
}
a { color: inherit; }
img { max-width: 100%; }

.glass, .card {
    background: var(--panel);
    border: 1px solid var(--line);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
    border-radius: var(--radius-xl);
}
.card { padding: 24px; }

.btn {
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 800;
    transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    box-shadow: 0 10px 24px rgba(255,107,87,.28);
}
.btn.secondary {
    color: var(--text);
    background: rgba(255,255,255,.08);
    border: 1px solid var(--line);
}
.btn.ghost {
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line);
}
.w-full { width: 100%; }

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    margin: 0 0 18px;
    border: 1px solid var(--line);
}
.alert.success { background: rgba(34,197,94,.12); color: #87f4af; }
.alert.error { background: rgba(239,68,68,.12); color: #ffaba2; }
html[data-theme="light"] .alert.success { color: #166534; }
html[data-theme="light"] .alert.error { color: #991b1b; }

.form-stack { display: grid; gap: 12px; }
.form-stack label { font-weight: 700; color: var(--muted); }
.form-stack input,
.form-stack select,
.form-stack textarea {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.05);
    color: var(--text);
    padding: 14px 16px;
    outline: none;
}
html[data-theme="light"] .form-stack input,
html[data-theme="light"] .form-stack select,
html[data-theme="light"] .form-stack textarea {
    background: rgba(15,23,42,.03);
}
input::placeholder, textarea::placeholder { color: #94a3b8; }

.login-body, .register-body {
    display: grid;
    place-items: center;
    padding: 24px;
}
.login-box, .register-wrap { width: min(1180px, 100%); }
.login-box {
    max-width: 480px;
    padding: 32px;
    position: relative;
}
.register-wrap {
    display: grid;
    grid-template-columns: 1.1fr .95fr;
    gap: 24px;
    align-items: stretch;
}
.register-hero {
    padding: 38px;
    min-height: 580px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.register-hero::after {
    content: '';
    position: absolute;
    width: 320px;
    height: 320px;
    right: -80px;
    top: -90px;
    background: radial-gradient(circle, rgba(255,107,87,.42), transparent 62%);
}
.register-form { align-content: center; }
.brand-line { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.brand-line.center { justify-content: center; }
.mini-mascot { width: 58px; height: 58px; object-fit: contain; filter: drop-shadow(0 12px 18px rgba(0,0,0,.25)); }
.hint-box {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255,255,255,.04);
    color: var(--muted);
    border: 1px dashed var(--line);
}

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}
.sidebar {
    position: sticky;
    top: 0;
    min-height: 100vh;
    padding: 22px;
    border-right: 1px solid var(--line);
    background: rgba(2, 6, 23, .55);
    backdrop-filter: blur(14px);
}
html[data-theme="light"] .sidebar { background: rgba(255,255,255,.55); }
.logo-block {
    padding: 22px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(124,92,255,.25), rgba(255,107,87,.18));
    border: 1px solid var(--line);
    margin-bottom: 18px;
}
.logo-block h2 { margin: 0 0 8px; }
.logo-block p { margin: 0; color: var(--muted); }
.sidebar nav { display: grid; gap: 10px; }
.sidebar nav a {
    padding: 14px 16px;
    border-radius: 16px;
    text-decoration: none;
    color: var(--text);
    background: rgba(255,255,255,.03);
    border: 1px solid transparent;
    transition: .18s ease;
}
.sidebar nav a:hover, .sidebar nav a.active {
    background: rgba(255,255,255,.08);
    border-color: var(--line);
    transform: translateX(2px);
}
.content { padding: 28px; }
.topbar {
    display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
    border: 1px solid var(--line);
    background: rgba(255,255,255,.08);
    color: var(--text);
    min-height: 46px;
    padding: 0 16px;
    border-radius: 999px;
    display: inline-flex;
    gap: 10px;
    align-items: center;
    cursor: pointer;
}
.user-chip {
    padding: 12px 14px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid var(--line); color: var(--muted);
}
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 24px; }
.page-head h1 { margin: 0 0 6px; font-size: clamp(2rem, 4vw, 3rem); }
.page-head p { margin: 0; color: var(--muted); }

.grid-4, .grid-3, .grid-2 {
    display: grid;
    gap: 18px;
}
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gap-lg { gap: 24px; }

.stat {
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.stat::after {
    content: '';
    position: absolute;
    inset: auto -40px -40px auto;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
}
.stat h3 { margin: 0 0 10px; font-size: clamp(2rem, 4vw, 2.8rem); }
.stat p { margin: 0; color: var(--muted); font-weight: 700; }
.stat.red { background: linear-gradient(160deg, rgba(239,68,68,.28), rgba(127,29,29,.25)); }
.stat.blue { background: linear-gradient(160deg, rgba(59,130,246,.28), rgba(30,58,138,.25)); }
.stat.yellow { background: linear-gradient(160deg, rgba(250,204,21,.28), rgba(161,98,7,.2)); }

.qr-box {
    display: grid; grid-template-columns: 230px 1fr; gap: 20px; align-items: center;
}
.qr-img { border-radius: 22px; background: #fff; padding: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.thermo-wrap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    align-items: end;
    min-height: 300px;
}
.thermo-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}
.thermo-bar {
    width: 100%;
    max-width: 90px;
    min-height: 20px;
    border-radius: 999px 999px 18px 18px;
    box-shadow: inset 0 0 18px rgba(255,255,255,.18), 0 16px 24px rgba(0,0,0,.18);
}
.thermo-bar.rojo { background: linear-gradient(180deg, #ff6b6b, #8b0000); }
.thermo-bar.azul { background: linear-gradient(180deg, #60a5fa, #1d4ed8); }
.thermo-bar.amarillo { background: linear-gradient(180deg, #fde047, #ca8a04); }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: .92rem; }
.thumb {
    width: 54px; height: 54px; object-fit: cover; border-radius: 16px; border: 1px solid var(--line);
}
.badge {
    display: inline-flex; align-items: center; justify-content: center; min-height: 30px; padding: 0 10px; border-radius: 999px; font-size: .82rem; font-weight: 800;
}
.badge.neutral { background: rgba(255,255,255,.08); color: var(--muted); }
.badge.present { background: rgba(34,197,94,.18); color: #8ef1ad; }
.badge.absent { background: rgba(239,68,68,.18); color: #ffb0aa; }
html[data-theme="light"] .badge.present { color: #166534; }
html[data-theme="light"] .badge.absent { color: #991b1b; }
.section-title-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.empty-state { padding: 30px 10px; text-align: center; color: var(--muted); }
.mural-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }
.mural-card { overflow: hidden; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); }
.mural-card img { width: 100%; height: 280px; object-fit: cover; display: block; }
.mural-info { padding: 14px; }
.mural-info h3 { margin: 0 0 6px; }
.mural-info p { margin: 0; color: var(--muted); }

.team-showcase,
.team-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.team-showcase-card,
.team-card {
    position: relative;
    overflow: hidden;
    min-height: 330px;
    border-radius: 30px;
    padding: 20px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.team-showcase-card img,
.team-card img { position: absolute; right: 6px; bottom: 8px; max-width: 58%; max-height: 240px; object-fit: contain; filter: drop-shadow(0 16px 26px rgba(0,0,0,.28)); }
.team-showcase-card.rojo, .team-card.rojo { background: linear-gradient(145deg, rgba(239,68,68,.72), rgba(127,29,29,.45)); }
.team-showcase-card.azul, .team-card.azul { background: linear-gradient(145deg, rgba(59,130,246,.72), rgba(30,58,138,.45)); }
.team-showcase-card.amarillo, .team-card.amarillo { background: linear-gradient(145deg, rgba(250,204,21,.75), rgba(161,98,7,.42)); color: #1f2937; }
.team-info, .team-card .content {
    position: relative; z-index: 2; max-width: 58%; padding: 14px 16px; border-radius: 18px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.16);
}
.team-card .content { max-width: 72%; margin-top: auto; }

.month-toolbar {
    display:flex; justify-content:space-between; gap:16px; flex-wrap:wrap; align-items:center; margin-bottom:18px;
}
.attendance-table td, .attendance-table th { text-align:center; }
.attendance-table td.name-cell, .attendance-table th.name-cell { text-align:left; position: sticky; left: 0; background: var(--panel-solid); z-index: 3; }
.attendance-table td.team-cell, .attendance-table th.team-cell { position: sticky; left: 230px; background: var(--panel-solid); z-index: 3; }
.attendance-status {
    width: 34px; height: 34px; display:inline-grid; place-items:center; border-radius: 10px; font-size: 1rem; font-weight: 900; margin: 0 auto;
}
.attendance-status.present { background: rgba(34,197,94,.18); color: #77f4a5; }
.attendance-status.absent { background: rgba(239,68,68,.18); color: #ffaaa3; }
.attendance-status.na { background: rgba(255,255,255,.08); color: var(--muted); }
html[data-theme="light"] .attendance-status.present { color: #166534; }
html[data-theme="light"] .attendance-status.absent { color: #991b1b; }
.summary-chip {
    display:inline-flex; gap:8px; align-items:center; padding: 10px 12px; border-radius:999px; border:1px solid var(--line); background: rgba(255,255,255,.05); color: var(--muted);
}

@media (max-width: 1080px) {
    .admin-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; min-height: auto; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3, .grid-2, .register-wrap, .team-showcase, .team-cards, .mural-grid { grid-template-columns: 1fr; }
    .qr-box { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .content, .sidebar, .login-box, .register-hero, .card { padding: 18px; }
    .page-head, .topbar, .section-title-row, .month-toolbar { flex-direction: column; align-items: stretch; }
    .grid-4 { grid-template-columns: 1fr; }
    .mini-mascot { width: 48px; height: 48px; }
    .attendance-table td.team-cell, .attendance-table th.team-cell { left: 180px; }
}
