/* Financial Dashboard — Stripe-inspired minimal design */

:root {
  /* Backgrounds */
  --bg-root: #09090b;
  --bg-surface: #0c0c0e;
  --bg-elevated: #111113;
  --bg-hover: #18181b;
  --bg-active: #1f1f23;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);

  /* Text */
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --text-muted: #52525b;

  /* Accents */
  --accent: #3b82f6;
  --positive: #22c55e;
  --negative: #ef4444;
  --warning: #f59e0b;

  /* Spacing */
  --sidebar-width: 240px;
  --mobile-nav-height: 64px;
  --header-height: 56px;

  /* Typography */
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-root);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

/* App Layout */
.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: 6px;
}

.logo-text {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  text-align: left;
  width: 100%;
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--bg-active);
  color: var(--text-primary);
}

.nav-link svg {
  opacity: 0.6;
  flex-shrink: 0;
}

.nav-link.active svg,
.nav-link:hover svg {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 9px;
  display: none;
  align-items: center;
  justify-content: center;
}

.nav-badge.visible {
  display: flex;
}

/* Nav Sections & Dropdowns */
.nav-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 12px 0;
}

.nav-section-label {
  padding: 4px 12px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  justify-content: flex-start;
}

.dropdown-arrow {
  margin-left: auto;
  opacity: 0.5;
  transition: transform 0.2s var(--ease-out);
}

.nav-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: none;
}

.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 8px 28px;
}

.nav-sublink {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  text-align: left;
  width: 100%;
  text-decoration: none;
  white-space: nowrap;
}

.nav-sublink:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.nav-sublink.active {
  background: var(--bg-active);
  color: var(--text-primary);
}

.entity-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-subtle);
}

/* Data Actions */
.data-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.data-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
}

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

.data-btn svg {
  opacity: 0.7;
}

/* Entity Switcher */
.entity-switcher {
  position: relative;
}

.entity-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
}

.entity-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.entity-dot {
  width: 8px;
  height: 8px;
  background: var(--positive);
  border-radius: 50%;
}

.entity-btn svg {
  margin-left: auto;
  opacity: 0.5;
}

.entity-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.2s var(--ease-out);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.entity-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.entity-option {
  display: block;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.1s;
}

.entity-option:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.entity-option.active {
  color: var(--text-primary);
}

.entity-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 0;
}

.entity-cta {
  display: none;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-primary);
  background: var(--bg-hover);
  font-size: 0.85rem;
  text-decoration: none;
  text-align: left;
  transition: all 0.1s;
}

.entity-cta:hover {
  background: var(--bg-active);
}

.entity-cta.active {
  display: block;
}

/* Mobile Header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}

.mobile-menu-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 10px;
}

.mobile-menu-btn:hover,
.mobile-menu-btn:active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Mobile Drawer */
.mobile-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 199;
  opacity: 0;
  transition: opacity 0.3s;
}

.mobile-drawer-backdrop.open {
  display: block;
  opacity: 1;
}

.mobile-drawer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--bg-surface);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.3s var(--ease-out);
  overflow-y: auto;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.mobile-drawer-header .logo-text {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
}

.mobile-drawer-close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 10px;
  margin-left: auto;
}

.mobile-drawer-close:hover,
.mobile-drawer-close:active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mobile-drawer-nav {
  padding: 12px;
}

.mobile-drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}

.mobile-drawer-link:hover,
.mobile-drawer-link.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mobile-drawer-link svg {
  opacity: 0.6;
  flex-shrink: 0;
}

.mobile-drawer-link.active svg,
.mobile-drawer-link:hover svg {
  opacity: 1;
}

.mobile-drawer-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 12px 0;
}

.mobile-drawer-section {
  padding: 8px 16px 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.mobile-drawer-sublink {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px 10px 32px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-tertiary);
  font-size: 0.95rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}

.mobile-drawer-sublink:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.mobile-drawer-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 9px;
  display: none;
  align-items: center;
  justify-content: center;
}

.mobile-drawer-badge.visible {
  display: flex;
}

/* Mobile FAB */
.mobile-fab {
  display: none;
  position: fixed;
  bottom: calc(var(--mobile-nav-height) + 20px + env(safe-area-inset-bottom, 0px));
  right: 16px;
  width: 60px;
  height: 60px;
  background: var(--accent);
  border: none;
  border-radius: 18px;
  color: white;
  cursor: pointer;
  z-index: 90;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.5);
  transition: all 0.2s;
  align-items: center;
  justify-content: center;
}

.mobile-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.mobile-fab:active {
  transform: scale(0.95);
  background: #2563eb;
}

@media (max-width: 768px) {
  .mobile-drawer {
    display: block;
  }

  .mobile-fab {
    display: flex;
  }
}

/* Main Content */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px 40px;
  max-width: 1200px;
}

.view {
  display: none;
  animation: fadeIn 0.3s var(--ease-out);
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-header {
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

/* Period Selector */
.period-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.period-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
}

.period-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.period-select {
  padding: 8px 32px 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

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

.period-select:focus {
  outline: none;
  border-color: var(--accent);
}

.view-title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.view-subtitle {
  font-size: 0.9rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* Metrics Row */
.metrics-row {
  display: flex;
  gap: 48px;
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-subtle);
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric.clickable {
  cursor: pointer;
  border-radius: 8px;
  padding: 8px 12px;
  margin: -8px -12px;
  transition: background 0.15s var(--ease-out);
}

.metric.clickable:hover {
  background: var(--bg-surface);
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.metric-value.positive {
  color: var(--positive);
}

.metric-value.negative {
  color: var(--negative);
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  margin-bottom: 48px;
}

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 24px;
}

.chart-card.wide {
  grid-column: span 1;
}

.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.chart-card-header h3 {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-dot.in {
  background: var(--positive);
}

.legend-dot.out {
  background: var(--text-muted);
}

.chart-wrapper {
  position: relative;
}

.chart-wrapper.donut {
  height: 200px;
}

.chart-wrapper.bar {
  height: 180px;
}

/* Sections */
.section {
  margin-bottom: 48px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h3 {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.section-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--positive);
}

/* Shareholder Loans Grid */
.loans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.loan-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  transition: border-color 0.15s var(--ease-out);
}

.loan-card {
  cursor: pointer;
}

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

.loan-entity {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.loan-amount {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--positive);
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .loans-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .loan-card {
    padding: 12px;
  }

  .loan-entity {
    font-size: 0.8rem;
    max-width: 80px;
  }

  .loan-amount {
    font-size: 0.85rem;
  }
}

/* Transactions List */
.transactions-list {
  display: flex;
  flex-direction: column;
}

.transaction-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.1s;
}

.transaction-row:last-child {
  border-bottom: none;
}

.transaction-row:hover {
  background: var(--bg-hover);
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  border-radius: 8px;
}

.tx-indicator {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
}

.tx-indicator.expense {
  background: var(--text-muted);
}

.tx-indicator.income {
  background: var(--positive);
}

.tx-info {
  flex: 1;
  min-width: 0;
}

.tx-description {
  font-size: 0.9rem;
  font-weight: 450;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-meta {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.tx-category {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

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

.tx-amount {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: right;
  flex-shrink: 0;
}

.tx-amount.positive {
  color: var(--positive);
}

.tx-amount.negative {
  color: var(--text-primary);
}

.tx-account-badge {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--acc-color, #64748b) 15%, transparent);
  color: var(--acc-color, #64748b);
  border: 1px solid color-mix(in srgb, var(--acc-color, #64748b) 25%, transparent);
  white-space: nowrap;
}

/* Filters Bar */
.filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.filter-select {
  padding: 10px 14px;
  padding-right: 36px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

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

.filter-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Goals Summary */
.goals-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.goal-summary-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  text-align: center;
}

.goal-ring {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 12px;
}

.goal-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
}

.goal-ring circle {
  transition: stroke-dashoffset 0.8s var(--ease-out);
}

.ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.summary-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.summary-count {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* Goal Sections */
.goals-sections {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.goal-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.goal-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
}

.section-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.goal-section-header h3 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Goal Cards */
.goal-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.goal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s var(--ease-out);
}

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

.goal-card-main {
  padding: 20px;
}

.goal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.goal-card-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}

.goal-deadline {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-active);
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.goal-card-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.goal-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-active);
  border-radius: 3px;
  overflow: hidden;
}

.goal-bar-fill {
  height: 100%;
  background: var(--goal-accent, var(--accent));
  border-radius: 3px;
  transition: width 0.6s var(--ease-out);
}

.goal-pct {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 36px;
  text-align: right;
}

.goal-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.goal-current-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary);
}

.goal-target-value {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* Subgoals */
.goal-subgoals {
  padding: 0 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
  margin-top: -4px;
}

.subgoal-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.subgoal-name {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.subgoal-target {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Goal Note */
.goal-note {
  padding: 12px 20px;
  background: var(--bg-hover);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-style: italic;
}

/* Debt Summary */
.debt-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.debt-summary-card {
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.debt-summary-card.total {
  background: linear-gradient(135deg, var(--bg-surface) 0%, color-mix(in srgb, #ef4444 8%, var(--bg-surface)) 100%);
}

.debt-summary-label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.debt-summary-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.debt-summary-card.total .debt-summary-value {
  color: var(--negative);
}

/* Debt Cards */
.debt-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.debt-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  border-top: 3px solid var(--debt-color, var(--negative));
}

.debt-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 20px 0;
}

.debt-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.debt-card-name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
}

.debt-card-creditor {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.debt-card-type {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-active);
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.debt-card-balance {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.debt-balance-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.debt-balance-amount {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.debt-card-details {
  display: flex;
  gap: 24px;
  padding: 16px 20px;
  background: var(--bg-hover);
  border-top: 1px solid var(--border-subtle);
}

.debt-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.debt-detail-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.debt-detail-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.debt-detail-value.urgent {
  color: var(--warning);
}

.debt-card-alert {
  padding: 12px 20px;
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  color: var(--warning);
  font-size: 0.8rem;
  font-weight: 500;
}

.debt-card-alert.urgent {
  background: color-mix(in srgb, var(--negative) 10%, transparent);
  color: var(--negative);
}

@media (max-width: 768px) {
  .debt-summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .debt-summary-card {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
  }

  .debt-cards {
    grid-template-columns: 1fr;
  }

  .debt-card-details {
    flex-wrap: wrap;
    gap: 16px;
  }

  .debt-detail {
    min-width: 80px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .goals-summary {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 32px;
  }

  .goal-summary-card {
    padding: 16px 8px;
  }

  .goal-ring {
    width: 60px;
    height: 60px;
    margin-bottom: 8px;
  }

  .ring-pct {
    font-size: 0.85rem;
  }

  .summary-label {
    font-size: 0.8rem;
  }

  .summary-count {
    font-size: 0.7rem;
  }

  .goal-cards {
    grid-template-columns: 1fr;
  }

  .goal-card-main {
    padding: 16px;
  }

  .goal-current-value {
    font-size: 1rem;
  }
}

/* Review List */
.review-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.review-card {
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.review-amount {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 500;
}

.review-date {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.review-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  word-break: break-word;
}

.review-note-section {
  margin-bottom: 16px;
}

.review-note-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-hover);
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  transition: all 0.15s var(--ease-out);
}

.review-note-input:hover {
  border-color: var(--border-default);
}

.review-note-input:focus {
  outline: none;
  background: var(--bg-surface);
  border-color: var(--accent);
}

.review-note-input::placeholder {
  color: var(--text-muted);
}

/* Entity Pills */
.entity-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.entity-pill {
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 14px;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
}

.entity-pill:hover {
  border-color: var(--ent-color, var(--border-strong));
  color: var(--text-secondary);
}

.entity-pill.selected {
  background: color-mix(in srgb, var(--ent-color) 20%, transparent);
  border-color: var(--ent-color);
  color: var(--ent-color);
}

/* Transaction Entity Pills (inline in list) */
.tx-entities {
  display: inline-flex;
  gap: 4px;
  margin-left: 4px;
}

.tx-entity-pill {
  display: inline-block;
  padding: 1px 6px;
  background: color-mix(in srgb, var(--ent-color) 15%, transparent);
  color: var(--ent-color);
  font-size: 0.65rem;
  font-weight: 500;
  border-radius: 3px;
  white-space: nowrap;
}

/* Modal entity pills */
.tx-entity-section {
  margin-bottom: 16px;
}

.modal-pills {
  margin-bottom: 0;
}

.modal-pills .entity-pill {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Category Pills (same pattern as entity pills) */
.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.category-pill {
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s var(--ease-out);
}

.category-pill:hover {
  border-color: var(--cat-color, var(--border-strong));
  color: var(--text-secondary);
}

.category-pill.selected {
  background: color-mix(in srgb, var(--cat-color) 20%, transparent);
  border-color: var(--cat-color);
  color: var(--cat-color);
  font-weight: 500;
}

.tx-category-section {
  margin-bottom: 16px;
}

.review-label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.category-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.category-chip {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
}

.category-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.category-chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.category-chip.other-chip {
  border-style: dashed;
  color: var(--text-muted);
}

.category-chip.other-chip:hover {
  color: var(--text-secondary);
}

.category-chip.other-chip.selected {
  border-style: solid;
  color: white;
}

.other-category-picker {
  margin-top: 10px;
  margin-bottom: 10px;
}

.category-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.category-select:focus {
  outline: none;
  border-color: var(--accent);
}

.review-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.learn-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  cursor: pointer;
}

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

.btn {
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  border: none;
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-root);
}

.btn-primary:hover {
  background: var(--text-secondary);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}

.empty-state p {
  font-size: 0.9rem;
}

/* Mobile Nav */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 100;
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
  padding: 8px 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
  color: var(--text-primary);
}

.mobile-nav-item svg {
  opacity: 0.5;
}

.mobile-nav-item.active svg {
  opacity: 1;
}

.mobile-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--accent);
  color: white;
  font-size: 0.6rem;
  font-weight: 600;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
}

.mobile-badge.visible {
  display: flex;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s var(--ease-out);
  z-index: 200;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 28px;
  max-width: 400px;
  width: calc(100% - 32px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s var(--ease-out);
  z-index: 201;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal.modal-wide {
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
}

.breakdown-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.breakdown-item:last-child {
  border-bottom: none;
}

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

.breakdown-item-desc {
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breakdown-item-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.breakdown-item-amount {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  flex-shrink: 0;
  margin-left: 12px;
}

.breakdown-item-amount.positive { color: var(--positive); }
.breakdown-item-amount.negative { color: var(--negative); }

.breakdown-summary {
  display: flex;
  justify-content: space-between;
  padding: 12px 0 0;
  margin-top: 8px;
  border-top: 2px solid var(--border-default);
  font-weight: 600;
  font-size: 0.9rem;
}

.breakdown-summary-amount {
  font-family: var(--font-mono);
}

.breakdown-note {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-style: italic;
  margin-top: 4px;
}

.loan-detail-draws {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.loan-detail-draws h4 {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal-body {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.modal-body p {
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

.modal-actions-right {
  display: flex;
  gap: 10px;
}

.btn-delete {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--negative);
  color: var(--negative);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-delete:hover {
  background: color-mix(in srgb, var(--negative) 15%, transparent);
}

.btn-ghost {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* Transaction Detail Modal */
.tx-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.tx-detail-amount {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.tx-detail-amount.positive {
  color: var(--positive);
}

.tx-detail-date {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.tx-detail-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.tx-detail-category {
  margin-bottom: 20px;
}

.category-tag {
  display: inline-block;
  padding: 4px 10px;
  background: color-mix(in srgb, var(--cat-color) 15%, transparent);
  color: var(--cat-color);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 4px;
}

.tx-note-section {
  margin-bottom: 20px;
}

.tx-note-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.tx-note-input {
  width: 100%;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 60px;
  transition: border-color 0.15s;
}

.tx-note-input:focus {
  outline: none;
  border-color: var(--accent);
}

.tx-note-input::placeholder {
  color: var(--text-muted);
}

/* Transaction Note Badge & Preview */
.tx-note-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  background: var(--bg-active);
  color: var(--text-tertiary);
  font-size: 0.65rem;
  font-weight: 500;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.tx-note-preview {
  color: var(--text-muted);
  font-style: italic;
}

/* Personal Use Toggle */
.tx-personal-use-section {
  margin-bottom: 20px;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 8px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.toggle-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.toggle-desc {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--bg-active);
  border-radius: 12px;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform 0.2s, background-color 0.2s;
}

.toggle-input:checked + .toggle-switch {
  background: var(--accent);
}

.toggle-input:checked + .toggle-switch::after {
  transform: translateX(20px);
  background: white;
}

.personal-use-note {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--negative);
}

/* Updated Loan Cards */
.loan-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.loan-card.negative {
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.05);
}

.loan-entity {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.loan-details {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.loan-label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.loan-amount {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--positive);
}

.loan-amount.negative {
  color: var(--negative);
}

.section-badge.negative {
  color: var(--negative);
}

/* Responsive */
@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .chart-card.wide {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .mobile-header {
    display: flex;
  }

  .mobile-nav {
    display: flex;
  }

  .main {
    margin-left: 0;
    padding: calc(var(--header-height) + 16px) 16px calc(var(--mobile-nav-height) + 24px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }

  .view-title {
    font-size: 1.4rem;
  }

  .metrics-row {
    flex-wrap: wrap;
    gap: 24px;
  }

  .metric {
    flex: 1;
    min-width: 100px;
  }

  .metric-value {
    font-size: 1.25rem;
  }

  .chart-wrapper.donut {
    height: 180px;
  }

  .chart-wrapper.bar {
    height: 160px;
  }

  .transaction-row {
    padding: 12px 0;
  }

  .filters-bar {
    flex-direction: column;
  }

  .filter-select {
    width: 100%;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* Selection */
::selection {
  background: var(--accent);
  color: white;
}

/* House Budget */
.budget-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.budget-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  transition: border-color 0.2s;
}

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

.budget-item.paid {
  border-left: 3px solid var(--positive);
}

.budget-item.pending {
  border-left: 3px solid var(--text-muted);
}

.budget-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.budget-item-name {
  font-weight: 500;
  color: var(--text-primary);
}

.budget-item-details {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.budget-item-notes {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.budget-item-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.budget-item-amount .amount {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1.1rem;
}

.status-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.paid {
  background: rgba(34, 197, 94, 0.15);
  color: var(--positive);
}

.status-badge.pending {
  background: rgba(156, 163, 175, 0.15);
  color: var(--text-muted);
}

.budget-actuals-grid {
  overflow-x: auto;
}

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

.actuals-table th,
.actuals-table td {
  padding: 12px;
  text-align: right;
  border-bottom: 1px solid var(--border-default);
}

.actuals-table th {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.actuals-table th:first-child,
.actuals-table td:first-child {
  text-align: left;
}

.actuals-table .month-label {
  font-weight: 500;
  color: var(--text-primary);
}

.actuals-table .month-total {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-primary);
}

.actuals-table td.paid {
  color: var(--positive);
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 32px;
  font-style: italic;
}

/* Email Templates */
.email-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 24px;
  margin-top: 20px;
}

.email-template-card {
  background: var(--card-bg);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.email-template-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.email-template-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-default);
}

.email-template-header h3 {
  margin: 8px 0 4px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.email-template-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  font-family: var(--font-mono);
}

.email-template-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.email-template-badge.booking {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.email-template-badge.membership {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.email-template-badge.admin {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
}

.email-preview-frame {
  padding: 12px;
  background: #0f0f0f;
  max-height: 450px;
  overflow-y: auto;
}

.email-template-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-default);
  background: rgba(0, 0, 0, 0.02);
}

.email-template-trigger {
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

  .email-preview-frame {
    max-height: 300px;
  }
}

/* Add Transaction Modal */
#add-tx-modal {
  max-width: 450px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-default);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.amount-input-group {
  display: flex;
  gap: 8px;
}

.amount-input-group select:first-child {
  width: 120px;
  flex-shrink: 0;
}

.amount-input-group input {
  flex: 1;
}

.amount-input-group select:last-child {
  width: 80px;
  flex-shrink: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-default);
}

.btn-secondary {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

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

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.view-header .btn {
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 768px) {
  .header-actions {
    display: none; /* Hide on mobile, use FAB instead */
  }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Ensure inputs don't trigger iOS zoom (must be 16px+) */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Better touch targets for buttons */
  .btn {
    min-height: 44px;
    padding: 12px 20px;
  }

  .btn-primary, .btn-secondary {
    min-height: 48px;
    font-size: 1rem;
  }

  /* Entity pills need larger touch area */
  .entity-pill {
    min-height: 36px;
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  /* Modal improvements */
  .modal {
    width: calc(100% - 32px);
    max-width: none;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }

  .receipt-modal {
    width: calc(100% - 24px);
  }

  /* Form groups spacing */
  .form-group {
    margin-bottom: 20px;
  }

  .form-group label {
    font-size: 0.9rem;
    margin-bottom: 8px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 14px 16px;
    border-radius: 10px;
  }

  /* Transaction rows need larger tap area */
  .transaction-row {
    padding: 16px 0;
    min-height: 64px;
  }

  /* Category chips */
  .category-chip {
    min-height: 40px;
    padding: 10px 16px;
  }

  /* Filter selects */
  .filter-select {
    min-height: 44px;
    padding: 12px 16px;
  }

  /* Better dropzone for mobile */
  .receipt-dropzone {
    min-height: 200px;
  }

  .dropzone-text {
    font-size: 1rem;
  }

  /* Stats grid on mobile */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }
}

/* Receipt Capture Modal */
.receipt-modal {
  max-width: 700px;
  width: 95%;
}

.receipt-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  border: 2px dashed var(--border-default);
  border-radius: 12px;
  background: var(--bg-surface);
  transition: all 0.2s;
  cursor: pointer;
}

.receipt-dropzone:hover,
.receipt-dropzone.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.dropzone-content {
  text-align: center;
  padding: 24px;
}

.dropzone-content svg {
  color: var(--text-muted);
  margin-bottom: 16px;
}

.dropzone-text {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.dropzone-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.dropzone-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.receipt-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  gap: 16px;
}

.processing-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.receipt-result .receipt-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  margin-bottom: 20px;
}

.receipt-preview {
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--bg-surface);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.receipt-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.receipt-form-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.receipt-form-col .form-group {
  margin-bottom: 0;
}

.form-row {
  display: flex;
  gap: 12px;
}

.confidence-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 8px;
}

.confidence-badge.high {
  background: color-mix(in srgb, var(--positive) 20%, transparent);
  color: var(--positive);
}

.confidence-badge.low {
  background: color-mix(in srgb, var(--warning) 20%, transparent);
  color: var(--warning);
}

@media (max-width: 600px) {
  .receipt-result .receipt-layout {
    grid-template-columns: 1fr;
  }

  .receipt-preview {
    max-height: 150px;
    aspect-ratio: auto;
  }
}
