/* =====================================================================
   WP Hub — Material Design 3
   Màu gốc: xanh biển đậm #00639B (tông màu "mực in" của trang quản trị)
   ===================================================================== */

:root {
  color-scheme: light;
  --primary: #00639b;
  --on-primary: #ffffff;
  --primary-container: #cee5ff;
  --on-primary-container: #001d33;
  --secondary: #51606f;
  --secondary-container: #d5e4f7;
  --on-secondary-container: #0e1d2a;
  --tertiary: #68587a;
  --tertiary-container: #efdbff;
  --on-tertiary-container: #231533;
  --error: #ba1a1a;
  --error-container: #ffdad6;
  --on-error-container: #410002;
  --surface: #f8f9ff;
  --surface-dim: #d8dae0;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f2f3fa;
  --surface-container: #eceef4;
  --surface-container-high: #e6e8ee;
  --surface-container-highest: #e1e2e8;
  --on-surface: #191c20;
  --on-surface-variant: #42474e;
  --outline: #72777f;
  --outline-variant: #c2c7cf;
  --inverse-surface: #2e3135;
  --inverse-on-surface: #eff0f7;
  --inverse-primary: #96ccff;
  --scrim: rgb(0 0 0 / 0.32);

  /* Màu điểm SEO (theo bảng màu Google) */
  --good: #146c2e;
  --good-container: #c4eed0;
  --ok: #8a5100;
  --ok-container: #ffdcbe;
  --bad: #b3261e;
  --bad-container: #ffdad6;

  --font: 'Roboto Flex', Roboto, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shape-xs: 4px;
  --shape-sm: 8px;
  --shape-md: 12px;
  --shape-lg: 16px;
  --shape-xl: 28px;
  --shape-full: 999px;
  --elev-1: 0 1px 2px rgb(0 0 0 / 0.3), 0 1px 3px 1px rgb(0 0 0 / 0.15);
  --elev-2: 0 1px 2px rgb(0 0 0 / 0.3), 0 2px 6px 2px rgb(0 0 0 / 0.15);
  --elev-3: 0 4px 8px 3px rgb(0 0 0 / 0.15), 0 1px 3px rgb(0 0 0 / 0.3);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-emph: cubic-bezier(0.05, 0.7, 0.1, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --primary: #96ccff;
    --on-primary: #003353;
    --primary-container: #004a77;
    --on-primary-container: #cee5ff;
    --secondary: #b9c8da;
    --secondary-container: #3a4857;
    --on-secondary-container: #d5e4f7;
    --tertiary: #d3bfe6;
    --tertiary-container: #4f4061;
    --on-tertiary-container: #efdbff;
    --error: #ffb4ab;
    --error-container: #93000a;
    --on-error-container: #ffdad6;
    --surface: #111418;
    --surface-dim: #111418;
    --surface-container-lowest: #0c0e12;
    --surface-container-low: #191c20;
    --surface-container: #1d2024;
    --surface-container-high: #282a2f;
    --surface-container-highest: #33353a;
    --on-surface: #e1e2e8;
    --on-surface-variant: #c2c7cf;
    --outline: #8c9199;
    --outline-variant: #42474e;
    --inverse-surface: #e1e2e8;
    --inverse-on-surface: #2e3135;
    --inverse-primary: #00639b;
    --good: #81c995;
    --good-container: #0f5223;
    --ok: #fdd663;
    --ok-container: #5c3c00;
    --bad: #f28b82;
    --bad-container: #8c1d18;
  }
}

/* ---------- Nền tảng ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--on-surface);
  font: 400 14px/20px var(--font);
  letter-spacing: 0.016em;
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  width: 1em;
  height: 1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}
.icon.fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.icon.sm { font-size: 18px; }
.icon.xl { font-size: 40px; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 40; }
svg.lucide, i.lu { width: 20px; height: 20px; flex: none; stroke-width: 2; }
svg.lucide.sm { width: 18px; height: 18px; }

/* Typescale M3 */
.display-s { font-size: 36px; line-height: 44px; font-weight: 400; letter-spacing: 0; }
.headline-s { font-size: 24px; line-height: 32px; font-weight: 400; letter-spacing: 0; }
.title-l { font-size: 22px; line-height: 28px; font-weight: 400; letter-spacing: 0; }
.title-m { font-size: 16px; line-height: 24px; font-weight: 500; letter-spacing: 0.009em; }
.title-s { font-size: 14px; line-height: 20px; font-weight: 500; letter-spacing: 0.007em; }
.body-l { font-size: 16px; line-height: 24px; letter-spacing: 0.031em; }
.body-s { font-size: 12px; line-height: 16px; letter-spacing: 0.033em; }
.label-l { font-size: 14px; line-height: 20px; font-weight: 500; letter-spacing: 0.007em; }
.label-m { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.042em; }
.muted { color: var(--on-surface-variant); }

/* ---------- Khung ứng dụng ---------- */
.shell { display: grid; grid-template-columns: 88px 1fr; min-height: 100%; }
.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 16px 0 calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
}
.brand {
  width: 56px; height: 56px; border-radius: var(--shape-lg);
  display: grid; place-items: center; margin-bottom: 28px;
  background: var(--primary-container); color: var(--on-primary-container);
}
.dest {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 80px; text-decoration: none; color: var(--on-surface-variant);
  border-radius: var(--shape-lg);
}
.dest-ind {
  width: 56px; height: 32px; border-radius: var(--shape-full);
  display: grid; place-items: center; position: relative; overflow: hidden;
  transition: background-color 200ms var(--ease);
}
.dest:hover .dest-ind { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.dest[aria-current='page'] { color: var(--on-surface); }
.dest[aria-current='page'] .dest-ind { background: var(--secondary-container); color: var(--on-secondary-container); }
.dest[aria-current='page'] .icon { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.dest-label { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.042em; }
.rail-spacer { flex: 1; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  min-height: 64px; padding: env(safe-area-inset-top, 0px) 16px 0 24px;
  background: var(--surface);
  transition: background-color 200ms var(--ease);
}
.topbar.scrolled { background: var(--surface-container); }
.topbar h1 { flex: 1; }
.view { padding: 8px 24px 48px; max-width: 1360px; width: 100%; }

@media (max-width: 839px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed; inset: auto 0 0 0; height: auto; z-index: 20;
    flex-direction: row; justify-content: space-around; gap: 0;
    padding: 12px 0 calc(16px + env(safe-area-inset-bottom, 0px));
    background: var(--surface-container);
  }
  .brand, .rail-spacer, .rail .logout { display: none; }
  .dest { width: auto; flex: 1; }
  .dest-ind { width: 64px; }
  .topbar { padding-left: 16px; }
  .view { padding: 4px 16px calc(120px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Nút ---------- */
.btn {
  --bg: transparent; --fg: var(--primary);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 24px; border: 0; border-radius: var(--shape-full);
  background: var(--bg); color: var(--fg);
  font-size: 14px; font-weight: 500; letter-spacing: 0.007em; white-space: nowrap;
  cursor: pointer; overflow: hidden; text-decoration: none;
  transition: box-shadow 200ms var(--ease);
}
.btn .icon { font-size: 18px; margin-left: -8px; }
.btn::after, .icon-btn::after, .chip::after, .seg button::after, .h-item::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: currentColor; opacity: 0; transition: opacity 150ms var(--ease); pointer-events: none;
}
.btn:hover::after, .icon-btn:hover::after, .chip:hover::after, .seg button:hover::after { opacity: 0.08; }
.btn:active::after, .icon-btn:active::after { opacity: 0.12; }
.btn.filled { --bg: var(--primary); --fg: var(--on-primary); }
.btn.filled:hover { box-shadow: var(--elev-1); }
.btn.tonal { --bg: var(--secondary-container); --fg: var(--on-secondary-container); }
.btn.outlined { border: 1px solid var(--outline); }
.btn.text { padding: 0 12px; }
.btn.text .icon { margin-left: -4px; }
.btn.danger { --fg: var(--error); }
.btn.filled.danger { --bg: var(--error); --fg: var(--surface); }
.btn.block { width: 100%; height: 48px; font-size: 15px; }
.btn:disabled { --bg: color-mix(in srgb, var(--on-surface) 12%, transparent); --fg: color-mix(in srgb, var(--on-surface) 38%, transparent); cursor: default; box-shadow: none; }
.btn.text:disabled { --bg: transparent; }
.btn:disabled::after { display: none; }

.icon-btn {
  position: relative; width: 40px; height: 40px; border: 0; border-radius: var(--shape-full);
  display: inline-grid; place-items: center; background: transparent; color: var(--on-surface-variant);
  cursor: pointer; flex: none; text-decoration: none;
}
.icon-btn.danger { color: var(--error); }

.fab {
  position: fixed; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 15;
  height: 56px; padding: 0 20px 0 16px; border: 0; border-radius: var(--shape-lg);
  display: none; align-items: center; gap: 12px;
  background: var(--primary-container); color: var(--on-primary-container);
  font-weight: 500; box-shadow: var(--elev-3); cursor: pointer;
}
@media (max-width: 839px) { .fab { display: inline-flex; } .hide-mobile { display: none !important; } }

/* ---------- Thẻ (card) ---------- */
.card {
  background: var(--surface-container-low);
  border-radius: var(--shape-md);
  padding: 20px;
}
.card.outlined { background: var(--surface); border: 1px solid var(--outline-variant); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head h2 { flex: 1; }
.card-head .count { color: var(--on-surface-variant); font-weight: 400; }

/* ---------- Chip ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--shape-sm);
  border: 1px solid var(--outline-variant); background: transparent; color: var(--on-surface-variant);
  font-size: 14px; font-weight: 500; letter-spacing: 0.007em; white-space: nowrap; cursor: default;
}
.chip .icon, .chip svg { font-size: 18px; width: 18px; height: 18px; }
button.chip { cursor: pointer; }
.chip[aria-pressed='true'] { background: var(--secondary-container); color: var(--on-secondary-container); border-color: transparent; }
.chip.sm { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.chip.sm .icon { font-size: 16px; }
.chip.good { background: var(--good-container); color: var(--good); border-color: transparent; }
.chip.warn { background: var(--ok-container); color: var(--ok); border-color: transparent; }
.chip.bad { background: var(--bad-container); color: var(--bad); border-color: transparent; }
.chip.info { background: var(--primary-container); color: var(--on-primary-container); border-color: transparent; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--primary)); flex: none; }

/* ---------- Ô nhập liệu (outlined text field) ---------- */
.fields { display: grid; gap: 20px; }
.fields.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 599px) { .fields.two { grid-template-columns: 1fr; } }
.tf { position: relative; }
.tf input, .tf textarea, .tf select {
  width: 100%; min-height: 56px; padding: 16px; border-radius: var(--shape-xs);
  border: 1px solid var(--outline); background: transparent; color: var(--on-surface);
  font-size: 16px; line-height: 24px; letter-spacing: 0.031em; outline: none;
  transition: border-color 150ms var(--ease);
}
.tf textarea { resize: vertical; min-height: 96px; display: block; }
.tf select { appearance: none; padding-right: 48px; cursor: pointer; }
.tf .tf-trail { position: absolute; right: 12px; top: 16px; pointer-events: none; color: var(--on-surface-variant); }
.tf input:hover, .tf textarea:hover, .tf select:hover { border-color: var(--on-surface); }
.tf input:focus, .tf textarea:focus, .tf select:focus { border: 2px solid var(--primary); padding: 15px; }
.tf select:focus { padding-right: 47px; }
.tf label {
  position: absolute; left: 12px; top: 16px; padding: 0 4px;
  color: var(--on-surface-variant); font-size: 16px; line-height: 24px;
  background: var(--tf-bg, var(--surface-container-low)); pointer-events: none;
  transform-origin: left top; transition: transform 150ms var(--ease), color 150ms var(--ease);
  max-width: calc(100% - 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tf input:focus + label, .tf textarea:focus + label, .tf select + label,
.tf input:not(:placeholder-shown) + label, .tf textarea:not(:placeholder-shown) + label {
  transform: translateY(-24px) scale(0.75);
}
.tf input:focus + label, .tf textarea:focus + label, .tf select:focus + label { color: var(--primary); }
.tf.prefix input { padding-left: var(--pl, 16px); }
.tf.prefix input:focus { padding-left: calc(var(--pl, 16px) - 1px); }
.tf .tf-prefix {
  position: absolute; left: 16px; top: 16px; line-height: 24px; font-size: 16px;
  color: var(--on-surface-variant); pointer-events: none; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tf-support { display: flex; justify-content: space-between; gap: 12px; padding: 4px 16px 0; font-size: 12px; line-height: 16px; color: var(--on-surface-variant); }
.tf-support .over { color: var(--error); font-weight: 500; }
.dialog .tf label, .card.outlined .tf label { --tf-bg: var(--surface-container-high); }
.card.outlined .tf label { --tf-bg: var(--surface); }

/* Nút chia đoạn (segmented button) */
.seg { display: flex; border: 1px solid var(--outline); border-radius: var(--shape-full); overflow: hidden; height: 40px; }
.seg button {
  position: relative; flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-left: 1px solid var(--outline); background: transparent; color: var(--on-surface);
  font-size: 14px; font-weight: 500; cursor: pointer; padding: 0 12px; white-space: nowrap;
}
.seg button:first-child { border-left: 0; }
.seg button .icon { font-size: 18px; width: 0; overflow: hidden; transition: width 150ms var(--ease); }
.seg button[aria-pressed='true'] { background: var(--secondary-container); color: var(--on-secondary-container); }
.seg button[aria-pressed='true'] .icon { width: 18px; }
.field-label { display: block; margin-bottom: 8px; }

/* Công tắc (switch) */
.switch { display: flex; align-items: center; gap: 16px; cursor: pointer; min-height: 40px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  position: relative; width: 52px; height: 32px; flex: none; border-radius: var(--shape-full);
  background: var(--surface-container-highest); border: 2px solid var(--outline);
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.switch .track::before {
  content: ''; position: absolute; top: 50%; left: 6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--outline); transform: translateY(-50%);
  transition: all 200ms var(--ease-emph);
}
.switch input:checked + .track { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .track::before { left: 22px; width: 24px; height: 24px; background: var(--on-primary); }
.switch input:focus-visible + .track { outline: 3px solid var(--primary); outline-offset: 2px; }
.switch .sw-text { flex: 1; }
.switch .sw-text small { display: block; color: var(--on-surface-variant); font-size: 12px; line-height: 16px; }

/* ---------- Banner cảnh báo ---------- */
.banner {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 16px; margin-bottom: 16px; border-radius: var(--shape-md);
  background: var(--ok-container); color: var(--on-surface);
}
.banner > .icon { color: var(--ok); }
.banner.info { background: var(--primary-container); color: var(--on-primary-container); }
.banner.info > .icon { color: inherit; }
.banner ul { margin: 4px 0 0; padding-left: 18px; }
.banner li + li { margin-top: 2px; }
.banner .banner-body { flex: 1; min-width: 0; }

/* ---------- Kéo thả file ---------- */
.drop {
  display: grid; justify-items: center; text-align: center; gap: 12px;
  padding: 64px 24px; margin-top: 8px; border-radius: var(--shape-xl);
  border: 2px dashed var(--outline-variant); background: var(--surface-container-low);
  transition: border-color 150ms var(--ease), background-color 150ms var(--ease);
}
.drop.over { border-color: var(--primary); background: var(--primary-container); }
.drop-art {
  width: 88px; height: 88px; border-radius: var(--shape-xl); display: grid; place-items: center;
  background: var(--primary-container); color: var(--on-primary-container); margin-bottom: 8px;
}
.drop p { max-width: 46ch; color: var(--on-surface-variant); }
.drop .btn { margin-top: 8px; }
.drop .chips { justify-content: center; margin-top: 16px; }
.drop.loading { opacity: 0.6; pointer-events: none; }


/* ---------- Trình soạn ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.editor-side { position: sticky; top: 72px; }
@media (max-width: 1099px) { .editor { grid-template-columns: 1fr; } .editor-side { position: static; order: -1; } }

.file-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; color: var(--on-surface-variant); font-size: 12px; max-width: 45%; overflow: hidden; }
.file-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

details.more { margin-top: 4px; }
details.more summary {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer; list-style: none;
  color: var(--primary); font-weight: 500; padding: 8px 0;
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary .icon { transition: transform 200ms var(--ease); }
details.more[open] summary .icon { transform: rotate(180deg); }
details.more .fields { margin-top: 16px; }

/* Ảnh */
.img-list { display: grid; gap: 16px; }
.img-row { display: grid; grid-template-columns: 88px 1fr; gap: 16px; align-items: start; }
.thumb {
  width: 88px; height: 88px; border-radius: var(--shape-sm); overflow: hidden;
  background: var(--surface-container-highest); color: var(--on-surface-variant);
  display: grid; place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-row.missing .thumb { background: var(--bad-container); color: var(--bad); }
.img-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; min-height: 24px; }
.img-name .nm { font-weight: 500; overflow-wrap: anywhere; }

/* Xem trước nội dung */
.prose { max-width: 72ch; font-size: 16px; line-height: 1.65; color: var(--on-surface); }
.prose h2 { font-size: 22px; line-height: 1.3; font-weight: 500; margin: 1.6em 0 0.5em; }
.prose h3 { font-size: 18px; line-height: 1.35; font-weight: 500; margin: 1.4em 0 0.4em; }
.prose h4, .prose h5, .prose h6 { font-size: 16px; font-weight: 600; margin: 1.2em 0 0.4em; }
.prose p, .prose ul, .prose ol, .prose figure, .prose blockquote, .prose pre { margin: 0 0 1em; }
.prose figure { margin-inline: 0; }
.prose img { border-radius: var(--shape-sm); max-height: 360px; object-fit: cover; }
.prose figcaption { font-size: 13px; color: var(--on-surface-variant); margin-top: 6px; }
.prose blockquote { border-left: 4px solid var(--primary); padding: 4px 0 4px 16px; color: var(--on-surface-variant); }
.prose pre { background: var(--surface-container-highest); padding: 12px 16px; border-radius: var(--shape-sm); overflow-x: auto; font-size: 13px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; }
.prose .wp-block-table { overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--outline-variant); padding: 8px 12px; text-align: left; }
.prose th { background: var(--surface-container-high); font-weight: 500; }
.prose hr { border: 0; border-top: 1px solid var(--outline-variant); margin: 2em 0; }
.prose > :first-child { margin-top: 0; }

/* ---------- Tab website ---------- */
.tabs {
  position: sticky; top: 64px; z-index: 4;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin;
  margin: 0 -24px 20px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--outline-variant);
}
.topbar.scrolled + .view .tabs, .tabs { box-shadow: none; }
.tab {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 16px; border: 0; background: transparent; cursor: pointer;
  color: var(--on-surface-variant); font-size: 14px; font-weight: 500; letter-spacing: 0.007em; white-space: nowrap; text-decoration: none;
}
.tab::before { content: ''; position: absolute; inset: 4px 0; border-radius: var(--shape-sm); background: currentColor; opacity: 0; transition: opacity 150ms var(--ease); }
.tab:hover::before { opacity: 0.08; }
.tab::after {
  content: ''; position: absolute; left: 8px; right: 8px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0;
  background: var(--c, var(--primary)); transform: scaleX(0); transition: transform 250ms var(--ease-emph);
}
.tab[aria-selected='true'] { color: var(--on-surface); }
.tab[aria-selected='true']::after { transform: scaleX(1); }
.tab .dot { background: var(--c); }
.tab-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--shape-full); display: inline-grid; place-items: center; background: var(--c, var(--primary)); color: #fff; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tab-add { padding: 0 12px; }
@media (max-width: 839px) { .tabs { margin: 0 -16px 16px; padding: 0 16px; } }

.site-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--shape-full); background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--on-surface); font-size: 12px; font-weight: 500; flex: none; }
.site-chip .dot { background: var(--c); width: 8px; height: 8px; }
.drop { border-color: color-mix(in srgb, var(--site, var(--primary)) 45%, var(--outline-variant)); }
.drop .drop-art { background: color-mix(in srgb, var(--site, var(--primary)) 16%, var(--surface)); color: var(--site, var(--primary)); }
.drop.over { border-color: var(--site, var(--primary)); background: color-mix(in srgb, var(--site, var(--primary)) 8%, var(--surface)); }
.drop-site { font-size: 16px; font-weight: 500; color: var(--site, var(--primary)); margin-top: -4px; }
.banner.danger { background: var(--error-container); color: var(--on-error-container); }
.banner.danger > .icon { color: var(--error); }
.banner p { margin-top: 4px; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.banner.danger .btn.filled { --bg: var(--error); --fg: var(--surface); }
.banner.danger .btn.text { --fg: var(--on-error-container); }

/* ---------- Hàng đợi ---------- */
.queue { margin-bottom: 16px; }
.queue-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.queue-head h2 { flex: 1; }
.queue-head .count { font-weight: 400; margin-left: 4px; }
.queue-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.q-item {
  position: relative; flex: 0 0 248px; scroll-snap-align: start;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: var(--shape-md); border: 1px solid var(--outline-variant);
  background: var(--surface); color: var(--on-surface); text-align: left; cursor: pointer;
}
.q-item::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; transition: opacity 150ms var(--ease); pointer-events: none; }
.q-item:hover::after { opacity: 0.06; }
.q-item[aria-selected='true'] { background: var(--secondary-container); color: var(--on-secondary-container); border-color: transparent; }
.q-text { min-width: 0; display: grid; }
.q-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-sub { font-size: 12px; line-height: 16px; color: var(--on-surface-variant); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-item[aria-selected='true'] .q-sub { color: inherit; opacity: 0.8; }
.q-warn { color: var(--error); }

.batch { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.b-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto 40px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--outline-variant); }
.b-row:last-child { border-bottom: 0; }
.b-row.done > .icon { color: var(--good); }
.b-row.error > .icon { color: var(--bad); }
.b-text { min-width: 0; display: grid; }
.b-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; color: var(--on-surface-variant); min-width: 0; }
.b-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-detail::before { content: ''; display: inline-block; width: 1px; height: 10px; background: var(--outline-variant); margin: 0 6px 0 2px; vertical-align: -1px; }
.b-row.error .b-detail { color: var(--error); white-space: normal; }

/* ---------- Điểm SEO ---------- */
.score-card { background: var(--surface-container); padding: 24px; }
.score-head { display: flex; align-items: center; gap: 20px; }
.score-head .sh-text { min-width: 0; }
.score-rating { font-size: 22px; line-height: 28px; margin: 2px 0 4px; }
.gauge { --size: 120px; position: relative; width: var(--size); height: var(--size); flex: none; color: var(--c); }
.gauge.good { --c: var(--good); --cc: var(--good-container); }
.gauge.ok { --c: var(--ok); --cc: var(--ok-container); }
.gauge.bad { --c: var(--bad); --cc: var(--bad-container); }
.gauge svg { width: 100%; height: 100%; display: block; }
.gauge .g-track { fill: none; stroke: var(--cc); stroke-width: 10; }
.gauge .g-bar { fill: none; stroke: currentColor; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 900ms var(--ease-emph), stroke 300ms; }
.gauge .g-num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: var(--on-surface); }
.gauge .g-num span { font-size: calc(var(--size) * 0.3); line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.gauge .g-num small { font-size: 12px; color: var(--on-surface-variant); margin-top: 2px; }
.gauge.sm .g-track, .gauge.sm .g-bar { stroke-width: 12; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 0 8px; }
.stat { padding: 12px; border-radius: var(--shape-sm); background: var(--surface-container-high); }
.stat b { display: block; font-size: 16px; line-height: 24px; font-weight: 500; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; line-height: 16px; color: var(--on-surface-variant); }

.checks details { border-top: 1px solid var(--outline-variant); }
.checks summary {
  display: flex; align-items: center; gap: 8px; padding: 14px 0; cursor: pointer; list-style: none; font-weight: 500;
}
.checks summary::-webkit-details-marker { display: none; }
.checks summary .grp-pts { margin-left: auto; color: var(--on-surface-variant); font-weight: 400; font-variant-numeric: tabular-nums; }
.checks summary .chev { transition: transform 200ms var(--ease); color: var(--on-surface-variant); }
.checks details[open] .chev { transform: rotate(180deg); }
.checks ul { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.check { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: start; }
.check .icon { font-size: 20px; font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20; }
.check.pass .icon { color: var(--good); }
.check.warn .icon { color: var(--ok); }
.check.fail .icon { color: var(--bad); }
.check.skip .icon { color: var(--outline); }
.check .c-label { line-height: 20px; }
.check .c-detail { display: block; font-size: 12px; line-height: 16px; color: var(--on-surface-variant); }
.check .c-pts { font-size: 12px; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; line-height: 20px; }
.score-actions { margin-top: 20px; display: grid; gap: 8px; }
.score-actions .hint { font-size: 12px; line-height: 16px; color: var(--on-surface-variant); text-align: center; }
.score-note { font-size: 12px; line-height: 16px; color: var(--on-surface-variant); margin-top: 12px; }

.publish-bar { display: none; }
@media (max-width: 1099px) {
  .publish-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 12;
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--surface-container-high); box-shadow: var(--elev-2);
  }
  .publish-bar .btn { flex: 1; }
  .publish-bar .pb-score { font-weight: 500; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
  .editor-side .score-actions .btn { display: none; }
}
@media (max-width: 839px) { .publish-bar { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); padding-bottom: 12px; } }

/* ---------- Trước / Sau ---------- */
.compare { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 8px 0 4px; }
.compare figure { margin: 0; display: grid; justify-items: center; gap: 8px; }
.compare figcaption { font-size: 12px; font-weight: 500; letter-spacing: 0.042em; color: var(--on-surface-variant); }
.compare .arrow { color: var(--on-surface-variant); }
.delta { display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 0 10px; border-radius: var(--shape-full); font-weight: 500; font-variant-numeric: tabular-nums; }
.delta.up { background: var(--good-container); color: var(--good); }
.delta.down { background: var(--bad-container); color: var(--bad); }
.delta.same { background: var(--surface-container-highest); color: var(--on-surface-variant); }
.changes { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.changes li { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.changes .pts { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--on-surface-variant); white-space: nowrap; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 699px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Tiến trình ---------- */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.steps li { display: grid; grid-template-columns: 24px 1fr; gap: 12px; padding: 8px 0; align-items: start; }
.steps .s-label { font-weight: 500; }
.steps .s-detail { display: block; font-size: 12px; line-height: 16px; color: var(--on-surface-variant); overflow-wrap: anywhere; }
.steps .done .icon { color: var(--good); }
.steps .error .icon { color: var(--bad); }
.spinner {
  width: 20px; height: 20px; margin: 2px; border-radius: 50%;
  border: 3px solid var(--primary-container); border-top-color: var(--primary);
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.linear { height: 4px; border-radius: 2px; background: var(--primary-container); overflow: hidden; margin: 4px 0 16px; }
.linear span { display: block; height: 100%; background: var(--primary); border-radius: 2px; transition: width 300ms var(--ease); }

/* ---------- Website ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
@media (max-width: 599px) { .site-grid { grid-template-columns: 1fr; } }
.card.site-card { display: flex; flex-direction: column; gap: 12px; border-left: 4px solid var(--c); }
.site-card .sc-head { display: flex; align-items: flex-start; gap: 8px; }
.site-card .sc-head > div { flex: 1; min-width: 0; }
.site-card .sc-url { color: var(--on-surface-variant); text-decoration: none; overflow-wrap: anywhere; }
.site-card .sc-url:hover { text-decoration: underline; }
.site-card .sc-foot { display: flex; align-items: center; gap: 4px; margin-top: auto; border-top: 1px solid var(--outline-variant); padding-top: 8px; }
.site-card .sc-foot .muted { flex: 1; font-size: 12px; }
.empty { text-align: center; padding: 48px 16px; display: grid; justify-items: center; gap: 12px; }
.empty .drop-art { margin-bottom: 4px; }
.empty p { max-width: 52ch; color: var(--on-surface-variant); }
.howto { text-align: left; max-width: 560px; margin: 16px auto 0; padding-left: 20px; display: grid; gap: 8px; color: var(--on-surface-variant); }
.howto b { color: var(--on-surface); font-weight: 500; }

/* ---------- Lịch sử ---------- */
.h-list { display: grid; gap: 8px; }
.h-item {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 16px; align-items: center;
  padding: 12px 8px 12px 16px; border-radius: var(--shape-md); background: var(--surface-container-low); cursor: pointer;
}
.h-item:hover::after { opacity: 0.04; }
.h-title { font-weight: 500; font-size: 16px; line-height: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 12px; line-height: 16px; color: var(--on-surface-variant); margin-top: 2px; }
.h-scores { display: flex; align-items: center; gap: 6px; }
.pill { min-width: 40px; height: 28px; padding: 0 8px; border-radius: var(--shape-full); display: inline-grid; place-items: center; font-weight: 500; font-variant-numeric: tabular-nums; }
.pill.good { background: var(--good-container); color: var(--good); }
.pill.ok { background: var(--ok-container); color: var(--ok); }
.pill.bad { background: var(--bad-container); color: var(--bad); }
.pill.real { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.h-actions { display: flex; }
@media (max-width: 699px) {
  .h-item { grid-template-columns: auto minmax(0, 1fr) auto; }
  .h-actions { grid-column: 2 / -1; justify-content: flex-end; margin: -8px -4px -8px 0; }
  .h-title { white-space: normal; }
}

/* ---------- Hộp thoại ---------- */
.dialog {
  border: 0; padding: 0; border-radius: var(--shape-xl);
  background: var(--surface-container-high); color: var(--on-surface);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  box-shadow: var(--elev-3);
}
.dialog.wide { width: min(880px, calc(100vw - 32px)); }
.dialog::backdrop { background: var(--scrim); }
.dialog[open] { animation: dlg-in 250ms var(--ease-emph); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }
.dlg { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); }
.dlg-head { padding: 24px 24px 16px; display: flex; gap: 16px; align-items: flex-start; }
.dlg-head .icon { color: var(--secondary); }
.dlg-head > div { flex: 1; min-width: 0; }
.dlg-head p { color: var(--on-surface-variant); margin-top: 4px; overflow-wrap: anywhere; }
.dlg-body { padding: 0 24px; overflow-y: auto; }
.dlg-actions { padding: 24px; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.dlg .error-box { background: var(--error-container); color: var(--on-error-container); padding: 12px 16px; border-radius: var(--shape-sm); margin-top: 16px; }
@media (max-width: 599px) {
  .dialog, .dialog.wide { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  .dlg { max-height: 100dvh; height: 100%; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .dlg-body { flex: 1; }
}

/* ---------- Snackbar ---------- */
.snackbar {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  min-height: 48px; max-width: min(560px, calc(100vw - 32px)); padding: 14px 16px; border-radius: var(--shape-xs);
  background: var(--inverse-surface); color: var(--inverse-on-surface); box-shadow: var(--elev-3);
  display: flex; align-items: center; gap: 12px;
  transition: opacity 150ms var(--ease), transform 250ms var(--ease-emph);
}
.snackbar.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.snackbar button { border: 0; background: none; color: var(--inverse-primary); font-weight: 500; cursor: pointer; padding: 4px 8px; }
@media (max-width: 839px) { .snackbar { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); } }

/* ---------- Đăng nhập ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login .card { width: min(400px, 100%); background: var(--surface-container); padding: 32px 24px 24px; }
.login .brand { margin: 0 0 24px; }
.login h1 { margin-bottom: 4px; }
.login p { color: var(--on-surface-variant); margin-bottom: 24px; }
.login .tf label { --tf-bg: var(--surface-container); }
.login .btn { margin-top: 24px; width: 100%; }
.login .err { color: var(--error); font-size: 12px; margin-top: 8px; min-height: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
@media (max-width: 599px) { .card-head .file-chip { display: none; } }
