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

:root {
  --bg-primary: #f8fafc;       /* Light, clean slate background */
  --bg-card: #ffffff;          /* Crisp white cards */
  --border-color: #e2e8f0;     /* Soft slate border */
  --accent-color: #0f172a;     /* Professional deep slate blue */
  --accent-hover: #1e293b;
  --text-primary: #0f172a;     /* High legibility dark text */
  --text-secondary: #475569;   /* Subtle description text */
  --color-success: #15803d;    /* Deep forest green for credits */
  --color-error: #b91c1c;      /* Crimson red for debits */
  --color-system: #b45309;     /* Corporate amber */
}

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

body, input, button, select, textarea {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 40px 20px;
}

/* Mobile-first base layout styles */
.main-dashboard {
  display: flex;
  flex-direction: column;
  width: 100%;
  align-items: stretch;
}

.sidebar-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ledger-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Desktop-only viewport height locking layout */
@media (min-width: 900px) {
  html.one-page-html,
  body.one-page {
    height: 100vh;
    overflow: hidden;
    padding: 0;
    min-height: unset;
    justify-content: flex-start;
    align-items: stretch;
  }

  body.one-page {
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  body.one-page > .container {
    flex: 1;
    max-width: 100% !important;
    padding:  2px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
  }

  .main-dashboard {
    flex: 1;
    overflow: hidden;
    min-height: 0;
  }

  .main-dashboard header {
    flex-shrink: 0;
    margin-bottom: 12px;
  }

  .main-dashboard .dashboard-grid {
    flex: 1;
    overflow: hidden;
    min-height: 0;
    gap: 16px;
    padding: 0 20px 20px 20px;
  }

  .sidebar-col {
    overflow-y: auto;
    min-height: 0;
    padding-right: 4px;
  }

  .ledger-panel {
    min-height: 0;
    overflow: hidden;
  }

  .ledger-table-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    max-height: none !important;
  }
}

/* Sidebar scrollbar styles */
.sidebar-col::-webkit-scrollbar {
  width: 4px;
}
.sidebar-col::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Mobile-first table container horizontal scrolling rules */
.ledger-table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Ledger Panel Header */
.ledger-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

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

/* Stat Chips Bar */
.ledger-stats-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
}

.ledger-stat {
  display: flex;
  flex-direction: column;
  padding: 7px 18px;
  flex: 1;
  min-width: 0;
}

.ledger-stat-sep {
  width: 1px;
  height: 34px;
  background: var(--border-color);
  flex-shrink: 0;
}

.lstat-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  white-space: nowrap;
}

.lstat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.ledger-stat--debit .lstat-value { color: var(--color-error); }
.ledger-stat--credit .lstat-value { color: var(--color-success); }


/* Ledger Panel Header (column: heading row, then filter row) */
.ledger-panel-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.ledger-filter-controls {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

/* Base container (non-one-page) */
.container {
  width: 100%;
  max-width: 1200px;
}

/* Corporate Header */
header {
  background: var(--bg-card);
  border: none;
  border-radius: 0;
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  box-sizing: border-box;

  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.05);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  background: var(--accent-color);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #ffffff;
}

.brand-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.auth-badge {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-tag {
  background: #f1f5f9;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background-color: var(--accent-color);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.btn-danger {
  background-color: #ffffff;
  color: #dc2626;
  border-color: #fee2e2;
}

.btn-danger:hover {
  background-color: #fef2f2;
  border-color: #fca5a5;
  transform: translateY(-1px);
}

/* Dashboard Panel Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

@media (min-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 360px 1fr;
    align-items: stretch;
  }
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

/* Auth Section */
.auth-panel {
  max-width: 420px;
  width: 100%;
  margin: 60px auto;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}

.auth-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 4px 24px rgba(15,23,42,0.08), 0 1px 4px rgba(15,23,42,0.04);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--accent-color);
  border-radius: 14px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(15,23,42,0.18);
}

.auth-logo-wrap span {
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -1px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin: 0 0 4px 0;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 0 0;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}


.auth-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 9px;
  cursor: pointer;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.auth-tab.active {
  background: #ffffff;
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.form-input {
  font-family: inherit;
  font-size: 14px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.06);
}

/* Account Info Cards */
.account-card {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
}

.balance-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.balance-amount {
  font-size: 28px;
  font-weight: 700;
  margin: 4px 0;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.balance-currency {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.account-id {
  font-family: monospace;
  font-size: 11px;
  color: var(--text-secondary);
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 8px;
}

/* Statement Tables */
.table-container {
  overflow-x: auto;
  max-height: 520px;
  overflow-y: auto;
  position: relative;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.statement-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 13px;
}

.statement-table thead th {
  position: sticky;
  top: 0;
  padding: 12px 14px;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background-color: #f8fafc;
  z-index: 20;
}

.statement-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: var(--text-primary);
}

.statement-table tr:hover td {
  background: #f8fafc;
}

/* Sticky Footer styling */
.statement-table tfoot {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: #ffffff;
  isolation: isolate;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.07);
}

.statement-table tfoot td {
  background-color: #ffffff;
  border-top: 2px solid var(--border-color);
  border-bottom: none;
}

.statement-table tfoot tr:hover td {
  background: #ffffff !important;
}

/* Notification Banners */
.notification {
  position: fixed;
  top: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  border-radius: 8px;
  padding: 14px 20px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  z-index: 999999;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  animation: slideDown 0.25s ease;
}

@keyframes slideDown {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Custom Styled Searchable Dropdown Selector */
.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.custom-select-input {
  width: 100%;
  padding-right: 36px !important;
}

.custom-select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  transition: transform 0.2s ease;
  
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-select-wrapper.open .custom-select-arrow {
  transform: translateY(-50%) rotate(180deg);
}

.custom-select-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 9999;
  margin-top: 6px;
  padding: 4px 0;
  list-style: none;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.12), 0 4px 10px -4px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
}

.custom-select-option {
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.custom-select-option:hover {
  background-color: #f1f5f9;
  color: var(--accent-color);
}

.custom-select-option.selected {
  background-color: #e2e8f0;
  font-weight: 600;
}

/* Segmented Control Switch for UI Tabs/Directions */
.segmented-control {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  border: 1px solid #cbd5e1;
  margin-top: 4px;
}

.segmented-control input[type="radio"] {
  display: none !important;
}

.segmented-control .segment-label {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  text-transform: none;
  letter-spacing: normal;
  display: block;
}

.segmented-control input[type="radio"]:checked + .segment-label {
  background: #ffffff;
  color: var(--accent-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Header Filter Section (user selector + date range + stats) */
.header-filter-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  max-width: 620px;
  margin: 0 20px;
}

.header-filter-section .form-group label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
}

/* Entry Preview Box inside Fund Transfer */
.inject-preview-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 2px;
}

.inject-preview-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #15803d;
  margin-bottom: 8px;
}

.inject-preview-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: center;
}

.preview-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.preview-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
}

/* Header Balance Badge */
.header-balance-badge {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  margin-left: 16px;
}

.hbb-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 14px;
  min-width: 100px;
}

.hbb-divider {
  width: 1px;
  height: 32px;
  background: var(--border-color);
  flex-shrink: 0;
}

.hbb-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.hbb-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.2;
  white-space: nowrap;
}

.hbb-currency {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
}

.hbb-holder {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  line-height: 1.2;
}

/* Modal overlay with backdrop blur */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

/* Modal container styling */
.modal-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-overlay.open .modal-container {
  transform: translateY(0) scale(1);
}

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

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

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 20px;
  line-height: 1;
}

.modal-close-btn:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Action button icons styling */
.btn-icon {
  background: none;
  border: none;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.btn-icon.btn-edit:hover {
  color: #3b82f6;
  background: #eff6ff;
}

.btn-icon.btn-delete:hover {
  background: #fee2e2;
  color: var(--color-error);
}

/* Actions column toggling */
.actions-col {
  display: none;
}
body.is-system .actions-col {
  display: table-cell;
}

/* -----------------------------------------
   Responsive Layout & CSS Media Overrides
   ----------------------------------------- */
@media (max-width: 900px) {
  body {
    padding: 0;
  }

  .container {
    padding: 0;
  }

  .main-dashboard .dashboard-grid {
    padding: 0 0 20px 0;
  }
}

@media (max-width: 768px) {
  /* Single horizontal row — no wrapping */
  header {
    flex-wrap: nowrap !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 8px 12px !important;
    gap: 8px !important;
  }

  #header-filter-section {
    display: none !important;
  }

  /* Brand: just the logo on mobile, hide the name */
  .brand-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
    font-size: 12px;
    flex-shrink: 0;
    border-radius: 8px;
  }

  /* Hide the user name text — initials in logo are enough */
  .brand-name {
    display: none;
  }

  /* Balance badge — compact pill showing amount only */
  #header-balance-badge {
    flex: 1 !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-color) !important;
    background: #f8fafc !important;
    overflow: hidden !important;
  }

  /* Hide label text and account holder — show only the number */
  .header-balance-badge .hbb-label {
    display: none;
  }

  .header-balance-badge .hbb-divider {
    display: none;
  }

  .header-balance-badge .hbb-inner:last-of-type {
    display: none;
  }

  .header-balance-badge .hbb-inner {
    padding: 6px 12px;
    flex: 1;
  }

  .header-balance-badge .hbb-amount {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--text-primary);
  }

  /* Auth buttons on the right */
  .auth-badge {
    margin-left: 0 !important;
    flex-shrink: 0;
    gap: 4px !important;
  }

  /* System-only buttons: icon-only square on mobile */
  .system-only-btn {
    padding: 6px 8px !important;
    min-width: 32px;
    justify-content: center;
  }

  /* Hide button label text on mobile — icon only */
  .btn-label-text {
    display: none;
  }

  .auth-badge .btn {
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .panel {
    padding: 16px;
  }

  /* Auth panel on mobile */
  .auth-panel {
    margin: 24px auto;
  }

  .auth-card {
    padding: 28px 20px;
    border-radius: 16px;
  }
}






@media (max-width: 600px) {
  .ledger-filter-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .ledger-filter-controls .form-group {
    width: 100% !important;
    min-width: 0 !important;
  }

  .ledger-filter-controls .form-input {
    width: 100% !important;
  }

  .ledger-stats-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .ledger-stat-sep {
    width: 100%;
    height: 1px;
  }

  .ledger-stat {
    padding: 8px 12px;
    text-align: center;
  }
}

@media (max-width: 540px) {
  .modal-container {
    margin: 16px;
    max-width: calc(100% - 32px);
  }
}

