/* =============================================
   CalcEasy — Design System v3
   Professional · Editorial · Mobile-first
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --primary:          #2563EB;
  --primary-dark:     #1D4ED8;
  --primary-light:    #EFF6FF;
  --primary-mid:      #BFDBFE;
  --success:          #059669;
  --success-light:    #ECFDF5;
  --warning:          #D97706;
  --warning-light:    #FFFBEB;
  --danger:           #DC2626;
  --danger-light:     #FEF2F2;
  --gray-50:          #F9FAFB;
  --gray-100:         #F3F4F6;
  --gray-200:         #E5E7EB;
  --gray-300:         #D1D5DB;
  --gray-400:         #9CA3AF;
  --gray-500:         #6B7280;
  --gray-600:         #4B5563;
  --gray-700:         #374151;
  --gray-800:         #1F2937;
  --gray-900:         #111827;
  --text-primary:     var(--gray-900);
  --text-secondary:   var(--gray-600);
  --text-muted:       var(--gray-400);
  --bg:               #FFFFFF;
  --surface:          var(--gray-50);
  --surface-2:        var(--gray-100);
  --border:           var(--gray-200);
  --border-strong:    var(--gray-300);
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.09), 0 4px 8px rgba(0,0,0,0.04);
  --radius-xs:  4px;
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --font-body:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --header-h:   64px;
  --max-w:      1200px;
  --ad-above-fold-h-mobile:  56px;
  --ad-above-fold-h-desktop: 90px;
  --ad-sidebar-w:            300px;
  --ad-sidebar-h:            600px;
  --ad-in-content-h:         250px;
}

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; font-size: 16px; }
body { font-family: var(--font-body); font-size: 1rem; line-height: 1.6; color: var(--text-primary); background: var(--bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow-x: hidden; }
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { text-decoration: underline; color: var(--primary-dark); }
ul, ol { padding-left: 1.5em; }

/* TYPOGRAPHY */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.025em; color: var(--gray-900); }
h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.015em; margin-bottom: 0.6em; color: var(--gray-900); }
h3 { font-size: 1.0625rem; font-weight: 600; line-height: 1.35; margin-bottom: 0.5em; color: var(--gray-800); }
p { margin-bottom: 1em; color: var(--text-secondary); line-height: 1.7; }
p:last-child { margin-bottom: 0; }

/* LAYOUT */
.container { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 16px; }
.page-grid { display: grid; grid-template-columns: 1fr; gap: 24px; padding: 20px 0 56px; }
.main-col { min-width: 0; }

/* HEADER */
.site-header {
  height: var(--header-h);
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
}
.site-header .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.125rem; letter-spacing: -0.02em; color: var(--gray-900); text-decoration: none; flex-shrink: 0; }
.logo:hover { text-decoration: none; color: var(--gray-900); }
.logo-icon { width: 32px; height: 32px; background: var(--primary); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: white; font-size: 0.875rem; font-weight: 800; flex-shrink: 0; }
.logo span { color: var(--primary); }

/* NAV */
.site-nav { display: none; align-items: center; gap: 1px; }
.site-nav a { font-size: 0.8125rem; font-weight: 500; color: var(--text-secondary); padding: 6px 11px; border-radius: var(--radius-sm); transition: color 0.15s, background 0.12s; white-space: nowrap; }
.site-nav a:hover, .site-nav a.active { color: var(--primary); background: var(--primary-light); text-decoration: none; }
.site-nav a.active { font-weight: 600; }

/* HAMBURGER */
.hamburger { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; display: flex; flex-direction: column; gap: 5px; padding: 10px; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; transition: background 0.15s; }
.hamburger:hover { background: var(--gray-100); }
.hamburger span { display: block; width: 16px; height: 1.5px; background: var(--gray-700); border-radius: 2px; transition: all 0.2s; }
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* MOBILE MENU */
.mobile-menu { display: none; position: fixed; top: var(--header-h); left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 199; padding: 8px 12px 20px; max-height: calc(100vh - var(--header-h)); overflow-y: auto; }
.mobile-menu.open { display: block; }
.mobile-menu a { display: flex; align-items: center; gap: 12px; font-size: 0.9375rem; font-weight: 500; color: var(--text-secondary); min-height: 48px; padding: 0 12px; border-radius: var(--radius-md); transition: color 0.12s, background 0.12s; }
.mobile-menu a:hover { color: var(--primary); background: var(--primary-light); text-decoration: none; }

/* BREADCRUMB */
.breadcrumb { font-size: 0.8125rem; color: var(--text-muted); padding: 16px 0 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.breadcrumb a { color: var(--text-muted); font-weight: 400; }
.breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb .sep { color: var(--border-strong); font-size: 0.75rem; }
.breadcrumb .current { color: var(--text-secondary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }

/* CARDS */
.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.card-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; color: var(--gray-900); margin-bottom: 3px; }
.card-subtitle { font-size: 0.875rem; color: var(--text-muted); font-weight: 400; margin-bottom: 20px; }

/* FORM */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 16px; }
label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; letter-spacing: 0; text-transform: none; }

input[type="number"],
input[type="text"],
input[type="date"],
select {
  width: 100%; height: 48px; padding: 0 14px;
  font-size: 16px; font-family: var(--font-body);
  color: var(--text-primary); background: var(--bg);
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none; appearance: none; max-width: 100%;
}
input[type="number"]:hover, input[type="text"]:hover, select:hover { border-color: var(--border-strong); }
input[type="number"]:focus, input[type="text"]:focus, input[type="date"]:focus, select:focus { border-color: var(--primary); background: var(--bg); box-shadow: 0 0 0 3px rgba(37,99,235,0.10); }
input::placeholder { color: var(--gray-400); font-weight: 400; }
input.error, select.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,0.10); }
.field-error { font-size: 0.75rem; color: var(--danger); margin-top: 4px; font-weight: 500; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%239CA3AF' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; cursor: pointer;
}

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 0.8125rem; font-weight: 500; color: var(--text-muted); pointer-events: none; user-select: none; }
.input-wrap input { padding-right: 48px; }

/* RANGE */
.range-wrap { display: flex; flex-direction: column; gap: 4px; }
input[type="range"] { -webkit-appearance: none; width: 100%; height: 44px; background: transparent; border: none; padding: 17px 0; cursor: pointer; box-shadow: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--border); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; background: var(--primary); border-radius: 50%; margin-top: -8px; box-shadow: 0 1px 4px rgba(37,99,235,0.35), 0 0 0 3px rgba(37,99,235,0.08); }
input[type="range"]::-moz-range-track { height: 4px; background: var(--border); border-radius: 2px; border: none; }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; background: var(--primary); border-radius: 50%; border: none; }
.range-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); padding: 0 2px; font-weight: 500; }

/* TABS */
.tab-group { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 3px; gap: 2px; margin-bottom: 20px; }
.tab-btn { flex: 1; min-height: 38px; border: none; background: none; border-radius: calc(var(--radius-md) - 3px); font-size: 0.875rem; font-weight: 500; font-family: var(--font-body); color: var(--text-muted); cursor: pointer; transition: all 0.15s; padding: 0 10px; white-space: nowrap; }
.tab-btn.active { background: var(--bg); color: var(--primary); font-weight: 600; box-shadow: var(--shadow-xs); }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 28px; font-size: 1rem; font-weight: 600; font-family: var(--font-body); border: none; border-radius: var(--radius-md); cursor: pointer; transition: all 0.15s; text-decoration: none; white-space: nowrap; letter-spacing: -0.01em; }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 1px 3px rgba(37,99,235,0.3), 0 2px 8px rgba(37,99,235,0.15); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 2px 6px rgba(37,99,235,0.4), 0 4px 16px rgba(37,99,235,0.2); transform: translateY(-1px); text-decoration: none; color: white; }
.btn-primary:active { transform: translateY(0); box-shadow: none; }
.btn-outline { background: var(--bg); color: var(--primary); border: 1.5px solid var(--primary-mid); }
.btn-outline:hover { background: var(--primary-light); border-color: var(--primary); text-decoration: none; color: var(--primary-dark); }
.btn-full { width: 100%; }
.btn-reset { background: none; border: none; font-size: 0.8125rem; font-weight: 500; color: var(--text-muted); cursor: pointer; padding: 8px 4px; min-height: 36px; font-family: var(--font-body); display: inline-flex; align-items: center; gap: 4px; transition: color 0.15s; }
.btn-reset:hover { color: var(--primary); }

/* RESULT PANEL */
.result-panel { background: linear-gradient(145deg, #EFF6FF 0%, #F0F9FF 100%); border: 1.5px solid #BFDBFE; border-radius: var(--radius-lg); padding: 20px; margin-top: 20px; display: none; }
.result-panel.visible { display: block; }
.result-label { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--primary); margin-bottom: 4px; }
.result-value { font-size: 2rem; font-weight: 700; color: var(--gray-900); letter-spacing: -0.03em; line-height: 1.1; overflow-wrap: break-word; }
.result-sub { font-size: 0.8125rem; color: var(--text-muted); margin-top: 4px; font-weight: 400; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.result-item { background: white; border-radius: var(--radius-md); padding: 12px 14px; border: 1px solid var(--border); }
.result-item .label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 3px; line-height: 1.3; }
.result-item .value { font-size: 1rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; overflow-wrap: break-word; }

/* CHART */
.chart-wrap { margin-top: 20px; background: white; border-radius: var(--radius-md); padding: 16px; border: 1px solid var(--border); overflow: hidden; }
.chart-wrap canvas { max-height: 240px; width: 100% !important; }

/* AD SLOTS */
.ad-slot { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.625rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; overflow: hidden; }
.ad-slot::before { content: 'Advertisement'; opacity: 0.3; }
.ad-above-fold { width: 100%; min-height: var(--ad-above-fold-h-mobile); margin: 14px 0 20px; }
.ad-sidebar { display: none; width: var(--ad-sidebar-w); min-height: var(--ad-sidebar-h); }
.ad-in-content { width: 100%; min-height: var(--ad-in-content-h); margin: 28px auto; max-width: 336px; }

/* AFFILIATE */
.affiliate-cta { margin-top: 20px; }
.affiliate-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: white; border: 1.5px solid var(--border); border-radius: var(--radius-md); text-decoration: none; transition: all 0.15s; width: 100%; min-height: 56px; }
.affiliate-card:hover { border-color: var(--warning); box-shadow: var(--shadow-sm); transform: translateY(-1px); text-decoration: none; background: var(--warning-light); }
.affiliate-logo { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.8125rem; flex-shrink: 0; font-weight: 700; color: var(--primary); font-family: var(--font-mono); }
.affiliate-text { flex: 1; min-width: 0; }
.affiliate-text .partner-name { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 1px; }
.affiliate-text .partner-cta { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.affiliate-arrow { flex-shrink: 0; font-size: 1rem; color: var(--warning); }
.affiliate-label { font-size: 0.625rem; color: var(--text-muted); text-align: right; margin-top: 4px; }

/* SEO CONTENT */
.seo-content { padding-top: 32px; border-top: 1px solid var(--border); margin-top: 32px; }
.seo-content h2 { font-size: 1.125rem; font-weight: 700; margin-top: 28px; margin-bottom: 10px; color: var(--gray-900); letter-spacing: -0.015em; }
.seo-content h2:first-child { margin-top: 0; }
.seo-content p, .seo-content li { color: var(--text-secondary); font-size: 0.9375rem; line-height: 1.75; }
.seo-content ol, .seo-content ul { margin-bottom: 1.2em; }
.seo-content li { margin-bottom: 6px; }
.seo-content strong { color: var(--gray-800); font-weight: 600; }

.formula-box { background: var(--gray-900); color: #E2E8F0; border-radius: var(--radius-md); padding: 16px 20px; font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.8; margin: 12px 0 20px; overflow-x: auto; max-width: 100%; }

.scenario-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 12px; border-left: 3px solid var(--primary-mid); }
.scenario-box h4 { font-size: 0.875rem; font-weight: 700; margin-bottom: 8px; color: var(--gray-800); letter-spacing: -0.01em; }
.scenario-box p { font-size: 0.875rem; margin-bottom: 0; line-height: 1.65; }

/* FAQ */
.faq-list { margin-top: 10px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 6px; overflow: hidden; transition: border-color 0.15s; }
.faq-item:hover { border-color: var(--border-strong); }
.faq-item.open { border-color: var(--primary-mid); }
.faq-question { width: 100%; background: none; border: none; padding: 14px 16px; min-height: 52px; text-align: left; font-size: 0.9375rem; font-weight: 600; font-family: var(--font-body); color: var(--gray-800); cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; transition: background 0.12s; white-space: normal; line-height: 1.4; letter-spacing: -0.01em; }
.faq-question:hover { background: var(--surface); }
.faq-item.open .faq-question { background: var(--primary-light); color: var(--primary-dark); }
.faq-icon { flex-shrink: 0; width: 22px; height: 22px; border: 1.5px solid var(--border-strong); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.875rem; color: var(--text-muted); font-weight: 400; transition: transform 0.2s, border-color 0.15s, color 0.15s, background 0.15s; line-height: 1; }
.faq-item.open .faq-question .faq-icon { transform: rotate(45deg); border-color: var(--primary-mid); color: var(--primary); background: white; }
.faq-answer { display: none; padding: 0 16px 16px; font-size: 0.9rem; color: var(--text-secondary); line-height: 1.75; }
.faq-item.open .faq-answer { display: block; }

/* RELATED */
.related { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }
.related h3 { margin-bottom: 14px; }
.related-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.related-card { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); text-decoration: none; transition: all 0.15s; }
.related-card:hover { border-color: var(--primary-mid); background: var(--primary-light); transform: translateY(-1px); box-shadow: var(--shadow-sm); text-decoration: none; }
.related-icon { width: 36px; height: 36px; background: white; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid var(--border); font-size: 0.9375rem; }
.related-card-text .name { font-size: 0.8125rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; letter-spacing: -0.01em; }
.related-card-text .cat { font-size: 0.6875rem; color: var(--text-muted); font-weight: 500; margin-top: 1px; text-transform: uppercase; letter-spacing: 0.05em; }

/* FOOTER */
.site-footer { background: var(--gray-900); color: var(--gray-400); padding: 40px 0 28px; margin-top: 56px; }
.footer-inner { display: flex; flex-direction: column; gap: 28px; }
.footer-top { display: flex; flex-direction: column; gap: 24px; }
.footer-brand .logo { color: white; margin-bottom: 10px; display: inline-flex; }
.footer-brand .logo:hover { color: white; text-decoration: none; }
.footer-brand .logo .logo-icon { background: var(--primary); }
.footer-brand .logo span { color: #93C5FD; }
.footer-tagline { font-size: 0.875rem; color: var(--gray-500); line-height: 1.6; max-width: 280px; margin: 0; }
.footer-links-group { display: flex; flex-direction: column; gap: 2px; }
.footer-links-label { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gray-500); margin-bottom: 6px; display: block; }
.footer-links-group a { font-size: 0.875rem; color: var(--gray-400); min-height: 32px; display: flex; align-items: center; transition: color 0.15s; }
.footer-links-group a:hover { color: white; text-decoration: none; }
.footer-bottom { border-top: 1px solid var(--gray-800); padding-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.footer-disclaimer { font-size: 0.8rem; color: var(--gray-600); line-height: 1.55; margin: 0; }
.footer-legal { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.footer-legal a { font-size: 0.8rem; color: var(--gray-500); font-weight: 500; min-height: 32px; display: flex; align-items: center; transition: color 0.15s; }
.footer-legal a:hover { color: white; text-decoration: none; }
.footer-copy { font-size: 0.75rem; color: var(--gray-600); margin: 0; }
/* Simple footer for pages still using old pattern */
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: center; }
.footer-nav a { font-size: 0.8rem; color: var(--gray-500); font-weight: 500; min-height: 32px; display: flex; align-items: center; transition: color 0.15s; }
.footer-nav a:hover { color: white; text-decoration: none; }
.footer-copy-center { font-size: 0.75rem; color: var(--gray-600); text-align: center; }
.footer-disclaimer-center { font-size: 0.8rem; color: var(--gray-600); line-height: 1.55; text-align: center; max-width: 560px; margin: 0 auto; }

/* HOMEPAGE */
.hero { padding: 44px 0 36px; text-align: center; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-light); color: var(--primary); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 5px 12px; border-radius: 20px; margin-bottom: 14px; border: 1px solid var(--primary-mid); }
.hero h1 { font-size: 2.25rem; font-weight: 800; letter-spacing: -0.035em; margin-bottom: 12px; line-height: 1.12; color: var(--gray-900); }
.hero h1 span { color: var(--primary); }
.hero p { font-size: 1.0625rem; color: var(--text-secondary); max-width: 460px; margin: 0 auto 24px; line-height: 1.6; }
.search-bar { display: flex; max-width: 480px; margin: 0 auto; border: 1.5px solid var(--border); border-radius: 20px; overflow: hidden; background: var(--bg); box-shadow: var(--shadow-md); transition: border-color 0.15s, box-shadow 0.15s; }
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,0.08), var(--shadow-md); }
.search-bar input { flex: 1; height: 52px; border: none; background: none; padding: 0 16px; font-size: 16px; border-radius: 0; box-shadow: none; min-width: 0; outline: none; }
.search-bar button { height: 52px; padding: 0 22px; background: var(--primary); border: none; color: white; font-weight: 600; cursor: pointer; font-size: 0.9375rem; font-family: var(--font-body); transition: background 0.15s; white-space: nowrap; flex-shrink: 0; }
.search-bar button:hover { background: var(--primary-dark); }
.stats-bar { display: flex; justify-content: center; gap: 32px; padding: 20px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 36px; }
.stat-item { text-align: center; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--primary); letter-spacing: -0.03em; line-height: 1; }
.stat-label { font-size: 0.6875rem; color: var(--text-muted); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; margin-top: 3px; }
.category-section { padding: 8px 0 32px; }
.category-section + .category-section { border-top: 1px solid var(--border); padding-top: 28px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 700; color: var(--gray-900); letter-spacing: -0.015em; }
.section-icon { width: 30px; height: 30px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 0.875rem; flex-shrink: 0; }
.section-link { font-size: 0.8125rem; font-weight: 600; color: var(--primary); min-height: 36px; display: flex; align-items: center; gap: 4px; }
.section-link:hover { text-decoration: none; color: var(--primary-dark); }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.calc-card { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 12px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); text-decoration: none; transition: all 0.15s; }
.calc-card:hover { border-color: var(--primary-mid); background: var(--primary-light); transform: translateY(-1px); box-shadow: var(--shadow-sm); text-decoration: none; }
.calc-card-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.calc-card-name { font-size: 0.8125rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; letter-spacing: -0.005em; }
.cat-finance .section-icon, .cat-finance .calc-card-icon { background: #EFF6FF; }
.cat-health  .section-icon, .cat-health  .calc-card-icon { background: #ECFDF5; }
.cat-convert .section-icon, .cat-convert .calc-card-icon { background: #FFFBEB; }
.cat-math    .section-icon, .cat-math    .calc-card-icon { background: #F5F3FF; }
.cat-every   .section-icon, .cat-every   .calc-card-icon { background: #F0FDFA; }

/* BADGES */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 20px; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-primary { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-mid); }
.badge-warning { background: var(--warning-light); color: var(--warning); }

/* UTILITY */
.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; }
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* =============================================
   TABLET ≥ 640px
   ============================================= */
@media (min-width: 640px) {
  h1 { font-size: 2rem; }
  .container { padding: 0 24px; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .calc-grid { grid-template-columns: repeat(3, 1fr); }
  .related-grid { grid-template-columns: repeat(3, 1fr); }
  .result-grid { grid-template-columns: repeat(3, 1fr); }
  .hero h1 { font-size: 2.75rem; }
  .hero p { font-size: 1.125rem; }
  .site-nav { display: flex; align-items: center; gap: 1px; }
  .hamburger { display: none; }
  .ad-above-fold { min-height: var(--ad-above-fold-h-desktop); }
  .card { padding: 28px; }
  .footer-top { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
  .footer-bottom { flex-direction: row; justify-content: space-between; align-items: flex-start; }
}

/* =============================================
   DESKTOP ≥ 1024px
   ============================================= */
@media (min-width: 1024px) {
  .container { padding: 0 40px; }
  .page-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
  .side-col { position: sticky; top: calc(var(--header-h) + 16px); display: flex; flex-direction: column; gap: 20px; }
  .ad-sidebar { display: flex; }
  .calc-grid { grid-template-columns: repeat(4, 1fr); }
  .hero h1 { font-size: 3.25rem; }
  .result-value { font-size: 2.25rem; }
  .card { padding: 32px; }
}

@media (min-width: 1280px) {
  .container { padding: 0 48px; }
}

/* PRINT */
@media print {
  .site-header, .site-footer, .ad-slot, .affiliate-cta, .related, .hamburger, .mobile-menu, .breadcrumb { display: none !important; }
  body { font-size: 11pt; color: #000; }
  .result-panel { border: 1px solid #ccc; background: #f9f9f9; display: block !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
