/* ==========================================================
   GENERAL LEDGER — PAGE STYLES
   ========================================================== */

/* ---- Filter bar ---- */
.gl-filter-bar {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}
.gl-filter-field { display: flex; flex-direction: column; gap: 6px; }
.gl-filter-field label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-soft);
}
.gl-filter-field select,
.gl-filter-field input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.gl-filter-field select:focus,
.gl-filter-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: var(--surface);
}
.gl-filter-actions { display: flex; gap: 8px; }

/* ---- Account picker combo (searchable) ---- */
.gl-account-combo { position: relative; }
.gl-account-combo input { width: 100%; }
.gl-account-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 260px;
  overflow-y: auto;
  z-index: 60;
  display: none;
}
.gl-account-dropdown.open { display: block; }
.gl-account-option {
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.gl-account-option:last-child { border-bottom: none; }
.gl-account-option:hover, .gl-account-option.highlighted { background: var(--primary-light); }
.gl-account-option .code { color: var(--text-faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.gl-account-option .type-tag {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  padding: 2px 8px; border-radius: 20px; align-self: center;
}

/* ---- Summary strip (opening / closing / totals) ---- */
.gl-summary-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
.gl-summary-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}
.gl-summary-box:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.gl-summary-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--text-soft);
}
.gl-summary-value { margin: 6px 0 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gl-summary-box.opening .gl-summary-value { color: var(--text); }
.gl-summary-box.debit .gl-summary-value { color: var(--primary-dark); }
.gl-summary-box.credit .gl-summary-value { color: var(--emerald-dark); }
.gl-summary-box.closing { background: var(--primary-light); border-color: var(--primary); }
.gl-summary-box.closing .gl-summary-value { color: var(--primary-dark); }
.gl-summary-box.count .gl-summary-value { color: var(--text-soft); }

/* ---- Account context header shown above the ledger table ---- */
.gl-account-context {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.gl-account-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.gl-account-context-meta strong { display: block; font-size: 14.5px; }
.gl-account-context-meta span { font-size: 12px; color: var(--text-faint); }

/* ---- Ledger table ---- */
.gl-table-wrap { overflow-x: auto; }
table.gl-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 980px; }
.gl-table thead th {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface-2);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-soft);
  border-bottom: 2px solid var(--border-strong);
  white-space: nowrap;
}
.gl-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.gl-table tbody tr:hover { background: var(--surface-2); }
.gl-table .text-right { text-align: right; font-variant-numeric: tabular-nums; }
.gl-table .row-opening td { background: var(--surface-2); font-weight: 700; }
.gl-table .row-closing td { background: var(--primary-light); font-weight: 700; color: var(--primary-dark); }
.gl-table .running-balance { font-weight: 700; }
.gl-table .running-balance.negative { color: var(--danger); }

.gl-voucher-link {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.gl-voucher-link:hover { text-decoration: underline; }

.gl-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 60px 20px;
  color: var(--text-faint);
  text-align: center;
}
.gl-empty-state i { font-size: 34px; opacity: 0.5; }
.gl-empty-state strong { color: var(--text-soft); font-size: 14px; }

/* ---- Print styles ---- */
@media print {
  .sidebar, .topbar, .page-header-actions, .gl-filter-bar, .footer,
  .sidebar-backdrop, .toast-container, .btn { display: none !important; }
  .main-area, .content-scroll { overflow: visible !important; height: auto !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; margin: 0 0 16px !important; }
}

/* ---- Responsive ---- */
@media (max-width: 1366px) {
  .gl-filter-bar { grid-template-columns: repeat(3, 1fr); }
  .gl-summary-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .gl-filter-bar { grid-template-columns: 1fr 1fr; }
  .gl-summary-strip { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .gl-filter-bar { grid-template-columns: 1fr; }
  .gl-summary-strip { grid-template-columns: 1fr; }
}