/* Reusable UI Components Styling */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1.25;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-700));
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: white;
  color: var(--color-slate-700);
  border-color: var(--color-slate-300);
}
.btn-secondary:hover {
  background: var(--color-slate-50);
  color: var(--color-slate-900);
  border-color: var(--color-slate-400);
}

.btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}
.btn-danger:hover {
  background: #dc2626;
  color: white;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--color-slate-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.125rem;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-slate-700);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-family: var(--font-family);
  font-size: 0.875rem;
  color: var(--color-slate-900);
  background: #ffffff;
  border: 1px solid var(--color-slate-300);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.currency-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-prefix {
  position: absolute;
  left: 0.875rem;
  font-weight: 700;
  color: var(--color-slate-500);
  font-size: 0.9375rem;
  pointer-events: none;
}

.currency-input {
  padding-left: 2.5rem !important;
  font-size: 1.125rem !important;
  font-weight: 700 !important;
  color: var(--color-slate-900) !important;
}

/* Quick Nominal Presets */
.quick-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.preset-chip {
  padding: 0.25rem 0.625rem;
  background: var(--color-slate-100);
  border: 1px solid var(--color-slate-200);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-slate-700);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.preset-chip:hover {
  background: var(--color-primary-50);
  border-color: var(--color-primary-300);
  color: var(--color-primary-700);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.badge-income {
  background: var(--color-income-light);
  color: var(--color-income);
  border: 1px solid var(--color-income-border);
}

.badge-expense {
  background: var(--color-expense-light);
  color: var(--color-expense);
  border: 1px solid var(--color-expense-border);
}

.badge-transfer {
  background: var(--color-transfer-light);
  color: var(--color-transfer);
  border: 1px solid var(--color-transfer-border);
}

.badge-verified {
  background: #f0fdf4;
  color: #15803d;
}

.badge-cancelled {
  background: #fef2f2;
  color: #991b1b;
  text-decoration: line-through;
}

/* Type Segmented Control */
.type-segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.375rem;
  background: var(--color-slate-100);
  padding: 0.375rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
}

.segment-btn {
  padding: 0.625rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-slate-600);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}

.segment-btn.active.type-expense {
  background: var(--color-expense);
  color: white;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.3);
}

.segment-btn.active.type-income {
  background: var(--color-income);
  color: white;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.segment-btn.active.type-transfer {
  background: var(--color-transfer);
  color: white;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

/* Modal Framework */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn var(--transition-fast) forwards;
}

.modal-container {
  background: white;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalPop var(--transition-bounce) forwards;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-slate-900);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--color-slate-400);
  cursor: pointer;
  padding: 0.375rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close-btn:hover {
  background: var(--color-slate-100);
  color: var(--color-slate-700);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--color-slate-50);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 380px;
  padding: 0.875rem 1.125rem;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-left: 4px solid var(--color-primary-500);
  animation: slideInRight var(--transition-bounce);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-slate-800);
}

.toast-success {
  border-left-color: var(--color-primary-500);
}
.toast-error {
  border-left-color: var(--color-expense);
}
.toast-info {
  border-left-color: var(--color-transfer);
}

/* Progress Bar */
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--color-slate-100);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 400ms ease-out;
}

.progress-safe {
  background: linear-gradient(90deg, #10b981, #059669);
}
.progress-warning {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}
.progress-danger {
  background: linear-gradient(90deg, #f43f5e, #e11d48);
}

/* Empty State */
.empty-state {
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--color-slate-100);
  color: var(--color-slate-400);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-slate-800);
  margin-bottom: 0.375rem;
}

.empty-state-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: 1.25rem;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* Mobile overflow menu */
.mobile-more-intro {
  margin-bottom: 0.875rem;
  padding: 0.75rem;
  background: var(--color-primary-50);
  color: var(--color-primary-800);
  border: 1px solid var(--color-primary-200);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  line-height: 1.45;
}

.mobile-more-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.625rem;
}

.mobile-more-menu-item {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: white;
  color: var(--color-slate-800);
  border: 1px solid var(--color-slate-200);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  cursor: pointer;
  text-align: left;
}

.mobile-more-menu-item.active {
  background: var(--color-primary-50);
  border-color: var(--color-primary-300);
}

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

.mobile-more-icon.purple { background:#ede9fe; color:#7c3aed; }
.mobile-more-icon.orange { background:#ffedd5; color:#ea580c; }
.mobile-more-icon.blue { background:#dbeafe; color:#2563eb; }
.mobile-more-icon.slate { background:#e2e8f0; color:#475569; }

.mobile-more-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mobile-more-copy strong {
  font-size: 0.875rem;
  color: var(--color-slate-900);
}

.mobile-more-copy small {
  margin-top: 0.125rem;
  color: var(--text-muted);
  font-size: 0.6875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-more-chevron {
  flex-shrink: 0;
  color: var(--color-slate-400);
  font-size: 1.5rem;
  line-height: 1;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

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

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

@media (max-width: 640px) {
  .card {
    min-width: 0;
    padding: 1rem;
    border-radius: var(--radius-md);
  }

  .card-header {
    align-items: flex-start;
    gap: 0.75rem;
  }

  .card-title {
    min-width: 0;
    font-size: 1rem;
  }

  .btn {
    min-height: 42px;
    padding-inline: 0.875rem;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-container {
    max-width: none;
    max-height: min(92dvh, 92vh);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-title {
    min-width: 0;
    font-size: 1rem;
    line-height: 1.35;
  }

  .modal-body {
    padding: 1rem;
    overscroll-behavior: contain;
  }

  .modal-body [style*="grid-template-columns"]:not(.mobile-nav-sheet-grid):not(.mobile-sheet-features-grid) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .modal-footer {
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
  }

  .type-segmented-control {
    gap: 0.25rem;
    padding: 0.25rem;
  }

  .segment-btn {
    min-width: 0;
    padding: 0.625rem 0.25rem;
    font-size: 0.75rem;
    gap: 0.25rem;
  }

  #toast-container {
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
  }

  .toast {
    width: 100%;
    min-width: 0;
    max-width: none;
  }
}
/* Access & licensing prototype */
.access-page{min-height:100dvh;display:grid;grid-template-columns:minmax(320px,45%) 1fr;background:#f8fafc;color:#0f172a}
.access-brand-panel{padding:clamp(2.5rem,6vw,6rem);background:linear-gradient(145deg,#047857,#059669 55%,#10b981);color:#fff;display:flex;flex-direction:column;justify-content:center;gap:2rem;position:relative;overflow:hidden}
.access-brand-panel:after{content:"";position:absolute;width:360px;height:360px;border:70px solid rgba(255,255,255,.08);border-radius:50%;right:-170px;bottom:-150px}
.access-brand-mark{width:58px;height:58px;border-radius:18px;background:#fff;color:#059669;display:grid;place-items:center;font-size:2rem;font-weight:900;box-shadow:0 14px 35px rgba(0,0,0,.15)}
.access-brand-copy span{font-size:.75rem;letter-spacing:.18em;font-weight:800;opacity:.85}
.access-brand-copy h1{font-size:clamp(2rem,3.5vw,3.5rem);line-height:1.08;margin:1rem 0;max-width:620px}
.access-brand-copy p{font-size:1rem;line-height:1.7;max-width:540px;opacity:.9}
.access-trust-list{display:grid;gap:.8rem;font-size:.9rem;font-weight:700}
.access-card-wrap{display:grid;place-items:center;padding:clamp(1rem,5vw,4rem)}
.access-card{width:min(100%,520px);background:#fff;border:1px solid #e2e8f0;border-radius:24px;padding:clamp(1.25rem,4vw,2.5rem);box-shadow:0 24px 60px rgba(15,23,42,.09)}
.access-mobile-brand{display:none;align-items:center;gap:.6rem;color:#047857;font-weight:800;margin-bottom:1.5rem}.access-mobile-brand span{font-size:1.5rem}
.access-heading h2{font-size:1.75rem;margin:0 0 .4rem}.access-heading p{color:#64748b;line-height:1.55;margin:0 0 1.5rem}
.access-form{display:grid;gap:1rem}.access-form label{display:grid;gap:.45rem;font-size:.82rem;font-weight:750;color:#334155}
.access-form input,.access-form select{width:100%;min-height:48px;border:1px solid #cbd5e1;border-radius:12px;padding:.75rem .9rem;font:inherit;color:#0f172a;background:#fff;outline:none}
.access-form input:focus,.access-form select:focus{border-color:#10b981;box-shadow:0 0 0 3px rgba(16,185,129,.13)}
.access-form .access-consent{display:flex;align-items:flex-start;gap:.65rem;line-height:1.45}.access-consent input{width:18px;min-height:18px;margin-top:.15rem}
.access-primary,.access-google{min-height:48px;border-radius:12px;border:0;padding:.75rem 1rem;font:inherit;font-weight:800;cursor:pointer}.access-primary{background:#059669;color:#fff}.access-primary:hover{background:#047857}
.access-google{width:100%;background:#fff;border:1px solid #cbd5e1;color:#334155}.access-google:disabled{opacity:.65;cursor:not-allowed}.access-google small{font-weight:600;color:#64748b}
.access-google-host{min-height:48px;display:flex;justify-content:center;margin:.5rem 0}.access-google-host>div{max-width:100%}.access-demo-details{margin-top:1rem;border-top:1px solid #e2e8f0;padding-top:.8rem}.access-demo-details summary{cursor:pointer;color:#64748b;font-size:.78rem;text-align:center;margin-bottom:1rem}
.access-link,.access-switch button,.access-admin-entry,.access-back{border:0;background:transparent;color:#047857;font:inherit;font-weight:750;cursor:pointer;padding:0}.access-link{justify-self:end;margin-top:-.35rem}
.access-switch{text-align:center;color:#64748b;margin:1.25rem 0 .6rem}.access-admin-entry{display:block;margin:auto;font-size:.78rem;color:#64748b;text-decoration:underline}.access-back{margin-bottom:1rem}
.access-divider{display:flex;align-items:center;gap:.8rem;color:#94a3b8;margin:1.25rem 0;font-size:.75rem}.access-divider:before,.access-divider:after{content:"";height:1px;background:#e2e8f0;flex:1}
.access-notice{padding:.85rem 1rem;border:1px solid #a7f3d0;background:#ecfdf5;color:#047857;border-radius:12px;font-size:.84rem;line-height:1.5;margin-bottom:1.25rem}
.access-secondary{width:100%;min-height:46px;margin-top:.65rem;border:1px solid #cbd5e1;border-radius:12px;background:#fff;color:#334155;font:inherit;font-weight:800;cursor:pointer}.access-security-note{margin-top:1rem;padding:.8rem;border-radius:10px;background:#f8fafc;color:#64748b;font-size:.78rem;line-height:1.5}.access-status-icon{text-align:center;font-size:2.5rem;margin-bottom:1rem}.access-heading.centered{text-align:center}.access-status-steps{display:grid;gap:.6rem;padding:1rem;background:#f8fafc;border-radius:12px;margin:1rem 0;color:#64748b;font-size:.84rem}.access-status-steps .done{color:#047857;font-weight:750}
.access-demo-note{margin-top:1rem;padding:.75rem;background:#f8fafc;border-radius:10px;text-align:center;color:#64748b;font-size:.72rem;overflow-wrap:anywhere}
.access-admin-list{display:grid;gap:.75rem;margin:1rem 0}.access-admin-row{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem;border:1px solid #e2e8f0;border-radius:12px}.access-admin-row>div:first-child{min-width:0;flex:1}.access-admin-row strong,.access-admin-row>div:first-child span{display:block;overflow-wrap:anywhere}.access-admin-row>div:first-child span{color:#64748b;margin-top:.25rem;font-size:.72rem}.access-admin-actions{display:flex;gap:.4rem;flex-wrap:wrap;justify-content:flex-end}.access-admin-actions button{border:1px solid #cbd5e1;background:#fff;border-radius:8px;padding:.45rem .65rem;font:inherit;font-size:.75rem;font-weight:750;cursor:pointer}
.access-status{display:inline-flex;margin-top:.4rem;padding:.2rem .5rem;border-radius:999px;font-size:.65rem;font-weight:800;background:#fef3c7;color:#92400e}.access-status.active{background:#dcfce7;color:#166534}.access-status.suspended{background:#fee2e2;color:#991b1b}
@media(max-width:760px){.access-page{display:block;background:#f8fafc;padding:max(1rem,env(safe-area-inset-top)) 1rem max(1rem,env(safe-area-inset-bottom))}.access-brand-panel{display:none}.access-card-wrap{display:block;padding:0;max-width:520px;margin:auto}.access-card{border-radius:18px;padding:1.25rem;box-shadow:0 10px 30px rgba(15,23,42,.07)}.access-mobile-brand{display:flex}.access-heading h2{font-size:1.4rem}.access-admin-row{align-items:flex-start;flex-direction:column}.access-admin-actions{justify-content:flex-start}}

/* PWA Install Banner & Action Styles */
.pwa-install-banner-wrap {
  animation: slideInDown 0.35s ease;
}
@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
.mobile-sheet-pwa-banner:hover,
#sheet-btn-install-app:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.28);
}
@media (max-width: 480px) {
  .pwa-install-banner-wrap {
    padding: 0.75rem 0.875rem !important;
  }
}

