:root{
  --blue-1:#1d4ed8;
  --blue-2:#4f46e5;
  --blue-3:#3b82f6;
  --ink:#0f172a;
  --sub:#64748b;
  --line:#e6e9f0;
  --bg:#f4f6fb;
  --card:#ffffff;
  --green:#16a34a;
  --red:#dc2626;
  --purple:#7c3aed;
  --amber:#d97706;
  --shadow:0 10px 28px rgba(20,30,80,.08);
}
[data-theme="dark"]{
  --ink:#f1f4ff;
  --sub:#8b93bd;
  --line:#232c4d;
  --bg:#0b1020;
  --card:#141b34;
  --shadow:none;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  font-family:"Inter",-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color:var(--ink);
  background:var(--bg);
  -webkit-font-smoothing:antialiased;
  transition:background .25s ease,color .25s ease;
}

.btn-ghost{
  background:transparent;border:1px solid var(--line);color:var(--ink);
  padding:9px 16px;border-radius:11px;font-size:13.5px;font-weight:600;cursor:pointer;
}
.btn-excel{
  background:transparent;border:1px solid #bbf7d0;color:var(--green);
  padding:9px 16px;border-radius:11px;font-size:13.5px;font-weight:700;
  cursor:pointer;display:inline-flex;align-items:center;gap:6px;
}
.btn-excel:disabled{opacity:.4;cursor:not-allowed;}
.theme-toggle{
  display:flex;align-items:center;justify-content:center;
  width:38px;height:38px;flex-shrink:0;padding:0;
  background:var(--card);border:1px solid var(--line);border-radius:50%;
  color:var(--sub);cursor:pointer;
}
.theme-toggle:hover{background:var(--bg);color:var(--ink);}
.theme-icon{width:18px;height:18px;display:none;}
.theme-toggle .icon-sun{display:block;}
[data-theme="dark"] .theme-toggle .icon-sun{display:none;}
[data-theme="dark"] .theme-toggle .icon-moon{display:block;}

/* ---------- HERO ---------- */
.hero{padding:56px 24px 40px;}
.hero-inner{max-width:760px;margin:0 auto;}
.hero h1{font-size:40px;line-height:1.18;font-weight:800;margin:0 0 14px;}
.hero h1 .accent{color:var(--blue-2);}
.hero p{font-size:16px;color:var(--sub);line-height:1.65;margin:0 0 28px;}
.hero-stats{display:flex;gap:30px;margin-bottom:34px;flex-wrap:wrap;}
.hero-stat b{font-size:20px;display:block;}
.hero-stat span{font-size:12px;color:var(--sub);}

.upload-card{
  background:var(--card);border:1px solid var(--line);border-radius:22px;
  padding:26px;box-shadow:var(--shadow);
}
.field-row{margin-bottom:18px;}
.field-row label{display:block;font-size:12.5px;font-weight:700;color:var(--sub);margin-bottom:8px;}
/* ---- Bank picker: custom dropdown (native <select> is visually hidden) ---- */
.bank-select{position:relative;}
.bank-select-native{
  position:absolute;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0 0 0 0);border:0;
}
.bank-select-trigger{
  width:100%;display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:12px 14px;border-radius:11px;border:1px solid var(--line);
  background:var(--bg);color:var(--ink);font-size:14px;font-weight:600;
  font-family:inherit;text-align:left;cursor:pointer;transition:border-color .15s,box-shadow .15s;
}
.bank-select-trigger:hover{border-color:var(--blue-3);}
.bank-select.open .bank-select-trigger{
  border-color:var(--blue-2);box-shadow:0 0 0 3px rgba(79,90,246,.18);
}
.bank-select-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.bank-select-value.placeholder{color:var(--sub);font-weight:500;}
.bank-select-caret{color:var(--sub);font-size:11px;flex-shrink:0;transition:transform .18s;}
.bank-select.open .bank-select-caret{transform:rotate(180deg);}

/* The popup: a fixed search row on top of a scrolling list, so the search box
   stays put while the results scroll under it. */
.bank-select-panel{
  position:absolute;z-index:40;top:calc(100% + 6px);left:0;right:0;
  background:var(--card);border:1px solid var(--line);border-radius:12px;
  box-shadow:var(--shadow);overflow:hidden;
}
.bank-select-search-row{
  display:flex;align-items:center;gap:8px;
  padding:9px 12px;border-bottom:1px solid var(--line);background:var(--bg);
}
.bank-select-search-icon{
  width:15px;height:15px;flex-shrink:0;color:var(--sub);
  fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;
}
.bank-select-search{
  flex:1;min-width:0;border:0;background:transparent;outline:none;
  font-family:inherit;font-size:13.5px;font-weight:600;color:var(--ink);
}
.bank-select-search::placeholder{color:var(--sub);font-weight:500;}
.bank-select-clear{
  flex-shrink:0;border:0;background:transparent;cursor:pointer;
  color:var(--sub);font-size:17px;line-height:1;padding:0 2px;
}
.bank-select-clear:hover{color:var(--ink);}

.bank-select-menu{
  margin:0;padding:5px;list-style:none;
  max-height:264px;overflow-y:auto;
  scrollbar-width:none;-ms-overflow-style:none;
}
.bank-select-menu::-webkit-scrollbar{display:none;}
.bank-select-empty{
  margin:0;padding:18px 14px;text-align:center;
  font-size:13px;font-weight:500;color:var(--sub);
}
/* Matched part of a bank name, so a keyword search shows why a row matched. */
.bank-select-option mark{
  background:transparent;color:var(--blue-2);font-weight:800;
}
.bank-select-option{
  display:flex;align-items:center;
  padding:11px 12px;border-radius:8px;
  font-size:13.5px;font-weight:600;color:var(--ink);
  cursor:pointer;transition:background .12s;
  border-bottom:1px solid var(--line);
}
.bank-select-option:last-child{border-bottom:none;}
.bank-select-option:hover,
.bank-select-option.active{background:var(--bg);}
.bank-select-option.selected{
  color:var(--blue-2);font-weight:700;
  box-shadow:inset 3px 0 0 var(--blue-2);
}

.dropzone{
  border:2px dashed #b9c3f0;border-radius:18px;
  background:linear-gradient(180deg,var(--card),var(--bg));
  padding:46px 24px;text-align:center;cursor:pointer;transition:border-color .2s;
}
[data-theme="dark"] .dropzone{border-color:#2c3660;}
.dropzone.dragover{border-color:var(--blue-2);}
.dz-icon{
  width:60px;height:60px;border-radius:16px;margin:0 auto 16px;
  background:linear-gradient(135deg,#dbe4ff,#eef2ff);
  display:flex;align-items:center;justify-content:center;font-size:24px;color:var(--blue-2);
}
[data-theme="dark"] .dz-icon{background:#1c2547;}
.dz-title{font-size:18px;font-weight:800;margin-bottom:6px;}
.dz-sub{font-size:13px;color:var(--sub);margin-bottom:16px;}
.dz-formats{display:flex;justify-content:center;gap:8px;}
.fmt-chip{background:var(--card);border:1px solid var(--line);border-radius:8px;padding:5px 12px;font-size:11.5px;font-weight:700;color:var(--sub);}

.file-list{display:flex;flex-direction:column;gap:10px;}
.file-list:not(:empty){margin-top:16px;}

.multi-note{
  margin-top:10px;font-size:11.5px;line-height:1.5;color:var(--sub);
  padding:9px 12px;border:1px dashed var(--line);border-radius:10px;
}

.file-card{
  background:var(--bg);border:1px solid var(--line);border-radius:14px;
  padding:14px 18px;display:flex;align-items:center;justify-content:space-between;
}
.file-left{display:flex;align-items:center;gap:12px;}
.file-ico{width:34px;height:34px;border-radius:9px;background:#fee2e2;color:#dc2626;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:800;flex-shrink:0;}
.file-name{font-weight:700;font-size:13.5px;word-break:break-all;}
.file-meta{font-size:11px;color:var(--sub);}
.file-actions{display:flex;align-items:center;gap:12px;flex-shrink:0;}
.file-ready{color:var(--green);font-weight:700;font-size:12px;white-space:nowrap;}
.file-remove{background:none;border:none;color:var(--sub);font-size:14px;cursor:pointer;}

/* Shown in place of "Ready to analyze" only when the uploaded PDF is
   password-protected (see script.js). */
.pdf-password-wrap{position:relative;display:inline-flex;align-items:center;}
.pdf-password{
  width:190px;max-width:46vw;
  padding:9px 36px 9px 11px;
  border:1.5px solid var(--blue-3);border-radius:8px;
  background:var(--card);color:var(--ink);
  font-size:13px;font-weight:600;letter-spacing:.12em;
  outline:none;
}
.pdf-password::placeholder{color:var(--sub);font-weight:500;letter-spacing:normal;}
.pdf-password:focus{border-color:var(--blue-2);box-shadow:0 0 0 3px rgba(79,90,246,.18);}
.pdf-eye{
  position:absolute;right:5px;top:50%;transform:translateY(-50%);
  width:26px;height:26px;padding:0;border:none;border-radius:6px;
  background:none;color:var(--sub);cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  -webkit-user-select:none;user-select:none;touch-action:none;
}
.pdf-eye:hover{color:var(--blue-2);}
.pdf-eye.revealing{color:var(--blue-2);background:rgba(79,90,246,.14);}

.analyze-btn{
  margin-top:16px;width:100%;
  background:linear-gradient(135deg,var(--blue-3),var(--blue-2));
  color:#fff;border:none;padding:15px;border-radius:13px;
  font-size:14.5px;font-weight:800;cursor:pointer;
  box-shadow:0 14px 30px rgba(59,90,246,.3);
}
.analyze-btn:disabled{opacity:.5;cursor:not-allowed;}

.loading-state{margin-top:18px;text-align:center;color:var(--sub);font-size:13.5px;font-weight:600;}
.loading-row{display:flex;align-items:center;justify-content:center;gap:14px;margin-bottom:10px;}
.spinner{
  width:30px;height:30px;border-radius:50%;flex:none;
  border:3px solid var(--line);border-top-color:var(--blue-2);
  animation:spin .8s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg);}}

/* Icon-only circle, sized to sit beside the round spinner rather than as a
   mismatched text pill next to it. */
.stop-btn{
  width:32px;height:32px;padding:0;flex:none;
  display:flex;align-items:center;justify-content:center;
  background:transparent;color:var(--red);border:1.5px solid var(--red);
  border-radius:50%;cursor:pointer;
  transition:background .15s,color .15s;
}
.stop-btn:hover{background:var(--red);color:#fff;}

.error-state{
  margin-top:16px;background:#fef2f2;border:1px solid #fecaca;color:#b91c1c;
  padding:14px 16px;border-radius:12px;font-size:13px;font-weight:600;
}

.trust-row{display:flex;gap:22px;margin-top:26px;color:var(--sub);font-size:12px;flex-wrap:wrap;}
.trust-row div{display:flex;align-items:center;gap:6px;}

/* ---------- RESULTS ---------- */
.results{padding:10px 24px 60px;overflow-x:clip;}
.results-inner{max-width:1160px;margin:0 auto;}
.section-title{margin:20px 0 18px;}
.section-title h2{font-size:20px;margin:0;font-weight:800;}

.holder-card{
  background:linear-gradient(135deg,#0f1f5c,#1d3fae 60%,#3b62e0);
  border-radius:20px;padding:24px 26px;color:#fff;
  display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:14px;
  box-shadow:0 18px 40px rgba(30,55,150,.25);margin-bottom:20px;
}
.holder-left{display:flex;align-items:center;gap:16px;}
.holder-avatar{width:50px;height:50px;border-radius:13px;background:rgba(255,255,255,.14);display:flex;align-items:center;justify-content:center;font-size:20px;flex-shrink:0;}
.holder-name{font-size:18px;font-weight:800;}
.holder-badge{display:inline-block;background:rgba(255,255,255,.18);font-size:10px;font-weight:700;padding:3px 9px;border-radius:6px;margin-left:8px;vertical-align:middle;}
.holder-meta{font-size:12px;color:#cfd8ff;margin-top:5px;}
.holder-combined{font-size:11.5px;color:#eaf0ff;margin-top:6px;opacity:.9;}
.holder-right{text-align:right;font-size:11.5px;color:#d9e0ff;}
.holder-right b{display:block;font-size:13px;color:#fff;}

.kpi-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:14px;margin-bottom:20px;}
.kpi-card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:16px 18px;box-shadow:var(--shadow);}
.kpi-label{font-size:10px;color:var(--sub);font-weight:800;letter-spacing:.4px;text-transform:uppercase;}
.kpi-value{font-size:18px;font-weight:800;margin-top:8px;}
.kpi-value.green{color:var(--green);}
.kpi-value.red{color:var(--red);}
.kpi-value.blue{color:var(--blue-1);}
.kpi-value.purple{color:var(--purple);}

.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:20px;}
@media (max-width:820px){.grid-2{grid-template-columns:1fr;}}
/* grid/flex children default to min-width:auto, which lets a wide <table>
   push the track (and the whole centred layout) past the viewport edge.
   Letting them shrink to 0 keeps every panel aligned and hands the
   horizontal overflow to .table-scroll instead. */
.grid-2 > *{min-width:0;}

.panel{background:var(--card);border:1px solid var(--line);border-radius:18px;padding:20px 22px;box-shadow:var(--shadow);min-width:0;max-width:100%;}
.panel.full{margin-bottom:20px;}
.panel h3{font-size:15px;margin:0 0 14px;display:flex;align-items:center;gap:10px;font-weight:800;}
.panel h3 .ic{width:28px;height:28px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:13px;color:#fff;flex-shrink:0;}
.ic.blue{background:linear-gradient(135deg,#60a5fa,#3b82f6);}
.ic.orange{background:linear-gradient(135deg,#fb923c,#f59e0b);}
.ic.green{background:linear-gradient(135deg,#34d399,#10b981);}
.ic.purple{background:linear-gradient(135deg,#a78bfa,#7c3aed);}
.ic.pink{background:linear-gradient(135deg,#fb7185,#e11d48);}

.table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%;}
table{width:100%;border-collapse:collapse;font-size:12.5px;}
thead th{
  text-align:left;font-size:10px;letter-spacing:.4px;text-transform:uppercase;
  color:var(--sub);font-weight:800;padding:0 8px 10px;border-bottom:1px solid var(--line);white-space:nowrap;
}
thead th.tright{text-align:right;}
tbody td{padding:11px 8px;border-bottom:1px solid var(--line);font-weight:600;}
tbody tr:last-child td{border-bottom:none;}
.tright{text-align:right;}
.empty-row td{text-align:center;padding:20px 8px;color:var(--sub);font-weight:600;}
.emi-obs-line{padding:1px 0;}
.emi-obs-line + .emi-obs-line{margin-top:2px;}

.pill{font-size:9.5px;font-weight:800;padding:3px 9px;border-radius:999px;letter-spacing:.2px;white-space:nowrap;}
.pill.customer{background:#dcfce7;color:#15803d;}
.pill.supplier{background:#ffedd5;color:#c2410c;}
.pill.transfer{background:#e5e7eb;color:#374151;}
.pill.emilender,.pill.emilendr{background:#ede9fe;color:#6d28d9;}
.pill.selftransfer{background:#e0e7ff;color:#3730a3;}
.pill.salary{background:#ccfbf1;color:#0f766e;}
.pill.investment{background:#ede9fe;color:#6d28d9;}
.pill.insurance{background:#cffafe;color:#0e7490;}
.pill.taxgovt{background:#ffe4e6;color:#9f1239;}
.pill.utilitybill{background:#dbeafe;color:#1d4ed8;}
.pill.bankcharges{background:#fef3c7;color:#92400e;}
.pill.cash{background:#f1f5f9;color:#475569;}
.pill.other{background:#e5e7eb;color:#374151;}
.pill.active,.pill.possible{background:#dcfce7;color:#15803d;}
.pill.bounced{background:#fee2e2;color:#b91c1c;}

/* Top 10 Customers / Suppliers: let the name column absorb the slack so the
   numeric columns pack against the right edge and the table fills the panel */
.cp-table{table-layout:auto;}
.cp-table th:nth-child(1),.cp-table td:nth-child(1){width:1%;white-space:nowrap;color:var(--sub);}
.cp-table th:nth-child(2),.cp-table td:nth-child(2){width:100%;}
.cp-table th:nth-child(3),.cp-table td:nth-child(3),
.cp-table th:nth-child(4),.cp-table td:nth-child(4){width:1%;white-space:nowrap;padding-left:22px;}
.cp-table th:nth-child(5),.cp-table td:nth-child(5){width:1%;white-space:nowrap;padding-left:22px;text-align:right;}

.mini-stats{display:flex;gap:14px;margin-top:16px;flex-wrap:wrap;}
.mini-stats > div{flex:1;min-width:140px;background:var(--bg);border-radius:12px;padding:12px 16px;text-align:center;}

.salary-mini{display:flex;gap:8px;margin-top:16px;flex-wrap:wrap;}
.salary-mini div{background:var(--bg);border:1px solid var(--line);border-radius:10px;padding:8px 10px;font-size:10.5px;flex:1;min-width:80px;text-align:center;color:var(--sub);}
.salary-mini b{display:block;font-size:12.5px;color:var(--ink);}

.callout{
  background:#eef2ff;border:1px solid #c7d2fe;border-radius:18px;padding:22px 24px;margin-bottom:20px;
}
[data-theme="dark"] .callout{background:#161d3d;border-color:#2f3d75;}
.callout h3{color:#4338ca;font-size:15px;margin:0 0 12px;}
[data-theme="dark"] .callout h3{color:#a5b4fc;}
.callout ul{margin:0;padding-left:18px;font-size:12.5px;color:#3730a3;line-height:1.9;}
[data-theme="dark"] .callout ul{color:#c7d0f5;}

.footer-note{margin-top:10px;font-size:11px;color:var(--sub);text-align:center;}

/* ---------- MONTHWISE TABLE ---------- */
.mw-table{font-size:12px;border:1px solid var(--line);border-radius:10px;overflow:hidden;min-width:640px;}
.mw-table th{
  background:var(--bg);color:var(--ink);font-size:11px;text-align:right;
  padding:12px 10px;border-bottom:1px solid var(--line);white-space:nowrap;
}
.mw-table th.mw-field{text-align:left;}
.mw-table th.mw-total{background:#c7d2f7;}
[data-theme="dark"] .mw-table th.mw-total{background:#2a3568;}
.mw-table td{padding:10px 12px;text-align:right;border-bottom:1px solid var(--line);font-weight:600;white-space:nowrap;}
.mw-table td.mw-field{text-align:left;font-weight:700;}
.mw-table td.mw-total{font-weight:800;background:#dbe3fb;}
[data-theme="dark"] .mw-table td.mw-total{background:#1e2650;}
.mw-table tr.a td.mw-field{background:#fde8e0;}
.mw-table tr.b td.mw-field{background:#dbe9fb;}
[data-theme="dark"] .mw-table tr.a td.mw-field{background:#1b2348;}
[data-theme="dark"] .mw-table tr.b td.mw-field{background:#141b34;}
.mw-table tr:last-child td{border-bottom:none;}

@media (max-width:640px){
  .hero h1{font-size:30px;}
  .btn-ghost,.btn-excel{padding:8px 12px;font-size:12px;}
}

/* Header must stay a single row on phones, not stack into two rows
   that eat the top of the screen before any content shows. Icon-only
   buttons + no-wrap keeps everything on one line down to ~340px. */
.btn-ic{display:inline-block;}
.btn-label{display:inline;}
@media (max-width:480px){
  .btn-excel .btn-label,
  .btn-ghost .btn-label{display:none;}
  .btn-excel,.btn-ghost{padding:8px 10px;}
}

/* ---------- MODAL POPUP ---------- */
.modal-overlay{
  position:fixed;inset:0;background:rgba(10,15,35,.55);
  display:flex;align-items:center;justify-content:center;
  z-index:200;padding:20px;
}
.modal-box{
  background:var(--card);border-radius:20px;padding:30px 26px;
  max-width:380px;width:100%;text-align:center;
  box-shadow:0 30px 60px rgba(0,0,0,.3);
}
.modal-icon{font-size:34px;margin-bottom:10px;}
.modal-title{font-size:17px;font-weight:800;margin-bottom:8px;}
.modal-text{font-size:13.5px;color:var(--sub);line-height:1.6;margin-bottom:22px;}
.modal-btn{
  background:linear-gradient(135deg,var(--blue-3),var(--blue-2));
  color:#fff;border:none;padding:12px 28px;border-radius:11px;
  font-size:13.5px;font-weight:700;cursor:pointer;
}

/* ---------- Responsive: mobile & tablet ---------- */
@media (max-width:1024px){
  .results-inner,.hero-inner{padding-left:20px;padding-right:20px;}
  .kpi-grid{grid-template-columns:repeat(auto-fit,minmax(150px,1fr));}
}

@media (max-width:820px){
  .grid-2{grid-template-columns:1fr;}
  .holder-card{flex-direction:column;align-items:flex-start;}
  .holder-right{text-align:left;}
}

@media (max-width:640px){
  .hero{padding:32px 16px 28px;}
  .hero h1{font-size:26px;line-height:1.25;}
  .hero p{font-size:14px;}
  .hero-stats{gap:22px;margin-bottom:24px;}
  .upload-card{padding:18px;border-radius:18px;}
  .dropzone{padding:32px 16px;}
  .dz-title{font-size:16px;}
  .results{padding:6px 16px 40px;}
  .kpi-grid{grid-template-columns:repeat(2,1fr);gap:10px;}
  .kpi-card{padding:12px 14px;}
  .kpi-value{font-size:16px;}
  .panel{padding:16px;}
  .holder-card{padding:18px;}
  .holder-name{font-size:16px;}
  .file-card{flex-wrap:wrap;gap:10px;}
  .file-actions{width:100%;justify-content:space-between;}
  .btn-ghost,.btn-excel{padding:8px 12px;font-size:12px;}
  .theme-toggle{width:34px;height:34px;}
  .theme-icon{width:16px;height:16px;}
}

@media (max-width:400px){
  .kpi-grid{grid-template-columns:1fr 1fr;}
  .hero h1{font-size:22px;}
}

/* ================================================================
   VISUAL POLISH — layered on top of the rules above.
   Presentation only: no HTML structure or JS behaviour changes.
   ================================================================ */
:root{
  --brand-grad:linear-gradient(135deg,#4f46e5,#3b82f6);
  --th-bg:#eef2ff;
  --th-ink:#3730a3;
  --row-alt:#f7f9ff;
  --row-hover:#eaf1ff;
  --frame:#e6e9f0;
}
[data-theme="dark"]{
  --th-bg:#1f2650;
  --th-ink:#c7d0f5;
  --row-alt:#141b34;
  --row-hover:#1b2450;
  --frame:#232c4d;
}

/* Soft tinted backdrop instead of a flat fill */
body{
  background:
    radial-gradient(1000px 520px at 100% -8%,rgba(79,70,229,.10),transparent 60%),
    radial-gradient(760px 520px at -8% 6%,rgba(14,165,164,.09),transparent 55%),
    var(--bg);
  background-attachment:fixed;
}

/* Smooth, consistent interaction feedback */
.btn-ghost,.btn-excel,.analyze-btn,.modal-btn,
.kpi-card,.panel,.upload-card,.dropzone,.theme-toggle,.fmt-chip,
.file-remove,.hero-stat{
  transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease,background .2s ease;
}
.modal-btn:hover{transform:translateY(-1px);box-shadow:0 16px 32px rgba(59,90,246,.45);}
.analyze-btn:hover:not(:disabled){transform:translateY(-2px);box-shadow:0 20px 40px rgba(59,90,246,.4);}
.btn-ghost:hover,.btn-excel:not(:disabled):hover{transform:translateY(-1px);border-color:var(--blue-3);}
.theme-toggle:hover{transform:translateY(-1px);}

/* Hero: gradient headline + gradient stat numbers */
.hero h1 .accent{
  background:linear-gradient(120deg,#4f46e5,#0ea5a4);
  -webkit-background-clip:text;background-clip:text;color:transparent;
}
.hero-stat b{
  background:var(--brand-grad);
  -webkit-background-clip:text;background-clip:text;color:transparent;
}

/* Upload card: brand accent strip + livelier dropzone */
.upload-card{position:relative;overflow:hidden;}
.upload-card::before{
  content:"";position:absolute;top:0;left:0;right:0;height:4px;background:var(--brand-grad);
}
.dropzone:hover{
  border-color:var(--blue-2);
  background:linear-gradient(180deg,var(--card),#eef2ff);
}
[data-theme="dark"] .dropzone:hover{background:linear-gradient(180deg,var(--card),#161d3d);}
.dz-icon{box-shadow:0 10px 22px rgba(79,70,229,.22);}

/* Results: gentle reveal on render */
.results-inner > *{animation:rise .5s ease both;}
@keyframes rise{from{opacity:0;transform:translateY(12px);}to{opacity:1;transform:none;}}

/* Section title: accent bar */
.section-title h2{display:flex;align-items:center;gap:10px;}
.section-title h2::before{
  content:"";width:5px;height:20px;border-radius:3px;background:var(--brand-grad);
}

/* KPI cards: accent strip + hover lift */
.kpi-card{position:relative;overflow:hidden;}
.kpi-card::before{
  content:"";position:absolute;top:0;left:0;right:0;height:3px;background:var(--brand-grad);
}
.kpi-card:hover{transform:translateY(-3px);box-shadow:0 18px 32px rgba(20,30,80,.14);}

/* Panels: hover lift */
.panel:hover{transform:translateY(-2px);box-shadow:0 18px 36px rgba(20,30,80,.12);}

/* Framed, rounded scrollable tables */
.table-scroll{
  border:1px solid var(--frame);border-radius:12px;background:var(--card);
}
.table-scroll .mw-table{border:0;}

/* Coloured headers + banded, hover-highlighted value rows */
table:not(.mw-table) thead th{
  background:var(--th-bg);color:var(--th-ink);
  padding:12px 10px;border-bottom:1px solid var(--frame);
}
table:not(.mw-table) tbody tr:nth-child(even) td{background:var(--row-alt);}
table:not(.mw-table) tbody tr:hover td{background:var(--row-hover);}
table:not(.mw-table) .empty-row td,
table:not(.mw-table) .empty-row:hover td{background:transparent;}

/* Key / value panels (Account Snapshot, Cash Flow, Salary) */
.panel > table tbody td:first-child{color:var(--sub);font-weight:600;}
.panel > table tbody td:last-child{font-weight:700;color:var(--ink);}
.panel > table tbody tr:hover td{background:var(--row-hover);}

/* Charges "TOTAL" row */
.total-row td{
  background:var(--th-bg);color:var(--th-ink);
  font-weight:800;border-top:2px solid var(--frame);
}

/* Pills: subtle depth */
.pill{box-shadow:0 1px 2px rgba(15,23,42,.08);}

/* Monthwise table: match the framed look */
.mw-table{border-color:var(--frame);}

/* Callout: gradient edge */
.callout{position:relative;overflow:hidden;}
.callout::before{
  content:"";position:absolute;top:0;left:0;bottom:0;width:4px;background:var(--brand-grad);
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion:reduce){
  .results-inner > *{animation:none;}
  *{transition:none !important;}
}

/* ================================================================
   ADMIN DASHBOARD SECTION — the sidebar app-shell (logo/theme/collapse,
   Records / Hidden Data / Deleted) plus the record-table + modal styling
   used inside it. Comes after the shared rules above, so it only carries
   what differs from the shared Loan Zoan brand components (.upload-card,
   .field-row, .analyze-btn, .error-state, .footer-note are all reused
   as-is by the New Analysis view).
   ================================================================ */

/* ----------------------------------------------------------------
   TYPE SCALE — the only font sizes used anywhere in the admin console.
   Every rule below references one of these; nothing hardcodes a size.

     --t-eyebrow 11  uppercase micro labels (pills, stacked-card labels)
     --t-xs      12  table headers, field labels, meta / captions / notes
     --t-sm      13  body: table cells, inputs, buttons          <- workhorse
     --t-base    14  nav items, emphasised body
     --t-lg      16  section + modal titles
     --t-xl      20  KPI values
     --t-2xl     24  page title

   Weights: 500 body · 600 medium · 700 semibold · 800 headings
   ---------------------------------------------------------------- */
:root{
  --t-eyebrow:11px;
  --t-xs:12px;
  --t-sm:13px;
  --t-base:14px;
  --t-lg:16px;
  --t-xl:20px;
  --t-2xl:24px;
  --admin-ctl-h:38px;   /* one height for every filter-bar control */
  --topbar-h:60px;      /* shared height for the sidebar header and the
                            content navbar, so their borders line up as one
                            continuous bar across the top of the page */
}

.admin-title{
  font-size:var(--t-2xl);
  font-weight:800;
  margin:0 0 6px;
  letter-spacing:-.02em;
  line-height:1.2;
}
.admin-sub{
  font-size:var(--t-sm);
  color:var(--sub);
  line-height:1.55;
  font-weight:500;
  margin:0;
}

/* Text inputs, styled to match .bank-select-trigger from style.css. */
.admin-input{
  width:100%;
  padding:12px 14px;
  border-radius:11px;
  border:1px solid var(--line);
  background:var(--bg);
  color:var(--ink);
  font-family:inherit;
  font-size:var(--t-sm);
  font-weight:600;
  outline:none;
  transition:border-color .15s,box-shadow .15s;
}
.admin-input::placeholder{color:var(--sub);font-weight:500;}
.admin-input:hover{border-color:var(--blue-3);}
.admin-input:focus{
  border-color:var(--blue-2);
  box-shadow:0 0 0 3px rgba(79,90,246,.18);
}

/* .error-state already carries the light-red styling (used by the Edit
   record modal); keep the dark-mode contrast reasonable and let [hidden]
   hide it. */
.admin-error{margin-top:0;margin-bottom:16px;}
[data-theme="dark"] .admin-error{
  background:#2a1416;
  border-color:#7f1d1d;
  color:#fca5a5;
}

/* ================================================================
   DASHBOARD SHELL (index.html) — wide layout. Reuses .panel,
   .table-scroll + base table styles, .pill, .modal-*, .field-row,
   .admin-input, .btn-ghost from style.css.
   ================================================================ */

/* App-shell: a full-height sidebar on the left, section content on the
   right. The outer page never scrolls - each view manages its own vertical
   scroll: Records/Hidden/Deleted scroll only inside .table-scroll (so the
   filter bar stays put), while New Analysis - a long, single-flow page -
   scrolls as a whole via #analyzeView itself.
   Below 900px the shell unwinds: the sidebar becomes a horizontal strip and
   the page scrolls normally (see the responsive block). */
.admin-shell{display:flex;align-items:stretch;}

/* These scroll internally (New Analysis, the record table, the sidebar nav)
   but the browser's scrollbar track/thumb is hidden - the content still
   scrolls fine via wheel/trackpad/touch/keyboard, it just doesn't show a
   visible bar. */
#analyzeView,
.dash-table-panel .table-scroll,
.sb-nav{
  scrollbar-width:none;      /* Firefox */
  -ms-overflow-style:none;   /* old Edge/IE */
}
#analyzeView::-webkit-scrollbar,
.dash-table-panel .table-scroll::-webkit-scrollbar,
.sb-nav::-webkit-scrollbar{
  display:none;              /* Chrome/Safari/Edge */
}

@media (min-width:900px){
  html,body{height:100%;overflow:hidden;}
  .admin-shell{height:100%;}
  .dash-sidebar{flex:0 0 248px;height:100%;}
  #adminShell.sidebar-collapsed .dash-sidebar{flex-basis:68px;}
  .admin-dash{
    flex:1 1 auto;min-width:0;min-height:0;
    display:flex;overflow:hidden;padding:0;
  }
  .admin-dash-inner{display:flex;flex-direction:column;min-height:0;flex:1 1 auto;}
  .content-navbar{flex:0 0 auto;}
  #analyzeView{flex:1 1 auto;min-height:0;overflow-y:auto;}
  #recordsView{
    flex:1 1 auto;min-height:0;display:flex;flex-direction:column;
    padding:26px 30px 24px;
  }
  /* #recordsView's own `display:flex` above (an ID selector) outranks the
     browser's default `[hidden]{display:none}` (an attribute selector) -
     without this, switching away from Records leaves it visibly stacked
     underneath New Analysis instead of actually hidden. */
  #recordsView[hidden]{display:none;}
  .dash-topbar,.dash-stats,.dash-controls{flex:0 0 auto;}
  .dash-table-panel{
    flex:1 1 0;min-height:0;display:flex;flex-direction:column;
  }
  .dash-table-panel .table-scroll{flex:1 1 0;min-height:120px;overflow-y:auto;}
}

/* Mobile-only fallback padding — on desktop (900px+) .admin-dash is
   padding:0 (set above) so .content-navbar can sit flush against the top
   and right edges, flush against the sidebar on the left. */
@media (max-width:899px){
  .admin-dash{padding:26px 28px 20px;}
}
.admin-dash-inner{width:100%;min-width:0;}

/* ---- Persistent top bar: just Download Excel + the theme toggle,
   right-aligned. Sits above every section (New Analysis / Records / Hidden
   Data / Deleted alike) since it's a sibling of #analyzeView/#recordsView,
   not part of either. Same height, background and border as .sb-top, so the
   two read as one continuous bar across the top of the page. ---- */
.content-navbar{
  display:flex;align-items:center;justify-content:flex-end;
  height:var(--topbar-h);padding:0 30px;box-sizing:border-box;
  background:var(--card);
  border-bottom:1px solid var(--line);
  box-shadow:0 2px 8px rgba(20,30,80,.04);
}
.content-navbar-right{display:flex;align-items:center;gap:10px;}
@media (max-width:600px){
  .content-navbar{padding:0 16px;}
}

/* ---- Content header: title/description on the left, the summary strip on
   the right of the same row — the theme toggle lives in the persistent top
   bar, and there's no login so no identity chip. ---- */
.dash-topbar{
  display:flex;align-items:flex-start;justify-content:space-between;
  gap:16px 32px;flex-wrap:wrap;margin-bottom:18px;
}
.dash-head-text{min-width:0;flex:1 1 260px;}
.dash-topbar .admin-title{text-align:left;}
.dash-topbar .admin-sub{text-align:left;}

/* ---- Summary strip: four flat figures, no card chrome ---- */
.dash-stats{
  display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:flex-end;
  gap:10px 44px;margin:0;flex:0 1 auto;
}
.stat{min-width:0;max-width:200px;text-align:center;}
.stat-label{
  font-size:var(--t-sm);font-weight:600;color:var(--sub);line-height:1.3;
}
.stat-value{
  font-size:var(--t-xl);font-weight:800;color:var(--ink);
  margin-top:4px;line-height:1.2;letter-spacing:-.01em;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.stat-value.amber{color:var(--amber);}
.stat-value.blue{color:var(--blue-3);}
/* A bank name is text, not a figure — step it down so it never wraps. */
.stat-value-text{font-size:var(--t-lg);letter-spacing:0;}

/* ---- Filter bar: one control height, one text size ---- */
/* Bottom-aligned so the labelled date fields sit on the same baseline as the
   unlabelled search / select / Clear controls. */
.dash-controls{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end;margin-bottom:14px;}
.dash-field{display:flex;flex-direction:column;gap:5px;min-width:0;}
.dash-field[hidden]{display:none;}
.dash-field-grow{flex:1 1 220px;}
.dash-field-label{
  font-size:var(--t-xs);font-weight:600;color:var(--sub);line-height:1;
  padding-left:2px;
}
.dash-controls .admin-input{
  height:var(--admin-ctl-h);padding:0 12px;border-radius:10px;
  font-size:var(--t-sm);font-weight:500;
}
.dash-search{width:100%;}
.admin-select{width:auto;min-width:180px;}
.dash-clear{
  height:var(--admin-ctl-h);padding:0 16px;border-radius:10px;
  font-size:var(--t-sm);font-weight:600;
}
.dash-clear:hover{transform:none;}

/* ---- Full-height sidebar: brand header + section nav (New Analysis,
   Records, Hidden Data, Deleted — all four are equal tabs). ---- */
.dash-sidebar{
  flex:0 0 248px;display:flex;flex-direction:column;
  background:var(--card);border-right:1px solid var(--line);
  box-shadow:2px 0 8px rgba(20,30,80,.04);
  transition:flex-basis .18s ease;
}
.sb-top{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  height:var(--topbar-h);padding:0 16px;flex:0 0 auto;
  border-bottom:1px solid var(--line);
  box-sizing:border-box;
}
.sb-brand{display:flex;align-items:center;gap:10px;min-width:0;overflow:hidden;}
.sb-logo{width:32px;height:32px;object-fit:contain;flex-shrink:0;display:block;}
.sb-brand-text{min-width:0;overflow:hidden;white-space:nowrap;}
.sb-brand-name{font-size:14.5px;font-weight:700;color:var(--ink);}
.sb-brand-sub{font-size:11px;color:var(--sub);margin-top:1px;}

.sb-top-actions{display:flex;align-items:center;gap:4px;flex:0 0 auto;}
.sb-collapse{
  flex:0 0 auto;width:30px;height:30px;padding:0;
  display:flex;align-items:center;justify-content:center;
  border:none;border-radius:8px;background:none;color:var(--sub);cursor:pointer;
  transition:background .15s,color .15s;
}
.sb-collapse:hover{background:var(--bg);color:var(--ink);}

/* Plain table-style rows — no pill/block background anywhere, just a thin
   divider line between rows and a colour change for hover/active. */
.sb-nav{flex:1 1 auto;overflow-y:auto;padding:0;display:flex;flex-direction:column;}
.sb-tablist{display:flex;flex-direction:column;}

.dash-navitem{
  border:none;border-bottom:1px solid var(--line);background:none;
  cursor:pointer;font-family:inherit;
  text-align:left;padding:14px 20px;border-radius:0;width:100%;
  display:flex;align-items:center;gap:12px;
  font-size:var(--t-base);font-weight:600;color:var(--sub);flex:0 0 auto;
  text-decoration:none;white-space:nowrap;overflow:hidden;
  transition:color .15s;
}
.dash-navitem .nav-ico{
  flex:0 0 auto;width:19px;height:19px;
  display:flex;align-items:center;justify-content:center;opacity:.85;
}
.dash-navitem .nav-label{overflow:hidden;text-overflow:ellipsis;}
.dash-navitem:hover{color:var(--ink);background:var(--bg);}
.dash-navitem.active{background:var(--bg);color:var(--blue-2);font-weight:700;}
.dash-navitem.active .nav-ico{opacity:1;}

/* ---- Sign out: pinned to the bottom of the sidebar, red, own divider ---- */
.sb-bottom{flex:0 0 auto;border-top:1px solid var(--line);}
.sb-signout{
  border:none;background:none;cursor:pointer;font-family:inherit;
  text-align:left;width:100%;padding:14px 20px;
  display:flex;align-items:center;gap:12px;
  font-size:var(--t-base);font-weight:600;color:var(--red);
  white-space:nowrap;overflow:hidden;transition:background .15s;
}
.sb-signout .nav-ico{flex:0 0 auto;width:19px;height:19px;display:flex;align-items:center;justify-content:center;}
.sb-signout:hover{background:var(--bg);}
.sb-signout:disabled{opacity:.45;cursor:not-allowed;pointer-events:none;}

/* ---- Collapsed state: icons only, centred, labels hidden ---- */
#adminShell.sidebar-collapsed .sb-brand-text,
#adminShell.sidebar-collapsed .nav-label{display:none;}
/* Fixed to --topbar-h (not auto) so its border-bottom lines up exactly with
   .content-navbar's, the same way it does when expanded. */
#adminShell.sidebar-collapsed .sb-top{
  height:var(--topbar-h);flex-direction:column;justify-content:center;
  gap:0;padding:0 10px;
}
#adminShell.sidebar-collapsed .dash-navitem{justify-content:center;padding:10px;}
#adminShell.sidebar-collapsed .sb-signout{justify-content:center;padding:12px 10px;}
/* No room for the collapse button next to the icon-only nav - from here the
   sidebar re-expands via the logo or any nav icon instead (see dashboard.js).
   .sb-top-actions holds nothing else, so it collapses away with it. */
#adminShell.sidebar-collapsed .sb-top-actions{display:none;}
#adminShell.sidebar-collapsed .sb-brand{cursor:pointer;}

/* ---- Table panel ----
   .panel's own card chrome is dropped: the bordered scroll region is the
   card, so the tinted header band meets the rounded corner with no white
   gutter around it. */
.dash-table-panel{
  padding:0;border:none;background:transparent;box-shadow:none;
  border-radius:0;margin-bottom:0;
}
.panel.full.dash-table-panel{margin-bottom:0;}
/* Data panels must not float about on hover the way the analyzer's do. */
.dash-table-panel:hover{transform:none;box-shadow:none;}

/* The table scrolls inside .table-scroll rather than crushing columns. */
.dash-table{min-width:700px;font-size:var(--t-sm);}
.dash-table-panel .table-scroll{
  border:1px solid var(--line);border-radius:12px;background:var(--card);
}

/* ---- Table cells: one rhythm, one size, clear hierarchy ---- */
.dash-table th,.dash-table td{padding:14px 16px;vertical-align:middle;}
.dash-table thead th{
  position:sticky;top:0;z-index:2;
  background:var(--th-bg);color:var(--th-ink);
  font-size:var(--t-xs);font-weight:700;letter-spacing:.06em;
  text-transform:uppercase;white-space:nowrap;
  border-bottom:1px solid var(--line);
}
.dash-table tbody td{
  padding:16px;font-size:var(--t-sm);font-weight:500;color:var(--ink);
}
/* Ordinals and clock times are reference marks, not the row's content — they
   sit back so name / bank / date carry the scan. */
.dash-table tbody td.col-num{color:var(--sub);}
/* Name is the row's identity — one step of emphasis, nothing else. */
.dash-table tbody td.col-name{font-weight:600;}
.dash-table tbody tr{transition:background .12s;}
/* Flat rows + hover reads cleaner than the analyzer's zebra banding. The extra
   .dash-table-panel qualifier is needed to outweigh style.css's
   `table:not(.mw-table) tbody tr:nth-child(even) td`. */
.dash-table-panel .dash-table tbody tr:nth-child(even) td{background:transparent;}
.dash-table-panel .dash-table tbody tr:hover td{background:var(--row-hover);}
.dash-table tbody tr:not(:last-child) td{border-bottom:1px solid var(--line);}

/* A row whose account has repeat exports — a translucent amber wash (same
   family as .pill.dup below) plus a pointer cursor, since clicking it opens
   the duplicate-history dialog. Uses rgba over --amber rather than a flat
   hex so it reads as a clean tint in both themes instead of a muddy solid. */
.dash-table-panel .dash-table tbody tr.row-duplicate td{background:rgba(217,119,6,.08);}
.dash-table-panel .dash-table tbody tr.row-duplicate:hover td{background:rgba(217,119,6,.14);}
.dash-table tbody tr.row-duplicate{cursor:pointer;}
[data-theme="dark"] .dash-table-panel .dash-table tbody tr.row-duplicate td{background:rgba(99,102,241,.14);}
[data-theme="dark"] .dash-table-panel .dash-table tbody tr.row-duplicate:hover td{background:rgba(99,102,241,.22);}
.dash-table .empty-row td{
  padding:40px 14px;text-align:center;color:var(--sub);
  font-size:var(--t-sm);font-weight:500;
}

.dash-table .col-num{width:1%;white-space:nowrap;text-align:left;font-variant-numeric:tabular-nums;}
.dash-table .col-date{width:1%;white-space:nowrap;font-variant-numeric:tabular-nums;}
.dash-table .col-name{max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.dash-table .col-bank{max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--sub);}
/* Fixed width sized for a fully-revealed account number (not "width:1%" like
   the other narrow columns) - reveal must not grow the column, or the table
   widens and an unexpected horizontal scrollbar appears mid-interaction. */
.dash-table .col-acct{width:19ch;white-space:nowrap;}
.dash-table .col-file{max-width:190px;}
.dash-table .col-actions{width:1%;white-space:nowrap;padding-right:10px;}

.acct{display:inline-flex;align-items:center;gap:4px;}
.acct-text{font-variant-numeric:tabular-nums;letter-spacing:.02em;}

.dash-file{
  display:inline-block;max-width:100%;vertical-align:middle;
  color:var(--blue-1);font-weight:600;text-decoration:none;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.dash-file:hover{text-decoration:underline;}
.dash-muted{color:var(--sub);}

/* Duplicate badge — green/amber counterparts of the shared .pill. */
.dash-table .pill{
  font-size:var(--t-eyebrow);font-weight:700;letter-spacing:.01em;
  padding:4px 10px;box-shadow:none;
}
.pill.unique{background:#dcfce7;color:#15803d;}
.pill.dup{background:#fef3c7;color:#92400e;}
[data-theme="dark"] .pill.unique{background:#0f2417;color:#86efac;}
[data-theme="dark"] .pill.dup{background:#2a2109;color:#fcd34d;}

/* Row action icons + the account eye toggle. */
.row-actions{display:flex;align-items:center;gap:2px;}
.icon-btn{
  width:26px;height:26px;padding:0;flex-shrink:0;
  display:inline-flex;align-items:center;justify-content:center;
  border:none;border-radius:7px;
  background:none;color:var(--ink);cursor:pointer;
  transition:color .15s,background .15s,opacity .12s;
}
.icon-btn:hover{color:var(--blue-3);background:var(--row-hover);}
/* Destructive actions read red at rest, not only on hover. */
.icon-btn.danger{color:var(--red);}
.icon-btn.danger:hover{color:var(--red);background:#fef2f2;}
[data-theme="dark"] .icon-btn.danger:hover{background:#2a1416;}
.icon-btn:disabled{opacity:.5;cursor:not-allowed;}

/* The account reveal toggle is a per-row affordance — it stays out of the
   way until the row is hovered, focused, or already revealed. */
.acct .icon-btn{width:22px;height:22px;border-radius:6px;color:var(--sub);opacity:0;}
.dash-table tbody tr:hover .acct .icon-btn,
.acct .icon-btn:focus-visible,
.acct.revealed .icon-btn{opacity:1;}
@media (hover:none){.acct .icon-btn{opacity:1;}}

/* Toast — dark chip, centred at the bottom. */
.dash-toast{
  position:fixed;left:50%;bottom:26px;transform:translateX(-50%);
  background:var(--ink);color:var(--bg);
  padding:11px 18px;border-radius:10px;
  font-size:var(--t-sm);font-weight:600;max-width:90vw;
  box-shadow:0 12px 30px rgba(0,0,0,.25);z-index:300;
}

/* Modals — reuse .modal-overlay/.modal-box; [hidden] must beat the
   .modal-overlay{display:flex} rule from style.css. */
.modal-overlay[hidden]{display:none;}
.admin-modal{max-width:440px;width:100%;text-align:left;max-height:90vh;overflow-y:auto;}
.admin-modal .modal-title{font-size:var(--t-lg);font-weight:800;margin-bottom:10px;letter-spacing:-.01em;}
.admin-modal .modal-text{font-size:var(--t-sm);font-weight:500;margin-bottom:20px;}
.admin-modal .modal-icon{text-align:center;}
.admin-modal .field-row label{font-size:var(--t-xs);font-weight:600;}
.admin-modal .admin-input{height:var(--admin-ctl-h);padding:0 12px;border-radius:10px;font-size:var(--t-sm);}
.admin-modal-form .field-row:last-of-type{margin-bottom:20px;}

/* Duplicate-history dialog — one row per export, newest first. */
.admin-modal-dup{max-width:480px;}
.dup-list{list-style:none;margin:0 0 20px;padding:0;display:flex;flex-direction:column;gap:8px;}
.dup-item{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:11px 13px;border-radius:10px;border:1px solid var(--line);background:var(--bg);
}
.dup-item.current{border-color:#fbbf24;background:#fffbeb;}
[data-theme="dark"] .dup-item.current{border-color:#78530f;background:#1f1a08;}
.dup-item-when{display:flex;flex-direction:column;gap:2px;min-width:0;}
.dup-item-date{font-size:var(--t-sm);font-weight:700;color:var(--ink);}
.dup-item-file{
  font-size:var(--t-xs);font-weight:500;color:var(--sub);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.dup-item .pill{flex:0 0 auto;font-size:10.5px;padding:4px 10px;}
.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:4px;}
.modal-actions .btn-ghost,
.modal-actions .modal-btn{
  height:var(--admin-ctl-h);padding:0 18px;border-radius:10px;
  font-size:var(--t-sm);font-weight:700;
  display:inline-flex;align-items:center;justify-content:center;
}
.modal-actions button:hover{transform:none;}
.modal-btn.danger{background:linear-gradient(135deg,#f87171,#dc2626);}
/* Lock background scroll while a modal is open (toggled from JS). */
body.admin-modal-open{overflow:hidden;}

/* Visible keyboard-focus ring for the dashboard shell's interactive bits
   (mouse focus stays quiet via :focus-visible). */
.dash-navitem:focus-visible,
.sb-collapse:focus-visible,
.theme-toggle:focus-visible,
.icon-btn:focus-visible,
.dash-clear:focus-visible,
.dash-file:focus-visible,
.modal-actions button:focus-visible{
  outline:2px solid var(--blue-2);
  outline-offset:2px;
  border-radius:7px;
}

/* Below the app-shell breakpoint (900px): sidebar becomes a horizontal
   scrollable strip and the page scrolls normally again. The brand text and
   collapse toggle only make sense in the full-height layout, so they're
   dropped here — the theme toggle stays, right-aligned on its own slim row. */
@media (max-width:899px){
  .admin-shell{flex-direction:column;align-items:stretch;}
  .dash-sidebar{flex:none;width:100%;height:auto;border-right:none;border-bottom:1px solid var(--line);}
  /* The collapse toggle only makes sense in the full-height layout, and the
     theme toggle now lives in .content-navbar (always visible) - so the
     brand header has nothing left to show here. */
  .sb-top{display:none;}
  .sb-nav{
    flex-direction:row;align-items:center;gap:4px;padding:0 12px 8px;
    overflow-x:auto;overflow-y:hidden;
  }
  .sb-tablist{flex-direction:row;gap:4px;}
  .dash-navitem{
    flex:0 0 auto;width:auto;justify-content:center;text-align:center;
    white-space:nowrap;font-size:var(--t-sm);padding:10px 14px;
    border-bottom:none;border-right:1px solid var(--line);
  }
  .dash-navitem:last-child{border-right:none;}
  .dash-table-panel .table-scroll{max-height:none;overflow-y:visible;}
}

/* Phone: the data table becomes one card per record. A <thead> can't be
   width-shrunk, so it's dropped; each <td>'s data-label ::before names the
   field in the stacked layout. */
@media (max-width:760px){
  .admin-dash{padding:22px 16px 52px;}
  .dash-topbar{margin-bottom:18px;}
  .dash-stats{flex:1 1 100%;justify-content:flex-start;}
  .stat{text-align:left;}
  .dash-table-panel{padding:14px;}

  .dash-table-panel{border:none;background:transparent;box-shadow:none;padding:0;}
  .dash-table-panel .table-scroll{overflow:visible;border:none;background:transparent;}
  .dash-table thead th{position:static;}
  .dash-table,
  .dash-table tbody,
  .dash-table tr,
  .dash-table td{display:block;width:auto;}
  .dash-table{min-width:0;}
  .dash-table thead{display:none;}

  .dash-table tbody tr{
    background:var(--card);border:1px solid var(--line);border-radius:14px;
    box-shadow:var(--shadow);padding:4px 2px;margin-bottom:12px;
  }
  .dash-table tbody tr:hover{background:var(--card);}
  .dash-table tbody td{
    display:flex;align-items:flex-start;justify-content:space-between;gap:14px;
    padding:10px 12px;border:none;border-bottom:1px solid var(--line);
    text-align:right;font-weight:600;max-width:none;
  }
  .dash-table tbody tr td:last-child{border-bottom:none;}
  .dash-table tbody td::before{
    content:attr(data-label);
    text-align:left;color:var(--sub);flex-shrink:0;
    font-size:var(--t-eyebrow);font-weight:700;letter-spacing:.06em;text-transform:uppercase;
    max-width:42%;overflow-wrap:anywhere;
  }
  .dash-table .col-name,.dash-table .col-bank,.dash-table .col-file{
    max-width:none;overflow:visible;overflow-wrap:anywhere;white-space:normal;text-overflow:clip;
  }
  .dash-file{max-width:100%;white-space:normal;overflow-wrap:anywhere;}

  .empty-row td{justify-content:center;text-align:center;}
  .empty-row td::before{content:none;}

  .acct{justify-content:flex-end;}
  .acct .icon-btn{opacity:1;}
  .row-actions{justify-content:flex-end;}
  .dash-table .col-num,.dash-table .col-actions{width:auto;}
}

@media (max-width:600px){
  .dash-stats{gap:12px 28px;}
  .stat{flex:1 0 40%;max-width:none;}

  .dash-controls{flex-direction:column;align-items:stretch;}
  .dash-controls > *{width:100%;}
  .dash-controls .admin-select{width:100%;flex:none;min-width:0;}
}

@media (max-width:480px){
  .dash-navitem{font-size:var(--t-xs);padding:9px 10px;}
  .modal-actions{flex-direction:column-reverse;}
  .modal-actions button{width:100%;}
}

/* Excel view modal: modern pill tabs + clean data grid, theme-aware */
#viewModal .modal-box{border-radius:18px;padding:22px 24px;}
#viewTitle{font-size:var(--t-lg);font-weight:800;letter-spacing:-.01em;margin-bottom:14px;}
#viewTabs{flex:none;display:flex;gap:6px;overflow:auto hidden;margin:0 0 12px;padding-bottom:2px;scrollbar-width:none;}
#viewTabs::-webkit-scrollbar{display:none;}
#viewTabs button{border:1px solid var(--line);background:var(--card);color:var(--sub);padding:7px 14px;border-radius:999px;cursor:pointer;white-space:nowrap;font:inherit;font-size:var(--t-sm);font-weight:600;transition:background .15s,color .15s;}
#viewTabs button:hover{background:var(--row-hover);color:var(--ink);}
#viewTabs button.active{background:var(--brand-grad);border-color:transparent;color:#fff;}
#viewBody{border:1px solid var(--frame);border-radius:12px;font-size:var(--t-sm);color:var(--ink);}
#viewBody table{border-collapse:separate;border-spacing:0;width:max-content;min-width:100%;}
#viewBody td{padding:9px 14px;white-space:nowrap;vertical-align:middle;border-bottom:1px solid var(--line);}
#viewBody tr:first-child td{background:var(--th-bg);color:var(--th-ink);font-weight:700;font-size:var(--t-xs);letter-spacing:.04em;text-transform:uppercase;position:sticky;top:0;z-index:1;}
#viewBody tr:nth-child(even) td{background:var(--row-alt);}
#viewBody tr:hover td{background:var(--row-hover);}
#viewBody tr:first-child:hover td{background:var(--th-bg);}
#viewBody td[t="n"]{text-align:right;font-variant-numeric:tabular-nums;}
#viewModal ::-webkit-scrollbar{width:8px;height:8px;}
#viewModal ::-webkit-scrollbar-button{display:none;}
#viewModal ::-webkit-scrollbar-thumb{background:var(--line);border-radius:4px;}
.dup-item.clickable{cursor:pointer;}
.dup-item.clickable:hover{border-color:var(--blue-1);background:var(--row-hover);}

/* Period dropdown on the stat card - reuses the bank-select panel look */
.stat-period{position:relative;display:inline-block;}
.stat-period-btn{display:inline-flex;align-items:center;gap:6px;border:none;background:none;padding:0;cursor:pointer;font:inherit;font-size:var(--t-sm);font-weight:600;color:var(--sub);}
.stat-period-btn:hover{color:var(--ink);}
.stat-period-menu{left:auto;right:0;min-width:160px;margin:0;padding:4px;list-style:none;text-align:left;}
.stat-period-menu[hidden]{display:none;}

/* ---- Professional type scale: Inter, lighter weights, tighter sizes ---- */
:root{--t-xs:11.5px;--t-sm:12.5px;--t-base:13px;--t-lg:15px;--t-xl:18px;--t-2xl:22px;}
body{-webkit-font-smoothing:antialiased;}
.admin-title{font-weight:700;letter-spacing:-.015em;}
.stat-label,.stat-period-btn{font-weight:500;font-size:var(--t-xs);}
.stat-value{font-weight:700;}
.stat-value-text{font-size:var(--t-base);}
.dash-table th,.dash-table td{padding:12px 16px;}
.dash-table thead th{font-weight:600;font-size:11px;letter-spacing:.05em;}
.dash-table tbody td{font-weight:400;}
.dash-table .col-name{font-weight:500;}
.dash-file{font-weight:500;}
.dash-navitem{font-weight:500;}
.bank-select-option{font-size:var(--t-sm);font-weight:500;padding:9px 12px;}
.bank-select-option.selected{font-weight:600;}
.admin-input{font-weight:400;}
.modal-title,.admin-modal .modal-title{font-weight:700;}

/* Landing hero keeps the original system font */
.hero-inner > h1,.hero-inner > p,.hero-stats{font-family:-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;}

/* Account Type row in the Account Snapshot: manual picker */
.acct-type .stat-period-btn{color:var(--ink);font-weight:600;font-size:inherit;}
.acct-type.unset .stat-period-btn{color:var(--amber);}
.acct-type .stat-period-menu{text-align:left;font-weight:500;}

/* Results heading row + feedback dialog */
.section-title{display:flex;align-items:center;justify-content:space-between;gap:12px;}
.fb-info{margin:0 0 14px;display:grid;gap:8px;}
.fb-info div{display:flex;justify-content:space-between;gap:16px;padding:8px 12px;border-radius:10px;background:var(--bg);border:1px solid var(--line);}
.fb-info dt{color:var(--sub);font-size:var(--t-sm);}
.fb-info dd{margin:0;font-weight:600;font-size:var(--t-sm);text-align:right;}
.fb-text{height:auto;padding:10px 12px;resize:vertical;width:100%;box-sizing:border-box;font-family:inherit;}
.admin-modal .fb-text{height:216px;padding:14px 16px;line-height:1.4;}
#feedbackModal .dash-field-label{display:block;margin:20px 0 8px;padding-left:4px;}

/* View modal: title row with the feedback toggle */
.view-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;}
.view-head .modal-title{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.fb-view{margin-bottom:12px;padding:12px 14px;border-radius:10px;background:var(--bg);border:1px solid var(--line);font-size:var(--t-sm);white-space:pre-wrap;max-height:25vh;overflow:auto;text-align:left;}
.fb-view[hidden]{display:none;}

/* Feedback: corner toasts, delete button, popover under "Check feedback" */
.dash-toast.ok,.dash-toast.err{left:auto;right:26px;transform:none;color:#fff;}
.dash-toast.ok{background:#16a34a;}
.dash-toast.err{background:#dc2626;}
.fb-anchor{position:relative;flex:none;}
.fb-pop{position:absolute;top:calc(100% + 8px);right:0;width:320px;z-index:5;padding:10px;border-radius:14px;background:var(--card);border:1px solid var(--line);box-shadow:0 16px 40px rgba(0,0,0,.22);}
.fb-pop[hidden]{display:none;}
.fb-pop .fb-view{margin:0;}
.fb-icon{width:42px;height:42px;display:inline-flex;align-items:center;justify-content:center;border-radius:12px;border:1px solid var(--line);background:var(--card);color:var(--ink);cursor:pointer;transition:background .15s,transform .15s;}
.fb-icon:hover{background:var(--row-hover);transform:translateY(-1px);}
.fb-icon.fb-primary{background:var(--brand-grad);border-color:transparent;color:#fff;}
.fb-icon.fb-delete{margin-right:auto;color:var(--red);}
.fb-icon[hidden]{display:none;}

/* Project-wide scrollbar: slim, rounded thumb, no arrow buttons.
   (Scrollbars that are intentionally hidden above stay hidden.) */
*::-webkit-scrollbar{width:8px;height:8px;}
*::-webkit-scrollbar-button{display:none;}
*::-webkit-scrollbar-track{background:transparent;}
*::-webkit-scrollbar-thumb{background:var(--line);border-radius:4px;}
@supports not selector(::-webkit-scrollbar){
  *{scrollbar-width:thin;scrollbar-color:var(--line) transparent;}
}

/* Detected Loans: keep every row on a single line (lender may still wrap) */
#loansTable td:not(:first-child){white-space:nowrap;}
#loansTable td,#loansTable + * th,.panel:has(#loansTable) th{padding-left:10px;padding-right:10px;}
.fb-text.invalid{border-color:var(--red);}
.fb-error{color:var(--red);font-size:var(--t-xs);font-weight:500;margin:6px 2px 0;}
.fb-error[hidden]{display:none;}
.fb-text+.fb-error+.modal-actions{margin-top:14px;}
