/* =====================================================
   Design system: SEC Institutional Dashboard
   Paleta del archivo de diseño (login.md / consulta.md)
   ===================================================== */

:root {
    --sec-primary:          #9D142E;
    --sec-primary-dark:     #77001d;
    --sec-primary-hover:    #851127;
    --sec-primary-soft:     rgba(157, 20, 46, 0.10);
    --sec-primary-badge:    #ffdada;

    --sec-sidebar-bg:       #2d3133;
    --sec-sidebar-width:    280px;
    --sec-topbar-height:    4rem;

    --sec-canvas:           #F8FAFC;
    --sec-surface:          #ffffff;
    --sec-surface-low:      #f2f4f6;
    --sec-surface-mid:      #eceef0;
    --sec-border:           #e1bebf;
    --sec-border-light:     #f1f5f9;
    --sec-border-input:     #e2e8f0;

    --sec-text-primary:     #191c1e;
    --sec-text-secondary:   #594141;
    --sec-text-muted:       #8d7070;
    --sec-text-sidebar:     #e0e3e5;
    --sec-text-sidebar-dim: rgba(224, 227, 229, 0.65);

    --sec-shadow-soft:   0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --sec-shadow-medium: 0 10px 15px -3px rgba(0,0,0,0.10), 0 4px 6px -2px rgba(0,0,0,0.05);
}

/* ===== BASE ===== */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--sec-text-primary);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* =====================================================
   AUTH LAYOUT
   ===================================================== */

.sec-auth-body {
    background-color: var(--sec-canvas);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.sec-auth-main {
    width: 100%;
    max-width: 440px;
}

/* Login card */
.sec-login-card {
    background: var(--sec-surface);
    border-radius: 0.75rem;
    border-top: 4px solid var(--sec-primary);
    box-shadow: var(--sec-shadow-soft);
    padding: 2.5rem;
}

/* Branding block */
.sec-login-branding {
    text-align: center;
    margin-bottom: 2rem;
}

/* Shield badge */
.sec-shield-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background-color: var(--sec-primary-badge);
    color: var(--sec-primary);
    margin-bottom: 1.25rem;
}

/* Auth typography */
.sec-auth-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--sec-primary);
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin: 0 0 0.375rem;
}

.sec-auth-subtitle {
    font-size: 0.875rem;
    color: var(--sec-text-muted);
    margin: 0;
}

/* Alert */
.sec-alert {
    padding: 0.875rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.sec-alert-danger {
    background-color: #ffdad6;
    color: #93000a;
    border: 1px solid rgba(186, 26, 26, 0.15);
}

/* Field group */
.sec-field-group { margin-bottom: 1.25rem; }

.sec-submit-row { margin-top: 1.75rem; }

/* Label caps */
.sec-label-caps {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--sec-text-secondary);
    margin-bottom: 0.4rem;
}

/* Input group (icon + input) */
.sec-input-group {
    position: relative;
    margin-bottom: 0;
}

.sec-input-group--flush { margin-bottom: 0; }

.sec-input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sec-text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    line-height: 1;
}

.sec-input {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    background: var(--sec-surface);
    border: 1px solid var(--sec-border-input);
    border-radius: 0.375rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--sec-text-primary);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.5;
}

.sec-input:focus {
    border-color: var(--sec-primary);
    box-shadow: 0 0 0 3px var(--sec-primary-soft);
}

.sec-input-with-toggle { padding-right: 3rem; }

/* Iconos del toggle: por defecto ocultar el ojo-tachado */
.sec-pwd-toggle .icon-eye-off { display: none; }
/* Cuando el botón tiene la clase .showing: invertir visibilidad */
.sec-pwd-toggle.showing .icon-eye     { display: none; }
.sec-pwd-toggle.showing .icon-eye-off { display: block; }

/* Password toggle */
.sec-pwd-toggle {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 2.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--sec-text-muted);
    padding: 0;
    transition: color 0.15s;
}

.sec-pwd-toggle:hover { color: var(--sec-primary); }

.sec-pwd-toggle:focus-visible {
    outline: 2px solid var(--sec-primary);
    outline-offset: -2px;
    border-radius: 0 0.375rem 0.375rem 0;
}

/* Primary button (full-width, login) */
.btn-sec-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background-color: var(--sec-primary);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    font-family: inherit;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.1s;
    line-height: 1.5;
    text-decoration: none;
}

.btn-sec-primary:hover  { background-color: var(--sec-primary-hover); }
.btn-sec-primary:active { transform: scale(0.98); }

.btn-sec-primary:focus-visible {
    outline: 3px solid var(--sec-primary-soft);
    outline-offset: 2px;
}

.btn-sec-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Auth footer */
.sec-auth-footer {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--sec-surface-mid);
    text-align: center;
}

.sec-auth-footer-text {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sec-text-muted);
    margin: 0;
}

/* Status row */
.sec-status-row {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.25rem;
    opacity: 0.6;
}

.sec-status-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sec-text-secondary);
}

.sec-status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background-color: #22c55e;
    flex-shrink: 0;
    animation: sec-pulse 2s ease-in-out infinite;
}

@keyframes sec-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

/* =====================================================
   DASHBOARD LAYOUT
   ===================================================== */

.sec-dashboard-body {
    background-color: var(--sec-canvas);
    min-height: 100vh;
}

/* Sidebar */
.sec-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sec-sidebar-width);
    height: 100vh;
    background-color: var(--sec-sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 50;
    overflow-y: auto;
}

.sec-sidebar-header {
    padding: 1.5rem 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.sec-sidebar-brand {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sec-text-sidebar);
    margin-bottom: 0.2rem;
}

.sec-sidebar-tagline {
    display: block;
    font-size: 0.8125rem;
    color: var(--sec-text-sidebar-dim);
}

.sec-sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.625rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Nav items (links and form buttons) */
.sec-nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--sec-text-sidebar);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    line-height: 1.5;
    transition: background-color 0.15s, color 0.15s, transform 0.12s;
}

.sec-nav-item:hover {
    background-color: rgba(255,255,255,0.07);
    color: #fff;
    transform: translateX(2px);
}

.sec-nav-item:focus-visible {
    outline: 2px solid rgba(157, 20, 46, 0.7);
    outline-offset: 1px;
}

.sec-nav-item.active {
    background-color: var(--sec-primary);
    color: #fff;
    font-weight: 600;
}

.sec-nav-item.active:hover {
    background-color: var(--sec-primary-hover);
    transform: none;
}

/* Content wrapper */
.sec-content-wrapper {
    margin-left: var(--sec-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top bar */
.sec-topbar {
    height: var(--sec-topbar-height);
    background-color: var(--sec-canvas);
    border-bottom: 1px solid var(--sec-surface-mid);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 40;
    flex-shrink: 0;
}

.sec-topbar-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--sec-primary);
    letter-spacing: -0.01em;
    margin: 0;
}

.sec-topbar-user {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.sec-topbar-user-info { text-align: right; }

.sec-topbar-user-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--sec-text-primary);
    line-height: 1.25;
}

.sec-topbar-user-role {
    display: block;
    font-size: 0.75rem;
    color: var(--sec-text-muted);
    line-height: 1.25;
}

.sec-user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: var(--sec-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Main content area */
.sec-main {
    flex: 1;
    padding: 2.5rem 2rem;
    max-width: 1200px;
    width: 100%;
}

/* Mobile header */
.sec-mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    background-color: var(--sec-sidebar-bg);
    padding: 0.75rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sec-mobile-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--sec-text-sidebar);
}

.btn-sec-logout-mobile {
    font-size: 0.8125rem;
    color: var(--sec-text-sidebar-dim);
    background: none;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s;
}

.btn-sec-logout-mobile:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.5);
}

/* =====================================================
   QUERY PAGE CONTENT
   ===================================================== */

.sec-page-header { margin-bottom: 1.75rem; }

.sec-page-heading {
    font-size: 2rem;
    font-weight: 700;
    color: var(--sec-text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0 0 0.5rem;
}

.sec-page-desc {
    font-size: 1rem;
    color: var(--sec-text-secondary);
    max-width: 640px;
    margin: 0;
    line-height: 1.6;
}

/* Search card */
.sec-search-card {
    background: var(--sec-surface);
    border-radius: 0.5rem;
    border: 1px solid var(--sec-border-light);
    box-shadow: var(--sec-shadow-soft);
    padding: 2rem;
    margin-bottom: 2rem;
}

.sec-search-form {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.sec-search-field { flex: 1; min-width: 220px; }

.sec-field-hint {
    margin: 0.4rem 0 0;
    font-size: 0.8125rem;
    color: var(--sec-text-muted);
    line-height: 1.5;
}

/* Search / consultar button */
.btn-sec-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    padding: 0.75rem 1.5rem;
    background-color: var(--sec-primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.9375rem;
    font-family: inherit;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(157, 20, 46, 0.20);
    transition: background-color 0.15s, transform 0.1s;
    line-height: 1.5;
}

.btn-sec-search:hover  { background-color: var(--sec-primary-hover); }
.btn-sec-search:active { transform: scale(0.97); }

.btn-sec-search:focus-visible {
    outline: 3px solid var(--sec-primary-soft);
    outline-offset: 2px;
}

.btn-sec-search:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Results section */
.sec-results-section { margin-top: 0.5rem; }

.sec-results-header {
    display: flex;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--sec-border-input);
    margin-bottom: 1.25rem;
}

.sec-results-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--sec-text-primary);
    letter-spacing: -0.01em;
    margin: 0;
}

/* Result cards */
.sec-result-card {
    background: var(--sec-surface);
    border-radius: 0.5rem;
    border: 1px solid var(--sec-border-light);
    border-left-width: 4px;
    box-shadow: var(--sec-shadow-soft);
    padding: 1.5rem 2rem;
}

.sec-result-success { border-left-color: #198754; }
.sec-result-info    { border-left-color: #0d6efd; }
.sec-result-warning { border-left-color: #ffc107; }
.sec-result-danger  { border-left-color: #dc3545; }

.sec-result-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin: 0 0 0.375rem;
}

.sec-result-success .sec-result-label { color: #146c43; }
.sec-result-info    .sec-result-label { color: #0a58ca; }
.sec-result-warning .sec-result-label { color: #856404; }
.sec-result-danger  .sec-result-label { color: #842029; }

.sec-result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--sec-text-primary);
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.2;
}

.sec-result-message {
    font-size: 0.9375rem;
    margin: 0;
    line-height: 1.5;
}

.sec-result-success .sec-result-message { color: #146c43; }
.sec-result-info    .sec-result-message { color: #0a58ca; }
.sec-result-warning .sec-result-message { color: #856404; }
.sec-result-danger  .sec-result-message { color: #842029; }

/* Member result card (full data) */
.sec-member-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.sec-member-photo {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--sec-surface-low);
    border: 2px solid var(--sec-border);
}

.sec-member-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sec-member-details { flex: 1; min-width: 0; }

.sec-member-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--sec-text-primary);
    margin: 0 0 0.5rem;
    line-height: 1.3;
}

.sec-member-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    align-items: baseline;
    font-size: 0.9375rem;
    margin-bottom: 0.35rem;
}

.sec-member-row:last-child { margin-bottom: 0; }

.sec-member-row-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sec-text-muted);
    white-space: nowrap;
}

.sec-member-row-value { color: var(--sec-text-primary); }

.sec-member-tipo-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sec-primary);
    line-height: 1;
}

@media (max-width: 479.98px) {
    .sec-member-layout { flex-direction: column; align-items: center; text-align: center; }
    .sec-member-row    { justify-content: center; }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 991.98px) {
    .sec-sidebar         { display: none !important; }
    .sec-topbar          { display: none !important; }
    .sec-mobile-header   { display: flex; }
    .sec-content-wrapper { margin-left: 0; }

    .sec-main {
        padding: 1.5rem 1.25rem;
    }

    .sec-page-heading { font-size: 1.5rem; }

    .sec-search-form {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-sec-search {
        width: 100%;
        justify-content: center;
    }

    .sec-search-card { padding: 1.5rem; }
}

@media (max-width: 479.98px) {
    .sec-login-card { padding: 1.75rem 1.5rem; }
}
