:root {
    --bg-primary: #0a0c12;
    --bg-secondary: #11141e;
    --bg-card: #161a26;
    --bg-hover: #1e2433;
    --bg-input: #1a1f2e;
    --text-primary: #e8ecf4;
    --text-secondary: #8b93b0;
    --text-muted: #4f5670;
    --border-color: rgba(255,255,255,0.06);
    --border-hover: rgba(255,255,255,0.12);
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-bg: rgba(99,102,241,0.12);
    --success: #10b981;
    --success-bg: rgba(16,185,129,0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245,158,11,0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239,68,68,0.12);
    --info: #3b82f6;
    --info-bg: rgba(59,130,246,0.12);
    --sidebar-width: 250px;
    --topbar-height: 60px;
    --radius: 12px;
    --radius-sm: 8px;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 4px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 12px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: 0.85; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.85; }
.btn-ghost { background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-abierto { background: var(--warning-bg); color: var(--warning); }
.badge-progreso { background: var(--info-bg); color: var(--info); }
.badge-cerrado { background: var(--success-bg); color: var(--success); }
.badge-pendiente { background: var(--danger-bg); color: var(--danger); }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-subtitle { font-size: 12px; color: var(--text-secondary); }

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
    font-family: var(--font-family);
}
.form-control:focus { outline: none; border-color: var(--accent); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { appearance: none; cursor: pointer; }
select.form-control option { background: var(--bg-secondary); }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state h3 { font-size: 18px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 12px;
    color: var(--text-muted);
}
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── LOGIN ─── */
.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 20%, rgba(99,102,241,0.18), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(16,185,129,0.10), transparent 40%),
        var(--bg-primary);
    z-index: 1000;
    overflow-y: auto;
}
.login-shell {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    width: 100%;
    max-width: 980px;
    min-height: 580px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-hover);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5);
    animation: loginIn 0.5s ease-out;
}
@keyframes loginIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Panel de marca */
.login-brand {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 44px 40px;
    background: linear-gradient(145deg, #4f46e5 0%, #4338ca 45%, #312e81 100%);
    color: #fff;
    overflow: hidden;
}
.login-brand::before,
.login-brand::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
}
.login-brand::before { width: 380px; height: 380px; top: -140px; right: -140px; }
.login-brand::after  { width: 260px; height: 260px; bottom: -110px; left: -90px; }
.login-brand > * { position: relative; z-index: 1; }

/* Contenedor del logo centrado */
.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Ocultar solo el ícono */
.login-logo-mark {
    display: none;
}

/* Bloque de texto centrado */
.login-logo > div {
    text-align: center;
    width: 100%;
}

/* Título SIGOF grande y centrado */
.login-logo h1 {
    font-size: 72px;
    font-weight: 900;
    letter-spacing: 8px;
    text-align: center;
    text-transform: uppercase;
    line-height: 1;
    margin: 0 0 10px 0;
    text-shadow: 0 6px 30px rgba(0,0,0,0.35);
}

/* Subtítulo visible y centrado */
.login-logo > div > span {
    display: block;
    font-size: 16px;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
    letter-spacing: 1.5px;
    text-align: center;
}

/* Panel de formulario */
.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 44px 48px;
}
.login-form { width: 100%; max-width: 360px; }
.login-form-header { margin-bottom: 28px; }
.login-form h2 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.login-subtitle { color: var(--text-secondary); font-size: 13px; }
.login-form .form-group { margin-bottom: 18px; }
.login-form .form-group label { font-size: 12px; font-weight: 600; margin-bottom: 6px; }

.input-icon { position: relative; }
.input-icon > svg {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; color: var(--text-muted);
    pointer-events: none; transition: color 0.2s;
}
.input-icon .form-control { padding: 12px 44px 12px 44px; height: 46px; }
.input-icon .form-control:focus { box-shadow: 0 0 0 3px var(--accent-bg); }
.input-icon:focus-within > svg { color: var(--accent); }
.input-toggle {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; border-radius: 6px;
    color: var(--text-muted); cursor: pointer;
}
.input-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }
.input-toggle svg { width: 18px; height: 18px; }

.login-submit { height: 48px; margin-top: 8px; font-size: 15px; box-shadow: 0 8px 24px rgba(99,102,241,0.35); }
.login-submit .spinner { width: 18px; height: 18px; border-width: 2px; border-color: rgba(255,255,255,0.3); border-top-color: #fff; }
.login-help { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 20px; }

.info-msg {
    color: #a5b4fc;
    font-size: 13px;
    margin-bottom: 14px;
    padding: 10px 14px;
    background: var(--accent-bg);
    border: 1px solid rgba(99,102,241,0.3);
    border-radius: var(--radius-sm);
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; border-color: rgba(255,255,255,0.3); border-top-color: #fff; }
.btn-danger:disabled, .btn-success:disabled, .btn-ghost:disabled { opacity: 0.6; cursor: not-allowed; }
.badge { white-space: nowrap; }

.error-msg {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 14px;
    padding: 10px 14px;
    background: var(--danger-bg);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: var(--radius-sm);
}

@media (max-width: 860px) {
    .login-shell { grid-template-columns: 1fr; min-height: auto; max-width: 440px; }
    .login-brand { padding: 40px 28px; }
    .login-logo h1 { font-size: 48px; letter-spacing: 5px; }
    .login-logo > div > span { font-size: 13px; }
    .login-panel { padding: 32px 28px; }
}