/* BHX đăng bài: one system. Tokens, one radius scale, one button pair, one card. */
:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --ink: #16201a;
  --muted: #55625a;
  --line: #d9e0d9;
  --accent: #0b7a3b;
  --accent-ink: #ffffff;
  --accent-soft: #e3f3e9;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a4b00;
  --warn-soft: #fff3df;
  --ok: #067647;
  --ok-soft: #e1f5e9;
  --r-s: 8px;
  --r-m: 12px;
  --gap: 16px;
  --shadow: 0 1px 2px rgba(22, 32, 26, .06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101612; --surface: #18201b; --ink: #eef3ee; --muted: #a6b3aa; --line: #2c3830;
    --accent: #3fbf74; --accent-ink: #07210f; --accent-soft: #163322;
    --danger: #ff8a7a; --danger-soft: #3a1d19; --warn: #ffbe6b; --warn-soft: #3a2a10;
    --ok: #5fd394; --ok-soft: #123222; --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.wrap { width: min(1040px, 100% - 32px); margin-inline: auto; }   /* equal left and right edges */
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2rem); line-height: 1.2; margin: 24px 0 8px; }
h2 { font-size: 1.125rem; line-height: 1.3; margin: 0; }
p { margin: 0; }
.lead { color: var(--muted); max-width: 62ch; margin-bottom: 20px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0 !important; padding: 0 !important; }
[hidden] { display: none !important; }

/* focus: always visible */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: var(--r-s); }
.skip { position: absolute; left: 16px; top: -60px; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: var(--r-s); z-index: 10; }
.skip:focus { top: 12px; }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { font-weight: 700; letter-spacing: -.01em; }
nav { display: flex; gap: 4px; }
.tab {
  min-height: 44px; padding: 0 16px; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; border-radius: var(--r-s); cursor: pointer; position: relative;
  transition: color .15s, background-color .15s;
}
.tab:hover { color: var(--ink); background: var(--accent-soft); }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"]::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 4px; height: 2px; background: var(--accent); border-radius: 2px; }

.banner { background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--line); padding: 10px 16px; text-align: center; font-weight: 600; }
.banner.bad { background: var(--danger-soft); color: var(--danger); }

main { padding-bottom: 64px; }

/* card: one style */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 20px; box-shadow: var(--shadow); }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
.editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); margin-top: var(--gap); }
.row-form { display: flex; gap: 12px; align-items: end; }
.grow { flex: 1; min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }

/* fields: visible labels */
.field { display: grid; gap: 6px; }
label, legend { font-weight: 600; font-size: .9375rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
input[type="text"], input[type="url"], input[type="datetime-local"], textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r-s);
}
textarea { resize: vertical; line-height: 1.45; }
input::placeholder { color: var(--muted); opacity: .8; }
input:hover, textarea:hover { border-color: var(--muted); }
.hint { color: var(--muted); font-size: .875rem; }
.hint.bad { color: var(--danger); font-weight: 600; }

.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--bg); cursor: pointer; font-weight: 500; }
.check:hover { border-color: var(--accent); }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--accent); }
details[open] > summary { margin-bottom: 8px; }
.groups .two { margin-bottom: 12px; }
.manage { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.manage li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0 4px 12px; border: 1px solid var(--line); border-radius: var(--r-s); }
.manage .id { color: var(--muted); font-size: .8125rem; overflow-wrap: anywhere; }

/* buttons: one pair (primary + secondary), step on hover, press on click */
.btn {
  min-height: 44px; padding: 0 18px; font: inherit; font-weight: 600; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-s); cursor: pointer;
  transition: transform .12s, background-color .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.big { min-width: 180px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; filter: none; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn.sm { min-height: 44px; padding: 0 14px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* product block */
.product { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.product > * { min-width: 0; }
.facts { display: grid; gap: 8px; align-content: start; }
.facts p, .facts h2 { overflow-wrap: anywhere; }
.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.price strong { font-size: 1.5rem; color: var(--danger); }
.price s { color: var(--muted); }
.chip { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px; font-size: .8125rem; font-weight: 700; background: var(--bg); color: var(--muted); }
.chip.sale { background: var(--danger-soft); color: var(--danger); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.chip.wait { background: var(--warn-soft); color: var(--warn); }

/* messages, loading */
.msg { margin-top: 10px; padding: 10px 14px; border-radius: var(--r-s); font-weight: 600; background: var(--danger-soft); color: var(--danger); }
.msg.good { background: var(--ok-soft); color: var(--ok); }
.loading { display: flex; align-items: center; gap: 12px; margin-top: var(--gap); padding: 16px 20px; background: var(--accent-soft); border-radius: var(--r-m); font-weight: 600; }
.spinner { width: 20px; height: 20px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* results and history */
.list { display: grid; gap: 12px; }
.res { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.res-line { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); }
.res-line:first-child { border-top: 0; }
.res-line .what { font-weight: 600; min-width: 120px; }
.res-line .why { color: var(--muted); overflow-wrap: anywhere; }

/* product gallery */
.gallery { display: grid; gap: 10px; min-width: 0; }
.gallery > img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--bg); }
.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.thumbwrap { position: relative; }
.pick { position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; display: grid; place-items: center; background: var(--surface); border-radius: 6px; border: 1px solid var(--line); cursor: pointer; }
.pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.thumbwrap.off .thumb { opacity: .4; }
.thumb { padding: 0; width: 100%; border: 2px solid var(--line); border-radius: var(--r-s); background: var(--bg); cursor: pointer; overflow: hidden; aspect-ratio: 1 / 1; transition: border-color .15s, transform .12s; }
.thumb:hover { border-color: var(--accent); transform: translateY(-1px); }
.thumb[aria-current] { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* one tab per platform */
.ptabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.ptab { min-height: 48px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; margin-bottom: -1px; transition: color .15s, background-color .15s; border-radius: var(--r-s) var(--r-s) 0 0; }
.ptab:hover { color: var(--ink); background: var(--accent-soft); }
.ptab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.dot { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.dot.on { background: var(--ok-soft); color: var(--ok); }
.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); padding-top: 4px; }

/* how the post will look */
.mock { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--bg); padding: 14px; display: grid; gap: 10px; max-width: 520px; }
.mock-head { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); border: 1px solid var(--line); flex: none; }
.mock-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.mock-comment { font-size: .875rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; overflow-wrap: anywhere; }
.shots-grid { display: grid; gap: 4px; border-radius: var(--r-s); overflow: hidden; }
.shots-grid.n1 { grid-template-columns: 1fr; }
.shots-grid.n2, .shots-grid.n3, .shots-grid.n4 { grid-template-columns: 1fr 1fr; }
.shots-grid img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1 / 1; display: block; background: var(--surface); }
.shots-grid.n1 img { aspect-ratio: 4 / 3; }
.shots-grid.n3 img:first-child { grid-row: span 2; aspect-ratio: auto; }
.zl-mock { background: var(--accent-soft); }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* history: one card per link */
.link-card { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow); display: grid; gap: 8px; transition: border-color .15s; }
.link-card:hover { border-color: var(--accent); }
.link-top { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 16px; align-items: start; }
.link-top img { width: 88px; height: 88px; object-fit: cover; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--bg); }
.link-info h3 { font-size: 1rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.runs { display: grid; gap: 10px; }
.run { border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 12px; }
.run-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 4px; }

@media (max-width: 720px) {
  .row-form { flex-direction: column; align-items: stretch; }
  .two { grid-template-columns: 1fr; }
  .product { grid-template-columns: minmax(0, 1fr); }
  .link-top { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; }
  .link-top img { width: 64px; height: 64px; }
  .ptabs { gap: 0; }
  .ptab { flex: 1 1 0; min-width: 0; padding: 0 4px; gap: 4px; justify-content: center; font-size: .9375rem; }
  .dot { padding: 2px 6px; }
  .actions .btn { flex: 1 1 100%; }              /* full-width buttons on a phone */
  .card { padding: 16px; }
  .res-line { flex-direction: column; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .btn:hover, .thumb:hover { transform: none; }
}
