/* Finigent — product UI (2026 fintech / autonomous agent trends) */

:root {
  --bg: #06080f;
  --bg-elevated: #0c1019;
  --surface: rgba(18, 24, 38, 0.72);
  --surface-solid: #121826;
  --surface-hover: rgba(28, 36, 56, 0.9);
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #f4f6fb;
  --text-secondary: #a8b4cc;
  --muted: #6b7a94;
  --accent: #34d399;
  --accent-dim: rgba(52, 211, 153, 0.15);
  --accent-glow: rgba(52, 211, 153, 0.35);
  --accent2: #22d3ee;
  --accent-warm: #fbbf24;
  --danger: #fb7185;
  --danger-dim: rgba(251, 113, 133, 0.12);
  --warn: #fbbf24;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --font: "DM Sans", system-ui, sans-serif;
  --font-display: "Instrument Sans", "DM Sans", sans-serif;
  --sidebar-w: 268px;
  --topbar-h: 72px;
  --bottom-nav-h: 64px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(52, 211, 153, 0.14), transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(34, 211, 238, 0.1), transparent 45%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(99, 102, 241, 0.06), transparent 50%);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* —— Sidebar —— */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
  backdrop-filter: blur(4px);
}

.sidebar-backdrop:not([hidden]) {
  display: block;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(1.2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.85rem;
  flex-shrink: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem 1.5rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px var(--accent-glow);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand-tag {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.nav-group-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.85rem 0.65rem 0.35rem;
  margin: 0;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease);
  position: relative;
}

.nav a .nav-icon {
  width: 20px;
  height: 20px;
  opacity: 0.75;
  flex-shrink: 0;
}

.nav a:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav a:hover .nav-icon {
  opacity: 1;
}

.nav a.active {
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.2);
}

.nav a.active .nav-icon {
  opacity: 1;
  color: var(--accent);
}

.nav-badge {
  margin-left: auto;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-foot {
  padding: 0.75rem 0.35rem 0;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.35rem;
  margin-bottom: 0.65rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--accent);
  flex-shrink: 0;
}

.user-email {
  font-size: 0.78rem;
  color: var(--text-secondary);
  word-break: break-all;
  line-height: 1.3;
}

.sidebar-cta {
  width: 100%;
  justify-content: center;
}

.sidebar-cta.hidden {
  display: none;
}

/* —— Main —— */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  min-height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: rgba(6, 8, 15, 0.75);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-titles {
  flex: 1;
  min-width: 0;
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.menu-btn {
  display: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-strong);
}

.content {
  padding: 1.5rem 1.5rem 2rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

/* —— Page patterns —— */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 52ch;
}

.section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

/* —— Grid & cards —— */
.grid {
  display: grid;
  gap: 1rem;
}

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

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

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

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

@media (max-width: 900px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}

.card:hover {
  border-color: var(--border-strong);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(52, 211, 153, 0.25);
}

.card h2,
.card h3 {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.card-head h2,
.card-head h3 {
  margin: 0;
}

/* Stat cards */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, var(--accent-dim), transparent 70%);
  opacity: 0.6;
  pointer-events: none;
}

.stat-card .stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.stat-card .stat-icon svg {
  width: 18px;
  height: 18px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-value.credit {
  color: var(--accent);
}

.stat-value.debit {
  color: var(--danger);
}

.stat-delta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

/* Quick links */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
}

.quick-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.1rem 1.15rem;
  text-decoration: none;
  color: inherit;
}

.quick-card .quick-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent2);
  margin-bottom: 0.25rem;
}

.quick-card strong {
  font-size: 0.95rem;
  font-weight: 600;
}

.quick-card span {
  font-size: 0.8rem;
  color: var(--muted);
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s var(--ease), box-shadow 0.2s, background 0.2s, opacity 0.2s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
}

.btn-primary,
.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #2dd4bf 100%);
  color: var(--bg);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover,
.btn-accent:hover {
  box-shadow: 0 6px 28px var(--accent-glow);
}

.btn-secondary {
  background: var(--surface-solid);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

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

.btn-ghost:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(251, 113, 133, 0.25);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* —— Forms & filters —— */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filters input,
.filters select,
.field input,
.field select,
.field textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.filters input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

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

.field label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-grid {
  display: grid;
  gap: 1rem;
}

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

@media (max-width: 640px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* —— Tables —— */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

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

th,
td {
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.2);
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* —— Chat —— */
.chat-shell {
  display: flex;
  flex-direction: column;
  min-height: 480px;
  max-height: calc(100vh - 220px);
}

.chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
}

.chat-msg {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  max-width: 88%;
  font-size: 0.92rem;
  line-height: 1.5;
  animation: msgIn 0.35s var(--ease);
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.chat-msg.user {
  background: linear-gradient(135deg, var(--accent) 0%, #2dd4bf 100%);
  color: var(--bg);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg.assistant {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-msg.error {
  border-color: var(--danger);
  color: var(--danger);
}

.chat-input-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-end;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.chat-input-row textarea {
  flex: 1;
  min-height: 52px;
  max-height: 140px;
  resize: vertical;
}

.chat-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chip {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* —— Inbox & lists —— */
.list-stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.inbox-item {
  cursor: pointer;
}

.inbox-unread {
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, var(--accent-dim), transparent 40%);
}

.inbox-item .item-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.memo-body {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  padding: 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow-x: auto;
  line-height: 1.6;
}

.action-card {
  border-left: 3px solid var(--warn);
}

.action-card[data-risk="high"],
.action-card[data-risk="critical"] {
  border-left-color: var(--danger);
}

.action-card[data-risk="low"] {
  border-left-color: var(--accent);
}

/* —— Onboarding —— */
.hero-onboard {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  max-width: 520px;
  margin: 0 auto 1.5rem;
}

.hero-onboard h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.03em;
}

.hero-onboard p {
  color: var(--muted);
  margin: 0;
}

.onboard-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.onboard-steps li {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.2s;
}

.onboard-steps li.done {
  border-color: rgba(52, 211, 153, 0.35);
}

.onboard-steps li.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.step-num {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-solid);
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 0.5rem;
  color: var(--muted);
}

.onboard-steps li.done .step-num {
  background: var(--accent-dim);
  color: var(--accent);
}

/* —— Badges & misc —— */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--surface-solid);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.badge-ok,
.badge-success {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(52, 211, 153, 0.25);
}

.badge-warn {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warn);
}

.badge-danger {
  background: var(--danger-dim);
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.error {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.loading {
  color: var(--muted);
  padding: 2rem;
  text-align: center;
}

/* Skeleton */
.skeleton-page .skeleton-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-solid) 0%,
    rgba(255, 255, 255, 0.06) 50%,
    var(--surface-solid) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-title {
  height: 28px;
  width: 40%;
}

.skeleton-card {
  height: 100px;
}

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

.chart-box {
  height: 240px;
  margin-top: 0.5rem;
}

.chart-box canvas {
  width: 100% !important;
  height: 100% !important;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.empty-state .empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.empty-state p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Toggle row */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0;
  cursor: pointer;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.settings-section {
  margin-bottom: 1.25rem;
}

/* Expense modal */
body.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 4, 10, 0.72);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.25rem 1.35rem 1.5rem;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
  }

  .modal-card {
    border-radius: var(--radius-lg);
  }
}

.modal-card .card-head .icon-btn {
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
}

.modal-card-wide {
  max-width: 560px;
}

.expense-modal-hint {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.45;
}

.expense-form textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 4rem;
}

.expense-filters {
  margin-bottom: 1rem;
}

.expense-table-wrap {
  margin-top: 0;
}

.expense-table td {
  vertical-align: top;
  padding: 0.75rem 0.5rem;
}

.expense-remarks {
  font-size: 0.78rem;
  margin-top: 0.25rem;
  max-width: 220px;
  line-height: 1.35;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.tag-chip {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.12);
  color: var(--accent);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.expense-row {
  cursor: pointer;
}

.expense-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.expense-actions {
  display: flex;
  gap: 0.25rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.expense-actions .tx-delete {
  color: var(--danger, #ef4444);
  opacity: 0.85;
}

.expense-actions .tx-delete:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.12);
}

.expense-budget-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
}

.budget-chip,
.budget-pct {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.budget-chip.warn,
.budget-pct.warn {
  background: rgba(234, 179, 8, 0.15);
  color: var(--warn, #eab308);
}

.budget-chip.over,
.budget-pct.over {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.budget-pct {
  margin-left: 0.35rem;
  vertical-align: middle;
}

.expense-missed-panel {
  margin-bottom: 1rem;
}

.missed-row {
  padding: 0.85rem 1rem;
}

.settings-section .card {
  margin-bottom: 0;
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0));
  right: 1.5rem;
  left: auto;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-width: min(360px, calc(100vw - 2rem));
  font-size: 0.9rem;
  animation: toastIn 0.35s var(--ease);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.toast.hidden {
  display: none;
}

.toast.error {
  border-left: 4px solid var(--danger);
}

/* Bottom nav (mobile) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0));
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: rgba(12, 16, 25, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 30;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  max-width: 72px;
}

.bottom-nav a svg {
  width: 22px;
  height: 22px;
}

.bottom-nav a.active {
  color: var(--accent);
}

/* —— Responsive —— */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-btn {
    display: inline-flex;
  }

  .bottom-nav {
    display: flex;
  }

  .main-wrap {
    padding-bottom: calc(var(--bottom-nav-h) + 1rem);
  }

  .content {
    padding: 1rem 1rem 1.5rem;
  }

  .topbar {
    padding: 0.85rem 1rem;
  }

  .page-title {
    font-size: 1.15rem;
  }

  .skeleton-page .skeleton-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* —— Light theme —— */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f5f9;
  --bg-elevated: #ffffff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-hover: #f8fafc;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --accent: #059669;
  --accent-dim: rgba(5, 150, 105, 0.12);
  --accent-glow: rgba(5, 150, 105, 0.2);
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .ambient {
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(5, 150, 105, 0.08), transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(14, 165, 233, 0.06), transparent 45%);
}

/* —— Settings layout —— */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.25rem;
  align-items: start;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: sticky;
  top: 1rem;
}

.settings-nav button {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.settings-nav button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.settings-nav button.active {
  background: var(--accent-dim);
  border-color: rgba(52, 211, 153, 0.25);
  color: var(--accent);
  font-weight: 600;
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.settings-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.settings-panel .panel-desc {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.theme-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.theme-picker label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
}

.theme-picker label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.theme-picker input {
  accent-color: var(--accent);
}

@media (max-width: 768px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    flex-direction: row;
    flex-wrap: wrap;
    position: static;
  }
}
