:root {
  --navy: #0f2a5c;
  --navy-2: #173a7a;
  --navy-3: #0a1d42;
  --gold: #f7a81b;
  --yellow: #fcd116;
  --red: #ce1126;
  --green: #1f8a4c;
  --cream: #fbf8f2;
  --sand: #f3eee3;
  --ink: #18202f;
  --muted: #5b6477;
  --line: #e6dfd0;
  --sidebar-w: 264px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif; font-size: 15px; line-height: 1.55;
}
[hidden] { display: none !important; }
h1, h2, h3 { letter-spacing: -.02em; color: var(--navy); margin: 0; }
.stripe { position: fixed; inset: 0 0 auto; height: 4px; z-index: 30; background: linear-gradient(90deg, var(--yellow) 0 50%, var(--navy-2) 50% 75%, var(--red) 75%); }

/* ---------- Shared controls ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: .85rem; font-weight: 700; color: var(--navy); }
.field input, .field textarea, .field select, .input {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field textarea:focus, .input:focus, .field select:focus {
  outline: none; border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(23, 58, 122, .15);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: .95rem; padding: 10px 18px;
  border: 1.5px solid var(--navy); border-radius: 99px; background: var(--navy); color: #fff;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn--ghost { background: #fff; color: var(--navy); }
.btn--ghost:hover { background: var(--sand); color: var(--navy); }
.btn--block { width: 100%; padding: 13px 20px; }
.btn--sm { padding: 6px 12px; font-size: .85rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 1.5rem; line-height: 1;
}
.icon-btn:hover { background: rgba(15, 42, 92, .08); }
.link { background: none; border: 0; padding: 0; font: inherit; font-size: .9rem; font-weight: 600; color: var(--navy-2); cursor: pointer; }
.link:hover { text-decoration: underline; }
.error {
  margin: 0; padding: 10px 14px; border-radius: 10px; font-size: .9rem;
  background: #fff1f2; border: 1px solid #f3c9cd; color: #9f0d1f;
}
.muted { color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); }

/* ---------- Sign in ---------- */
.auth { max-width: 440px; margin: 0 auto; padding: 48px 16px; }
.logos { display: flex; justify-content: center; gap: 18px; margin-bottom: 24px; }
.logos img { width: 64px; height: 64px; object-fit: contain; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 22px;
  padding: clamp(22px, 6vw, 34px); box-shadow: 0 12px 32px rgba(15, 42, 92, .08);
}
.card h1 { font-size: 1.7rem; font-weight: 800; margin-bottom: 4px; }
.card .muted { margin: 0 0 20px; }
.card form { display: grid; gap: 14px; }
.code-input { text-align: center; font-size: 1.8rem !important; font-weight: 800; letter-spacing: .4em; font-variant-numeric: tabular-nums; }
.hint { margin: 16px 0 0; font-size: .85rem; color: var(--muted); text-align: center; }
.row { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- App shell ---------- */
.app { min-height: 100%; }
.sidebar {
  position: fixed; inset: 4px auto 0 0; width: var(--sidebar-w); z-index: 20;
  display: flex; flex-direction: column; background: var(--navy-3); color: #dfe6f3;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar__brand img { width: 36px; height: 36px; object-fit: contain; background: #fff; border-radius: 50%; padding: 3px; }
.sidebar__brand strong { display: block; color: #fff; font-size: .95rem; }
.sidebar__brand span { font-size: .78rem; color: #9fb0cc; }
.nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav__section { margin: 14px 10px 6px; font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.nav__group-title { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 10px; font-weight: 700; color: #fff; }
.nav__link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 38px; margin: 2px 0;
  border-radius: 10px; color: #c7d2e6; text-decoration: none; font-weight: 500; font-size: .92rem;
}
.nav__link--top { padding-left: 10px; font-weight: 700; color: #fff; }
.nav__link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav__link[aria-current="page"] { background: rgba(247, 168, 27, .16); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.sidebar__user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--navy-3); font-weight: 800; }
.sidebar__who { min-width: 0; flex: 1; }
.sidebar__who strong { display: block; color: #fff; font-size: .9rem; }
.sidebar__who span { display: block; font-size: .75rem; color: #9fb0cc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .icon-btn:hover { background: rgba(255, 255, 255, .1); }
.mobilebar { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(10, 29, 66, .5); z-index: 15; }

.content { margin-left: var(--sidebar-w); padding: 36px clamp(16px, 3vw, 40px) 60px; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 1.7rem; font-weight: 800; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumbs { font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.stat span { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat strong { display: block; font-size: 1.6rem; font-weight: 800; color: var(--navy); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat--gold { border-top: 4px solid var(--gold); }
.stat--green { border-top: 4px solid var(--green); }
.stat--red { border-top: 4px solid var(--red); }
.stat--navy { border-top: 4px solid var(--navy-2); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { max-width: 320px; flex: 1 1 220px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: .85rem; font-weight: 600; padding: 7px 12px; border-radius: 99px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.toolbar__end { margin-left: auto; }

/* ---------- Table ---------- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data th {
  text-align: left; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--cream); white-space: nowrap;
}
.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data tbody tr:last-child td { border-bottom: 0; }
.data tbody tr.clickable { cursor: pointer; }
.data tbody tr.clickable:hover { background: var(--cream); }
.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data .who strong { display: block; }
.data .who span { font-size: .82rem; color: var(--muted); }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--navy); font-size: 1.05rem; margin-bottom: 4px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px;
  font-size: .78rem; font-weight: 700; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--pending { background: #fff6e0; color: #9a6500; }
.badge--verified { background: #e7f6ed; color: var(--green); }
.badge--rejected { background: #fdebed; color: #b00e22; }
.badge--muted { background: var(--sand); color: var(--muted); }
.badge--navy { background: #e8eef9; color: var(--navy-2); }
.flag { font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--sand); }

/* ---------- Modal ---------- */
.modal {
  width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto;
  border: 0; border-radius: 20px; padding: 26px; background: #fff; color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
}
.modal::backdrop { background: rgba(10, 29, 66, .6); }
.modal__close-form { position: absolute; top: 12px; right: 12px; margin: 0; }
.modal h2 { font-size: 1.35rem; font-weight: 800; margin-bottom: 4px; padding-right: 40px; }
.modal__form { display: grid; gap: 14px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 16px 0; }
.detail div span { display: block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.detail div strong { font-weight: 600; word-break: break-word; }
.receipt { margin: 8px 0 16px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--sand); }
.receipt img { display: block; width: 100%; max-height: 420px; object-fit: contain; background: #fff; }
.receipt a { display: block; padding: 10px 14px; font-weight: 700; color: var(--navy-2); }
.status-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.status-picker label { flex: 1 1 0; }
.status-picker input { position: absolute; opacity: 0; pointer-events: none; }
.status-picker span {
  display: block; text-align: center; padding: 9px 10px; border-radius: 10px; border: 1.5px solid var(--line);
  font-weight: 700; font-size: .88rem; cursor: pointer;
}
.status-picker input:focus-visible + span { box-shadow: 0 0 0 3px rgba(23, 58, 122, .25); }
.status-picker input[value="pending"]:checked + span { background: #fff6e0; border-color: #e8b64a; color: #9a6500; }
.status-picker input[value="verified"]:checked + span { background: #e7f6ed; border-color: #6cc093; color: var(--green); }
.status-picker input[value="rejected"]:checked + span { background: #fdebed; border-color: #ec8d98; color: #b00e22; }
.audit { font-size: .8rem; color: var(--muted); margin: 0; }

.perms { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 14px; margin: 0; }
.perms legend { font-size: .85rem; font-weight: 700; color: var(--navy); padding: 0 6px; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.perm-row:last-child { border-bottom: 0; }
.perm-row > span { font-weight: 600; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 12px; font-size: .82rem; font-weight: 600; cursor: pointer; }
.seg label + label span { border-left: 1.5px solid var(--line); }
.seg input:checked + span { background: var(--navy); color: #fff; }
.seg input:focus-visible + span { box-shadow: inset 0 0 0 2px var(--gold); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--navy-3); color: #fff; padding: 12px 20px; border-radius: 12px; font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .mobilebar {
    position: sticky; top: 4px; z-index: 10; display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line);
  }
  .mobilebar__title { font-weight: 800; color: var(--navy); }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .app.is-menu-open .sidebar { transform: none; }
  .content { margin-left: 0; padding-top: 20px; }

  /* Tables become cards */
  .data thead { display: none; }
  .data, .data tbody, .data tr, .data td { display: block; width: 100%; }
  .data tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .data td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .data td::before { content: attr(data-label); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: left; }
  .data td.who { display: block; text-align: left; margin-bottom: 4px; }
  .data td.who::before { content: none; }
  .data .num { text-align: right; }
  .detail { grid-template-columns: 1fr; }
  .toolbar__end { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* ---------- Analytics ---------- */
.stat--link { text-decoration: none; border-top: 4px solid var(--gold); }
.stat--link strong { font-size: 1.05rem; color: var(--navy-2); }
.stat--link:hover { background: var(--cream); }
.panel {
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: clamp(18px, 3vw, 28px); margin-bottom: 20px;
}
.panel__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.panel__flag { width: 44px; height: 23px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.panel__head h2 { font-size: 1.35rem; font-weight: 800; }
.panel__head h2 span { color: var(--muted); font-weight: 600; }
.panel__head p { margin: 0 0 0 auto; color: var(--muted); font-weight: 600; font-size: .9rem; }
.panel__sub { font-size: 1rem; font-weight: 800; margin: 26px 0 10px; }

/* Wide tiles so large amounts (e.g. $1.250.000.000 COP) never get cramped */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: var(--cream); min-width: 0; }
.kpi span { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); }
.kpi strong {
  display: block; margin: 2px 0; font-size: clamp(1.35rem, 2.4vw, 1.9rem); font-weight: 800; color: var(--ink);
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.2;
}
.kpi small { font-size: .8rem; color: var(--muted); }
.kpi--hero { grid-column: 1 / -1; background: var(--navy); border-color: var(--navy); }
.kpi--hero span { color: #b9c6de; }
.kpi--hero strong { color: #fff; font-size: clamp(1.8rem, 4vw, 2.8rem); }
.kpi--verified { border-left: 4px solid var(--green); }
.kpi--pending { border-left: 4px solid #e0a100; }
.kpi--rejected { border-left: 4px solid var(--red); }

/* Stacked share bar: 2px surface gap between segments, rounded ends */
.bar { display: flex; gap: 2px; height: 14px; margin: 20px 0 10px; border-radius: 4px; overflow: hidden; background: #fff; }
.bar__seg { flex-basis: 0; min-width: 4px; }
.bar__seg:first-child { border-radius: 4px 0 0 4px; }
.bar__seg:last-child { border-radius: 0 4px 4px 0; }
.bar__seg:only-child { border-radius: 4px; }
.bar__seg--verified, .legend__dot--verified { background: var(--green); }
.bar__seg--pending, .legend__dot--pending { background: #e0a100; }
.bar__seg--rejected, .legend__dot--rejected { background: var(--red); }
.legend { list-style: none; display: flex; gap: 18px; flex-wrap: wrap; padding: 0; margin: 0; font-size: .85rem; color: var(--ink); }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend__dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.empty--inline { padding: 20px; background: var(--cream); border-radius: 12px; margin-top: 14px; }
.panel .table-wrap { border-radius: 12px; }
@media (max-width: 900px) {
  .panel__head p { margin-left: 0; width: 100%; }
}
/* Large figures wrap inside their card instead of overflowing */
.stat { min-width: 0; }
.stat strong { overflow-wrap: anywhere; line-height: 1.2; font-size: clamp(1.2rem, 2vw, 1.6rem); }
