/* ==========================================================================
   Calcapay — Premium Fintech Design System
   Engineered for US Financial & Daily Utility Tools (Stripe/Linear Polish)
   ========================================================================== */

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/assets/fonts/plus-jakarta-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Dark Theme Palette (Fintech Sleek) */
  --bg-main: #090d16;
  --bg-surface: #101726;
  --bg-card: #151e32;
  --bg-card-hover: #1b263f;
  --bg-input: #0c1220;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-focus: #10b981;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #090d16;

  /* Accents */
  --accent-emerald: #10b981;
  --accent-emerald-subtle: rgba(16, 185, 129, 0.12);
  --accent-emerald-glow: rgba(16, 185, 129, 0.25);
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-teal: #14b8a6;

  /* Ad units */
  --ad-bg: rgba(255, 255, 255, 0.02);
  --ad-border: rgba(255, 255, 255, 0.09);
  --ad-text: #94a3b8;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-main: #f4f6fa;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #f8fafc;

  --border-subtle: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-focus: #059669;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --accent-emerald-subtle: rgba(16, 185, 129, 0.12);
  --ad-bg: #f1f5f9;
  --ad-border: #cbd5e1;
  --ad-text: #64748b;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 3000;
  background: rgba(16, 23, 38, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, 0.95);
}

.header-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

/* Inline SVG logo: icon takes the accent colour, wordmark the text colour, so it follows the theme */
.site-logo {
  display: block;
  height: 26px;
  width: auto;
}

.site-logo-icon {
  stroke: var(--accent-emerald);
}

.site-logo-word {
  stroke: var(--text-primary);
}

.site-footer .site-logo {
  height: 22px;
}

.search-wrapper {
  flex: 1;
  max-width: 420px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: color 0.18s ease;
}

.search-wrapper:focus-within .search-icon {
  color: var(--accent-emerald);
}

.search-wrapper input {
  width: 100%;
  height: 40px;
  padding: 0 4.2rem 0 2.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.search-wrapper input:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px var(--accent-emerald-glow);
  background: var(--bg-surface);
}

.search-shortcut {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  background: var(--border-subtle);
  border: 1px solid var(--border-hover);
  padding: 2px 7px;
  border-radius: 6px;
  pointer-events: none;
  line-height: 1.4;
}

/* Floating Instant Global Search Results Dropdown */
.search-results-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  z-index: 10000;
  overflow: hidden;
  display: none;
  flex-direction: column;
  animation: searchDropFade 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .search-results-dropdown {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

@keyframes searchDropFade {
  from { opacity: 0; transform: translateY(-4px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.search-results-dropdown.active {
  display: flex;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition);
}

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

.search-result-item:hover,
.search-result-item.highlighted {
  background: rgba(16, 185, 129, 0.12);
}

.search-result-icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
}

.search-result-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.search-result-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-emerald);
  background: var(--accent-emerald-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.search-no-results {
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: var(--transition);
}

.icon-button:hover {
  color: var(--text-primary);
  border-color: var(--accent-emerald);
}

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

/* Category Navigation Bar */
.category-nav-wrapper {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
  width: 100%;
}

.category-nav-container {
  max-width: 1360px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
}

.category-nav {
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding: 0.35rem 0.25rem;
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.category-nav-inner {
  display: inline-flex;
  width: max-content;
  gap: 0.35rem;
  align-items: center;
}

.nav-scroll-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  z-index: 2;
  padding: 0;
  flex-shrink: 0;
}

.nav-scroll-btn:hover {
  color: #fff;
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  transform: scale(1.05);
}

.nav-scroll-btn:focus-visible {
  outline: 2px solid var(--accent-emerald);
  outline-offset: 2px;
}

.nav-scroll-prev {
  margin-right: 0.35rem;
}

.nav-scroll-next {
  margin-left: 0.35rem;
}

.nav-tab {
  padding: 0.6rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
  text-decoration: none;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  color: #fff;
  background: var(--accent-emerald);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

/* ==========================================================================
   Ad Placements (Google AdSense / Mediavine Compatible Units)
   ========================================================================== */

.ad-container {
  max-width: 1320px;
  margin: 1.25rem auto 0;
  padding: 0 1.5rem;
}

/* ==========================================================================
   Main Layout Container (Fixes Squishing & Header Clipping)
   ========================================================================== */

.main-layout-container {
  max-width: 1320px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.5rem;
  flex: 1;
  width: 100%;
}

.layout-grid {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 2rem;
  align-items: start;
}

.calculator-workspace {
  min-width: 0; /* Prevents CSS grid overflow */
  scroll-margin-top: 130px;
}

.calculator-panel {
  display: none;
  scroll-margin-top: 130px;
  animation: panelFade 0.2s ease-out;
}

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

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

/* Panel Header */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  padding-bottom: 0.5rem;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 0.45rem;
}

.badge-emerald { background: var(--accent-emerald-subtle); color: var(--accent-emerald); }
.badge-indigo { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); }
.badge-amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.badge-teal { background: rgba(20, 184, 166, 0.15); color: var(--accent-teal); }

.panel-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: var(--text-primary);
}

.panel-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  max-width: 700px;
}

.btn-action-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
}

.btn-action-outline:hover {
  color: var(--text-primary);
  border-color: var(--accent-emerald);
}

/* ==========================================================================
   Calculator 2-Column Split: Inputs (Left) vs Results (Right)
   Spacious, readable, never squished!
   ========================================================================== */

.calc-split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  width: 100%;
}

.calc-form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  width: 100%;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
  min-width: 0;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Form Input Styling (Fintech Sleek, Dark/Light Mode Compatible)
   Ensures ALL inputs match theme tokens and NEVER look like browser defaults
   ========================================================================== */

/* 1. Universal Base Styling for All Form Inputs */
input[type="text"]:not(#globalSearchInput):not(.custom-select-search-input),
input[type="number"],
input[type="email"],
input[type="password"],
input[type="tel"] {
  display: block;
  width: 100%;
  height: 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0 0.95rem;
  outline: none;
  transition: var(--transition);
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]:not(#globalSearchInput):not(.custom-select-search-input):hover,
input[type="number"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="tel"]:hover {
  border-color: var(--border-hover);
}

input[type="text"]:not(#globalSearchInput):not(.custom-select-search-input):focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px var(--accent-emerald-glow);
}

input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* 2. Input Fields with Affix - Clean Fintech Styling (Guaranteed No Overflow) */
.input-with-affix {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  height: 44px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.input-with-affix:hover {
  border-color: var(--border-hover);
}

.input-with-affix:focus-within {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px var(--accent-emerald-glow);
}

.affix {
  padding: 0 0.2rem 0 0.85rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-muted);
  user-select: none;
  flex-shrink: 0;
}

.input-with-affix input[type="text"],
.input-with-affix input[type="number"],
.input-with-affix input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--text-primary);
  padding: 0 0.75rem 0 0.4rem !important;
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  min-width: 0;
  width: 100%;
  height: 100% !important;
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
}

.input-with-affix.affix-right input[type="text"],
.input-with-affix.affix-right input[type="number"],
.input-with-affix.affix-right input {
  padding: 0 0.4rem 0 0.75rem !important;
}

.input-with-affix.affix-right .affix {
  padding: 0 0.85rem 0 0.2rem;
}

/* ==========================================================================
   Remove Browser Native Up/Down Spinners on Number Inputs
   Fintech inputs should never show jarring default browser white boxes
   ========================================================================== */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 0 !important;
  display: none !important;
}

input[type="number"] {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0 2.5rem 0 0.95rem;
  height: 44px;
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  transition: var(--transition);
  cursor: pointer;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  text-overflow: ellipsis;
  white-space: nowrap;
}

select:hover {
  border-color: var(--border-hover);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

select:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px var(--accent-emerald-glow);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

[data-theme="light"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

[data-theme="light"] select:hover,
[data-theme="light"] select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23059669' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

select option {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  padding: 10px 14px;
  font-weight: 500;
}

/* ==========================================================================
   Searchable Custom Select Dropdown System (Type & Search Support)
   ========================================================================== */

.custom-select-wrapper {
  position: relative;
  width: 100%;
  min-width: 0;
}

.custom-select-wrapper.open {
  z-index: 10001;
}

.form-group:has(.custom-select-wrapper.open),
.form-row-2:has(.custom-select-wrapper.open) {
  z-index: 10001;
  position: relative;
}

.custom-select-wrapper select {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  border: none;
  overflow: hidden;
  z-index: -1;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0 0.85rem;
  height: 44px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  width: 100%;
  box-sizing: border-box;
}

.custom-select-trigger:hover {
  border-color: var(--border-hover);
}

.custom-select-wrapper.open .custom-select-trigger,
.custom-select-trigger:focus-visible {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px var(--accent-emerald-glow);
  outline: none;
}

.custom-select-trigger-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 0.35rem;
  flex: 1;
  min-width: 0;
}

.custom-select-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
  flex-shrink: 0;
}

.custom-select-wrapper.open .custom-select-chevron {
  transform: rotate(180deg);
  color: var(--accent-emerald);
}

/* Floating Custom Options Menu */
.custom-select-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 360px;
  width: max-content;
  max-width: min(440px, 94vw);
  z-index: 10002;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: dropdownFadeIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Smart Upward Direction if near bottom of viewport */
.custom-select-wrapper.open-upward .custom-select-options {
  top: auto;
  bottom: calc(100% + 6px);
  box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

@media (max-width: 640px) {
  .custom-select-options {
    min-width: 100%;
    max-width: 100%;
    width: 100%;
    right: 0;
    left: 0;
  }
}

[data-theme="light"] .custom-select-options {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.14);
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.custom-select-wrapper.open .custom-select-options {
  display: flex;
}

/* Enclosed Search Box Container */
.custom-select-search-box {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-surface);
  padding: 0.65rem 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="light"] .custom-select-search-box {
  background: #f8fafc;
}

.custom-select-search-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.custom-select-search-field .search-box-icon {
  position: absolute;
  left: 12px;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.15s ease;
  z-index: 2;
}

.custom-select-search-field:focus-within .search-box-icon {
  color: var(--accent-emerald);
}

.custom-select-search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.5rem 2.2rem 0.5rem 2.35rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-sizing: border-box;
}

.custom-select-search-input:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px var(--accent-emerald-glow);
  background: var(--bg-surface);
}

.custom-select-clear-btn {
  position: absolute;
  right: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: var(--text-muted);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: all 0.15s ease;
  z-index: 2;
}

.custom-select-clear-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: var(--text-primary);
}

/* Quick Filter Badges inside Dropdown */
.custom-select-pills {
  display: flex;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem 0.5rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
}

.custom-select-pills::-webkit-scrollbar {
  display: none;
}

[data-theme="light"] .custom-select-pills {
  background: #f8fafc;
}

.select-pill {
  font-size: 0.73rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.select-pill:hover {
  border-color: var(--accent-emerald);
  color: var(--text-primary);
  background: rgba(16, 185, 129, 0.08);
}

.select-pill.active {
  background: var(--accent-emerald-subtle);
  color: var(--accent-emerald);
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 1px var(--accent-emerald);
}

/* Custom Sleek Scrollbar for Dropdown List */
.custom-select-list {
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden; /* STRICTLY PREVENT HORIZONTAL SCROLLBAR */
  padding: 0.4rem;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

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

.custom-select-list::-webkit-scrollbar-track {
  background: transparent;
}

.custom-select-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
}

.custom-select-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent-emerald);
}

[data-theme="light"] .custom-select-list {
  scrollbar-color: #cbd5e1 transparent;
}

[data-theme="light"] .custom-select-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

.custom-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  gap: 0.5rem;
}

.custom-select-opt-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-option:hover {
  background: rgba(16, 185, 129, 0.12);
  color: var(--text-primary);
}

[data-theme="light"] .custom-select-option:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.custom-select-option.selected {
  background: var(--accent-emerald-subtle);
  color: var(--accent-emerald);
  font-weight: 700;
}

.opt-state-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
  gap: 0.75rem;
}

.opt-state-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.opt-state-rate {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.opt-state-rate.zero-tax {
  color: var(--accent-emerald);
  background: var(--accent-emerald-subtle);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.custom-select-check {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-emerald);
  opacity: 0;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.custom-select-option.selected .custom-select-check {
  opacity: 1;
}

.custom-select-empty {
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-muted);
  display: none;
}

.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Range Slider */
.slider-control-group {
  margin-top: 0.25rem;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.slider-value {
  color: var(--accent-emerald);
  font-weight: 700;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.range-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 4px;
  background: var(--border-subtle);
  outline: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-emerald);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
  transition: transform 0.1s;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* Button Group Pills for Tips */
.button-group-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.pill-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.65rem 0.25rem;
  text-align: center;
  transition: var(--transition);
}

.pill-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-amber);
}

.pill-btn.active {
  background: var(--accent-amber);
  color: #0b0f19;
  border-color: var(--accent-amber);
  font-weight: 700;
}

/* Stepper Input */
.stepper-input {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  height: 44px;
  overflow: hidden;
}

.stepper-btn {
  width: 44px;
  height: 100%;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-surface);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stepper-btn:hover {
  background: var(--accent-emerald);
  color: #fff;
}

.stepper-input input {
  flex: 1;
  text-align: center;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 700;
  outline: none;
  height: 100% !important;
  padding: 0 !important;
}

/* ==========================================================================
   Results Display Card (High-Impact, Spacious, Never Clipped)
   ========================================================================== */

.calc-results-card {
  background: linear-gradient(145deg, var(--bg-surface), var(--bg-card));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
}

@media (min-width: 901px) {
  .calc-results-card {
    position: sticky;
    top: 85px;
    z-index: 10;
    max-height: calc(100vh - 105px);
    overflow-y: auto;
    scrollbar-width: thin;
  }
}

.calc-results-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: linear-gradient(90deg, #10b981, #06b6d4, #3b82f6);
}

/* Visual Stacked Breakdown Chart */
.breakdown-chart-wrap {
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.breakdown-bar {
  display: flex;
  height: 12px;
  width: 100%;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.bar-segment {
  height: 100%;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 0;
}

.bar-segment-net, .bar-segment-pi { background: #10b981; }
.bar-segment-fed, .bar-segment-tax { background: #3b82f6; }
.bar-segment-fica, .bar-segment-ins { background: #f59e0b; }
.bar-segment-state, .bar-segment-hoa { background: #8b5cf6; }
.bar-segment-pmi { background: #ec4899; }

.breakdown-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.85rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

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

.dot-net, .dot-pi { background: #10b981; }
.dot-fed, .dot-tax { background: #3b82f6; }
.dot-fica, .dot-ins { background: #f59e0b; }
.dot-state, .dot-hoa { background: #8b5cf6; }
.dot-pmi { background: #ec4899; }


.results-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1.1rem;
}

.results-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.results-subtitle {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.pct-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent-emerald-subtle);
  color: var(--accent-emerald);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.net-pay-amount {
  font-size: clamp(1.85rem, 2.5vw, 2.4rem);
  font-weight: 800;
  color: var(--accent-emerald);
  letter-spacing: -0.02em;
  margin: 0.35rem 0 0.15rem;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
}

.net-pay-cycle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Horizontal Stacked Progress Bar (Sleek & Never Cramped) */
.stacked-progress-container {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.stacked-bar {
  display: flex;
  height: 10px;
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
}

.bar-segment {
  height: 100%;
  transition: width 0.3s ease;
}

.seg-net { background: var(--accent-emerald); }
.seg-fed { background: var(--accent-rose); }
.seg-fica { background: var(--accent-amber); }
.seg-state { background: var(--accent-indigo); }
.seg-pretax { background: var(--accent-teal); }

/* Breakdown List */
.metrics-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.86rem;
}

.metric-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.metric-name {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.metric-val {
  margin-left: auto;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-emerald { color: var(--accent-emerald); }

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

.dot-emerald { background: var(--accent-emerald); }
.dot-rose { background: var(--accent-rose); }
.dot-amber { background: var(--accent-amber); }
.dot-indigo { background: var(--accent-indigo); }
.dot-teal { background: var(--accent-teal); }
.dot-slate { background: var(--text-muted); }

/* Quick Frequency Stat Pills */
.per-paycheck-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.1rem;
}

.pill-stat {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.4rem;
  text-align: center;
}

.pill-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pill-val {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Tip guidance reference */
.tip-guidance-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.8rem;
}

.tip-guidance-box ul {
  margin-top: 0.5rem;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   SEO Educational Article Section
   ========================================================================== */

/* ==========================================================================
   Right Sidebar Column
   ========================================================================== */

.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.35rem;
}

.sidebar-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
}

.sidebar-text {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.privacy-callout {
  display: flex;
  gap: 0.85rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(6, 182, 212, 0.08));
  border-color: rgba(16, 185, 129, 0.2);
}

.privacy-callout .shield-icon {
  font-size: 1.6rem;
}

.privacy-callout h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-emerald);
}

.privacy-callout p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.45;
}

/* ==========================================================================
   Footer & Legal Modal
   ========================================================================== */

.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
  padding: 3rem 1.5rem 2rem;
  font-size: 0.85rem;
}

.footer-container {
  max-width: 1320px;
  margin: 0 auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2.5rem;
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  max-width: 380px;
  line-height: 1.6;
}

.footer-links-col h4 {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.footer-links-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-links-col a{
  color: var(--text-secondary);
  font-size: inherit;
  text-align: left;
  padding: 0;
  transition: var(--transition);
}

.footer-links-col a:hover{
  color: var(--accent-emerald);
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.75rem;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.6;
}

/* Legal Modal */

@keyframes modalPop {
  from { transform: scale(0.97); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

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

  .sidebar-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

}

@media (max-width: 1024px) {
  .calc-split-grid {
    grid-template-columns: 1fr;
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 850px) {
  .panel-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
    width: 100%;
  }

  .panel-title-group {
    width: 100%;
    max-width: 100%;
  }

  .panel-title {
    font-size: 1.6rem;
    line-height: 1.25;
    width: 100%;
    max-width: 100%;
  }

  .panel-desc {
    max-width: 100%;
    width: 100%;
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .print-btn {
    align-self: flex-start;
    margin-top: 0.15rem;
  }
}

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

@media (max-width: 580px) {
  .header-container {
    padding: 0.65rem 1rem;
  }

  .search-wrapper {
    display: none;
  }

  .form-row-2 {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .footer-top {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

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

/* ==========================================================================
   Informational SEO & FAQ Section Styling
   ========================================================================== */

/* ==========================================================================
   Venmo / Text Split Share Button Styling
   ========================================================================== */

.tip-share-container {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.btn-venmo-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #008cff, #0056b3);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 140, 255, 0.3);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-venmo-share:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 140, 255, 0.4);
}

.btn-venmo-share:active {
  transform: scale(0.97);
}

.copy-toast {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-emerald);
  background: var(--accent-emerald-subtle);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  animation: fadeInToast 0.25s ease-out;
}

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

/* ==========================================================================
   Mobile Bottom App Bar (Sticky Thumb Navigation for US Users)
   ========================================================================== */

.mobile-bottom-bar {
  display: none;
}

@media (max-width: 768px) {
  .site-header {
    position: relative; /* Scrolls naturally with page on phone so it doesn't block screen or cover footer */
  }

  .site-footer {
    padding-bottom: calc(85px + env(safe-area-inset-bottom)); /* Seamless background padding behind mobile bottom bar */
  }

  .mobile-bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    padding: 0.4rem 0.5rem calc(0.45rem + env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    padding: 0.35rem 0.65rem;
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    flex: 1;
    max-width: 75px;
  }

  .mobile-nav-item .mobile-nav-icon {
    font-size: 1.25rem;
    line-height: 1;
    transition: transform 0.15s ease;
  }

  .mobile-nav-item .mobile-nav-label {
    letter-spacing: -0.01em;
  }

  .mobile-nav-item:active {
    transform: scale(0.92);
  }

  .mobile-nav-item.active {
    color: var(--accent-emerald);
    background: var(--accent-emerald-subtle);
  }

  .mobile-nav-item.active .mobile-nav-icon {
    transform: scale(1.15);
  }

  /* Make header and category nav even sleeker on phone */
  .category-nav-inner {
    padding: 0.35rem 0.75rem;
    gap: 0.35rem;
  }

  .nav-tab {
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
  }

  .panel-title {
    font-size: 1.5rem;
  }

  .net-pay-amount {
    font-size: 2.2rem;
  }

  .calc-form-card, .calc-results-card {
    padding: 1.15rem;
  }

  .slider-control-group {
    padding: 0.85rem;
  }

  /* Mobile Floating Quick-Result Bar */
  .mobile-floating-result {
    display: flex;
    position: fixed;
    bottom: calc(64px + env(safe-area-inset-bottom));
    left: 0.75rem;
    right: 0.75rem;
    background: rgba(16, 23, 38, 0.95);
    border: 1px solid rgba(16, 185, 129, 0.5);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-md);
    padding: 0.65rem 1rem;
    align-items: center;
    justify-content: space-between;
    z-index: 9998;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  [data-theme="light"] .mobile-floating-result {
    background: rgba(255, 255, 255, 0.96);
    border-color: #10b981;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  }

  .mobile-floating-result.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
  }

  .mfr-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .mfr-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .mfr-val {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent-emerald);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
  }

  .mfr-jump-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--accent-emerald);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    padding: 0.45rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
    flex-shrink: 0;
    transition: var(--transition);
  }

  .mfr-jump-btn:active {
    transform: scale(0.96);
  }
}

.mobile-floating-result {
  display: none;
}


/* ==========================================================================
   Multi-Page Site Components (links as nav, breadcrumbs, guides, hub, blog)
   ========================================================================== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10002;
  padding: 0.6rem 1rem;
  background: var(--accent-emerald);
  color: var(--text-inverse);
  font-weight: 700;
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
  left: 0;
}

a.nav-tab,
a.mobile-nav-item,
a.logo-link {
  text-decoration: none;
}

.category-nav-inner {
  overflow-x: auto;
  scrollbar-width: none;
}

.category-nav-inner::-webkit-scrollbar {
  display: none;
}

.footer-heading {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.privacy-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.footer-bottom a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Breadcrumbs */
.breadcrumb {
  margin-bottom: 1rem;
  font-size: 0.82rem;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--text-secondary);
}

.guide-content .breadcrumb ol {
  padding: 0;
  margin: 0;
}

.guide-content .breadcrumb li {
  margin: 0;
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.35rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.breadcrumb a:hover {
  color: var(--accent-emerald);
}

/* Standalone pages (hub, legal, blog) */
.page-container {
  width: 100%;
  max-width: 1320px;
  min-width: 0;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.prose-page {
  max-width: 780px;
  margin: 0 auto;
}

/* Long-form guide content */
.guide-content {
  overflow-wrap: break-word;
  min-width: 0;
  margin-top: 2.5rem;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
}

.prose-page.guide-content {
  margin-top: 0;
}

.guide-content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 2.25rem 0 0.75rem;
  line-height: 1.3;
}

.guide-content h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 1.5rem 0 0.5rem;
}

.guide-content p,
.guide-content ul,
.guide-content ol {
  margin-bottom: 1rem;
}

.guide-content ul,
.guide-content ol {
  padding-left: 1.4rem;
}

.guide-content li {
  margin-bottom: 0.4rem;
}

.guide-content strong {
  color: var(--text-primary);
}

.guide-content a {
  color: var(--link-color, var(--accent-emerald));
  text-decoration: underline;
  text-underline-offset: 2px;
}

.guide-content a:hover {
  text-decoration-thickness: 2px;
}

.formula {
  padding: 0.85rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-weight: 600;
  overflow-x: auto;
}

.notice {
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--accent-amber);
  background: rgba(245, 158, 11, 0.08);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.review-note,
.post-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.review-note {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* Data tables */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.data-table,
.guide-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.guide-content > table {
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-subtle);
}

.data-table caption {
  caption-side: top;
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.data-table th,
.data-table td,
.guide-content table th,
.guide-content table td {
  padding: 0.6rem 1rem;
  text-align: right;
  border-top: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child,
.guide-content table th:first-child,
.guide-content table td:first-child {
  text-align: left;
}

.data-table thead th,
.guide-content table thead th {
  color: var(--text-primary);
  font-weight: 700;
  background: var(--bg-surface);
}

.data-table tbody th {
  color: var(--text-primary);
  font-weight: 600;
}

.schedule-details {
  margin-top: 1.5rem;
}

.schedule-details summary,
.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
}

.schedule-details summary {
  padding: 0.85rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
}

.schedule-details .table-wrap {
  max-height: 420px;
  overflow-y: auto;
}

/* FAQ */
.faq-list {
  display: grid;
  gap: 0.6rem;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
}

.faq-item p {
  margin: 0.6rem 0 0;
}

.source-list {
  font-size: 0.9rem;
}

/* State and link grids */
.state-grid {
  list-style: none;
  padding: 0 !important;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 0.35rem 1rem;
}

.state-grid li {
  margin: 0;
}

.state-grid a {
  display: inline-block;
  padding: 0.3rem 0;
}

.related-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.25rem;
}

.related-list a {
  display: block;
  padding: 0.45rem 0.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.related-list a:hover {
  color: var(--accent-emerald);
}

/* Hub (home) page */
.hub-hero {
  max-width: 820px;
  margin-bottom: 2rem;
}

.hub-section {
  margin-bottom: 2.5rem;
}

.hub-section > h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hub-grid,
.post-list {
  list-style: none;
  padding: 0 !important;
  margin: 0 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem;
}

.hub-grid li,
.post-list li {
  margin: 0;
}

.hub-card,
.post-card {
  display: flex;
  gap: 0.9rem;
  height: 100%;
  padding: 1.1rem 1.2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none !important;
  color: inherit;
  transition: var(--transition);
}

.post-card {
  flex-direction: column;
  gap: 0.4rem;
}

.hub-card:hover,
.post-card:hover {
  border-color: var(--accent-emerald);
  background: var(--bg-card);
}

.hub-card-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.hub-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.hub-card-title,
.post-card-title {
  font-weight: 700;
  color: var(--text-primary);
}

.hub-card-desc,
.post-card-desc,
.post-card-date {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.post-card-date {
  font-size: 0.8rem;
}

.post-cta {
  margin-top: 2rem;
  padding: 1.25rem 1.4rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.post-cta h2 {
  margin-top: 0;
}

.post-cta a.btn-action-outline {
  display: inline-flex;
  text-decoration: none;
  color: var(--text-primary);
}

/* Real ad units: space is reserved so content does not shift when an ad loads */
.ad-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 0.35rem;
}

.ad-in-content {
  min-height: 280px;
  margin: 2rem 0 0;
}

.ad-sidebar {
  min-height: 280px;
}

@media (max-width: 768px) {
  .page-container {
    padding: 1.25rem 1rem 6rem;
  }

  .data-table th,
  .data-table td,
  .guide-content table th,
  .guide-content table td {
    padding: 0.5rem 0.65rem;
  }
}

@media print {
  @page {
    margin: 1.5cm;
    size: letter;
  }

  body {
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 10.5pt !important;
    line-height: 1.4 !important;
  }

  .site-header,
  .site-footer,
  .mobile-bottom-bar,
  .mobile-floating-result,
  .sidebar-column,
  .guide-content,
  .breadcrumb,
  .btn-action-outline,
  [data-print],
  .print-btn,
  .ad-container,
  .category-nav-wrapper {
    display: none !important;
  }

  .main-layout-container {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .layout-grid {
    display: block !important;
  }

  .calc-split-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1.5rem !important;
  }

  .calc-form-card,
  .calc-results-card {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    color: #0f172a !important;
    page-break-inside: avoid !important;
    position: static !important;
    max-height: none !important;
  }

  .calc-results-card::before {
    display: none !important;
  }

  .results-header,
  .metric-row {
    border-color: #e2e8f0 !important;
  }

  .net-pay-amount {
    color: #059669 !important;
  }

  .metric-name,
  .results-subtitle,
  .net-pay-cycle,
  label {
    color: #475569 !important;
  }

  .metric-val {
    color: #0f172a !important;
  }

  .input-with-affix,
  input,
  select {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .breakdown-bar {
    border: 1px solid #cbd5e1 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Contrast fixes (WCAG AA) */
:root {
  --text-muted: #8494a8;
}

.nav-tab.active {
  color: #04130d;
}

[data-theme="light"] .nav-tab.active {
  color: #fff;
}

.footer-bottom p {
  color: var(--text-secondary);
}

/* Light theme: emerald and muted greys are too pale on white for body-size text */
[data-theme="light"] {
  --accent-emerald: #047857;
  --link-color: #047857;
  --text-muted: #5b6b80;
}

[data-theme="light"] .badge-indigo {
  color: #4338ca;
}

[data-theme="light"] .badge-emerald,
[data-theme="light"] .badge-teal {
  color: #046c4e;
}

[data-theme="light"] .badge-amber {
  color: #92400e;
}

[data-theme="light"] .search-shortcut {
  color: var(--text-secondary);
}

/* Checkbox row inside calculator forms */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: var(--accent-emerald);
}

.form-check label {
  display: inline;
  flex: 1;
  width: auto;
  margin: 0;
  font-weight: 500;
  line-height: 1.45;
}

/* Secondary result block that compares the main result with an alternative */
.compare-callout {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.compare-callout-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-amber);
  margin: 0.25rem 0 0.75rem;
  font-variant-numeric: tabular-nums;
}

[data-theme="light"] .compare-callout-value {
  color: #92400e;
}

/* Data basis and review date under the page heading */
.trust-line {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.trust-line a {
  color: var(--link-color, var(--accent-emerald));
  text-decoration: underline;
  text-underline-offset: 2px;
}

