:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --navy: #112735;
  --navy-2: #193746;
  --text: #102131;
  --muted: #6f7f8c;
  --line: #dfe6ea;
  --line-strong: #cdd7dd;
  --accent: #0b8662;
  --accent-dark: #07684d;
  --accent-soft: #e9f6f1;
  --blue: #2167d9;
  --warning: #8c6100;
  --warning-bg: #fff7de;
  --danger: #a13636;
  --danger-bg: #fff1f1;
  --shadow: 0 7px 24px rgba(27, 46, 58, .055);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { color: inherit; }
a { color: var(--blue); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 16px 20px;
  overflow-y: auto;
  color: #fff;
  background: linear-gradient(180deg, #102936 0%, #0c202b 100%);
  border-right: 1px solid rgba(255,255,255,.05);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; padding: 0 8px; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #112735;
  background: #77e1c5;
  font-size: 18px;
  font-weight: 900;
}
.brand-copy strong, .brand-copy small { display: block; }
.brand-copy strong { font-size: 21px; letter-spacing: -.03em; }
.brand-copy small { margin-top: 1px; color: #aec0c9; font-size: 9px; letter-spacing: .03em; }

.side-nav { display: grid; gap: 6px; margin-top: 34px; }
.nav-link {
  width: 100%;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c7d2d8;
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
}
.nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-link.active { position: relative; color: #fff; background: rgba(255,255,255,.08); }
.nav-link.active::before { content: ""; position: absolute; left: -16px; top: 0; bottom: 0; width: 4px; background: #55d8b5; }
.nav-icon { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.18); border-radius: 6px; font-size: 14px; }
.nav-link b, .nav-link small { display: block; }
.nav-link b { font-size: 13px; font-weight: 720; }
.nav-link small { margin-top: 3px; color: #93a8b3; font-size: 9px; }
.sidebar-spacer { flex: 1; min-height: 36px; }
.trust-panel {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  margin: 0 8px 22px;
  padding: 20px;
  border: 1px solid rgba(126,221,197,.28);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(36,104,105,.38), rgba(9,36,47,.35));
}
.trust-panel::after { content: ""; position: absolute; width: 150px; height: 150px; right: -50px; bottom: -70px; border: 1px solid rgba(118,225,196,.22); border-radius: 50%; box-shadow: 0 0 0 24px rgba(118,225,196,.035), 0 0 0 48px rgba(118,225,196,.025); }
.trust-orbit { display: block; margin-bottom: 18px; color: #56d8b4; font-size: 30px; }
.trust-panel strong { display: block; font-size: 17px; line-height: 1.35; }
.trust-panel small { display: block; margin-top: 10px; max-width: 145px; color: #b5c5cc; font-size: 10px; line-height: 1.6; }
.sidebar-meta { display: grid; gap: 7px; padding: 0 10px; color: #849ba7; font-size: 9px; }

.page-shell { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
}
.topbar-note { color: #9aa6ae; font-size: 10px; letter-spacing: .01em; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.header-mode { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.header-mode i { width: 6px; height: 6px; border-radius: 50%; background: #31a478; }
.language-control { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.language-control select { width: auto; min-width: 82px; min-height: 30px; padding: 5px 25px 5px 8px; border-radius: 16px; }

.site-main { max-width: 1440px; margin: 0 auto; padding: 30px 28px 70px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.product-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 30px;
  align-items: end;
  margin-bottom: 22px;
}
.intro-copy { max-width: 680px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 9px; font-weight: 820; letter-spacing: .14em; text-transform: uppercase; }
.product-intro h1, .section-heading h1 { margin: 0; font-size: clamp(27px, 2.6vw, 38px); line-height: 1.12; letter-spacing: -.035em; font-weight: 760; }
.hero-copy, .section-heading > div > p:not(.eyebrow) { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.intro-metrics { display: flex; align-items: stretch; gap: 0; border-left: 1px solid var(--line); }
.marketplaces { display: grid; grid-template-columns: repeat(4, minmax(66px, 1fr)); align-items: center; }
.market-chip { min-width: 72px; display: grid; place-items: center; gap: 5px; border: 0; border-right: 1px solid var(--line); background: transparent; padding: 4px 12px; cursor: pointer; }
.market-chip:hover { background: #fff; }
.market-chip small { color: var(--muted); font-size: 9px; }
.market-logo { display: grid; place-items: center; min-height: 30px; font-size: 20px; font-weight: 800; }
.market-logo.amazon { color: #111; font-family: Georgia, serif; }
.market-logo.ebay { color: #2767c9; font-size: 13px; }
.market-logo.etsy { color: #e7692e; font-family: Georgia, serif; }
.market-logo.tiktok { color: #111; }
.metric-block { min-width: 150px; display: grid; align-content: center; padding: 4px 20px; border-right: 1px solid var(--line); }
.metric-block strong { font-size: 25px; color: var(--accent-dark); letter-spacing: -.03em; }
.metric-block span { margin-top: 3px; font-size: 10px; font-weight: 650; }
.metric-block small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.ruleset-block strong { color: var(--text); font-size: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ruleset-block small { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.calculator-grid { display: grid; grid-template-columns: minmax(360px, .72fr) minmax(0, 1.28fr); gap: 14px; align-items: start; }
.result-column { display: grid; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 18px; box-shadow: var(--shadow); }
.panel-heading { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.panel-heading > div:first-child { display: flex; align-items: center; gap: 9px; }
.panel-heading h2 { margin: 0; font-size: 14px; font-weight: 760; }
.panel-heading.compact { margin-bottom: 10px; }
.section-number { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 4px; color: #fff; background: linear-gradient(180deg, #193b4d, #122d3a); font-size: 11px; font-weight: 800; }
.utility-link { color: var(--blue); font-size: 10px; }
.text-action { border: 0; background: transparent; color: var(--blue); font-size: 10px; cursor: pointer; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.three-costs { grid-template-columns: repeat(3, 1fr); }
.field { display: grid; gap: 6px; }
.field.wide { grid-column: 1 / -1; }
.field > span, .field > label > span { color: #485967; font-size: 10px; font-weight: 650; }
input, select { width: 100%; min-height: 39px; border: 1px solid #ced8de; border-radius: 5px; background: #fff; padding: 8px 10px; color: var(--text); outline: none; }
input:hover, select:hover { border-color: #aebbc3; }
input:focus, select:focus { border-color: #4e9b86; box-shadow: 0 0 0 2px rgba(42,137,108,.10); }
.money-input { display: grid; grid-template-columns: 27px 1fr; align-items: center; overflow: hidden; border: 1px solid #ced8de; border-radius: 5px; background: #fff; }
.money-input:focus-within { border-color: #4e9b86; box-shadow: 0 0 0 2px rgba(42,137,108,.10); }
.money-input b { color: var(--muted); text-align: right; font-size: 10px; font-weight: 600; }
.money-input input { border: 0; box-shadow: none; background: transparent; }
.platform-fields { margin-top: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafb; }
.advanced-block { margin: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 11px 0; }
.advanced-block summary { cursor: pointer; font-size: 11px; font-weight: 700; }
.advanced-block p { color: var(--muted); font-size: 10px; }
.primary-btn { width: 100%; min-height: 42px; border: 1px solid var(--accent-dark); border-radius: 5px; background: linear-gradient(180deg, #0e956e, #0a7b5b); color: #fff; padding: 10px 14px; cursor: pointer; font-size: 11px; font-weight: 760; }
.primary-btn:hover { background: var(--accent-dark); }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; }
.microcopy { margin: 9px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.center-copy { text-align: center; }

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 8px; font-size: 9px; font-weight: 820; letter-spacing: .03em; }
.badge.good { color: #0c714f; background: #e4f5ec; }
.badge.warn { color: var(--warning); background: var(--warning-bg); }
.badge.danger { color: var(--danger); background: var(--danger-bg); }
.badge.neutral { color: #53636e; background: #eef2f4; }

.empty-state { min-height: 330px; display: grid; align-content: center; justify-items: center; padding: 24px; border: 1px dashed var(--line); border-radius: 6px; background: #fbfcfc; color: var(--muted); text-align: center; }
.empty-state h3 { margin: 10px 0 4px; color: var(--text); font-size: 14px; }
.empty-state p { margin: 0; max-width: 390px; font-size: 10px; line-height: 1.6; }
.empty-icon { color: var(--accent); font-size: 24px; }
.hidden { display: none !important; }
.totals-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.totals-grid > div { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfd; }
.totals-grid .profit-cell { border-color: #bfe4d6; background: linear-gradient(135deg, #f0fbf6, #e6f6ef); }
.totals-grid span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.totals-grid strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 20px; letter-spacing: -.025em; }
.totals-grid .profit-cell strong { color: var(--accent-dark); }
.result-label { margin: 0 0 8px; font-size: 12px; font-weight: 780; }
.fee-lines { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.fee-line { border: 0; border-bottom: 1px solid var(--line); }
.fee-line:last-child { border-bottom: 0; }
.fee-line summary { list-style: none; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; cursor: pointer; padding: 12px 13px; }
.fee-line summary::-webkit-details-marker { display: none; }
.fee-line-title strong { font-size: 11px; }
.fee-line-title small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.fee-line-amount { min-width: 65px; text-align: right; font-size: 14px; font-weight: 800; }
.fee-detail { border-top: 1px solid var(--line); padding: 10px 13px 12px; background: #fafcfd; color: var(--muted); font-size: 9px; line-height: 1.65; }
.fee-detail code, .receipt-footer code { color: #40515d; word-break: break-all; }
.source-link { display: inline-block; margin-top: 5px; color: var(--blue); font-size: 9px; font-weight: 700; text-decoration: none; }
.source-link:hover { text-decoration: underline; }
.warning-box { margin: 0 0 10px; padding: 9px 10px; border-left: 3px solid #d0a12b; background: var(--warning-bg); color: var(--warning); font-size: 9px; }
.receipt-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfd; color: var(--muted); font-size: 9px; }

.lower-grid { display: grid; grid-template-columns: 1fr .86fr; gap: 14px; }
.compact-card { padding: 14px; box-shadow: none; }
.evidence-preview { display: grid; }
.evidence-preview > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.evidence-preview strong { font-size: 10px; }
.evidence-preview span { color: var(--muted); font-size: 9px; text-align: right; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.quick-actions button { min-height: 36px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 5px; background: #fff; padding: 7px 9px; cursor: pointer; text-align: left; font-size: 9px; }
.quick-actions button:hover { border-color: #b9c7ce; background: #fafcfd; }
.quick-actions button:last-child { grid-column: 1 / -1; }
.mini-logo { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 5px; font-size: 10px; font-weight: 800; background: #f3f6f7; }
.mini-logo.etsy { color: #e36a31; }
.mini-logo.amazon { color: #111; font-family: Georgia, serif; }
.mini-logo.ebay { color: #2c67c8; }
.mini-logo.tiktok { color: #111; }
.mini-logo.chart { color: var(--accent); }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; padding: 22px 0 18px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.section-heading h1 { max-width: 760px; font-size: clamp(25px, 2.5vw, 35px); }
.filter-row label { display: grid; gap: 5px; min-width: 180px; color: var(--muted); font-size: 9px; }
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.summary-strip > div { padding: 12px 13px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.summary-strip span { display: block; color: var(--muted); font-size: 9px; }
.summary-strip strong { display: block; margin-top: 3px; font-size: 17px; }
.evidence-list { display: grid; gap: 8px; }
.evidence-card { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: var(--shadow); }
.evidence-card h3 { margin: 0 0 5px; font-size: 13px; }
.evidence-meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0; }
.evidence-claims { display: grid; gap: 6px; }
.claim { padding: 8px 9px; border-left: 2px solid #9eb1ba; background: var(--surface-2); font-size: 9px; }
.claim b { display: block; margin-bottom: 2px; }

.workspace { display: grid; }
.settlement-layout { grid-template-columns: 1fr 1fr; gap: 12px; }
.privacy-card { min-width: 230px; padding: 11px 13px; border: 1px solid #bfe0d4; border-radius: 6px; background: #eef8f4; }
.privacy-card strong, .privacy-card span { display: block; }
.privacy-card strong { font-size: 10px; }
.privacy-card span { margin-top: 3px; color: #567166; font-size: 9px; line-height: 1.5; }
.drop-zone { position: relative; min-height: 180px; display: grid; place-items: center; align-content: center; gap: 6px; margin-top: 12px; border: 1px dashed #aebcc3; border-radius: 6px; background: #fafcfd; color: var(--muted); text-align: center; }
.drop-zone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-zone strong { color: var(--text); font-size: 11px; }
.drop-icon { color: var(--accent); font-size: 10px; font-weight: 800; }
.sample-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 9px; }
.mapping-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.mapping-fields.empty-mapping { min-height: 180px; grid-template-columns: 1fr; place-items: center; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); }
.mapping-fields label { display: grid; gap: 5px; color: var(--muted); font-size: 9px; }
.backtest-results { margin-top: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.outcome-match { color: var(--accent-dark); font-weight: 800; }
.outcome-mismatch { color: var(--danger); font-weight: 800; }

footer { max-width: 1440px; margin: 0 auto; display: flex; justify-content: space-between; gap: 20px; padding: 18px 28px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 8px; }

@media (max-width: 1180px) {
  .intro-metrics { display: none; }
  .calculator-grid { grid-template-columns: 1fr; }
  .input-card { max-width: none; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; z-index: 20; height: auto; min-height: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; padding: 10px 14px; }
  .side-nav { display: flex; justify-content: flex-end; gap: 4px; margin: 0; }
  .nav-link { width: auto; grid-template-columns: 1fr; padding: 8px 10px; text-align: center; }
  .nav-link.active::before { display: none; }
  .nav-icon, .nav-link small, .sidebar-spacer, .trust-panel, .sidebar-meta { display: none; }
  .brand { padding: 0; }
  .brand-copy small { display: none; }
  .topbar { top: 54px; }
  .lower-grid { grid-template-columns: 1fr; }
  .evidence-card { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .sidebar { grid-template-columns: 1fr; gap: 8px; }
  .brand { justify-self: center; }
  .side-nav { width: 100%; justify-content: center; overflow-x: auto; }
  .topbar { top: 94px; padding: 0 14px; }
  .topbar-note, .header-mode, .language-control span { display: none; }
  .site-main { padding: 20px 12px 50px; }
  .product-intro h1, .section-heading h1 { font-size: 27px; }
  .field-grid, .three-costs, .mapping-fields { grid-template-columns: 1fr; }
  .field.wide { grid-column: auto; }
  .totals-grid, .summary-strip { grid-template-columns: 1fr 1fr; }
  .fee-line summary { grid-template-columns: 1fr auto; }
  .fee-line summary .badge { grid-row: 2; grid-column: 1; width: max-content; }
  .receipt-footer { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
  .quick-actions button:last-child { grid-column: auto; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .privacy-card { min-width: 0; }
  .settlement-layout { grid-template-columns: 1fr; }
  footer { flex-direction: column; padding-left: 14px; padding-right: 14px; }
}
