/* ==========================================================================
   TALLY DATA VISUALIZER — EXECUTIVE FINTECH BI ENGINE
   Clean Architecture with Strict Separation of Real Data vs Demo Preview
   Author: Priyanshu Pandey (IQ4U8)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens & Color Palettes
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root,
[data-theme="light"] {
  /* Surfaces & Canvas */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-subtle: #f8fafc;
  --bg-hover: #f1f5f9;

  /* Borders */
  --border-subtle: #f1f5f9;
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-strong: #0f172a;

  /* Brand Emerald (FinTech) */
  --primary: #059669;
  --primary-hover: #047857;
  --primary-subtle: #ecfdf5;
  --primary-border: #a7f3d0;
  --primary-dark: #0f172a;

  /* Amber Demo Tag */
  --demo-bg: #fffbeb;
  --demo-border: #fde68a;
  --demo-text: #92400e;
  --demo-accent: #d97706;

  /* Typography */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --text-main: #0f172a;

  /* Accounting Semantics */
  --acc-cr: #059669;
  --acc-cr-bg: #ecfdf5;
  --acc-cr-border: #a7f3d0;
  --acc-dr: #dc2626;
  --acc-dr-bg: #fef2f2;
  --acc-dr-border: #fecaca;

  /* Header & Navigation */
  --header-bg: #0f172a;
  --header-border: #1e293b;
  --header-text: #f8fafc;
  --header-muted: #94a3b8;
  --header-btn-bg: #1e293b;
  --header-btn-hover: #334155;

  --subbar-bg: #ffffff;
  --subbar-border: #e2e8f0;
  --subbar-text: #475569;

  /* Table */
  --table-head-bg: #f8fafc;
  --table-head-text: #475569;
  --table-row-bg: #ffffff;
  --table-row-alt: #f8fafc;
  --table-row-hover: #f1f5f9;
  --table-border: #e2e8f0;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.07), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-elevated: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 20px 25px -5px rgba(15, 23, 42, 0.2), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
}

[data-theme="dark"] {
  /* Surfaces & Canvas */
  --bg-page: #0b0f17;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-subtle: #161f30;
  --bg-hover: #1f2937;

  /* Borders */
  --border-subtle: #1f2937;
  --border-light: #1f2937;
  --border-medium: #374151;
  --border-strong: #10b981;

  /* Brand Emerald (FinTech) */
  --primary: #10b981;
  --primary-hover: #34d399;
  --primary-subtle: rgba(16, 185, 129, 0.12);
  --primary-border: rgba(16, 185, 129, 0.25);
  --primary-dark: #f9fafb;

  /* Amber Demo Tag */
  --demo-bg: rgba(217, 119, 6, 0.15);
  --demo-border: rgba(217, 119, 6, 0.35);
  --demo-text: #fbbf24;
  --demo-accent: #f59e0b;

  /* Typography */
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --text-faint: #6b7280;
  --text-main: #f9fafb;

  /* Accounting Semantics */
  --acc-cr: #34d399;
  --acc-cr-bg: rgba(52, 211, 153, 0.15);
  --acc-cr-border: rgba(52, 211, 153, 0.3);
  --acc-dr: #f87171;
  --acc-dr-bg: rgba(248, 113, 113, 0.15);
  --acc-dr-border: rgba(248, 113, 113, 0.3);

  /* Header & Navigation */
  --header-bg: #090d14;
  --header-border: #1a2234;
  --header-text: #f9fafb;
  --header-muted: #9ca3af;
  --header-btn-bg: #161f30;
  --header-btn-hover: #223049;

  --subbar-bg: #0e1420;
  --subbar-border: #1f2937;
  --subbar-text: #9ca3af;

  /* Table */
  --table-head-bg: #161f30;
  --table-head-text: #9ca3af;
  --table-row-bg: #111827;
  --table-row-alt: #0d131f;
  --table-row-hover: #1a2333;
  --table-border: #1f2937;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.5), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-elevated: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.8), 0 8px 10px -6px rgba(0, 0, 0, 0.6);
}

:root {
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;

  --header-height: 48px;
  --subbar-height: 36px;
  --statusbar-height: 26px;
  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-full: 9999px;
}

/* --------------------------------------------------------------------------
   2. Base Document Typography & Layout
   -------------------------------------------------------------------------- */
html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* --------------------------------------------------------------------------
   3. Modern FinTech Navigation Header
   -------------------------------------------------------------------------- */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--header-text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.7);
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--header-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Header Buttons */
.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  background: var(--header-btn-bg);
  color: var(--header-text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-nav:hover {
  background: var(--header-btn-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-nav-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
}

.btn-nav-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-nav-demo {
  background: rgba(217, 119, 6, 0.18);
  border-color: rgba(217, 119, 6, 0.4);
  color: #fbbf24;
  font-weight: 600;
}

.btn-nav-demo:hover {
  background: rgba(217, 119, 6, 0.3);
  border-color: #f59e0b;
  color: #ffffff;
}

.btn-nav-icon {
  width: 30px;
  padding: 0;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   4. Sub-Navigation / Financial Period Strip
   -------------------------------------------------------------------------- */
.subbar-strip {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: var(--subbar-height);
  background: var(--subbar-bg);
  border-bottom: 1px solid var(--subbar-border);
  z-index: 990;
  display: flex;
  align-items: center;
}

.subbar-inner {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--subbar-text);
}

.subbar-path {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.subbar-divider {
  color: var(--text-faint);
  font-size: 10px;
}

.subbar-current {
  color: var(--text-primary);
  font-weight: 600;
}

.subbar-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 11.5px;
}

.subbar-meta strong {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.subbar-meta span {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   5. Workstation Workspace Layout (Full-Width)
   -------------------------------------------------------------------------- */
.workspace-wrapper {
  padding-top: calc(var(--header-height) + var(--subbar-height));
  padding-bottom: var(--statusbar-height);
  width: 100%;
  min-height: 100vh;
}

.main-canvas {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 28px 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* --------------------------------------------------------------------------
   6. FRESH / ORIGINAL HERO INGESTION VIEW (Default State)
   -------------------------------------------------------------------------- */
.hero-fresh-view {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px 0;
}

.hero-ingestion-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 36px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto;
}

.hero-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.hero-upload-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  margin-top: 10px;
}

@media (max-width: 900px) {
  .hero-upload-grid {
    grid-template-columns: 1fr;
  }
}

.hero-dropzone {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hero-dropzone:hover,
.hero-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-subtle);
}

.hero-dropzone-icon {
  margin-bottom: 12px;
  color: var(--primary);
}

.hero-dropzone-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.hero-dropzone-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.hero-paste-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-paste-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero-paste-textarea {
  width: 100%;
  height: 140px;
  padding: 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease;
}

.hero-paste-textarea:focus {
  border-color: var(--primary);
}

.btn-hero-process {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-hero-process:hover {
  background: var(--primary-hover);
}

.hero-demo-footer {
  border-top: 1px solid var(--border-light);
  padding-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-demo-hint {
  font-size: 12.5px;
  color: var(--text-muted);
}

.btn-hero-demo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--demo-bg);
  border: 1px solid var(--demo-border);
  color: var(--demo-text);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-hero-demo:hover {
  background: var(--demo-accent);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   7. SEPARATE DEMO NOTIFICATION BANNER (Only in Demo Mode)
   -------------------------------------------------------------------------- */
.demo-status-banner {
  background: var(--demo-bg);
  border: 1px solid var(--demo-border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--demo-text);
}

.demo-status-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
}

.demo-status-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.demo-scenario-select {
  background: var(--bg-surface);
  border: 1px solid var(--demo-border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.btn-exit-demo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--demo-border);
  color: var(--demo-text);
  border-radius: var(--radius-xs);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-exit-demo:hover {
  background: var(--demo-text);
  color: #ffffff;
}

/* UPLOADED FILE STATUS BANNER */
.uploaded-status-banner {
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--primary-dark);
}

.uploaded-status-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
}

.uploaded-status-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   8. Company Header Banner (Inside Active Dashboard)
   -------------------------------------------------------------------------- */
.company-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 20px 24px;
}

.company-banner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.company-meta {
  flex: 1;
  min-width: 280px;
}

.company-title {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 5px;
  color: var(--text-primary);
}

.company-gstin-chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.company-subtext {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   8B. IDE Panel Resizing System (Custom Drag Corners & Resizable Width/Height)
   -------------------------------------------------------------------------- */
.ide-resizable {
  position: relative;
  resize: both;
  overflow: auto;
  min-width: 280px;
  min-height: 80px;
  max-width: 100%;
  transition: box-shadow 0.15s ease;
}

.ide-resizable:hover {
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
}

.ide-resize-handle {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.15s ease, transform 0.15s ease;
  user-select: none;
}

.ide-resize-handle:hover,
.ide-resize-handle.active {
  opacity: 1;
  color: var(--primary);
  transform: scale(1.25);
}

.ide-resize-handle svg {
  pointer-events: none;
}

.badge-mode {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-mode.demo {
  background: var(--demo-bg);
  border: 1px solid var(--demo-border);
  color: var(--demo-accent);
}

.badge-mode.real {
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   9. Executive KPI Matrix
   -------------------------------------------------------------------------- */
.kpi-section {
  width: 100%;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease;
}

.kpi-card:hover {
  border-color: var(--border-medium);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.kpi-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
  font-size: 11px;
}

.kpi-trend {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.kpi-trend.positive {
  background: var(--acc-cr-bg);
  color: var(--acc-cr);
}

.kpi-trend.negative {
  background: var(--acc-dr-bg);
  color: var(--acc-dr);
}

.kpi-trend.neutral {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

.kpi-subtext {
  color: var(--text-faint);
  font-size: 10.5px;
}

/* --------------------------------------------------------------------------
   10. Charts Section & IDE-Style Resizable Cards
   -------------------------------------------------------------------------- */
.analytics-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.charts-row-1,
.charts-row-2 {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 18px;
}

.charts-row-2 {
  grid-template-columns: 1fr 1fr;
}

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.chart-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chart-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
}

.chart-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
}

/* Crucial: Explicit height so Chart.js canvas never collapses! */
.chart-body {
  position: relative;
  width: 100%;
  height: 290px;
  min-height: 250px;
}

/* --------------------------------------------------------------------------
   11. IDE-Style Interactive Resizable Panels
   -------------------------------------------------------------------------- */
.ide-resizable {
  position: relative;
  transition: box-shadow 0.15s ease;
}

.ide-resizable.resizing {
  box-shadow: 0 0 0 2px var(--primary), var(--shadow-elevated) !important;
}

.ide-resize-handle {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 16px;
  height: 16px;
  cursor: se-resize;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 2px;
  color: var(--text-faint);
  opacity: 0.35;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 50;
  user-select: none;
}

.ide-resizable:hover .ide-resize-handle {
  opacity: 0.85;
}

.ide-resize-handle:hover {
  opacity: 1;
  color: var(--primary);
  transform: scale(1.25);
}

/* --------------------------------------------------------------------------
   12. Financial DayBook Table Register
   -------------------------------------------------------------------------- */
.ledger-section {
  width: 100%;
}

.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 20px 22px;
  position: relative;
}

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

.table-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.table-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.table-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
}

.table-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrap svg {
  position: absolute;
  left: 9px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 6px 10px 6px 28px;
  font-size: 12px;
  width: 220px;
  outline: none;
  transition: all 0.15s ease;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-subtle);
  width: 250px;
}

.table-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.table-select:focus {
  border-color: var(--primary);
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--table-border);
  border-radius: var(--radius-sm);
  background: var(--table-row-bg);
}

.tally-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.tally-table thead tr {
  background: var(--table-head-bg);
  border-bottom: 1px solid var(--table-border);
}

.tally-table th {
  padding: 10px 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 10.5px;
  color: var(--table-head-text);
  border-right: 1px solid var(--table-border);
  white-space: nowrap;
}

.tally-table th:last-child {
  border-right: none;
}

.tally-table th.text-right,
.tally-table td.text-right {
  text-align: right;
}

.tally-table tbody tr {
  background: var(--table-row-bg);
  border-bottom: 1px solid var(--table-border);
  transition: background-color 0.12s ease;
}

.tally-table tbody tr:nth-child(even) {
  background: var(--table-row-alt);
}

.tally-table tbody tr:hover {
  background: var(--table-row-hover);
}

.tally-table td {
  padding: 9px 12px;
  color: var(--text-primary);
  border-right: 1px solid var(--table-border);
  white-space: nowrap;
}

.tally-table td:last-child {
  border-right: none;
}

.tally-table td.font-mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
}

/* Voucher Badges */
.voucher-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  display: inline-block;
  line-height: 1.2;
}

.voucher-badge.v-sales {
  background: var(--acc-cr-bg);
  color: var(--acc-cr);
}

.voucher-badge.v-purchase {
  background: #eff6ff;
  color: #1d4ed8;
}

[data-theme="dark"] .voucher-badge.v-purchase {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.voucher-badge.v-payment {
  background: var(--acc-dr-bg);
  color: var(--acc-dr);
}

.voucher-badge.v-receipt {
  background: #f0fdf4;
  color: #15803d;
}

[data-theme="dark"] .voucher-badge.v-receipt {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.voucher-badge.v-journal {
  background: #faf5ff;
  color: #7e22ce;
}

[data-theme="dark"] .voucher-badge.v-journal {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

.amount-dr {
  color: var(--acc-dr);
  font-weight: 600;
}

.amount-cr {
  color: var(--acc-cr);
  font-weight: 600;
}

/* Double underline total rule */
.tally-table tfoot tr {
  background: var(--table-head-bg);
  border-top: 1px solid var(--table-border);
  border-bottom: 3px double var(--table-border);
  font-weight: 700;
}

.tally-table tfoot td {
  padding: 10px 12px;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* Pagination Row */
.table-pagination-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  gap: 12px;
}

/* --------------------------------------------------------------------------
   13. DEDICATED DEMO PRESETS MODAL
   -------------------------------------------------------------------------- */
.demo-preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 600px) {
  .demo-preset-grid {
    grid-template-columns: 1fr;
  }
}

.demo-preset-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.demo-preset-card:hover {
  border-color: var(--primary);
  background: var(--primary-subtle);
  transform: translateY(-2px);
}

.demo-preset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.demo-preset-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary);
}

.demo-preset-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
}

.demo-preset-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   14. Universal Ingestion Modal
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drop-zone {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-subtle);
}

.drop-zone-icon {
  margin-bottom: 8px;
  color: var(--primary);
}

.drop-zone-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13.5px;
}

.drop-zone-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.modal-textarea {
  width: 100%;
  height: 120px;
  padding: 10px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  resize: vertical;
  outline: none;
}

.modal-textarea:focus {
  border-color: var(--primary);
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-surface-elevated);
}

/* --------------------------------------------------------------------------
   15. Bottom Status Bar & Toast
   -------------------------------------------------------------------------- */
.app-status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--statusbar-height);
  background: var(--header-bg);
  border-top: 1px solid var(--header-border);
  color: var(--header-muted);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.toast-container {
  position: fixed;
  bottom: calc(var(--statusbar-height) + 16px);
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--header-bg);
  border: 1px solid var(--header-border);
  color: var(--header-text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-elevated);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* --------------------------------------------------------------------------
   16. Footer
   -------------------------------------------------------------------------- */
.app-footer {
  margin-top: auto;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  padding: 24px 28px 20px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 24px;
  margin-bottom: 20px;
}

.footer-bottom {
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   17. Responsiveness
   -------------------------------------------------------------------------- */
@media (max-width: 1120px) {
  .charts-row-1,
  .charts-row-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .main-canvas {
    padding: 16px 16px 50px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* --------------------------------------------------------------------------
   18. PREMIUM FINTECH LANDING PAGE & 4D PERSPECTIVE SYSTEM
   -------------------------------------------------------------------------- */
.landing-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 56px;
  padding-bottom: 30px;
}

/* Background Atmosphere */
.landing-hero-wrap {
  position: relative;
  overflow: hidden;
  padding: 48px 0 32px;
  background: radial-gradient(circle at 50% -10%, var(--primary-subtle) 0%, transparent 65%);
  border-bottom: 1px solid var(--border-light);
}

.landing-hero-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(var(--border-medium) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.35;
  pointer-events: none;
}

.landing-hero {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
  padding: 0 20px;
}

.landing-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.15);
  margin-bottom: 20px;
  animation: pulseGlow 4s ease-in-out infinite;
}

.landing-badge-dot {
  width: 7px;
  height: 7px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--primary);
}

.landing-title {
  font-size: clamp(32px, 5vw, 54px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 18px;
}

.landing-title-accent {
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.landing-subtitle {
  font-size: clamp(14px, 1.8vw, 16.5px);
  color: var(--text-muted);
  max-width: 780px;
  margin: 0 auto 30px;
  line-height: 1.6;
}

.landing-cta-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 44px;
}

.btn-cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 26px;
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-cta-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(5, 150, 105, 0.45);
}

.btn-cta-demo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--demo-bg);
  border: 1px solid var(--demo-border);
  color: var(--demo-text);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-cta-demo:hover {
  background: var(--demo-accent);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.3);
}

.btn-cta-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-cta-outline:hover {
  border-color: var(--text-primary);
  background: var(--bg-hover);
  transform: translateY(-2px);
}

/* 4D Interactive Perspective Mockup Stage */
.perspective-stage-wrapper {
  position: relative;
  max-width: 1040px;
  margin: 0 auto;
  perspective: 1200px;
  padding: 20px 10px 40px;
}

.mockup-3d-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 
    0 20px 45px -15px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  transform: rotateX(7deg) rotateY(-2deg) rotateZ(0.5deg);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: visible;
}

.perspective-stage-wrapper:hover .mockup-3d-card {
  transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1.015);
  box-shadow: 
    0 30px 60px -15px rgba(0, 0, 0, 0.25),
    0 0 0 1px var(--primary-border);
}

/* Floating 4D Metric Chips around Mockup */
.floating-chip {
  position: absolute;
  z-index: 10;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.chip-top-right {
  top: -15px;
  right: -20px;
  animation: floatCard 4s ease-in-out infinite;
  border-color: var(--primary-border);
}

.chip-bottom-left {
  bottom: -15px;
  left: -20px;
  animation: floatCardAlt 4.5s ease-in-out infinite;
  border-color: var(--demo-border);
}

@media (max-width: 900px) {
  .floating-chip {
    display: none;
  }
}

/* Mockup Content Styling */
.mockup-inner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.mockup-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 720px) {
  .mockup-kpi-row {
    grid-template-columns: 1fr 1fr;
  }
}

.mockup-kpi-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: left;
}

.mockup-kpi-title {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.mockup-kpi-num {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.mockup-svg-canvas {
  width: 100%;
  height: 200px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
  position: relative;
}

/* Section: 4 Enterprise Scenarios Showcase */
.landing-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

.section-head {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 36px;
}

.section-title {
  font-size: clamp(24px, 3.2vw, 34px);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.section-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.scenarios-grid-4d {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 20px;
}

.scenario-card-4d {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.scenario-card-4d:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 16px 30px -10px rgba(5, 150, 105, 0.25);
}

.scenario-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.scenario-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary-subtle);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.scenario-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.scenario-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.scenario-card-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  font-size: 11.5px;
}

.btn-launch-scenario {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 32px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  transition: all 0.15s ease;
  margin-top: 4px;
}

.scenario-card-4d:hover .btn-launch-scenario {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Feature Pillars Grid */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
}

.pillar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
}

.pillar-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
}

.pillar-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pillar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.pillar-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Keyframe Animations */
@keyframes floatCard {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

@keyframes floatCardAlt {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(8px); }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); }
}

