/* ==========================================================================
 * TD Demo — shared theme
 * TD Green forward palette. Demo/illustration only; not affiliated with TD.
 * ========================================================================== */
:root {
  --td-green:        #008A00;   /* TD primary green */
  --td-green-dark:   #006B1F;
  --td-green-darker: #00431A;
  --td-green-light:  #E6F4E9;
  --td-green-lighter:#F3FAF4;
  --td-accent:       #43B02A;   /* fresh accent green */
  --td-gold:         #FFB81C;   /* warm CTA accent */
  --td-ink:          #12211A;
  --td-ink-2:        #445049;
  --td-ink-3:        #6E7B74;
  --td-border:       #E3E8E5;
  --td-bg:           #FFFFFF;
  --td-bg-soft:      #F5F7F5;
  --td-error:        #B91C1C;
  --font-display: 'Poppins', system-ui, -apple-system, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--td-bg); color: var(--td-ink); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* Utility bar */
.utility-bar { background: var(--td-green-darker); color: #fff; font-size: 13px; }
.utility-bar .wrap { max-width: 1280px; margin: 0 auto; padding: 8px 24px; display: flex; justify-content: space-between; align-items: center; }
.utility-bar a { opacity: 0.9; }
.utility-bar a:hover { opacity: 1; text-decoration: underline; }
.utility-bar .u-links { display: flex; gap: 18px; }

/* Nav */
.nav { background: #fff; border-bottom: 1px solid var(--td-border); position: sticky; top: 0; z-index: 50; }
.nav-wrap { max-width: 1280px; margin: 0 auto; padding: 16px 24px; display: flex; align-items: center; gap: 32px; }
.logo { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--td-green-dark); letter-spacing: -0.01em; }
.logo-mark { width: 42px; height: 42px; background: var(--td-green); border-radius: 8px; display: grid; place-items: center; color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.nav-links { display: flex; gap: 26px; flex: 1; }
.nav-links a { font-weight: 500; font-size: 15px; color: var(--td-ink); padding: 8px 0; border-bottom: 2px solid transparent; transition: border-color 150ms, color 150ms; }
.nav-links a:hover { border-bottom-color: var(--td-green); color: var(--td-green-dark); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer; border: none; transition: transform 100ms, background 150ms, box-shadow 150ms; font-family: var(--font-body); }
.btn-primary { background: var(--td-green); color: #fff; }
.btn-primary:hover { background: var(--td-green-dark); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,138,0,0.28); }
.btn-primary:disabled { background: var(--td-ink-3); cursor: not-allowed; transform: none; box-shadow: none; }
.btn-outline { background: transparent; color: var(--td-green-dark); border: 1.5px solid var(--td-green-dark); }
.btn-outline:hover { background: var(--td-green-light); }
.btn-gold { background: var(--td-gold); color: #3a2c00; }
.btn-gold:hover { background: #f0ab00; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(255,184,28,0.32); }
.btn-lg { padding: 15px 30px; font-size: 16px; }
.btn-block { width: 100%; }

/* Hero */
.hero { background: linear-gradient(135deg, var(--td-green-darker) 0%, var(--td-green-dark) 55%, var(--td-green) 100%); color: #fff; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 85% 12%, rgba(255,184,28,0.18), transparent 48%); pointer-events: none; }
.hero-wrap { max-width: 1280px; margin: 0 auto; padding: 88px 24px 108px; display: grid; grid-template-columns: 1.08fr 0.92fr; gap: 56px; align-items: center; position: relative; }
.hero h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(38px, 5vw, 64px); line-height: 1.05; letter-spacing: -0.025em; margin-bottom: 22px; }
.hero h1 em { font-style: normal; color: var(--td-gold); }
.hero .lede { font-size: 19px; line-height: 1.55; opacity: 0.92; max-width: 540px; margin-bottom: 34px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-actions .btn-outline { color: #fff; border-color: rgba(255,255,255,0.55); }
.hero-actions .btn-outline:hover { background: rgba(255,255,255,0.1); border-color: #fff; }

/* Hero card */
.hero-card { background: #fff; color: var(--td-ink); border-radius: 18px; padding: 28px; box-shadow: 0 30px 60px -20px rgba(0,0,0,0.4); }
.hero-card .pill { display: inline-block; background: var(--td-green-light); color: var(--td-green-dark); font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; margin-bottom: 12px; }
.hero-card h3 { font-family: var(--font-display); font-weight: 600; font-size: 21px; margin-bottom: 6px; }
.hero-card .sub { color: var(--td-ink-3); font-size: 14px; margin-bottom: 20px; }
.calc-row { display: flex; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--td-border); }
.calc-row:last-of-type { border-bottom: none; }
.calc-row label { color: var(--td-ink-2); font-size: 14px; }
.calc-row .val { font-weight: 600; font-family: var(--font-display); }
.calc-row .val.big { font-size: 28px; color: var(--td-green-dark); }
.calc-row .val.big small { font-size: 14px; color: var(--td-ink-3); font-weight: 500; }
.calc-cta { width: 100%; margin-top: 16px; }

/* Section shells */
.section { max-width: 1280px; margin: 0 auto; padding: 80px 24px; }
.strip { background: var(--td-bg-soft); }
.strip .section { padding: 80px 24px; }
h2.section-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 3.4vw, 42px); letter-spacing: -0.02em; margin-bottom: 12px; max-width: 760px; line-height: 1.15; }
h2.section-title em { font-style: normal; color: var(--td-green); }
p.section-intro { color: var(--td-ink-2); font-size: 17px; max-width: 620px; margin-bottom: 44px; }

/* Product grid */
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.product-card { background: #fff; border: 1px solid var(--td-border); border-radius: 16px; padding: 28px; cursor: pointer; transition: transform 200ms, box-shadow 200ms, border-color 200ms; position: relative; overflow: hidden; display: block; }
.product-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px -15px rgba(0,0,0,0.15); border-color: var(--td-green); }
.product-card::after { content: '→'; position: absolute; top: 26px; right: 26px; width: 34px; height: 34px; border-radius: 50%; background: var(--td-green-light); color: var(--td-green-dark); display: grid; place-items: center; font-size: 17px; transition: background 200ms, transform 200ms; }
.product-card:hover::after { background: var(--td-green); color: #fff; transform: translateX(4px); }
.product-icon { width: 50px; height: 50px; border-radius: 12px; background: var(--td-green-light); color: var(--td-green-dark); display: grid; place-items: center; margin-bottom: 22px; font-size: 24px; }
.product-card h3 { font-family: var(--font-display); font-weight: 600; font-size: 22px; margin-bottom: 10px; letter-spacing: -0.01em; }
.product-card p { color: var(--td-ink-2); font-size: 15px; line-height: 1.5; margin-bottom: 16px; }
.product-rate { color: var(--td-green-dark); font-weight: 600; font-size: 14px; }
.product-badge { position: absolute; top: 0; left: 0; background: var(--td-gold); color: #3a2c00; font-size: 11px; font-weight: 700; padding: 5px 12px; border-radius: 0 0 10px 0; letter-spacing: 0.02em; }

/* Filters */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 32px; }
.filter-chip { padding: 9px 18px; border-radius: 999px; border: 1.5px solid var(--td-border); background: #fff; font-size: 14px; font-weight: 500; color: var(--td-ink-2); cursor: pointer; transition: all 150ms; font-family: var(--font-body); }
.filter-chip:hover { border-color: var(--td-green); color: var(--td-green-dark); }
.filter-chip.active { background: var(--td-green); border-color: var(--td-green); color: #fff; }

/* Value props */
.props-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.prop-item { padding: 26px; border-left: 3px solid var(--td-green); background: var(--td-green-lighter); border-radius: 0 12px 12px 0; }
.prop-item .num { font-family: var(--font-display); font-weight: 700; font-size: 30px; color: var(--td-green-dark); margin-bottom: 6px; letter-spacing: -0.02em; }
.prop-item h4 { font-weight: 600; font-size: 16px; margin-bottom: 8px; }
.prop-item p { color: var(--td-ink-2); font-size: 14px; line-height: 1.5; }

/* Promo strip */
.promo { background: var(--td-green-light); }
.promo-wrap { max-width: 1280px; margin: 0 auto; padding: 52px 24px; display: flex; justify-content: space-between; align-items: center; gap: 32px; flex-wrap: wrap; }
.promo-wrap h3 { font-family: var(--font-display); font-weight: 600; font-size: 27px; color: var(--td-green-darker); letter-spacing: -0.015em; max-width: 640px; line-height: 1.2; }
.promo-wrap h3 em { font-style: normal; color: var(--td-green); }

/* Footer */
footer { background: var(--td-green-darker); color: rgba(255,255,255,0.85); }
.foot-wrap { max-width: 1280px; margin: 0 auto; padding: 60px 24px 36px; }
.foot-cols { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 44px; margin-bottom: 44px; }
.foot-cols h5 { color: #fff; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 16px; }
.foot-cols ul { list-style: none; }
.foot-cols li { margin-bottom: 10px; font-size: 14px; }
.foot-cols a:hover { color: var(--td-gold); }
.foot-bottom { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 22px; display: flex; justify-content: space-between; font-size: 13px; opacity: 0.75; flex-wrap: wrap; gap: 10px; }

/* Forms */
.field { display: flex; flex-direction: column; margin-bottom: 18px; }
.field label { font-size: 13px; font-weight: 500; color: var(--td-ink-2); margin-bottom: 6px; }
.field input, .field select { padding: 14px; border: 1.5px solid var(--td-border); border-radius: 9px; font-size: 16px; font-family: var(--font-body); background: #fff; transition: border-color 150ms, box-shadow 150ms; color: var(--td-ink); }
.field input:focus, .field select:focus { outline: none; border-color: var(--td-green); box-shadow: 0 0 0 3px rgba(0,138,0,0.14); }
.field .help { font-size: 12px; color: var(--td-ink-3); margin-top: 6px; }
.field.invalid input { border-color: var(--td-error); }
.field .err-msg { display: none; color: var(--td-error); font-size: 12px; margin-top: 5px; }
.field.invalid .err-msg { display: block; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.alert { padding: 14px 16px; border-radius: 9px; font-size: 13px; margin-bottom: 20px; display: none; }
.alert.error { background: #FEF2F2; color: var(--td-error); border: 1px solid #FECACA; }
.alert.success { background: var(--td-green-light); color: var(--td-green-darker); border: 1px solid #A9DAB4; }
.alert.show { display: block; }

/* RTCDP Event Debug Panel */
#rtcdp-panel { position: fixed; right: 20px; bottom: 20px; width: 370px; max-height: 520px; background: #0d1117; color: #e6edf3; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.4); font-family: 'SF Mono', 'Monaco', 'Consolas', monospace; font-size: 12px; z-index: 1000; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #30363d; }
#rtcdp-panel.collapsed { max-height: 44px; }
#rtcdp-panel header { background: #161b22; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; user-select: none; border-bottom: 1px solid #30363d; }
#rtcdp-panel header .title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-family: var(--font-body); font-size: 13px; }
#rtcdp-panel header .pulse { width: 8px; height: 8px; border-radius: 50%; background: #3fb950; box-shadow: 0 0 8px #3fb950; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
#rtcdp-panel header .count { background: #1f6feb; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-family: var(--font-body); font-weight: 600; }
#rtcdp-panel header .toggle { color: #8b949e; font-size: 16px; }
#rtcdp-events { overflow-y: auto; flex: 1; padding: 8px; }
.ev { background: #161b22; border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; border-left: 3px solid #3fb950; animation: slideIn 300ms ease-out; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.ev.pageView { border-left-color: #3fb950; }
.ev.linkClick { border-left-color: #d29922; }
.ev.productView { border-left-color: #58a6ff; }
.ev.formInteract { border-left-color: #bc8cff; }
.ev.purchase { border-left-color: #f85149; }
.ev.authAttempt { border-left-color: #ffa657; }
.ev.authSuccess { border-left-color: #58a6ff; background: #0d2030; }
.ev.authFail { border-left-color: #f85149; }
.ev .ev-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; }
.ev .ev-type { color: #3fb950; font-weight: 600; }
.ev.linkClick .ev-type { color: #d29922; }
.ev.productView .ev-type { color: #58a6ff; }
.ev.formInteract .ev-type { color: #bc8cff; }
.ev.purchase .ev-type { color: #ff7b72; }
.ev.authAttempt .ev-type { color: #ffa657; }
.ev.authSuccess .ev-type { color: #58a6ff; }
.ev.authFail .ev-type { color: #ff7b72; }
.ev .ev-time { color: #6e7681; font-size: 10px; white-space: nowrap; }
.ev pre { color: #c9d1d9; white-space: pre-wrap; word-break: break-word; line-height: 1.4; font-size: 11px; margin: 0; font-family: inherit; }

@media (max-width: 900px) {
  .hero-wrap { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr; }
  .props-grid { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
  .foot-cols { grid-template-columns: 1fr 1fr; }
  .field-row { grid-template-columns: 1fr; }
  #rtcdp-panel { width: calc(100% - 40px); }
}
