/* =====================================================================
   NovelHub — Trang quản trị. Tách riêng khỏi style.css (site đọc truyện không tải file này).
   Sáng/tối: html[data-theme] (nút trên thanh trên) hoặc theo hệ thống.
   ===================================================================== */
:root {
  --brand-ink: #14123d; --brand-900: #41238a; --brand-700: #5b1fb0; --brand-600: #6d14c4; --brand-500: #8111df;
  --brand-400: #a26af2; --brand-300: #b78bff; --brand-100: #ece0ff; --brand-50: #f6f0ff;
  --bg: #f6f4fb; --panel: #ffffff; --panel-2: #faf8fe; --line: #e6e1f2; --line-2: #d6cfea;
  --text: #17142e; --muted: #5d5878; --faint: #8a85a3;
  --accent: var(--brand-600); --accent-hover: var(--brand-700); --accent-ink: #fff; --accent-text: var(--brand-600); --accent-soft: var(--brand-50);
  --focus: #8111df;
  --ok: #15803d; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --danger: #b91c1c; --danger-soft: #fee2e2; --info: #1d4ed8; --info-soft: #dbeafe;
  --side-bg: #ffffff; --side-w: 248px; --side-w-min: 68px; --top-h: 60px;
  --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px;
  --sh-1: 0 1px 2px rgb(20 18 61 / .06); --sh-2: 0 4px 16px -4px rgb(20 18 61 / .12); --sh-3: 0 20px 48px -12px rgb(20 18 61 / .28);
  --sans: "Be Vietnam Pro", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --dur: .16s; color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #100d22; --panel: #1a1631; --panel-2: #201b3b; --line: #2d2750; --line-2: #3b3466;
  --text: #ece8fb; --muted: #aaa3cc; --faint: #7d76a3;
  --accent: #8111df; --accent-hover: #9233ee; --accent-text: #c4a3ff; --accent-soft: #2a2050; --focus: #b78bff;
  --ok: #4ade80; --ok-soft: #12321f; --warn: #fbbf24; --warn-soft: #3a2a0c; --danger: #f87171; --danger-soft: #3d1416; --info: #93c5fd; --info-soft: #172a4d;
  --side-bg: #15122a; --sh-1: 0 1px 2px rgb(0 0 0 / .4); --sh-2: 0 6px 18px -6px rgb(0 0 0 / .6); --sh-3: 0 24px 56px -12px rgb(0 0 0 / .7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --bg: #100d22; --panel: #1a1631; --panel-2: #201b3b; --line: #2d2750; --line-2: #3b3466;
    --text: #ece8fb; --muted: #aaa3cc; --faint: #7d76a3;
    --accent: #8111df; --accent-hover: #9233ee; --accent-text: #c4a3ff; --accent-soft: #2a2050; --focus: #b78bff;
    --ok: #4ade80; --ok-soft: #12321f; --warn: #fbbf24; --warn-soft: #3a2a0c; --danger: #f87171; --danger-soft: #3d1416; --info: #93c5fd; --info-soft: #172a4d;
    --side-bg: #15122a; --sh-1: 0 1px 2px rgb(0 0 0 / .4); --sh-2: 0 6px 18px -6px rgb(0 0 0 / .6); --sh-3: 0 24px 56px -12px rgb(0 0 0 / .7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
img, svg { max-width: 100%; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code, kbd { font-family: var(--mono); font-size: .86em; }
code { padding: .1em .35em; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); }
kbd { display: inline-block; min-width: 1.6em; padding: .05em .4em; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--panel); text-align: center; }
h1, h2, h3 { line-height: 1.25; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
html:not(.js) .js-only { display: none !important; }
html.js .no-js-only, html.js .no-js-inline { display: none !important; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; word-break: break-word; }
.pre { white-space: pre-line; overflow-wrap: anywhere; max-width: 32rem; }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: .6rem 1rem; border-radius: var(--r-md); background: var(--accent); color: #fff; }
.skip:focus { top: 1rem; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Khung: thanh bên + cột chính ---------- */
.shell { --sw: var(--side-w); display: grid; grid-template-columns: var(--sw) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh;
  background: linear-gradient(90deg, var(--side-bg) 0 calc(var(--sw) - 1px), var(--line) 0 var(--sw), transparent 0); }
html.side-collapsed .shell { --sw: var(--side-w-min); }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: var(--side-bg); border-right: 1px solid var(--line); z-index: 30; }
.side-head { display: flex; align-items: center; gap: .5rem; height: var(--top-h); padding: 0 .9rem; border-bottom: 1px solid var(--line); }
.side-brand { display: flex; align-items: center; gap: .65rem; min-width: 0; color: var(--text); text-decoration: none !important; }
.brand-mark { width: 40px; height: auto; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 800; letter-spacing: -.01em; }
.brand-sub { color: var(--muted); font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.side-close { display: none; margin-left: auto; }
.side-nav { flex: 1; overflow-y: auto; padding: .6rem .6rem 1rem; overscroll-behavior: contain; }
.side-group { margin: 1rem .7rem .35rem; color: var(--faint); font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.side-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side-nav a { position: relative; display: flex; align-items: center; gap: .75rem; min-height: 40px; padding: 0 .7rem; border-radius: var(--r-md); color: var(--muted); font-weight: 600; font-size: .92rem; text-decoration: none; white-space: nowrap; transition: background-color var(--dur), color var(--dur); }
.side-nav a:hover { background: var(--accent-soft); color: var(--text); }
.side-nav a[aria-current] { background: var(--accent-soft); color: var(--accent-text); }
.side-nav a[aria-current]::before { content: ""; position: absolute; left: -.6rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-label { overflow: hidden; text-overflow: ellipsis; }
.side-badge { margin-left: auto; min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 800; line-height: 20px; text-align: center; }
.side-badge.muted { background: var(--line-2); color: var(--text); }
.side-collapse { display: flex; align-items: center; gap: .75rem; margin: .5rem .6rem .8rem; min-height: 40px; padding: 0 .7rem; border: 0; border-radius: var(--r-md); background: none; color: var(--muted); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.side-collapse:hover { background: var(--accent-soft); color: var(--text); }
.side-collapse .ic { transition: transform var(--dur); }
html.side-collapsed .side-collapse .ic { transform: rotate(180deg); }
/* Thu gọn (desktop): chỉ còn biểu tượng, tooltip theo data-tip */
html.side-collapsed .side .brand-text, html.side-collapsed .side .side-label, html.side-collapsed .side .side-group { display: none; }
html.side-collapsed .side-head { justify-content: center; padding: 0; }
html.side-collapsed .side-nav a, html.side-collapsed .side-collapse { justify-content: center; padding: 0; }
html.side-collapsed .side-badge { position: absolute; top: 3px; right: 3px; min-width: 16px; padding: 0 4px; font-size: .62rem; line-height: 16px; }
html.side-collapsed .side-nav ul + ul { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--line); }
@media (hover: hover) {
  html.side-collapsed .side-nav a:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); padding: .3rem .6rem; border-radius: var(--r-sm); background: var(--text); color: var(--bg); font-size: .8rem; white-space: nowrap; pointer-events: none; z-index: 50; }
}
.scrim { display: none; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; height: var(--top-h); padding: 0 1.25rem; background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-menu { display: none; }
.top-search { position: relative; flex: 1; max-width: 34rem; display: flex; align-items: center; }
.top-search > .ic { position: absolute; left: .8rem; color: var(--faint); pointer-events: none; }
.top-search input { width: 100%; height: 40px; padding: 0 2.6rem 0 2.5rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font: inherit; font-size: .92rem; }
.top-search input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.kbd-hint { position: absolute; right: .7rem; color: var(--faint); pointer-events: none; }
.top-search input:focus ~ .kbd-hint { display: none; }
.top-actions { display: flex; align-items: center; gap: .3rem; margin-left: auto; }
.top-actions form { margin: 0; display: flex; }
.loadbar { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--accent); opacity: 0; transition: width 8s cubic-bezier(.1, .7, .2, 1), opacity .2s; }
html.is-loading .loadbar { width: 85%; opacity: 1; }
.content { width: 100%; max-width: 1400px; margin: 0 auto; padding: 1.25rem 1.5rem 4rem; outline: none; }

/* ---------- Nút ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 40px; padding: 0 1rem; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--panel); color: var(--text); font: inherit; font-size: .9rem; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background-color var(--dur), border-color var(--dur), color var(--dur), box-shadow var(--dur); }
.btn:hover { border-color: var(--accent); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--text); border-color: transparent; }
.btn-ok { color: var(--ok); }
.btn-ok:hover { border-color: var(--ok); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
html[data-theme="dark"] .btn-danger { color: #1a0505; }
.btn-danger:hover { filter: brightness(1.08); border-color: var(--danger); }
.btn-danger-ghost { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: transparent; }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { min-height: 34px; padding: 0 .75rem; font-size: .84rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .65; cursor: progress; }
.btn.is-busy::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ibtn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0; border: 0; border-radius: var(--r-md); background: none; color: var(--muted); cursor: pointer; text-decoration: none !important; }
.ibtn:hover { background: var(--accent-soft); color: var(--text); }
.ibtn-sm { width: 34px; height: 34px; }
.ibtn.side-close, .ibtn.top-menu { display: none; }
.ibtn.flip .ic { transform: rotate(180deg); }
.ic-sun { display: none; }
html[data-theme="dark"] .ic-sun { display: block; }
html[data-theme="dark"] .ic-moon { display: none; }
@media (prefers-color-scheme: dark) { html:not([data-theme]) .ic-sun { display: block; } html:not([data-theme]) .ic-moon { display: none; } }
@media (hover: hover) and (pointer: fine) {
  .top [data-tip]:hover::after, .col-act [data-tip]:hover::after, .form-actions [data-tip]:hover::after {
    content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); padding: .3rem .55rem; border-radius: var(--r-sm);
    background: var(--text); color: var(--bg); font-size: .76rem; font-weight: 600; white-space: nowrap; pointer-events: none; z-index: 60;
  }
}

/* ---------- Trang: đầu trang, breadcrumb ---------- */
.crumbs ol { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 .9rem; padding: 0; list-style: none; color: var(--muted); font-size: .84rem; }
.crumbs li + li::before { content: "/"; margin-right: .35rem; color: var(--faint); }
.crumbs a { color: var(--muted); }
.crumbs [aria-current] { color: var(--text); font-weight: 600; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin: 0 0 1.1rem; }
.page-title { margin: 0; font-size: 1.55rem; font-weight: 800; letter-spacing: -.015em; overflow-wrap: anywhere; }
.count { display: inline-block; margin-left: .35rem; padding: .05rem .55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: .8rem; font-weight: 700; vertical-align: middle; letter-spacing: 0; }
.head-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.page-help { margin: -.4rem 0 1rem; max-width: 60rem; }
.help { margin: .35rem 0 0; color: var(--muted); font-size: .84rem; }

/* ---------- Thẻ, lưới ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .85rem; }
.card-title { margin: 0 0 .75rem; font-size: 1.02rem; font-weight: 700; }
.card-head .card-title { margin: 0; }
.link-more { font-size: .84rem; font-weight: 600; white-space: nowrap; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 1rem; align-items: start; }
.settings-grid, .search-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; align-items: start; }
.settings-grid .card, .search-grid .card { margin: 0; }

/* ---------- Tổng quan ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; margin-bottom: 1rem; }
.kpi-wide { grid-column: span 2; }
.kpi { position: relative; display: flex; flex-direction: column; gap: .15rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--sh-1); color: var(--text); text-decoration: none !important; transition: border-color var(--dur), transform var(--dur), box-shadow var(--dur); min-width: 0; }
a.kpi:hover { border-color: var(--accent); box-shadow: var(--sh-2); transform: translateY(-1px); }
.kpi-ic { position: absolute; top: .9rem; right: .9rem; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.kpi-ic .ic { width: 18px; height: 18px; }
.kpi-label { color: var(--muted); font-size: .82rem; font-weight: 600; padding-right: 2.5rem; }
.kpi-val { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-sub { color: var(--muted); font-size: .8rem; }
.kpi-sub b { color: var(--text); font-variant-numeric: tabular-nums; }
.kpi-attn .kpi-ic { background: var(--danger-soft); color: var(--danger); }
.kpi-attn .kpi-val { color: var(--danger); }
.meter { display: block; height: 6px; margin-top: .5rem; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-400), var(--brand-600)); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.dash-grid .card { margin: 0; }
.chart-wrap { position: relative; width: 100%; aspect-ratio: 720 / 220; }
.chart { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .axis { fill: var(--faint); font-size: 11px; font-family: var(--sans); }
.chart .col { fill: var(--brand-400); transition: fill var(--dur); }
.chart .is-today .col { fill: var(--accent); }
.chart .hit { fill: transparent; }
.chart .bar:hover .col { fill: var(--brand-700); }
html[data-theme="dark"] .chart .bar:hover .col { fill: var(--brand-300); }
.chart-empty { margin: 0 0 .5rem; }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.alert { display: flex; gap: .6rem; align-items: flex-start; margin: 0; padding: .65rem .8rem; border-radius: var(--r-md); font-size: .88rem; line-height: 1.45; }
.alert .ic { margin-top: 1px; width: 18px; height: 18px; }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert span { color: var(--text); }
.alert a { font-weight: 700; }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.rank li { display: grid; grid-template-columns: 1.6rem 32px minmax(0, 1fr) auto; align-items: center; gap: .65rem; }
.rank-n { color: var(--faint); font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.rank li:nth-child(-n+3) .rank-n { color: var(--accent-text); }
.rank-main { min-width: 0; }
.rank-main a { display: block; color: var(--text); font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-bar { display: block; height: 4px; margin-top: .3rem; border-radius: 999px; background: var(--line); overflow: hidden; }
.rank-bar span { display: block; height: 100%; background: var(--brand-400); border-radius: inherit; }
.rank-v { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; font-size: .9rem; }
.rank-v small { color: var(--muted); font-size: .72rem; }
.rank .thumb { width: 32px; height: 48px; font-size: .9rem; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.feed li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: .65rem; align-items: center; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed-dot { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); }
.feed-dot .ic { width: 16px; height: 16px; }
.feed-novel { background: var(--ok-soft); color: var(--ok); }
.feed-main { min-width: 0; display: flex; flex-direction: column; }
.feed-main a { color: var(--text); font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-main small { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-time { color: var(--faint); font-size: .78rem; white-space: nowrap; }

/* ---------- Bộ lọc, thanh công cụ ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .8rem; }
.f-search { position: relative; flex: 1 1 16rem; display: flex; align-items: center; min-width: 0; }
.f-search > .ic { position: absolute; left: .75rem; color: var(--faint); pointer-events: none; }
.f-search .inp { padding-left: 2.4rem; }
.f-inline { max-width: 26rem; margin-bottom: .9rem; }
.f-inline.big { max-width: 40rem; }
.toolbar .f-inline { margin: 0; flex: 0 1 20rem; }
.f-sel { flex: 0 1 11rem; min-width: 0; }
.f-wide { flex: 1 1 16rem; }
.f-actions { display: flex; gap: .4rem; }
html.js [data-autosubmit] .f-actions .btn:first-child { display: none; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--r-md); background: var(--panel); border: 1px solid var(--line); }
.seg a { display: inline-flex; align-items: center; gap: .35rem; min-height: 34px; padding: 0 .85rem; border-radius: 8px; color: var(--muted); font-size: .86rem; font-weight: 600; text-decoration: none !important; }
.seg a:hover { color: var(--text); background: var(--panel-2); }
.seg a[aria-current] { background: var(--accent); color: var(--accent-ink); }
.seg-badge { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--line); color: var(--text); font-size: .72rem; line-height: 18px; text-align: center; }
.seg a[aria-current] .seg-badge { background: rgb(255 255 255 / .25); color: inherit; }
.bulkbar { position: sticky; top: calc(var(--top-h) + 6px); z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .6rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); box-shadow: var(--sh-1); }
.bulkbar.has-sel { border-color: var(--accent); background: var(--accent-soft); }
.bulk-count { color: var(--muted); font-size: .86rem; font-weight: 600; margin-right: .25rem; }
.has-sel .bulk-count { color: var(--accent-text); }

/* ---------- Ô nhập ---------- */
.inp { width: 100%; min-height: 40px; padding: .45rem .75rem; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--panel); color: var(--text); font: inherit; font-size: .92rem; transition: border-color var(--dur), box-shadow var(--dur); }
.inp:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line-2)); }
.inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.inp::placeholder { color: var(--faint); }
.inp[readonly] { background: var(--panel-2); color: var(--muted); }
textarea.inp { line-height: 1.6; resize: vertical; }
select.inp { padding-right: 2rem; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a85a3' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .6rem center; background-size: 16px; text-overflow: ellipsis; }
.inp-sm { min-height: 34px; padding-top: .25rem; padding-bottom: .25rem; font-size: .84rem; width: auto; }
.inp-lg { font-size: 1.05rem; font-weight: 600; }
.inp-content { min-height: 26rem; font-family: "Noto Serif", Georgia, serif; font-size: 1rem; line-height: 1.8; }
.lbl { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .35rem; font-size: .86rem; font-weight: 700; color: var(--text); }
.field { margin-bottom: 1rem; min-width: 0; }
.field-num { max-width: 12rem; }
.field-err { margin: .5rem 0 0; color: var(--danger); font-size: .86rem; font-weight: 600; }
.counter { color: var(--faint); font-size: .76rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.counter.over { color: var(--warn); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.1rem; }
.span2 { grid-column: 1 / -1; }
.stack > * + * { margin-top: .9rem; }
.inp-prefix { display: flex; align-items: stretch; }
.inp-prefix > span { display: flex; align-items: center; padding: 0 .65rem; border: 1px solid var(--line-2); border-right: 0; border-radius: var(--r-md) 0 0 var(--r-md); background: var(--panel-2); color: var(--muted); font-family: var(--mono); font-size: .82rem; }
.inp-prefix .inp { border-radius: 0 var(--r-md) var(--r-md) 0; font-family: var(--mono); font-size: .9rem; }
.slug-status.ok { color: var(--ok); } .slug-status.bad { color: var(--danger); }
.check { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; cursor: pointer; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-weight: 600; font-size: .9rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--line-2); transition: background-color var(--dur); }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform var(--dur); }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--focus); outline-offset: 2px; }
.color-row { display: flex; align-items: center; gap: .6rem; }
.inp-color { width: 48px; height: 40px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--panel); cursor: pointer; }
.note { padding: .7rem .9rem; border-radius: var(--r-md); font-size: .88rem; }
.note-warn { background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }

/* ---------- Bảng ---------- */
.tbl-wrap { overflow-x: auto; padding: 0; }
.tbl-wrap.card { padding: 0; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.tbl th, .tbl td { padding: .65rem .8rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.tbl thead th { position: sticky; top: 0; z-index: 1; background: var(--panel-2); color: var(--muted); font-size: .76rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color var(--dur); }
.tbl tbody tr:hover { background: var(--panel-2); }
.tbl tbody tr:has(input[name=ids]:checked), .tbl tbody tr:has(input[name=keys]:checked) { background: var(--accent-soft); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .col-check { width: 44px; padding-right: 0; }
.tbl .col-cover { width: 56px; padding-right: 0; }
.tbl .col-act { width: 1%; text-align: right; white-space: nowrap; }
.tbl tr.is-muted .row-title { color: var(--muted); }
.th-sort { display: inline-flex; align-items: center; gap: .3rem; color: inherit; text-decoration: none !important; }
.th-sort:hover { color: var(--text); }
.sort-ic { font-size: .7rem; opacity: .55; }
[aria-sort] .th-sort { color: var(--accent-text); }
[aria-sort] .sort-ic { opacity: 1; }
.row-title { color: var(--text); font-weight: 650; }
.sub { display: block; margin-top: .1rem; color: var(--muted); font-size: .78rem; font-weight: 400; overflow-wrap: anywhere; }
.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.col-title .tags { display: flex; margin-top: .3rem; }
.tag { display: inline-flex; align-items: center; min-height: 20px; padding: 0 .4rem; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font-size: .7rem; font-weight: 700; line-height: 1; text-decoration: none !important; white-space: nowrap; }
.tag-lang { font-family: var(--mono); text-transform: lowercase; }
.tag-missing { font-family: var(--mono); opacity: .45; text-decoration: line-through !important; }
.tag-hot { background: #fde7e3; border-color: #f6c3b8; color: #b42318; }
.tag-full { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.tag-demo { background: #b45309; border-color: #b45309; color: #fff; letter-spacing: .05em; }
.tag-muted { background: var(--line); color: var(--text); }
html[data-theme="dark"] .tag-hot { background: #3d1712; border-color: #6b2318; color: #fca5a5; }
@media (prefers-color-scheme: dark) { html:not([data-theme]) .tag-hot { background: #3d1712; border-color: #6b2318; color: #fca5a5; } }
.chip { display: inline-flex; align-items: center; gap: .3rem; min-height: 24px; padding: 0 .55rem; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; background: var(--line); color: var(--text); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-muted { background: var(--line); color: var(--muted); }
.dot-status { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; font-size: .86rem; }
.dot-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.dot-status.st-completed::before { background: var(--ok); }
.thumb { display: block; width: 40px; height: 60px; flex: none; object-fit: cover; border-radius: 6px; background: var(--line); box-shadow: var(--sh-1); }
.thumb-auto { display: grid; place-items: center; background: linear-gradient(150deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); color: #fff; font-weight: 800; font-size: 1.1rem; text-shadow: 0 1px 2px rgb(0 0 0 / .25); }
.thumb-xl { width: 200px; height: 300px; border-radius: var(--r-md); font-size: 4rem; }
.cell-novel { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.cell-novel a, .cell-novel strong { font-weight: 650; }
.list-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .75rem; }
.per-form label { display: inline-flex; align-items: center; gap: .4rem; font-size: .84rem; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.pager-info { color: var(--muted); font-size: .84rem; }
.pager ul { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.pager a, .pager span:not(.pager-info) { display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 .6rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); color: var(--text); font-size: .86rem; font-weight: 600; text-decoration: none !important; }
.pager a:hover { border-color: var(--accent); }
.pager [aria-current] { background: var(--accent) !important; border-color: var(--accent) !important; color: var(--accent-ink) !important; }
.pager .off { opacity: .45; }
.pager .gap { border: 0 !important; background: none !important; min-width: 20px; }
.inline { display: inline-flex; gap: .3rem; margin: 0; vertical-align: middle; }
.purge-name { width: 9rem; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state p { margin: 0; }
.empty-ic { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-text); }
.empty-ic .ic { width: 26px; height: 26px; }

/* ---------- Bình luận ---------- */
.cmt-list { list-style: none; margin: 0 0 1rem; padding: 0; overflow: hidden; }
.cmt { display: grid; grid-template-columns: 22px 36px minmax(0, 1fr); gap: .75rem; align-items: start; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.cmt:last-child { border-bottom: 0; }
.cmt input[type=checkbox] { margin-top: .5rem; }
.cmt.st-pending { background: color-mix(in srgb, var(--warn-soft) 55%, transparent); }
.cmt.st-hidden { opacity: .7; }
.cmt:has(input:checked) { background: var(--accent-soft); }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-400), var(--brand-700)); color: #fff; font-weight: 800; }
.cmt-head { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; }
.cmt-head .sub { display: inline; margin: 0; }
.cmt-body { margin: .35rem 0; white-space: pre-line; overflow-wrap: anywhere; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: .2rem 0 0; }
.res-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.res-list li { display: flex; gap: .65rem; align-items: center; min-width: 0; }
.res-list li > span { min-width: 0; }
.res-list .thumb { width: 32px; height: 48px; font-size: .9rem; }

/* ---------- Đánh giá, thể loại, giao diện ---------- */
.dist { display: inline-flex; align-items: flex-end; gap: 3px; height: 34px; }
.dist-bar { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; width: 16px; height: 100%; }
.dist-bar > span { width: 100%; border-radius: 3px 3px 0 0; background: var(--brand-400); }
.dist-bar small { position: absolute; bottom: -14px; color: var(--faint); font-size: .62rem; }
.stars { color: #f59e0b; letter-spacing: 1px; white-space: nowrap; }
.stars-off { color: var(--line-2); }
.genre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: .85rem; }
.genre-card { display: flex; flex-direction: column; gap: .3rem; margin: 0; color: var(--text); text-decoration: none !important; transition: border-color var(--dur), transform var(--dur); }
.genre-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.genre-name { font-weight: 800; font-size: 1.05rem; }
.genre-stats { display: flex; flex-wrap: wrap; gap: .2rem .8rem; color: var(--muted); font-size: .82rem; margin-top: .3rem; }
.genre-stats b { color: var(--text); }
.genre-card .tag { align-self: flex-start; }
.swatches { display: flex; flex-wrap: wrap; gap: .75rem; margin: .75rem 0 1rem; }
.swatch { display: flex; flex-direction: column; gap: .25rem; font-size: .76rem; }
.swatch span { width: 64px; height: 44px; border-radius: var(--r-sm); border: 1px solid var(--line); }
.swatch code { padding: 0; border: 0; background: none; }
.swatch small { color: var(--muted); }
.brand-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.brand-tile { display: grid; place-items: center; min-height: 80px; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
.brand-tile.dark { background: #14102a; }
.brand-tile img { height: 40px; width: auto; }
.kv { margin: 0; display: grid; gap: 0; }
.kv > div { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: .75rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: .86rem; }
.kv dd { margin: 0; font-size: .9rem; min-width: 0; }

/* ---------- Form truyện / chương ---------- */
.form-head { position: sticky; top: calc(var(--top-h) - 1px); z-index: 15; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem;
  margin: -.25rem -1.5rem 1rem; padding: .7rem 1.5rem; background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.form-head-main { min-width: 0; }
.form-head .page-title { font-size: 1.3rem; }
.form-state { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-top: .25rem; font-size: .86rem; }
.dirty-flag { display: inline-flex; align-items: center; gap: .35rem; color: var(--warn); font-weight: 700; font-size: .8rem; }
.dirty-flag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.tabs { display: flex; gap: .25rem; margin: 0 0 1rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs [role=tab] { position: relative; display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 1rem; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 700; font-size: .92rem; cursor: pointer; white-space: nowrap; }
.tabs [role=tab]:hover { color: var(--text); }
.tabs [role=tab][aria-selected=true] { color: var(--accent-text); }
.tabs [role=tab][aria-selected=true]::after { content: ""; position: absolute; left: .6rem; right: .6rem; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.tab-count { padding: 0 .45rem; border-radius: 999px; background: var(--line); color: var(--text); font-size: .72rem; line-height: 18px; }
html.js .panel:not(.is-active) { display: none; }
.panel-title { margin: 0 0 1rem; font-size: 1.1rem; }
.ltabs { display: flex; flex-wrap: wrap; gap: .35rem; margin: .9rem 0 1rem; }
.ltabs [role=tab] { display: inline-flex; align-items: center; gap: .45rem; min-height: 36px; padding: 0 .8rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; }
.ltabs [role=tab]:hover { border-color: var(--accent); color: var(--text); }
.ltabs [role=tab][aria-selected=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.lt-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--faint); }
.lt-dot.done { background: var(--ok); border-color: var(--ok); }
html.js .lpanel:not(.is-active) { display: none; }
html:not(.js) .lpanel { padding-top: 1rem; border-top: 1px solid var(--line); }
.lpanel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .75rem; }
.lpanel-title { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: 1rem; }
.copy-from { display: flex; flex-wrap: wrap; gap: .4rem; }
.cover-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.cover-now { margin: 0; }
.cover-now img { display: block; width: 200px; height: 300px; object-fit: cover; border-radius: var(--r-md); box-shadow: var(--sh-2); }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; min-height: 170px; padding: 1.25rem; border: 2px dashed var(--line-2); border-radius: var(--r-lg); background: var(--panel-2); text-align: center; cursor: pointer; transition: border-color var(--dur), background-color var(--dur); }
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop > .ic { width: 30px; height: 30px; color: var(--accent-text); }
.drop-text { font-weight: 700; }
.drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
html:not(.js) .drop input[type=file] { position: static; opacity: 1; width: auto; height: auto; }
.crop { margin-top: 1rem; }
.crop-row { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; }
.crop-stage { position: relative; width: 240px; aspect-ratio: 2 / 3; border-radius: var(--r-md); overflow: hidden; background: repeating-conic-gradient(var(--line) 0 25%, transparent 0 50%) 0 0 / 16px 16px; box-shadow: 0 0 0 2px var(--accent), var(--sh-2); cursor: grab; touch-action: none; }
.crop-stage:active { cursor: grabbing; }
.crop-stage canvas { display: block; width: 100%; height: 100%; }
.crop-side { flex: 1; min-width: 12rem; }
.crop-side input[type=range] { width: 100%; accent-color: var(--accent); }
.seo-lang { max-width: 16rem; }
html.js .seo-block:not(.is-active) { display: none; }
.seo-previews { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.25rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.serp { max-width: 600px; padding: 1rem 1.1rem; border-radius: var(--r-md); background: #fff; border: 1px solid #e3e3e3; font-family: Arial, sans-serif; color: #202124; }
.serp-site { display: flex; align-items: center; gap: .6rem; margin-bottom: .3rem; font-size: 14px; line-height: 1.3; }
.serp-fav { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #f1f3f4; }
.serp-name { display: block; color: #202124; }
.serp-url { display: block; color: #4d5156; font-size: 12px; word-break: break-all; }
.serp-title { color: #1a0dab; font-size: 20px; line-height: 1.3; margin-bottom: .2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serp-desc { color: #4d5156; font-size: 14px; line-height: 1.58; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.share-card { max-width: 300px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--panel-2); }
.share-card img { display: block; width: 100%; height: auto; max-height: 220px; object-fit: cover; }
.share-meta { padding: .55rem .75rem; display: flex; flex-direction: column; gap: .1rem; }
.share-site { color: var(--muted); font-size: .72rem; text-transform: uppercase; }
.share-meta strong { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-line { margin-top: .5rem; }
.danger-zone { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line-2); }
.danger-zone form { margin: 0; margin-left: auto; }

/* ---------- Toast, hộp thoại ---------- */
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; display: grid; gap: .5rem; width: min(26rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: .6rem; padding: .75rem .8rem .75rem 1rem; border-radius: var(--r-md); background: var(--text); color: var(--bg); box-shadow: var(--sh-3); font-size: .9rem; font-weight: 600; pointer-events: auto; animation: toast-in .25s ease-out; }
.toast > .ic { margin-top: 1px; }
.toast > span { flex: 1; }
.toast-ok > .ic { color: #4ade80; } .toast-error > .ic { color: #f87171; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-ok { border-left: 4px solid #22c55e; }
.toast-x { display: grid; place-items: center; width: 26px; height: 26px; margin: -2px -2px 0 0; padding: 0; border: 0; border-radius: 6px; background: none; color: inherit; opacity: .7; cursor: pointer; }
.toast-x:hover { opacity: 1; background: rgb(255 255 255 / .12); }
.toast-x .ic { width: 16px; height: 16px; }
.toast.is-out { opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
.dlg { width: min(30rem, calc(100vw - 2rem)); padding: 0; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--panel); color: var(--text); box-shadow: var(--sh-3); }
.dlg::backdrop { background: rgb(16 13 34 / .5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.dlg[open] { animation: dlg-in .18s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dlg-body { padding: 1.4rem 1.5rem 1.25rem; }
.dlg-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: .75rem; border-radius: 12px; background: var(--danger-soft); color: var(--danger); }
.dlg.is-info .dlg-icon { background: var(--accent-soft); color: var(--accent-text); }
.dlg-title { margin: 0 0 .4rem; font-size: 1.15rem; }
.dlg-msg { margin: 0 0 1rem; color: var(--muted); overflow-wrap: anywhere; }
.dlg-type { margin-bottom: 1rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.kb-list { margin: 0 0 1rem; display: grid; gap: .1rem; }
.kb-list > div { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.kb-list dt { white-space: nowrap; color: var(--muted); font-size: .84rem; }
.kb-list dd { margin: 0; font-size: .9rem; }

/* ---------- Đăng nhập ---------- */
.guest-main { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(60rem 30rem at 50% -10%, color-mix(in srgb, var(--brand-400) 28%, transparent), transparent), var(--bg); }
.login-card { width: min(24rem, 100%); padding: 2rem 1.75rem 1.75rem; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--panel); box-shadow: var(--sh-3); }
.login-logo { display: flex; justify-content: center; margin-bottom: .75rem; }
.login-logo .logo-v { width: 9.5rem; height: auto; }
.login-title { margin: 0 0 1.25rem; text-align: center; font-size: 1.25rem; }
.logo-dark { display: none; }
html[data-theme="dark"] .logo-light { display: none; }
html[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) { html:not([data-theme]) .logo-light { display: none; } html:not([data-theme]) .logo-dark { display: block; } }

/* ---------- Quản lý chương ---------- */
.th-sub { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--faint); }
.tbl .col-drag { width: 28px; padding-left: 0; padding-right: 0; }
.drag-handle { display: inline-block; padding: .2rem .3rem; color: var(--faint); cursor: grab; letter-spacing: -2px; user-select: none; }
.tbl-chapters tr.is-dragging { opacity: .45; }
.tbl-chapters tr.drop-before td { box-shadow: inset 0 2px 0 var(--accent); }
.tbl-chapters tr.drop-after td { box-shadow: inset 0 -2px 0 var(--accent); }
.tbl-chapters tr.is-moved td:nth-child(-n+4) { background: color-mix(in srgb, var(--warn-soft) 70%, transparent); }
.reorder-bar { position: sticky; top: calc(var(--top-h) + 6px); z-index: 11; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .6rem; padding: .55rem .7rem; border: 1px solid var(--warn); border-radius: var(--r-md); background: var(--warn-soft); box-shadow: var(--sh-2); font-size: .88rem; font-weight: 600; }
.reorder-bar > span { display: inline-flex; align-items: center; gap: .4rem; flex: 1; min-width: 12rem; }
.bulk-extra { display: inline-flex; align-items: center; gap: .35rem; font-size: .84rem; color: var(--muted); }
html.js .bulk-extra:not(.is-on) { display: none; }
.inp-num { width: 6.5rem; }
.inp-mono { font-family: var(--mono); font-size: .86rem; }
.ibtn[disabled] { opacity: .3; pointer-events: none; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1.1rem; }

/* ---------- Trình soạn chương ---------- */
.publish-box { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: flex-start; }
.publish-box .field { margin-bottom: 0; }
.pub-status { flex: 1; min-width: min(100%, 28rem); border: 0; padding: 0; margin: 0; }
.radio-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.radio-card { position: relative; flex: 1 1 10rem; display: flex; gap: .55rem; align-items: flex-start; padding: .6rem .75rem; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--panel); cursor: pointer; }
.radio-card input { margin-top: .2rem; accent-color: var(--accent); }
.radio-card span { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.radio-card strong { font-size: .9rem; }
.radio-card small { color: var(--muted); font-size: .76rem; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.sched-when { margin-top: .75rem; max-width: 20rem; }
html.js .pub-status:not(:has(input[value=schedule]:checked)) .sched-when { display: none; }
.autosave { color: var(--muted); font-size: .8rem; }
.autosave.is-local { color: var(--warn); font-weight: 600; }
.draft-banner { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin: 0 0 1rem; padding: .65rem .85rem; border-radius: var(--r-md); background: var(--info-soft); color: var(--text); font-size: .9rem; }
.draft-banner > span { flex: 1; min-width: 14rem; }
.draft-banner .ic { color: var(--info); }
.ed-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem .75rem; margin: 0 0 .75rem; }
.ed-lang { display: flex; flex-direction: column; gap: .2rem; font-size: .76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ed-lang .inp { min-width: 11rem; text-transform: none; letter-spacing: 0; }
.ed-single { margin-left: auto; font-size: .86rem; }
.find-panel { padding: .75rem; }
.find-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.find-row + .find-row { margin-top: .5rem; }
.find-row > .inp { flex: 1 1 12rem; width: auto; }
.find-count { font-size: .84rem; }
.spacer { flex: 1; }
.ed-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
html.js .ed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.js .ed-grid.is-single { grid-template-columns: minmax(0, 1fr); }
html.js .ed-pane { display: none; }
html.js .ed-pane.is-left, html.js .ed-pane.is-right { display: flex; }
html.js .ed-pane.is-left { order: 1; } html.js .ed-pane.is-right { order: 2; }
html.js .ed-grid.is-single .ed-pane.is-left { display: none; }
.ed-pane { flex-direction: column; gap: .5rem; min-width: 0; padding: .9rem; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--sh-1); }
html:not(.js) .ed-pane { display: flex; }
.ed-pane.is-right { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.ed-pane-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem .75rem; }
.ed-pane-title { display: flex; align-items: center; gap: .45rem; margin: 0; font-size: .95rem; }
.ed-side { color: var(--faint); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.ed-side:empty { display: none; }
.ed-stats { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.ed-pane .inp-content { flex: 1; min-height: 32rem; height: 60vh; resize: vertical; }
.ed-pane.is-left .inp-content { background: var(--panel-2); }
.dlg-preview { width: min(1320px, calc(100vw - 2rem)); height: calc(100vh - 2rem); height: calc(100dvh - 2rem); max-height: none; padding: 0; display: none; }
.dlg-preview[open] { display: flex; flex-direction: column; }
.pv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .6rem .9rem; border-bottom: 1px solid var(--line); }
.pv-bar .dlg-title { flex: 1; margin: 0; font-size: 1rem; }
.pv-bar form { margin: 0; }
.pv-stage { flex: 1; display: flex; justify-content: center; overflow: auto; background: var(--bg); padding: 1rem; }
.pv-frame { width: 100%; max-width: 1280px; height: 100%; min-height: 60vh; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
.pv-frame.is-phone { max-width: 390px; }

/* ---------- Lịch sử phiên bản: so sánh theo đoạn ---------- */
.vs-grid { grid-template-columns: minmax(0, 1fr) 24rem; }
.diff { font-family: "Noto Serif", Georgia, serif; font-size: .98rem; line-height: 1.75; }
.diff p { margin: 0 0 .5rem; padding: .3rem .6rem; border-radius: 6px; overflow-wrap: anywhere; }
.d-same { color: var(--muted); }
.d-add { background: color-mix(in srgb, var(--ok-soft) 85%, transparent); box-shadow: inset 3px 0 0 var(--ok); color: var(--text); }
.d-del { background: color-mix(in srgb, var(--danger-soft) 85%, transparent); box-shadow: inset 3px 0 0 var(--danger); color: var(--text); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.d-mark { display: inline-block; width: 1.1rem; margin-right: .3rem; font-family: var(--mono); font-weight: 800; text-decoration: none; }
.d-add .d-mark { color: var(--ok); } .d-del .d-mark { color: var(--danger); }
.d-gap { text-align: center; color: var(--faint); font-family: var(--sans); font-size: .8rem; background: var(--panel-2); }
.diff-title { font-size: 1.05rem; margin: 0 0 .9rem; }
.diff-title del { color: var(--danger); } .diff-title ins { color: var(--ok); text-decoration: none; font-weight: 700; }
.diff-stat { font-weight: 800; font-family: var(--mono); }
.diff-stat.add { color: var(--ok); } .diff-stat.del { color: var(--danger); }
.tbl-compact th, .tbl-compact td { padding: .45rem .5rem; }
.tbl tr.is-b td { background: color-mix(in srgb, var(--ok-soft) 50%, transparent); }
.tbl tr.is-a td { background: color-mix(in srgb, var(--danger-soft) 45%, transparent); }
.vs-pick .btn { margin-top: .6rem; }

/* ---------- Nhập hàng loạt ---------- */
.drop-sm { min-height: 110px; }
.im-summary p { margin: 0 0 .75rem; }
.im-actions { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1rem; }
.tbl-import tr.has-warn td { background: color-mix(in srgb, var(--warn-soft) 45%, transparent); }
.im-peek summary { cursor: pointer; color: var(--accent-text); font-size: .78rem; }
.im-peek p { margin: .3rem 0 0; font-size: .82rem; color: var(--muted); max-width: 40rem; }
html.js [data-custom-re]:not(.is-on) { display: none; }
.actor { display: inline-flex; align-items: center; gap: .35rem; font-size: .84rem; white-space: nowrap; }
.actor::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.actor-system::before { background: var(--faint); }

/* ---------- Đáp ứng ---------- */
@media (max-width: 1100px) and (min-width: 601px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1200px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-side { grid-template-columns: minmax(0, 1fr); }
  .hide-md { display: none; }
}
@media (max-width: 900px) {
  .shell, html.side-collapsed .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  /* Thanh bên thành menu trượt */
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(18rem, 86vw); transform: translateX(-102%); transition: transform .22s ease-out; box-shadow: var(--sh-3); }
  html.side-open .side { transform: none; }
  html.side-collapsed .side .brand-text, html.side-collapsed .side .side-label, html.side-collapsed .side .side-group { display: revert; }
  html.side-collapsed .side-nav a { justify-content: flex-start; padding: 0 .7rem; }
  html.side-collapsed .side-head { justify-content: flex-start; padding: 0 .9rem; }
  html.side-collapsed .side-badge { position: static; }
  .ibtn.side-close { display: inline-grid; }
  .side-collapse { display: none; }
  .scrim { position: fixed; inset: 0; z-index: 25; display: block; background: rgb(16 13 34 / .45); }
  .ibtn.top-menu { display: inline-grid; }
  .top { padding: 0 .75rem; gap: .4rem; }
  .content { padding: 1rem 1rem 4rem; }
  .form-head { margin: -.25rem -1rem 1rem; padding: .6rem 1rem; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .cover-grid { grid-template-columns: minmax(0, 1fr); }
  .seo-previews { grid-template-columns: minmax(0, 1fr); }
  html.js .ed-grid { grid-template-columns: minmax(0, 1fr); }
  .ed-pane .inp-content { min-height: 22rem; height: 55vh; }
  .vs-grid, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .hide-sm { display: none; }
  .kbd-hint { display: none; }
}
@media (max-width: 600px) {
  .tbl-novels .tag-lang { display: none; }
  .tbl .thumb { width: 32px; height: 48px; font-size: .9rem; }
  .tbl .col-cover { width: 40px; }
  .top-actions .ibtn[target] { display: none; }
  .page-title { font-size: 1.3rem; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .kpi { padding: .8rem .85rem; }
  .kpi-val { font-size: 1.35rem; }
  .kpi-ic { display: none; }
  .kpi-label { padding-right: 0; }
  .kpi-wide { grid-column: 1 / -1; }
  .f-sel { flex: 1 1 calc(50% - .3rem); }
  .form-head { position: static; }   /* điện thoại: không dính, để còn chỗ cho nội dung */
  .form-actions { width: 100%; }
  .form-actions .btn-ghost { flex: 1 1 auto; justify-content: flex-start; }   /* hàng 1: Chương (n) + mở trên site */
  .form-actions .btn:not(.btn-ghost) { flex: 1 1 calc(50% - .25rem); min-width: 0; white-space: normal; text-align: center; line-height: 1.25; padding-top: .45rem; padding-bottom: .45rem; } /* hàng 2: hai nút lưu */
  .tbl th, .tbl td { padding: .55rem .5rem; }
  .cmt { grid-template-columns: 22px minmax(0, 1fr); padding: .8rem; }
  .cmt .avatar { display: none; }
  .kv > div { grid-template-columns: minmax(0, 1fr); gap: .15rem; }
  .crop-stage { width: 200px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =====================================================================
   KIỂM DUYỆT · CÀI ĐẶT · SAO LƯU · BẢO MẬT · HỆ THỐNG
   ===================================================================== */
.premod-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1rem; margin-bottom: 1rem; }
.premod-card .sub { display: block; margin-top: .2rem; }
.cmt.st-spam { background: var(--danger-soft); }
.cmt.st-trash { opacity: .7; }
.builtin { margin-top: 1rem; }
.builtin summary { cursor: pointer; color: var(--muted); font-weight: 600; min-height: 32px; }
.st-toc { display: flex; flex-wrap: wrap; gap: .25rem .5rem; padding: .6rem .8rem; margin-bottom: 1rem; position: sticky; top: calc(var(--top-h) + .5rem); z-index: 5; }
.st-toc a { padding: .3rem .6rem; border-radius: var(--r-md); font-weight: 600; font-size: .9rem; text-decoration: none; color: var(--muted); }
.st-toc a:hover, .st-toc a:focus-visible { background: var(--panel-2); color: var(--text); }
.st-sec { scroll-margin-top: calc(var(--top-h) + 4.5rem); margin-bottom: 1rem; }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field > legend { padding: 0; margin-bottom: .25rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .4rem 1rem; }
.check-grid .check { min-height: 36px; }
.color-row:has(.accent-prev) { flex-wrap: wrap; }
.accent-prev { --ap: var(--accent, #6d14c4); display: inline-flex; flex-wrap: wrap; max-width: 100%; align-items: center; gap: .75rem; padding: .35rem .75rem; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
.ap-btn { padding: .3rem .7rem; border-radius: 8px; background: var(--ap); color: #fff; font-weight: 700; font-size: .85rem; }
.ap-link { color: var(--ap); font-weight: 600; text-decoration: underline; font-size: .9rem; }
.ok-text { color: var(--ok); font-weight: 600; }
.err-text { color: var(--danger); font-weight: 600; }
.code-box { max-height: 14rem; overflow: auto; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); font-size: .85rem; }
.brand-tile .sub { display: block; margin-top: .4rem; text-align: center; }
.brand-tile img { max-width: 100%; height: auto; max-height: 48px; width: auto; }
.row-actions { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; }
.page-lang { padding: 0; }
.page-lang > summary { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .8rem 1rem; cursor: pointer; min-height: 44px; }
.page-lang > :not(summary) { margin: 0 1rem 1rem; }
.qr-box { display: inline-block; padding: .5rem; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); line-height: 0; }
.qr-box svg { display: block; width: 196px; height: 196px; }
.secret { letter-spacing: .06em; font-size: .95rem; }
.codes-box { margin: .5rem 0 1rem; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem 1.5rem; margin: .5rem 0 .75rem; padding-left: 1.6rem; font-size: 1rem; }
.codes code { letter-spacing: .08em; }
@media (max-width: 640px) { .codes { grid-template-columns: 1fr; } .row-actions { justify-content: flex-start; } }
@media print { .side, .top, .toasts { display: none !important; } .codes-box { border: 0; } }
.kpi-attn { border-color: var(--warn); }

/* =====================================================================
   CỔNG TÁC GIẢ (/tac-gia) — dùng lại thành phần của khu quản trị, bố cục một cột + thanh trên
   ===================================================================== */
body.au { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.au-top { position: sticky; top: 0; z-index: 20; background: var(--panel); border-bottom: 1px solid var(--line); }
.au-top-in { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; max-width: 72rem; margin: 0 auto; padding: .5rem 1rem; min-height: var(--top-h); }
.au-brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; }
.au-brand .logo-h { height: 30px; }
.au-brand-sub { color: var(--muted); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.au-nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.au-nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 .75rem; border-radius: var(--r-md); color: var(--muted); font-weight: 600; text-decoration: none; }
.au-nav a:hover { background: var(--panel-2); color: var(--text); }
.au-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.au-actions { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.au-main { flex: 1; width: 100%; max-width: 72rem; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; outline: none; }
.au-main.guest-main { display: grid; align-content: start; justify-items: center; padding-top: 2.5rem; }
.au-foot { padding: 1rem; text-align: center; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }
.au-foot a { color: var(--muted); }
.au-reg { max-width: 30rem; }
.au-switch { margin-top: 1rem; text-align: center; }
.au-agree { align-items: flex-start; line-height: 1.5; }
.au-agree input { margin-top: .25rem; flex: none; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.au-novels { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); gap: 1rem; }
.au-novel { display: flex; gap: 1rem; padding: 1rem; }
.au-cover { flex: none; width: 96px; }
.au-cover img, .au-cover-ph { display: block; width: 96px; height: 144px; border-radius: 8px; object-fit: cover; }
.au-cover-ph { background: linear-gradient(160deg, var(--c, #6d14c4), #14123d); }
.au-novel-main { min-width: 0; flex: 1; display: grid; gap: .35rem; align-content: start; }
.au-novel-title { margin: 0; font-size: 1.1rem; line-height: 1.3; overflow-wrap: anywhere; }
.au-novel-title a { color: var(--text); text-decoration: none; }
.au-novel-title a:hover { text-decoration: underline; }
.au-novel-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .25rem; }
.au-status { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .75rem 1rem; margin-bottom: 1rem; }
.au-cover-now { display: block; margin-bottom: .5rem; border-radius: 8px; object-fit: cover; }
.au-spark { display: flex; align-items: flex-end; gap: 2px; height: 56px; margin-top: .75rem; }
.au-spark span { flex: 1; min-width: 2px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .8; }
.au-editor .inp-content { min-height: 50vh; font-size: 1.05rem; line-height: 1.7; }
.au-ed-actions { position: sticky; bottom: 0; z-index: 5; padding: .75rem 0; background: var(--bg); border-top: 1px solid var(--line); }
.au-count { text-align: right; }
.au-term > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; padding: .8rem 1rem; cursor: pointer; min-height: 44px; }
.au-term > form { margin: 0 1rem 1rem; }
.bt-grid td, .bt-grid th { white-space: nowrap; }
.bt-grid th[scope="row"] { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.bt-grid a.chip { text-decoration: none; }
.bt-legend { margin-bottom: .75rem; }
.bt-src { max-height: 70vh; overflow: auto; line-height: 1.7; }
@media (max-width: 640px) {
  .au-novel { flex-direction: column; }
  .au-brand-sub { display: none; }
  .au-nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
}
.au-main.guest-main { min-height: 0; background: none; }
.cr-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-bottom: .5rem; }
.cr-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.cr-item .kv dd.pre { white-space: pre-wrap; }
.rv-cover { flex: none; width: 48px; }
.rv-cover img { display: block; width: 48px; height: 72px; border-radius: 6px; object-fit: cover; }
