/* ==========================================================================
   SellerMarginPro — Modern Fintech Calculator Stylesheet
   Palette: Emerald (#059669), Crisp Slate (#0f172a), Neutral Canvas (#f8fafc)
   Zero External Dependencies • Responsive • Print-Ready
   ========================================================================== */

:root {
  --emerald-600: #059669;
  --emerald-700: #047857;
  --emerald-800: #065f46;
  --emerald-500: #10b981;
  --emerald-100: #d1fae5;
  --emerald-50: #ecfdf5;

  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;

  --amber-500: #f59e0b;
  --amber-50: #fffbeb;
  --blue-500: #3b82f6;
  --indigo-500: #6366f1;
  --purple-500: #8b5cf6;
  --rose-600: #e11d48;
  --rose-50: #fff1f2;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.07), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -6px rgba(15, 23, 42, 0.09), 0 4px 10px -3px rgba(15, 23, 42, 0.04);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --container-max: 1180px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--slate-800);
  background-color: var(--slate-50);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  vertical-align: middle;
}

a {
  color: var(--emerald-600);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--emerald-700);
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Skip Link for Accessibility */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 1000;
  background: var(--slate-900);
  color: var(--white);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
}

.skip-link:focus {
  left: 16px;
}

/* ==========================================================================
   SwiftKitHub Unified Global Top Bar & Breadcrumb
   ========================================================================== */
.skh-topbar {
  background: var(--slate-950);
  color: var(--slate-300);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  line-height: 1.4;
}

.skh-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.skh-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--slate-400);
}

.skh-breadcrumb a {
  color: var(--slate-200);
  font-weight: 600;
}

.skh-breadcrumb a:hover {
  color: #34d399;
}

.skh-breadcrumb span {
  color: var(--slate-400);
  font-weight: 500;
}

.skh-all-tools {
  color: #34d399;
  font-weight: 700;
  white-space: nowrap;
}

.skh-all-tools:hover {
  color: var(--emerald-100);
}

/* ==========================================================================
   Sticky Header & Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--slate-200);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--slate-900);
}

.brand-logo:hover {
  color: var(--slate-900);
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--emerald-600), var(--emerald-700));
  color: var(--white);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.28);
  flex-shrink: 0;
}

.brand-pro {
  color: var(--emerald-600);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.main-nav a {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--slate-600);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--slate-900);
  background-color: var(--slate-100);
}

.nav-cta-pill {
  background-color: var(--emerald-50) !important;
  color: var(--emerald-700) !important;
  border: 1px solid var(--emerald-100);
}

.nav-cta-pill:hover {
  background-color: var(--emerald-100) !important;
  color: var(--emerald-800) !important;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--slate-700);
  cursor: pointer;
}

/* ==========================================================================
   AdSense Slots (Hidden by Default When Unconfigured)
   ========================================================================== */
.ad-slot {
  display: none;
  margin: 18px auto;
  width: 100%;
  max-width: var(--container-max);
}

.ad-slot.ad-slot--visible {
  display: block;
}

.ad-placeholder-box {
  border: 1.5px dashed var(--slate-300);
  background: var(--slate-100);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  color: var(--slate-500);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   Compact Hero Section (Keeps Calculator Right Above the Fold)
   ========================================================================== */
.hero-section {
  padding: 28px 0 18px;
}

.hero-header {
  max-width: 840px;
  margin: 0 auto;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--emerald-50);
  border: 1px solid var(--emerald-100);
  color: var(--emerald-700);
  font-size: 0.79rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}

.hero-header h1 {
  margin: 0 0 10px;
  font-size: clamp(1.65rem, 3.2vw, 2.35rem);
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--slate-900);
}

.hero-subtitle {
  margin: 0 auto;
  max-width: 700px;
  font-size: 0.98rem;
  color: var(--slate-600);
}

/* ==========================================================================
   Core Calculator Layout
   ========================================================================== */
.calculator-section {
  padding: 8px 0 36px;
}

.calc-shell {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* Platform Tabs Bar */
.platform-tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  background: var(--slate-900);
  color: var(--white);
}

.platform-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.platform-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--slate-200);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.platform-tab:hover {
  background: rgba(255, 255, 255, 0.13);
  color: var(--white);
}

.platform-tab.active {
  background: var(--emerald-600);
  border-color: var(--emerald-500);
  color: var(--white);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

.platform-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.preset-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-label {
  font-size: 0.78rem;
  color: var(--slate-400);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.preset-select {
  background: var(--slate-800);
  color: var(--white);
  border: 1px solid var(--slate-700);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.preset-select:focus {
  outline: 2px solid var(--emerald-500);
  outline-offset: 1px;
}

/* Main 2-Column Calculator Body */
.calc-grid {
  display: grid;
  grid-template-columns: 1.04fr 0.96fr;
  align-items: stretch;
}

.calc-inputs-pane {
  padding: 24px;
  border-right: 1px solid var(--slate-200);
  background: var(--white);
}

.calc-outputs-pane {
  padding: 24px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.pane-section-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-700);
  display: flex;
  align-items: center;
  gap: 7px;
}

.btn-text-reset {
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  color: var(--emerald-600);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-text-reset:hover {
  background: var(--emerald-50);
  color: var(--emerald-700);
}

/* Form Inputs Grid */
.inputs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-group.full-span {
  grid-column: 1 / -1;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--slate-700);
}

.field-hint {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--slate-400);
}

.input-affix-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix,
.input-suffix {
  position: absolute;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--slate-400);
  pointer-events: none;
  user-select: none;
}

.input-prefix {
  left: 12px;
}

.input-suffix {
  right: 12px;
}

.num-input,
.select-input {
  width: 100%;
  height: 41px;
  padding: 8px 12px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--slate-900);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.has-prefix .num-input {
  padding-left: 28px;
}

.has-suffix .num-input {
  padding-right: 30px;
}

.num-input:hover,
.select-input:hover {
  border-color: var(--slate-400);
}

.num-input:focus,
.select-input:focus {
  outline: none;
  border-color: var(--emerald-600);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

/* Platform Fee Override Box */
.platform-fee-box {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 16px;
}

.platform-fee-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.platform-fee-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--slate-900);
}

.fee-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.fee-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--slate-300);
  background: var(--white);
  color: var(--slate-600);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fee-chip:hover {
  border-color: var(--emerald-600);
  color: var(--emerald-700);
}

.fee-chip.active {
  background: var(--emerald-600);
  border-color: var(--emerald-600);
  color: var(--white);
}

.fee-note {
  margin: 10px 0 0;
  font-size: 0.77rem;
  color: var(--slate-500);
  line-height: 1.45;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--slate-700);
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--emerald-600);
  cursor: pointer;
}

/* ==========================================================================
   Outputs Pane — KPI Cards & Stacked Revenue Breakdown
   ========================================================================== */
.hero-kpi-card {
  background: var(--slate-900);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

.hero-kpi-card.is-loss {
  background: linear-gradient(135deg, #4c0519, #881337);
}

.hero-kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-300);
  margin-bottom: 4px;
}

.hero-kpi-value {
  font-size: clamp(1.9rem, 3.2vw, 2.45rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #34d399;
}

.hero-kpi-card.is-loss .hero-kpi-value {
  color: #fda4af;
}

.hero-kpi-sub {
  margin-top: 5px;
  font-size: 0.8rem;
  color: var(--slate-300);
}

.margin-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  text-align: right;
  flex-shrink: 0;
}

.margin-pill-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-300);
}

.margin-pill-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--white);
}

/* Secondary 3-Card KPI Grid */
.kpi-subgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mini-kpi {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 12px 13px;
  box-shadow: var(--shadow-xs);
}

.mini-kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--slate-500);
  margin-bottom: 4px;
}

.mini-kpi-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--slate-900);
}

.mini-kpi-sub {
  font-size: 0.71rem;
  color: var(--slate-400);
  margin-top: 2px;
}

/* Stacked Horizontal Bar Chart */
.chart-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-xs);
}

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

.chart-title {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--slate-800);
}

.chart-total {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-500);
}

.stacked-bar-track {
  display: flex;
  width: 100%;
  height: 24px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
}

.bar-seg {
  height: 100%;
  transition: width 0.25s ease;
  min-width: 0;
}

.bar-seg--profit {
  background: var(--emerald-600);
}

.bar-seg--cogs {
  background: var(--slate-700);
}

.bar-seg--shipping {
  background: var(--blue-500);
}

.bar-seg--fees {
  background: var(--amber-500);
}

.bar-seg--ads {
  background: var(--purple-500);
}

.chart-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 14px;
  margin-top: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--slate-600);
}

.legend-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-val {
  font-weight: 700;
  color: var(--slate-900);
}

/* Line-item Ledger Summary */
.ledger-box {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 0.83rem;
}

.ledger-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  color: var(--slate-600);
  border-bottom: 1px dashed var(--slate-100);
}

.ledger-row:last-child {
  border-bottom: none;
  padding-top: 8px;
  margin-top: 3px;
  border-top: 1px solid var(--slate-200);
  font-weight: 700;
  color: var(--slate-900);
}

/* Action Buttons Row */
.calc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--emerald-600);
  color: var(--white);
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.25);
}

.btn-primary:hover {
  background: var(--emerald-700);
  color: var(--white);
}

.btn-outline {
  background: var(--white);
  border-color: var(--slate-300);
  color: var(--slate-700);
}

.btn-outline:hover {
  border-color: var(--slate-400);
  background: var(--slate-50);
  color: var(--slate-900);
}

/* ==========================================================================
   Side-by-Side 4-Platform Comparison Table
   ========================================================================== */
.comparison-panel {
  border-top: 1px solid var(--slate-200);
  padding: 24px;
  background: var(--white);
}

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

.comparison-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--slate-900);
}

.comparison-sub {
  margin: 3px 0 0;
  font-size: 0.86rem;
  color: var(--slate-500);
}

.savings-callout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  background: var(--emerald-50);
  border: 1px solid var(--emerald-100);
  color: var(--emerald-800);
  font-size: 0.83rem;
  font-weight: 600;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
}

.comp-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 660px;
  font-size: 0.88rem;
}

.comp-table th,
.comp-table td {
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid var(--slate-200);
}

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

.comp-table thead th {
  background: var(--slate-50);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-500);
}

.comp-table tbody tr:last-child td {
  border-bottom: none;
}

.comp-table tbody tr:hover {
  background: var(--slate-50);
}

.comp-table tr.is-best-row {
  background: rgba(5, 150, 105, 0.04);
}

.comp-table tr.is-active-row td:first-child {
  box-shadow: inset 3px 0 0 var(--emerald-600);
}

.plat-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--slate-900);
}

.best-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--emerald-100);
  color: var(--emerald-800);
  font-size: 0.69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.profit-pos {
  color: var(--emerald-700);
  font-weight: 800;
}

.profit-neg {
  color: var(--rose-600);
  font-weight: 800;
}

/* ==========================================================================
   Recommended Tools & Affiliate Partner Deals Section
   ========================================================================== */
.partners-section {
  padding: 16px 0 44px;
}

.section-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.section-head-row h2 {
  margin: 0;
  font-size: 1.38rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--slate-900);
}

.section-head-sub {
  margin: 4px 0 0;
  font-size: 0.92rem;
  color: var(--slate-600);
}

.ftc-inline-note {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--slate-500);
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  padding: 5px 10px;
  border-radius: 999px;
}

.affiliate-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.partner-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.partner-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--emerald-500);
}

.partner-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--emerald-50);
  color: var(--emerald-700);
  border: 1px solid var(--emerald-100);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.partner-name {
  margin: 8px 0 6px;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--slate-900);
}

.partner-desc {
  margin: 0;
  font-size: 0.87rem;
  color: var(--slate-600);
  line-height: 1.52;
}

.partner-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--slate-900);
  color: var(--white) !important;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  transition: background-color 0.15s ease;
}

.partner-card:hover .partner-cta {
  background: var(--emerald-600);
}

/* ==========================================================================
   SEO Guide Section & Benchmark Tables
   ========================================================================== */
.guide-section {
  padding: 48px 0;
  background: var(--white);
  border-top: 1px solid var(--slate-200);
  border-bottom: 1px solid var(--slate-200);
}

.prose-shell {
  max-width: 860px;
  margin: 0 auto;
}

.prose-shell h2 {
  margin: 0 0 14px;
  font-size: clamp(1.45rem, 2.5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--slate-900);
}

.prose-shell h3 {
  margin: 30px 0 10px;
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--slate-900);
}

.prose-shell p {
  margin: 0 0 15px;
  color: var(--slate-700);
}

.prose-shell ul,
.prose-shell ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--slate-700);
}

.prose-shell li {
  margin-bottom: 8px;
}

.formula-callout {
  background: var(--slate-50);
  border-left: 4px solid var(--emerald-600);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 18px 0;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--slate-800);
  overflow-x: auto;
}

.guide-table-wrap {
  overflow-x: auto;
  margin: 18px 0 24px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 580px;
}

.guide-table th,
.guide-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--slate-200);
}

.guide-table thead th {
  background: var(--slate-50);
  font-weight: 700;
  color: var(--slate-800);
}

.guide-table tbody tr:last-child td {
  border-bottom: none;
}

/* ==========================================================================
   FAQ Accordion Section
   ========================================================================== */
.faq-section {
  padding: 48px 0 56px;
}

.faq-shell {
  max-width: 860px;
  margin: 0 auto;
}

.faq-shell h2 {
  margin: 0 0 8px;
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  font-weight: 800;
  color: var(--slate-900);
}

.faq-intro {
  margin: 0 0 22px;
  color: var(--slate-600);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  background: none;
  border: none;
  text-align: left;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--slate-900);
  cursor: pointer;
}

.faq-question:hover {
  color: var(--emerald-700);
}

.faq-chevron {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--slate-400);
  transition: transform 0.2s ease, color 0.2s ease;
}

.faq-item.is-open .faq-chevron {
  transform: rotate(180deg);
  color: var(--emerald-600);
}

.faq-answer {
  display: none;
  padding: 0 20px 18px;
  color: var(--slate-600);
  font-size: 0.93rem;
  line-height: 1.65;
  border-top: 1px solid var(--slate-100);
}

.faq-item.is-open .faq-answer {
  display: block;
  padding-top: 14px;
}

/* ==========================================================================
   Related Calculators & SwiftKitHub Internal Linking Section
   ========================================================================== */
.related-section {
  padding: 44px 0 52px;
  background: var(--white);
  border-top: 1px solid var(--slate-200);
}

.related-group-label {
  margin: 22px 0 12px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

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

.related-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 18px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  color: var(--slate-800);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.related-card:hover {
  transform: translateY(-2px);
  background: var(--white);
  border-color: var(--emerald-500);
  box-shadow: var(--shadow-md);
  color: var(--slate-900);
}

.related-card-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--emerald-700);
  background: var(--emerald-50);
  border: 1px solid var(--emerald-100);
  padding: 2px 8px;
  border-radius: 999px;
}

.related-card-title {
  margin: 2px 0 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--slate-900);
}

.related-card-desc {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.48;
  color: var(--slate-600);
}

.related-card-arrow {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--emerald-600);
  margin-top: 4px;
}

/* ==========================================================================
   Secondary Pages (Privacy, Terms, About, Contact)
   ========================================================================== */
.page-main {
  padding: 42px 0 64px;
}

.page-card {
  max-width: 820px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  box-shadow: var(--shadow-sm);
}

.page-card h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  color: var(--slate-900);
}

.page-meta {
  margin: 0 0 26px;
  font-size: 0.85rem;
  color: var(--slate-500);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--slate-200);
}

.page-card h2 {
  margin: 28px 0 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--slate-900);
}

.page-card p,
.page-card li {
  color: var(--slate-700);
  font-size: 0.95rem;
}

.page-card ul {
  padding-left: 22px;
}

.contact-box {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 20px 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.contact-form {
  display: grid;
  gap: 14px;
}

.text-input,
.textarea-input {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.94rem;
  color: var(--slate-900);
}

.textarea-input {
  min-height: 120px;
  resize: vertical;
}

.text-input:focus,
.textarea-input:focus {
  outline: none;
  border-color: var(--emerald-600);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

/* ==========================================================================
   Footer & FTC Disclosure
   ========================================================================== */
.site-footer {
  background: var(--slate-900);
  color: var(--slate-300);
  padding: 40px 0 32px;
  font-size: 0.87rem;
}

.footer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand-col {
  max-width: 440px;
}

.footer-brand-col .brand-logo {
  color: var(--white);
  margin-bottom: 8px;
}

.footer-tagline {
  margin: 0;
  color: var(--slate-400);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-links a {
  color: var(--slate-300);
  font-weight: 600;
}

.footer-links a:hover {
  color: #34d399;
}

.footer-disclosure {
  margin-top: 20px;
  font-size: 0.79rem;
  color: var(--slate-400);
  line-height: 1.55;
}

.footer-copy {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--slate-500);
}

/* Toast Notification */
.toast-msg {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 999;
  background: var(--slate-900);
  color: var(--white);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-msg.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

  .calc-inputs-pane {
    border-right: none;
    border-bottom: 1px solid var(--slate-200);
  }

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

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

@media (max-width: 720px) {
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .main-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding: 10px 0 14px;
    border-top: 1px solid var(--slate-200);
  }

  .main-nav.is-open {
    display: flex;
  }

  .header-inner {
    flex-wrap: wrap;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .inputs-grid,
  .kpi-subgrid,
  .affiliate-grid,
  .related-grid,
  .related-grid--four,
  .chart-legend {
    grid-template-columns: 1fr;
  }

  .hero-kpi-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .margin-pill {
    align-items: flex-start;
    text-align: left;
    width: 100%;
  }

  .page-card {
    padding: 24px 20px;
  }
}

/* ==========================================================================
   Print Stylesheet (Clean Order Margin Sheet)
   ========================================================================== */
@media print {
  body {
    background: #ffffff;
    color: #000000;
  }

  .skh-topbar,
  .site-header,
  .ad-slot,
  .preset-toolbar,
  .calc-actions,
  .partners-section,
  .guide-section,
  .faq-section,
  .related-section,
  .site-footer,
  .btn-text-reset {
    display: none !important;
  }

  .calc-shell {
    box-shadow: none;
    border: 1px solid #cbd5e1;
  }

  .hero-kpi-card {
    background: #f8fafc !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1;
  }

  .hero-kpi-value,
  .margin-pill-val {
    color: #0f172a !important;
  }
}
