@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&family=Outfit:wght@500;600;700&display=swap');

:root {
    --bg: #f0f4f8;
    --surface: #ffffff;
    --sidebar: #0c1222;
    --sidebar-hover: #161f35;
    --sidebar-active: #4f46e5;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --success: #059669;
    --danger: #dc2626;
    --radius: 14px;
    --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* LOGIN */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, #0c1222 0%, #1a2744 50%, #0f172a 100%);
}

.login-wrap { width: 100%; max-width: 420px; }

.login-box {
    background: #fff;
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.4rem; margin-bottom: 20px;
}

.login-box h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem; margin-bottom: 6px;
}

.login-sub { color: var(--text-muted); margin-bottom: 24px; font-size: .92rem; }

/* LAYOUT */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--sidebar);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform .3s ease;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex; gap: 14px; align-items: center;
}

.logo-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; flex-shrink: 0;
}

.sidebar-brand strong {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-size: .95rem; color: #fff;
}

.sidebar-brand small { color: #64748b; font-size: .72rem; }

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav a {
    color: #94a3b8;
    text-decoration: none;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: .88rem;
    font-weight: 500;
    display: flex; align-items: center; gap: 11px;
    transition: all .2s;
}

.sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 4px 14px rgba(79,70,229,.4);
}

.sidebar-footer {
    padding: 16px 12px 20px;
    border-top: 1px solid rgba(255,255,255,.06);
}

.sidebar-logout {
    color: #64748b;
    text-decoration: none;
    padding: 10px 14px;
    font-size: .85rem;
    display: flex; align-items: center; gap: 10px;
    border-radius: 10px;
}

.sidebar-logout:hover { background: rgba(239,68,68,.12); color: #fca5a5; }

.main-wrap {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
}

.menu-toggle {
    display: none;
    background: none; border: none;
    font-size: 1.2rem; cursor: pointer; color: var(--text);
}

.topbar-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600; font-size: 1rem;
    color: var(--text-muted);
}

.topbar-date { font-size: .82rem; color: var(--text-muted); }

.content { flex: 1; padding: 28px 32px 40px; max-width: 1200px; width: 100%; }

.content > h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 24px;
}

/* CARDS */
.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.card, .stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card small, .stat-card .stat-label {
    font-size: .78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
}

.card strong, .stat-card .stat-value {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    margin-top: 4px;
}

/* PANEL BOX */
.panel-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    max-width: 640px;
}

/* FORM */
label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    margin: 16px 0 7px;
    color: #334155;
}

label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="password"],
input[type="search"] {
    width: 100%;
    padding: 12px 15px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font: inherit;
    font-size: .92rem;
    background: #fafbfc;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(79,70,229,.1);
}

.input-hint { font-size: .78rem; color: var(--text-muted); margin-top: 5px; }

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border: none;
    border-radius: 10px;
    font: inherit;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
    box-shadow: 0 4px 14px rgba(79,70,229,.3);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(79,70,229,.35); }

.btn-block { width: 100%; margin-top: 20px; }
.btn-sm { padding: 6px 12px; font-size: .78rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }

/* ALERTS */
.alert {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: .88rem;
}

.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }

/* CODIGO */
.codigo-box {
    margin-top: 24px;
    padding: 24px;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 2px solid #6ee7b7;
    border-radius: var(--radius);
    text-align: center;
}

.codigo-result {
    font-family: 'Outfit', monospace;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: #065f46;
    margin: 12px 0;
}

/* TABLE */
.table-wrap {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .86rem;
    background: #fff;
}

th, td {
    padding: 13px 18px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
}

tbody tr:hover { background: #fafbfc; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
}

.badge-activa { background: #dcfce7; color: #166534; }
.badge-bloqueada { background: #fee2e2; color: #991b1b; }

.empty-state {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 60px 40px;
    text-align: center;
    color: var(--text-muted);
    box-shadow: var(--shadow);
}

.toast {
    position: fixed;
    bottom: 24px; right: 24px;
    background: #0f172a; color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    opacity: 0;
    transition: .3s;
    z-index: 999;
}

.toast.show { opacity: 1; }

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-wrap { margin-left: 0; }
    .menu-toggle { display: block; }
    .content { padding: 20px 16px; }
    .cards { grid-template-columns: 1fr; }
}
