/* ══════════════════════════════════════════════════════════════
 * Mason Ark Finance — Premium Dark-Mode Design System
 * ══════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────
 * Google Fonts (loaded in HTML <head>)
 * Font: Inter (300, 400, 500, 600, 700, 800)
 * ────────────────────────────────────────────── */

/* ──────────────────────────────────────────────
 * CSS Custom Properties (Design Tokens)
 * ────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-body:       #06060e;
  --bg-primary:    #0c0c18;
  --bg-secondary:  #111125;
  --bg-card:       rgba(255, 255, 255, 0.035);
  --bg-card-hover: rgba(255, 255, 255, 0.065);
  --bg-input:      rgba(255, 255, 255, 0.06);
  --bg-input-focus: rgba(255, 255, 255, 0.10);

  /* Glass */
  --glass-bg:      rgba(14, 14, 30, 0.75);
  --glass-border:  rgba(255, 255, 255, 0.08);
  --glass-blur:    16px;

  /* Text */
  --text-primary:   #e8ecf4;
  --text-secondary: #8892a6;
  --text-muted:     #4a5568;
  --text-inverse:   #0c0c18;

  /* Accent Colors - Mason Ark Gold/Corporate Branding */
  --accent-primary:  #d4af37; /* Gold */
  --accent-business: #60a5fa;
  --accent-private:  #fbbf24;
  --accent-positive: #34d399;
  --accent-negative: #f87171;
  --accent-info:     #a78bfa;
  --accent-warning:  #fb923c;

  /* Accent with alpha */
  --accent-business-bg: rgba(96, 165, 250, 0.10);
  --accent-private-bg:  rgba(251, 191, 36, 0.10);
  --accent-positive-bg: rgba(52, 211, 153, 0.10);
  --accent-negative-bg: rgba(248, 113, 113, 0.10);

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

  /* Shadows */
  --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md:  0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg:  0 8px 40px rgba(0, 0, 0, 0.45);
  --shadow-glow-blue:  0 0 20px rgba(96, 165, 250, 0.15);
  --shadow-glow-green: 0 0 20px rgba(52, 211, 153, 0.15);
  --shadow-glow-red:   0 0 20px rgba(248, 113, 113, 0.15);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Spacing */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Radius */
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 999px;

  /* Transitions */
  --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}


/* ──────────────────────────────────────────────
 * Reset & Base
 * ────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated gradient background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(52, 211, 153, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(96, 165, 250, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
}


/* ──────────────────────────────────────────────
 * Header
 * ────────────────────────────────────────────── */
#app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 6, 14, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.header-left h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.header-left h1 .accent {
  color: var(--accent-primary);
}

.tax-year-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  background: rgba(129, 140, 248, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(129, 140, 248, 0.25);
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}


/* ──────────────────────────────────────────────
 * Main Layout
 * ────────────────────────────────────────────── */
#app-main {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}


/* ──────────────────────────────────────────────
 * Glass Panel (reusable card component)
 * ────────────────────────────────────────────── */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-normal);
}

.glass-panel:hover {
  border-color: var(--border-medium);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.section-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

.section-title .subtitle {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.section-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}


/* ──────────────────────────────────────────────
 * Income Section
 * ────────────────────────────────────────────── */
.income-display {
  text-align: center;
}

.income-input-group {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.income-input-group .currency {
  font-size: 2rem;
  font-weight: 300;
  color: var(--text-secondary);
}

.big-input {
  font-family: var(--font-family);
  font-size: 2.5rem;
  font-weight: 800;
  width: 250px;
  text-align: center;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border-medium);
  color: var(--accent-positive);
  padding: var(--space-sm);
  outline: none;
  transition: border-color var(--transition-fast);
}

.big-input:focus {
  border-color: var(--accent-positive);
}

/* Remove number input spinners */
.big-input::-webkit-outer-spin-button,
.big-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.big-input { -moz-appearance: textfield; }

.income-annual {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.income-annual span {
  color: var(--accent-positive);
  font-weight: 600;
}


/* ──────────────────────────────────────────────
 * Expense Section
 * ────────────────────────────────────────────── */

/* Filter Buttons */
.expense-filters {
  display: flex;
  gap: var(--space-xs);
}

.filter-btn {
  font-family: var(--font-family);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn:hover {
  background: var(--bg-card-hover);
}

.filter-btn.active {
  background: rgba(129, 140, 248, 0.15);
  color: var(--accent-primary);
  border-color: rgba(129, 140, 248, 0.3);
}

/* Add Expense Form */
.expense-form {
  display: grid;
  grid-template-columns: 1fr 120px auto auto;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  align-items: center;
}

.form-input {
  font-family: var(--font-family);
  font-size: 0.85rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
  width: 100%;
}

.form-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.1);
}

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

/* Remove spinners from number inputs in forms */
.form-input[type="number"]::-webkit-outer-spin-button,
.form-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.form-input[type="number"] { -moz-appearance: textfield; }

.amount-input-group {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.amount-input-group .currency {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.amount-input-group .form-input {
  width: 100%;
}

/* Category Toggle */
.category-toggle {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.cat-btn {
  font-family: var(--font-family);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.45rem 0.6rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.cat-btn.active.cat-business {
  background: var(--accent-business-bg);
  color: var(--accent-business);
}

.cat-btn.active.cat-private {
  background: var(--accent-private-bg);
  color: var(--accent-private);
}

/* Expense List */
.expense-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 500px;
  overflow-y: auto;
  margin-bottom: var(--space-lg);
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) transparent;
}

.expense-list::-webkit-scrollbar {
  width: 6px;
}

.expense-list::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 3px;
}

.expense-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: var(--space-md);
  align-items: center;
  padding: 0.6rem 0.8rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  animation: slideIn var(--transition-normal) ease-out;
}

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

.expense-item:hover {
  background: var(--bg-card-hover);
}

.expense-item.business {
  border-left: 3px solid var(--accent-business);
}

.expense-item.private {
  border-left: 3px solid var(--accent-private);
}

.expense-item .exp-category {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.expense-item.business .exp-category {
  background: var(--accent-business-bg);
  color: var(--accent-business);
}

.expense-item.private .exp-category {
  background: var(--accent-private-bg);
  color: var(--accent-private);
}

.expense-item .exp-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-item .exp-amount {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  white-space: nowrap;
}

.expense-item .exp-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.expense-item:hover .exp-actions {
  opacity: 1;
}

.exp-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all var(--transition-fast);
}

.exp-action-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}

.exp-action-btn.delete:hover {
  background: var(--accent-negative-bg);
  color: var(--accent-negative);
  border-color: rgba(248, 113, 113, 0.3);
}

.exp-action-btn.toggle:hover {
  background: rgba(129, 140, 248, 0.1);
  color: var(--accent-primary);
  border-color: rgba(129, 140, 248, 0.3);
}

/* Expense Totals */
.expense-totals {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
}

.total-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.total-item.business { background: var(--accent-business-bg); }
.total-item.private  { background: var(--accent-private-bg); }
.total-item.all      { background: var(--bg-card); }

.total-value {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  margin-top: 0.2rem;
}

.total-item.business .total-value { color: var(--accent-business); }
.total-item.private .total-value  { color: var(--accent-private); }


/* ──────────────────────────────────────────────
 * Summary Dashboard
 * ────────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

.summary-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 var(--space-md);
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
}

.summary-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.card-icon {
  grid-row: 1 / 3;
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.card-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.card-value {
  grid-column: 2;
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  transition: color var(--transition-fast);
}

.card-sub {
  grid-column: 3;
  grid-row: 1 / 3;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

/* Card color accents */
.card-income  .card-icon { background: var(--accent-positive-bg); }
.card-income  .card-value { color: var(--accent-positive); }

.card-business .card-icon { background: var(--accent-business-bg); }
.card-business .card-value { color: var(--accent-business); }

.card-private .card-icon { background: var(--accent-private-bg); }
.card-private .card-value { color: var(--accent-private); }

.card-profit .card-icon { background: rgba(167, 139, 250, 0.10); }
.card-profit .card-value { color: var(--accent-info); }

.card-tax .card-icon { background: var(--accent-negative-bg); }
.card-tax .card-value { color: var(--accent-negative); }

.card-aftertax .card-icon { background: rgba(129, 140, 248, 0.10); }

.card-left {
  border-color: rgba(52, 211, 153, 0.2);
}
.card-left .card-icon {
  background: var(--accent-positive-bg);
}
.card-left .card-value {
  color: var(--accent-positive);
  font-size: 1.3rem;
}

.highlight-card {
  background: rgba(52, 211, 153, 0.05);
  box-shadow: var(--shadow-glow-green);
}


/* ──────────────────────────────────────────────
 * Tax Optimizer
 * ────────────────────────────────────────────── */
.optimizer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.optimizer-panel {
  padding: var(--space-xl);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.optimizer-panel h3 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.panel-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.recommended-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  background: var(--accent-positive-bg);
  color: var(--accent-positive);
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
}

.panel-sole {
  border-top: 3px solid var(--accent-warning);
}

.panel-pty {
  border-top: 3px solid var(--accent-positive);
}

/* Optimizer Breakdown Rows */
.optimizer-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.optimizer-breakdown hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-xs) 0;
}

.opt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.opt-row.total {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.opt-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

.tax-negative {
  color: var(--accent-negative) !important;
}

/* Salary Slider */
.salary-slider-container {
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: rgba(52, 211, 153, 0.04);
  border-radius: var(--radius-md);
  border: 1px solid rgba(52, 211, 153, 0.1);
}

.salary-slider-container label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: var(--space-sm);
}

.salary-value {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-positive);
  font-size: 1.1rem;
}

.salary-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-medium);
  border-radius: 3px;
  outline: none;
  margin: var(--space-sm) 0;
}

.salary-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-positive);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.4);
  transition: transform var(--transition-fast);
}

.salary-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.salary-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-positive);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.4);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Auto-Optimize Button */
.btn-accent {
  background: linear-gradient(135deg, var(--accent-positive), #059669);
  color: white;
  border: none;
  font-weight: 700;
}

.btn-accent:hover {
  box-shadow: var(--shadow-glow-green);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  margin-top: var(--space-sm);
}

/* Savings Banner */
.savings-banner {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.08), rgba(52, 211, 153, 0.02));
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.savings-icon {
  font-size: 2rem;
}

.savings-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.savings-highlight {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--accent-positive);
}

.savings-optimal {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-left: auto;
}


/* ──────────────────────────────────────────────
 * Tax Bracket Visual
 * ────────────────────────────────────────────── */
.bracket-visual {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 120px;
  padding: var(--space-md) 0;
}

.bracket-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: all var(--transition-normal);
  cursor: default;
}

.bracket-bar .bar-fill {
  width: 100%;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--border-medium);
  transition: all var(--transition-slow);
  position: relative;
}

.bracket-bar.active .bar-fill {
  background: linear-gradient(180deg, var(--accent-primary), rgba(129, 140, 248, 0.4));
  box-shadow: 0 0 15px rgba(129, 140, 248, 0.3);
}

.bracket-bar.below .bar-fill {
  background: rgba(52, 211, 153, 0.3);
}

.bracket-bar .bar-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: var(--space-xs);
  text-align: center;
}

.bracket-bar.active .bar-label {
  color: var(--accent-primary);
}

.bracket-bar .bar-range {
  font-size: 0.55rem;
  color: var(--text-muted);
  text-align: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
  position: absolute;
  top: -20px;
  white-space: nowrap;
}

.bracket-bar:hover .bar-range {
  opacity: 1;
}


/* ──────────────────────────────────────────────
 * Debt Calculator
 * ────────────────────────────────────────────── */
.debt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: start;
}

.debt-inputs {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.computed-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-positive);
  padding: 0.6rem 0;
}

.debt-results {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.debt-stat {
  padding: var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  text-align: center;
}

.debt-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.debt-stat-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}


/* ──────────────────────────────────────────────
 * Buttons
 * ────────────────────────────────────────────── */
.btn {
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
}

.btn-primary:hover {
  background: #6366f1;
  box-shadow: 0 0 20px rgba(129, 140, 248, 0.3);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}


/* ──────────────────────────────────────────────
 * Modals
 * ────────────────────────────────────────────── */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--transition-normal) ease-out;
}

.modal.hidden {
  display: none;
}

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

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 1;
  min-width: 380px;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 {
  margin-bottom: var(--space-lg);
  font-size: 1.2rem;
}

.modal-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-xl);
}

.toggle-group {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.toggle-btn {
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex: 1;
}

.toggle-btn.active {
  background: rgba(129, 140, 248, 0.15);
  color: var(--accent-primary);
}

.export-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.import-label {
  cursor: pointer;
  text-align: center;
}

.last-saved {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--space-md);
}


/* ──────────────────────────────────────────────
 * Footer
 * ────────────────────────────────────────────── */
#app-footer {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-xl) var(--space-xl);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border-subtle);
}

.footer-sub {
  font-size: 0.7rem;
  margin-top: var(--space-xs);
  color: var(--text-muted);
  opacity: 0.6;
}

.footer-save {
  font-size: 0.7rem;
  margin-top: var(--space-sm);
  color: var(--text-muted);
  opacity: 0.5;
}


/* ──────────────────────────────────────────────
 * Value Change Animation
 * ────────────────────────────────────────────── */
@keyframes valuePulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.value-changed {
  animation: valuePulse 300ms ease-out;
}


/* ──────────────────────────────────────────────
 * Responsive Design
 * ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  #app-main {
    grid-template-columns: 1fr;
    padding: var(--space-md);
  }

  #income-section,
  #expense-section,
  #summary-section,
  #optimizer-section,
  #bracket-section,
  #debt-section {
    grid-column: 1;
    grid-row: auto;
  }

  .optimizer-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .header-content {
    padding: var(--space-sm) var(--space-md);
  }

  .header-left h1 {
    font-size: 1.1rem;
  }

  .tax-year-badge {
    font-size: 0.6rem;
    padding: 0.15rem 0.5rem;
  }

  .expense-form {
    grid-template-columns: 1fr;
  }

  .expense-totals {
    grid-template-columns: 1fr;
  }

  .summary-card {
    padding: var(--space-md);
  }

  .big-input {
    font-size: 1.8rem;
    width: 180px;
  }

  .savings-banner {
    flex-direction: column;
    text-align: center;
  }

  .savings-optimal {
    margin-left: 0;
  }

  .expense-item {
    grid-template-columns: auto 1fr auto;
    gap: var(--space-sm);
  }

  .expense-item .exp-actions {
    opacity: 1;
  }

  .expense-item .exp-category {
    display: none;
  }
}


/* ──────────────────────────────────────────────
 * Print Styles
 * ────────────────────────────────────────────── */
@media print {
  body::before { display: none; }
  #app-header { position: static; background: white; color: black; }
  .glass-panel { background: white; border: 1px solid #ddd; }
  .expense-item .exp-actions { display: none; }
  .btn, .icon-btn, .modal { display: none; }
  .expense-form { display: none; }
  #tab-nav { display: none; }
  .tab-panel:not(.active) { display: none; }
}


/* ══════════════════════════════════════════════════════════════
 * SYNC INDICATOR
 * ══════════════════════════════════════════════════════════════ */

.sync-indicator {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  opacity: 0;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

.sync-indicator.sync-flash {
  opacity: 1;
}


/* ══════════════════════════════════════════════════════════════
 * TAB NAVIGATION
 * ══════════════════════════════════════════════════════════════ */

#tab-nav {
  position: sticky;
  top: 57px; /* below header */
  z-index: 99;
  background: rgba(6, 6, 14, 0.80);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.tab-nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  position: relative;
}

.tab-btn {
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.85rem 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  position: relative;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-secondary);
}

.tab-btn.active {
  color: var(--accent-primary);
}

.tab-icon {
  font-size: 1rem;
}

.tab-indicator {
  position: absolute;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), #6366f1);
  border-radius: 2px 2px 0 0;
  transition: left var(--transition-normal), width var(--transition-normal);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}


/* ──────────────────────────────────────────────
 * Tab Panels
 * ────────────────────────────────────────────── */

.tab-panel {
  display: none;
}

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

#tab-payments #payment-tracker-section {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}


/* ══════════════════════════════════════════════════════════════
 * PAYMENT TRACKER — Month Navigation
 * ══════════════════════════════════════════════════════════════ */

.pmt-month-nav {
  text-align: center;
}

.pmt-month-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.pmt-nav-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pmt-nav-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.pmt-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pmt-month-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  min-width: 200px;
}

.pmt-month-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.pmt-today-btn {
  font-family: var(--font-family);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: var(--radius-full);
  color: var(--accent-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pmt-today-btn:hover {
  background: rgba(212, 175, 55, 0.2);
}

.pmt-today-btn.hidden {
  display: none;
}


/* ──────────────────────────────────────────────
 * Progress Banner
 * ────────────────────────────────────────────── */

.pmt-progress-section {
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
}

.pmt-progress-stats {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-sm);
}

.pmt-progress-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pmt-outstanding {
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--accent-negative);
}

.pmt-progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.pmt-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-positive), #059669);
  border-radius: var(--radius-full);
  transition: width 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.3);
}


/* ──────────────────────────────────────────────
 * Payment Filters
 * ────────────────────────────────────────────── */

.pmt-filters-bar {
  display: flex;
  align-items: center;
}

.pmt-filter-group {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.pmt-filter-btn {
  font-family: var(--font-family);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.pmt-filter-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}

.pmt-filter-btn.active {
  background: rgba(129, 140, 248, 0.15);
  color: var(--accent-primary);
  border-color: rgba(129, 140, 248, 0.3);
}


/* ──────────────────────────────────────────────
 * Payment Table
 * ────────────────────────────────────────────── */

.pmt-table-section {
  padding: var(--space-lg) 0;
}

.pmt-table-header {
  display: grid;
  grid-template-columns: 44px 80px 1fr 100px 70px 90px 80px;
  gap: var(--space-sm);
  padding: 0.5rem var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  align-items: center;
}

.pmt-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}


/* ──────────────────────────────────────────────
 * Payment Row
 * ────────────────────────────────────────────── */

.payment-row {
  display: grid;
  grid-template-columns: 44px 80px 1fr 100px 70px 90px 80px;
  gap: var(--space-sm);
  padding: 0.65rem var(--space-lg);
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  animation: slideIn var(--transition-normal) ease-out;
}

.payment-row:hover {
  background: var(--bg-card-hover);
}

.payment-row--paid {
  opacity: 0.7;
}

.payment-row--paid:hover {
  opacity: 1;
}

.payment-row--paid .payment-name {
  text-decoration: line-through;
  text-decoration-color: var(--accent-positive);
}


/* ──────────────────────────────────────────────
 * Custom Checkbox
 * ────────────────────────────────────────────── */

.payment-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.payment-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.payment-checkbox__mark {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  position: relative;
}

.payment-checkbox__mark::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid var(--accent-positive);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform var(--transition-spring);
  position: absolute;
  top: 2px;
}

.payment-checkbox input:checked + .payment-checkbox__mark {
  background: rgba(52, 211, 153, 0.15);
  border-color: var(--accent-positive);
}

.payment-checkbox input:checked + .payment-checkbox__mark::after {
  transform: rotate(45deg) scale(1);
}

.payment-checkbox input:focus-visible + .payment-checkbox__mark {
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
}


/* ──────────────────────────────────────────────
 * Payment Row — Category Badge
 * ────────────────────────────────────────────── */

.payment-cat {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
  text-align: center;
}

.payment-cat.cat-business {
  background: var(--accent-business-bg);
  color: var(--accent-business);
}

.payment-cat.cat-private {
  background: var(--accent-private-bg);
  color: var(--accent-private);
}


/* ──────────────────────────────────────────────
 * Payment Row — Fields
 * ────────────────────────────────────────────── */

.payment-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-amount {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  text-align: right;
  white-space: nowrap;
}

.payment-due {
  display: flex;
  align-items: center;
  justify-content: center;
}

.payment-due__input {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  width: 48px;
  text-align: center;
  padding: 0.3rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
  -moz-appearance: textfield;
}

.payment-due__input::-webkit-outer-spin-button,
.payment-due__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.payment-due__input:focus {
  border-color: var(--accent-primary);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

.payment-paid-date {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}


/* ──────────────────────────────────────────────
 * Status Pills
 * ────────────────────────────────────────────── */

.payment-pill {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  text-align: center;
  white-space: nowrap;
}

.pill-paid {
  background: var(--accent-positive-bg);
  color: var(--accent-positive);
}

.pill-due {
  background: rgba(251, 191, 36, 0.10);
  color: var(--accent-private);
}

.pill-overdue {
  background: var(--accent-negative-bg);
  color: var(--accent-negative);
  animation: overduePulse 2s ease-in-out infinite;
}

@keyframes overduePulse {
  0%, 100% { box-shadow: none; }
  50%      { box-shadow: 0 0 12px rgba(248, 113, 113, 0.35); }
}


/* ──────────────────────────────────────────────
 * Payment Empty State
 * ────────────────────────────────────────────── */

.payment-empty-state {
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}


/* ──────────────────────────────────────────────
 * Payment History Grid
 * ────────────────────────────────────────────── */

.pmt-history-section {
  margin-top: var(--space-md);
}

.pmt-history-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
  color: var(--text-secondary);
}

.pmt-history-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-sm);
}

.history-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
  text-align: center;
}

.history-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.history-card__month {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.history-card__ratio {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.history-card__pct {
  font-size: 1.1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-positive);
}

.history-card__amount {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}


/* ──────────────────────────────────────────────
 * Screen reader only
 * ────────────────────────────────────────────── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* ══════════════════════════════════════════════════════════════
 * PAYMENT TRACKER — Responsive
 * ══════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .pmt-table-header,
  .payment-row {
    grid-template-columns: 36px 70px 1fr 90px 60px 80px 70px;
    gap: var(--space-xs);
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

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

  #tab-nav {
    top: 49px;
  }
}

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

  .payment-row {
    grid-template-columns: 36px 1fr auto;
    grid-template-rows: auto auto;
    gap: var(--space-xs) var(--space-sm);
    padding: var(--space-md);
  }

  .payment-checkbox {
    grid-row: 1 / 3;
  }

  .payment-cat {
    display: none;
  }

  .payment-name {
    grid-column: 2;
    font-size: 0.8rem;
  }

  .payment-amount {
    grid-column: 3;
    grid-row: 1;
    font-size: 0.8rem;
  }

  .payment-due {
    grid-column: 2;
    grid-row: 2;
    justify-content: flex-start;
  }

  .payment-due::before {
    content: 'Due: ';
    font-size: 0.7rem;
    color: var(--text-muted);
  }

  .payment-pill {
    grid-column: 3;
    grid-row: 2;
  }

  .payment-paid-date {
    display: none;
  }

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

  .tab-btn {
    padding: 0.7rem 1rem;
    font-size: 0.8rem;
  }

  .tab-label {
    display: none;
  }

  .tab-icon {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  #tab-payments #payment-tracker-section {
    padding: var(--space-md);
  }

  .pmt-month-title {
    font-size: 1.1rem;
  }

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



/* ══════════════════════════════════════════════════════════════
 * LOGIN GATE
 * ══════════════════════════════════════════════════════════════ */

body.is-locked > header,
body.is-locked > nav,
body.is-locked > main,
body.is-locked > .modal {
  display: none !important;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  background: var(--bg-body);
}

.login-gate.hidden { display: none; }

.login-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-xl);
  text-align: center;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.login-title .accent { color: var(--accent-primary); }

.login-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.login-input {
  text-align: center;
  font-size: 1rem;
  letter-spacing: 0.1em;
}

.login-btn { width: 100%; }

.login-error {
  font-size: 0.8rem;
  color: var(--accent-negative);
}

.login-error.hidden { display: none; }


/* ══════════════════════════════════════════════════════════════
 * SALARY AFFORDABILITY WARNING
 * ══════════════════════════════════════════════════════════════ */

.salary-warning {
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--accent-warning);
  background: rgba(251, 146, 60, 0.10);
  border: 1px solid rgba(251, 146, 60, 0.28);
  border-radius: var(--radius-md);
}

.salary-warning.hidden { display: none; }


/* ══════════════════════════════════════════════════════════════
 * EXPENSE ROSTER TOTALS
 * ══════════════════════════════════════════════════════════════ */

.expense-totals {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
}


/* ══════════════════════════════════════════════════════════════
 * PAYMENT SUMMARY — Total / Paid / Remaining
 * ══════════════════════════════════════════════════════════════ */

.pmt-summary {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}

.pmt-summary-head {
  display: flex;
  align-items: baseline;
  gap: 0.5ch;
  margin-bottom: var(--space-md);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pmt-summary-scope-label { color: var(--text-muted); }

.pmt-summary-scope {
  font-weight: 700;
  color: var(--accent-primary);
}

.pmt-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.pmt-summary-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left-width: 3px;
  border-radius: var(--radius-md);
}

.pmt-summary-card--total     { border-left-color: var(--text-secondary); }
.pmt-summary-card--paid      { border-left-color: var(--accent-positive); }
.pmt-summary-card--remaining { border-left-color: var(--accent-warning); }

.pmt-summary-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.pmt-summary-value {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-primary);
}

.pmt-summary-card--paid      .pmt-summary-value { color: var(--accent-positive); }
.pmt-summary-card--remaining .pmt-summary-value { color: var(--accent-warning); }

.pmt-summary-meta {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.pmt-summary-overdue {
  display: flex;
  align-items: center;
  gap: 0.5ch;
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-negative);
  background: var(--accent-negative-bg);
  border-radius: var(--radius-md);
}

.pmt-summary-overdue-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-negative);
  flex-shrink: 0;
}

.pmt-summary-split {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.pmt-split-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
}

.pmt-split-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.pmt-split-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-primary);
}

.pmt-split-left { color: var(--accent-warning); }


/* ══════════════════════════════════════════════════════════════
 * HISTORY CARDS — current month + status states
 * ══════════════════════════════════════════════════════════════ */

.pmt-history-grid {
  grid-template-columns: repeat(7, 1fr);
}

.history-card__now {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  font-size: 0.55rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bg-body);
  background: var(--accent-primary);
  border-radius: 999px;
  vertical-align: middle;
}

.history-card--current {
  border-color: rgba(212, 175, 55, 0.35);
  background: rgba(212, 175, 55, 0.05);
}

.history-card--active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.35);
}

.history-card--complete .history-card__pct { color: var(--accent-positive); }
.history-card--overdue  .history-card__pct { color: var(--accent-warning); }

.history-card__bar {
  display: block;
  width: 100%;
  height: 3px;
  margin: 2px 0;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  overflow: hidden;
}

.history-card__bar-fill {
  display: block;
  height: 100%;
  background: var(--accent-positive);
  border-radius: 999px;
  transition: width var(--transition-base, 0.3s) ease;
}

.history-card--overdue .history-card__bar-fill { background: var(--accent-warning); }

.history-card__left {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  color: var(--accent-warning);
}

.history-card__left--clear { color: var(--accent-positive); }

.payment-row--overdue { background: rgba(248, 113, 113, 0.04); }

.payment-archived-tag {
  margin-left: 0.5ch;
  padding: 1px 6px;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
}


/* ── Responsive ──────────────────────────────── */

/* The history grid gained a 7th card (the current month). These rules come
 * after every earlier .pmt-history-grid declaration, so they own the column
 * count at all widths — restating each existing breakpoint rather than
 * leaving the older 1024/768/480 rules to be overridden out of order. */
@media (max-width: 1200px) {
  .pmt-history-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1024px) {
  .pmt-history-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .pmt-summary-grid  { grid-template-columns: 1fr; }
  .pmt-summary-split { grid-template-columns: 1fr; }
}

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

@media (max-width: 480px) {
  .pmt-history-grid { grid-template-columns: repeat(2, 1fr); }
  .pmt-summary-value { font-size: 1.25rem; }
}


/* ══════════════════════════════════════════════════════════════
 * EXPENSE REGISTER — due-day column
 * ══════════════════════════════════════════════════════════════ */

.expense-table-head,
.expense-row {
  display: grid;
  grid-template-columns: 80px 1fr 100px 100px 84px 80px;
  gap: 1rem;
  align-items: center;
  padding: 0.5rem 1rem;
}

.expense-table-head {
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.exp-dueday { display: flex; justify-content: center; }

.exp-dueday__input {
  width: 56px;
  padding: 0.25rem 0.35rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.exp-dueday__input:hover  { border-color: var(--border-medium); }
.exp-dueday__input:focus  {
  outline: none;
  background: var(--bg-input-focus);
  border-color: var(--accent-primary);
}

/* Hide the spinner arrows so the narrow field stays readable */
.exp-dueday__input::-webkit-outer-spin-button,
.exp-dueday__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.exp-dueday__input { -moz-appearance: textfield; appearance: textfield; }

@media (max-width: 900px) {
  .expense-table-head,
  .expense-row {
    grid-template-columns: 70px 1fr 90px 76px 70px;
    gap: 0.5rem;
    font-size: 0.8rem;
  }
  /* Drop the Annual column on narrow screens, keep Due Day */
  .expense-table-head > div:nth-child(4),
  .expense-row > span:nth-child(4) { display: none; }
}

@media (max-width: 560px) {
  .expense-table-head,
  .expense-row { grid-template-columns: 1fr 84px 60px 64px; }
  .expense-table-head > div:nth-child(1),
  .expense-row > span:nth-child(1) { display: none; }
}


/* ══════════════════════════════════════════════════════════════
 * PAYMENT TRACKER — bulk actions
 * ══════════════════════════════════════════════════════════════ */

.pmt-filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.pmt-bulk-group {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.pmt-bulk-btn {
  padding: 0.4rem 0.85rem;
  font-family: var(--font-family);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.pmt-bulk-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.pmt-bulk-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.pmt-bulk-btn--pay {
  color: var(--accent-positive);
  border-color: rgba(52, 211, 153, 0.30);
  background: var(--accent-positive-bg);
}

.pmt-bulk-btn--pay:hover:not(:disabled) {
  color: var(--accent-positive);
  background: rgba(52, 211, 153, 0.18);
  border-color: rgba(52, 211, 153, 0.50);
}

@media (max-width: 700px) {
  .pmt-filters-bar { flex-direction: column; align-items: stretch; }
  .pmt-bulk-group  { justify-content: stretch; }
  .pmt-bulk-btn    { flex: 1; }
}
