/* ============================================================
   Licitaciones Pro AI - Main Stylesheet
   ============================================================ */

:root {
    --primary: #1e3a5f;
    --primary-light: #2d5a9e;
    --primary-dark: #12253d;
    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --sidebar-bg: #0f1f35;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
    --shadow-lg: 0 4px 24px rgba(0,0,0,.12);
    --transition: .2s ease;
}

[data-bs-theme="dark"] {
    --body-bg: #0a1628;
    --card-bg: #111f35;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: #1e3a5f;
    --sidebar-bg: #070e1a;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--body-bg);
    color: var(--text-main);
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
#sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width var(--transition);
}

#sidebar .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-decoration: none;
}

#sidebar .sidebar-brand .brand-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--primary-light));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 18px; flex-shrink: 0;
}

#sidebar .sidebar-brand span {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
}

#sidebar .sidebar-brand small {
    color: rgba(255,255,255,.5);
    font-size: 10px;
    display: block;
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-section {
    padding: 16px 20px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
}

/* Clases usadas en el sidebar que nunca tenían definición propia:
   quedaban con el color de texto por defecto (oscuro), invisibles
   sobre el fondo azul marino del sidebar. */
.text-muted-light { color: rgba(255,255,255,.5) !important; }
.x-small { font-size: .72rem; }
.topbar-footer { background: var(--card-bg); }

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    border-radius: 0;
    font-size: 13.5px;
    font-weight: 450;
    transition: all var(--transition);
    position: relative;
}

.sidebar-nav .nav-link i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.07);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(59,130,246,.25);
    font-weight: 600;
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 4px; bottom: 4px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.sidebar-nav .nav-link .badge-count {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: background var(--transition);
}

.sidebar-user:hover { background: rgba(255,255,255,.07); }

.sidebar-user .avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--accent), var(--primary-light));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 13px;
    flex-shrink: 0;
}

.sidebar-user .user-info { min-width: 0; }
.sidebar-user .user-name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { color: rgba(255,255,255,.4); font-size: 11px; }

/* ══════════════════════════════════════
   TOPBAR
══════════════════════════════════════ */
#topbar, .topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    box-shadow: 0 1px 0 rgba(0,0,0,.06);
}

.topbar-search {
    flex: 1;
    max-width: 380px;
}

.topbar-search .input-group {
    background: var(--body-bg);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.topbar-search input {
    background: transparent;
    border: none;
    padding: 8px 12px;
    font-size: 13.5px;
    color: var(--text-main);
}

.topbar-search input:focus { box-shadow: none; outline: none; }

.topbar-search .btn-search {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0 12px;
}

.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.topbar-btn {
    width: 38px; height: 38px;
    border-radius: 10px;
    border: none;
    background: var(--body-bg);
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.topbar-btn:hover { background: var(--border-color); color: var(--text-main); }

.topbar-btn .notif-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--card-bg);
}

/* ══════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════ */
#main-content, .main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    padding: 28px 28px 60px;
    transition: margin-left var(--transition);
}

/* ══════════════════════════════════════
   CARDS
══════════════════════════════════════ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 14.5px;
}

.card-body { padding: 20px; }
.card-footer { background: transparent; border-top: 1px solid var(--border-color); padding: 12px 20px; }

/* ── Stat Cards ── */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue  { background: rgba(59,130,246,.12);  color: #3b82f6; }
.stat-icon.green { background: rgba(16,185,129,.12);  color: #10b981; }
.stat-icon.amber { background: rgba(245,158,11,.12);  color: #f59e0b; }
.stat-icon.red   { background: rgba(239,68,68,.12);   color: #ef4444; }
.stat-icon.cyan  { background: rgba(6,182,212,.12);   color: #06b6d4; }
.stat-icon.purple{ background: rgba(139,92,246,.12);  color: #8b5cf6; }

.stat-value { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.stat-change { font-size: 12px; margin-top: 4px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ══════════════════════════════════════
   SEMAPHORE BADGES
══════════════════════════════════════ */
.semaphore-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
}

.semaphore-badge::before {
    content: '';
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.semaphore-verde   { background: rgba(16,185,129,.12); color: #059669; }
.semaphore-verde::before { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,.6); }

.semaphore-amarillo { background: rgba(245,158,11,.12); color: #b45309; }
.semaphore-amarillo::before { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,.6); }

.semaphore-rojo    { background: rgba(239,68,68,.12); color: #dc2626; }
.semaphore-rojo::before { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,.6); }

.semaphore-gris    { background: rgba(100,116,139,.12); color: #475569; }
.semaphore-gris::before { background: #94a3b8; }

/* Large semaphore for detail page */
.semaphore-lg { padding: 8px 18px; font-size: 14px; }
.semaphore-lg::before { width: 12px; height: 12px; }

/* ══════════════════════════════════════
   STATUS BADGES
══════════════════════════════════════ */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}

.status-detectada   { background: #f1f5f9; color: #475569; }
.status-revision    { background: rgba(6,182,212,.1); color: #0891b2; }
.status-preparacion { background: rgba(139,92,246,.1); color: #7c3aed; }
.status-lista       { background: rgba(16,185,129,.1); color: #059669; }
.status-presentada  { background: rgba(59,130,246,.1); color: #2563eb; }
.status-evaluacion  { background: rgba(245,158,11,.1); color: #d97706; }
.status-subsanacion { background: rgba(249,115,22,.1); color: #ea580c; }
.status-buena_pro   { background: rgba(16,185,129,.15); color: #047857; border: 1px solid rgba(16,185,129,.3); }
.status-perdida     { background: rgba(239,68,68,.1); color: #dc2626; }
.status-cancelada   { background: #f1f5f9; color: #64748b; }
.status-archivada   { background: #f8fafc; color: #94a3b8; }

/* Priority badges */
.priority-urgente { background: rgba(239,68,68,.12); color: #dc2626; }
.priority-alta    { background: rgba(245,158,11,.12); color: #d97706; }
.priority-normal  { background: rgba(59,130,246,.1); color: #2563eb; }
.priority-baja    { background: #f1f5f9; color: #64748b; }

/* ══════════════════════════════════════
   TABLES
══════════════════════════════════════ */
.table-clean {
    width: 100%;
    border-collapse: collapse;
}

.table-clean th {
    background: var(--body-bg);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table-clean td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 13.5px;
}

.table-clean tr:last-child td { border-bottom: none; }
.table-clean tbody tr:hover { background: rgba(59,130,246,.03); }

/* DataTables override */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 13px;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px 8px;
}

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn { border-radius: 9px; font-weight: 500; font-size: 13.5px; padding: 8px 16px; transition: all var(--transition); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { padding: 11px 22px; font-size: 15px; border-radius: 11px; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: #2563eb; border-color: #2563eb; }

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

/* ══════════════════════════════════════
   FORMS
══════════════════════════════════════ */
.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: 9px;
    padding: 9px 12px;
    font-size: 13.5px;
    background: var(--card-bg);
    color: var(--text-main);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
    outline: none;
}

.form-label { font-weight: 500; font-size: 13px; margin-bottom: 5px; color: var(--text-main); }
.form-text  { font-size: 12px; color: var(--text-muted); }
.required-star { color: var(--danger); margin-left: 2px; }

/* ── Section header in form ── */
.form-section-header {
    background: var(--body-bg);
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 13px;
    color: var(--primary);
    margin-bottom: 16px;
    border-left: 3px solid var(--accent);
}

/* ══════════════════════════════════════
   PAGE HEADER
══════════════════════════════════════ */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header-left h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.page-header-left .breadcrumb {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 4px 0 0;
    padding: 0;
    background: none;
}

.page-header-left .breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ══════════════════════════════════════
   TABS
══════════════════════════════════════ */
.nav-tabs-custom {
    border-bottom: 2px solid var(--border-color);
    gap: 4px;
    display: flex;
    flex-wrap: wrap;
}

.nav-tabs-custom .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 0;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-tabs-custom .nav-link:hover { color: var(--text-main); border-bottom-color: var(--border-color); }
.nav-tabs-custom .nav-link.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ══════════════════════════════════════
   CHECKLIST
══════════════════════════════════════ */
.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 9px;
    border: 1px solid var(--border-color);
    margin-bottom: 6px;
    transition: all var(--transition);
    background: var(--card-bg);
}

.checklist-item:hover { border-color: var(--accent-light); box-shadow: 0 2px 8px rgba(59,130,246,.08); }

.checklist-item.status-completo   { border-left: 3px solid var(--success); }
.checklist-item.status-pendiente  { border-left: 3px solid var(--warning); }
.checklist-item.status-critico    { border-left: 3px solid var(--danger); background: rgba(239,68,68,.02); }
.checklist-item.status-observado  { border-left: 3px solid var(--info); }
.checklist-item.status-no_aplica  { opacity: .5; }

.checklist-icon { font-size: 18px; flex-shrink: 0; }
.checklist-name { flex: 1; font-weight: 500; font-size: 13.5px; }
.checklist-meta { font-size: 12px; color: var(--text-muted); }

/* ── Progress bar ── */
.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.progress { height: 8px; border-radius: 4px; background: var(--border-color); }
.progress-bar { border-radius: 4px; transition: width .4s ease; }

/* ══════════════════════════════════════
   ALERTS / NOTIFICATIONS
══════════════════════════════════════ */
.alert-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid transparent;
    transition: all var(--transition);
}

.alert-item:hover { transform: translateX(3px); }

.alert-item.urgente  { background: rgba(239,68,68,.06);  border-color: rgba(239,68,68,.2);  }
.alert-item.media    { background: rgba(245,158,11,.06); border-color: rgba(245,158,11,.2); }
.alert-item.baja     { background: rgba(59,130,246,.05); border-color: rgba(59,130,246,.15); }
.alert-item.info     { background: rgba(6,182,212,.05);  border-color: rgba(6,182,212,.15); }

.alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-content .alert-title { font-weight: 600; font-size: 13.5px; }
.alert-content .alert-desc  { font-size: 12.5px; color: var(--text-muted); }
.alert-content .alert-time  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ══════════════════════════════════════
   TIMELINE
══════════════════════════════════════ */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 7px; top: 4px; bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -21px; top: 4px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--card-bg);
    box-shadow: 0 0 0 2px var(--border-color);
}

.timeline-item.done::before   { background: var(--success); box-shadow: 0 0 0 2px rgba(16,185,129,.3); }
.timeline-item.active::before { background: var(--accent);  box-shadow: 0 0 0 2px rgba(59,130,246,.3); }
.timeline-item.overdue::before{ background: var(--danger);  box-shadow: 0 0 0 2px rgba(239,68,68,.3); }

.timeline-date  { font-size: 11.5px; color: var(--text-muted); margin-bottom: 2px; }
.timeline-title { font-weight: 600; font-size: 13.5px; }
.timeline-days  { font-size: 12px; }

/* ══════════════════════════════════════
   FILE MANAGER
══════════════════════════════════════ */
.file-folder {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
}

.file-folder-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    cursor: pointer;
    background: var(--body-bg);
    font-weight: 600;
    font-size: 13.5px;
    transition: background var(--transition);
    user-select: none;
}

.file-folder-header:hover { background: var(--border-color); }
.file-folder-header i { color: var(--warning); font-size: 17px; }
.file-folder-header .file-count { margin-left: auto; font-size: 12px; color: var(--text-muted); font-weight: 400; }

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    border-top: 1px solid var(--border-color);
    transition: background var(--transition);
}

.file-item:hover { background: rgba(59,130,246,.03); }
.file-item .file-icon { font-size: 20px; flex-shrink: 0; }
.file-item .file-name { flex: 1; font-size: 13.5px; font-weight: 500; }
.file-item .file-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.file-item .file-actions { display: flex; gap: 4px; opacity: 0; transition: opacity var(--transition); }
.file-item:hover .file-actions { opacity: 1; }

/* ══════════════════════════════════════
   UPLOAD DROP ZONE
══════════════════════════════════════ */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--body-bg);
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(59,130,246,.05);
    color: var(--accent);
}

.drop-zone i { font-size: 36px; margin-bottom: 8px; display: block; }
.drop-zone p { margin: 0; font-size: 14px; }
.drop-zone small { font-size: 12px; }

/* ══════════════════════════════════════
   SEARCH RESULTS DROPDOWN
══════════════════════════════════════ */
#global-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    max-height: 380px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition);
    text-decoration: none;
    color: var(--text-main);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--body-bg); }
.search-result-item .result-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.search-result-item .result-title { font-weight: 500; font-size: 13.5px; }
.search-result-item .result-sub   { font-size: 12px; color: var(--text-muted); }
.search-result-category { padding: 7px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); background: var(--body-bg); border-bottom: 1px solid var(--border-color); }

/* ══════════════════════════════════════
   MODAL
══════════════════════════════════════ */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 18px 24px;
}

.modal-title { font-size: 16px; font-weight: 700; }
.modal-body  { padding: 24px; }
.modal-footer { border-top: 1px solid var(--border-color); padding: 14px 24px; }

/* ══════════════════════════════════════
   AUTH LAYOUT
══════════════════════════════════════ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
}

.auth-panel-left {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.auth-panel-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.auth-panel-right {
    width: 480px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 48px;
    background: var(--card-bg);
}

@media (max-width: 900px) {
    .auth-panel-left { display: none; }
    .auth-panel-right { width: 100%; padding: 40px 28px; }
}

/* ══════════════════════════════════════
   TENDER DETAIL - COMMAND CENTER
══════════════════════════════════════ */
.command-bar {
    background: var(--primary-dark);
    border-radius: 14px;
    padding: 20px 24px;
    color: #fff;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.command-bar .tender-code { font-size: 13px; color: rgba(255,255,255,.6); }
.command-bar .tender-title { font-size: 19px; font-weight: 700; margin: 2px 0; }
.command-bar .tender-entity { font-size: 13.5px; color: rgba(255,255,255,.75); }
.command-bar .command-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.command-bar .meta-item { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: rgba(255,255,255,.7); }
.command-bar .meta-item i { font-size: 14px; }
.command-bar .command-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ══════════════════════════════════════
   FINANCE
══════════════════════════════════════ */
.finance-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.finance-item {
    background: var(--body-bg);
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
}

.finance-item .fi-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.finance-item .fi-value { font-size: 20px; font-weight: 700; }
.finance-item.green .fi-value { color: var(--success); }
.finance-item.red   .fi-value { color: var(--danger); }
.finance-item.blue  .fi-value { color: var(--accent); }

/* ══════════════════════════════════════
   MISC UTILITIES
══════════════════════════════════════ */
.text-muted-sm { font-size: 12px; color: var(--text-muted); }
.rounded-custom { border-radius: var(--radius); }
.shadow-custom { box-shadow: var(--shadow); }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state i { font-size: 48px; opacity: .3; display: block; margin-bottom: 12px; }
.empty-state h6 { font-size: 15px; color: var(--text-main); margin-bottom: 6px; }
.empty-state p { font-size: 13px; margin: 0; }

.divider-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin: 20px 0 14px;
}

.divider-label::before, .divider-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* Spinner overlay */
.spinner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tag chips */
.chip {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 12px;
    background: var(--body-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    margin: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    :root { --sidebar-width: 0px; }
    #sidebar { transform: translateX(-260px); width: 260px; }
    #sidebar.show { transform: translateX(0); }
    #topbar, .topbar { left: 0; }
    #main-content, .main-content { margin-left: 0; padding: 16px 14px 50px; }
    .page-header { flex-direction: column; }
}

/* Navegación simplificada RC1.4 */
.sidebar-group-toggle{color:rgba(226,234,247,.82);font-size:.72rem;font-weight:700;letter-spacing:.045em;text-transform:uppercase;border:0;background:transparent}
.sidebar-group-toggle:hover,.sidebar-group-toggle:focus{color:#fff;background:rgba(255,255,255,.045);box-shadow:none}
.sidebar-group-toggle i{font-size:.7rem;transition:transform .2s ease}.sidebar-group-toggle:not(.collapsed) i{transform:rotate(180deg)}
.sidebar-link-sub{padding-left:1rem!important;font-size:.88rem}.sidebar-link-sub i{font-size:.92rem}
.sidebar-footer .btn-outline-light{color:rgba(255,255,255,.72);font-size:.75rem}.sidebar-footer .btn-outline-light:hover{color:#fff;background:rgba(255,255,255,.08)}

/* RC2: contraste reforzado para grupos del sidebar sobre fondo oscuro. */
.sidebar-group-toggle{
    color:rgba(240,246,255,.92)!important;
    opacity:1!important;
}
.sidebar-group-toggle span{color:inherit!important;}
.sidebar-group-toggle:hover,.sidebar-group-toggle:focus,.sidebar-group-toggle:not(.collapsed){
    color:#fff!important;
    background:rgba(61,139,255,.10)!important;
}
.sidebar-link-sub{color:rgba(222,233,249,.84)!important;}
.sidebar-link-sub:hover,.sidebar-link-sub:focus{color:#fff!important;}
.sidebar-link-sub.active{color:#fff!important;background:rgba(48,118,255,.20)!important;}
.text-muted-light{color:rgba(217,229,247,.68)!important;}
