/* ===========================================================
 * VabcV ERP — Stylesheet maestro
 * Made by: Bert Rendon
 * Estilo: QuickBooks-inspired structure + AB CleanRoom Blue palette
 * Referencia visual: docs/vabcv_prototype.html (commit c3750f0+)
 * Tipografía: Geist (body+headings) + JetBrains Mono (tabular/mono)
 * =========================================================== */

/* ============================================================ */
/* 1. DESIGN TOKENS — AB CleanRoom Blue palette                 */
/* ============================================================ */
:root {
  /* Sidebar */
  --ab-sidebar:          #0b3d5c;
  --ab-sidebar-hover:    #0e486d;
  --ab-sidebar-active:   #145c85;
  --ab-sidebar-text:     #d6e9f5;
  --ab-sidebar-text-dim: #8fb0c4;

  /* Primary / accent */
  --ab-primary:          #2094c7;
  --ab-primary-hover:    #1d7fa8;
  --ab-primary-dark:     #156a8c;
  --ab-accent:           #5ec5f0;
  --ab-accent-light:     #d6edf7;

  /* Semantic */
  --ab-amber:            #f59e0b;
  --ab-amber-light:      #fff4e0;
  --ab-amber-dark:       #854f0b;
  --ab-green:            #17a34a;
  --ab-green-dark:       #0d6e31;
  --ab-green-light:      #d1f4dd;
  --ab-red:              #dc2626;
  --ab-red-light:        #fde6e6;

  /* Surfaces */
  --ab-bg:               #f8fafb;
  --ab-white:            #ffffff;
  --ab-row-hover:        #f1f6f9;

  /* Text */
  --ab-text:             #003d66;
  --ab-text-body:        #1a2634;
  --ab-text-muted:       #6b7a85;
  --ab-text-dim:         #9ba7b0;

  /* Borders */
  --ab-border:           #e4ebf0;
  --ab-border-strong:    #ccd8e0;

  /* Layout scale */
  --ab-radius:           4px;
  --ab-radius-lg:        8px;
  --ab-shadow-sm:        0 1px 2px rgba(11, 61, 92, 0.04);
  --ab-shadow-md:        0 2px 8px rgba(11, 61, 92, 0.06);
  --ab-shadow-lg:        0 10px 40px rgba(0, 0, 0, 0.2);

  /* Bootstrap overrides (5.3 uses CSS vars) */
  --bs-primary:          var(--ab-primary);
  --bs-primary-rgb:      32, 148, 199;
  --bs-body-color:       var(--ab-text-body);
  --bs-body-bg:          var(--ab-bg);
  --bs-link-color:       var(--ab-primary);
  --bs-link-hover-color: var(--ab-primary-hover);
}

/* ============================================================ */
/* 2. RESET + BASE                                              */
/* ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Geist', -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--ab-text-body);
  background: var(--ab-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
  color: inherit;
}

code, pre, kbd, samp, .text-mono, .font-mono {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--ab-text);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

/* ============================================================ */
/* 3. LAYOUT PRIMARIO (grid .app)                               */
/* ============================================================ */
.app {
  display: grid;
  grid-template-columns: 64px 240px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "nav secondary topbar"
    "nav secondary main";
  height: 100vh;
  overflow: hidden;
}

/* ============================================================ */
/* 4. PRIMARY NAV (64px icon-only)                              */
/* ============================================================ */
.nav-primary {
  grid-area: nav;
  background: var(--ab-sidebar);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 10;
}
.nav-logo {
  width: 64px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ab-sidebar);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.nav-logo-box {
  width: 36px;
  height: 36px;
  background: var(--ab-accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ab-sidebar);
  font-weight: 600;
  font-size: 16px;
}
.nav-items {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
  width: 100%;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 4px;
  color: var(--ab-sidebar-text-dim);
  cursor: pointer;
  font-size: 10.5px;
  gap: 3px;
  width: 100%;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
  text-align: center;
  line-height: 1.2;
}
.nav-item:hover {
  background: var(--ab-sidebar-hover);
  color: #fff;
}
.nav-item.active {
  background: var(--ab-sidebar-hover);
  color: #fff;
  border-left-color: var(--ab-accent);
}
.nav-item svg {
  width: 22px;
  height: 22px;
  display: block;
}
.nav-item-disabled,
.nav-item-coming-soon {
  opacity: 0.5;
  cursor: not-allowed;
}
.nav-item-disabled:hover,
.nav-item-coming-soon:hover {
  background: transparent;
  color: var(--ab-sidebar-text-dim);
}
.nav-spacer { flex: 1; }
.nav-bottom {
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 0;
}

/* ============================================================ */
/* 5. SECONDARY NAV (240px context-aware)                       */
/* ============================================================ */
.nav-secondary {
  grid-area: secondary;
  background: var(--ab-white);
  border-right: 1px solid var(--ab-border);
  overflow-y: auto;
  padding: 14px 0;
}
.nav-sec-title {
  padding: 6px 18px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ab-text-muted);
  text-transform: uppercase;
}
.nav-sec-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 18px;
  color: var(--ab-text-body);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.12s ease;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.nav-sec-item:hover { background: var(--ab-bg); }
.nav-sec-item.active {
  background: var(--ab-accent-light);
  color: var(--ab-text);
  font-weight: 600;
  border-left-color: var(--ab-primary);
}
.nav-sec-divider {
  margin: 14px 18px;
  border-top: 1px solid var(--ab-border);
}
.nav-sec-badge {
  background: var(--ab-amber-light);
  color: var(--ab-amber-dark);
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
}

/* ============================================================ */
/* 6. TOPBAR (56px)                                             */
/* ============================================================ */
.topbar {
  grid-area: topbar;
  background: var(--ab-white);
  border-bottom: 1px solid var(--ab-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 20px;
  z-index: 5;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ab-text);
}
.topbar-brand-tag {
  font-size: 11px;
  color: var(--ab-text-muted);
  font-weight: 400;
  padding: 3px 8px;
  background: var(--ab-bg);
  border-radius: 4px;
  border: 1px solid var(--ab-border);
}
.topbar-search {
  flex: 1;
  max-width: 560px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  height: 36px;
  background: var(--ab-bg);
  border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius-lg);
  padding: 0 14px 0 36px;
  font-size: 13.5px;
  color: var(--ab-text-body);
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.topbar-search input:focus {
  outline: none;
  border-color: var(--ab-primary);
  background: var(--ab-white);
  box-shadow: 0 0 0 3px rgba(32, 148, 199, 0.15);
}
.topbar-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ab-text-muted);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ab-radius);
  color: var(--ab-text-muted);
  cursor: pointer;
  position: relative;
  transition: background 0.12s ease;
  background: transparent;
  border: none;
}
.topbar-icon:hover { background: var(--ab-bg); }
.topbar-icon svg { width: 18px; height: 18px; }
.topbar-icon-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--ab-red);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}
.topbar-avatar {
  width: 32px;
  height: 32px;
  background: var(--ab-primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

/* ============================================================ */
/* 7. MAIN CONTENT                                              */
/* ============================================================ */
.main {
  grid-area: main;
  overflow-y: auto;
  padding: 24px 32px 48px;
  background: var(--ab-bg);
}
.main-footer {
  margin-top: 32px;
  padding: 16px 0;
  border-top: 1px solid var(--ab-border);
  text-align: center;
  color: var(--ab-text-muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* Scrollbars — main + nav-secondary */
.main::-webkit-scrollbar { width: 10px; }
.main::-webkit-scrollbar-thumb { background: #cfd8df; border-radius: 5px; }
.main::-webkit-scrollbar-thumb:hover { background: #aeb9c2; }
.nav-secondary::-webkit-scrollbar { width: 6px; }
.nav-secondary::-webkit-scrollbar-thumb { background: #d8dde1; border-radius: 3px; }

/* ============================================================ */
/* 8. COMPONENTS — Dashboard header, chips, section titles      */
/* ============================================================ */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.dash-greeting {
  font-size: 22px;
  font-weight: 500;
  color: var(--ab-text);
}
.dash-actions-right {
  display: flex;
  gap: 10px;
  font-size: 13px;
  color: var(--ab-text-muted);
}
.dash-actions-right span {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--ab-radius);
}
.dash-actions-right span:hover { background: var(--ab-white); }

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ab-text);
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section-title a {
  color: var(--ab-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.page-title {
  font-size: 22px;
  font-weight: 500;
  color: var(--ab-text);
}
.page-subtitle {
  font-size: 13px;
  color: var(--ab-text-muted);
  margin-top: 2px;
}

.app-chips {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
  overflow-x: auto;
  padding: 4px 0;
}
.app-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 12px;
  background: var(--ab-white);
  border: 1px solid var(--ab-border);
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-size: 14px;
  font-weight: 500;
  color: var(--ab-text-body);
  text-decoration: none;
}
.app-chip:hover {
  border-color: var(--ab-primary);
  box-shadow: 0 2px 8px rgba(11, 61, 92, 0.1);
}
.app-chip-icon {
  width: 28px;
  height: 28px;
  background: var(--ab-sidebar);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ab-accent);
  font-size: 13px;
  font-weight: 700;
}
.app-chip.placeholder {
  opacity: 0.6;
  cursor: not-allowed;
}
.app-chip.placeholder .app-chip-icon {
  background: #415f74;
}

/* ============================================================ */
/* 9. COMPONENTS — Buttons (primary, secondary, split, pill)    */
/* ============================================================ */
.btn-primary {
  background: var(--ab-primary);
  color: #fff;
  padding: 9px 18px;
  border-radius: var(--ab-radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--ab-primary);
  transition: background 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn-primary:hover {
  background: var(--ab-primary-hover);
  border-color: var(--ab-primary-hover);
  color: #fff;
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary-split {
  display: inline-flex;
  border-radius: var(--ab-radius);
  overflow: hidden;
}
.btn-primary-split > .btn-primary { border-radius: 0; }
.btn-primary-split-chevron {
  background: var(--ab-primary-dark);
  color: #fff;
  padding: 9px 10px;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

.btn-secondary {
  padding: 9px 16px;
  background: var(--ab-white);
  color: var(--ab-text-body);
  border: 1px solid var(--ab-border-strong);
  border-radius: var(--ab-radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease;
}
.btn-secondary:hover { background: var(--ab-bg); color: var(--ab-text-body); }

.btn-danger {
  background: var(--ab-red);
  color: #fff;
  padding: 9px 18px;
  border-radius: var(--ab-radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--ab-red);
  transition: background 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

.create-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.create-actions-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ab-text);
  margin-right: 4px;
}
.action-pill {
  padding: 7px 14px;
  background: var(--ab-white);
  border: 1px solid var(--ab-border-strong);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ab-text-body);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.action-pill:hover {
  background: var(--ab-accent-light);
  border-color: var(--ab-primary);
  color: var(--ab-text);
}
.action-pill-link {
  color: var(--ab-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-left: 4px;
  text-decoration: none;
}
.action-pill-link:hover { text-decoration: underline; }

/* ============================================================ */
/* 10. COMPONENTS — Forms                                       */
/* ============================================================ */
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ab-text);
  margin-bottom: 6px;
  display: block;
}
.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--ab-white);
  border: 1px solid var(--ab-border-strong);
  border-radius: var(--ab-radius);
  font-size: 14px;
  color: var(--ab-text-body);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ab-primary);
  box-shadow: 0 0 0 3px rgba(32, 148, 199, 0.15);
}
.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--ab-red);
}
.invalid-feedback {
  color: var(--ab-red);
  font-size: 12px;
  margin-top: 4px;
  display: block;
}
.form-text {
  color: var(--ab-text-muted);
  font-size: 12px;
  margin-top: 4px;
}

/* ============================================================ */
/* 11. COMPONENTS — Tables (inv-table pattern)                  */
/* ============================================================ */
.table-wrap {
  background: var(--ab-white);
  border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius-lg);
  overflow: hidden;
}
table.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.inv-table thead { background: var(--ab-bg); }
.inv-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ab-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--ab-border);
  white-space: nowrap;
}
.inv-table th.num { text-align: right; }
.inv-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ab-border);
  color: var(--ab-text-body);
  vertical-align: middle;
}
.inv-table tbody tr { transition: background 0.12s ease; }
.inv-table tbody tr:hover { background: var(--ab-row-hover); }
.inv-table tbody tr:last-child td { border-bottom: none; }
.inv-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.inv-table td.muted { color: var(--ab-text-muted); }
.row-actions {
  display: inline-flex;
  gap: 8px;
  color: var(--ab-primary);
  font-weight: 500;
  font-size: 13px;
}
.row-actions a { cursor: pointer; text-decoration: none; }
.row-actions a:hover { text-decoration: underline; }
.row-sep { color: var(--ab-border-strong); }

.table-footer {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--ab-bg);
  border-top: 1px solid var(--ab-border);
  font-size: 13px;
  color: var(--ab-text-muted);
}
.pagination { display: flex; gap: 14px; }
.pagination a { cursor: pointer; color: var(--ab-text-muted); text-decoration: none; }
.pagination a.active { color: var(--ab-text); font-weight: 600; }
.pagination a.disabled { opacity: 0.4; cursor: default; }

/* ============================================================ */
/* 12. COMPONENTS — Pills, badges, status-pills                 */
/* ============================================================ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: capitalize;
}
.status-pill.paid,
.status-pill.activo,
.status-pill.convertido {
  background: var(--ab-green-light);
  color: var(--ab-green-dark);
}
.status-pill.pending,
.status-pill.nueva,
.status-pill.suspendido {
  background: var(--ab-amber-light);
  color: var(--ab-amber-dark);
}
.status-pill.overdue,
.status-pill.cancelado {
  background: var(--ab-red-light);
  color: #9a1b1b;
}
.status-pill.contactado {
  background: var(--ab-accent-light);
  color: var(--ab-text);
}
.status-pill.descartado,
.status-pill.draft {
  background: #eceff3;
  color: #556470;
}
.status-pill-dot { width: 6px; height: 6px; border-radius: 50%; }
.status-pill.paid .status-pill-dot,
.status-pill.activo .status-pill-dot,
.status-pill.convertido .status-pill-dot { background: var(--ab-green); }
.status-pill.pending .status-pill-dot,
.status-pill.nueva .status-pill-dot,
.status-pill.suspendido .status-pill-dot { background: var(--ab-amber); }
.status-pill.overdue .status-pill-dot,
.status-pill.cancelado .status-pill-dot { background: var(--ab-red); }
.status-pill.contactado .status-pill-dot { background: var(--ab-primary); }
.status-pill.descartado .status-pill-dot,
.status-pill.draft .status-pill-dot { background: #6b7a85; }

/* ============================================================ */
/* 13. COMPONENTS — Cards, feed, glance, bank, metric           */
/* ============================================================ */
.card {
  background: var(--ab-white);
  border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius-lg);
  box-shadow: var(--ab-shadow-sm);
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.feed-card {
  background: var(--ab-white);
  border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius-lg);
  padding: 18px 20px;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}
.feed-card:hover {
  border-color: var(--ab-primary);
  box-shadow: 0 2px 10px rgba(11, 61, 92, 0.06);
}
.feed-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.feed-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ab-text);
}
.feed-icon-sq {
  width: 22px;
  height: 22px;
  background: var(--ab-sidebar);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ab-accent);
  font-size: 12px;
  font-weight: 700;
}
.feed-card-dots { color: var(--ab-text-muted); cursor: pointer; }
.feed-card-body {
  font-size: 13px;
  color: var(--ab-text-body);
  line-height: 1.55;
  margin-bottom: 12px;
}
.feed-card-link {
  color: var(--ab-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.feed-card-link:hover { text-decoration: underline; }

.glance-row {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  margin-bottom: 28px;
}
.glance-card,
.bank-card {
  background: var(--ab-white);
  border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius-lg);
  padding: 20px 24px;
}
.glance-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.glance-subtitle {
  font-size: 11.5px;
  color: var(--ab-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.glance-period {
  font-size: 12.5px;
  color: var(--ab-text-muted);
  padding: 4px 10px;
  border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
}

.funnel {
  display: grid;
  grid-template-columns: 1fr 20px 1fr 20px 1fr 20px 1fr;
  gap: 0;
  align-items: center;
}
.funnel-step {
  padding: 14px;
  border-top: 4px solid var(--ab-green);
  background: var(--ab-white);
  border-right: 1px solid var(--ab-border);
  border-bottom: 1px solid var(--ab-border);
  border-left: 1px solid var(--ab-border);
  border-radius: 6px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.funnel-step:first-child {
  border-top-color: var(--ab-primary);
  background: var(--ab-accent-light);
}
.funnel-step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ab-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.funnel-step-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--ab-text);
  line-height: 1.1;
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}
.funnel-step-sub {
  font-size: 11.5px;
  color: var(--ab-green);
  margin-top: 6px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}
.funnel-arrow {
  color: var(--ab-border-strong);
  font-size: 18px;
  text-align: center;
  font-weight: 300;
}

.bank-row {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ab-border);
}
.bank-row:last-child { border-bottom: none; }
.bank-icon {
  width: 32px;
  height: 32px;
  background: var(--ab-accent-light);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ab-primary);
  flex-shrink: 0;
}
.bank-info { flex: 1; min-width: 0; }
.bank-name { font-size: 13px; font-weight: 600; color: var(--ab-text-body); }
.bank-sub { font-size: 11.5px; color: var(--ab-text-muted); line-height: 1.4; }
.bank-amounts { text-align: right; font-size: 12.5px; }
.bank-amount-big {
  font-size: 13px;
  font-weight: 600;
  color: var(--ab-text);
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}
.bank-status {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--ab-green);
  font-weight: 500;
  margin-top: 2px;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.metric-card {
  background: var(--ab-white);
  border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius-lg);
  padding: 16px 18px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.metric-card:hover {
  border-color: var(--ab-primary);
  box-shadow: 0 2px 8px rgba(11, 61, 92, 0.06);
}
.metric-label {
  font-size: 11.5px;
  color: var(--ab-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 6px;
}
.metric-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--ab-text);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}
.metric-sub {
  font-size: 11.5px;
  color: var(--ab-text-muted);
  margin-top: 4px;
}
.metric-card.alert {
  background: var(--ab-amber-light);
  border-color: var(--ab-amber);
}
.metric-card.alert .metric-label,
.metric-card.alert .metric-value { color: var(--ab-amber-dark); }
.metric-card.placeholder {
  background: var(--ab-bg);
  border-style: dashed;
  opacity: 0.7;
}
.metric-card.placeholder .metric-value {
  font-size: 14px;
  font-style: italic;
  color: var(--ab-text-muted);
  font-weight: 400;
  font-family: 'Geist', sans-serif;
}

/* ============================================================ */
/* 14. COMPONENTS — Demo banner + modal + alerts                */
/* ============================================================ */
.demo-banner {
  background: var(--ab-accent-light);
  border: 1px solid var(--ab-accent);
  border-radius: var(--ab-radius-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  position: relative;
}
.demo-banner-icon { font-size: 22px; }
.demo-banner-text {
  flex: 1;
  font-size: 13.5px;
  color: var(--ab-text);
  line-height: 1.5;
}
.demo-banner-text strong { font-weight: 600; }
.demo-banner-text a {
  color: var(--ab-primary);
  font-weight: 600;
  margin-left: 8px;
  text-decoration: none;
  cursor: pointer;
}
.demo-banner-text a:hover { text-decoration: underline; }
.demo-banner-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ab-text-muted);
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
  border: none;
  flex-shrink: 0;
}
.demo-banner-close:hover { background: rgba(11, 61, 92, 0.08); }

/* Bootstrap alert overrides — align with AB palette */
.alert {
  border-radius: var(--ab-radius-lg);
  padding: 12px 16px;
  border: 1px solid transparent;
  margin-bottom: 14px;
  font-size: 13.5px;
}
.alert-success {
  background: var(--ab-green-light);
  color: var(--ab-green-dark);
  border-color: var(--ab-green);
}
.alert-info {
  background: var(--ab-accent-light);
  color: var(--ab-text);
  border-color: var(--ab-accent);
}
.alert-warning {
  background: var(--ab-amber-light);
  color: var(--ab-amber-dark);
  border-color: var(--ab-amber);
}
.alert-danger {
  background: var(--ab-red-light);
  color: #9a1b1b;
  border-color: var(--ab-red);
}

/* Bootstrap modal overrides */
.modal-content {
  border-radius: var(--ab-radius-lg);
  border: none;
  box-shadow: var(--ab-shadow-lg);
}
.modal-header {
  padding: 18px 24px;
  background: var(--ab-accent-light);
  border-bottom: 1px solid var(--ab-accent);
  border-top-left-radius: var(--ab-radius-lg);
  border-top-right-radius: var(--ab-radius-lg);
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ab-text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-body {
  padding: 22px 24px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ab-text-body);
}
.modal-body p { margin-bottom: 10px; }
.modal-body p:last-child { margin-bottom: 0; }
.modal-body strong { color: var(--ab-text); }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--ab-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================ */
/* 15. AUTH LAYOUT (login, password-reset, public form, errors) */
/* ============================================================ */
.auth-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 15% 20%, rgba(32, 148, 199, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 85% 80%, rgba(94, 197, 240, 0.08) 0%, transparent 50%),
    var(--ab-bg);
}
.auth-container {
  max-width: 28rem;
  margin: 4rem auto 2rem;
  padding: 0 1rem;
  flex: 1;
}
.auth-container .card {
  padding: 2rem;
  border-radius: var(--ab-radius-lg);
  background: var(--ab-white);
  box-shadow: var(--ab-shadow-md);
}
.auth-container h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.auth-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}
.auth-brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--ab-primary);
  color: #fff;
  border-radius: 10px;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}
.auth-brand-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--ab-text);
  letter-spacing: -0.01em;
}
.auth-brand-name .text-accent { color: var(--ab-primary); }
.auth-footer {
  padding: 1rem;
  text-align: center;
  color: var(--ab-text-muted);
  font-size: 12px;
}

.public-form-container {
  max-width: 46rem;
  margin: 2.5rem auto;
  padding: 0 1rem;
  flex: 1;
}
.public-form-container .card {
  padding: 2rem;
  border-radius: var(--ab-radius-lg);
  background: var(--ab-white);
  box-shadow: var(--ab-shadow-md);
}

/* SAMPLE warning banner used by Ready-to-Receive Rule 6 */
.sample-warning {
  background: var(--ab-amber-light);
  border-left: 4px solid var(--ab-amber);
  color: var(--ab-text);
  padding: 0.75rem 1rem;
  border-radius: var(--ab-radius);
  margin-bottom: 1rem;
  font-size: 13px;
  line-height: 1.5;
}

/* ============================================================ */
/* 16. UTILITIES — focus-visible, skip-link, status-icon, a11y  */
/* ============================================================ */
*:focus-visible {
  outline: 2px solid var(--ab-primary);
  outline-offset: 2px;
  border-radius: 2px;
}
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible {
  outline-offset: 4px;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--ab-primary);
  color: #fff;
  padding: 8px 12px;
  z-index: 1050;
  text-decoration: none;
  font-weight: 600;
  border-radius: 0 0 var(--ab-radius) 0;
}
.skip-link:focus,
.skip-link:focus-visible { top: 0; color: #fff; }

.status-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.status-icon-success { color: var(--ab-primary); }
.status-icon-warning { color: var(--ab-amber); }
.status-icon-error   { color: var(--ab-red); }

.help-popover-trigger {
  color: var(--ab-text-muted);
  vertical-align: baseline;
  text-decoration: none;
}
.help-popover-trigger:hover,
.help-popover-trigger:focus { color: var(--ab-primary); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.text-muted { color: var(--ab-text-muted); }
.text-accent { color: var(--ab-accent); }
.text-primary { color: var(--ab-primary); }
.text-danger { color: var(--ab-red); }
.text-success { color: var(--ab-green-dark); }
.small { font-size: 12px; }

/* ============================================================ */
/* 17. RESPONSIVE                                               */
/* ============================================================ */
@media (max-width: 1200px) {
  .glance-row { grid-template-columns: 1fr; }
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .app {
    grid-template-columns: 64px 1fr;
    grid-template-areas:
      "nav topbar"
      "nav main";
  }
  .nav-secondary { display: none; }
  .main { padding: 16px 18px 32px; }
  .topbar-search { display: none; }
  .topbar-left { font-size: 13px; }
}
