/* Account Tree */
.account-tree {
  padding: 4px 0;
  font-size: 0.8125rem;
  user-select: none;
}
.tree-node { position: relative; }
.tree-node-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--gray-700);
}
.tree-node-header:hover { background: var(--gray-50); }
.tree-node-header.selected { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.tree-node-header .tree-toggle {
  width: 16px;
  text-align: center;
  font-size: 0.625rem;
  color: var(--gray-400);
  flex-shrink: 0;
  transition: transform 0.15s;
}
.tree-node-header .tree-toggle.expanded { transform: rotate(90deg); }
.tree-node-header .tree-toggle.no-children { visibility: hidden; }
.tree-node-header .tree-icon {
  width: 16px;
  text-align: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.tree-node-header .tree-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-node-header .tree-balance {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gray-400);
  white-space: nowrap;
}
.tree-node-children { display: none; }
.tree-node-children.open { display: block; }
.tree-node.level-1 .tree-node-header { padding-left: 16px; }
.tree-node.level-2 .tree-node-header { padding-left: 32px; }
.tree-node.level-3 .tree-node-header { padding-left: 48px; }
.tree-node.level-4 .tree-node-header { padding-left: 64px; }

/* Voucher Entry Grid */
.voucher-grid { width: 100%; }
.voucher-grid th {
  padding: 6px 10px;
  font-size: 0.6875rem;
  text-align: left;
  border-bottom: 2px solid var(--gray-200);
  background: var(--gray-50);
  white-space: nowrap;
}
.voucher-grid td { padding: 4px 6px; vertical-align: top; }
.voucher-grid .row-num {
  text-align: center;
  color: var(--gray-400);
  font-size: 0.75rem;
  width: 28px;
}

.voucher-ledger-select {
  min-width: 180px;
  font-size: 0.8125rem;
  padding: 4px 6px;
  height: 30px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  width: 100%;
  font-family: inherit;
}
.voucher-ledger-select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px rgba(26,86,219,0.15); }

.ledger-search-wrapper {
  position: relative;
  width: 100%;
  min-width: 200px;
}
.voucher-ledger-search-input {
  width: 100%;
  font-size: 0.8125rem;
  padding: 4px 24px 4px 8px;
  height: 30px;
  border: 1px solid var(--gray-300, #cbd5e1);
  border-radius: var(--radius-sm, 6px);
  font-family: inherit;
  background-color: #ffffff;
}
.voucher-ledger-search-input:focus {
  border-color: var(--primary, #1a56db);
  outline: none;
  box-shadow: 0 0 0 2px rgba(26,86,219,0.15);
}
.ledger-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--gray-400, #94a3b8);
  font-size: 0.875rem;
  display: none;
  z-index: 2;
  line-height: 1;
}
.ledger-search-clear:hover {
  color: var(--danger, #ef4444);
}
.ledger-suggestions-dropdown {
  position: fixed;
  z-index: 999999;
  max-height: 240px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  display: none;
}
.ledger-suggestion-item {
  padding: 8px 12px;
  font-size: 0.8125rem;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.ledger-suggestion-item:last-child {
  border-bottom: none;
}
.ledger-suggestion-item:hover,
.ledger-suggestion-item.active {
  background-color: #eff6ff;
  color: #1d4ed8;
}
.ledger-code-badge {
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 2px 6px;
  background-color: #e0e7ff;
  color: #3730a3;
  border-radius: 4px;
  display: inline-block;
}
.voucher-desc-input {
  width: 100%;
  min-width: 120px;
  font-size: 0.8125rem;
  padding: 4px 6px;
  height: 30px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-family: inherit;
}
.voucher-desc-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px rgba(26,86,219,0.15); }
.voucher-amount-input {
  width: 120px;
  font-size: 0.8125rem;
  padding: 4px 6px;
  height: 30px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  text-align: right;
  font-family: var(--font-mono);
}
.voucher-amount-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px rgba(26,86,219,0.15); }
.voucher-remove-btn {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
  font-size: 1rem;
  border-radius: var(--radius-sm);
}
.voucher-remove-btn:hover { color: var(--danger); background: var(--danger-light); }

.voucher-totals {
  background: var(--gray-50);
  font-weight: 600;
}
.voucher-totals td { padding: 8px 10px; border-top: 2px solid var(--gray-300); }

/* ── Item Grid Clean Mode ─────────────────────────────── */
.item-clean-grid th {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 6px 5px;
  white-space: nowrap;
  background: #f8fafc;
  color: var(--gray-700);
}
.item-clean-grid td {
  padding: 5px 4px;
  vertical-align: middle;
  border-bottom: 1px solid var(--gray-200);
}
.item-clean-grid .voucher-desc-input {
  min-width: 0;
  font-size: 0.8125rem;
  padding: 4px 6px;
  height: 32px;
  border-radius: 4px;
}
.item-clean-grid .voucher-amount-input {
  width: 100%;
  font-size: 0.8125rem;
  padding: 4px 6px;
  height: 32px;
  border-radius: 4px;
}

/* Primary row: smooth highlight when focused */
.item-primary-row:hover {
  background: #f8fafc;
}
.item-primary-row:focus-within {
  background: #f0f6ff;
}
.item-primary-row:focus-within .row-num {
  color: var(--primary);
  font-weight: 700;
}

/* kbd hint styling */
kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background: #f1f3f5;
  font-size: 0.625rem;
  font-family: var(--font-mono);
  color: #495057;
  line-height: 1.6;
}


/* Account Detail Panel */
.account-detail-panel { padding: 0; }
.account-detail-header {
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
}
.account-detail-name { font-size: 1.125rem; font-weight: 600; color: var(--gray-900); margin-bottom: 2px; }
.account-detail-code { font-size: 0.75rem; color: var(--gray-400); }
.account-detail-body { padding: 16px; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.detail-item { }
.detail-item .detail-label { font-size: 0.6875rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 2px; }
.detail-item .detail-value { font-size: 0.875rem; color: var(--gray-800); font-weight: 500; }

/* Summary Cards Row */
.summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.summary-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.summary-card .summary-label {
  font-size: 0.6875rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}
.summary-card .summary-value {
  font-size: 1.125rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--gray-900);
}

/* Date Group Header */
.date-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
}
.date-group-header:first-child { border-top: none; }
.date-group-header .date-label { flex: 1; }
.date-group-header .date-total { font-family: var(--font-mono); font-weight: 500; font-size: 0.75rem; color: var(--gray-500); }

/* Reconciliation Panel */
.recon-panel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  min-height: 400px;
}
.recon-side {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}
.recon-side-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.recon-side-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}
.recon-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.1s;
  font-size: 0.8125rem;
}
.recon-item:hover { border-color: var(--primary); }
.recon-item.selected { border-color: var(--primary); background: var(--primary-light); }
.recon-item.matched { border-color: var(--success); background: var(--success-light); opacity: 0.7; }
.recon-item .recon-amount { font-family: var(--font-mono); font-weight: 600; margin-left: auto; }

.recon-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Period Lock Grid */
.period-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.period-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.1s;
}
.period-card:hover { border-color: var(--primary); }
.period-card.locked { border-color: var(--warning); background: var(--warning-light); }
.period-card.unlocked { border-color: var(--success); background: var(--success-light); }
.period-card .period-month { font-size: 0.75rem; font-weight: 600; color: var(--gray-700); }
.period-card .period-status { font-size: 0.625rem; margin-top: 2px; }

/* Premium Dropdown Component */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle::after {
  content: '';
  display: inline-block;
  margin-left: 0.35em;
  vertical-align: 0.2em;
  border-top: 0.3em solid;
  border-right: 0.3em solid transparent;
  border-bottom: 0;
  border-left: 0.3em solid transparent;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1050;
  min-width: 175px;
  padding: 6px 0;
  margin-top: 4px;
  margin-left: 0;
  list-style: none !important;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.dropdown-menu.dropdown-menu-end {
  right: 0;
  left: auto;
}

.dropdown-menu.show {
  display: block !important;
}

.dropdown-menu li {
  margin: 0;
  padding: 0;
  list-style: none !important;
}

.dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 14px;
  clear: both;
  font-weight: 500;
  font-size: 0.825rem;
  color: #334155;
  text-align: inherit;
  text-decoration: none !important;
  white-space: nowrap;
  background-color: transparent;
  border: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropdown-item:hover, .dropdown-item:focus {
  color: #0f172a;
  background-color: #f1f5f9;
  text-decoration: none !important;
}

.dropdown-item i {
  font-size: 1rem;
  line-height: 1;
}
