/* ─────────────────────────────────────────────────
   DOV WIKI — Wikipedia-style CSS
   Tối giản. Chỉ đen + trắng + xanh dương.
   Text là trung tâm.
   ───────────────────────────────────────────── */

:root {
  --bg:        #ffffff;
  --surface:   #f8f9fa;    /* Wikipedia light gray */
  --border:    #a2a9b1;    /* Wikipedia border color */
  --border-lt: #eaecf0;    /* Wikipedia light border */
  --text:      #202122;    /* Wikipedia text */
  --muted:     #54595d;    /* Wikipedia muted */
  --link:      #3366cc;    /* Wikipedia link blue */
  --link-vis:  #6b4ba1;    /* Wikipedia visited */
  --brand:     #0f172a;
  --font: -apple-system, BlinkMacSystemFont, 'Linux Libertine', Georgia, Times, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, monospace;
  --max-width: 1100px;
  --sidebar-w: 200px;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

/* Ẩn Google Translate toolbar mặc định (thanh xanh xấu inject vào top) */
.goog-te-banner-frame,
.skiptranslate { display: none !important; }
body { top: 0 !important; }
.goog-te-gadget { display: none !important; }

a { color: var(--link); text-decoration: none; }
a:visited { color: var(--link-vis); }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: #f8f9fa;
  border: 1px solid #eaecf0;
  padding: 1px 5px;
  color: #202122;
}

/* ─────────── HEADER — Wikipedia style ─────────── */
#wiki-header {
  background: #fff;
  border-bottom: 1px solid var(--border-lt);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Top bar: logo + search */
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border-lt);
}

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

.brand-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo-img { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; display: block; }
.brand-icon { font-size: 26px; line-height: 1; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.brand-tagline { font-size: 11px; color: var(--muted); white-space: nowrap; }

.header-search { flex: 1; max-width: 500px; position: relative; }

/* Header right group: Extension + Lang switcher — luôn cùng hàng, không wrap */
.header-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
  white-space: nowrap;
}

/* Chrome Extension CTA button */
.header-ext-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 5px 10px;
  background-color: #1d4ed8;
  color: #fff !important;           /* override a:visited */
  font-size: 11px;
  font-weight: 700;
  text-decoration: none !important;
  white-space: nowrap;
  letter-spacing: .01em;
  border: 2px solid #1d4ed8;
  transition: background-color .15s, border-color .15s;
}
.header-ext-btn:visited,
.header-ext-btn:focus {
  color: #fff !important;
  background-color: #1d4ed8;
}
.header-ext-btn:hover {
  background-color: #1e40af;
  border-color: #1e40af;
  color: #fff !important;
  text-decoration: none;
}

.search-box { display: flex; }

.search-box input {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  outline: none;
  font-family: var(--font-ui);
}

.search-box input::placeholder { color: var(--muted); }
.search-box input:focus { border-color: var(--link); }

.search-box button {
  padding: 6px 14px;
  background: var(--link);
  border: 1px solid var(--link);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.search-box button:hover { background: #2a4baa; }

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  z-index: 200;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  max-height: 400px;
  overflow-y: auto;
}

.suggestion-item {
  padding: 7px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-lt);
  color: var(--text);
  text-decoration: none;
}

.suggestion-item:hover { background: #eaf3fb; text-decoration: none; }
.suggestion-item:focus { background: #eaf3fb; outline: none; }
.suggestion-item:last-child { border-bottom: none; }
.suggestion-img { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.suggestion-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion-sku { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.suggestion-price { margin-left: auto; font-weight: 700; color: var(--text); font-size: 12px; flex-shrink: 0; padding-left: 8px; white-space: nowrap; }

/* Tab navigation bar — Wikipedia-style below brand/search */
.header-nav {
  background: var(--surface);
}

.header-nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 0;
}

.header-nav a {
  padding: 5px 14px;
  font-size: 13px;
  color: var(--link);
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
  border-right: 1px solid var(--border-lt);
}

.header-nav a:first-child { border-left: 1px solid var(--border-lt); }
.header-nav a:hover { background: #eaf3fb; text-decoration: none; }

/* Language switcher — inside header-actions, cạnh ext btn */
.lang-switcher {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.lang-btn {
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--muted);
  background: #fff;
  border: none;
  border-left: 1px solid var(--border-lt);
  cursor: pointer;
  line-height: 1;
  transition: color .12s, background .12s;
}
.lang-btn:first-child { border-left: none; }
.lang-btn:hover { background: #eaf3fb; color: var(--link); }
.lang-btn.active {
  color: #fff;
  background: #0f172a;
}

/* ─────────── MAIN WRAP ─────────── */
#wiki-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 16px;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 24px;
  align-items: start;
}

#wiki-main { min-width: 0; }

/* ─────────── SIDEBAR ─────────── */
#wiki-sidebar { font-size: 13px; }

.sidebar-block {
  border: 1px solid var(--border-lt);
  margin-bottom: 12px;
  background: var(--surface);
}

.sidebar-title {
  background: #eaecf0;
  border-bottom: 1px solid var(--border-lt);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.sidebar-list { list-style: none; padding: 2px 0; }

.sidebar-list li { }

.sidebar-list a {
  display: block;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--link);
}

.sidebar-list a:hover { background: #eaf3fb; text-decoration: none; }
.sidebar-list a.active { font-weight: 700; color: var(--text); }

/* Subcategory list đệ quy — mỗi cấp indent thêm */
.sidebar-sublist {
  list-style: none; padding: 2px 0 2px 10px;
  border-left: 2px solid var(--border-lt);
  margin: 2px 0 4px 10px;
}
.sidebar-sublist a {
  display: block; padding: 3px 8px;
  font-size: 12px; color: var(--link);
}
.sidebar-sublist a:hover { background: #eaf3fb; text-decoration: none; }
.sidebar-sublist a.active { font-weight: 700; color: var(--text); }

/* Sublist lồng tiếp — cấp 3+ indent thêm với màu border nhạt hơn */
.sidebar-sublist .sidebar-sublist {
  margin-left: 8px;
  border-left-color: #e2e8f0;
}
.sidebar-sublist .sidebar-sublist a { font-size: 11px; }

/* ─────────── TIER PRICES (Giá sỉ theo cấp đại lý) — wiki blue tone ─────────── */
.tier-prices {
  margin: 8px 0 14px;
  padding: 10px 12px;
  background: #f3f6fa;
  border: 1px solid var(--border-lt);
  border-left: 3px solid var(--link);
}
.tier-prices-title {
  font-size: 12px; font-weight: 700; color: var(--link);
  margin-bottom: 8px; letter-spacing: .02em;
}
.tier-prices-grid {
  display: grid; gap: 6px;
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 600px) {
  .tier-prices-grid { grid-template-columns: repeat(2, 1fr); }
}
.tier-card {
  background: #fff;
  border: 1px solid var(--border-lt);
  padding: 6px 8px;
}
.tier-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 3px;
}
.tier-card-label {
  font-size: 11px; font-weight: 700; color: var(--link);
  letter-spacing: .03em;
}
.tier-card-disc {
  font-size: 11px; font-weight: 700; color: var(--link);
}
.tier-card-price {
  font-size: 13px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.tier-card-desc { font-size: 10px; color: var(--muted); margin-top: 1px; }
.tier-prices-tip {
  margin-top: 8px;
  font-size: 11px; color: var(--muted); font-style: italic;
}

/* ─────────── SIDEBAR CONSULTANT WIDGET ─────────── */
.sidebar-consultant { border-top: 2px solid #15803d; }
.sidebar-consultant .sidebar-title { color: #15803d; }
.sidebar-consultant-list { list-style: none; padding: 6px 10px 4px; margin: 0; }
.sidebar-consultant-list li { padding: 7px 0; border-bottom: 1px dashed var(--border-lt); }
.sidebar-consultant-list li:last-child { border-bottom: 0; }
.sc-region {
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px;
}
.sc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sc-phone {
  font-size: 14px; font-weight: 700; color: #1d4ed8;
  font-variant-numeric: tabular-nums; letter-spacing: .01em;
}
.sc-phone:hover { text-decoration: none; color: #0f172a; }
.sc-zalo {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; font-size: 11px; font-weight: 700;
  background: #2563eb; color: #fff !important;
  border: 1px solid #1d4ed8;
}
.sc-zalo:hover { background: #1e40af; text-decoration: none; color: #fff; }
.sc-note {
  padding: 8px 10px 10px; font-size: 11px; color: var(--muted);
  line-height: 1.5; margin: 0;
  border-top: 1px solid var(--border-lt); background: #f8fafc;
}

/* ─────────── SIDEBAR KNOWLEDGE WIDGET ─────────── */
.sidebar-knowledge { border-top: 2px solid #1d4ed8; }
.sidebar-knowledge .sidebar-title { color: #1d4ed8; }

.sidebar-knowledge-list {
  list-style: none; padding: 4px 0; margin: 0;
}
.sidebar-knowledge-list li { margin-bottom: 2px; }

.sidebar-knowledge-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 10px;
  text-decoration: none;
  color: var(--text);
  transition: background .15s;
}
.sidebar-knowledge-item:hover { background: #eaf3fb; }

.sidebar-knowledge-thumb {
  width: 40px; height: 40px; flex-shrink: 0;
  object-fit: cover;
  border: 1px solid var(--border-lt);
  background: #f1f5f9;
}
.sidebar-knowledge-thumb--empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #94a3b8;
}

.sidebar-knowledge-title {
  font-size: 12px; line-height: 1.45;
  color: var(--link);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.sidebar-knowledge-item:hover .sidebar-knowledge-title { text-decoration: underline; }

.sidebar-knowledge-more {
  padding: 6px 10px 4px;
  border-top: 1px solid var(--border-lt);
  text-align: right;
}
.sidebar-knowledge-more a {
  font-size: 11px; color: #1d4ed8; text-decoration: none;
}
.sidebar-knowledge-more a:hover { text-decoration: underline; }

/* Toolbar breadcrumb separator */
.chip-sep {
  color: var(--text-muted); font-size: 12px;
  display: inline-flex; align-items: center;
  padding: 0 2px;
}

/* ─────────── BREADCRUMB ─────────── */
.breadcrumb {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.breadcrumb a { color: var(--link); }
.bc-sep { color: #a2a9b1; }
.breadcrumb [aria-current="page"] { color: var(--text); }

/* ─────────── PAGE TITLE ─────────── */
.wiki-title {
  font-family: var(--font);
  font-size: 24px;
  font-weight: 400;   /* Wikipedia uses regular weight for h1 */
  color: var(--text);
  line-height: 1.25;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.wiki-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: -10px;
  margin-bottom: 16px;
}

/* ─────────── FILTERS / TOOLBAR ─────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border-lt);
  border-bottom: 1px solid var(--border-lt);
  font-size: 13px;
}

.toolbar-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.filter-chips { display: flex; gap: 4px; flex-wrap: wrap; }

.chip {
  font-size: 12px;
  padding: 2px 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--link);
  cursor: pointer;
  text-decoration: none;
}

.chip:hover { background: #eaf3fb; text-decoration: none; border-color: var(--link); }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }

.result-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* ─────────── PRODUCT LIST (Wikipedia article list style) ─────────── */
.product-grid {
  border-top: 1px solid var(--border-lt);
  margin-bottom: 20px;
}

.product-card {
  border-bottom: 1px solid var(--border-lt);
}

.product-card:hover { background: #eaf3fb; }

.product-card-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  text-decoration: none;
  color: inherit;
}

.product-card-img {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  overflow: hidden;
  background: #f8f9fa;
  border: 1px solid var(--border-lt);
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.product-card-img-placeholder {
  font-size: 22px;
  opacity: .3;
}

.product-card-body {
  flex: 1;
  min-width: 0;
}

.product-card-name {
  font-size: 14px;
  font-weight: 400;
  color: var(--link);
  line-height: 1.35;
  margin-bottom: 2px;
}

.product-card:hover .product-card-name { text-decoration: underline; }

.product-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.product-card-sku {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--muted);
}

/* Category badge ẩn */
.product-card-cat { display: none; }
.product-card-desc { display: none; }

.product-card-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-left: auto;
  flex-shrink: 0;
  padding-left: 12px;
  white-space: nowrap;
}

/* ─────────── PRODUCT DETAIL — Wikipedia infobox style ─────────── */

/* Wikipedia infobox floats right */
.wiki-infobox {
  float: right;
  clear: right;
  margin: 0 0 16px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  width: 260px;
  max-width: 40%;
}

.wiki-infobox-title {
  background: #cee0f2;   /* Wikipedia infobox header blue */
  text-align: center;
  padding: 6px 10px;
  font-weight: 700;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.wiki-infobox-img {
  padding: 10px;
  text-align: center;
  border-bottom: 1px solid var(--border-lt);
}

.wiki-infobox-img img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  mix-blend-mode: multiply;
  display: inline-block;
}

.wiki-infobox-img-placeholder {
  font-size: 60px;
  opacity: .2;
  padding: 20px;
}

.wiki-infobox table {
  width: 100%;
  border-collapse: collapse;
}

.wiki-infobox th,
.wiki-infobox td {
  padding: 4px 8px;
  vertical-align: top;
  font-size: 12px;
  border-top: 1px solid var(--border-lt);
  word-break: break-word;
  overflow-wrap: break-word;
}

.wiki-infobox th {
  color: var(--muted);
  font-weight: 600;
  width: 40%;
  text-align: right;
  white-space: nowrap;
}

.wiki-infobox td {
  color: var(--text);
  max-width: 160px;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Price display in article */
.wiki-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 12px 0 4px;
}

.wiki-price-note {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}

/* Wikipedia article sections */
.wiki-section {
  margin: 20px 0 0;
  padding-top: 4px;
  clear: both;
}

.wiki-section-title {
  font-family: var(--font);
  font-size: 18px;
  font-weight: 400;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 10px;
}

.wiki-section p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 8px;
}

/* Compatibility list — inline like Wikipedia */
.compat-inline {
  font-size: 13px;
  color: var(--text);
  line-height: 1.8;
}

.compat-inline a { color: var(--link); }

/* SKU badge */
.sku-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--brand);
  color: #94a3b8;
  padding: 2px 8px;
  font-weight: 700;
  letter-spacing: .04em;
  margin-bottom: 6px;
}

/* EPC Citations — Wikipedia reference style */
.epc-citations {
  margin: 20px 0 0;
  padding-top: 4px;
  clear: both;
}

.epc-citations-title {
  font-family: var(--font);
  font-size: 18px;
  font-weight: 400;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 10px;
}

.epc-citation-intro {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  font-style: italic;
}

.epc-citation-list {
  list-style: none;
  padding: 0;
}

.epc-citation-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-lt);
  font-size: 13px;
}

.epc-citation-item:last-child { border-bottom: none; }

.epc-cite-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  min-width: 24px;
}

.epc-cite-body {}
.epc-cite-name { color: var(--link); }
.epc-cite-attrs { font-size: 12px; color: var(--muted); }

/* Inline citation superscript in body text */
.cite-ref {
  font-size: 11px;
  vertical-align: super;
  line-height: 0;
  color: var(--link);
}

/* Footnote references cuối bài — Wikipedia style */
.wiki-references {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border-lt);
}
.wiki-references h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 0 10px;
}
.wiki-ref-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 4px 24px;
}
.wiki-ref-list li {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.6;
}
.wiki-ref-list li a {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

/* Wikipedia info table (product detail infobox expanded) */
.product-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0;
}

.product-info-table th,
.product-info-table td {
  padding: 5px 10px;
  border: 1px solid var(--border-lt);
  text-align: left;
  vertical-align: top;
}

.product-info-table th {
  background: var(--surface);
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  width: 35%;
  white-space: nowrap;
}

.product-info-table tr:nth-child(even) td { background: #f8f9fa; }

/* ─────────── SELLER LINKS (Các nơi đang bán) ─────────── */
.seller-links-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--border-lt);
}
.seller-link-item { border-bottom: 1px solid var(--border-lt); }
.seller-link-anchor {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
  color: var(--text);
  text-decoration: none;
  transition: background .12s;
}
.seller-link-anchor:hover { background: #eaf3fb; text-decoration: none; }
.seller-link-domain {
  font-size: 12px;
  font-weight: 700;
  color: var(--link);
  min-width: 130px;
  flex-shrink: 0;
}
.seller-link-anchor:hover .seller-link-domain { text-decoration: underline; }
.seller-link-title {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seller-link-ext { font-size: 11px; color: #94a3b8; flex-shrink: 0; }

/* Related products as text list */
.related-list {
  border-top: 1px solid var(--border-lt);
}

.related-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-lt);
  font-size: 13px;
}

.related-thumb {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  object-fit: contain;
  border: 1px solid var(--border-lt);
  background: var(--surface);
}

.related-thumb-placeholder {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #ccc;
}

.related-name { color: var(--link); flex: 1; }
.related-sku { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.related-price { font-weight: 700; font-size: 13px; color: var(--text); flex-shrink: 0; }

/* ─────────── SEARCH RESULTS ─────────── */
.search-result-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-lt);
}

.search-result-img {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--border-lt);
}

.search-result-img-placeholder {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #ccc;
}

.search-result-body { flex: 1; }
.search-result-title { font-size: 15px; margin-bottom: 3px; }
.search-result-title a { color: var(--link); }
.search-result-meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; font-family: var(--font-mono); }
.search-result-desc { font-size: 13px; color: var(--muted); }

/* ─────────── HOMEPAGE ─────────── */

/* ── Homepage Article Cards ── */
.hp-articles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border-top: 1px solid var(--border-lt);
}

.hp-article-card {
  border-bottom: 1px solid var(--border-lt);
  border-right: 1px solid var(--border-lt);
}
.hp-article-card:nth-child(2n) { border-right: none; }

.hp-article-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text);
  text-decoration: none;
  transition: background .15s;
}
.hp-article-link:hover { background: #eaf3fb; text-decoration: none; }

.hp-article-img {
  width: 80px;
  height: 56px;
  flex-shrink: 0;
  overflow: hidden;
  background: #f1f5f9;
  border: 1px solid var(--border-lt);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hp-article-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hp-article-img--empty { font-size: 22px; color: #94a3b8; }

.hp-article-body {
  flex: 1;
  min-width: 0;
}

.hp-article-title {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--link);
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hp-article-link:hover .hp-article-title { text-decoration: underline; }

.hp-article-excerpt {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.hp-article-date {
  font-size: 11px;
  color: #94a3b8;
}

.hero {
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--border-lt);
  margin-bottom: 20px;
}

.hero-title {
  font-family: var(--font);
  font-size: 26px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 8px;
}

.hero-subtitle { font-size: 14px; color: var(--muted); margin-bottom: 16px; }

.hero-stats {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.stat-item { }
.stat-number { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 11px; color: var(--muted); }

/* Section title (Wikipedia section) */
.section-title {
  font-family: var(--font);
  font-size: 18px;
  font-weight: 400;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 14px;
}

/* Category cards — compact text links */
.category-grid {
  columns: 2;
  gap: 0;
  margin-bottom: 16px;
  list-style: none;
}

.category-card {
  display: block;
  padding: 3px 0;
  color: var(--link);
  font-size: 13px;
  text-decoration: none;
  break-inside: avoid;
}

.category-card:hover { text-decoration: underline; }
.category-card-icon { display: none; }

/* ─────────── INFO TABLE ─────────── */
.info-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.info-table th {
  background: var(--surface);
  border: 1px solid var(--border-lt);
  padding: 6px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  width: 140px;
  vertical-align: top;
}

.info-table td {
  border: 1px solid var(--border-lt);
  padding: 6px 10px;
  color: var(--text);
  vertical-align: top;
}

/* ─────────── EPC PARTS TABLE ─────────── */
.epc-parts-table {
  margin: 12px 0;
  overflow-x: auto;
}

.epc-parts-table table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

.epc-parts-table th {
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 6px 10px;
  text-align: left;
  border: 1px solid var(--border-lt);
}

.epc-parts-table td {
  padding: 6px 10px;
  border: 1px solid var(--border-lt);
  vertical-align: middle;
}

.epc-parts-table tr:nth-child(even) td { background: #f8f9fa; }

/* EPC attrs badges */
.epc-attrs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 2px;
}

.epc-attr {
  font-size: 11px;
  color: var(--muted);
}

.epc-attr::after { content: ' ·'; }
.epc-attr:last-child::after { content: ''; }

/* ─────────── PAGINATION ─────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  margin: 20px 0;
  flex-wrap: wrap;
}

.pagination a,
.pag-current,
.pag-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  font-size: 13px;
  border: 1px solid var(--border-lt);
}

.pagination a { color: var(--link); background: var(--bg); }
.pagination a:hover { background: #eaf3fb; text-decoration: none; }
.pag-current { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.pag-ellipsis { border: none; color: var(--muted); }
.pag-prev, .pag-next { font-weight: 600; }

/* ─────────── NOTICE / EMPTY ─────────── */
.notice {
  padding: 12px 16px;
  background: #eaf3fb;
  border: 1px solid #a2c4e0;
  font-size: 13px;
  color: var(--text);
  margin: 12px 0;
}

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}

.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ─────────── FOOTER ─────────── */
#wiki-footer {
  background: var(--surface);
  color: var(--muted);
  margin-top: 32px;
  font-size: 12px;
  border-top: 1px solid var(--border-lt);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Hàng trên: brand info trái + links phải */
.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 12px;
}

.footer-inner a { color: var(--link); }
.footer-inner a:hover { color: var(--text); }
.footer-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* Hàng dưới: thông tin pháp lý — full width, căn giữa */
.footer-legal {
  width: 100%;
  padding: 10px 0 14px;
  border-top: 1px dashed var(--border-lt);
  font-size: 11px;
  color: var(--muted);
  opacity: 0.75;
  text-align: center;
  line-height: 1.8;
}
.footer-legal strong { color: var(--text-sub, #475569); font-weight: 600; }

/* ─────────── KNOWLEDGE ARTICLES ─────────── */
.article-list { border-top: 1px solid var(--border-lt); }

.article-card {
  border-bottom: 1px solid var(--border-lt);
  padding: 14px 0;
}

.article-card:hover { background: #fafbfc; }

.article-card-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.article-card-thumb {
  flex-shrink: 0;
  display: block;
  width: 80px;
  height: 80px;
  overflow: hidden;
  border: 1px solid var(--border-lt);
  background: var(--surface);
}

.article-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-card-text { flex: 1; min-width: 0; }

.article-card-cat {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}

.article-card-cat a { color: var(--link); }

.article-card-title {
  font-family: var(--font);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 6px;
}

.article-card-title a { color: var(--link); }
.article-card-title a:hover { text-decoration: underline; }

.article-card-excerpt {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-meta { font-size: 12px; color: var(--muted); }

/* Article detail — body content */
.wiki-article-content {
  font-size: 14px;
  color: var(--text);
  line-height: 1.8;
  margin: 16px 0;
  clear: both;
}

.wiki-article-content p { margin-bottom: 12px; }
.wiki-article-content h2 { font-family: var(--font); font-size: 20px; font-weight: 400; border-bottom: 1px solid var(--border-lt); padding-bottom: 4px; margin: 20px 0 10px; }
.wiki-article-content h3 { font-size: 16px; font-weight: 600; margin: 16px 0 8px; }
.wiki-article-content ul, .wiki-article-content ol { margin: 8px 0 12px 20px; }
.wiki-article-content li { margin-bottom: 4px; line-height: 1.7; }
.wiki-article-content strong { font-weight: 700; }
.wiki-article-content em { font-style: italic; color: var(--muted); }

/* SKU inline link — Wikipedia cite style */
.wiki-sku-inline {
  color: var(--link);
  font-family: var(--font-mono);
  font-size: 12px;
  text-decoration: none;
  border-bottom: 1px dotted var(--link);
}

.wiki-sku-inline:hover { text-decoration: underline; }

/* ─────────── MARKDOWN ELEMENTS (từ dov_markdown_to_html) ─────────── */
.wiki-p { margin-bottom: 12px; line-height: 1.75; }
.wiki-h2 {
  font-size: 20px; font-weight: 400;
  border-bottom: 1px solid var(--border-lt);
  padding-bottom: 4px; margin: 24px 0 10px;
  color: var(--text);
}
.wiki-h3 {
  font-size: 15px; font-weight: 700;
  margin: 18px 0 8px; color: var(--text);
}
.wiki-ul { list-style: disc; margin: 6px 0 12px 22px; }
.wiki-ol { list-style: decimal; margin: 6px 0 12px 22px; }
.wiki-ul li, .wiki-ol li { margin-bottom: 4px; line-height: 1.7; }
.wiki-quote {
  border-left: 3px solid var(--link);
  margin: 10px 0; padding: 8px 14px;
  background: #f1f5f9; color: var(--text-muted);
  font-style: italic;
}
.wiki-hr {
  border: none; border-top: 1px solid var(--border-lt);
  margin: 20px 0;
}
.wiki-code-inline {
  font-family: var(--font-mono);
  font-size: 12px;
  background: #f1f5f9;
  border: 1px solid var(--border-lt);
  padding: 1px 5px;
  color: #b91c1c;
}
.wiki-img {
  max-width: 100%; height: auto;
  display: block; margin: 10px 0;
  border: 1px solid var(--border-lt);
}
.wiki-link {
  color: var(--link); text-decoration: none;
  border-bottom: 1px dotted var(--link);
}
.wiki-link:hover { text-decoration: underline; }

/* ─────────── TABLE TRONG BÀI VIẾT KIẾN THỨC ─────────── */
/*
 * Áp dụng cho mọi <table> bên trong .wiki-article-content
 * Bảng từ panel editor (HTML/Markdown) không có class → style toàn bộ tag
 */
.wiki-article-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 16px 0 20px;
  border: 1px solid var(--border-lt);
  overflow-x: auto;
  display: block;         /* cho phép scroll ngang trên mobile */
  max-width: 100%;
}

.wiki-article-content thead tr {
  background: #0f172a;
  color: #fff;
}

.wiki-article-content thead th {
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,.1);
}
.wiki-article-content thead th:last-child { border-right: none; }

.wiki-article-content tbody tr {
  border-bottom: 1px solid var(--border-lt);
  transition: background .1s;
}
.wiki-article-content tbody tr:nth-child(even) { background: #f8fafc; }
.wiki-article-content tbody tr:hover            { background: #eaf3fb; }

.wiki-article-content td {
  padding: 8px 12px;
  vertical-align: top;
  border-right: 1px solid var(--border-lt);
  line-height: 1.6;
}
.wiki-article-content td:last-child { border-right: none; }

/* Part code cell — monospace + link style */
.wiki-article-content td code,
.wiki-article-content td a code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: #f1f5f9;
  border: 1px solid var(--border-lt);
  padding: 1px 5px;
  color: #b91c1c;
  white-space: nowrap;
}

/* Link trong bảng */
.wiki-article-content td a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px dotted var(--link);
}
.wiki-article-content td a:hover { text-decoration: underline; border-bottom: none; }

/* Footnote số [n] trong bảng — Wikipedia style */
.wiki-article-content td sup a,
.wiki-article-content td sup {
  font-size: 10px;
  color: var(--link);
  vertical-align: super;
  line-height: 0;
}

/* Nhóm cell — tag badge nhỏ */
.wiki-article-content td:first-child {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

/* Caption / tên bảng (nếu có <caption>) */
.wiki-article-content caption {
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  padding: 0 0 8px;
  color: var(--text);
}

/* Scroll wrapper mobile */
@media (max-width: 640px) {
  .wiki-article-content table {
    font-size: 12px;
  }
  .wiki-article-content th,
  .wiki-article-content td {
    padding: 7px 8px;
  }
}

/* ─────────── WIKI NOTICE BOX (authenticity, tips...) ─────────── */
.wiki-notice-box {
  border: 1px solid #a2c4e0;
  background: #eaf3fb;
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}

.wiki-notice-box-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wiki-notice-box p { margin-bottom: 6px; }
.wiki-notice-box p:last-child { margin-bottom: 0; }
.wiki-notice-box code { font-size: 12px; }

/* ─────────── HIGHLIGHT ─────────── */
mark { background: #fef3c7; color: inherit; padding: 0 2px; }

/* ─────────── RESPONSIVE ─────────── */
@media (max-width: 768px) {
  #wiki-wrap {
    grid-template-columns: 1fr;
    padding: 10px 12px;
  }

  #wiki-sidebar {
    grid-column: 1;
    grid-row: 2;
  }

  #wiki-main {
    grid-column: 1;
    grid-row: 1;
  }

  .wiki-infobox {
    float: none;
    margin: 0 0 16px;
    width: 100%;
    max-width: 100%;
  }

  .header-inner {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }

  .header-nav-inner { padding: 0 12px; overflow-x: auto; }
  .brand-tagline { display: none; }
  /* header-inner wrap: row1 = [logo][actions], row2 = [search] */
  .header-inner { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .header-brand { flex-shrink: 0; order: 1; }
  .header-actions { order: 2; flex-shrink: 0; margin-left: auto; gap: 6px; }
  .header-search { order: 3; width: 100%; flex: none; max-width: 100%; }
  /* Mobile: ẩn text ext-btn, chỉ giữ icon cho gọn */
  .header-ext-btn span { display: none; }
  .header-ext-btn { padding: 5px 8px; }

  .hero-title { font-size: 20px; }
  .hero-stats { gap: 20px; }
  .stat-number { font-size: 20px; }

  .category-grid { columns: 2; }

  .hp-articles-grid { grid-template-columns: 1fr; }
  .hp-article-card { border-right: none; }
  .hp-article-img { width: 60px; height: 44px; }

  /* Footer mobile — stack vertically, left-align */
  #wiki-footer {
    margin-top: 0;
  }

  .footer-inner {
    flex-direction: column;
    gap: 12px;
    padding: 14px 12px;
  }

  .footer-right {
    align-items: flex-start;
    border-top: 1px solid var(--border-lt);
    padding-top: 10px;
    width: 100%;
  }

  /* Sidebar mobile — thêm border trên để tách khỏi main */
  #wiki-sidebar {
    border-top: 2px solid var(--border-lt);
    padding-top: 12px;
    margin-top: 4px;
  }
}

@media (max-width: 480px) {
  .category-grid { columns: 1; }
  .wiki-infobox { width: 100%; }
}
