/* ============================================================
   Plataforma Amazonía Siempre — BID design tokens
   Manual de marca BID. Tipografía: Open Sans.
   ============================================================ */

:root {
  /* Primarias */
  --bid-blue: #004e70;
  --bid-blue-700: #013a54;
  --bid-cyan: #009ade;
  --bid-ink: #3c3b3b;

  /* Secundarias */
  --bid-yellow: #ffda00;
  --bid-green-dark: #308144;
  --bid-green-light: #8dba38;
  --bid-gray: #a6a6a8;

  /* Fondos suaves */
  --bid-blue-soft: #cbd8df;
  --bid-blue-pale: #dbedf8;

  /* Semáforos */
  --st-ontime: #8dba38;
  --st-risk: #ffda00;
  --st-late: #c0392b;

  /* Neutros derivados */
  --paper: #ffffff;
  --canvas: #f4f6f8;
  --line: #e3e8ec;
  --line-strong: #d2dade;
  --muted: #6c7378;
  --ink-soft: #545a5e;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 2px rgba(16, 42, 60, .06), 0 1px 3px rgba(16, 42, 60, .05);
  --shadow-pop: 0 8px 28px rgba(8, 33, 48, .16);
  --sidebar-w: 252px;
  --header-h: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--canvas);
  color: var(--bid-ink);
  font-family: "Open Sans", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#root { height: 100%; }

button { font-family: inherit; cursor: pointer; }
a { color: var(--bid-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- App shell ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h);
  background: var(--bid-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark {
  font-weight: 800;
  letter-spacing: .5px;
  font-size: 16px;
  background: #fff;
  color: var(--bid-blue);
  padding: 4px 9px;
  border-radius: 5px;
}
.brand .brand-name { font-size: 15.5px; font-weight: 600; letter-spacing: .2px; }
.brand .brand-name b { font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.update-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: #cfe7f6;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.16);
  padding: 5px 12px; border-radius: 999px;
}
.update-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bid-green-light); box-shadow: 0 0 0 3px rgba(141,186,56,.25); }
.user-chip { display: flex; align-items: center; gap: 9px; }
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bid-cyan); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.user-chip .who { line-height: 1.15; }
.user-chip .who b { font-size: 13px; font-weight: 600; display: block; }
.user-chip .who span { font-size: 11.5px; color: #bcd9ec; }

.body-row { display: flex; flex: 1; min-height: 0; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  position: sticky;
  top: var(--header-h);
  align-self: flex-start;
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .9px; color: var(--muted); padding: 6px 12px 10px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 10px 12px; margin-bottom: 2px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: 13.5px; font-weight: 600;
  position: relative;
}
.nav-item .ico { width: 20px; height: 20px; flex: 0 0 20px; color: var(--bid-gray); }
.nav-item:hover { background: #f1f5f8; color: var(--bid-blue); }
.nav-item:hover .ico { color: var(--bid-blue); }
.nav-item.active { background: var(--bid-blue-pale); color: var(--bid-blue); }
.nav-item.active .ico { color: var(--bid-cyan); }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 6px; bottom: 6px;
  width: 4px; border-radius: 0 4px 4px 0; background: var(--bid-cyan);
}
.sidebar-foot { margin-top: 18px; padding: 12px; border-top: 1px solid var(--line); }
.sidebar-foot .src-line { font-size: 11px; color: var(--muted); line-height: 1.5; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 26px 32px 12px; max-width: 1320px; width: 100%; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 23px; font-weight: 700; color: var(--bid-blue); margin: 0 0 4px; letter-spacing: -.2px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); font-weight: 600; }
.crumbs .sep { color: var(--line-strong); }

.footer-note {
  margin-top: auto;
  padding: 18px 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  display: flex; align-items: center; gap: 8px;
}
.footer-note .lock { width: 13px; height: 13px; opacity: .7; }

/* ---------- Cards ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--bid-blue); }
.card-head .sub { font-size: 12px; color: var(--muted); }

.grid { display: grid; gap: 18px; }
.section-gap { margin-bottom: 22px; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
}
.kpi::before { content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background: var(--bid-cyan); }
.kpi.tone-blue::before { background: var(--bid-blue); }
.kpi.tone-green::before { background: var(--bid-green-light); }
.kpi.tone-yellow::before { background: var(--bid-yellow); }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .2px; }
.kpi .value { font-size: 30px; font-weight: 800; color: var(--bid-blue); line-height: 1.1; margin: 8px 0 2px; letter-spacing: -.5px; }
.kpi .value small { font-size: 15px; font-weight: 700; color: var(--bid-cyan); margin-left: 4px; }
.kpi .delta { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.kpi .delta .up { color: var(--bid-green-dark); font-weight: 700; }

/* mini KPI */
.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mini-kpi { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.mini-kpi .big { font-size: 26px; font-weight: 800; color: var(--bid-blue); line-height: 1; }
.mini-kpi .mlabel { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.mini-kpi .badge-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 38px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 15px; font-size: 13px; font-weight: 600;
  transition: background .12s, border-color .12s, color .12s;
}
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--bid-blue); color: #fff; }
.btn-primary:hover { background: var(--bid-blue-700); }
.btn-cyan { background: var(--bid-cyan); color: #fff; }
.btn-cyan:hover { background: #0086c4; }
.btn-ghost { background: #fff; border-color: var(--line-strong); color: var(--bid-blue); }
.btn-ghost:hover { background: #f1f5f8; }
.btn-sm { padding: 6px 11px; font-size: 12px; }

/* ---------- Badges / status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; padding: 3px 9px;
  border-radius: 999px; letter-spacing: .2px;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.badge-ontime { background: #eef6e1; color: #4e6f1f; }
.badge-ontime .dot { background: var(--st-ontime); }
.badge-risk { background: #fff7d6; color: #8a6d00; }
.badge-risk .dot { background: var(--st-risk); }
.badge-late { background: #fbe7e4; color: #a5281a; }
.badge-late .dot { background: var(--st-late); }
.badge-neutral { background: #eef1f3; color: var(--ink-soft); }
.badge-neutral .dot { background: var(--bid-gray); }

.tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 6px;
}
.tag .ti { width: 13px; height: 13px; }
.tag-source { background: var(--bid-blue-pale); color: var(--bid-blue); border: 1px solid #bcdcf0; }
.tag-team { background: #e1f4fc; color: #0779a8; border: 1px solid #b6e4f7; }
.tag-knowledge { background: #eaf4dc; color: var(--bid-green-dark); border: 1px solid #cfe6ad; }

.pill {
  display: inline-flex; align-items: center;
  font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 5px;
  background: #eef1f3; color: var(--ink-soft);
}
.pill.fund-amdtf { background: #e6f3fa; color: #0779a8; }
.pill.fund-kif { background: #eef6e1; color: #4e6f1f; }
.pill.fund-orc { background: #f3eefb; color: #6a4ca0; }

/* ---------- Tables ---------- */
.tbl-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 700; color: var(--muted);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px;
  padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: #fafbfc;
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr.clickable:hover { background: #f3f8fb; cursor: pointer; }
.op-code { font-weight: 700; color: var(--bid-blue); font-variant-numeric: tabular-nums; }
.op-name { font-weight: 600; color: var(--bid-ink); }
.cell-sub { font-size: 11.5px; color: var(--muted); }

/* Semáforo cell (pipeline) */
.sem-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.sem-cell .date { font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 600; }
.sem-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px;
}
.sem-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.sem-done { background: #eef6e1; color: #4e6f1f; }
.sem-done .dot { background: var(--st-ontime); }
.sem-next { background: #fff7d6; color: #8a6d00; }
.sem-next .dot { background: var(--st-risk); }
.sem-late { background: #fbe7e4; color: #a5281a; }
.sem-late .dot { background: var(--st-late); }
.sem-planned { color: var(--muted); }
.sem-planned .date { color: var(--bid-gray); font-weight: 600; }
.sem-planned .sem-chip { background: #f0f2f4; color: var(--muted); }
.sem-planned .sem-chip .dot { background: var(--line-strong); }

/* Progress bar */
.progress { height: 8px; background: #eef1f3; border-radius: 999px; overflow: hidden; min-width: 90px; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--bid-cyan); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .pval { font-size: 12px; font-weight: 700; color: var(--bid-blue); font-variant-numeric: tabular-nums; min-width: 34px; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .2px; }
.select, .input {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--line-strong); background: #fff;
  border-radius: var(--radius-sm); padding: 8px 30px 8px 11px;
  font-size: 13px; color: var(--bid-ink); font-family: inherit;
  min-width: 150px; font-weight: 600;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c7378' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input { padding: 8px 11px; background-image: none; }
.select:focus, .input:focus { outline: none; border-color: var(--bid-cyan); box-shadow: 0 0 0 3px rgba(0,154,222,.15); }
.filter-active { display: inline-flex; align-items:center; gap:6px; font-size:12px; color: var(--bid-cyan); font-weight:700; }

/* ---------- Access cards (home) ---------- */
.access-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.access {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px; text-align: left; align-items: flex-start;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.access:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); border-color: #bcdcf0; }
.access .ai { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--bid-blue-pale); color: var(--bid-cyan); }
.access h4 { margin: 2px 0 0; font-size: 15px; color: var(--bid-blue); font-weight: 700; }
.access p { margin: 0; font-size: 12.5px; color: var(--muted); }
.access .go { margin-top: auto; font-size: 12.5px; font-weight: 700; color: var(--bid-cyan); display: flex; align-items: center; gap: 6px; }

/* ---------- Alerts ---------- */
.alert-list { display: flex; flex-direction: column; }
.alert {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.alert:last-child { border-bottom: none; }
.alert .aic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 34px; }
.alert .atxt { flex: 1; }
.alert .atxt b { font-size: 13.5px; color: var(--bid-ink); font-weight: 700; display: block; }
.alert .atxt span { font-size: 12.5px; color: var(--muted); }
.alert .awhen { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-weight: 600; }
.aic.warn { background: #fbe7e4; color: var(--st-late); }
.aic.soon { background: #fff7d6; color: #8a6d00; }
.aic.info { background: var(--bid-blue-pale); color: var(--bid-cyan); }

/* ---------- Hero ---------- */
.hero {
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(0,154,222,.32), transparent 55%),
    linear-gradient(120deg, var(--bid-blue) 0%, var(--bid-blue-700) 100%);
  color: #fff; padding: 28px 30px; position: relative; overflow: hidden;
}
.hero h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -.3px; }
.hero p { margin: 0; font-size: 14px; color: #d6ecf8; max-width: 640px; }
.hero .update-line { display: inline-flex; align-items: center; gap: 9px; margin-top: 16px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); padding: 7px 14px; border-radius: 999px; font-size: 12.5px; color: #eaf6ff; }
.hero .update-line .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bid-green-light); }

/* ---------- Charts ---------- */
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 6px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.legend-item .sw { width: 11px; height: 11px; border-radius: 3px; }
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.bar-row .bl { width: 78px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); text-align: right; }
.bar-track { flex: 1; height: 22px; background: #f1f4f6; border-radius: 5px; overflow: hidden; }
.bar-track > span { display: flex; align-items: center; justify-content: flex-end; height: 100%; border-radius: 5px; padding-right: 8px; color: #fff; font-size: 11.5px; font-weight: 700; min-width: 30px; }

/* ---------- Detail / Ficha ---------- */
.block { margin-bottom: 20px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.block-head .bh-left { display: flex; align-items: center; gap: 12px; }
.block-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--bid-blue); }
.dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; }
.dl .di { padding: 13px 4px; border-bottom: 1px solid var(--line); }
.dl .di .dt { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.dl .di .dd { font-size: 13.5px; color: var(--bid-ink); font-weight: 600; }
.dl .di.full { grid-column: 1 / -1; }

/* timeline */
.timeline { margin-top: 10px; }
.tl-names, .tl-dates, .tl-track { display: flex; }
.tl-names > span, .tl-dates > span, .tl-track > .tl-cell { flex: 1 1 0; min-width: 0; }
.tl-names > span { font-size: 12px; font-weight: 700; color: var(--bid-ink); text-align: center; padding: 0 6px; min-height: 34px; display: flex; align-items: flex-end; justify-content: center; line-height: 1.25; }
.tl-track { position: relative; height: 22px; align-items: center; margin: 8px 0; }
.tl-track::before { content: ""; position: absolute; left: calc(100% / 12); right: calc(100% / 12); top: 50%; transform: translateY(-50%); height: 3px; background: var(--line-strong); border-radius: 2px; }
.tl-cell { position: relative; display: flex; justify-content: center; align-items: center; }
.tl-dot { width: 15px; height: 15px; border-radius: 50%; background: var(--bid-gray); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line-strong); position: relative; z-index: 1; }
.tl-cell.done .tl-dot { background: var(--st-ontime); box-shadow: 0 0 0 2px var(--st-ontime); }
.tl-cell.next .tl-dot { background: var(--st-risk); box-shadow: 0 0 0 2px #d9b400; }
.tl-cell.late .tl-dot { background: var(--st-late); box-shadow: 0 0 0 2px var(--st-late); }
.tl-dates > span { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; padding: 0 4px; }

/* knowledge products */
.kp-row { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.kp-row:last-child { border-bottom: none; }
.kp-ico { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 40px; background: #eaf4dc; color: var(--bid-green-dark); }
.kp-meta { flex: 1; }
.kp-meta b { font-size: 13.5px; color: var(--bid-ink); font-weight: 700; display: block; }
.kp-meta span { font-size: 12px; color: var(--muted); }

.note-box { background: #f8fafb; border: 1px solid var(--line); border-radius: 8px; padding: 13px 15px; font-size: 13px; color: var(--ink-soft); line-height: 1.6; }
textarea.input { min-height: 80px; resize: vertical; width: 100%; line-height: 1.5; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10,28,40,.46); display: grid; place-items: center; z-index: 80; padding: 24px; animation: fade .14s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 540px; box-shadow: var(--shadow-pop); overflow: hidden; animation: pop .16s ease; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; color: var(--bid-blue); font-weight: 700; }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 15px; max-height: 64vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); background: #fafbfc; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: none; background: transparent; color: var(--muted); display: grid; place-items: center; }
.icon-btn:hover { background: #f1f4f6; color: var(--bid-ink); }

/* ---------- Fondos ---------- */
.fund-tabs { display: inline-flex; gap: 4px; background: #eef1f3; padding: 4px; border-radius: 10px; }
.fund-tab { border: none; background: transparent; padding: 8px 18px; border-radius: 7px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.fund-tab.active { background: #fff; color: var(--bid-blue); box-shadow: var(--shadow-card); }
.donor-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  background: linear-gradient(110deg, #013a54, var(--bid-blue));
  color: #fff; border-radius: var(--radius-lg); padding: 18px 22px;
}
.donor-banner .db-txt b { font-size: 14.5px; display: block; font-weight: 700; }
.donor-banner .db-txt span { font-size: 12.5px; color: #cfe7f6; }
.toggle { display: inline-flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 700; color: #eaf6ff; background: none; border: none; cursor: pointer; }
.switch { width: 46px; height: 26px; border-radius: 999px; background: rgba(255,255,255,.25); border: none; position: relative; transition: background .15s; flex: 0 0 46px; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on { background: var(--bid-green-light); }
.switch.on::after { left: 23px; }
.public-tag { display:inline-flex; align-items:center; gap:7px; font-size:12px; font-weight:700; color: var(--bid-green-dark); background:#eaf4dc; padding:5px 12px; border-radius:999px; }

/* ---------- Asistente / chat ---------- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - var(--header-h) - 150px); min-height: 480px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 12px; max-width: 760px; }
.msg .av { width: 34px; height: 34px; border-radius: 9px; flex: 0 0 34px; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.msg.assistant .av { background: var(--bid-blue); color: #fff; }
.msg.user { margin-left: auto; flex-direction: row-reverse; }
.msg.user .av { background: var(--bid-cyan); color: #fff; }
.bubble { border-radius: 12px; padding: 13px 16px; font-size: 13.5px; line-height: 1.6; }
.msg.assistant .bubble { background: #fff; border: 1px solid var(--line); border-top-left-radius: 3px; }
.msg.user .bubble { background: var(--bid-blue); color: #fff; border-top-right-radius: 3px; }
.cite {
  display: flex; gap: 10px; align-items: flex-start;
  background: #f6f9fb; border: 1px solid var(--line); border-left: 3px solid var(--bid-cyan);
  border-radius: 7px; padding: 10px 12px; margin-top: 8px;
}
.cite .cn { width: 22px; height: 22px; border-radius: 6px; background: var(--bid-blue-pale); color: var(--bid-cyan); display: grid; place-items: center; flex: 0 0 22px; font-weight: 800; font-size: 11px; }
.cite .ct b { font-size: 12.5px; color: var(--bid-ink); display: block; font-weight: 700; }
.cite .ct .csrc { font-size: 11.5px; color: var(--muted); }
.cite .ct a { font-size: 11.5px; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 9px; padding: 0 24px 14px; }
.chip { border: 1px solid var(--line-strong); background: #fff; color: var(--bid-blue); border-radius: 999px; padding: 8px 14px; font-size: 12.5px; font-weight: 600; }
.chip:hover { background: var(--bid-blue-pale); border-color: #bcdcf0; }
.chat-input { display: flex; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: #fafbfc; align-items: flex-end; }
.chat-input textarea { flex: 1; border: 1px solid var(--line-strong); border-radius: 10px; padding: 11px 14px; font-family: inherit; font-size: 13.5px; resize: none; min-height: 44px; max-height: 120px; }
.chat-input textarea:focus { outline: none; border-color: var(--bid-cyan); box-shadow: 0 0 0 3px rgba(0,154,222,.15); }
.send-btn { width: 44px; height: 44px; border-radius: 10px; border: none; background: var(--bid-blue); color: #fff; display: grid; place-items: center; flex: 0 0 44px; }
.send-btn:hover { background: var(--bid-blue-700); }

.typing { display: inline-flex; gap: 4px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--bid-gray); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* ---------- misc ---------- */
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* ---------- Bloque de estadística (estilo dashboard) ---------- */
.statblock {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: 20px 22px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; min-height: 116px;
}
.statblock .sb-big { font-size: 40px; font-weight: 800; color: var(--bid-blue); line-height: 1; letter-spacing: -1px; }
.statblock .sb-label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 8px; }
.statblock.sb-cyan .sb-big { color: var(--bid-cyan); }

/* ---------- Matriz institucional ---------- */
table.matrix { font-variant-numeric: tabular-nums; }
table.matrix th { text-align: center; vertical-align: middle; background: #f4f7f9; color: var(--ink-soft); }
table.matrix thead tr.mx-group th { font-size: 11.5px; letter-spacing: .4px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
table.matrix thead tr.mx-sub th { font-size: 10.5px; text-transform: none; letter-spacing: 0; padding: 7px 12px; border-left: 1px solid var(--line); color: var(--muted); }
table.matrix th.mx-rowhead { text-align: left; background: #eef2f5; }
table.matrix th.mx-total-col, table.matrix td.mx-total-col { background: #eef5fa; }
table.matrix thead th.mx-total-col { background: #e2eef7; color: var(--bid-blue); }
table.matrix td { text-align: right; padding: 11px 12px; border-left: 1px solid var(--line); }
table.matrix td.mx-rowhead { text-align: left; font-weight: 700; color: var(--bid-ink); border-left: none; }
table.matrix td.mx-num { color: var(--ink-soft); font-weight: 600; }
table.matrix td.mx-amt { color: var(--bid-ink); font-weight: 600; }
table.matrix td.mx-b { font-weight: 800; color: var(--bid-blue); }
table.matrix tr.mx-totalrow td { background: #f4f7f9; border-top: 2px solid var(--line-strong); font-weight: 800; }
table.matrix tr.mx-totalrow td.mx-rowhead { color: var(--bid-blue); }

/* celda resaltada estilo "DaysDiff" */
.cell-flag { display: inline-flex; align-items: center; justify-content: center; min-width: 54px; padding: 4px 9px; border-radius: 5px; font-weight: 800; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cell-flag.f-late { background: #f8d7d2; color: #a5281a; }
.cell-flag.f-risk { background: #fff1b8; color: #8a6d00; }
.cell-flag.f-ok { background: #e9f0f4; color: var(--ink-soft); }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 3px; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .access-grid { grid-template-columns: repeat(2, 1fr); }
  .dl { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .content { padding: 18px; }
  .mini-kpis { grid-template-columns: 1fr; }
}
