/* Bank Statement Analyzer - UI styles (namespaced) */

.bsa-app, .bsa-app * { box-sizing: border-box; }

.bsa-app {
  --bsa-bg: #05070a;
  --bsa-panel: rgba(255,255,255,0.04);
  --bsa-panel2: rgba(255,255,255,0.06);
  --bsa-border: rgba(255,255,255,0.10);
  --bsa-border2: rgba(255,255,255,0.14);
  --bsa-text: rgba(255,255,255,0.92);
  --bsa-muted: rgba(255,255,255,0.62);
  --bsa-muted2: rgba(255,255,255,0.42);
  --bsa-blue: #2B6BFF;
  --bsa-blue2: #1F56D7;
  --bsa-green: #3BEA88;
  --bsa-red: #FF4D4D;
  --bsa-amber: #FFCB45;
  --bsa-shadow: 0 20px 60px rgba(0,0,0,0.45);

  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--bsa-text);
  background: radial-gradient(1200px 600px at 75% 20%, rgba(43,107,255,0.15), transparent 60%),
              radial-gradient(900px 500px at 25% 80%, rgba(59,234,136,0.08), transparent 60%),
              var(--bsa-bg);
  border-radius: 18px;
  overflow: hidden;
  min-height: 520px;
}

/* Maximize mode */
body.bsa-body-lock { overflow: hidden !important; }
.bsa-app.bsa-max {
  position: fixed;
  inset: 0;
  z-index: 999999;
  border-radius: 0;
  height: 100vh;
  min-height: 100vh;
}

.bsa-shell {
  display: flex;
  height: 100%;
  min-height: 520px;
}

.bsa-sidebar {
  width: 280px;
  padding: 22px 18px;
  border-right: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
}

.bsa-brand {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.bsa-shield {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(43,107,255,0.12);
  border: 1px solid rgba(43,107,255,0.35);
  display: grid;
  place-items: center;
}

.bsa-brand h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.bsa-brand .bsa-sub {
  margin-top: 4px;
  color: rgba(43,107,255,0.9);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.bsa-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.bsa-nav button {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.78);
  border-radius: 14px;
  padding: 12px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.bsa-nav button:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.16);
}

.bsa-nav button.active {
  background: rgba(43,107,255,0.12);
  border-color: rgba(43,107,255,0.35);
  color: rgba(255,255,255,0.92);
}

.bsa-nav .bsa-nav-ico {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.bsa-side-footer {
  margin-top: auto;
  padding-top: 14px;
}

.bsa-side-action {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 14px 0;
  color: rgba(255,255,255,0.60);
  font-size: 13px;
}

.bsa-status {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  border-radius: 14px;
  padding: 12px;
}

.bsa-status .label {
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 8px;
}

.bsa-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.bsa-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bsa-green);
  box-shadow: 0 0 0 6px rgba(59,234,136,0.12);
}

.bsa-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.bsa-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: 64px;
}

.bsa-top-left {
  display: flex;
  gap: 12px;
  align-items: center;
}

.bsa-terminal {
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 12px;
  color: rgba(255,255,255,0.40);
}

.bsa-top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.bsa-icon-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.85);
  border-radius: 12px;
  padding: 9px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.bsa-icon-btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.18); }

.bsa-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 26px 22px;
}

.bsa-center {
  max-width: 980px;
  margin: 0 auto;
}

.bsa-hero {
  padding: 44px 0 20px;
  text-align: center;
}

.bsa-ready {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(43,107,255,0.35);
  background: rgba(43,107,255,0.10);
  color: rgba(153,197,255,0.95);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.bsa-ready .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(43,107,255,1);
  box-shadow: 0 0 0 6px rgba(43,107,255,0.16);
}

.bsa-title {
  margin: 18px 0 0;
  font-size: 54px;
  line-height: 1.04;
  font-weight: 900;
  letter-spacing: -1px;
}

.bsa-title .shadow {
  display: block;
  background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.10));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.bsa-lead {
  margin: 16px auto 0;
  max-width: 660px;
  color: rgba(255,255,255,0.60);
  font-size: 15px;
  line-height: 1.6;
}

.bsa-hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.bsa-btn {
  border-radius: 14px;
  padding: 13px 18px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.92);
  min-width: 190px;
}

.bsa-btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.18); }

.bsa-btn.primary {
  background: var(--bsa-blue);
  border-color: rgba(43,107,255,0.50);
}

.bsa-btn.primary:hover { background: var(--bsa-blue2); }

/* Modal */
.bsa-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999999;
}

.bsa-modal {
  width: 100%;
  max-width: 620px;
  background: rgba(20,22,27,0.96);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  box-shadow: var(--bsa-shadow);
  overflow: hidden;
}

.bsa-modal .head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 20px 20px 8px;
}

.bsa-modal .head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
}

.bsa-modal .head .sub {
  margin-top: 2px;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.50);
}

.bsa-modal .body { padding: 14px 20px 18px; }

.bsa-field { margin-bottom: 14px; }
.bsa-label {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 8px;
}

.bsa-select, .bsa-input {
  width: 100%;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 12px 12px;
  color: rgba(255,255,255,0.90);
  outline: none;
}

.bsa-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.bsa-toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.bsa-toggle-grid button {
  border-radius: 12px;
  padding: 12px 10px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.75);
  cursor: pointer;
}

.bsa-toggle-grid button.active {
  background: rgba(43,107,255,0.18);
  border-color: rgba(43,107,255,0.40);
  color: rgba(255,255,255,0.92);
}

.bsa-modal .foot {
  display: flex;
  gap: 12px;
  padding: 0 20px 20px;
}

.bsa-modal .foot .bsa-btn { min-width: 0; flex: 1; }

.bsa-btn.ghost {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.72);
}

/* Upload */
.bsa-upload {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.bsa-drop {
  background: rgba(255,255,255,0.03);
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 18px;
  padding: 18px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
}

.bsa-drop strong { font-size: 14px; }
.bsa-drop p { margin: 0; color: rgba(255,255,255,0.60); font-size: 13px; line-height: 1.5; }

.bsa-drop input[type=file] { display: none; }

.bsa-small {
  font-size: 12px;
  color: rgba(255,255,255,0.50);
  margin-top: 6px;
}

.bsa-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 16px;
}

.bsa-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.70);
}

.bsa-kv {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.bsa-kv .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: rgba(255,255,255,0.80);
}

.bsa-kv .row span { color: rgba(255,255,255,0.55); }

/* Report */
.bsa-report {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bsa-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.bsa-metric {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 14px;
}

.bsa-metric .k {
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
}

.bsa-metric .v {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 900;
}

.bsa-metric .v.small { font-size: 14px; font-weight: 800; color: rgba(255,255,255,0.78); }

.bsa-row {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 12px;
}

.bsa-categories {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 16px;
}

.bsa-categories .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.bsa-categories .head h4 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.70);
}

.bsa-cat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

.bsa-cat {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.25);
  border-radius: 14px;
  padding: 10px 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.bsa-cat:hover { border-color: rgba(255,255,255,0.18); }

.bsa-cat.active {
  border-color: rgba(43,107,255,0.45);
  background: rgba(43,107,255,0.12);
}

.bsa-cat .name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.bsa-cat .name b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bsa-cat .name small { color: rgba(255,255,255,0.55); }

.bsa-cat .amt {
  font-weight: 900;
  font-size: 13px;
}

.bsa-table {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 16px;
  min-width: 0;
}

.bsa-table .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.bsa-table .head h4 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.70);
}

.bsa-search {
  display: flex;
  gap: 10px;
  align-items: center;
}

.bsa-search input {
  width: 260px;
  max-width: 70vw;
  background: rgba(0,0,0,0.30);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 10px 10px;
  color: rgba(255,255,255,0.90);
  outline: none;
}

.bsa-table-wrap {
  overflow: auto;
  max-height: 520px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  -webkit-overflow-scrolling: touch;
}

/* In maximize mode, avoid nested scroll traps on mobile by letting the table grow
   and letting the main content area handle scrolling. */
.bsa-max .bsa-table-wrap {
  max-height: none;
}

.bsa-table table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px;
}

.bsa-table th {
  position: sticky;
  top: 0;
  background: rgba(12,14,18,0.98);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  padding: 10px 10px;
  text-align: left;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.60);
}

.bsa-table td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
  color: rgba(255,255,255,0.82);
  vertical-align: top;
}

.bsa-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  color: rgba(255,255,255,0.78);
  background: rgba(255,255,255,0.03);
}

.bsa-badge.red { border-color: rgba(255,77,77,0.35); background: rgba(255,77,77,0.10); }
.bsa-badge.green { border-color: rgba(59,234,136,0.35); background: rgba(59,234,136,0.10); }
.bsa-badge.blue { border-color: rgba(43,107,255,0.35); background: rgba(43,107,255,0.10); }

.bsa-muted { color: rgba(255,255,255,0.55); }

/* Loading */
.bsa-loading {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  text-align: center;
}

.bsa-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.14);
  border-top-color: rgba(43,107,255,0.95);
  animation: bsaSpin 0.9s linear infinite;
}

@keyframes bsaSpin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 980px) {
  .bsa-sidebar { width: 92px; padding: 18px 12px; }
  .bsa-brand h4, .bsa-brand .bsa-sub { display: none; }
  .bsa-nav button { justify-content: center; }
  .bsa-nav button span { display: none; }
  .bsa-side-action { display: none; }
  .bsa-status { display: none; }

  .bsa-title { font-size: 42px; }
  .bsa-upload { grid-template-columns: 1fr; }
  .bsa-row { grid-template-columns: 1fr; }
  .bsa-summary { grid-template-columns: repeat(2, 1fr); }
  .bsa-table table { min-width: 680px; }
}

@media (max-width: 520px) {
  .bsa-topbar { padding: 14px 14px; }
  .bsa-content { padding: 18px 14px; }
  .bsa-title { font-size: 34px; }
  .bsa-summary { grid-template-columns: 1fr; }
  .bsa-search input { width: 100%; }
}
