/* ── Reset mínimo ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { max-width: 100%; display: block; }

/* ── Tema oscuro (por defecto) ────────────────────────────────────── */
:root,
:root[data-theme="dark"] {
    --bg:         #0f172a;
    --bg-soft:    #111827;
    --surface:    #1e293b;
    --surface-2:  #273449;
    --border:     #334155;
    --text:       #e2e8f0;
    --text-dim:   #94a3b8;
    --primary:    #38bdf8;
    --primary-2:  #0ea5e9;
    --success:    #4ade80;
    --error:      #f87171;
    --warning:    #fbbf24;
    --shadow:     0 8px 24px rgba(0,0,0,.35);
    --radius:     14px;
    --font:       system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: dark;
}

/* ── Tema claro ───────────────────────────────────────────────────── */
:root[data-theme="light"] {
    --bg:         #f8fafc;
    --bg-soft:    #f1f5f9;
    --surface:    #ffffff;
    --surface-2:  #f1f5f9;
    --border:     #e2e8f0;
    --text:       #0f172a;
    --text-dim:   #64748b;
    --primary:    #0284c7;
    --primary-2:  #0369a1;
    --success:    #16a34a;
    --error:      #dc2626;
    --warning:    #d97706;
    --shadow:     0 4px 16px rgba(15,23,42,.08);
    color-scheme: light;
}

/* ── Base ─────────────────────────────────────────────────────────── */
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ───────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: .95rem;
}
.nav .user { color: var(--text-dim); }
.inline { display: inline; margin: 0; }
.link-like {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font: inherit;
    padding: 0;
}
.link-like:hover { text-decoration: underline; }
.icon-btn {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .35rem .6rem;
    cursor: pointer;
    font-size: 1rem;
}

/* ── Layout ───────────────────────────────────────────────────────── */
.container {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ── Tarjetas ─────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 .75rem; font-size: 1.1rem; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.hero h1 { margin: 0 0 .5rem; }
.muted { color: var(--text-dim); font-size: .92rem; }

/* ── Formularios ──────────────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: .9rem; }
label {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    font-size: .92rem;
    color: var(--text-dim);
}
input[type="text"], input[type="password"], input[type="number"], input[type="date"] {
    background: var(--bg-soft);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .6rem .75rem;
    font: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(56,189,248,.2);
}

.btn {
    border: none;
    border-radius: 10px;
    padding: .65rem 1rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform .05s, filter .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #062235; }
.btn-primary:hover { filter: brightness(1.1); }

/* ── Tarjeta de autenticación ─────────────────────────────────────── */
.auth-card {
    max-width: 420px;
    margin: 3rem auto;
}
.auth-card h1 { margin-top: 0; }

/* ── Flash messages ───────────────────────────────────────────────── */
.flash {
    padding: .75rem 1rem;
    border-radius: 10px;
    margin-bottom: .75rem;
    border: 1px solid transparent;
    font-size: .92rem;
}
.flash-success { background: rgba(74,222,128,.12); border-color: rgba(74,222,128,.4); color: var(--success); }
.flash-error   { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.4); color: var(--error); }
.flash-info    { background: rgba(56,189,248,.12); border-color: rgba(56,189,248,.4); color: var(--primary); }

/* ── Checklist (home) ─────────────────────────────────────────────── */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: .3rem 0; color: var(--text-dim); }
.checklist li.done { color: var(--success); }

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .topbar { flex-wrap: wrap; gap: .5rem; }
    .nav { flex-wrap: wrap; font-size: .85rem; }
    .container { padding: 1rem; }
}
