/* ============================================
   Banco Page
   ============================================ */

.banco-page {
  padding: var(--space-6);
  max-width: 1200px;
  margin: 0 auto;
}

.banco-header {
  margin-bottom: var(--space-5);
}

.banco-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 var(--space-1);
}

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

/* ── Summary cards ── */
.banco-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.banco-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-xs);
}

.banco-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.banco-stat-card--balance .banco-stat-icon  { background: var(--blue-50);  color: var(--primary); }
.banco-stat-card--income  .banco-stat-icon  { background: var(--green-50); color: var(--success); }
.banco-stat-card--expense .banco-stat-icon  { background: var(--red-50);   color: var(--danger); }
.banco-stat-card--accounts .banco-stat-icon { background: var(--amber-50); color: var(--warning); }

.banco-stat-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.banco-stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.banco-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Content grid ── */
.banco-content-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: var(--space-4);
}

.banco-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.banco-card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.banco-card-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.btn-banco-new {
  background: var(--blue-600) !important;
  color: white !important;
  border: none !important;
  border-radius: var(--radius-md);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-banco-new:hover { background: var(--blue-700) !important; }

/* ── Accounts list ── */
.banco-accounts-list {
  padding: var(--space-2) 0;
}

.banco-account-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  cursor: pointer;
  transition: background-color 0.15s, border-left-color 0.15s;
  border-left: 3px solid transparent;
}

.banco-account-item:hover {
  background: var(--gray-50);
}

.banco-account-item--active {
  background: var(--blue-50) !important;
  border-left-color: var(--primary);
}

:root[data-theme='dark'] .banco-account-item:hover { background: rgba(30,58,110,0.2); }
:root[data-theme='dark'] .banco-account-item--active { background: rgba(37,99,235,0.12) !important; }

.banco-account-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--blue-50);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.banco-account-item--active .banco-account-icon {
  background: var(--primary);
  color: white;
}

.banco-account-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.banco-account-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banco-account-sub {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: ui-monospace, 'Cascadia Code', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banco-account-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.banco-account-balance {
  font-size: 13px;
  font-weight: 700;
  color: var(--success);
  font-variant-numeric: tabular-nums;
}

.banco-account-balance--negative { color: var(--danger); }

.banco-account-item--closed {
  opacity: 0.55;
}

.banco-account-closed-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: middle;
}

:root[data-theme='dark'] .banco-account-closed-badge {
  color: var(--gray-400);
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.12);
}

.banco-account-arrow {
  color: var(--gray-300);
  transition: color 0.15s, transform 0.15s;
}

.banco-account-item:hover .banco-account-arrow,
.banco-account-item--active .banco-account-arrow {
  color: var(--primary);
  transform: translateX(2px);
}

.btn-account-edit {
  display: none;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: transparent !important;
  border: 1px solid var(--border-color) !important;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
  padding: 0 !important;
}

.btn-account-edit svg {
  stroke: var(--gray-500);
  transition: stroke 0.15s;
  display: block;
}

.banco-account-item:hover .btn-account-edit,
.banco-account-item--active .btn-account-edit {
  display: inline-flex;
}

.btn-account-edit:hover {
  background: var(--blue-50) !important;
  border-color: var(--primary) !important;
}

.btn-account-edit:hover svg {
  stroke: var(--primary);
}

:root[data-theme='dark'] .btn-account-edit svg { stroke: var(--gray-400); }
:root[data-theme='dark'] .btn-account-edit:hover { background: rgba(37,99,235,0.15) !important; }
:root[data-theme='dark'] .btn-account-edit:hover svg { stroke: var(--blue-400, #60a5fa); }

/* ── Back button in tx header ── */
.btn-banco-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-secondary) !important;
  border-radius: var(--radius-md);
  padding: 3px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-banco-back:hover { background: var(--gray-100) !important; color: var(--text-primary) !important; }
:root[data-theme='dark'] .btn-banco-back:hover { background: rgba(30,58,110,0.3) !important; }

.banco-account-balance--negative {
  color: var(--danger);
}

/* ── Transactions list ── */
.banco-transactions-list {
  padding: var(--space-2) 0;
}

.banco-tx-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  transition: background-color var(--transition-fast);
}

.banco-tx-item:hover {
  background: var(--bg-subtle);
}

.banco-tx-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.banco-tx-indicator--credit { background: var(--success); }
.banco-tx-indicator--debit  { background: var(--danger); }

.banco-tx-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.banco-tx-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banco-tx-date {
  font-size: 11px;
  color: var(--text-secondary);
}

.banco-tx-amount {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.banco-tx-amount--credit { color: var(--success); }
.banco-tx-amount--debit  { color: var(--danger); }

/* ── Loading skeleton ── */
.banco-loading {
  padding: var(--space-3) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.banco-skeleton {
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--gray-100) 50%, var(--bg-subtle) 75%);
  background-size: 200% 100%;
  animation: banco-shimmer 1.4s ease infinite;
}

@keyframes banco-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Empty state ── */
.banco-empty {
  padding: var(--space-8) var(--space-5);
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.banco-soon-tag {
  display: inline-block;
  background: var(--amber-50);
  color: var(--warning);
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  letter-spacing: 0.04em;
}

/* ── Dark mode ── */
:root[data-theme='dark'] .banco-stat-card,
:root[data-theme='dark'] .banco-card {
  background: #081226;
  border-color: #1e2f4d;
}

:root[data-theme='dark'] .banco-card-header {
  border-color: #1e2f4d;
}

:root[data-theme='dark'] .banco-account-icon {
  background: rgba(30, 58, 110, 0.4);
}

:root[data-theme='dark'] .banco-account-item--active .banco-account-icon {
  background: var(--primary);
}

:root[data-theme='dark'] .banco-stat-card--balance .banco-stat-icon  { background: rgba(37, 99, 235, 0.15); }
:root[data-theme='dark'] .banco-stat-card--income  .banco-stat-icon  { background: rgba(22, 163, 74, 0.15); }
:root[data-theme='dark'] .banco-stat-card--expense .banco-stat-icon  { background: rgba(220, 38, 38, 0.15); }
:root[data-theme='dark'] .banco-stat-card--accounts .banco-stat-icon { background: rgba(217, 119, 6, 0.15); }

:root[data-theme='dark'] .banco-skeleton {
  background: linear-gradient(90deg, rgba(15,23,42,0.8) 25%, rgba(30,47,77,0.8) 50%, rgba(15,23,42,0.8) 75%);
  background-size: 200% 100%;
}

:root[data-theme='dark'] .banco-soon-tag {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.3);
  color: #fbbf24;
}

/* ── Create account modal ── */
.banco-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
  backdrop-filter: blur(2px);
}

.banco-modal {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  animation: fadeScaleIn 0.15s ease;
}

@keyframes fadeScaleIn {
  from { opacity: 0; transform: scale(0.97) translateY(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

.banco-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border-color);
  gap: var(--space-3);
}

.banco-modal-title-group {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.banco-modal-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--blue-50);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.banco-modal-icon--edit {
  background: #f0fdf4;
  color: #16a34a;
}

:root[data-theme='dark'] .banco-modal-icon--edit {
  background: rgba(22,163,74,0.12);
  color: #4ade80;
}

.banco-modal-header h2 {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.banco-modal-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.banco-modal-close {
  background: none !important;
  border: none !important;
  color: var(--text-tertiary, var(--gray-400));
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.banco-modal-close:hover { background: var(--gray-100) !important; color: var(--text-primary); }

.banco-modal-form { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }

/* ── Form sections ── */
.banco-form-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.banco-form-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.banco-form-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.banco-form-section-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  color: var(--text-tertiary, var(--gray-400));
}

.banco-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.banco-form-field { display: flex; flex-direction: column; gap: 5px; }
.banco-form-field--full { grid-column: 1 / -1; }

.banco-form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.banco-form-label .required { color: var(--danger); margin-left: 1px; }

.banco-form-input {
  padding: 8px var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  background: var(--card-bg);
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.banco-form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.banco-form-input::placeholder { color: var(--gray-400); }

select.banco-form-input { cursor: pointer; }

.banco-modal-footer {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  align-items: center;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-color);
}

.btn-banco-cancel {
  background: transparent !important;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md);
  padding: 8px 18px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-banco-cancel:hover { background: var(--gray-50) !important; color: var(--text-primary) !important; }

.btn-banco-submit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue-600) !important;
  color: white !important;
  border: none !important;
  border-radius: var(--radius-md);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-banco-submit:hover:not(:disabled) {
  background: var(--blue-700) !important;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}
.btn-banco-submit:disabled { opacity: 0.65; cursor: not-allowed; }

:root[data-theme='dark'] .banco-modal { background: #0d1a2e; border-color: #1e2f4d; }
:root[data-theme='dark'] .banco-modal-header { border-color: #1e2f4d; }
:root[data-theme='dark'] .banco-modal-footer { border-color: #1e2f4d; }
:root[data-theme='dark'] .banco-modal-icon { background: rgba(37,99,235,0.15); }
:root[data-theme='dark'] .banco-form-section-label::after { background: #1e2f4d; }
:root[data-theme='dark'] .banco-form-input { background: #081226; border-color: #1e2f4d; }
:root[data-theme='dark'] .banco-form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
:root[data-theme='dark'] .banco-modal-close:hover { background: rgba(30,58,110,0.3) !important; }
:root[data-theme='dark'] .btn-banco-cancel:hover { background: rgba(30,47,77,0.5) !important; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .banco-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .banco-content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .banco-page { padding: var(--space-3); }
  .banco-summary-grid { grid-template-columns: 1fr 1fr; }
}
