/* Trade data (/hscodes/) on the ?layout=preview styling: same masthead, outlined cards,
   light tables and segmented toggles as the product pages. Layout and navigation unchanged. */

body.hs-pv {
  --ink: #14213d; --ink-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --line: #e3e9f1; --line-2: #edf1f6; --bg: #f3f6fa; --panel: #fff;
  --blue: #027bfb; --blue-dark: #0062cc; --tint: #eaf3ff;
  font-family: Inter, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased;
}
body.hs-pv .hscodes-content h1,
body.hs-pv .hscodes-content h2,
body.hs-pv .hscodes-content h3 { font-family: inherit; }

/* ── Masthead (header_slot) ── */
body.hs-pv .main-header { padding: 10px 20px; gap: 18px; flex-wrap: nowrap; }
body.hs-pv .main-header .logo { width: 112px; }
body.hs-pv .main-header .right-links { margin-left: 0; }
body.hs-pv .pv-bar { flex: 1; min-width: 0; display: flex; align-items: center; gap: 16px; padding: 8px 0; position: relative; z-index: 3; }
body.hs-pv .pv-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
body.hs-pv .pv-title-icon {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 10px;
  background: linear-gradient(180deg, #f3f8ff, var(--tint)); border: 1px solid #dbe9fb;
  display: flex; align-items: center; justify-content: center;
}
body.hs-pv .pv-title-icon svg { width: 26px; height: 26px; }
body.hs-pv .pv-title h1 { margin: 0; padding: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; color: var(--ink); }
body.hs-pv .pv-sub { margin-top: 3px; }
body.hs-pv .pv-updated { font-size: 12px; color: var(--muted); }
body.hs-pv .pv-controls { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
body.hs-pv .pv-controls-sep { width: 1px; height: 24px; background: var(--line); }
body.hs-pv .pv-toggle {
  display: inline-flex; gap: 2px; height: 40px; box-sizing: border-box;
  background: var(--line-2); border: 1px solid var(--line); padding: 3px; border-radius: 10px;
}
body.hs-pv .pv-toggle a,
body.hs-pv .flow-toggle button {
  height: 32px; box-sizing: border-box; border: 0; background: transparent; cursor: pointer;
  font: 600 13px/1 Inter, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--muted);
  padding: 0 14px; border-radius: 7px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
body.hs-pv .pv-toggle a:hover,
body.hs-pv .flow-toggle button:hover:not(.active) { color: var(--ink); background: transparent; }
body.hs-pv .pv-toggle a.active,
body.hs-pv .flow-toggle button.active {
  background: var(--panel); color: var(--ink);
  box-shadow: 0 1px 2px rgba(16,24,40,0.10), 0 0 0 1px rgba(16,24,40,0.04);
}
@media (max-width: 1240px) {
  body.hs-pv .main-header { flex-wrap: wrap; }
  body.hs-pv .main-header .pv-bar { order: 3; flex-basis: 100%; }
  body.hs-pv .main-header .right-links { margin-left: auto; }
}

/* ── Page frame and ad slots ── */
body.hs-pv .hscodes-page-wrapper { background: var(--bg); }
body.hs-pv .hscodes-ad-top { background: var(--bg); gap: 12px; padding: 16px 24px 0; }
body.hs-pv .hscodes-ad-left,
body.hs-pv .hscodes-ad-right { background: var(--bg); gap: 12px; padding: 24px 0; width: 226px; min-width: 226px; }
body.hs-pv .hscodes-ad-left { padding-left: 24px; }
body.hs-pv .hscodes-ad-right { padding-right: 24px; }
body.hs-pv .ad-slot,
body.hs-pv .ad-slot-top,
body.hs-pv .ad-slot-top-square {
  border: 1px dashed #d3dce7; border-radius: 12px; background: rgba(255,255,255,0.55);
  color: var(--faint); font-size: 11px; font-weight: 500; letter-spacing: 0.04em;
}
body.hs-pv .ad-price { color: #b6c0cc; }
body.hs-pv .ad-slot-fdk { display: none; } /* logo is in the masthead */
body.hs-pv .hscodes-content { padding: 24px 28px 40px; }
body.hs-pv .hscodes-view-toggle { display: none; } /* moved to the masthead */
body.hs-pv .generated-note { color: var(--faint); font-size: 12px; }

/* ── Headings and intro ── */
body.hs-pv .hscodes-content h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); margin: 0 0 6px; }
body.hs-pv .hscodes-content .subtitle { color: var(--ink-2); font-size: 14px; }
body.hs-pv .hscodes-content .subtitle-detail { color: var(--muted); font-size: 13px; }
body.hs-pv .hscodes-content .subtitle-detail a { color: var(--blue); text-decoration: none; font-weight: 600; }
body.hs-pv .hscodes-content h2 {
  display: block; border: 0; padding: 0; margin: 28px 0 10px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--faint);
}
body.hs-pv .hscodes-content h2.section-heading {
  text-transform: none; letter-spacing: -0.01em; font-size: 16px; font-weight: 700; color: var(--ink); margin: 18px 0 10px;
}
body.hs-pv .hscodes-content h3 { font-size: 15px; font-weight: 700; color: var(--ink); margin: 22px 0 4px; }

/* ── Country and product cards ── */
body.hs-pv .region-grid,
body.hs-pv .product-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
body.hs-pv .country-card,
body.hs-pv .hs-product-card {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: none; padding: 11px 14px; gap: 10px; transition: border-color 0.15s, background 0.15s;
}
body.hs-pv .country-card:hover,
body.hs-pv .hs-product-card:hover { border-color: #cfe2fb; background: #f7fbff; box-shadow: none; }
body.hs-pv .country-card a,
body.hs-pv .hs-product-card a { color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; }
/* Whole card is the link */
body.hs-pv .country-card a::after,
body.hs-pv .hs-product-card a::after { content: ""; position: absolute; inset: 0; }
body.hs-pv .country-card:hover a,
body.hs-pv .hs-product-card:hover a { color: var(--blue); text-decoration: none; }
body.hs-pv .country-card .flag-img {
  width: 24px; height: 17px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(15,23,42,0.12);
}
body.hs-pv .country-card.no-data { opacity: 1; background: var(--line-2); border-color: transparent; }
body.hs-pv .country-card.no-data .flag-img { filter: grayscale(1); opacity: 0.5; }
body.hs-pv .country-card.no-data span,
body.hs-pv .hs-product-card.no-data span { color: var(--faint); font-style: normal; font-size: 13px; }
body.hs-pv .hs-product-card .country-count {
  font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap;
  background: rgba(100,116,139,0.12); border-radius: 999px; padding: 1px 8px;
}

/* ── Breadcrumb and country/product chips ── */
body.hs-pv .hscodes-breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
body.hs-pv .hscodes-breadcrumb a { color: var(--blue); font-weight: 600; text-decoration: none; }
body.hs-pv .hscodes-breadcrumb a:hover { text-decoration: underline; color: var(--blue); }
body.hs-pv .hscodes-nav-bar { gap: 6px; padding: 0 0 16px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
body.hs-pv .hscodes-nav-bar a,
body.hs-pv .hscodes-nav-bar .current {
  height: 28px; box-sizing: border-box; display: inline-flex; align-items: center;
  padding: 0 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
body.hs-pv .hscodes-nav-bar a { background: var(--panel); border: 1px solid var(--line); color: var(--ink-2); }
body.hs-pv .hscodes-nav-bar a:hover { background: var(--tint); border-color: #cfe2fb; color: var(--blue); }
body.hs-pv .hscodes-nav-bar .current { background: var(--blue); border: 1px solid var(--blue); color: #fff; }

/* ── Country profile ── */
body.hs-pv .country-profile { border: 1px solid var(--line); box-shadow: none; border-radius: 14px; padding: 18px 22px; }
body.hs-pv .country-profile .profile-flag { width: 72px; border-radius: 6px; box-shadow: 0 0 0 1px rgba(15,23,42,0.10); }
body.hs-pv .country-profile .stat-item { align-items: flex-start; }
body.hs-pv .country-profile .stat-value { font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
body.hs-pv .country-profile .stat-label { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); text-align: left; }

/* ── Imports/Exports toggle ── */
body.hs-pv .title-row { margin: 6px 0 4px; }
body.hs-pv .title-row h1 { font-size: 22px; }
body.hs-pv .flow-toggle {
  border: 1px solid var(--line); background: var(--line-2); padding: 3px; gap: 2px;
  border-radius: 10px; height: 40px; box-sizing: border-box; animation: none;
}
body.hs-pv .back-link-btn {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; margin: 8px 0 4px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  color: var(--blue); font-size: 13px; font-weight: 600; text-decoration: none;
}
body.hs-pv .back-link-btn:hover { background: var(--tint); border-color: #cfe2fb; }
body.hs-pv .product-summary { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ── Trade tables ── */
body.hs-pv .trade-table-wrapper {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 24px;
}
body.hs-pv .trade-table { margin: 0; box-shadow: none; border-radius: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
body.hs-pv .trade-table thead th {
  background: #f8fafc; color: var(--muted); border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 11px 12px;
}
body.hs-pv .trade-table thead th:hover { background: #f1f5fa; color: var(--ink); }
body.hs-pv .trade-table thead th[data-type="num"]:not([data-col="0"]) { text-align: right; }
body.hs-pv .top5-sub-table thead th:nth-child(n+3) { text-align: right; }
body.hs-pv .trade-table thead th .sort-arrow { font-size: 8px; opacity: 0.35; }
body.hs-pv .trade-table thead th.sort-asc,
body.hs-pv .trade-table thead th.sort-desc { color: var(--blue); }
body.hs-pv .trade-table tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); }
body.hs-pv .trade-table tbody tr.data-row:nth-of-type(4n+3) { background: #f7fbff; }
body.hs-pv .trade-table tbody tr.data-row:hover { background: var(--tint); }
body.hs-pv .trade-table tbody tr.data-row td:first-child { color: var(--ink); font-weight: 600; padding-left: 28px; }
body.hs-pv .trade-table tbody tr.data-row td:first-child::before {
  content: ""; left: 12px; width: 6px; height: 6px; font-size: 0;
  border-right: 1.6px solid var(--faint); border-bottom: 1.6px solid var(--faint);
  transform: translateY(-65%) rotate(-45deg);
}
body.hs-pv .trade-table tbody tr.data-row.expanded { background: var(--tint); }
body.hs-pv .trade-table tbody tr.data-row.expanded td:first-child { color: var(--blue); }
body.hs-pv .trade-table tbody tr.data-row.expanded td:first-child::before {
  border-color: var(--blue); transform: translateY(-75%) rotate(45deg);
}
body.hs-pv .trade-table .reporter-flag {
  width: 20px; height: 14px; object-fit: cover; border-radius: 3px; vertical-align: -2px; margin-right: 8px;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.12);
}
body.hs-pv .trade-table .total-row td {
  background: #f8fafc; border-top: 1px solid var(--line); border-bottom: 0; color: var(--ink); font-weight: 700;
}
body.hs-pv .trade-table .others-row td { color: var(--faint); }

/* Top-5 partners under an expanded row */
body.hs-pv .top5-detail-row td { background: #f7fbff; border-bottom: 1px solid var(--line); padding: 4px 16px 14px 28px; }
body.hs-pv .top5-sub-table { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; border-collapse: separate; border-spacing: 0; overflow: hidden; font-size: 12.5px; }
body.hs-pv .top5-sub-table thead th,
body.hs-pv .top5-sub-table thead th:hover {
  background: #f8fafc; color: var(--faint); font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  border-bottom: 1px solid var(--line); padding: 8px 10px;
}
body.hs-pv .top5-sub-table tbody td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); }
body.hs-pv .top5-sub-table tbody tr:last-child td { border-bottom: 0; }
body.hs-pv .top5-sub-table .others-row td { color: var(--faint); font-style: normal; }

@media (max-width: 1100px) {
  body.hs-pv .hscodes-content { padding: 20px 16px 32px; }
}
