:root {
    --bg: #0f1419;
    --surface: #1a212b;
    --surface-2: #232c38;
    --text: #e6edf3;
    --muted: #8b98a5;
    --brand: #4f9cf9;
    --ok: #3fb950;
    --border: #2d3845;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
}

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

.topbar {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand span { color: var(--muted); font-weight: 400; }

.container {
    max-width: 880px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

.hero h1 { font-size: 2rem; margin: 0 0 .5rem; }
.lead { color: var(--muted); font-size: 1.1rem; margin-top: 0; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.card h2 { margin-top: 0; font-size: 1.1rem; }

.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { padding: .35rem 0; border-bottom: 1px solid var(--border); }
.status-list li:last-child { border-bottom: 0; }

.ok { color: var(--ok); }
.muted { color: var(--muted); }
code { background: var(--surface-2); padding: .15rem .4rem; border-radius: 5px; }

.error-page { text-align: center; padding: 3rem 0; }
.error-page h1 { font-size: 4rem; margin: 0; color: var(--brand); }

.footer {
    text-align: center;
    color: var(--muted);
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* ---------- Topbar / nav ---------- */
.topbar { justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.topnav { display: flex; gap: .25rem; flex: 1; }
.topnav a {
    color: var(--muted); padding: .4rem .7rem; border-radius: 7px; font-size: .92rem;
}
.topnav a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.topnav a.active { color: var(--text); background: var(--surface-2); }
.topbar-right { display: flex; align-items: center; gap: .75rem; }
.admin-name { color: var(--muted); font-size: .85rem; }

/* ---------- Botones ---------- */
.btn {
    display: inline-block; cursor: pointer; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text); padding: .55rem 1rem;
    border-radius: 8px; font-size: .92rem; font-weight: 500; text-align: center;
    transition: filter .15s ease;
}
.btn:hover { text-decoration: none; filter: brightness(1.15); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #06203f; font-weight: 600; }
.btn-ghost { background: transparent; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #052e12; }
.btn-warn { background: #d29922; border-color: #d29922; color: #2a1d00; }
.btn-sm { padding: .35rem .65rem; font-size: .82rem; }
.btn-block { width: 100%; }
.inline-form { display: inline; margin: 0; }

/* ---------- Formularios ---------- */
form label { display: block; margin-bottom: 1rem; font-size: .9rem; color: var(--muted); }
form input, form select {
    display: block; width: 100%; margin-top: .35rem; padding: .6rem .75rem;
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-size: 1rem;
}
form input:focus, form select:focus { outline: none; border-color: var(--brand); }
.form-card { max-width: 560px; }
.form-actions { margin-top: 1rem; }
.field-error { display: block; color: #f85149; font-size: .82rem; margin-top: .3rem; }
.owner-fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.25rem 0; margin: .5rem 0 1rem; }
.owner-fieldset legend { padding: 0 .5rem; font-weight: 600; color: var(--text); }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row > label { flex: 1; min-width: 140px; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; color: var(--text); margin-bottom: 1rem; }
.checkbox-label input { width: auto; margin: 0; }
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .3rem 1rem; margin-bottom: .5rem; }
.member-grid .checkbox-label { margin-bottom: .35rem; }
.code-input { letter-spacing: .4em; font-size: 1.4rem; text-align: center; font-family: monospace; }

/* ---------- Alerts ---------- */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1.25rem; font-size: .92rem; }
.alert-success { background: rgba(63,185,80,.15); border: 1px solid var(--ok); color: #7ee787; }
.alert-error { background: rgba(248,81,73,.12); border: 1px solid #f85149; color: #ffa198; }

/* ---------- Tablas ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.data-table th, .data-table td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.data-table tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: .4rem; justify-content: flex-end; }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 20px; font-size: .76rem; font-weight: 600; }
.badge-ok { background: rgba(63,185,80,.18); color: #7ee787; }
.badge-warn { background: rgba(210,153,34,.2); color: #e3b341; }
.badge-info { background: rgba(79,156,249,.2); color: #79b8ff; }
.badge-muted { background: var(--surface-2); color: var(--muted); }

/* Reservaciones */
.filter-bar { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filter-bar label { margin-bottom: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: .5rem; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* Estadísticas */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.bar-row { display: flex; align-items: center; gap: .75rem; margin: .3rem 0; }
.bar-label { width: 86px; flex-shrink: 0; color: var(--muted); font-size: .85rem; }
.bar { flex: 1; background: var(--surface-2); border-radius: 6px; height: 14px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.bar-val { width: 36px; text-align: right; font-size: .85rem; }
.stat-num .ok { color: var(--ok); font-size: .85rem; }
.stat-num .warn { color: #e3b341; font-size: .85rem; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; text-align: center; }
.stat-num { font-size: 2rem; font-weight: 700; }
.stat-num.ok { color: var(--ok); }
.stat-num.warn { color: #e3b341; }
.stat-label { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); }

/* ---------- Auth ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-wrap { width: 100%; max-width: 420px; padding: 1.5rem; }
.auth-brand { text-align: center; font-weight: 700; font-size: 1.2rem; margin-bottom: 1.25rem; }
.auth-brand span { color: var(--muted); font-weight: 400; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; }
.auth-card-wide { max-width: 460px; }
.auth-card h1 { margin-top: 0; font-size: 1.4rem; }
.totp-setup { margin: 1.25rem 0; }
.qr-box { display: flex; justify-content: center; margin: 1rem 0; }
.qr-box > div { background: #fff; padding: 12px; border-radius: 10px; line-height: 0; }
.totp-secret { font-family: monospace; font-size: 1.25rem; letter-spacing: .1em; background: var(--bg); padding: .75rem; border-radius: 8px; border: 1px solid var(--border); text-align: center; }
.totp-uri { margin-top: .75rem; }
.totp-uri code { word-break: break-all; display: block; margin-top: .5rem; font-size: .78rem; }
