.card {
  background: radial-gradient(circle at top left, #020617 0, #020617 35%, #020617 70%, #030712 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(15, 23, 42, 0.9);
  box-shadow: var(--shadow-soft);
  padding: 1rem 1.1rem 1.1rem;
}

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

.card-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.card-value {
  font-size: 1.4rem;
  font-weight: 600;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  background: rgba(148, 163, 184, 0.14);
  color: var(--color-text-muted);
}

.btn {
  border-radius: 999px;
  border: none;
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-primary {
  background: linear-gradient(135deg, #22c1c3, #38bdf8);
  color: #0b1120;
}

.btn-outline {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn-xs {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

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

.field input,
.field select,
.field textarea {
  border-radius: 999px;
  border: 1px solid var(--color-border);
  padding: 0.45rem 0.8rem;
  background: rgba(15, 23, 42, 0.88);
  outline: none;
}

.field textarea {
  border-radius: var(--radius-md);
  min-height: 80px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.table th,
.table td {
  padding: 0.5rem 0.35rem;
  text-align: left;
}

.table th {
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}

.table tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.7);
}

.tag-income {
  color: #22c55e;
}

.tag-savings {
  color: #3b82f6;
}

.tag-expense {
  color: #f97316;
}

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.page-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.page-description {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.pill-tabs {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.15rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.95);
}

.pill-tabs button {
  border-radius: 999px;
  border: none;
  padding: 0.35rem 0.9rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  background: transparent;
  cursor: pointer;
}

.pill-tabs button.active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.banner-error {
  background: rgba(248, 113, 113, 0.12);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.banner-success {
  background: rgba(74, 222, 128, 0.1);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
  color: #bbf7d0;
  border: 1px solid rgba(74, 222, 128, 0.4);
}

/* Auth switch button */
#auth-switch-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 0.2rem 0.3rem;
  margin: 0;
  font-weight: 500;
  transition: color 0.2s ease;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

#auth-switch-btn:hover {
  color: #7dd3fc;
  text-decoration: none;
}

/* Sidebar / logout styling */
.desktop-sidebar {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 1rem 0.8rem;
}

.desktop-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1 1 auto;
}

.desktop-sidebar-nav a {
  color: var(--color-text-muted);
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.desktop-sidebar-nav a.active {
  background: rgba(56, 189, 248, 0.08);
  color: var(--color-primary);
}

/* Logout link inside nav: pinned to bottom, centered slightly to the right */
.desktop-sidebar-nav a.nav-logout {
  margin-top: auto;
  align-self: center;
  transform: translateX(6px);
  color: #c62828;
  font-weight: 700;
  border: 1px solid rgba(139,0,0,0.65);
  padding: 0.45rem 0.8rem;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
}

.desktop-sidebar-nav a.nav-logout .icon { display: none; }
.desktop-sidebar-nav a.nav-logout .nav-text { display: inline; }

.desktop-sidebar.collapsed .desktop-sidebar-nav a.nav-logout .icon { display: inline; }
.desktop-sidebar.collapsed .desktop-sidebar-nav a.nav-logout .nav-text { display: none; }

.desktop-sidebar-nav a.nav-logout:hover {
  background: linear-gradient(135deg, rgba(198,40,40,0.12), rgba(139,0,0,0.12));
  color: #fff;
  box-shadow: 0 6px 18px rgba(198,40,40,0.12), 0 2px 6px rgba(0,0,0,0.35);
  transform: translateX(6px) scale(1.03) translateY(-2px);
  border-color: rgba(139,0,0,0.9);
}

/* Mobile bottom-nav logout style */
.bottom-logout { color:#c62828 }
.bottom-logout.logout-link { color:#c62828; font-weight:700 }
.bottom-logout.logout-link .icon { display: none; }
.bottom-logout.logout-link:hover { background:#fff0f0; color:#b71c1c }

/* Logout confirmation modal */
.logout-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.logout-modal-overlay.active {
  display: flex;
}

.logout-modal {
  background: white;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  text-align: center;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.logout-modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: #333;
}

.logout-modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.logout-modal-actions button {
  padding: 0.6rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-modal-actions .btn-yes {
  background: #c62828;
  color: white;
}

.logout-modal-actions .btn-yes:hover {
  background: #b71c1c;
  transform: scale(1.05);
}

.logout-modal-actions .btn-no {
  background: #e0e0e0;
  color: #333;
}

.logout-modal-actions .btn-no:hover {
  background: #d0d0d0;
  transform: scale(1.05);
}

/* Theme toggle switch */
.theme-switch-wrapper {
  display: inline-block;
  height: 28px;
  width: 50px;
  position: relative;
}

.theme-switch {
  display: none;
}

.slider {
  background-color: #ccc;
  bottom: 0;
  cursor: pointer;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: 0.4s;
  border-radius: 28px;
}

.slider:before {
  background-color: #fff;
  bottom: 2px;
  content: "";
  height: 24px;
  left: 2px;
  position: absolute;
  transition: 0.4s;
  width: 24px;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #1a73e8;
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.slider:hover {
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

/* ===== LIGHT MODE OVERRIDES ===== */
:root[data-theme="light"] .card {
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .card-title {
  color: var(--color-text-muted);
}

:root[data-theme="light"] .card-value {
  color: #0f172a;
}

:root[data-theme="light"] .chip {
  background: rgba(15, 23, 42, 0.08);
  color: var(--color-text-muted);
}

:root[data-theme="light"] .btn-primary {
  background: linear-gradient(135deg, #0066cc, #0052a3);
  color: white;
}

:root[data-theme="light"] .btn-primary:hover {
  background: linear-gradient(135deg, #0052a3, #003d7a);
}

:root[data-theme="light"] .btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

:root[data-theme="light"] .btn-secondary:hover {
  background: #cbd5e1;
}

:root[data-theme="light"] .banner-error {
  background: rgba(220, 38, 38, 0.1);
  border-color: #fca5a5;
  color: #7f1d1d;
}

:root[data-theme="light"] .banner-success {
  background: rgba(34, 197, 94, 0.1);
  border-color: #bbf7d0;
  color: #15803d;
}

:root[data-theme="light"] .field input,
:root[data-theme="light"] .field select,
:root[data-theme="light"] .field textarea {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

:root[data-theme="light"] .field input::placeholder,
:root[data-theme="light"] .field select::placeholder,
:root[data-theme="light"] .field textarea::placeholder {
  color: #94a3b8;
}

:root[data-theme="light"] .field input:focus,
:root[data-theme="light"] .field select:focus,
:root[data-theme="light"] .field textarea:focus {
  border-color: #0066cc;
  background: #f8fafc;
}

/* Fix calendar icon visibility in light theme */
:root[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5);
  cursor: pointer;
}

:root[data-theme="light"] input[type="date"]::-webkit-inner-spin-button,
:root[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 1;
}

:root[data-theme="light"] .auth-form label {
  color: #0f172a;
}

:root[data-theme="light"] table {
  color: #0f172a;
}

:root[data-theme="light"] table thead {
  border-bottom-color: #cbd5e1;
}

:root[data-theme="light"] table tbody tr:hover {
  background: rgba(0, 102, 204, 0.05);
}

:root[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, 0.95);
  border-top-color: #cbd5e1;
}

:root[data-theme="light"] .bottom-nav a {
  color: #475569;
}

:root[data-theme="light"] .bottom-nav a.active {
  color: #0066cc;
}

:root[data-theme="light"] .logout-modal {
  background: white;
  color: #0f172a;
}

:root[data-theme="light"] .logout-modal-title {
  color: #0f172a;
}

:root[data-theme="light"] .logout-modal-overlay {
  background: rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] .sidebar-menu-text {
  color: #64748b;
}

:root[data-theme="light"] .sidebar-toggle-btn {
  color: #64748b;
}

:root[data-theme="light"] .sidebar-toggle-btn:hover {
  color: #0f172a;
}
