/* =========================================================
   TRANG QUẢN TRỊ — admin.html
   ========================================================= */

body.admin { background: var(--bg); }
body.admin .toasts { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }

/* ---------- Đăng nhập ---------- */
.login { position: relative; isolation: isolate; overflow: hidden; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-bg { position: absolute; inset: 0; z-index: -1; }
.login .b1 { width: 420px; height: 420px; background: var(--accent); top: -120px; left: -100px; }
.login .b2 { width: 360px; height: 360px; background: color-mix(in srgb, var(--price) 70%, var(--accent)); bottom: -120px; right: -80px; animation-delay: -8s; }
.login-card {
  width: min(400px, 100%);
  display: flex; flex-direction: column; gap: 18px;
  padding: 32px 28px 24px;
  box-shadow: var(--shadow-lg);
  animation: rise .6s var(--ease);
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
.login-card p { margin: 0; }
.logo-mark.lg { width: 52px; height: 52px; border-radius: var(--r-lg); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: var(--r-sm); }
.pw-eye:hover { color: var(--ink); background: var(--surface-2); }
.back-link { display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--accent); }

/* ---------- Khung ---------- */
:root { --sbw: 252px; }
:root.sb-collapsed { --sbw: 76px; }
.app { display: grid; grid-template-columns: var(--sbw) minmax(0, 1fr); min-height: 100dvh; transition: grid-template-columns .4s var(--ease); }
.sidebar {
  position: sticky; top: 0; height: 100dvh; z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 12px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-right: 1px solid var(--line);
  overflow: hidden;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; margin-bottom: 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sb-name { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; transition: opacity .25s; }
.sb-name b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.sb-name small { font-size: 12px; color: var(--muted); }
.sb-nav { position: relative; display: flex; flex-direction: column; gap: 2px; }
.sb-ind { position: absolute; left: 0; right: 0; top: 0; height: 42px; border-radius: var(--r); background: var(--accent-soft); transition: transform .4s var(--ease), height .3s; pointer-events: none; }
.sb-link {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 12px;
  width: 100%; height: 42px; padding: 0 12px;
  border: 0; border-radius: var(--r); background: none; cursor: pointer;
  color: var(--ink-2); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: color .2s, background-color .2s;
}
.sb-link:hover { color: var(--ink); background: color-mix(in srgb, var(--surface-3) 60%, transparent); }
.sb-link.active { color: var(--accent); background: none; }
.sb-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sb-link > span, .sb-link .count { transition: opacity .25s; }
.sb-link .count { margin-left: auto; font-style: normal; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--muted); font-variant-numeric: tabular-nums; }
.sb-link.active .count { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent); }
.sb-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.sb-collapsed .sb-name, .sb-collapsed .sb-link > span, .sb-collapsed .sb-link .count { opacity: 0; pointer-events: none; }
.sb-collapsed .sb-brand { padding-left: 10px; }
.sb-scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  height: 64px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.tb-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.tb-crumb { font-size: 12px; color: var(--muted); font-weight: 500; }
.tb-title h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; }
.btn-icon.btn-ghost { border-color: transparent; }
.btn-icon.btn-ghost:hover { border-color: var(--line); }

.view { padding: 24px; display: flex; flex-direction: column; gap: 20px; max-width: 1280px; width: 100%; }
.view-in > * { animation: rise .45s var(--ease) both; }
.view-in > *:nth-child(2) { animation-delay: .05s; }
.view-in > *:nth-child(3) { animation-delay: .1s; }
.view-in > *:nth-child(4) { animation-delay: .15s; }

@media (max-width: 860px) {
  .app, .sb-collapsed .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; height: auto; z-index: 120; transform: translateX(-102%); transition: transform .4s var(--ease); box-shadow: var(--shadow-lg); border-radius: 0 var(--r-lg) var(--r-lg) 0; }
  .sb-collapsed .sb-name, .sb-collapsed .sb-link > span, .sb-collapsed .sb-link .count { opacity: 1; pointer-events: auto; }
  .app.sb-open .sidebar { transform: none; }
  .sb-scrim { display: block; position: fixed; inset: 0; z-index: 110; background: rgba(8,12,24,.45); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .app.sb-open .sb-scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-flex; }
  .collapse-btn { display: none; }
  .topbar { padding: 0 16px; }
  .view { padding: 16px; gap: 16px; }
  .hide-sm { display: none; }
}

/* ---------- Khối nội dung ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.panel-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-h h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.panel-h p { margin: 2px 0 0; }
.panel-h .inline { display: inline; vertical-align: -2px; }
.ph-ic { width: 32px; height: 32px; flex: none; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.panel-b { padding: 20px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.sel-auto { width: auto; min-width: 170px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } .panel-h, .panel-b { padding-inline: 16px; } }

/* ---------- Tổng quan ---------- */
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hello h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.02em; }
.hello p { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 18px; color: var(--ink); text-decoration: none; transition: transform .35s var(--ease), box-shadow .35s, border-color .35s; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent-line); }
.kpi-ic { width: 38px; height: 38px; border-radius: var(--r); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 8px; transition: transform .5s var(--spring); }
.kpi:hover .kpi-ic { transform: rotate(-8deg) scale(1.08); }
.kpi-l { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi b { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi b small { font-size: 16px; color: var(--muted); font-weight: 600; }
.kpi-s { font-size: 12.5px; color: var(--muted); }
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 22px minmax(90px, 150px) minmax(0, 1fr) 32px; gap: 10px; align-items: center; font-size: 14px; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; }
.bar-track { height: 10px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0; border-radius: var(--r-pill); background: var(--c, var(--accent)); transition: width 1.1s var(--ease); }
.toplist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.toplist li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); transition: background-color .2s; }
.toplist li:hover { background: var(--surface-2); }
.rank { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--surface-3); color: var(--muted); }
.toplist li:first-child .rank { background: var(--accent); color: var(--on-accent); }
.tl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.tl-main b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-main small { font-size: 12px; color: var(--muted); }
.tl-n { font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.warns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.warns li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); }
.w-ic { width: 32px; height: 32px; flex: none; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.w-warn .w-ic { background: color-mix(in srgb, var(--warn) 15%, var(--surface)); color: var(--warn); }
.w-t { flex: 1; min-width: 0; font-size: 14px; }
@media (max-width: 560px) { .warns li { flex-wrap: wrap; } .warns .btn { margin-left: 44px; } }

/* ---------- Bảng ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; white-space: nowrap;
  padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color .2s, opacity .2s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr.sel, .tbl tr.sel:hover { background: var(--accent-soft); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th.num { text-align: right; }
.tbl th.num .th-sort { margin-left: auto; }
.tbl .w-check { width: 44px; padding-right: 0; }
.tbl .w-drag { width: 70px; padding-right: 0; }
.is-hidden > td:not(:last-child):not(.w-check), .clist .is-hidden .cl-main { opacity: .5; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main > div { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.cell-main b { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cell-main small { font-size: 12.5px; color: var(--muted); }
.cell-main.sm { gap: 8px; font-size: 13.5px; }
.tbl-prods .cell-main { min-width: 250px; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.row-actions .btn-icon { border-color: transparent; }
.lnk { color: var(--accent); font-weight: 600; text-decoration: none; }
.lnk:hover { text-decoration: underline; }
.th-sort { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }
.th-sort:hover, .th-sort.on { color: var(--ink); }
.th-sort .ic { opacity: .6; }
.th-sort.on .ic { opacity: 1; color: var(--accent); }
.qprice { display: inline-flex; align-items: center; gap: 6px; border: 1px dashed transparent; background: none; cursor: pointer; padding: 4px 8px; margin: -4px -8px; border-radius: var(--r-sm); font: inherit; font-weight: 700; color: var(--price); font-variant-numeric: tabular-nums; transition: border-color .2s, background-color .2s; }
.qprice .ic { opacity: 0; color: var(--muted); transition: opacity .2s; }
.qprice:hover { border-color: var(--line-2); background: var(--surface); }
.qprice:hover .ic { opacity: 1; }
.q-wrap { width: 140px; margin-left: auto; }
.q-in { padding: 6px 30px 6px 10px; text-align: right; font-weight: 700; }

.drag { display: flex; align-items: center; gap: 4px; }
.grip { display: grid; place-items: center; width: 22px; height: 30px; color: var(--muted); cursor: grab; border-radius: 6px; }
.grip:hover { background: var(--surface-3); color: var(--ink); }
.grip:active { cursor: grabbing; }
.ud { display: flex; flex-direction: column; }
.ud button { width: 22px; height: 16px; display: grid; place-items: center; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 4px; }
.ud button:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
.ud button:disabled { opacity: .25; cursor: default; }
.ud.v { flex-direction: column; gap: 2px; }
tr.dragging, li.dragging { opacity: .4; }
tr.drop-before td { box-shadow: inset 0 2px 0 var(--accent); }
tr.drop-after td { box-shadow: inset 0 -2px 0 var(--accent); }
.flash { animation: flash 1.4s var(--ease); }
@keyframes flash { 0%, 30% { background: color-mix(in srgb, var(--accent) 18%, transparent); } }

.filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.filters .select { width: auto; min-width: 160px; flex: 0 1 200px; }
.search-in { position: relative; flex: 1 1 240px; display: block; }
.search-in .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-in .input { padding-left: 36px; }
@media (max-width: 560px) { .filters { padding-inline: 16px; } .filters .select { flex: 1 1 140px; min-width: 0; } }

/* ---------- Danh sách nội dung ---------- */
.clist { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.clist li { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: var(--r); transition: background-color .2s; }
.clist li:hover { background: var(--surface-2); }
.cl-main { flex: 1; min-width: 0; }
.cl-main b { display: block; }
.cl-main p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; max-width: 80ch; }
.cl-rv { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cl-rv .rv-av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; }
.cl-act { display: flex; align-items: center; gap: 4px; }
.cl-act .switch { margin-right: 6px; }
.stars { display: inline-flex; gap: 1px; color: var(--line-2); }
.stars .on { color: var(--star); }
.stars .on svg { fill: currentColor; }
.seg em { font-style: normal; font-size: 11px; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--muted); margin-left: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; }
.star-pick { display: flex; gap: 4px; }
.star-pick button { border: 0; background: none; padding: 2px; cursor: pointer; color: var(--line-2); transition: transform .25s var(--spring), color .15s; border-radius: 6px; }
.star-pick button.on { color: var(--star); }
.star-pick button.on svg { fill: currentColor; }
.star-pick button:hover { transform: scale(1.15); }
.star-pick button:focus-visible { outline: 2px solid var(--accent); }
@media (max-width: 560px) { .clist li { flex-wrap: wrap; } .cl-act { width: 100%; justify-content: flex-end; } }

/* ---------- Biểu mẫu ---------- */
.preview-av { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r); background: var(--surface-2); border: 1px dashed var(--line-2); }
.preview-av > div { display: flex; flex-direction: column; min-width: 0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { position: relative; width: 34px; height: 34px; border-radius: var(--r-sm); border: 0; background: var(--c); color: #fff; cursor: pointer; display: grid; place-items: center; transition: transform .25s var(--spring), box-shadow .2s; }
.sw .ic { opacity: 0; transform: scale(.5); transition: .25s var(--spring); }
.sw.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.sw.on .ic { opacity: 1; transform: none; }
.sw:hover { transform: scale(1.1); }
.sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sw.custom { background: conic-gradient(from 90deg, #e0474c, #d4940b, #5b8c1f, #1b93c9, #7c4ddb, #e0474c); }
.sw.custom.on { background: var(--c); }
.sw.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.sw.custom .ic { opacity: 1; transform: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.pv { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--r); background: var(--surface-2); border: 1px dashed var(--line-2); }
.pv-l { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pv-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid var(--accent); }
.pv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pv-main b { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pv-main small { font-size: 12.5px; color: var(--muted); }
.pv-pr { display: flex; flex-direction: column; align-items: flex-end; }
.pv-pr b { color: var(--price); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pv-pr s { font-size: 12px; color: var(--muted); }
.form-modal { width: min(520px, 100%); }
.bp-preview { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); font-size: 14px; }
.bp-preview span { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.bp-preview .pr { color: var(--price); }

/* ---------- Cài đặt ---------- */
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; padding-bottom: 72px; }
@media (max-width: 1000px) { .settings { grid-template-columns: minmax(0, 1fr); } }
.accents { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.acc { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink); text-align: left; transition: border-color .2s, transform .2s var(--ease); }
.acc:hover { border-color: var(--line-2); transform: translateY(-2px); }
.acc.on { border-color: var(--c); box-shadow: 0 0 0 1px var(--c); }
.acc-sw { width: 28px; height: 28px; flex: none; border-radius: var(--r-sm); background: var(--c); color: #fff; display: grid; place-items: center; }
.acc-sw .ic { opacity: 0; transform: scale(.4); transition: .3s var(--spring); }
.acc.on .acc-sw .ic { opacity: 1; transform: none; }
.acc:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 560px) { .accents { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.savebar {
  position: fixed; z-index: 80; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 32px);
  padding: 8px 8px 8px 16px; border-radius: var(--r-lg);
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 500;
  transform: translate(-50%, 160%); transition: transform .45s var(--spring);
}
.savebar.show { transform: translate(-50%, 0); }
.savebar > span { display: inline-flex; align-items: center; gap: 8px; margin-right: 6px; }
.savebar .btn:not(.btn-primary) { background: color-mix(in srgb, var(--bg) 14%, transparent); color: var(--bg); }
@media (min-width: 861px) { .savebar, .bulk { margin-left: calc(var(--sbw) / 2); transition: transform .45s var(--spring), margin-left .4s var(--ease); } }

/* ---------- Thao tác hàng loạt ---------- */
.bulk {
  position: fixed; z-index: 85; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 32px);
  padding: 8px; border-radius: var(--r-lg);
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg);
  transform: translate(-50%, 180%); transition: transform .45s var(--spring);
}
.bulk.show { transform: translate(-50%, 0); }
.bulk-n { padding: 0 10px 0 8px; font-size: 14px; white-space: nowrap; }
.bulk .btn { background: color-mix(in srgb, var(--bg) 13%, transparent); color: var(--bg); }
.bulk .btn:hover { background: color-mix(in srgb, var(--bg) 24%, transparent); }
.bulk .bulk-del:hover { background: var(--danger); color: #fff; }

/* ---------- Sao lưu ---------- */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0; }
.meta-grid > div { padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); }
.meta-grid dt { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.meta-grid dd { margin: 4px 0 0; font-weight: 600; font-size: 14px; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--ink-2); font-size: 14px; }
.callout .ic { color: var(--accent); margin-top: 1px; }
.callout p { margin: 0; }
.callout code { font-family: var(--mono); font-size: 12.5px; padding: 1px 6px; border-radius: 6px; background: var(--surface); }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 150px; padding: 20px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line-2); border-radius: var(--r); background: var(--surface-2); color: var(--muted);
  transition: border-color .2s, background-color .2s, transform .25s var(--ease);
}
.drop b { color: var(--ink); }
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); outline: none; }
.drop.over { transform: scale(1.02); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.danger-zone .ph-ic { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.dz { display: flex; flex-direction: column; gap: 0; padding-block: 4px; }
.dz-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dz-row:last-child { border-bottom: 0; }
.dz-row p { margin: 2px 0 0; }

/* ---------- Danh sách dạng thẻ (Chân trang, Liên hệ nhanh) ---------- */
.stack-narrow { display: flex; flex-direction: column; gap: 20px; max-width: 900px; padding-bottom: 72px; }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.row-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface);
  transition: border-color .2s, box-shadow .2s, opacity .2s;
}
.row-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.row-card.is-off .rc-main, .row-card.is-off .ch-ic, .row-card.is-off .rc-ic { opacity: .45; }
.rc-ic { width: 34px; height: 34px; flex: none; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.rc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.rc-main b { font-size: 14px; }
.rc-main small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-act { display: flex; align-items: center; gap: 2px; }
.rc-act .btn-icon { border-color: transparent; }
.eye.on { color: var(--accent); }
.rows-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 14px; border: 1px dashed var(--line-2); border-radius: var(--r); }
.add-row { margin-top: 12px; }
.switch-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 14px; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--line); cursor: pointer;
}
.switch-card > span:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch-card b { font-size: 14px; }
.switch-card small { font-size: 12.5px; color: var(--muted); }
.range-row { display: flex; align-items: center; gap: 14px; min-height: 42px; }
.range-row input { flex: 1; accent-color: var(--accent); }
.range-row b { min-width: 56px; color: var(--accent); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .row-card { flex-wrap: wrap; }
  .rc-act { width: 100%; justify-content: flex-end; border-top: 1px dashed var(--line); padding-top: 6px; }
}

/* Chọn biểu tượng */
.ch-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.chp {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px 8px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  transition: border-color .2s, background-color .2s, transform .2s var(--ease);
}
.chp:hover { border-color: var(--line-2); transform: translateY(-2px); }
.chp.on { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); box-shadow: 0 0 0 1px var(--accent); }
.chp:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chp span:last-child { text-align: center; line-height: 1.2; }

/* Liên hệ nhanh: bố cục + xem trước */
.quick-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; padding-bottom: 72px; }
.qp-wrap { position: sticky; top: 84px; }
@media (max-width: 1100px) { .quick-grid { grid-template-columns: minmax(0, 1fr); } .qp-wrap { position: static; } }
.qp { display: flex; align-items: center; justify-content: flex-end; }
.qp.left { justify-content: flex-start; }
.qp-panel { width: 250px; padding: 12px 8px 8px; border-radius: var(--r-lg) 0 0 var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.qp.left .qp-panel { border-radius: 0 var(--r-lg) var(--r-lg) 0; }
.qp-h { display: flex; flex-direction: column; gap: 2px; padding: 0 6px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.qp-h span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.qp-h i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.qp-item { display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-radius: var(--r); }
.qp-item > span { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.qp-item b { font-size: 14px; }
.qp-item small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qp-tab { width: 36px; height: 46px; flex: none; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); border-radius: var(--r) 0 0 var(--r); }
.qp.left .qp-tab { border-radius: 0 var(--r) var(--r) 0; }
.qp:not(.left) .qp-panel { order: 1; }
.qp:not(.left) .qp-tab { order: 0; }
.panel-h > .ph-ic + div { flex: 1; min-width: 0; }
.bulk:not(.show), .savebar:not(.show) { visibility: hidden; transition: transform .45s var(--spring), visibility 0s .45s; }

/* ---------- Cây Game › Danh mục › Sản phẩm ---------- */
.tree-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tree-top h2 { margin: 0 0 2px; font-size: 18px; letter-spacing: -.01em; }
.tree-top p { margin: 0; }
.tree-top .inline { display: inline; vertical-align: -2px; }
.filters.panel { border-radius: var(--r-lg); border: 1px solid var(--line); }
.tree { display: flex; flex-direction: column; gap: 12px; }
.tree-g { overflow: hidden; transition: border-color .3s, box-shadow .3s; }
.tree-g.open { border-color: var(--accent-line); box-shadow: var(--shadow); }
.tree-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; }
.tree-tg {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 6px; border: 0; background: none; cursor: pointer;
  border-radius: var(--r); text-align: left; color: var(--ink);
  transition: background-color .2s;
}
.tree-tg:hover { background: var(--surface-2); }
.tree-tg:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tree-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.tree-t b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-t small { font-size: 12.5px; color: var(--muted); }
.tree-chev { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--muted); background: var(--surface-2); transition: transform .35s var(--ease), background-color .2s, color .2s; }
.open > .tree-h .tree-chev { transform: rotate(180deg); background: var(--accent-soft); color: var(--accent); }
.tree-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s var(--ease); }
.open > .tree-body { grid-template-rows: 1fr; }
.tree-body > div { overflow: hidden; min-height: 0; }
.tree-g > .tree-body > div { border-top: 1px solid transparent; transition: border-color .3s; }
.tree-g.open > .tree-body > div { border-top-color: var(--line); }
.tree-cats { display: flex; flex-direction: column; gap: 10px; padding: 0 14px; }
.tree-g.open > .tree-body > .tree-cats { padding-block: 14px; }
.tree-c { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); overflow: hidden; transition: border-color .3s; }
.tree-c.open { border-color: var(--accent-line); background: var(--surface); }
.tree-c > .tree-h { padding: 6px 10px 6px 6px; }
.tree-c .tree-t b { font-size: 14px; }
.tree-c .tbl th { background: var(--surface-2); }
.tree-c.open > .tree-body > div { border-top: 1px solid var(--line); }
.g-off > .tree-h .tree-t b, .c-off > .tree-h .tree-t b { opacity: .55; }
.g-off > .tree-h .av { opacity: .5; }
.tree-empty { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px; color: var(--muted); font-size: 14px; }
.tree-empty .btn { margin-left: auto; }
@media (max-width: 560px) {
  .hide-xs { display: none; }
  .tree-h { padding: 8px; gap: 6px; }
  .tree-cats { padding: 0 8px; }
  .tree-g.open > .tree-body > .tree-cats { padding-block: 8px; }
  .tree-empty .btn { margin-left: 0; }
}

/* ---------- Khung xem trước khi gửi link ---------- */
.settings .panel.full { grid-column: 1 / -1; }
.seo-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 24px; align-items: start; }
@media (max-width: 1100px) { .seo-grid { grid-template-columns: minmax(0, 1fr); } }
.seo-side { display: flex; flex-direction: column; gap: 10px; }
.seo-side code { font-family: var(--mono); font-size: 12px; padding: 1px 5px; border-radius: 5px; background: var(--surface-2); }
.og-card { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.og-img { position: relative; aspect-ratio: 1200 / 630; max-width: 100%; background: var(--surface-3); display: grid; place-items: center; }
.og-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.og-img span { font-size: 13px; color: var(--muted); }
.og-img:not(.bad) img + span { display: none; }
.og-img.bad img { display: none; }
.og-body { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; background: var(--surface-2); border-top: 1px solid var(--line); }
.og-body small { font-size: 12px; color: var(--muted); letter-spacing: .03em; }
.og-body b { font-size: 15px; line-height: 1.35; }
.og-body p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
label.btn { cursor: pointer; }
label.btn.disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Giao diện ---------- */
.look-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; padding-bottom: 72px; }
.look-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
@media (max-width: 1100px) { .look-grid { grid-template-columns: minmax(0, 1fr); } }
.presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .presets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.preset {
  display: flex; flex-direction: column; gap: 10px; padding: 10px; text-align: left; cursor: pointer;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: border-color .2s, transform .2s var(--ease), box-shadow .2s;
}
.preset:hover { transform: translateY(-2px); border-color: var(--line-2); }
.preset.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); color: var(--ink); }
.preset:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pz { height: 36px; border-radius: var(--r-sm); }
.color-row { display: flex; gap: 10px; }
.color-sw { position: relative; width: 46px; height: 42px; flex: none; display: grid; place-items: center; cursor: pointer; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); }
.color-sw::after { content: ""; width: 26px; height: 26px; border-radius: 6px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
.color-sw input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.color-row .input { text-transform: lowercase; }
.music-box { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: var(--r); border: 1px dashed var(--line-2); background: var(--surface-2); }

.lk-prev { position: relative; overflow: hidden; isolation: isolate; padding: 28px 24px; border-radius: var(--prl, 16px); background: var(--surface-2); border: 1px solid var(--line); }
.lp-blob { position: absolute; z-index: -1; right: -70px; top: -90px; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(circle, var(--pb), transparent 70%); opacity: .35; filter: blur(10px); }
.lk-prev h3 { margin: 0 0 8px; font-size: 24px; line-height: 1.25; letter-spacing: -.02em; }
.lp-hl { background: linear-gradient(90deg, var(--pa), var(--pb)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lk-prev p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.lp-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.lp-btn, .lp-btn2 { padding: 10px 16px; border-radius: var(--pr, 12px); font-weight: 700; font-size: 14px; }
.lp-btn { background: linear-gradient(135deg, var(--pa), var(--pb)); color: var(--pon); box-shadow: 0 8px 18px -10px var(--pa); }
.lp-btn2 { border: 1px solid var(--line-2); background: var(--surface); }
.lp-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--pr, 12px); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.lp-card b { display: block; }
.lp-card small { color: var(--muted); }
.lp-ic { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: var(--pr, 12px); background: linear-gradient(135deg, var(--pa), var(--pb)); color: var(--pon); }
.lk-prev[data-card="glass"] .lp-card { background: color-mix(in srgb, var(--surface) 50%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-color: rgba(255,255,255,.45); }
.lk-prev[data-card="outline"] .lp-card { background: transparent; box-shadow: none; border-color: var(--line-2); }
.lk-prev[data-hero="center"] { text-align: center; }
.lk-prev[data-hero="center"] .lp-cta { justify-content: center; }
.lk-prev[data-hero="center"] .lp-card { text-align: left; max-width: 360px; margin: 0 auto; }
