/* ==========================================================================
   CP Soluciones — sistema de diseño
   CSS sin compilación (compatible con hosting compartido).
   Manual de marca: azul #225387 · naranja #eb5b2e · tipografía Montserrat.
   ========================================================================== */

:root {
  --brand-blue: #225387;
  --brand-orange: #eb5b2e;
  --brand-navy: #0f2742;

  /* acentos derivados (tonos de apoyo para iconos y KPIs) */
  --cyan: #2f7fc1;
  --magenta: #eb5b2e;
  --navy: #225387;
  --lime: #f29a3b;
  --green: #1f9d6b;

  --primary: #225387;
  --primary-600: #1a4270;
  --primary-50: #eef3f9;
  --primary-100: #d6e2ef;
  --violet: #3a6ea8;
  --accent: #eb5b2e;
  --accent-600: #d24a1f;
  --accent-50: #fdf0eb;

  --ink: #0e1726;
  --ink-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e6e9f0;
  --line-2: #f0f2f6;
  --bg: #f5f7fb;
  --surface: #ffffff;

  --ok: #12925a;   --ok-bg: #e7f7ef;
  --warn: #b25e09; --warn-bg: #fff4e0;
  --bad: #d92d20;  --bad-bg: #fdecea;
  --info: #225387; --info-bg: #eef3f9;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px -8px rgba(16, 24, 40, .08);
  --shadow-lg: 0 20px 48px -12px rgba(16, 24, 40, .22);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Montserrat", "Inter", system-ui, sans-serif;
  --sidebar: 256px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
[x-cloak] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
::selection { background: var(--primary-100); }

/* ----- utilidades ----- */
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .xs { font-size: 11.5px; }
.strong { font-weight: 600; } .bold { font-weight: 700; } .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { text-align: center; } .right { text-align: right; }
.flex { display: flex; } .items-center { align-items: center; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.grow { flex: 1 1 auto; min-width: 0; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.hidden { display: none; }
.text-ok { color: var(--ok); } .text-bad { color: var(--bad); } .text-warn { color: var(--warn); } .text-primary { color: var(--primary); }

.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1180px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ----- iconos ----- */
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; } .icon-lg { width: 22px; height: 22px; }

/* ==========================================================================
   LAYOUT DEL SISTEMA
   ========================================================================== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--brand-navy);
  background: linear-gradient(180deg, #16385f 0%, #112d4d 55%, #0c2139 100%);
  color: #c9d2ea; display: flex; flex-direction: column; z-index: 40; transition: transform .25s ease;
}
.sidebar-brand { padding: 22px 18px 16px; display: flex; align-items: center; justify-content: center; }
.sidebar-brand .brand-card { background: #fff; border-radius: 12px; padding: 8px 10px; width: 100%; box-shadow: 0 6px 20px -8px rgba(0,0,0,.4); }
.sidebar-brand img { height: 62px; width: auto; margin: 0 auto; }
.brand-stripe { height: 3px; display: flex; margin: 0 18px 8px; border-radius: 3px; overflow: hidden; }
.brand-stripe span { flex: 1; } .brand-stripe span:nth-child(1) { background: var(--brand-orange); flex: 1; } .brand-stripe span:nth-child(2) { background: #3a78bd; flex: 2; }
.brand-stripe span:nth-child(n+3) { display: none; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 20px; scrollbar-width: thin; scrollbar-color: #2a3a6e transparent; }
.nav-group { margin-top: 14px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #7686b3; font-weight: 600; padding: 0 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: #c9d2ea;
  font-weight: 500; font-size: 13.5px; position: relative; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 var(--brand-orange); }
.nav a .icon { opacity: .9; }
.nav .pill { margin-left: auto; background: var(--magenta); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 7px; line-height: 18px; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.07); font-size: 12px; color: #7686b3; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: rgba(245,247,251,.85); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line);
}
.icon-btn.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input {
  width: 100%; height: 40px; border-radius: 11px; border: 1px solid var(--line); background: #fff; padding: 0 70px 0 38px;
  font: inherit; color: var(--ink); box-shadow: var(--shadow-sm);
}
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-50); }
.search > .icon { position: absolute; left: 12px; top: 11px; color: var(--faint); }
.search kbd { position: absolute; right: 10px; top: 9px; font: 11px var(--font); color: var(--muted); background: var(--line-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.search-results { position: absolute; top: 46px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 420px; overflow: auto; padding: 6px; }
.search-results .group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 8px 10px 4px; font-weight: 600; }
.search-results a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.search-results a:hover, .search-results a.hl { background: var(--primary-50); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { border-color: #cfd6e4; color: var(--ink); }
.icon-btn .dot { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--magenta); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 12px; background: #fff; border: 1px solid var(--line); cursor: pointer; }
.avatar { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; color: #fff; background: linear-gradient(135deg, var(--brand-blue), #3a78bd); }
.user-chip .who { line-height: 1.15; } .user-chip .who b { display: block; font-size: 13px; } .user-chip .who span { font-size: 11.5px; color: var(--muted); }

.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--line-2); color: var(--ink); }
.menu .sep { border-top: 1px solid var(--line); margin: 6px 0; }

.content { padding: 26px 28px 60px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.page-head .eyebrow a { color: var(--muted); } .page-head .eyebrow a:hover { color: var(--primary); }
.page-head p.lead { color: var(--muted); margin-top: 4px; max-width: 720px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .icon-btn.menu-btn { display: grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 60px; }
  .user-chip .who { display: none; }
  .backdrop { position: fixed; inset: 0; background: rgba(14,23,38,.45); z-index: 35; }
}
@media (max-width: 640px) { .search kbd { display: none; } .search input { padding-right: 12px; } h1 { font-size: 22px; } }

/* ==========================================================================
   COMPONENTES
   ========================================================================== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head .sub { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line-2); background: #fbfcfe; border-radius: 0 0 var(--radius) var(--radius); }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }

/* botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s; box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: #cdd4e2; color: var(--ink); background: #fcfdff; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--primary-100); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px rgba(34,83,135,.8); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.btn-grad { background: var(--accent); border: 0; color: #fff; box-shadow: 0 8px 18px -8px rgba(235,91,46,.8); }
.btn-grad:hover { background: var(--accent-600); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; } .btn-ok:hover { background: #0d7a4a; color: #fff; }
.btn-danger { background: #fff; border-color: #f4c7c3; color: var(--bad); } .btn-danger:hover { background: var(--bad-bg); color: var(--bad); border-color: #eea59f; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); } .btn-ghost:hover { background: var(--line-2); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-gray { background: #f0f2f5; color: #475467; } .badge-blue { background: #e8f0ff; color: #1f4fd6; }
.badge-purple { background: #f1ecff; color: #5b36d6; } .badge-green { background: var(--ok-bg); color: var(--ok); }
.badge-red { background: var(--bad-bg); color: var(--bad); } .badge-orange { background: var(--warn-bg); color: var(--warn); }
.badge-teal { background: #e3f8f8; color: #0f7b7f; } .badge-magenta { background: #fde8f4; color: #b0005f; }
.badge.plain::before { display: none; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); font-size: 11.5px; font-weight: 600; }

/* KPI */
.kpi { position: relative; padding: 18px 18px 16px; overflow: hidden; }
.kpi .kpi-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.kpi .kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.kpi .kpi-value { font: 700 25px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .kpi-foot { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kpi .kpi-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.delta { font-weight: 700; font-size: 12px; } .delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.tone-cyan .kpi-icon, .tone-navy .kpi-icon, .tone-violet .kpi-icon { background: var(--primary-50); color: var(--brand-blue); }
.tone-cyan .kpi-bar { background: #3a78bd; } .tone-navy .kpi-bar { background: var(--brand-blue); } .tone-violet .kpi-bar { background: #0f2742; }
.tone-magenta .kpi-icon, .tone-lime .kpi-icon { background: var(--accent-50); color: var(--brand-orange); }
.tone-magenta .kpi-bar { background: var(--brand-orange); } .tone-lime .kpi-bar { background: #f29a73; }
.tone-green .kpi-icon { background: var(--ok-bg); color: var(--ok); } .tone-green .kpi-bar { background: var(--green); }
.tone-red .kpi-icon { background: var(--bad-bg); color: var(--bad); } .tone-red .kpi-bar { background: var(--bad); }

.kpi-block-title { display: flex; align-items: center; gap: 8px; font: 700 12px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; }
.kpi-block-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* tablas */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 10px 14px; background: #fafbfd; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: #fafcff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tfoot td { font-weight: 700; background: #fafbfd; border-top: 1px solid var(--line); }
.table .th-num, .table td.num { text-align: right; }
.table.compact td { padding: 8px 12px; } .table.compact th { padding: 8px 12px; }
.table a.row-link { color: var(--ink); font-weight: 600; } .table a.row-link:hover { color: var(--primary); }
.sort-link { color: inherit; } .sort-link:hover { color: var(--primary); }

/* filtros */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.toolbar .input, .toolbar .select { height: 36px; }
.toolbar .search-input { min-width: 240px; flex: 1; max-width: 360px; position: relative; }
.toolbar .search-input .icon { position: absolute; left: 10px; top: 9px; color: var(--faint); }
.toolbar .search-input input { padding-left: 34px; width: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-weight: 600; font-size: 12.5px; }
.chip:hover { border-color: #cdd4e2; color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .count { background: rgba(0,0,0,.07); border-radius: 99px; padding: 0 7px; font-size: 11px; }
.chip.active .count { background: rgba(255,255,255,.2); }

/* formularios */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
@media (max-width: 760px) { .form-grid > [class*="col-"] { grid-column: span 12; } }
.field label, .label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field .error, .error-text { font-size: 12px; color: var(--bad); margin-top: 5px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; height: 40px; border-radius: 10px; border: 1px solid #d9dee8; background: #fff; padding: 0 12px; font: 14px var(--font); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 10px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-50); }
.input.is-invalid, .select.is-invalid { border-color: var(--bad); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .addon { position: absolute; left: 12px; color: var(--faint); pointer-events: none; }
.input-group .addon-r { position: absolute; right: 12px; color: var(--muted); font-size: 13px; pointer-events: none; }
.input-group .input { padding-left: 38px; }
.input-group.pct .input { padding-left: 12px; padding-right: 30px; }
.input-sm { height: 34px; font-size: 13px; border-radius: 8px; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 99px; background: #d0d5dd; position: relative; cursor: pointer; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked { background: var(--primary); } .switch input:checked::after { transform: translateX(16px); }
.fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.fieldset legend { padding: 0 8px; font-weight: 650; font-family: var(--display); }

/* alertas / avisos */
.notice { display: flex; gap: 12px; padding: 13px 16px; border-radius: 12px; border: 1px solid; align-items: flex-start; }
.notice .icon { margin-top: 1px; }
.notice-info { background: var(--info-bg); border-color: #cddcff; color: #1d3f9c; }
.notice-ok { background: var(--ok-bg); border-color: #b9e8cf; color: #0b6a41; }
.notice-warn { background: var(--warn-bg); border-color: #fbd9a5; color: #8a4706; }
.notice-bad { background: var(--bad-bg); border-color: #f8c7c2; color: #a3231a; }
.notice b { font-weight: 700; }

.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(460px, calc(100vw - 40px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 12px; padding: 13px 14px; box-shadow: var(--shadow-lg); animation: toast-in .3s ease; }
.toast.warning { border-left-color: #f59e0b; } .toast.error { border-left-color: var(--bad); }
.toast .t-icon { color: var(--ok); } .toast.warning .t-icon { color: #d97706; } .toast.error .t-icon { color: var(--bad); }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* modales */
.modal-backdrop { position: fixed; inset: 0; background: rgba(14,23,38,.5); backdrop-filter: blur(2px); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); max-height: calc(100vh - 32px); overflow: auto; animation: toast-in .2s ease; }
.modal-lg { max-width: 760px; }
.modal-head { padding: 18px 22px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-body { padding: 16px 22px; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 8px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; font-weight: 600; color: var(--muted); border: 0; background: none; font: 600 13.5px var(--font); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs .active { color: var(--primary); border-bottom-color: var(--primary); }

/* progreso */
.progress { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #3a78bd, var(--primary)); transition: width .4s ease; }
.progress.ok > span { background: linear-gradient(90deg, #34d399, var(--ok)); }
.progress.warn > span { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.progress.bad > span { background: linear-gradient(90deg, #f87171, var(--bad)); }
.progress-lg { height: 12px; }

/* semáforo de margen */
.m-good { color: var(--ok); } .m-warn { color: var(--warn); } .m-bad { color: var(--bad); }
.m-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 58px; height: 24px; padding: 0 8px; border-radius: 7px; font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.m-pill.m-good { background: var(--ok-bg); } .m-pill.m-warn { background: var(--warn-bg); } .m-pill.m-bad { background: var(--bad-bg); }
.m-pill.m-none { background: var(--line-2); color: var(--muted); }

/* listas de definición */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 9px 14px; font-size: 13.5px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; font-weight: 500; }
.stat-list { display: flex; flex-direction: column; }
.stat-list > div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--line); gap: 12px; }
.stat-list > div:last-child { border-bottom: 0; }
.stat-list .big { font: 700 18px var(--display); }

/* estado vacío */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .empty-icon { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary-50), var(--accent-50)); color: var(--primary); }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; bottom: -3px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); }
.timeline .when { font-size: 11.5px; color: var(--faint); }

/* stepper de flujo */
.flow { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 2px; }
.flow .step { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 12.5px; color: var(--faint); white-space: nowrap; }
.flow .step .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); font-size: 11px; }
.flow .step.done { color: var(--ok); } .flow .step.done .n { background: var(--ok); color: #fff; }
.flow .step.current { color: var(--primary); background: var(--primary-50); } .flow .step.current .n { background: var(--primary); color: #fff; }
.flow .arrow { color: var(--line); flex: none; }

/* alertas de tablero */
.alert-card { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; align-items: flex-start; }
.alert-card .a-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.alert-card.danger .a-icon { background: var(--bad-bg); color: var(--bad); }
.alert-card.warning .a-icon { background: var(--warn-bg); color: var(--warn); }
.alert-card.info .a-icon { background: var(--info-bg); color: var(--info); }
.alert-card .count { font: 700 20px var(--display); }
.alert-items { margin: 8px 0 0; padding: 0; list-style: none; font-size: 12.5px; }
.alert-items li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-top: 1px dashed var(--line-2); }
.alert-items a { color: var(--ink-2); } .alert-items a:hover { color: var(--primary); }

/* preguntas gerenciales */
.qa { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: #fff; color: var(--ink); transition: border-color .15s, transform .15s, box-shadow .15s; min-height: 118px; }
.qa:hover { border-color: #c9d6f5; transform: translateY(-2px); box-shadow: var(--shadow); color: var(--ink); }
.qa .q { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.qa .a { font: 700 21px/1.15 var(--display); letter-spacing: -.01em; }
.qa .d { font-size: 12px; color: var(--muted); }

/* kanban de surtido */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: #eef1f7; border-radius: 14px; padding: 10px; min-height: 200px; }
.kanban-col h3 { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; font-size: 13.5px; }
.kanban-card { display: block; background: #fff; border-radius: 11px; padding: 12px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); margin-bottom: 8px; color: var(--ink); }
.kanban-card:hover { border-color: #c9d6f5; color: var(--ink); box-shadow: var(--shadow); }

/* editor de cotización */
.editor-lines td { vertical-align: top; }
.editor-lines .input { height: 36px; }
.line-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.line-meta button { background: none; border: 0; padding: 0; color: var(--primary); font: 600 11.5px var(--font); cursor: pointer; }
.line-below { background: #fff7f6 !important; }
.product-picker { position: relative; }
.picker-results { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 380px; overflow: auto; }
.picker-results button { display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line-2); padding: 10px 14px; cursor: pointer; font: inherit; color: var(--ink); }
.picker-results button:hover, .picker-results button.hl { background: var(--primary-50); }
.sticky-summary { position: sticky; top: 84px; }
.summary-row { display: flex; justify-content: space-between; padding: 7px 0; font-variant-numeric: tabular-nums; }
.summary-row.total { font: 700 20px var(--display); border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }
.internal-panel { background: linear-gradient(180deg, #16385f, #0f2742); color: #dfe6ff; border-radius: var(--radius); padding: 18px; }
.internal-panel .summary-row { color: #c3cdf0; } .internal-panel .summary-row b { color: #fff; }
.internal-panel .lock { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8ea0dc; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }

/* paginación */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 14px 16px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; }
.pagination a, .pagination span.pg { min-width: 34px; height: 34px; padding: 0 10px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-size: 13px; background: #fff; }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination .disabled { opacity: .4; }

/* matriz de comparación de proveedores */
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix .cell { display: flex; flex-direction: column; gap: 4px; align-items: stretch; min-width: 130px; }
.matrix .best { background: #eafaf2 !important; }
.matrix .best-tag { font-size: 10.5px; font-weight: 700; color: var(--ok); text-transform: uppercase; letter-spacing: .05em; }

/* gráficas */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; } .chart-box.lg { height: 330px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* cuadrantes de rentabilidad */
.quad { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quad > div { border-radius: 12px; padding: 14px; border: 1px solid var(--line); background: #fff; }
.quad h4 { font-size: 13.5px; display: flex; gap: 8px; align-items: center; margin-bottom: 2px; }
.quad .q-star { border-color: #b9e8cf; background: #f4fcf8; } .quad .q-vol { border-color: #fbd9a5; background: #fffaf1; }
.quad .q-niche { border-color: #cddcff; background: #f6f9ff; } .quad .q-rev { border-color: #f8c7c2; background: #fff7f6; }
.quad ul { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12.5px; }
.quad li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }

/* upload */
.dropzone { border: 2px dashed #c9d3e6; border-radius: 16px; padding: 34px 20px; text-align: center; background: #fafcff; cursor: pointer; transition: border-color .15s, background .15s; display: block; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-50); }
.dropzone .icon { width: 36px; height: 36px; color: var(--primary); margin: 0 auto 10px; }

/* ==========================================================================
   PÁGINAS PÚBLICAS (home + login)
   ========================================================================== */
.public { background: #fff; }
.pub-nav { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-2); }
.pub-nav .inner { max-width: 1200px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 24px; }
.pub-nav img { height: 48px; width: auto; }
.pub-nav nav { display: flex; gap: 22px; margin-left: auto; }
.pub-nav nav a { color: var(--ink-2); font-weight: 500; }
.pub-nav nav a:hover { color: var(--primary); }
@media (max-width: 820px) { .pub-nav nav { display: none; } .pub-nav .inner { justify-content: space-between; } }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.hero { position: relative; overflow: hidden; padding: 72px 0 60px; background: radial-gradient(1000px 500px at 85% -10%, #e6eef8 0%, transparent 60%), radial-gradient(700px 400px at -10% 110%, #fdeee8 0%, transparent 60%), #fff; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: 1fr; } }
.hero h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.04; letter-spacing: -.035em; font-weight: 800; }
.grad-text { color: var(--brand-orange); }
.hero .lead { font-size: 18px; color: var(--ink-2); margin-top: 18px; max-width: 560px; }
.hero .cta { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.stripe { display: flex; width: 240px; height: 4px; border-radius: 4px; overflow: hidden; margin: 22px 0 0; }
.stripe span { flex: 3; background: var(--brand-blue); } .stripe span:nth-child(1) { flex: 1; background: var(--brand-orange); } .stripe span:nth-child(n+3) { display: none; }
.diamond { position: absolute; width: 180px; height: 180px; border-radius: 34px; transform: rotate(45deg); opacity: .9; }
.hero-card { background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 22px; position: relative; }
.hero-card .mini-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hero-card .mini { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.hero-card .mini b { font: 700 22px var(--display); display: block; }
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 960px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .feature-grid { grid-template-columns: 1fr; } }
.feature { border: 1px solid var(--line); border-radius: 18px; padding: 22px; background: #fff; transition: transform .2s, box-shadow .2s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature .f-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 14px; }
.section { padding: 72px 0; }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 40px; }
.section-head h2 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 750; letter-spacing: -.025em; }
.section-head p { color: var(--muted); font-size: 16px; margin-top: 10px; }
.flow-public { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; }
@media (max-width: 960px) { .flow-public { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 520px) { .flow-public { grid-template-columns: repeat(2, 1fr); } }
.flow-public div { text-align: center; padding: 18px 8px; border-radius: 16px; background: #f7f9fd; border: 1px solid var(--line-2); font-weight: 600; font-size: 13px; }
.flow-public .n { width: 34px; height: 34px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; color: #fff; font-weight: 700; }
.pub-footer { background: var(--brand-navy); color: #c9d2ea; padding: 44px 0 30px; }
.pub-footer a { color: #fff; }
.contact-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .contact-bar { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .contact-bar { grid-template-columns: 1fr; } }
.contact-bar .c { display: flex; gap: 12px; align-items: center; }
.contact-bar .c-icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; }

/* login (según diseño aprobado) */
.auth { min-height: 100vh; display: flex; flex-direction: column; background: linear-gradient(180deg, #fbfcff 0%, #f3f6fb 100%); position: relative; overflow: hidden; }
.auth-main { flex: 1; display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; max-width: 1240px; width: 100%; margin: 0 auto; padding: 48px 32px 32px; align-items: center; position: relative; z-index: 1; }
@media (max-width: 980px) { .auth-main { grid-template-columns: 1fr; padding: 28px 16px; } .auth-brand .welcome, .auth-brand .feat-row, .auth-photo { display: none; } }
.auth-brand img.logo { width: min(300px, 70%); height: auto; }
.auth-brand .tagline { font-size: 19px; color: var(--ink-2); margin-top: 22px; max-width: 470px; }
.auth-brand .welcome { font: 800 clamp(34px, 4vw, 50px)/1.05 var(--display); letter-spacing: -.03em; margin-top: 36px; }
.auth-brand .welcome-sub { font-size: 18px; color: var(--muted); margin-top: 12px; max-width: 520px; }
.feat-row { display: flex; gap: 34px; margin-top: 30px; flex-wrap: wrap; }
.feat-row .f { text-align: center; font-size: 13.5px; color: var(--ink-2); width: 92px; }
.feat-row .f .circle { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; }
.auth-photo { position: absolute; left: 0; bottom: 70px; width: 58%; height: 330px; background: linear-gradient(90deg, rgba(243,246,251,0) 0%, rgba(243,246,251,.2) 60%, #f3f6fb 100%), linear-gradient(0deg, #f3f6fb 0%, rgba(243,246,251,0) 45%), url("../img/print-floor.svg") center/cover no-repeat; opacity: .55; z-index: 0; pointer-events: none; }
.auth-card { background: #fff; border-radius: 22px; padding: 44px 44px 30px; box-shadow: 0 30px 60px -20px rgba(16,24,40,.18), 0 0 0 1px rgba(16,24,40,.04); }
@media (max-width: 520px) { .auth-card { padding: 28px 20px 22px; } }
.auth-card h1 { font-size: 38px; font-weight: 800; letter-spacing: -.02em; color: var(--brand-blue); }
.auth-card .sub { color: var(--muted); font-size: 17px; margin-top: 6px; }
.auth-card .field label { font-size: 14px; color: var(--ink); font-weight: 500; }
.auth-card .input { height: 54px; border-radius: 12px; font-size: 15px; padding-left: 48px; }
.auth-card .input-group .addon { left: 16px; }
.auth-card .toggle-pass { position: absolute; right: 12px; background: none; border: 0; color: var(--ink-2); cursor: pointer; padding: 6px; }
.auth-card .btn-lg { height: 56px; font-size: 17px; border-radius: 12px; }
.auth-divider { display: flex; align-items: center; gap: 14px; color: var(--muted); margin-top: 30px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-foot { background: #fff; border-top: 1px solid var(--line-2); position: relative; z-index: 1; }
.auth-foot .contact-bar { max-width: 1240px; margin: 0 auto; padding: 18px 32px; color: var(--ink-2); font-size: 14px; }
.corner { position: absolute; border-radius: 28px; transform: rotate(45deg); z-index: 0; }

/* ==========================================================================
   PORTAL DEL CLIENTE
   ========================================================================== */
.portal-nav { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.portal-nav .inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 20px; padding: 10px 24px; }
.portal-nav img { height: 44px; width: auto; }
.portal-links { display: flex; gap: 4px; margin-left: 12px; overflow-x: auto; }
.portal-links a { padding: 8px 12px; border-radius: 9px; color: var(--ink-2); font-weight: 600; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.portal-links a:hover { background: var(--line-2); color: var(--ink); }
.portal-links a.active { background: var(--primary-50); color: var(--primary); }
.portal-content { max-width: 1200px; margin: 0 auto; padding: 28px 24px 60px; }
.portal-hero { border-radius: 22px; padding: 28px; color: #fff; background: linear-gradient(120deg, #0f2742 0%, #1b4672 60%, #225387 100%); position: relative; overflow: hidden; }
.portal-hero h1 { color: #fff; }
.portal-hero .diamond { width: 120px; height: 120px; border-radius: 24px; opacity: .35; }
@media (max-width: 820px) { .portal-nav .inner { flex-wrap: wrap; padding: 10px 16px; } .portal-links { order: 3; width: 100%; margin-left: 0; } .portal-content { padding: 20px 16px 50px; } }

/* impresión */
@media print {
  .sidebar, .topbar, .page-actions, .no-print, .toast-stack { display: none !important; }
  .main { margin: 0; } .content { padding: 0; } body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; }
}
