/* ========================================================
   ASISTEC SEGURIDAD - Admin Control Panel Stylesheet
   Modern Glassmorphism & High-Tech Dark Interface
   ======================================================== */

:root {
    --bg-dark: #070d18;
    --bg-surface: #0e1726;
    --bg-card: #131d31;
    --bg-card-hover: #1a2740;
    
    --accent-blue: #2563eb;
    --accent-blue-light: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-amber: #f59e0b;
    --accent-green: #10b981;
    --accent-red: #ef4444;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-sub: #64748b;
    --border-color: rgba(255, 255, 255, 0.08);

    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;

    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --------------------------------------------------------
   LOGIN PAGE
   -------------------------------------------------------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.15), transparent 40%),
                radial-gradient(circle at bottom left, rgba(6, 182, 212, 0.1), transparent 40%),
                var(--bg-dark);
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
}

.login-logo {
    max-width: 220px;
    height: auto;
    margin-bottom: 20px;
}

.login-header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 6px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper svg {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
}

.input-icon-wrapper input,
.input-icon-wrapper select,
.input-icon-wrapper textarea,
.form-control {
    width: 100%;
    background: rgba(7, 13, 24, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px 12px 44px;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.input-icon-wrapper input:focus,
.form-control:focus {
    outline: none;
    border-color: var(--accent-blue-light);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.login-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-sub);
}

.back-link {
    color: var(--accent-blue-light);
    text-decoration: none;
    display: inline-block;
    margin-top: 10px;
    font-weight: 500;
}

.back-link:hover { text-decoration: underline; }

/* --------------------------------------------------------
   ADMIN LAYOUT & HEADER
   -------------------------------------------------------- */
.admin-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    background: rgba(14, 23, 38, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-logo {
    height: 38px;
    width: auto;
}

.admin-badge {
    background: rgba(37, 99, 235, 0.15);
    color: var(--accent-blue-light);
    border: 1px solid rgba(37, 99, 235, 0.3);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 0.9rem;
}

.user-text .user-name {
    font-weight: 600;
    color: #fff;
    font-size: 0.9rem;
}

.user-text .user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* NAVIGATION TABS */
.admin-nav-bar {
    background: #091221;
    border-bottom: 1px solid var(--border-color);
}

.nav-tabs-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.nav-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 16px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
}

.marketing-module-link .nav-tab-badge {
    color: #075985;
    background: #dff4ff;
}

.nav-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.nav-tab-btn.active {
    color: var(--accent-blue-light);
    border-bottom-color: var(--accent-blue-light);
    background: rgba(37, 99, 235, 0.08);
}

.nav-tab-badge {
    background: var(--bg-card);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.nav-tab-btn.active .nav-tab-badge {
    background: var(--accent-blue);
    color: #fff;
}

/* --------------------------------------------------------
   MAIN CONTENT AREA
   -------------------------------------------------------- */
.admin-main {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 24px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* PAGE SECTION HEADERS */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.dashboard-title h1 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: #fff;
    margin-bottom: 4px;
}

.dashboard-title p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* KPI CARDS GRID */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-3px);
    border-color: rgba(37, 99, 235, 0.3);
}

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon.blue { background: rgba(37, 99, 235, 0.15); color: var(--accent-blue-light); }
.kpi-icon.cyan { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.kpi-icon.amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.kpi-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }

.kpi-info .kpi-value {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
}

.kpi-info .kpi-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* CHARTS SECTION */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 992px) {
    .charts-grid { grid-template-columns: 1fr; }
}

.card-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.card-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-box-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

/* --------------------------------------------------------
   FILTER PILLS & BADGES
   -------------------------------------------------------- */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-pill {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.filter-pill:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.filter-pill.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tag-badge.camaras { background: rgba(37, 99, 235, 0.18); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.tag-badge.alarmas { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.tag-badge.proyectos { background: rgba(16, 185, 129, 0.18); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.tag-badge.otros { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-block;
}

.status-badge.pendiente { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.status-badge.en-proceso { background: rgba(6, 182, 212, 0.18); color: #22d3ee; }
.status-badge.resuelto { background: rgba(16, 185, 129, 0.18); color: #34d399; }

/* --------------------------------------------------------
   DATA TABLES
   -------------------------------------------------------- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.admin-table th {
    background: #091221;
    color: var(--text-muted);
    font-weight: 600;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.admin-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-main);
}

.admin-table tbody tr {
    transition: background 0.15s ease;
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.user-cell {
    display: flex;
    flex-direction: column;
}

.user-cell .name { font-weight: 600; color: #fff; }
.user-cell .contact { font-size: 0.8rem; color: var(--text-muted); }

.actions-cell {
    display: flex;
    gap: 8px;
}

/* --------------------------------------------------------
   COVER PROJECTS CARDS GRID
   -------------------------------------------------------- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.project-admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}

.project-admin-card:hover {
    border-color: rgba(37, 99, 235, 0.4);
    transform: translateY(-4px);
}

.project-card-img {
    height: 180px;
    width: 100%;
    object-fit: cover;
    background: #091221;
}

.project-card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.project-card-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.project-card-desc {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 14px;
    flex: 1;
    line-height: 1.4;
}

.project-card-meta {
    font-size: 0.8rem;
    color: var(--text-sub);
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    margin-bottom: 14px;
}

.project-card-actions {
    display: flex;
    gap: 10px;
}

/* --------------------------------------------------------
   BUTTONS & FORMS
   -------------------------------------------------------- */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary { background: var(--accent-blue); color: #fff; }
.btn-primary:hover { background: var(--accent-blue-light); }

.btn-secondary { background: var(--bg-surface); color: var(--text-main); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: rgba(255, 255, 255, 0.2); }

.btn-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; border-color: rgba(239, 68, 68, 0.3); }
.btn-danger:hover { background: var(--accent-red); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.w-full { width: 100%; }

.form-select-sm {
    background: #070d18;
    color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.8rem;
}

/* --------------------------------------------------------
   MODALS
   -------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    padding: 28px;
    box-shadow: var(--shadow-md);
    transform: scale(0.95);
    transition: transform 0.25s ease;
}

.modal-overlay.active .modal-dialog {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: #fff;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
}

.modal-close:hover { color: #fff; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.delete-confirmation-modal {
    max-width: 460px;
}

.delete-confirmation-body p {
    margin: 0 0 18px;
    color: var(--text-main);
    line-height: 1.6;
}

.delete-confirmation-body .alert-danger {
    margin-bottom: 0;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 12px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
    padding: 12px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* ========================================================
   PREMIUM OPERATIONS CONSOLE
   ======================================================== */
:root {
    --bg-dark: #070b12;
    --bg-surface: #0c121d;
    --bg-card: #111927;
    --bg-card-hover: #162133;
    --accent-blue: #2563eb;
    --accent-blue-light: #60a5fa;
    --accent-cyan: #22d3ee;
    --text-main: #edf3fb;
    --text-muted: #94a3b8;
    --text-sub: #64748b;
    --border-color: rgba(148, 163, 184, 0.13);
    --border-strong: rgba(148, 163, 184, 0.2);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.28);
    --shadow-glow: 0 20px 60px rgba(37, 99, 235, 0.12);
    --radius-xl: 22px;
    --radius-lg: 16px;
    --radius-md: 10px;
}

html {
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(circle at 82% -12%, rgba(37, 99, 235, 0.12), transparent 28rem),
        linear-gradient(180deg, #080d15 0%, var(--bg-dark) 55%);
    letter-spacing: -0.01em;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.23;
    background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, black, transparent 75%);
}

::selection { background: rgba(59, 130, 246, 0.38); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #080d15; }
::-webkit-scrollbar-thumb { background: #27354a; border: 2px solid #080d15; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #354963; }

.admin-layout {
    display: grid;
    grid-template-columns: 268px minmax(0, 1fr);
    grid-template-rows: 76px minmax(calc(100vh - 76px), auto);
    min-height: 100vh;
}

.admin-header {
    grid-column: 1 / -1;
    grid-row: 1;
    background: rgba(8, 13, 21, 0.88);
    border-bottom-color: var(--border-color);
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
}

.header-inner {
    max-width: none;
    height: 76px;
    padding: 0 28px;
}

.brand-wrapper { gap: 14px; }
.admin-logo { height: 42px; max-width: 152px; object-fit: contain; }

.brand-copy {
    display: flex;
    flex-direction: column;
    padding-left: 14px;
    border-left: 1px solid var(--border-strong);
    line-height: 1.15;
}

.brand-kicker {
    color: var(--text-sub);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .14em;
}

.brand-title {
    margin-top: 4px;
    color: #fff;
    font-family: var(--font-heading);
    font-size: .95rem;
    font-weight: 700;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: 6px;
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.22);
    color: #6ee7b7;
    letter-spacing: .05em;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 4px rgba(52, 211, 153, .09), 0 0 12px rgba(52, 211, 153, .55);
}

.header-date {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-right: 16px;
    border-right: 1px solid var(--border-color);
    line-height: 1.2;
}

.header-date span { color: #dbe7f6; font-size: .82rem; font-weight: 700; }
.header-date small { color: var(--text-sub); font-size: .66rem; margin-top: 3px; }

.user-nav { gap: 13px; }
.user-info { padding: 6px 10px 6px 6px; border-radius: 12px; }
.avatar-circle {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(96, 165, 250, .35);
    box-shadow: inset 0 0 18px rgba(255,255,255,.08), 0 8px 18px rgba(37,99,235,.18);
}

.admin-nav-bar {
    grid-column: 1;
    grid-row: 2;
    position: sticky;
    top: 76px;
    align-self: start;
    height: calc(100vh - 76px);
    background: linear-gradient(180deg, rgba(12,18,29,.98), rgba(8,13,21,.96));
    border-right: 1px solid var(--border-color);
    border-bottom: 0;
    overflow-y: auto;
    z-index: 80;
}

.nav-tabs-container {
    max-width: none;
    height: 100%;
    padding: 28px 18px 90px;
    flex-direction: column;
    gap: 6px;
    overflow: visible;
    position: relative;
}

.nav-tabs-container::before {
    content: "NAVEGACI\00D3N";
    display: block;
    padding: 0 12px 9px;
    color: #506078;
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .15em;
}

.nav-tabs-container::after {
    content: "ASISTEC  /  ADMIN";
    position: absolute;
    bottom: 26px;
    left: 30px;
    color: #3f4e63;
    font-size: .61rem;
    font-weight: 800;
    letter-spacing: .14em;
}

.nav-tab-btn {
    width: 100%;
    min-height: 48px;
    padding: 11px 12px;
    gap: 12px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #8797ad;
    font-size: .84rem;
    text-align: left;
}

.nav-tab-btn svg {
    flex: 0 0 auto;
    width: 19px;
    height: 19px;
    opacity: .8;
}

.nav-tab-btn:hover {
    color: #dce8f7;
    background: rgba(255,255,255,.035);
    border-color: rgba(255,255,255,.045);
    transform: translateX(2px);
}

.nav-tab-btn.active {
    color: #fff;
    border-color: rgba(96, 165, 250, .22);
    border-bottom-color: rgba(96, 165, 250, .22);
    background: linear-gradient(105deg, rgba(37,99,235,.2), rgba(37,99,235,.07));
    box-shadow: inset 3px 0 0 #3b82f6, 0 10px 26px rgba(0,0,0,.12);
}

.nav-tab-btn.active svg { color: #60a5fa; opacity: 1; }
.nav-tab-btn.nav-section-break { margin-top: 18px; }

.nav-tab-badge {
    margin-left: auto;
    min-width: 25px;
    text-align: center;
    background: rgba(148,163,184,.09);
    border: 1px solid rgba(148,163,184,.08);
    color: #8797ad;
}

.nav-tab-btn.active .nav-tab-badge {
    background: #2563eb;
    border-color: #3b82f6;
    box-shadow: 0 5px 14px rgba(37,99,235,.25);
}

.admin-main {
    grid-column: 2;
    grid-row: 2;
    max-width: none;
    min-width: 0;
    margin: 0;
    padding: 38px clamp(24px, 3vw, 48px) 64px;
}

.tab-pane.active { animation: premiumReveal .35s cubic-bezier(.2,.75,.3,1); }

@keyframes premiumReveal {
    from { opacity: 0; transform: translateY(10px); filter: blur(2px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.dashboard-header { margin-bottom: 26px; align-items: flex-end; }
.dashboard-title { max-width: 780px; }
.section-eyebrow,
.dashboard-title::before {
    display: block;
    margin-bottom: 9px;
    color: #60a5fa;
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .16em;
}

.dashboard-title::before { content: "CENTRO DE OPERACIONES"; }
.dashboard-title .section-eyebrow + h1 { margin-top: 0; }
.dashboard-title:has(.section-eyebrow)::before { display: none; }

.dashboard-title h1 {
    font-size: clamp(1.65rem, 2.2vw, 2.15rem);
    line-height: 1.15;
    letter-spacing: -.035em;
}

.dashboard-title p {
    max-width: 720px;
    margin-top: 8px;
    color: #8190a6;
    line-height: 1.65;
}

.kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 26px;
}

.kpi-card,
.metric-card {
    position: relative;
    min-width: 0;
    padding: 20px;
    background: linear-gradient(145deg, rgba(20,30,47,.96), rgba(13,21,33,.96));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.kpi-card::after,
.metric-card::after {
    content: "";
    position: absolute;
    width: 130px;
    height: 130px;
    right: -70px;
    top: -75px;
    border-radius: 50%;
    background: rgba(59,130,246,.08);
    filter: blur(2px);
}

.kpi-card:hover,
.metric-card:hover {
    transform: translateY(-3px);
    border-color: rgba(96,165,250,.26);
    box-shadow: var(--shadow-glow);
}

.kpi-card-featured {
    background: linear-gradient(145deg, rgba(31,65,129,.45), rgba(14,25,42,.96));
    border-color: rgba(96,165,250,.22);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 13px;
    border: 1px solid currentColor;
    border-color: color-mix(in srgb, currentColor 22%, transparent);
}

.kpi-info .kpi-value { font-size: 1.7rem; letter-spacing: -.04em; }
.kpi-info .kpi-label { margin-top: 5px; color: #c4d0df; font-weight: 650; }
.kpi-context { margin-top: 4px; color: #64748b; font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card-box {
    background: linear-gradient(145deg, rgba(17,25,39,.98), rgba(11,18,29,.98));
    border-color: var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: 0 18px 55px rgba(0,0,0,.16);
}

.card-box:has(.table-responsive) { padding: 0; overflow: hidden; }
.card-box-header { margin-bottom: 18px; }
.card-box-title { font-size: 1rem; letter-spacing: -.02em; }

.filter-bar {
    padding: 8px;
    margin-bottom: 18px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: rgba(12,18,29,.72);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.015);
}

.filter-pill {
    min-height: 38px;
    padding: 7px 13px;
    background: transparent;
    border-color: transparent;
    border-radius: 9px;
    color: #8797ad;
    font-size: .79rem;
}

.filter-pill:hover { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.06); }
.filter-pill.active {
    background: rgba(37,99,235,.18);
    border-color: rgba(96,165,250,.24);
    color: #dbeafe;
    box-shadow: none;
}

.filter-bar .input-icon-wrapper input {
    height: 40px;
    background: #0a101a;
    border-color: rgba(148,163,184,.16);
}

.table-responsive { scrollbar-width: thin; }
.admin-table,
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .84rem; text-align: left; }

.admin-table th,
.data-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 13px 16px;
    background: rgba(8,14,23,.96);
    border-bottom: 1px solid var(--border-color);
    color: #6f8098;
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .085em;
    text-transform: uppercase;
    white-space: nowrap;
}

.admin-table td,
.data-table td {
    padding: 15px 16px;
    border-bottom: 1px solid rgba(148,163,184,.085);
    color: #cbd5e1;
    vertical-align: middle;
}

.admin-table tbody tr:last-child td,
.data-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr,
.data-table tbody tr { transition: background .18s ease, box-shadow .18s ease; }
.admin-table tbody tr:hover,
.data-table tbody tr:hover { background: rgba(59,130,246,.045); box-shadow: inset 3px 0 0 rgba(59,130,246,.65); }

.user-cell { gap: 2px; }
.user-cell .name { color: #f1f5f9; font-size: .87rem; }
.user-cell .contact { color: #718198; line-height: 1.45; }
.actions-cell { flex-wrap: nowrap; }

.tag-badge,
.status-badge { letter-spacing: .035em; }
.status-badge { border: 1px solid transparent; }
.status-badge.pendiente { border-color: rgba(245,158,11,.2); }
.status-badge.en-proceso { border-color: rgba(6,182,212,.2); }
.status-badge.resuelto { border-color: rgba(16,185,129,.2); }

.btn {
    min-height: 39px;
    border-radius: 9px;
    font-size: .82rem;
    box-shadow: var(--shadow-sm);
}

.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); box-shadow: 0 8px 20px rgba(37,99,235,.2); }
.btn-primary:hover { background: linear-gradient(135deg, #3b82f6, #2563eb); box-shadow: 0 10px 24px rgba(37,99,235,.3); }
.btn-secondary { background: rgba(148,163,184,.055); border-color: rgba(148,163,184,.15); }
.btn-secondary:hover { background: rgba(148,163,184,.11); }
.btn-sm { min-height: 32px; padding: 6px 10px; }

.form-control,
.form-select-sm {
    width: 100%;
    min-height: 42px;
    padding: 10px 13px;
    background: #090f18;
    border: 1px solid rgba(148,163,184,.16);
    border-radius: 9px;
    color: #e2e8f0;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.form-select-sm { min-width: 142px; min-height: 34px; padding: 6px 9px; font-size: .76rem; }
.input-icon-wrapper input { padding-left: 42px; }
.form-control:focus,
.form-select-sm:focus {
    outline: none;
    background: #0b131f;
    border-color: rgba(96,165,250,.7);
    box-shadow: 0 0 0 3px rgba(37,99,235,.13);
}

textarea.form-control { resize: vertical; line-height: 1.55; }
.form-group label { display: block; margin-bottom: 7px; color: #9cacbf; font-size: .75rem; font-weight: 700; }

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 15px;
}

.metric-card { padding: 20px; transition: .2s ease; }
.metric-title { color: #8190a6; font-size: .75rem; font-weight: 650; }
.metric-value { margin-top: 9px; color: #fff; font-family: var(--font-heading); font-size: 1.75rem; font-weight: 750; letter-spacing: -.04em; }
.metric-sub { margin-top: 4px; color: #536177; font-size: .69rem; }
.mb-4 { margin-bottom: 20px; }
.py-4 { padding-top: 28px !important; padding-bottom: 28px !important; }
.text-center { text-align: center; }

.projects-grid { grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 18px; }
.project-admin-card {
    background: linear-gradient(150deg, rgba(18,28,44,.98), rgba(11,18,29,.98));
    border-color: var(--border-color);
    box-shadow: 0 14px 40px rgba(0,0,0,.15);
}
.project-admin-card:hover { border-color: rgba(96,165,250,.28); box-shadow: var(--shadow-glow); }
.project-card-body { padding: 22px; }
.project-card-title { margin-bottom: 8px; letter-spacing: -.025em; }
.project-card-desc { line-height: 1.6; }

.modal-overlay { padding: 22px; background: rgba(2,6,12,.82); backdrop-filter: blur(12px); }
.modal-dialog {
    max-height: calc(100vh - 44px);
    overflow-y: auto;
    background: linear-gradient(160deg, #121b2a, #0b121d);
    border-color: rgba(148,163,184,.18);
    border-radius: 20px;
    box-shadow: 0 35px 90px rgba(0,0,0,.55);
}
.modal-header { position: sticky; top: -28px; z-index: 4; padding: 22px 0 16px; background: linear-gradient(#121b2a 75%, transparent); }
.modal-header h3 { letter-spacing: -.025em; }
.modal-close { width: 34px; height: 34px; border-radius: 8px; background: rgba(148,163,184,.08); }
.modal-close:hover { background: rgba(239,68,68,.14); color: #fca5a5; }

/* Message detail modal */
.inquiry-modal {
    width: min(960px, 100%);
    max-width: 960px;
    padding: 0;
    overflow: hidden auto;
    border-color: rgba(96, 165, 250, .2);
    background: #0c131f;
}

.inquiry-modal .inquiry-modal-header {
    position: static;
    margin: 0;
    padding: 24px 28px 21px;
    background:
        radial-gradient(circle at 75% -40%, rgba(59,130,246,.2), transparent 45%),
        linear-gradient(130deg, #121d2d, #0d1521);
    border-bottom: 1px solid var(--border-color);
}

.modal-eyebrow {
    display: block;
    margin-bottom: 5px;
    color: #60a5fa;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .16em;
}

.inquiry-modal-header h3 { font-size: 1.35rem; }

.inquiry-modal-layout {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    min-height: 430px;
}

.inquiry-contact-panel {
    padding: 28px 24px;
    background: linear-gradient(180deg, rgba(15,25,40,.96), rgba(10,17,28,.96));
    border-right: 1px solid var(--border-color);
}

.inquiry-contact-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 23px;
    border-bottom: 1px solid rgba(148,163,184,.1);
}

.inquiry-avatar {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(96,165,250,.32);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(37,99,235,.4), rgba(6,182,212,.18));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 12px 28px rgba(37,99,235,.16);
    color: #dbeafe;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: .03em;
}

.inquiry-contact-kicker {
    display: block;
    margin-bottom: 3px;
    color: #64748b;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.inquiry-contact-head h4 {
    color: #f8fafc;
    font-family: var(--font-heading);
    font-size: 1rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.inquiry-contact-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.inquiry-contact-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: inherit;
    text-decoration: none;
    transition: .2s ease;
}

.inquiry-contact-item:hover {
    border-color: rgba(96,165,250,.18);
    background: rgba(59,130,246,.07);
    transform: translateX(2px);
}

.inquiry-contact-item.is-disabled { opacity: .48; pointer-events: none; }

.inquiry-contact-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: rgba(59,130,246,.09);
    color: #60a5fa;
}

.inquiry-contact-item > span:last-child { min-width: 0; }
.inquiry-contact-item small,
.inquiry-category-block small {
    display: block;
    margin-bottom: 2px;
    color: #617087;
    font-size: .64rem;
    font-weight: 650;
}

.inquiry-contact-item strong {
    display: block;
    max-width: 172px;
    color: #cbd5e1;
    font-size: .73rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inquiry-category-block {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid rgba(148,163,184,.1);
}

.inquiry-category-block small { margin-bottom: 9px; text-transform: uppercase; letter-spacing: .07em; }

.inquiry-message-panel { padding: 31px 32px 28px; min-width: 0; }

.inquiry-message-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 10px;
    color: #64748b;
    font-size: .69rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.inquiry-message-meta time {
    padding: 5px 9px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: rgba(148,163,184,.04);
    color: #8190a6;
    font-size: .65rem;
    letter-spacing: 0;
    text-transform: none;
}

.inquiry-message-panel h2 {
    color: #f8fafc;
    font-family: var(--font-heading);
    font-size: clamp(1.35rem, 2.4vw, 1.8rem);
    line-height: 1.25;
    letter-spacing: -.035em;
    overflow-wrap: anywhere;
}

.inquiry-message-card {
    position: relative;
    min-height: 170px;
    margin-top: 22px;
    padding: 27px 28px 25px 34px;
    overflow: hidden;
    border: 1px solid rgba(96,165,250,.15);
    border-radius: 16px;
    background:
        radial-gradient(circle at 100% 0, rgba(37,99,235,.1), transparent 36%),
        rgba(7,13,23,.72);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}

.inquiry-message-card::before {
    content: "";
    position: absolute;
    top: 26px;
    bottom: 26px;
    left: 0;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(#3b82f6, #22d3ee);
}

.inquiry-quote-mark {
    position: absolute;
    right: 21px;
    top: -13px;
    color: rgba(96,165,250,.09);
    font-family: Georgia, serif;
    font-size: 7rem;
    line-height: 1;
    pointer-events: none;
}

#inq-mensaje {
    position: relative;
    color: #c7d2e0;
    font-size: .91rem;
    line-height: 1.75;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.inquiry-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 20px;
}

.inquiry-action-feedback {
    display: flex;
    align-items: center;
    gap: 9px;
    width: fit-content;
    max-width: 100%;
    max-height: 0;
    margin-top: 0;
    padding: 0 12px;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #6ee7b7;
    font-size: .72rem;
    font-weight: 650;
    opacity: 0;
    transform: translateY(-4px);
    transition: max-height .25s ease, margin .25s ease, padding .25s ease, opacity .2s ease, transform .25s ease;
}

.inquiry-action-feedback.is-visible {
    max-height: 48px;
    margin-top: 12px;
    padding: 8px 12px;
    border-color: rgba(16,185,129,.2);
    background: rgba(16,185,129,.07);
    opacity: 1;
    transform: translateY(0);
}

.inquiry-action-feedback.is-error {
    color: #fca5a5;
    border-color: rgba(239,68,68,.22);
    background: rgba(239,68,68,.08);
}

.inquiry-feedback-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(16,185,129,.13);
}

.inquiry-action-feedback.is-error .inquiry-feedback-icon { background: rgba(239,68,68,.13); }

.btn-whatsapp {
    background: rgba(37,211,102,.09);
    border-color: rgba(37,211,102,.25);
    color: #4ade80;
}
.btn-whatsapp:hover { background: rgba(37,211,102,.17); border-color: rgba(37,211,102,.4); }
.btn.is-disabled { opacity: .42; pointer-events: none; filter: grayscale(.4); }

.inquiry-modal .inquiry-modal-footer {
    justify-content: space-between;
    align-items: center;
    margin: 0;
    padding: 16px 28px;
    background: #0a111b;
    border-top: 1px solid var(--border-color);
}

.inquiry-modal-footer > span {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: #64748b;
    font-size: .69rem;
}

.inquiry-modal-footer .status-dot { width: 6px; height: 6px; }

/* Light blue premium variant for the message viewer */
.inquiry-modal {
    color-scheme: light;
    background: #f8fbff;
    border-color: rgba(14, 116, 144, .2);
    box-shadow: 0 40px 110px rgba(2, 23, 43, .42), 0 0 0 1px rgba(255,255,255,.7) inset;
}

.inquiry-modal .inquiry-modal-header {
    background:
        radial-gradient(circle at 78% -70%, rgba(14,165,233,.2), transparent 48%),
        linear-gradient(135deg, #f7fcff 0%, #eaf7ff 54%, #e2f3fb 100%);
    border-bottom-color: #cfe5f2;
}

.inquiry-modal .modal-eyebrow { color: #0284c7; }
.inquiry-modal-header h3 { color: #0f2940; }
.inquiry-modal .modal-close {
    color: #527089;
    background: rgba(255,255,255,.72);
    border: 1px solid #c3dce9;
    box-shadow: 0 6px 18px rgba(14,116,144,.08);
}
.inquiry-modal .modal-close:hover { color: #075985; background: #fff; border-color: #7dd3fc; }

.inquiry-modal .inquiry-contact-panel {
    background: linear-gradient(180deg, #eef8fe 0%, #e8f5fc 100%);
    border-right-color: #cfe5f2;
}

.inquiry-modal .inquiry-contact-head,
.inquiry-modal .inquiry-category-block { border-color: rgba(14,116,144,.13); }

.inquiry-modal .inquiry-avatar {
    color: #ffffff;
    border-color: rgba(2,132,199,.28);
    background: linear-gradient(145deg, #0ea5e9, #0369a1);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 12px 28px rgba(2,132,199,.2);
}

.inquiry-modal .inquiry-contact-kicker,
.inquiry-modal .inquiry-contact-item small,
.inquiry-modal .inquiry-category-block small,
.inquiry-modal .inquiry-message-meta { color: #66839a; }

.inquiry-modal .inquiry-contact-head h4 { color: #102f46; }
.inquiry-modal .inquiry-contact-item { color: #173b52; }
.inquiry-modal .inquiry-contact-item:hover {
    border-color: rgba(2,132,199,.2);
    background: rgba(255,255,255,.68);
    box-shadow: 0 8px 20px rgba(14,116,144,.07);
}

.inquiry-modal .inquiry-contact-icon {
    color: #0284c7;
    background: rgba(14,165,233,.11);
    border: 1px solid rgba(14,165,233,.1);
}

.inquiry-modal .inquiry-contact-item strong { color: #244960; }
.inquiry-modal .inquiry-category-block .tag-badge {
    color: #0369a1;
    background: rgba(14,165,233,.1);
    border-color: rgba(2,132,199,.2);
}

.inquiry-modal .inquiry-message-panel { background: #ffffff; }
.inquiry-modal .inquiry-message-meta time {
    color: #527089;
    background: #f1f8fc;
    border-color: #d8e9f2;
}
.inquiry-modal .inquiry-message-panel h2 { color: #102f46; }

.inquiry-modal .inquiry-message-card {
    border-color: #cbe4f2;
    background:
        radial-gradient(circle at 100% 0, rgba(14,165,233,.09), transparent 38%),
        linear-gradient(145deg, #f8fcff, #f1f9fe);
    box-shadow: inset 0 1px 0 #fff, 0 12px 32px rgba(14,116,144,.07);
}

.inquiry-modal .inquiry-message-card::before { background: linear-gradient(#0ea5e9, #38bdf8); }
.inquiry-modal .inquiry-quote-mark { color: rgba(2,132,199,.09); }
.inquiry-modal #inq-mensaje { color: #36566d; }

.inquiry-modal .btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    border-color: #0284c7;
    box-shadow: 0 10px 24px rgba(2,132,199,.2);
}
.inquiry-modal .btn-primary:hover { background: linear-gradient(135deg, #38bdf8, #0284c7); }
.inquiry-modal .btn-secondary {
    color: #31556d;
    background: #f6fbfe;
    border-color: #cddfea;
    box-shadow: 0 4px 12px rgba(14,116,144,.05);
}
.inquiry-modal .btn-secondary:hover { color: #075985; background: #eaf7fd; border-color: #7dd3fc; }
.inquiry-modal .btn-whatsapp { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.inquiry-modal .btn-whatsapp:hover { background: #d1fae5; border-color: #6ee7b7; }

.inquiry-modal .inquiry-action-feedback.is-visible {
    color: #047857;
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.inquiry-modal .inquiry-modal-footer {
    background: linear-gradient(180deg, #f3f9fd, #edf7fc);
    border-top-color: #cfe5f2;
}
.inquiry-modal-footer > span { color: #66839a; }
.inquiry-modal-footer .status-dot { background: #0ea5e9; box-shadow: 0 0 0 4px rgba(14,165,233,.1), 0 0 12px rgba(14,165,233,.35); }

@media (max-width: 1280px) {
    .admin-layout { grid-template-columns: 236px minmax(0,1fr); }
    .kpi-grid, .metrics-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .admin-main { padding-left: 28px; padding-right: 28px; }
    .nav-tab-btn { font-size: .79rem; }
}

@media (max-width: 1024px) {
    .admin-layout { display: flex; flex-direction: column; }
    .admin-header { position: sticky; top: 0; }
    .admin-nav-bar {
        position: sticky;
        top: 76px;
        width: 100%;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
        overflow-x: auto;
    }
    .nav-tabs-container { width: max-content; min-width: 100%; height: auto; padding: 8px 18px; flex-direction: row; }
    .nav-tabs-container::before, .nav-tabs-container::after { display: none; }
    .nav-tab-btn { width: auto; min-height: 42px; padding: 9px 13px; }
    .nav-tab-btn.nav-section-break { margin-top: 0; margin-left: 10px; }
    .nav-tab-btn.active { box-shadow: inset 0 -2px 0 #3b82f6; }
    .admin-main { width: 100%; padding-top: 30px; }
    .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    html, body { max-width: 100%; overflow-x: hidden; }
    .admin-layout, .admin-main, .tab-pane, .card-box, .table-responsive { min-width: 0; max-width: 100%; }
    .header-inner { height: 68px; padding: 0 16px; }
    .admin-logo { height: 34px; max-width: 118px; }
    .brand-copy, .admin-badge, .header-date, .user-info { display: none; }
    .admin-nav-bar { top: 68px; }
    .nav-tabs-container { padding: 7px 12px; }
    .nav-tab-btn span:not(.nav-tab-badge) { display: none; }
    .nav-tab-btn { gap: 7px; }
    .nav-tab-btn.nav-section-break { margin-left: 0; }
    .admin-main { padding: 24px 16px 48px; }
    .dashboard-header { align-items: flex-start; flex-direction: column; gap: 16px; }
    .dashboard-header > .btn { width: 100%; }
    .dashboard-title h1 { font-size: 1.55rem; }
    .dashboard-title h1, .dashboard-title p { overflow-wrap: anywhere; }
    .kpi-grid, .metrics-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi-card { padding: 15px; gap: 12px; }
    .kpi-icon { width: 40px; height: 40px; flex-basis: 40px; }
    .kpi-icon svg { width: 19px; height: 19px; }
    .kpi-info .kpi-value, .metric-value { font-size: 1.4rem; }
    .kpi-context { display: none; }
    .filter-bar { align-items: stretch !important; }
    .filter-bar > div { width: 100%; min-width: 0; }
    .filter-bar .input-icon-wrapper { max-width: none !important; width: 100%; }
    .card-box { border-radius: 16px; }
    .table-responsive { overflow-x: auto; overscroll-behavior-inline: contain; }
    .admin-table, .data-table { min-width: 880px; }
    .admin-table th, .data-table th { padding: 11px 13px; }
    .admin-table td, .data-table td { padding: 13px; }
    .modal-overlay { padding: 10px; align-items: flex-end; }
    .modal-dialog { max-height: 92vh; padding: 22px 18px; border-radius: 20px 20px 10px 10px; }
    .modal-footer { flex-direction: column-reverse; }
    .modal-footer .btn { width: 100%; }
    .inquiry-modal { border-radius: 20px 20px 10px 10px; }
    .inquiry-modal .inquiry-modal-header { padding: 20px; }
    .inquiry-modal-layout { grid-template-columns: 1fr; }
    .inquiry-contact-panel { padding: 20px; border-right: 0; border-bottom: 1px solid var(--border-color); }
    .inquiry-contact-head { padding-bottom: 18px; }
    .inquiry-contact-list { display: grid; grid-template-columns: 1fr 1fr; margin-top: 14px; }
    .inquiry-category-block { margin-top: 14px; padding-top: 14px; }
    .inquiry-message-panel { padding: 23px 20px; }
    .inquiry-message-meta { align-items: flex-start; flex-direction: column; gap: 8px; }
    .inquiry-message-card { min-height: 140px; margin-top: 18px; padding: 23px 21px 22px 27px; }
    .inquiry-quick-actions { flex-direction: column; }
    .inquiry-quick-actions .btn { width: 100%; }
    .inquiry-modal .inquiry-modal-footer { align-items: stretch; padding: 15px 20px; }
    .inquiry-modal-footer > span { display: none; }
}

@media (max-width: 480px) {
    .inquiry-contact-list { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
    .user-nav > .btn-secondary { display: none; }
    .kpi-grid, .metrics-grid { grid-template-columns: 1fr; }
    .quote-kpi-grid { grid-template-columns: 1fr; }
    .projects-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ========================================================
   LIGHT SKY ADMIN THEME
   ======================================================== */
:root {
    --bg-dark: #f3f8fc;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #edf8fd;
    --accent-blue: #0284c7;
    --accent-blue-light: #0ea5e9;
    --accent-cyan: #06b6d4;
    --text-main: #16354a;
    --text-muted: #607d91;
    --text-sub: #7892a3;
    --border-color: #d8e7ef;
    --border-strong: #c4dce8;
    --shadow-sm: 0 1px 3px rgba(15, 72, 103, .07);
    --shadow-md: 0 20px 55px rgba(15, 72, 103, .13);
    --shadow-glow: 0 18px 45px rgba(14, 165, 233, .13);
}

html { color-scheme: light; }

body {
    color: var(--text-main);
    background:
        radial-gradient(circle at 83% -8%, rgba(56, 189, 248, .15), transparent 30rem),
        radial-gradient(circle at 22% 105%, rgba(14, 165, 233, .07), transparent 34rem),
        linear-gradient(180deg, #f8fcff 0%, #f1f7fb 52%, #edf5fa 100%);
}

body::before {
    opacity: .45;
    background-image: linear-gradient(rgba(2,132,199,.035) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(2,132,199,.035) 1px, transparent 1px);
}

::selection { color: #0c4a6e; background: rgba(125, 211, 252, .45); }
::-webkit-scrollbar-track { background: #eef6fa; }
::-webkit-scrollbar-thumb { background: #bdd7e4; border-color: #eef6fa; }
::-webkit-scrollbar-thumb:hover { background: #91bdcf; }

.admin-header {
    background: rgba(255, 255, 255, .9);
    border-bottom-color: #d9e8f0;
    box-shadow: 0 8px 32px rgba(15, 72, 103, .08);
}

.brand-copy { border-left-color: #d5e4ec; }
.brand-kicker { color: #6a879a; }
.brand-title,
.user-text .user-name { color: #163b52; }
.header-date { border-right-color: #dce9f0; }
.header-date span { color: #274e65; }
.header-date small,
.user-text .user-role { color: #7892a3; }
.admin-badge {
    color: #087f5b;
    background: #ecfdf5;
    border-color: #b7ead6;
}
.avatar-circle {
    border-color: rgba(2, 132, 199, .28);
    background: linear-gradient(145deg, #38bdf8, #0284c7);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 8px 20px rgba(2,132,199,.18);
}

.admin-nav-bar {
    background: linear-gradient(180deg, #f5fbfe 0%, #eaf5fa 100%);
    border-right-color: #d4e6ef;
    box-shadow: inset -1px 0 rgba(255,255,255,.8);
}
.nav-tabs-container::before { color: #7592a4; }
.nav-tabs-container::after { color: #91a8b7; }
.nav-tab-btn { color: #58788d; }
.nav-tab-btn:hover {
    color: #075985;
    background: rgba(255,255,255,.7);
    border-color: #d7e8f0;
}
.nav-tab-btn.active {
    color: #075985;
    border-color: #bfe2f2;
    background: linear-gradient(105deg, #dff4fd, #eefaff);
    box-shadow: inset 3px 0 0 #0ea5e9, 0 8px 22px rgba(14,116,144,.08);
}
.nav-tab-btn.active svg { color: #0284c7; }
.nav-tab-badge {
    color: #5f7e91;
    background: rgba(255,255,255,.72);
    border-color: #d6e6ee;
}
.nav-tab-btn.active .nav-tab-badge {
    color: #fff;
    background: #0284c7;
    border-color: #0284c7;
    box-shadow: 0 5px 14px rgba(2,132,199,.18);
}

.section-eyebrow,
.dashboard-title::before { color: #0284c7; }
.dashboard-title h1 { color: #15384e; }
.dashboard-title p { color: #668397; }

.kpi-card,
.metric-card {
    background: linear-gradient(145deg, #ffffff, #f7fbfd);
    border-color: #d9e8f0;
    box-shadow: 0 12px 32px rgba(15,72,103,.07);
}
.kpi-card::after,
.metric-card::after { background: rgba(56,189,248,.1); }
.kpi-card:hover,
.metric-card:hover { border-color: #a8d8ea; }
.kpi-card-featured {
    background: linear-gradient(145deg, #f2fbff, #e5f6fd);
    border-color: #b8e1f1;
}
.kpi-info .kpi-value,
.metric-value { color: #123a53; }
.kpi-info .kpi-label { color: #355a70; }
.kpi-context,
.metric-title { color: #6a8799; }
.metric-sub { color: #829aaa; }

.card-box {
    background: rgba(255,255,255,.94);
    border-color: #d9e8f0;
    box-shadow: 0 18px 48px rgba(15,72,103,.08);
}
.card-box-title,
.project-card-title { color: #173d55; }

.filter-bar {
    background: rgba(255,255,255,.78);
    border-color: #d8e8f0;
    box-shadow: 0 8px 24px rgba(15,72,103,.05), inset 0 1px #fff;
}
.filter-pill { color: #607f92; }
.filter-pill:hover {
    color: #075985;
    background: #eef9fd;
    border-color: #cae6f1;
}
.filter-pill.active {
    color: #075985;
    background: #dff4fd;
    border-color: #b8e0f0;
}

.filter-bar .input-icon-wrapper input,
.form-control,
.form-select-sm,
.input-icon-wrapper input,
.input-icon-wrapper select,
.input-icon-wrapper textarea {
    color: #173b52;
    background: #ffffff;
    border-color: #cfdee7;
}
.form-control::placeholder,
.input-icon-wrapper input::placeholder,
.input-icon-wrapper textarea::placeholder { color: #8ba1af; }
.form-control:focus,
.form-select-sm:focus,
.input-icon-wrapper input:focus {
    background: #ffffff;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(14,165,233,.13);
}
.form-group label { color: #526f82; }

.admin-table th,
.data-table th {
    color: #607f92;
    background: #eef7fb;
    border-bottom-color: #d4e6ee;
}
.admin-table td,
.data-table td {
    color: #315267;
    border-bottom-color: #e1edf2;
}
.admin-table tbody tr:hover,
.data-table tbody tr:hover {
    background: #f1faff;
    box-shadow: inset 3px 0 0 #38bdf8;
}
.user-cell .name { color: #173c54; }
.user-cell .contact { color: #708b9d; }

.project-admin-card {
    background: linear-gradient(150deg, #ffffff, #f6fbfd);
    border-color: #d7e7ef;
    box-shadow: 0 14px 36px rgba(15,72,103,.07);
}
.project-admin-card:hover { border-color: #a9d8e9; }
.project-card-desc { color: #607d91; }
.project-card-meta { color: #7892a3; border-top-color: #dfeaf0; }

.btn-secondary {
    color: #34586f;
    background: #f8fcfe;
    border-color: #cfdee7;
}
.btn-secondary:hover {
    color: #075985;
    background: #eaf7fd;
    border-color: #8ed2eb;
}
.btn-danger { color: #b42318; background: #fff3f1; border-color: #fecaca; }
.btn-danger:hover { color: #fff; background: #dc2626; border-color: #dc2626; }

.tag-badge.camaras { color: #0369a1; background: #e0f2fe; border-color: #bae6fd; }
.tag-badge.alarmas { color: #a16207; background: #fef9c3; border-color: #fde68a; }
.tag-badge.proyectos { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
.tag-badge.otros { color: #475569; background: #f1f5f9; border-color: #cbd5e1; }
.status-badge.pendiente { color: #a16207; background: #fff7d6; }
.status-badge.en-proceso { color: #0e7490; background: #e6faff; }
.status-badge.resuelto { color: #047857; background: #eafaf3; }

.modal-overlay {
    background: rgba(20, 55, 75, .3);
    backdrop-filter: blur(10px) saturate(.9);
}
.modal-dialog {
    color: #274b61;
    background: linear-gradient(160deg, #ffffff, #f6fbfe);
    border-color: #cae0eb;
    box-shadow: 0 35px 90px rgba(15,55,78,.25), 0 0 0 1px rgba(255,255,255,.8) inset;
}
.modal-header {
    background: linear-gradient(rgba(255,255,255,.98) 75%, transparent);
    border-bottom-color: #dbe9f0;
}
.modal-header h3 { color: #15384e; }
.modal-close {
    color: #607d91;
    background: #f1f8fc;
    border: 1px solid #cfe1ea;
}
.modal-close:hover { color: #075985; background: #e4f5fc; border-color: #7dd3fc; }
.modal-footer { border-top-color: #dce9ef; }

/* Neutralizes legacy dark inline panels inside detail modals. */
.modal-body > div[style*="rgba(7,13,24"],
#q-detalles,
#inv-mensaje {
    color: #36566d;
    background: #f1f8fc !important;
    border-color: #d3e5ee !important;
}

/* Keep the message modal crisp over the softer page overlay. */
.inquiry-modal {
    border-color: #bddce9;
    box-shadow: 0 38px 100px rgba(15,55,78,.25), 0 0 0 1px rgba(255,255,255,.82) inset;
}

/* ========================================================
   PREMIUM LIGHT RECORD VIEWERS
   Cotizaciones e inversores comparten el lenguaje visual
   del lector de consultas, sin afectar los modales de edición.
   ======================================================== */
.record-detail-modal {
    width: min(900px, 100%);
    max-width: 900px !important;
    padding: 0;
    overflow: hidden auto;
    border-color: #bcdce9;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 38px 100px rgba(15, 55, 78, .25), 0 0 0 1px rgba(255, 255, 255, .86) inset;
}

.record-detail-modal .record-detail-header {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0;
    padding: 23px 28px 20px;
    border-bottom: 1px solid #cfe5f0;
    background:
        radial-gradient(circle at 78% -80%, rgba(14, 165, 233, .2), transparent 48%),
        linear-gradient(135deg, rgba(250, 254, 255, .98), rgba(231, 247, 254, .98));
    backdrop-filter: blur(16px);
}

.record-detail-header .modal-eyebrow {
    margin-bottom: 5px;
    color: #0284c7;
}

.record-detail-header h3 {
    color: #102f46;
    font-size: 1.35rem;
    line-height: 1.25;
}

.record-detail-header .modal-close {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    color: #527089;
    background: rgba(255, 255, 255, .78);
    border-color: #c3dce9;
    box-shadow: 0 6px 18px rgba(14, 116, 144, .08);
}

.record-detail-header .modal-close:hover {
    color: #075985;
    background: #ffffff;
    border-color: #7dd3fc;
    transform: translateY(-1px);
}

.record-detail-modal .modal-body {
    padding: 27px 28px 0;
    background:
        radial-gradient(circle at 100% 0, rgba(14, 165, 233, .055), transparent 22rem),
        #ffffff;
}

.record-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 22px;
    overflow: hidden;
    border: 1px solid #cde4ef;
    border-radius: 16px;
    background: linear-gradient(145deg, #f8fcff, #eef8fd);
    box-shadow: inset 0 1px 0 #ffffff, 0 12px 30px rgba(14, 116, 144, .07);
}

.record-overview-grid > div {
    min-width: 0;
    padding: 14px 17px;
    border-bottom: 1px solid rgba(14, 116, 144, .1);
    color: #294f66;
    overflow-wrap: anywhere;
}

.record-overview-grid > div:nth-child(odd) {
    border-right: 1px solid rgba(14, 116, 144, .1);
}

.record-overview-grid > div:nth-last-child(-n+2) {
    border-bottom: 0;
}

.record-overview-grid strong,
.record-content-block > strong,
.record-message-block > strong {
    display: block;
    margin-bottom: 4px;
    color: #6a8799;
    font-size: .64rem;
    font-weight: 750;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.record-overview-grid span:not(.tag-badge) {
    color: #173f57;
    font-size: .86rem;
    font-weight: 650;
}

.record-overview-grid .tag-badge {
    display: inline-flex;
    color: #0369a1;
    background: #e0f2fe;
    border-color: #bae6fd;
}

.record-content-block,
.record-message-block {
    margin-bottom: 17px;
}

.record-content-block > div {
    color: #075985 !important;
    font-size: .9rem;
    line-height: 1.65;
}

.record-message-block > div {
    position: relative;
    min-height: 82px;
    margin-top: 7px !important;
    padding: 17px 18px 17px 22px !important;
    color: #36566d !important;
    line-height: 1.7;
    border: 1px solid #cbe4f2 !important;
    border-radius: 13px !important;
    background: linear-gradient(145deg, #f8fcff, #f1f9fe) !important;
    box-shadow: inset 0 1px 0 #ffffff, 0 10px 26px rgba(14, 116, 144, .06);
}

.record-message-block > div::before {
    content: "";
    position: absolute;
    top: 15px;
    bottom: 15px;
    left: 0;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(#0ea5e9, #67e8f9);
}

.record-ai-note {
    position: relative;
    margin-bottom: 14px;
    padding: 18px 18px 16px 48px;
    color: #28536b !important;
    white-space: pre-wrap;
    font-size: .84rem;
    line-height: 1.65;
    border: 1px solid #bfe2f1;
    border-radius: 13px;
    background: #edf9fe;
}

.record-ai-note::before {
    content: "IA";
    position: absolute;
    top: 17px;
    left: 16px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: #ffffff;
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .04em;
    border-radius: 8px;
    background: linear-gradient(145deg, #38bdf8, #0284c7);
    box-shadow: 0 6px 14px rgba(2, 132, 199, .18);
}

.record-ai-note:empty { display: none; }

.record-ai-suggestion {
    color: #17614e !important;
    border-color: #b7ead6;
    background: #f0fcf7;
}

.record-ai-suggestion::before {
    content: "OK";
    background: linear-gradient(145deg, #34d399, #059669);
    box-shadow: 0 6px 14px rgba(5, 150, 105, .16);
}

.record-detail-modal .form-group {
    padding: 16px;
    border: 1px solid #d7e8f0;
    border-radius: 13px;
    background: #fbfdff;
}

.record-detail-modal .form-group label {
    color: #466a7f;
    font-size: .7rem;
    font-weight: 750;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.record-detail-modal .form-control {
    padding: 11px 13px;
    color: #173b52;
    border-color: #cadde7;
    border-radius: 9px;
    background: #ffffff;
}

.record-detail-modal textarea.form-control {
    min-height: 94px;
    resize: vertical;
}

.record-detail-modal .modal-footer {
    margin: 24px -28px 0;
    padding: 17px 28px;
    border-top-color: #cfe5f0;
    background: linear-gradient(180deg, #f5fbfe, #edf7fc);
}

.record-detail-modal .btn-primary {
    color: #ffffff;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    border-color: #0284c7;
    box-shadow: 0 10px 24px rgba(2, 132, 199, .19);
}

.record-detail-modal .btn-primary:hover {
    background: linear-gradient(135deg, #38bdf8, #0284c7);
    box-shadow: 0 12px 27px rgba(2, 132, 199, .24);
    transform: translateY(-1px);
}

.record-detail-modal #btn-generate-ai-reply {
    color: #0284c7 !important;
    background: #eef9fe;
    border-color: #bfe3f2;
}

.record-detail-modal #btn-generate-ai-reply:hover {
    color: #075985 !important;
    background: #ddf3fc;
}

.investor-detail-modal .form-group span[style*="color:#94a3b8"] {
    color: #7892a3 !important;
}

@media (max-width: 640px) {
    .record-detail-modal {
        border-radius: 20px 20px 10px 10px;
    }

    .record-detail-modal .record-detail-header {
        padding: 19px 18px 17px;
    }

    .record-detail-header h3 { font-size: 1.14rem; }

    .record-detail-modal .modal-body {
        padding: 20px 16px 0;
    }

    .record-overview-grid { grid-template-columns: 1fr; }

    .record-overview-grid > div,
    .record-overview-grid > div:nth-child(odd) {
        border-right: 0;
        border-bottom: 1px solid rgba(14, 116, 144, .1);
    }

    .record-overview-grid > div:last-child { border-bottom: 0; }

    .record-detail-modal .form-group[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .record-detail-modal .form-group > div[style*="justify-content:space-between"] {
        align-items: flex-start !important;
        flex-direction: column;
        gap: 9px;
    }

    .record-detail-modal .modal-footer {
        margin-right: -16px;
        margin-left: -16px;
        padding: 15px 16px;
    }
}

/* ========================================================
   USERS & ROLES
   ======================================================== */
.access-dashboard-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.access-header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.access-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.access-summary-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 18px;
    border: 1px solid #d4e6ef;
    border-radius: 15px;
    background: linear-gradient(145deg, #ffffff, #f4fafd);
    box-shadow: 0 10px 28px rgba(15, 72, 103, .06);
}

.access-summary-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
}

.access-summary-icon.blue { color: #0369a1; background: #e0f2fe; }
.access-summary-icon.green { color: #047857; background: #dcfce7; }
.access-summary-icon.cyan { color: #0e7490; background: #cffafe; }

.access-summary-card div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.access-summary-card strong {
    color: #123a53;
    font-family: var(--font-heading);
    font-size: 1.45rem;
    line-height: 1.1;
}

.access-summary-card div span {
    margin-top: 3px;
    color: #6a8799;
    font-size: .72rem;
}

.access-users-card { padding: 0; overflow: hidden; }

.access-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px;
    border-bottom: 1px solid #d9e8f0;
    background: linear-gradient(135deg, #fbfeff, #f1f9fd);
}

.access-card-kicker {
    display: block;
    margin-bottom: 3px;
    color: #0284c7;
    font-size: .59rem;
    font-weight: 800;
    letter-spacing: .13em;
}

.access-security-note {
    padding: 6px 10px;
    color: #047857;
    font-size: .66rem;
    font-weight: 650;
    border: 1px solid #b7ead6;
    border-radius: 999px;
    background: #ecfdf5;
}

.access-users-table { min-width: 850px; }

.access-user-cell {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 260px;
}

.access-user-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: .82rem;
    font-weight: 800;
    border-radius: 11px;
    background: linear-gradient(145deg, #38bdf8, #0284c7);
    box-shadow: 0 7px 17px rgba(2, 132, 199, .2);
}

.access-user-cell > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.access-user-cell strong { color: #173c54; font-size: .82rem; }
.access-user-cell > div > span { color: #708b9d; font-size: .68rem; }

.current-user-label {
    display: inline-flex;
    margin-left: 5px;
    padding: 2px 6px;
    color: #0369a1;
    font-family: var(--font-body);
    font-size: .55rem;
    vertical-align: middle;
    border: 1px solid #bae6fd;
    border-radius: 999px;
    background: #e0f2fe;
}

.role-level-badge,
.user-state-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    font-size: .65rem;
    font-weight: 700;
    border: 1px solid;
    border-radius: 999px;
}

.role-level-badge.level-admin { color: #075985; border-color: #bae6fd; background: #e0f2fe; }
.role-level-badge.level-supervisor { color: #6d28d9; border-color: #ddd6fe; background: #f5f3ff; }
.role-level-badge.level-operator { color: #475569; border-color: #d5dee8; background: #f1f5f9; }
.user-state-badge.is-active { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }
.user-state-badge.is-inactive { color: #64748b; border-color: #d7e0e8; background: #f1f5f9; }

.user-state-badge > span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .1);
}

.never-accessed { color: #8aa0ae; font-size: .72rem; font-style: italic; }
.btn:disabled { cursor: not-allowed; opacity: .46; box-shadow: none; transform: none; }

.access-roles-section { margin-top: 28px; }

.access-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 15px;
}

.access-section-heading h2 { color: #15384e; font-family: var(--font-heading); font-size: 1.2rem; }
.access-section-heading p { max-width: 490px; color: #708b9d; font-size: .72rem; text-align: right; }

.access-roles-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
}

.access-role-card {
    display: flex;
    min-height: 220px;
    padding: 19px;
    flex-direction: column;
    border: 1px solid #d4e6ef;
    border-radius: 16px;
    background:
        radial-gradient(circle at 100% 0, rgba(14, 165, 233, .08), transparent 45%),
        linear-gradient(145deg, #ffffff, #f5fbfe);
    box-shadow: 0 12px 32px rgba(15, 72, 103, .07);
    transition: .2s ease;
}

.access-role-card:hover { border-color: #a8d8ea; transform: translateY(-2px); box-shadow: 0 18px 38px rgba(15, 72, 103, .1); }

.access-role-top,
.access-role-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.access-role-shield {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    color: #0284c7;
    border: 1px solid #bae6fd;
    border-radius: 11px;
    background: #e8f7fd;
}

.access-role-level { color: #52758a; font-size: .61rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.access-role-card h3 { margin-top: 15px; color: #173d55; font-family: var(--font-heading); font-size: 1rem; }
.access-role-card > p { margin: 6px 0 20px; color: #668397; font-size: .72rem; line-height: 1.55; }

.access-role-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #deebf1;
}

.access-role-footer > span { color: #7892a3; font-size: .66rem; }
.access-role-footer > span strong { color: #17435c; }

.access-form-modal {
    width: min(650px, 100%);
    max-width: 650px;
    padding: 0;
    overflow: hidden auto;
    border-color: #bddce9;
    border-radius: 21px;
    background: #ffffff;
    box-shadow: 0 38px 100px rgba(15, 55, 78, .25), 0 0 0 1px rgba(255, 255, 255, .82) inset;
}

.access-form-header {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0;
    padding: 22px 25px 19px;
    border-bottom: 1px solid #cfe5f0;
    background: linear-gradient(135deg, rgba(250, 254, 255, .98), rgba(231, 247, 254, .98));
}

.access-form-header h3 { color: #102f46; }
.access-form-header .modal-eyebrow { color: #0284c7; }
.access-form-body { padding: 24px 25px 4px; }

.access-form-intro {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 13px;
    border: 1px solid #cce6f2;
    border-radius: 12px;
    background: #f1fafe;
}

.access-form-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    color: #0284c7;
    border-radius: 10px;
    background: #dff4fd;
}

.access-form-intro div { display: flex; flex-direction: column; }
.access-form-intro strong { color: #173f57; font-size: .78rem; }
.access-form-intro span { color: #708b9d; font-size: .68rem; }

.access-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.access-field-wide { grid-column: 1 / -1; }
.access-form-modal .form-group { margin-bottom: 16px; }
.access-form-modal .form-group label { display: block; margin-bottom: 6px; color: #526f82; font-size: .7rem; font-weight: 700; }
.access-form-modal .form-control { padding: 11px 13px; color: #173b52; border-color: #cadde7; border-radius: 9px; background: #ffffff; }
.access-form-modal .form-control:focus { border-color: #38bdf8; box-shadow: 0 0 0 3px rgba(14, 165, 233, .13); }
.field-help { display: block; margin-top: 5px; color: #829aaa; font-size: .62rem; }
#admin-password-optional { color: #8aa0ae; font-size: .6rem; font-weight: 500; text-transform: none; }

.access-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 17px;
    padding: 13px 14px;
    cursor: pointer;
    border: 1px solid #d7e8f0;
    border-radius: 11px;
    background: #f8fcfe;
}

.access-switch-row > span:first-child { display: flex; flex-direction: column; }
.access-switch-row strong { color: #31556d; font-size: .73rem; }
.access-switch-row small { color: #829aaa; font-size: .62rem; }
.access-switch { position: relative; width: 42px; height: 24px; flex: 0 0 42px; }
.access-switch input { position: absolute; opacity: 0; pointer-events: none; }
.access-switch i { position: absolute; inset: 0; border-radius: 999px; background: #cbd5df; transition: .2s ease; }
.access-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #ffffff; box-shadow: 0 2px 6px rgba(15, 55, 78, .18); transition: .2s ease; }
.access-switch input:checked + i { background: linear-gradient(135deg, #38bdf8, #0284c7); }
.access-switch input:checked + i::after { transform: translateX(18px); }
.access-switch input:focus-visible + i { outline: 3px solid rgba(14, 165, 233, .2); outline-offset: 2px; }

.access-form-feedback {
    display: none;
    margin-bottom: 16px;
    padding: 10px 12px;
    color: #047857;
    font-size: .72rem;
    font-weight: 650;
    border: 1px solid #a7f3d0;
    border-radius: 9px;
    background: #ecfdf5;
}

.access-form-feedback.is-visible { display: block; }
.access-form-feedback.is-error { color: #b42318; border-color: #fecaca; background: #fff3f1; }

.access-form-footer {
    margin: 20px 0 0;
    padding: 16px 25px;
    border-top-color: #cfe5f0;
    background: linear-gradient(180deg, #f5fbfe, #edf7fc);
}

.access-role-modal { max-width: 540px; }
.access-range-label { display: flex; align-items: center; justify-content: space-between; }
.access-range-label output { min-width: 34px; padding: 3px 8px; color: #0369a1; font-size: .7rem; font-weight: 800; text-align: center; border: 1px solid #bae6fd; border-radius: 7px; background: #e0f2fe; }
#admin-role-level { width: 100%; accent-color: #0284c7; cursor: pointer; }
.access-range-scale { display: flex; justify-content: space-between; margin-top: 3px; color: #8aa0ae; font-size: .59rem; }

@media (max-width: 900px) {
    .access-dashboard-header,
    .access-section-heading { align-items: flex-start; flex-direction: column; }
    .access-header-actions { justify-content: flex-start; }
    .access-section-heading p { text-align: left; }
    .access-roles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .access-header-actions,
    .access-header-actions .btn { width: 100%; }
    .access-summary-grid,
    .access-roles-grid,
    .access-form-grid { grid-template-columns: 1fr; }
    .access-field-wide { grid-column: auto; }
    .access-card-header { align-items: flex-start; flex-direction: column; }
    .access-security-note { white-space: normal; }
    .access-role-card { min-height: 205px; }
    .access-form-modal { border-radius: 20px 20px 10px 10px; }
    .access-form-header { padding: 19px 18px 17px; }
    .access-form-body { padding: 20px 17px 3px; }
    .access-form-footer { align-items: stretch; margin-top: 16px; padding: 15px 17px; }
    .access-form-footer .btn { width: 100%; }
}
