/* ====================================================================
   Licitaciones - tema moderno (sobre Bootstrap 5.3)
   ==================================================================== */
:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-50: #eef2ff;
  --side-bg: #0f172a;
  --side-fg: #cbd5e1;
  --side-active: #1e293b;
  --body-bg: #f5f7fb;
  --line: #e7eaf0;
  --muted: #64748b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 10px 30px -12px rgba(16, 24, 40, .25);
  --bs-primary: #4f46e5;
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: #4f46e5;
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: #4338ca;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: #1e293b;
  --bs-border-color: #e7eaf0;
}
body { background: var(--body-bg); font-size: .925rem; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -.015em; color: #0f172a; }

/* ---------- Botones y formularios ---------- */
.btn { border-radius: 10px; font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600);
  --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-600); --bs-btn-disabled-bg: var(--brand);
  box-shadow: 0 4px 12px -4px rgba(79, 70, 229, .5); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: #c7d2fe; --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); }
.btn-outline-secondary { --bs-btn-color: #475569; --bs-btn-border-color: var(--line); --bs-btn-hover-bg: #f1f5f9;
  --bs-btn-hover-color: #0f172a; --bs-btn-hover-border-color: #cbd5e1; background: #fff; }
.btn-icon { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font-size: 1.2rem; }
.form-control, .form-select { border-radius: 10px; border-color: #dfe3ea; padding: .55rem .8rem; }
.form-control-sm, .form-select-sm { border-radius: 8px; padding: .3rem .6rem; }
.form-control:focus, .form-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .15); }
.form-label { font-weight: 500; font-size: .85rem; color: #334155; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* ---------- Estructura: menu lateral + contenido ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-content { padding: 1.5rem 1.75rem 3rem; flex: 1; }
@media (max-width: 575.98px) { .app-content { padding: 1rem 1rem 2rem; } }

.sidebar { width: 264px; background: var(--side-bg) !important; color: var(--side-fg); display: flex; flex-direction: column; }
@media (min-width: 992px) { .sidebar { position: sticky; top: 0; height: 100vh; flex-shrink: 0; } }
.sidebar.offcanvas-lg { --bs-offcanvas-width: 264px; --bs-offcanvas-bg: var(--side-bg); }
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.25rem 1rem; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; box-shadow: 0 6px 16px -6px rgba(99, 102, 241, .8); }
.brand-name { color: #fff; font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.brand-sub { font-size: .75rem; color: #94a3b8; }
.sidebar-nav { padding: .5rem .75rem; flex: 1; overflow-y: auto; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 1rem .75rem .4rem; font-weight: 600; }
.nav-item-link { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 10px; color: var(--side-fg);
  text-decoration: none; font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s; }
.nav-item-link i { font-size: 1.05rem; opacity: .85; }
.nav-item-link:hover { background: var(--side-active); color: #fff; }
.nav-item-link.active { background: linear-gradient(90deg, rgba(99, 102, 241, .25), rgba(99, 102, 241, .05)); color: #fff;
  box-shadow: inset 3px 0 0 #818cf8; }
.sidebar-user { display: flex; align-items: center; gap: .7rem; padding: 1rem 1.25rem; border-top: 1px solid #1e293b; color: #e2e8f0; }
.sidebar-user small { color: #94a3b8; }

.topbar { height: 64px; display: flex; align-items: center; gap: 1rem; padding: 0 1.75rem; background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1020; }
.topbar-title { color: var(--muted); font-size: .85rem; }
.topbar-title::first-letter { text-transform: uppercase; }
.user-chip { display: flex; align-items: center; gap: .6rem; background: none; border: 0; padding: .25rem .5rem; border-radius: 12px; color: inherit; }
.user-chip:hover { background: #f1f5f9; }
.user-chip small { color: var(--muted); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 600; font-size: .85rem;
  background: linear-gradient(135deg, #818cf8, #6366f1); color: #fff; flex-shrink: 0; }
.avatar-sm { width: 34px; height: 34px; font-size: .8rem; }
.avatar-xs { width: 26px; height: 26px; font-size: .68rem; }

/* ---------- Encabezado de pagina ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h4 { margin: 0; }
.page-head .subtitle { color: var(--muted); font-size: .875rem; margin-top: .15rem; }
.page-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem;
  background: var(--brand-50); color: var(--brand); flex-shrink: 0; }
.back-link { font-size: .85rem; color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; }
.back-link:hover { color: var(--brand); }

/* ---------- Tarjetas ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: #fff; border-bottom: 1px solid var(--line); padding: 1rem 1.25rem; font-weight: 600;
  border-radius: var(--radius) var(--radius) 0 0 !important; }
.card-title-icon { display: flex; align-items: center; gap: .6rem; font-weight: 600; font-size: 1rem; margin-bottom: 1rem; }
.card-title-icon i { color: var(--brand); }

.kpi { padding: 1.1rem 1.2rem; display: flex; flex-direction: row; align-items: center; gap: 1rem; text-decoration: none; color: inherit;
  transition: transform .15s, box-shadow .15s; height: 100%; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: inherit; }
.kpi.activo { outline: 2px solid var(--brand); }
.kpi-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.kpi-value { font-size: 1.5rem; font-weight: 700; line-height: 1; color: #0f172a; }
.kpi-label { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.tone-indigo { background: #eef2ff; color: #4f46e5; }
.tone-slate { background: #f1f5f9; color: #475569; }
.tone-blue { background: #e0f2fe; color: #0284c7; }
.tone-amber { background: #fef3c7; color: #b45309; }
.tone-green { background: #dcfce7; color: #15803d; }
.tone-red { background: #fee2e2; color: #b91c1c; }

.dato { padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fcfcfe; height: 100%; }
.dato .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: .25rem; }
.dato .val { font-weight: 600; color: #0f172a; }
.dato .lbl i { margin-right: .25rem; }

/* ---------- Tablas ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .75rem .9rem; border-bottom-color: #eef1f5; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600;
  white-space: nowrap; background: #f8fafc; border-bottom: 1px solid var(--line); }
.table-sm > :not(caption) > * > * { padding: .5rem .7rem; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8faff; }
.table td { vertical-align: middle; }
.card > .table-responsive:first-child .table thead th:first-child { border-top-left-radius: var(--radius); }
.card > .table-responsive:first-child .table thead th:last-child { border-top-right-radius: var(--radius); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.numero-lic { font-weight: 600; color: var(--brand); text-decoration: none; white-space: nowrap; }
.fila-click { cursor: pointer; }
.persona { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; }
.mini-progress { height: 6px; border-radius: 99px; background: #eef1f5; min-width: 70px; }
.mini-progress .progress-bar { background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 99px; }
.vacio { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.vacio i { font-size: 2.5rem; display: block; margin-bottom: .5rem; color: #cbd5e1; }

/* ---------- Estados (pildoras) ---------- */
.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .65rem; border-radius: 99px; font-size: .76rem;
  font-weight: 600; white-space: nowrap; line-height: 1.3; }
.pill-primary { background: #e0e7ff; color: #4338ca; }
.pill-secondary, .pill-light { background: #f1f5f9; color: #475569; }
.pill-warning { background: #fef3c7; color: #a16207; }
.pill-success { background: #dcfce7; color: #15803d; }
.pill-danger { background: #fee2e2; color: #b91c1c; }
.pill-info { background: #e0f2fe; color: #0369a1; }
.badge.text-bg-secondary { background: #e2e8f0 !important; color: #334155 !important; }

/* ---------- Pestanas ---------- */
.tabs-modern { border-bottom: 1px solid var(--line); gap: .25rem; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.tabs-modern .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; padding: .75rem 1rem;
  border-radius: 0; white-space: nowrap; display: flex; align-items: center; gap: .45rem; background: none; }
.tabs-modern .nav-link:hover { color: #0f172a; }
.tabs-modern .nav-link.active { color: var(--brand); border-bottom-color: var(--brand); background: none; }
.tabs-modern .badge { font-weight: 600; }

/* ---------- Linea de tiempo de etapas ---------- */
.flujo { position: relative; }
.flujo::before { content: ""; position: absolute; left: 21px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.etapa { position: relative; padding-left: 58px; margin-bottom: .75rem; }
.etapa-num { position: absolute; left: 0; top: .6rem; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: .85rem; background: #fff; border: 2px solid var(--line); color: var(--muted); z-index: 1; }
.etapa-card { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: .85rem 1rem; }
.etapa.CERRADA .etapa-num { background: #22c55e; border-color: #22c55e; color: #fff; }
.etapa.EN_CURSO .etapa-num { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 5px rgba(79, 70, 229, .15); }
.etapa.EN_CURSO .etapa-card { border-color: #c7d2fe; box-shadow: 0 6px 20px -10px rgba(79, 70, 229, .45); }
.etapa.RECHAZADA .etapa-num { background: #ef4444; border-color: #ef4444; color: #fff; }
.etapa.PENDIENTE .etapa-card { background: #fbfcfd; }
.etapa.PENDIENTE .etapa-titulo { color: #64748b; }
.etapa-titulo { font-weight: 600; color: #0f172a; }
.etapa-meta { font-size: .8rem; color: var(--muted); }
.etapa-accion { margin-top: .75rem; padding: .85rem; border-radius: 10px; background: #f8faff; border: 1px dashed #c7d2fe; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 8px; background: #f1f5f9;
  font-size: .75rem; color: #475569; }
.progreso-flujo { height: 10px; border-radius: 99px; background: #eef1f5; }
.progreso-flujo .progress-bar { background: linear-gradient(90deg, #6366f1, #22c55e); border-radius: 99px; }

/* ---------- Trazabilidad ---------- */
.timeline { position: relative; margin-left: .5rem; padding-left: 1.5rem; border-left: 2px solid var(--line); }
.timeline .item { position: relative; padding-bottom: 1rem; }
.timeline .item::before { content: ""; position: absolute; left: -1.95rem; top: .3rem; width: .85rem; height: .85rem; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand); }
.timeline .accion { font-weight: 600; color: #0f172a; }

/* ---------- Comparativo ---------- */
.min-precio { background: #dcfce7 !important; color: #166534; font-weight: 600; }

/* ---------- Alertas ---------- */
.alert-modern { display: flex; align-items: flex-start; gap: .65rem; border-radius: 12px; border: 0; box-shadow: var(--shadow); }
.alert-modern > i { font-size: 1.1rem; margin-top: .05rem; }
.alert-modern > div { flex: 1; }

/* ---------- Ingreso (login) ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
@media (max-width: 991.98px) { .login-wrap { grid-template-columns: 1fr; } .login-hero { display: none !important; } }
.login-hero { position: relative; overflow: hidden; color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(circle at 20% 20%, #6366f1 0, transparent 45%), radial-gradient(circle at 80% 70%, #8b5cf6 0, transparent 40%), #0f172a; }
.login-hero.proveedores { background: radial-gradient(circle at 20% 20%, #10b981 0, transparent 45%), radial-gradient(circle at 80% 70%, #0ea5e9 0, transparent 40%), #0f172a; }
.login-hero h2 { color: #fff; font-size: 2.2rem; line-height: 1.15; max-width: 440px; }
.login-hero p { color: #cbd5e1; max-width: 420px; }
.hero-feat { display: flex; gap: .8rem; align-items: center; margin-bottom: .9rem; color: #e2e8f0; }
.hero-feat i { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 2rem; background: #fff; }
.login-box { width: 100%; max-width: 380px; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.input-icon > .form-control { padding-left: 2.4rem; }

/* ---------- Portal proveedores ---------- */
.portal-top { background: #0f172a; color: #fff; }
.portal-top .brand-logo { background: linear-gradient(135deg, #10b981, #0ea5e9); }
.lic-card { border-radius: var(--radius); transition: transform .15s, box-shadow .15s; }
.lic-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

textarea.form-control[rows="1"] { min-height: 38px; }
@media print { .no-print, .sidebar, .topbar { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }
