@font-face {
  font-family: "Inter";
  src: url("/fonts/InterVariable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #162033;
  background: #f5f7fb;
  font-synthesis: none;
  --brand: #ee4d2d;
  --brand-dark: #d93f22;
  --brand-soft: #fff0eb;
  --ink: #162033;
  --muted: #667085;
  --line: #e4e8f0;
  --surface: rgba(255, 255, 255, .92);
  --green: #169b62;
  --green-soft: #eaf8f2;
  --blue: #2e6ae6;
  --blue-soft: #edf3ff;
  --amber: #b87503;
  --shadow: 0 20px 55px rgba(20, 30, 55, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(180deg, #f8f9fc 0%, #f3f6fa 100%);
  -webkit-font-smoothing: antialiased;
}

.ambient { position: fixed; z-index: -1; border-radius: 999px; filter: blur(2px); pointer-events: none; }
.ambient-one { top: -220px; left: -180px; width: 620px; height: 620px; background: radial-gradient(circle, rgba(255, 115, 70, .12), transparent 68%); }
.ambient-two { right: -230px; bottom: -280px; width: 680px; height: 680px; background: radial-gradient(circle, rgba(73, 108, 218, .08), transparent 69%); }

.app-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 80px; }

.app-header { display: flex; align-items: center; gap: 17px; margin-bottom: 28px; }
.brand-mark { display: grid; flex: 0 0 62px; height: 62px; place-items: center; border-radius: 19px; color: #fff; background: linear-gradient(145deg, #ff7452, #ee4328); box-shadow: 0 14px 32px rgba(238, 77, 45, .27); }
.brand-mark span { font-size: 29px; font-weight: 850; letter-spacing: -.05em; }
.brand-copy { min-width: 0; }
.eyebrow, .section-kicker { margin: 0 0 5px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
h1 { margin: 0; font-size: clamp(26px, 4vw, 34px); font-weight: 760; letter-spacing: -.045em; }
.subtitle { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.local-badge { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; padding: 8px 11px; border: 1px solid #dfe4ed; border-radius: 999px; color: #5b6475; background: rgba(255,255,255,.7); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.local-badge-dot { width: 7px; height: 7px; border-radius: 50%; background: #8b95a7; }

.connection-card, .search-card, .product-card, .commission-card, .json-card {
  border: 1px solid rgba(218, 224, 234, .95);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.connection-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; padding: 16px 20px; border-radius: 16px; }
.connection-main { display: flex; align-items: center; gap: 12px; }
.connection-main strong { display: block; margin-bottom: 3px; font-size: 14px; }
.connection-main p { margin: 0; color: var(--muted); font-size: 12px; }
.status-dot { position: relative; width: 11px; height: 11px; border-radius: 50%; background: #d49a23; box-shadow: 0 0 0 6px rgba(212,154,35,.12); }
.status-dot.ok { background: var(--green); box-shadow: 0 0 0 6px rgba(22,155,98,.12); }
.status-dot.bad { background: #d64c43; box-shadow: 0 0 0 6px rgba(214,76,67,.11); }
.connection-meta { padding-left: 20px; border-left: 1px solid var(--line); text-align: right; }
.connection-meta span { display: block; margin-bottom: 2px; color: #8a93a3; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.connection-meta strong { color: #596275; font: 600 12px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; }

.search-card { margin-bottom: 16px; padding: 22px; border-radius: 18px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-heading.compact { align-items: center; margin-bottom: 14px; }
.section-heading h2 { margin: 0; font-size: 19px; font-weight: 720; letter-spacing: -.025em; }
.section-heading > p { margin: 0; color: #8a93a3; font-size: 12px; }
.search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.url-input-wrap { position: relative; }
.link-icon { position: absolute; top: 50%; left: 15px; color: #8b95a7; font-size: 17px; transform: translateY(-50%); }
input, button { min-height: 50px; border-radius: 12px; font: inherit; }
input { width: 100%; padding: 0 16px 0 43px; border: 1px solid #d9dfe9; outline: none; color: var(--ink); background: #fbfcfe; font-size: 14px; transition: .2s ease; }
input::placeholder { color: #a0a8b6; }
input:focus { border-color: rgba(238,77,45,.65); background: #fff; box-shadow: 0 0 0 4px rgba(238,77,45,.09); }
button { display: inline-flex; align-items: center; justify-content: center; gap: 22px; min-width: 158px; padding: 0 18px; border: 0; color: #fff; background: linear-gradient(135deg, #f2593a, #ea4226); box-shadow: 0 9px 20px rgba(238,77,45,.2); cursor: pointer; font-size: 13px; font-weight: 750; transition: transform .18s ease, box-shadow .18s ease; }
button:hover { transform: translateY(-1px); box-shadow: 0 12px 25px rgba(238,77,45,.27); }
button:disabled { cursor: wait; opacity: .62; transform: none; }
.error-message { margin: 13px 0 0; padding: 11px 13px; border: 1px solid #ffd9d2; border-radius: 10px; color: #ad3025; background: #fff2ef; font-size: 12px; line-height: 1.5; }

.result-stack { display: grid; gap: 16px; scroll-margin-top: 18px; }
.product-card { display: grid; grid-template-columns: 244px minmax(0,1fr); gap: 26px; padding: 22px; border-radius: 20px; }
.product-image-wrap { position: relative; overflow: hidden; width: 244px; aspect-ratio: 1; border-radius: 16px; background: linear-gradient(145deg, #f0f2f6, #e4e8ee); }
.product-image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.image-placeholder { display: grid; width: 100%; height: 100%; place-items: center; color: #fff; background: linear-gradient(145deg, #ff8466, #ef4d30); font-size: 55px; font-weight: 850; }
.product-content { min-width: 0; padding: 3px 2px 2px; }
.product-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.badges { display: flex; flex-wrap: wrap; gap: 7px; }
.badge { display: inline-flex; align-items: center; min-height: 25px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 730; }
.badge.success { color: #08774a; background: var(--green-soft); }
.badge.warning { color: #8b5c00; background: #fff3d6; }
.item-id { color: #929aa9; font: 500 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.product-name { max-width: 790px; margin: 16px 0 22px; font-size: clamp(20px, 2.5vw, 25px); line-height: 1.35; font-weight: 730; letter-spacing: -.03em; }
.product-metrics { display: grid; grid-template-columns: 1.25fr repeat(3, 1fr); gap: 9px; }
.metric { padding: 13px 14px; border: 1px solid #edf0f5; border-radius: 12px; background: #f8f9fb; }
.metric.primary { border-color: #ffe0d8; background: #fff5f2; }
.metric span { display: block; margin-bottom: 6px; color: #8790a1; font-size: 10px; font-weight: 650; }
.metric strong { display: block; overflow: hidden; color: #273246; font-size: 14px; font-weight: 730; text-overflow: ellipsis; white-space: nowrap; }
.metric.primary strong { color: var(--brand-dark); font-size: 17px; }
.product-actions { display: flex; align-items: center; gap: 18px; margin-top: 22px; }
.affiliate-button { display: inline-flex; align-items: center; gap: 18px; padding: 11px 14px; border-radius: 10px; color: #fff; background: var(--ink); text-decoration: none; font-size: 12px; font-weight: 720; transition: .18s ease; }
.affiliate-button:hover { background: #29364c; transform: translateY(-1px); }
.text-button { color: var(--brand); font-size: 12px; font-weight: 720; text-decoration: none; }

.commission-card { padding: 25px 25px 18px; border-radius: 20px; }
.commission-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 14px; color: #70798b; font-size: 11px; }
.commission-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.legend-dot.xtra { background: var(--brand); }
.legend-dot.shopee { background: var(--blue); }
.commission-table { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }
.commission-row { display: grid; grid-template-columns: minmax(185px,1.6fr) repeat(5,minmax(90px,1fr)); align-items: center; min-height: 78px; padding: 0 16px; border-top: 1px solid var(--line); background: #fff; }
.commission-row:first-child { border-top: 0; }
.commission-header { min-height: 42px; color: #7e8798; background: #f7f8fa; font-size: 10px; font-weight: 720; text-transform: uppercase; letter-spacing: .045em; }
.commission-row.featured { position: relative; background: linear-gradient(90deg, #fff9f6 0%, #fff 44%); }
.commission-row.featured::before { position: absolute; top: 0; bottom: 0; left: 0; width: 3px; background: var(--brand); content: ""; }
.channel-cell { display: flex; align-items: center; gap: 11px; }
.channel-cell strong { display: block; margin-bottom: 4px; font-size: 13px; }
.channel-cell small { display: block; color: #929aa8; font-size: 10px; }
.channel-icon { display: grid; flex: 0 0 34px; height: 34px; place-items: center; border-radius: 10px; font-size: 11px; font-weight: 800; }
.channel-icon.live { color: #9b5d04; background: #fff1d8; }
.channel-icon.social { color: #cb3d23; background: #ffebe5; }
.channel-icon.video { color: #265fca; background: #e9f0ff; }
.rate-stack, .total-rate, .amount { font-size: 13px; font-variant-numeric: tabular-nums; }
.rate-stack strong { display: block; font-size: 13px; }
.rate-stack small { display: block; margin-top: 4px; color: #8992a2; font-size: 10px; font-weight: 550; }
.xtra-rate { color: var(--brand-dark); }
.shopee-rate { color: var(--blue); }
.total-rate { color: #273246; }
.amount { color: #101828; font-size: 14px; }
.cap { color: #747e90; font-size: 11px; }
.commission-note { margin: 13px 2px 0; color: #8992a2; font-size: 10px; line-height: 1.5; }

.json-card { overflow: hidden; border-radius: 16px; }
.json-card summary { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; cursor: pointer; color: #626c7e; font-size: 12px; font-weight: 650; list-style: none; }
.json-card summary::-webkit-details-marker { display: none; }
.json-card pre { max-height: 440px; overflow: auto; margin: 0; padding: 20px; border-top: 1px solid #2f394b; color: #d8e1f1; background: #182131; font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }

.sr-only { position: absolute; overflow: hidden; width: 1px; height: 1px; padding: 0; border: 0; margin: -1px; clip: rect(0,0,0,0); white-space: nowrap; }

@media (max-width: 940px) {
  .commission-table { overflow-x: auto; }
  .commission-row { width: 900px; }
  .product-metrics { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 720px) {
  .app-shell { width: min(100% - 24px,1180px); padding: 28px 0 55px; }
  .app-header { align-items: flex-start; }
  .brand-mark { flex-basis: 52px; height: 52px; border-radius: 15px; }
  .brand-mark span { font-size: 24px; }
  .local-badge { display: none; }
  .subtitle { font-size: 12px; }
  .connection-card { align-items: flex-start; flex-direction: column; }
  .connection-meta { padding: 10px 0 0; border-top: 1px solid var(--line); border-left: 0; text-align: left; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .section-heading > p { display: none; }
  .search-form { grid-template-columns: 1fr; }
  button { width: 100%; }
  .product-card { grid-template-columns: 1fr; padding: 15px; }
  .product-image-wrap { width: 100%; max-width: 330px; }
  .product-name { margin-top: 13px; }
  .product-topline { align-items: flex-start; flex-direction: column; }
  .commission-card { padding: 19px 14px 14px; }
  .commission-legend { justify-content: flex-start; }
}

@media (max-width: 430px) {
  .product-metrics { grid-template-columns: 1fr 1fr; }
  .product-actions { align-items: flex-start; flex-direction: column; }
}
