/* ============================================================
   FinOps BankSync — style.css
   Light Theme | Version 1.0
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── CSS VARIABLES ── */
:root {
  --bg:        #f0f4f8;
  --surface:   #ffffff;
  --surface2:  #f7f9fc;
  --surface3:  #edf1f7;
  --border:    #e2e8f0;
  --border2:   #cbd5e1;
  --accent:    #00a884;
  --accent-bg: rgba(0,168,132,0.08);
  --accent2:   #2563eb;
  --accent3:   #d97706;
  --danger:    #dc2626;
  --green:     #059669;
  --text:      #0f172a;
  --text2:     #475569;
  --text3:     #94a3b8;
  --sidebar-w: 240px;
  --radius:    12px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow:    0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  /* ── EasyLedger-style dark sidebar ── */
  --sb-bg:        #1a2744;
  --sb-bg2:       #1e2f52;
  --sb-active:    rgba(255,255,255,0.10);
  --sb-hover:     rgba(255,255,255,0.06);
  --sb-text:      rgba(255,255,255,0.85);
  --sb-text2:     rgba(255,255,255,0.50);
  --sb-accent:    #4ade80;
  --sb-border:    rgba(255,255,255,0.08);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================================
   SIDEBAR — EasyLedger dark style
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sb-bg);
  border-right: none;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--sb-border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 13px; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,168,132,0.4);
}
.logo-text .logo-name {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 15px; color: #fff;
  display: block;
}
.logo-text .logo-sub {
  font-size: 9px; font-weight: 600; color: var(--sb-text2);
  letter-spacing: 1.2px; text-transform: uppercase;
}

/* NAV */
.sidebar-nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sb-border); border-radius: 4px; }

.nav-section-label {
  font-size: 9px; font-weight: 700; letter-spacing: 1.8px;
  color: var(--sb-text2); text-transform: uppercase;
  padding: 10px 10px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  cursor: pointer; margin-bottom: 1px;
  color: var(--sb-text); font-size: 13px; font-weight: 500;
  transition: all 0.15s; text-decoration: none;
  user-select: none;
}
.nav-item:hover { background: var(--sb-hover); color: #fff; }
.nav-item.active {
  background: var(--sb-active);
  color: #fff;
  font-weight: 600;
  border-left: 3px solid var(--sb-accent);
  padding-left: 7px;
}
.nav-icon { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; opacity: 0.8; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--accent); color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 1px 6px; border-radius: 20px;
}
.nav-help {
  margin-left: 6px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.5);
  font-size: 9px; font-weight: 800;
  width: 16px; height: 16px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: .15s;
}
.nav-help:hover { background: #3b82f6; color: #fff; }
.nav-divider { height: 1px; background: var(--sb-border); margin: 8px 6px; }

/* Sidebar footer — user + contact info */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--sb-border);
  background: rgba(0,0,0,0.15);
}
.sidebar-user-name { font-size: 12px; font-weight: 600; color: #fff; }
.sidebar-company   { font-size: 11px; color: var(--sb-text2); margin-bottom: 8px; }
.sidebar-contact   { font-size: 10px; color: var(--sb-text2); margin-bottom: 8px; line-height: 1.7; }
.sidebar-contact a { color: var(--sb-accent); text-decoration: none; }
.sidebar-contact a:hover { text-decoration: underline; }
.sidebar-actions   { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* TOP BAR */
.topbar {
  height: 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 10px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title {
  font-family: 'Syne', sans-serif;
  font-size: 15px; font-weight: 700; color: var(--text);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Hamburger button — mobile only */
.hamburger {
  display: none;
  width: 36px; height: 36px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer;
  align-items: center; justify-content: center;
  font-size: 18px; color: var(--text2); flex-shrink: 0;
}
.hamburger:hover { background: var(--sb-bg); color: #fff; }

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* PAGE BODY */
.page-body { padding: 24px; flex: 1; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; font-family: 'DM Sans', sans-serif;
  transition: all 0.15s; line-height: 1;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 8px rgba(0,168,132,0.3);
}
.btn-primary:hover { background: #009175; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,168,132,0.35); }
.btn-secondary {
  background: var(--surface); color: var(--text2);
  border: 1px solid var(--border2);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn-blue { background: var(--accent2); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,0.3); }
.btn-blue:hover { background: #1d4ed8; }
.btn-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 11px 24px; font-size: 14px; }
.btn-block { width: 100%; justify-content: center; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 13px; font-weight: 700; color: var(--text);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.card-title .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
}

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ============================================================
   STEPPER
   ============================================================ */
.stepper {
  display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 24px;
  margin-bottom: 20px; box-shadow: var(--shadow-sm);
  gap: 0; overflow-x: auto;
}
.step {
  display: flex; align-items: center; gap: 10px;
  flex: 1; position: relative; min-width: 120px;
}
.step:not(:last-child)::after {
  content: '';
  position: absolute; right: 0; top: 50%;
  transform: translateY(-50%);
  left: 130px; height: 1px;
  background: var(--border);
}
.step.done:not(:last-child)::after { background: var(--accent); }
.step-num {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
  background: var(--surface2); color: var(--text3);
  border: 1.5px solid var(--border);
}
.step.active .step-num {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0,168,132,0.15);
}
.step.done .step-num {
  background: var(--accent-bg); color: var(--accent);
  border-color: var(--accent);
}
.step-label { font-size: 12px; font-weight: 600; color: var(--text3); }
.step.active .step-label { color: var(--text); }
.step.done .step-label { color: var(--accent); }
.step-sub { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* ============================================================
   STATS
   ============================================================ */
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 11px; color: var(--text3); font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-value { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 800; color: var(--text); }
.stat-value.green  { color: var(--green);   }
.stat-value.red    { color: var(--danger);  }
.stat-value.blue   { color: var(--accent2); }
.stat-value.teal   { color: var(--accent);  }
.stat-sub { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* ============================================================
   BANK SELECTOR
   ============================================================ */
.bank-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.bank-option {
  padding: 12px 8px; border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  cursor: pointer; text-align: center;
  transition: all 0.15s;
}
.bank-option:hover { border-color: var(--accent); background: var(--accent-bg); }
.bank-option.selected {
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: 0 0 0 3px rgba(0,168,132,0.1);
}
.bank-option .bicon { font-size: 22px; margin-bottom: 5px; }
.bank-option .bname { font-size: 11px; font-weight: 700; color: var(--text2); }
.bank-option.selected .bname { color: var(--accent); }

/* ============================================================
   UPLOAD ZONE
   ============================================================ */
.upload-zone {
  border: 2px dashed var(--border2);
  border-radius: 12px; padding: 36px 20px;
  text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--surface2);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.upload-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--accent-bg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px; font-size: 22px;
}
.upload-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.upload-sub { font-size: 12px; color: var(--text3); }
.upload-sub .link { color: var(--accent); font-weight: 600; cursor: pointer; }

.file-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
}
.file-chip .ficon {
  width: 32px; height: 32px; border-radius: 8px;
  background: #fef2f2; color: var(--danger);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  flex-shrink: 0;
}
.file-info .fname { font-size: 13px; font-weight: 600; color: var(--text); }
.file-info .fsize { font-size: 11px; color: var(--text3); }
.file-remove { margin-left: auto; color: var(--text3); cursor: pointer; font-size: 18px; line-height: 1; }
.file-remove:hover { color: var(--danger); }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  font-size: 12px; font-weight: 600; color: var(--text2);
  margin-bottom: 5px; display: block; letter-spacing: 0.2px;
}
.form-control {
  width: 100%; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: 8px;
  padding: 9px 12px; color: var(--text);
  font-family: 'DM Sans', sans-serif; font-size: 13px;
  outline: none; transition: border-color 0.15s;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,168,132,0.1); }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap {
  overflow-x: auto; border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--surface2); }
th {
  padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.8px;
  white-space: nowrap; border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 14px; font-size: 13px; color: var(--text2);
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }
.amount-debit  { color: var(--danger); font-weight: 700; font-family: 'Syne', sans-serif; }
.amount-credit { color: var(--green);  font-weight: 700; font-family: 'Syne', sans-serif; }

/* ============================================================
   CHIPS / BADGES
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.chip-pending { background: #fffbeb; color: var(--accent3); border: 1px solid #fde68a; }
.chip-mapped  { background: #f0fdf4; color: var(--green);   border: 1px solid #bbf7d0; }
.chip-posted  { background: #eff6ff; color: var(--accent2); border: 1px solid #bfdbfe; }

.ai-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: #fff7ed; color: var(--accent3);
  border: 1px solid #fed7aa;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 20px;
}

/* ============================================================
   LEDGER SELECT (inline in table)
   ============================================================ */
.ledger-select {
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 6px; padding: 5px 8px;
  color: var(--text); font-size: 12px; font-weight: 500;
  outline: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  min-width: 150px; transition: border-color 0.15s;
}
.ledger-select:focus { border-color: var(--accent); }

/* ============================================================
   AI PANEL
   ============================================================ */
.ai-panel {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, rgba(0,168,132,0.06), rgba(37,99,235,0.04));
  border: 1px solid rgba(0,168,132,0.2);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 16px;
}
.ai-orb {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff; font-weight: 700;
}
.ai-text strong { font-size: 13px; font-weight: 700; color: var(--text); display: block; margin-bottom: 2px; }
.ai-text span { font-size: 12px; color: var(--text2); }

/* ============================================================
   TALLY CONNECTION
   ============================================================ */
.tally-connect {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface2); border-radius: 10px;
  padding: 14px 16px; border: 1px solid var(--border); margin-bottom: 14px;
}
.tally-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(5,150,105,0.15);
  animation: pulse 2s infinite;
}
.tally-dot.offline { background: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,0.15); animation: none; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(5,150,105,0.15); }
  50%      { box-shadow: 0 0 0 6px rgba(5,150,105,0.06); }
}
.tally-info { flex: 1; }
.tally-info strong { font-size: 13px; font-weight: 600; color: var(--text); display: block; }
.tally-info span   { font-size: 11px; color: var(--text3); }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-wrap { background: var(--surface3); border-radius: 4px; height: 5px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width 0.6s ease; }

/* ============================================================
   CUSTOMER LIST
   ============================================================ */
.cust-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.cust-row:last-child { border-bottom: none; }
.cust-row:hover { background: var(--surface2); margin: 0 -8px; padding: 10px 8px; border-radius: 8px; }
.cust-avatar {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
}
.cust-name   { font-size: 13px; font-weight: 600; color: var(--text); }
.cust-ledger { font-size: 11px; color: var(--text3); margin-top: 1px; }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; gap: 2px; margin-bottom: 16px; background: var(--surface2); border-radius: 8px; padding: 3px; border: 1px solid var(--border); width: fit-content; }
.tab {
  padding: 6px 14px; border-radius: 6px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  color: var(--text3); transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ============================================================
   DIVIDER / MISC
   ============================================================ */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.space { height: 16px; }
input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

/* Port input */
.port-row { display: flex; gap: 8px; align-items: center; }
.port-input {
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 8px 14px;
  color: var(--text); font-family: 'Syne', sans-serif;
  font-size: 16px; font-weight: 700; width: 90px;
  outline: none; text-align: center;
}
.port-input:focus { border-color: var(--accent); }

/* Summary rows in tally panel */
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: var(--surface2);
  border-radius: 8px; margin-bottom: 8px;
  border: 1px solid var(--border);
}
.summary-row:last-child { margin-bottom: 0; }
.summary-row .s-label { font-size: 13px; color: var(--text2); }
.summary-row .s-value { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; }

/* ============================================================
   NOTIFICATION TOAST
   ============================================================ */
.toast {
  position: fixed; top: 68px; right: 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
  box-shadow: var(--shadow-lg); z-index: 999;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; min-width: 250px;
  animation: toastIn 0.25s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-title { font-weight: 700; color: var(--text); font-size: 13px; }
.toast-msg   { font-size: 12px; color: var(--text2); margin-top: 1px; }

/* ============================================================
   SECTION ANIMATION
   ============================================================ */
.page-section { display: none; }
.page-section.active { display: block; animation: fadeUp 0.3s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   MOBILE BOTTOM NAVIGATION BAR
   ============================================================ */
.mobile-bottom-nav {
  display: none; /* hidden on desktop */
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 58px;
  background: var(--sb-bg);
  border-top: 1px solid rgba(255,255,255,0.1);
  z-index: 150;
  align-items: stretch;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
}
.mbn-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; cursor: pointer;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  transition: all 0.15s;
  padding: 6px 4px;
  border: none; background: none;
  -webkit-tap-highlight-color: transparent;
}
.mbn-item:hover, .mbn-item.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
}
.mbn-item.active { color: #4ade80; }
.mbn-icon { font-size: 18px; line-height: 1; }
.mbn-label { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* ============================================================
   MOBILE CLIENT PICKER (inside sidebar)
   ============================================================ */
.mob-client-row {
  display: none;   /* hidden on desktop */
  align-items: center; gap: 8px;
  padding: 8px 10px 10px;
}
.mob-client-select {
  flex: 1; background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff; border-radius: 8px;
  padding: 7px 10px; font-size: 13px; font-weight: 600;
  outline: none;
}
.mob-client-select option { background: #1a2744; color: #fff; }

/* ============================================================
   RESPONSIVE — BULLETPROOF MOBILE
   ============================================================ */

/* ── TABLET ── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
}

/* ── MOBILE ── */
@media (max-width: 768px) {

  /* 1. Show hamburger */
  .hamburger { display: flex !important; }

  /* 2. Mobile client picker in sidebar */
  .mob-client-row { display: flex !important; }

  /* 3. Sidebar slides in from left — hidden by default */
  .sidebar {
    transform: translateX(-100%) !important;
    z-index: 1000 !important;
    transition: transform 0.28s ease !important;
  }
  .sidebar.open {
    transform: translateX(0) !important;
  }
  .sidebar-overlay.open {
    display: block !important;
  }

  /* 4. CRITICAL: main content fills full width */
  .main {
    margin-left: 0 !important;
    width: 100% !important;
    padding-bottom: 58px !important; /* space for bottom nav */
  }

  /* 5. Show mobile bottom nav */
  .mobile-bottom-nav { display: flex !important; }

  /* 5. Topbar compact */
  .topbar {
    padding: 0 12px !important;
    height: 52px !important;
    gap: 8px !important;
  }
  .topbar-title { font-size: 13px !important; }

  /* 6. Hide desktop-only topbar elements */
  .topbar-right .client-picker { display: none !important; }
  .topbar-right .btn-secondary { display: none !important; }

  /* 7. Page body */
  .page-body { padding: 12px !important; }

  /* 8. All grids → single column */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }

  /* 9. Bank grid → 2 columns */
  .bank-grid { grid-template-columns: repeat(2,1fr) !important; }

  /* 10. Stepper compact */
  .stepper { padding: 10px 12px; overflow-x: auto; }
  .step { min-width: 65px; }
  .step-label { font-size: 10px; }
  .step-sub { display: none; }
  .step:not(:last-child)::after { display: none; }
  .step-num { width: 26px; height: 26px; font-size: 11px; }

  /* 11. Cards */
  .card { padding: 14px; }

  /* 12. Table: horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 480px; }

  /* 13. Tabs: scroll */
  .tabs { overflow-x: auto; flex-wrap: nowrap; width: 100%; max-width: 100%; }
  .tab { white-space: nowrap; flex-shrink: 0; }

  /* 14. Toast: bottom of screen */
  .toast { top: auto; bottom: 14px; right: 10px; left: 10px; min-width: unset; }

  /* 15. Upload zone */
  .upload-zone { padding: 22px 14px; }

  /* 16. Modal */
  .modal-box { max-width: 94vw; padding: 18px; }
  .modal { width: 94%; }
}

/* ── VERY SMALL PHONES ── */
@media (max-width: 380px) {
  .stepper { display: none; }
  .page-body { padding: 10px !important; }
}

/* ════════ Phase D — client picker + modal ════════ */
.client-picker {
  display:flex; align-items:center; gap:8px;
  padding:6px 10px; background:var(--surface2);
  border:1px solid var(--border); border-radius:8px;
}
.client-picker-label {
  font-size:11px; font-weight:600; color:var(--text2);
  text-transform:uppercase; letter-spacing:0.4px;
}
.client-picker-select {
  border:none; background:transparent; font-size:13px; font-weight:600;
  color:var(--text); cursor:pointer; padding:2px 4px;
  min-width:140px; max-width:240px;
}
.client-picker-select:focus { outline:1px solid var(--accent); outline-offset:1px; border-radius:4px; }

.modal-backdrop {
  position:fixed; inset:0; background:rgba(0,0,0,0.45);
  display:none; align-items:center; justify-content:center; z-index:1000;
}
.modal {
  background:var(--surface); border-radius:12px; box-shadow:var(--shadow-lg, 0 10px 40px rgba(0,0,0,0.2));
  width:90%; max-width:480px; max-height:90vh; overflow:auto;
  display:flex; flex-direction:column;
}
.modal-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px; border-bottom:1px solid var(--border);
  font-weight:700; font-size:15px;
}
.modal-close { cursor:pointer; font-size:22px; line-height:1; color:var(--text2); padding:0 4px; }
.modal-close:hover { color:var(--danger); }
.modal-body  { padding:18px; }
.modal-footer {
  display:flex; gap:8px; justify-content:flex-end;
  padding:12px 18px; border-top:1px solid var(--border);
  background:var(--surface2); border-radius:0 0 12px 12px;
}

/* ════════ Phase 3C — mapping-source badges ════════ */
.map-badge {
  display:inline-flex; align-items:center; gap:3px;
  font-size:10px; font-weight:600; padding:2px 7px;
  border-radius:10px; line-height:1.4;
  border:1px solid transparent;
}
.map-badge-user    { background:#dbeafe; color:#1d4ed8; border-color:#bfdbfe; }
.map-badge-builtin { background:#f3f4f6; color:#4b5563; border-color:#e5e7eb; }
.map-badge-ai      { background:#fef3c7; color:#92400e; border-color:#fde68a; }

/* ════════ Phase F — Bulk Map modal ════════ */
.bulkmap-table {
  width:100%; border-collapse:collapse; font-size:13px;
}
.bulkmap-table thead th {
  position:sticky; top:0; z-index:1;
  background:var(--surface2); color:var(--text2);
  font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:0.4px;
  padding:10px 14px; border-bottom:1px solid var(--border);
}
.bulkmap-table tbody td {
  padding:10px 14px; border-bottom:1px solid var(--border);
  vertical-align:middle;
}
.bulkmap-table tbody tr:hover { background:var(--surface2); }
.bulkmap-select {
  padding:5px 8px; font-size:12px; min-width:160px;
  height:32px;
}
.bulkmap-filter { cursor:pointer; }

/* ============================================================
   SEARCHABLE SELECT — ss-wrap & portal
   ============================================================ */

/* ── Wrapper ── */
.ss-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
}

/* ── Display button (the "closed" face) ── */
.ss-display {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 38px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; color: var(--text);
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
  gap: 6px;
  box-sizing: border-box;
}
.ss-display:hover  { border-color: var(--border2); }
.ss-open .ss-display {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,168,132,0.12);
}

.ss-label {
  flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

.ss-arrow {
  font-size: 9px; color: var(--text3); flex-shrink: 0;
  transition: transform 0.15s;
  line-height: 1;
}
.ss-open .ss-arrow { transform: rotate(180deg); }

/* ── Portal dropdown (appended to body, position:fixed) ── */
.ss-portal { font-family: 'DM Sans', sans-serif; }

/* ── Options in portal ── */
.ss-opt {
  padding: 8px 12px;
  font-size: 13px; color: var(--text2);
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background 0.08s;
}
.ss-opt:hover, .ss-opt.ss-active { background: var(--surface2); color: var(--text); }
.ss-opt.ss-cur {
  background: var(--accent-bg); color: var(--accent);
  font-weight: 600;
}
.ss-no-opt {
  padding: 12px; text-align: center;
  font-size: 12px; color: var(--text3);
  font-style: italic;
}

/* ── Ledger-select variant (compact, for table cells) ── */
.ss-wrap.ss-ledger .ss-display {
  min-height: 30px; height: 30px;
  padding: 3px 8px; font-size: 12px;
  border-radius: 6px;
  background: var(--surface2);
  min-width: 150px;
}

/* ── Client picker variant (navbar — transparent, minimal) ── */
.ss-wrap.ss-client-picker {
  display: inline-flex; width: auto; min-width: 140px; max-width: 260px;
}
.ss-wrap.ss-client-picker .ss-display {
  border: none; background: transparent;
  padding: 2px 4px; min-height: auto;
  font-size: 13px; font-weight: 600;
  border-radius: 4px;
}
.ss-wrap.ss-client-picker .ss-open .ss-display {
  box-shadow: none; outline: 1px solid var(--accent);
  outline-offset: 1px;
}

