:root {
  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --bg-dark: #0f172a;
  --bg-dark-2: #1e293b;
  --amber: #f59e0b;
  --amber-hover: #d97706;
  --amber-soft: #fef3c7;
  --emerald: #059669;
  --emerald-soft: #d1fae5;
  --blue: #2563eb;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;
  --border: #cbd5e1;
  --border-light: #e2e8f0;
  --radius: 10px;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

/* Chinese Helper Toggle Visibility */
.zh-hint {
  display: none;
  font-size: 12px;
  font-weight: 500;
  color: #b45309;
  background: #fffbeb;
  border-left: 3px solid var(--amber);
  padding: 2px 6px;
  margin-top: 3px;
  border-radius: 3px;
}

body.show-zh .zh-hint {
  display: block;
}

.zh-inline {
  display: none;
  font-size: 12px;
  color: #d97706;
  font-weight: 500;
  margin-left: 4px;
}

body.show-zh .zh-inline {
  display: inline;
}

/* Top Navbar */
.topbar {
  background: var(--bg-dark);
  color: #fff;
  border-bottom: 3px solid var(--amber);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  background: var(--amber);
  color: var(--bg-dark);
  font-weight: 900;
  font-size: 15px;
  padding: 5px 9px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.brand-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.brand-sub {
  font-size: 12px;
  color: #94a3b8;
  display: block;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-zh-toggle {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.5);
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-zh-toggle.active {
  background: var(--amber);
  color: var(--bg-dark);
  border-color: var(--amber);
}

.btn-pro-top {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* Founder Strategy Banner (only shown in ZH mode) */
.founder-banner {
  display: none;
  background: #1e293b;
  color: #e2e8f0;
  border-bottom: 1px solid #334155;
  padding: 10px 20px;
  font-size: 13px;
}

body.show-zh .founder-banner {
  display: block;
}

.founder-banner-inner {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
}

.founder-pill {
  background: #334155;
  color: #fbbf24;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
}

/* Hero & Trade Tabs */
.hero-bar {
  background: #fff;
  border-bottom: 1px solid var(--border-light);
  padding: 16px 20px 0;
}

.hero-inner {
  max-width: 1360px;
  margin: 0 auto;
}

.hero-headline {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.hero-headline h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--bg-dark);
}

.hero-headline p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}

.trust-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.trust-badge {
  font-size: 12px;
  font-weight: 600;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 99px;
}

.trade-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 0;
}

.trade-tab {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-bottom: none;
  padding: 11px 18px;
  border-radius: 8px 8px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.trade-tab:hover {
  background: #f1f5f9;
  color: var(--bg-dark);
}

.trade-tab.active {
  background: var(--bg-page);
  color: var(--bg-dark);
  border-top: 3px solid var(--amber);
}

/* Main Workspace Grid */
.workspace {
  max-width: 1360px;
  margin: 20px auto 48px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 24px;
  align-items: start;
}

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

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.panel-header {
  background: #f8fafc;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h2 {
  font-size: 15px;
  font-weight: 800;
  color: var(--bg-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-num {
  background: var(--bg-dark);
  color: var(--amber);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.panel-body {
  padding: 16px 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

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

.form-group label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
}

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

.input-wrap input,
.input-wrap select,
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 15px;
  font-weight: 600;
  color: var(--bg-dark);
  background: #fff;
}

.form-group textarea {
  min-height: 68px;
  font-size: 13.5px;
  font-weight: 500;
  resize: vertical;
}

.input-wrap input:focus,
.input-wrap select:focus,
.form-group input:focus,
.form-group textarea:focus {
  outline: 2px solid var(--amber);
  border-color: var(--amber);
}

.unit-tag {
  position: absolute;
  right: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  pointer-events: none;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}

.input-wrap.has-unit input {
  padding-right: 54px;
}

.prefix-tag {
  position: absolute;
  left: 11px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-light);
  pointer-events: none;
}

.input-wrap.has-prefix input {
  padding-left: 26px;
}

/* Output Switcher Panel */
.output-Switch-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--bg-dark);
  padding: 10px 14px;
  border-radius: 10px 10px 0 0;
  flex-wrap: wrap;
}

.view-tabs {
  display: flex;
  gap: 6px;
}

.view-tab {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: none;
  padding: 9px 14px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.view-tab.active {
  background: var(--amber);
  color: var(--bg-dark);
}

.action-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--emerald);
  color: #fff;
  border: none;
  padding: 9px 15px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:hover {
  background: #047857;
}

.btn-secondary {
  background: #334155;
  color: #fff;
  border: 1px solid #475569;
  padding: 9px 13px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* KPI Profit Strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
}

@media (max-width: 680px) {
  .kpi-strip {
    grid-template-columns: 1fr 1fr;
  }
}

.kpi-box {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px;
}

.kpi-box.highlight {
  background: #ecfdf5;
  border-color: #6ee7b7;
}

.kpi-box.quote-total {
  background: #fffbeb;
  border-color: #fcd34d;
}

.kpi-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
}

.kpi-val {
  font-size: 21px;
  font-weight: 900;
  color: var(--bg-dark);
  margin-top: 3px;
}

.kpi-box.highlight .kpi-val {
  color: var(--emerald);
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Supply Sheet Table */
.bom-section {
  padding: 18px;
}

.pro-tip-callout {
  background: #eff6ff;
  border-left: 4px solid var(--blue);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  color: #1e3a8a;
  margin-bottom: 16px;
}

.bom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.bom-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 9px 10px;
  border-bottom: 2px solid var(--border-light);
}

.bom-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

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

.qty-pill {
  background: var(--bg-dark);
  color: var(--amber);
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 5px;
  display: inline-block;
  font-size: 13.5px;
}

.unit-cost-input {
  width: 82px;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-weight: 700;
  font-size: 13.5px;
  text-align: right;
}

/* High-CPC Affiliate / Monetization Slot */
.monetization-bar {
  margin: 0 18px 18px;
  padding: 12px 16px;
  background: linear-gradient(90deg, #f8fafc, #f1f5f9);
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.monetization-bar strong {
  font-size: 13.5px;
  color: var(--bg-dark);
}

.monetization-bar span {
  font-size: 12.5px;
  color: var(--text-muted);
  display: block;
}

.affiliate-link {
  background: var(--bg-dark);
  color: #fff;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* Client Proposal Sheet (Screen + Print) */
.proposal-wrapper {
  padding: 22px;
  background: #e2e8f0;
}

.proposal-paper {
  background: #fff;
  max-width: 816px;
  margin: 0 auto;
  padding: 38px 42px;
  border-radius: 4px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

.prop-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 3px solid var(--bg-dark);
  padding-bottom: 18px;
  margin-bottom: 20px;
  gap: 16px;
}

.prop-company-logo {
  max-height: 54px;
  max-width: 180px;
  object-fit: contain;
  margin-bottom: 8px;
  display: none;
}

.prop-company-name {
  font-size: 22px;
  font-weight: 900;
  color: var(--bg-dark);
}

.prop-company-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.prop-doc-badge {
  text-align: right;
}

.prop-doc-badge h3 {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--bg-dark);
}

.prop-doc-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.prop-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
  background: #f8fafc;
  padding: 14px 16px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

.prop-party-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 4px;
}

.prop-section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
  margin: 18px 0 10px;
}

.prop-scope-text {
  font-size: 13.5px;
  color: #1e293b;
  line-height: 1.6;
  white-space: pre-line;
}

.prop-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 13.5px;
}

.prop-table th {
  background: var(--bg-dark);
  color: #fff;
  padding: 9px 12px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
}

.prop-table th:last-child,
.prop-table td:last-child {
  text-align: right;
}

.prop-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
}

.prop-totals {
  width: 290px;
  margin-left: auto;
  margin-top: 14px;
  font-size: 14px;
}

.prop-total-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
}

.prop-total-row.grand {
  border-top: 2px solid var(--bg-dark);
  margin-top: 6px;
  padding-top: 8px;
  font-size: 18px;
  font-weight: 900;
}

.prop-total-row.deposit {
  color: var(--emerald);
  font-weight: 700;
  font-size: 13.5px;
}

.prop-terms {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 8px;
}

.prop-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 34px;
  padding-top: 12px;
}

.sig-line {
  border-top: 1px solid #334155;
  padding-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.prop-watermark {
  margin-top: 24px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: #94a3b8;
}

.prop-watermark button {
  background: none;
  border: none;
  color: var(--amber-hover);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  font-size: 11.5px;
}

/* Pro Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: #fff;
  max-width: 500px;
  width: 100%;
  border-radius: 12px;
  padding: 26px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.modal-box h3 {
  font-size: 21px;
  font-weight: 900;
  margin-bottom: 6px;
}

.pricing-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.price-card {
  border: 2px solid var(--border-light);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
}

.price-card.featured {
  border-color: var(--amber);
  background: #fffbeb;
}

.price-card .amount {
  font-size: 24px;
  font-weight: 900;
}

.pro-perks {
  list-style: none;
  margin: 14px 0 20px;
  font-size: 14px;
}

.pro-perks li {
  padding: 5px 0;
}

/* Ad Slots & House Banners */
.ad-slot-wrap {
  max-width: 1360px;
  margin: 16px auto 0;
  padding: 0 20px;
}

.ad-slot-wrap:empty {
  display: none;
}

.ad-mid-banner {
  margin: 0 auto 20px;
}

.ad-house-banner {
  min-height: 86px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  border: 1px solid #334155;
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.ad-house-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ad-house-copy strong {
  font-size: 14.5px;
  color: #fff;
}

.ad-house-copy span {
  font-size: 12.5px;
  color: #cbd5e1;
}

.ad-badge-label {
  display: inline-block;
  width: fit-content;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: #b45309;
  background: #fef3c7;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.ad-house-banner .ad-badge-label {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.ad-house-cta {
  background: var(--amber);
  color: var(--bg-dark);
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.ad-house-cta:hover {
  background: var(--amber-hover);
  color: #fff;
}

.site-footer {
  max-width: 1360px;
  margin: 0 auto 36px;
  padding: 0 20px;
}

.site-footer-inner {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-light);
}

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

.site-footer-links a {
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
}

.site-footer-links a:hover {
  color: var(--bg-dark);
  text-decoration: underline;
}

/* SEO Footer Links Preview */
.seo-matrix-footer {
  max-width: 1360px;
  margin: 0 auto 40px;
  padding: 20px;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.seo-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.seo-chip {
  font-size: 12.5px;
  color: var(--text-muted);
  background: #f8fafc;
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid var(--border-light);
  cursor: pointer;
}

.seo-chip:hover {
  border-color: var(--amber);
  color: var(--bg-dark);
}

/* Print Styles — Clean US Letter Proposal Only */
@media print {
  @page {
    size: letter;
    margin: 0.45in;
  }

  body {
    background: #fff !important;
  }

  .topbar,
  .founder-banner,
  .hero-bar,
  .left-inputs-col,
  .output-Switch-bar,
  .kpi-strip,
  #supply-sheet-view,
  .ad-slot-wrap,
  .monetization-bar,
  .seo-quick-summary,
  .seo-matrix-footer,
  .site-footer,
  .modal-backdrop,
  .zh-hint,
  .zh-inline {
    display: none !important;
  }

  .workspace {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  .panel-card {
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
  }

  #proposal-view {
    display: block !important;
  }

  .proposal-wrapper {
    padding: 0 !important;
    background: #fff !important;
  }

  .proposal-paper {
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  body.pro-unlocked .prop-watermark {
    display: none !important;
  }
}
