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

:root {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: rgba(18, 26, 47, 0.75);
  --bg-card-hover: rgba(26, 38, 68, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-primary: #6366f1;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  --accent-glow: 0 0 25px rgba(99, 102, 241, 0.35);

  --emerald: #10b981;
  --emerald-bg: rgba(16, 185, 129, 0.12);
  --emerald-border: rgba(16, 185, 129, 0.3);

  --rose: #f43f5e;
  --rose-bg: rgba(244, 63, 94, 0.12);
  --rose-border: rgba(244, 63, 94, 0.3);

  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --amber-border: rgba(245, 158, 11, 0.3);

  --cyan: #06b6d4;
  --cyan-bg: rgba(6, 182, 212, 0.12);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition-fast: 0.18s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.04) 0%, transparent 50%);
  background-attachment: fixed;
}

/* Glass panel */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* Header */
header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--accent-glow);
  font-size: 1.4rem;
}

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #fff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 500;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--emerald-bg);
  color: var(--emerald);
  border: 1px solid var(--emerald-border);
}

.status-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Main Container */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  width: fit-content;
}

.tab-btn {
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: #fff;
  background: var(--accent-gradient);
  box-shadow: var(--accent-glow);
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.kpi-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
  opacity: 0.7;
}

.kpi-card.emerald::before { background: linear-gradient(90deg, #10b981, #059669); }
.kpi-card.amber::before { background: linear-gradient(90deg, #f59e0b, #d97706); }
.kpi-card.cyan::before { background: linear-gradient(90deg, #06b6d4, #0284c7); }

.kpi-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

.kpi-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Upload Dropzone Section */
.upload-box {
  padding: 2.5rem 2rem;
  text-align: center;
  border: 2px dashed rgba(99, 102, 241, 0.35);
  background: rgba(18, 26, 47, 0.45);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
}

.upload-box:hover, .upload-box.dragover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.06);
  transform: translateY(-2px);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.4));
}

.upload-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.upload-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.btn-upload {
  padding: 0.75rem 1.8rem;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: var(--accent-glow);
  transition: var(--transition-fast);
}

.btn-upload:hover {
  transform: scale(1.02);
  filter: brightness(1.1);
}

/* Ingestion Result Card */
.ingestion-card {
  padding: 1.75rem;
  border-radius: var(--radius-md);
  margin-top: 1.5rem;
  border-left: 4px solid var(--accent-primary);
  display: none;
}

.ingestion-card.show {
  display: block;
  animation: fadeIn 0.35s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ingestion-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.ingestion-stat-item {
  padding: 1rem;
  background: rgba(15, 23, 42, 0.7);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.stat-number {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 0.2rem;
}

.stat-number.green { color: var(--emerald); }
.stat-number.amber { color: var(--amber); }

/* Ledger Table Toolbar */
.toolbar {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.input-search {
  padding: 0.6rem 1rem 0.6rem 2.2rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
  min-width: 260px;
  outline: none;
  transition: var(--transition-fast);
}

.input-search:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.search-wrap {
  position: relative;
}

.search-wrap::before {
  content: '🔍';
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  opacity: 0.5;
}

.select-filter {
  padding: 0.6rem 1.2rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.btn-pill {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-pill.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: #fff;
}

/* Master Ledger Table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

.ledger-table thead th {
  background: #0d1322;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  padding: 1rem 1.1rem;
  border-bottom: 2px solid var(--border-subtle);
  white-space: nowrap;
}

.ledger-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: var(--transition-fast);
}

.ledger-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.ledger-table td {
  padding: 0.85rem 1.1rem;
  vertical-align: middle;
}

/* Sequence badge */
.seq-badge {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  display: inline-block;
  font-size: 0.8rem;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

/* Date font */
.mono-date {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

/* Category Badge */
.category-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cat-neft { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.cat-rtgs { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.cat-imps { background: rgba(236, 72, 153, 0.15); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.3); }
.cat-upi { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }
.cat-razorpay { background: rgba(14, 165, 233, 0.15); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.3); }
.cat-cash { background: rgba(234, 179, 8, 0.15); color: #facc15; border: 1px solid rgba(234, 179, 8, 0.3); }
.cat-cheque { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.cat-charges { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.cat-other { background: rgba(148, 163, 184, 0.12); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.2); }

/* Amounts */
.amount-debit {
  color: var(--rose);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
  white-space: nowrap;
}

.amount-credit {
  color: var(--emerald);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
  white-space: nowrap;
}

.amount-balance {
  color: #93c5fd;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
  white-space: nowrap;
}

.hash-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.25);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: var(--transition-fast);
}

.hash-pill:hover {
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.15);
}

/* Pagination bar */
.pagination {
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.6);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-page {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-fast);
}

.btn-page:hover:not(:disabled) {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Gap banner */
.gap-alert {
  padding: 1rem 1.5rem;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-md);
  color: #fde68a;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 90%;
  max-width: 580px;
  background: #111827;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  transform: scale(0.95);
  transition: var(--transition-smooth);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

/* Accounts Grid */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.account-card {
  padding: 1.75rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
}

.account-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  width: fit-content;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container { padding: 1rem; }
  header { padding: 1rem; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .input-search { width: 100%; }
}
