/* =========================================================
   Pandu Uang Components
   Clean dark-gold premium component system.
   ========================================================= */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  color: var(--text);
}

.card.pad {
  padding: 22px;
}

.card h3 {
  margin: 0 0 15px;
  color: var(--text);
  font-weight: 900;
  letter-spacing: 0;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  color: var(--text);
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  margin-top: 8px;
  color: var(--gold-2);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0;
}

.form {
  display: grid;
  gap: 14px;
}

.form-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: #cfd6e3;
  font-size: 12px;
  font-weight: 850;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid rgba(216, 180, 106, 0.19);
  border-radius: 16px;
  outline: none;
  background: rgba(7, 10, 20, 0.86);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: #6b7280;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 4px rgba(216, 180, 106, 0.11);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.045);
  color: #7c8494;
}

.select option {
  background: #0b1020;
  color: var(--text);
}

input[type='date']::-webkit-calendar-picker-indicator {
  filter: invert(1) sepia(1) saturate(0.8) hue-rotate(350deg);
  opacity: 0.86;
}

input[type='date']:not(:disabled) {
  cursor: pointer;
}

.btn {
  position: relative;
  min-height: 44px;
  padding: 11px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(216, 180, 106, 0.2);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.btn svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.btn .mobile-label {
  display: none;
}

.btn.is-loading,
.btn.is-loading:disabled {
  cursor: wait;
  opacity: 1 !important;
  transform: none;
}

.btn.is-loading::after {
  position: absolute;
  right: 12px;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  content: '';
  animation: button-loading-spin 0.7s linear infinite;
}

@keyframes button-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(216, 180, 106, 0.10);
  border-color: rgba(216, 180, 106, 0.35);
  color: var(--gold-2);
}

.btn.primary {
  background: var(--gold-2);
  border-color: rgba(255, 255, 255, 0.08);
  color: #151007;
  box-shadow: 0 16px 34px rgba(216, 180, 106, 0.22);
}

.btn.primary:hover {
  background: #ffe7a4;
  color: #0f0b05;
  box-shadow: 0 20px 42px rgba(216, 180, 106, 0.27);
}

.btn.danger {
  background: rgba(251, 113, 133, 0.10);
  border-color: rgba(251, 113, 133, 0.32);
  color: #fecdd3;
}

.btn.danger:hover {
  background: rgba(251, 113, 133, 0.18);
  border-color: rgba(251, 113, 133, 0.50);
  color: #fff1f2;
}

.btn.pay {
  background: rgba(52, 211, 153, 0.10);
  border-color: rgba(52, 211, 153, 0.32);
  color: #bbf7d0;
}

.btn.pay:hover {
  background: rgba(52, 211, 153, 0.18);
  border-color: rgba(52, 211, 153, 0.48);
  color: #ecfdf5;
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  min-height: 34px;
  padding: 8px 13px;
  border-radius: 12px;
  font-size: 12px;
}

.icon-btn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 13px;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.filter-popover {
  position: relative;
  display: inline-flex;
  align-items: center;
  align-self: center;
  justify-content: flex-end;
  min-width: 42px;
}

.filter-popover > summary {
  list-style: none;
}

.filter-popover > summary::-webkit-details-marker {
  display: none;
}

.filter-trigger {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-color: transparent;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--soft);
}

.filter-trigger svg {
  width: 21px;
  height: 21px;
}

.filter-trigger:hover {
  border-color: transparent;
  background: transparent;
  color: var(--gold-2);
  transform: none;
}

.filter-trigger:active,
.filter-trigger:focus-visible,
.filter-popover[open] .filter-trigger {
  border-color: rgba(216, 180, 106, 0.42);
  border-radius: 999px;
  background: rgba(216, 180, 106, 0.13);
  color: var(--gold-2);
  outline: none;
}

.filter-popover-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 10010;
  width: max-content;
  max-width: min(920px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid var(--gold-border);
  border-radius: 18px;
  background: rgba(15, 19, 31, 0.99);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(20px);
}

.filter-popover-panel label,
.filter-popover-panel .btn {
  white-space: nowrap;
}

.filter-popover-panel .input,
.filter-popover-panel .select {
  min-width: 0;
}

.filter-popover:not([open]) .filter-popover-panel {
  display: none;
}

.action-menu {
  position: relative;
  display: inline-block;
}

.action-menu > summary {
  list-style: none;
}

.action-menu > summary::-webkit-details-marker {
  display: none;
}

.action-menu-trigger svg {
  width: 21px;
  height: 21px;
  display: none;
}

.action-menu-trigger {
  min-width: 88px;
}

.action-menu-popover {
  position: fixed;
  z-index: 10020;
  width: max-content;
  min-width: 190px;
  max-width: min(280px, calc(100vw - 20px));
  padding: 7px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--gold-border);
  border-radius: 15px;
  background: rgba(15, 19, 31, 0.99);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(20px);
}

.action-menu:not([open]) .action-menu-popover {
  display: none;
}

.action-menu-item {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  white-space: normal;
}

.action-menu-item:hover {
  background: rgba(216, 180, 106, 0.11);
  color: var(--gold-2);
}

.action-menu-item.danger {
  color: #fecdd3;
}

.action-menu-item.danger:hover {
  background: rgba(251, 113, 133, 0.13);
  color: #fff1f2;
}

.action-menu-item:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.action-menu-item svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.pill {
  min-height: 26px;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.pill.ok {
  color: #bbf7d0;
  border-color: rgba(52, 211, 153, 0.34);
  background: rgba(52, 211, 153, 0.11);
}

.pill.danger {
  color: #fecdd3;
  border-color: rgba(251, 113, 133, 0.34);
  background: rgba(251, 113, 133, 0.11);
}

.pill.warn {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.34);
  background: rgba(245, 158, 11, 0.11);
}

.pill.info {
  color: var(--gold-2);
  border-color: rgba(216, 180, 106, 0.34);
  background: rgba(216, 180, 106, 0.11);
}

.pill.tx-income {
  color: #bbf7d0;
  border-color: rgba(52, 211, 153, 0.38);
  background: rgba(52, 211, 153, 0.12);
}

.pill.tx-expense {
  color: #fecdd3;
  border-color: rgba(251, 113, 133, 0.38);
  background: rgba(251, 113, 133, 0.12);
}

.pill.tx-saving {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.38);
  background: rgba(251, 191, 36, 0.12);
}

.pill.tx-investment {
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, 0.4);
  background: rgba(96, 165, 250, 0.12);
}

.pill.tx-debt {
  color: #ddd6fe;
  border-color: rgba(167, 139, 250, 0.4);
  background: rgba(167, 139, 250, 0.12);
}

.pill.tx-other {
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.34);
  background: rgba(148, 163, 184, 0.1);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(8, 11, 20, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  border-spacing: 0;
  color: var(--text);
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(216, 180, 106, 0.09);
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}

th {
  height: 44px;
  background: rgba(255, 255, 255, 0.04);
  color: #b7c0ce;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  min-height: 62px;
  transition: background 0.14s ease;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.012);
}

tbody tr:hover {
  background: rgba(216, 180, 106, 0.05);
}

th:first-child,
td:first-child {
  padding-left: 20px;
}

th:last-child,
td:last-child {
  padding-right: 20px;
}

table.has-actions th:last-child,
table.has-actions td:last-child {
  width: 124px;
  min-width: 124px;
  text-align: center;
}

table.has-actions td:last-child .actions {
  width: 100%;
  justify-content: center;
}

.bank-history-table {
  min-width: 0;
}

.bank-history-table thead {
  display: none;
}

.bank-history-table,
.bank-history-table tbody {
  display: block;
  width: 100%;
}

.bank-history-table tr {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) minmax(104px, auto) minmax(136px, auto) minmax(92px, auto);
  align-items: center;
  gap: 12px;
  min-height: 82px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(216, 180, 106, 0.09);
  background: transparent;
}

.bank-history-table tr:last-child {
  border-bottom: 0;
}

.bank-history-table td {
  min-width: 0;
  padding: 0;
  border-bottom: 0;
  font-size: 13px;
  text-align: left;
  vertical-align: middle;
}

.bank-history-table td::before {
  content: none;
}

.bank-history-table td:nth-child(1) {
  grid-column: 1 / 2;
}

.bank-history-table td:nth-child(2) {
  grid-column: 2 / 3;
}

.bank-history-table td:nth-child(3) {
  grid-column: 3 / 4;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

.transaction-table.bank-history-table td:nth-child(4),
.transaction-table.bank-history-table td:nth-child(5),
.transaction-table.bank-history-table td:nth-child(7),
.transfer-table.bank-history-table td:nth-child(5) {
  display: none;
}

.transaction-table.bank-history-table td:nth-child(6),
.transfer-table.bank-history-table td:nth-child(4) {
  grid-column: 4 / 5;
  text-align: right;
}

.transaction-table.bank-history-table td:nth-child(8),
.transfer-table.bank-history-table td:nth-child(6) {
  grid-column: 5 / 6;
  width: auto;
  min-width: 92px;
  padding-right: 0;
  text-align: right;
}

.transaction-table.bank-history-table td:nth-child(8) .actions,
.transfer-table.bank-history-table td:nth-child(6) .actions {
  justify-content: flex-end;
}

.bank-history-table .action-menu-trigger {
  min-width: 88px;
}

.bank-history-icon {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.14);
  color: #5eead4;
}

.bank-history-icon::after {
  position: absolute;
  right: 0;
  bottom: 1px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--panel);
  border-radius: 999px;
  background: var(--gold-2);
  content: '';
}

.bank-history-icon.positive {
  background: rgba(52, 211, 153, 0.13);
  color: #86efac;
}

.bank-history-icon.negative {
  background: rgba(251, 113, 133, 0.12);
  color: #fda4af;
}

.bank-history-icon.transfer,
.bank-history-icon.exchange {
  background: rgba(147, 197, 253, 0.13);
  color: #93c5fd;
}

.bank-history-icon.cancelled {
  background: rgba(251, 113, 133, 0.12);
  color: #fda4af;
}

.bank-history-icon svg {
  width: 22px;
  height: 22px;
}

.bank-history-copy {
  display: grid;
  gap: 4px;
}

.bank-history-title {
  color: #dbeafe;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.25;
}

.bank-history-description {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.bank-history-amount {
  color: var(--gold-2);
  font-weight: 900;
}

.bank-history-amount.positive,
.bank-history-table .money.positive {
  color: #34d399;
}

.bank-history-amount.negative,
.bank-history-table .money.negative {
  color: #fb7185;
}

.bank-history-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  color: #7f8898;
  font-size: 11px;
  line-height: 1.35;
}

.bank-history-meta svg {
  width: 13px;
  height: 13px;
}

.bank-history-table .bank-history-main-amount,
.bank-history-table td:nth-child(6).money {
  font-size: 14px;
  font-weight: 950;
  white-space: nowrap;
}

.bank-history-empty-row {
  display: block !important;
  min-height: 0 !important;
  padding: 0 !important;
}

.bank-history-empty-row td {
  display: block !important;
  padding: 26px 18px !important;
  text-align: center !important;
}

.account-table th:nth-child(1) { width: 27%; }
.account-table th:nth-child(2) { width: 13%; }
.account-table th:nth-child(3) { width: 16%; }
.account-table th:nth-child(4) { width: 22%; }
.account-table th:nth-child(5) { width: 12%; }

.budget-table th:nth-child(1) { width: 30%; }
.budget-table th:nth-child(2) { width: 14%; }
.budget-table th:nth-child(3) { width: 18%; }
.budget-table th:nth-child(4) { width: 28%; }

.category-table th:nth-child(1) { width: 40%; }
.category-table th:nth-child(2) { width: 25%; }
.category-table th:nth-child(3) { width: 20%; }

.transaction-table th:nth-child(1) { width: 10%; }
.transaction-table th:nth-child(2) { width: 14%; }
.transaction-table th:nth-child(3) { width: 13%; }
.transaction-table th:nth-child(4) { width: 12%; }
.transaction-table th:nth-child(5) { width: 22%; }
.transaction-table th:nth-child(6) { width: 13%; }
.transaction-table th:nth-child(7) { width: 12%; }

.transaction-table .transaction-note {
  min-width: 210px;
  max-width: 360px;
  color: var(--soft);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.transaction-table .money,
.account-table .money,
.budget-table .money {
  white-space: nowrap;
}

.muted,
.support-text {
  color: var(--muted);
}

.support-text {
  margin-top: -4px;
  font-size: 12px;
  line-height: 1.55;
}

.money {
  color: var(--text);
  font-weight: 850;
  letter-spacing: 0;
  white-space: nowrap;
}

.money.negative {
  color: #fda4af;
}

.money.positive {
  color: #86efac;
}

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

.page-split {
  display: grid;
  grid-template-columns: minmax(330px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.page-split.wide {
  grid-template-columns: minmax(360px, 520px) minmax(0, 1fr);
}

.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

/* Modal system */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(3, 5, 12, 0.76);
  backdrop-filter: blur(12px);
  animation: modal-backdrop-enter 0.16s ease both;
}

.modal {
  width: min(500px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--gold-border);
  border-radius: 24px;
  background: var(--panel-2);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.56);
  color: var(--text);
  scrollbar-width: thin;
  animation: modal-enter 0.18s ease both;
}

.modal.wide {
  width: min(720px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.modal-kicker {
  margin-bottom: 4px;
  color: var(--gold-2);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.modal-title,
.modal h3 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 950;
  letter-spacing: 0;
}

.modal p {
  color: var(--muted);
  line-height: 1.6;
}

.modal-close {
  width: 36px;
  height: 36px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--text);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.inline-flow-icon {
  display: inline-flex;
  vertical-align: -0.18em;
  margin: 0 5px;
  color: var(--muted);
}

.inline-flow-icon svg {
  width: 17px;
  height: 17px;
}

.modal-close:hover {
  background: rgba(216, 180, 106, 0.12);
  color: var(--gold-2);
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.notification-modal {
  width: min(780px, 100%);
}

.notification-login-note {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(216, 180, 106, 0.26);
  border-radius: 16px;
  background: rgba(216, 180, 106, 0.09);
  color: var(--soft);
  font-size: 13px;
  line-height: 1.55;
}

.notification-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.notification-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 18px;
  background: rgba(245, 158, 11, 0.09);
}

.notification-item.is-danger {
  border-color: rgba(251, 113, 133, 0.3);
  background: rgba(251, 113, 133, 0.09);
}

.notification-item-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  color: #fde68a;
}

.notification-item.is-danger .notification-item-icon {
  color: #fecdd3;
}

.notification-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.notification-item-head strong {
  color: var(--text);
  line-height: 1.35;
}

.notification-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.notification-item-meta span {
  overflow-wrap: anywhere;
}

body.modal-open {
  overflow: hidden;
}

@keyframes modal-backdrop-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Debt/progress components */

.debt-title {
  color: var(--text);
  font-weight: 900;
}

.debt-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.debt-mobile-badges {
  display: none;
}

.progress-cell {
  min-width: 150px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(216, 180, 106, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--gold-2);
}

.progress-text {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1100px) {
  .grid.cols-4,
  .grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-split,
  .page-split.wide {
    grid-template-columns: 1fr;
  }
}
