:root {
  /* Màu chủ đạo – có thể đổi trong Quản trị → Cấu hình (giao diện tự tính lại các sắc độ) */
  --primary: #2f5d3e;
  --primary-d: #264a32;
  --primary-dd: #1e3b27;
  --primary-soft: #dee5e0;
  --primary-bg: #eef2f0;
  --primary-bg2: #f6f8f6;
  --line: #c9d5cd;
  --line-2: #a1b6a8;
  --cyan: #63866e;
  --p-rgb: 47, 93, 62;
  --pd-rgb: 30, 59, 39;
  --grad: linear-gradient(120deg, #1e3b27 0%, #2f5d3e 55%, #63866e 100%);
  --grad-hover: linear-gradient(120deg, #1a3322, #264a32);
  --hot: #dc2626;
  --paid: #be123c;
  --paid-soft: #ffe4e6;
  --free: #059669;
  --free-soft: #d1fae5;
  --warn-soft: #fef3c7;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .05);
  --shadow-lg: 0 14px 34px rgba(15, 23, 42, .16);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: linear-gradient(135deg, #f8fafc, #ffffff); background-color: var(--bg); color: var(--text); font-size: 16px; line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--primary-d); text-decoration: none; }
a:hover { color: var(--primary-dd); }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.3; color: #111827; }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
main.container { flex: 1; padding-top: 22px; padding-bottom: 44px; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.pre { white-space: pre-wrap; }
.ic { display: inline-flex; vertical-align: -3px; }

/* ================= Header ================= */
#site-header { color: #fff; position: sticky; top: -50px; z-index: 50; padding-top: 12px; }
.hdr-box { background: var(--grad); border-radius: 18px; box-shadow: 0 10px 28px rgba(var(--pd-rgb), .28); position: relative; }
.hdr-box::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.14), transparent 55%); }
.hdr-box > * { position: relative; z-index: 1; }
.hdr-box .navbar { z-index: 2; }
.topbar { height: 38px; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,.18); }
.topbar .in { display: flex; align-items: center; gap: 22px; height: 100%; padding: 0 22px; }
.topbar span, .topbar a { color: #fff; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.topbar .right { margin-left: auto; display: flex; gap: 18px; }
.topbar a:hover { opacity: .85; }
.hdr { display: flex; align-items: center; gap: 24px; height: 82px; padding: 0 22px; position: relative; z-index: 5; }
.logo { display: flex; align-items: center; gap: 12px; color: #fff; min-width: 0; }
.logo:hover { color: #fff; }
.logo .mark { width: 54px; height: 44px; display: grid; place-items: center; flex-shrink: 0; }
.logo .mark img { max-height: 44px; width: auto; }
.logo .t { font-weight: 800; font-size: 21px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo .sub { display: block; font-size: 13px; font-weight: 400; opacity: .92; }
.hdr-search { flex: 1; max-width: 520px; margin: 0 auto; display: flex; align-items: center; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 0 6px 0 18px; transition: background .2s; }
.hdr-search:focus-within { background: rgba(255,255,255,.28); }
.hdr-search input { flex: 1; background: none; border: 0; color: #fff; outline: none; padding: 10px 0; font: inherit; font-size: 14px; min-width: 0; }
.hdr-search input::placeholder { color: rgba(255,255,255,.85); }
.hdr-search button { background: none; border: 0; color: #fff; cursor: pointer; padding: 6px; display: grid; }
.hdr-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.btn-glass { background: rgba(255,255,255,.2); color: #fff; padding: 8px 18px; border-radius: 10px; font-weight: 600; font-size: 14px; white-space: nowrap; border: 1px solid rgba(255,255,255,.25); }
.btn-glass:hover { background: rgba(255,255,255,.3); color: #fff; }
.balance-chip { background: rgba(255,255,255,.2); color: #fff; border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.balance-chip:hover { color: #fff; background: rgba(255,255,255,.3); }
.user-menu { position: relative; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #fff; color: var(--primary-d); display: grid; place-items: center; font-weight: 800; overflow: hidden; flex-shrink: 0; border: 2px solid rgba(255,255,255,.6); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 84px; height: 84px; font-size: 32px; background: var(--primary-soft); border-color: #fff; box-shadow: var(--shadow); }
.dash-nav .avatar { background: var(--primary-soft); border-color: #fff; }
.user-btn { background: none; border: 0; cursor: pointer; padding: 0; display: flex; }
/* Trang soạn bài: nội dung bên trái, cột phải (Lưu + Tệp đính kèm ở trên cùng) */
.ed-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.ed-main > h1 { margin: 0 0 14px; }
.ed-main .card + .card { margin-top: 16px; }
.ed-title { font-size: 18px; font-weight: 700; }
.ed-side { display: flex; flex-direction: column; gap: 14px; }
.ed-box { padding: 16px; margin: 0; }
.ed-box h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 15px; font-weight: 800; color: var(--primary-dd); }
.ed-box h3 .fi { display: flex; color: var(--primary); }
.ed-box h3 .count { background: var(--primary-soft); color: var(--primary-d); border-radius: 999px; font-size: 12px; padding: 1px 8px; }
.ed-box .field { margin-bottom: 12px; }
.ed-publish { border-top: 4px solid var(--primary); }
.ed-save { width: 100%; justify-content: center; padding: 11px; font-size: 15px; }
.ed-pub-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; }
.ed-pub-foot a { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
/* Ô mục con: tìm, chọn hoặc thêm mới trong 1 ô */
.combo { position: relative; }
.combo .input { padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; }
.combo-opt { padding: 8px 12px; border-radius: 7px; cursor: pointer; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.combo-opt.on { background: var(--primary-bg); }
.combo-opt.sel { font-weight: 600; color: var(--primary-d); }
.combo-opt.new { color: var(--primary); border-top: 1px dashed var(--line); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.combo-opt.new .fi { display: flex; }
.combo-empty { padding: 8px 12px; }
.ed-thumb { width: 100%; height: 160px; }
.ed-thumb img { width: 100%; height: 100%; object-fit: cover; }
.input-sm { padding: 7px 10px; font-size: 13.5px; }
.att-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.att-row { border: 1px solid var(--border); border-radius: 10px; padding: 9px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.att-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.att-head .muted { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; }
.att-del { background: none; border: 0; cursor: pointer; color: #be123c; padding: 3px; border-radius: 6px; display: flex; }
.att-del:hover { background: #ffe4e6; }
.att-file { overflow-wrap: anywhere; }
.att-foot { display: flex; align-items: center; gap: 6px; }
.att-foot .input { width: 110px; }
.att-foot .btn { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; }
.att-foot .btn + .btn { margin-left: 0; }
.att-foot .btn .fi { display: flex; }
/* Tệp đã lưu bị khoá: chỉ xem, bấm Sửa mới sửa được */
.att-row.locked .input { background: var(--primary-bg2); border-color: transparent; color: var(--text); cursor: default; box-shadow: none; }
.att-row.locked .input:focus { outline: none; }
.att-row.editing { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--p-rgb), .12); }
.att-name { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.ed-side .att-tabs { display: flex; margin-bottom: 10px; }
.ed-side .att-tabs button { flex: 1; justify-content: center; padding: 7px 8px; font-size: 13px; }
.ed-side .att-link { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.ed-side .att-link .help { margin: 0; }
.ed-side .upload-zone { padding: 14px 10px; font-size: 13.5px; }
@media (max-width: 1100px) {
  .ed-layout { grid-template-columns: 1fr; }
  .ed-side { order: -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
}
@media (hover: none), (max-width: 640px) { .ed-pub-foot .small { display: none; } }

/* Tệp đính kèm: chọn Đường link / Tải lên tệp */
.att-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--primary-bg); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
.att-tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 8px 14px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--primary-d); cursor: pointer; }
.att-tabs button .fi { display: flex; }
.att-tabs button.on { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(var(--p-rgb), .18); }
.att-link { border: 1px dashed var(--line-2); border-radius: 12px; padding: 14px 16px; background: var(--primary-bg2); }
.att-kind { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--primary); }
.att-kind .fi { display: flex; }
.gear-btn {width: 40px; height: 40px; border-radius: 12px; align-items: center; justify-content: center; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); color: #fff; transition: background .2s, border-color .2s; }
.gear-btn .fi { font-size: 20px; line-height: 1; display: flex; transition: transform .45s ease; }
.gear-btn:hover, .gear-btn[aria-expanded="true"] { background: rgba(255,255,255,.24); border-color: rgba(255,255,255,.5); }
.gear-btn:hover .fi { transform: rotate(90deg); }
.gear-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.user-dd { position: absolute; right: 0; top: calc(100% + 10px); background: #fff; color: var(--text); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 230px; padding: 6px; display: none; z-index: 60; }
.user-dd.open { display: block; }
.user-dd .who { padding: 8px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-dd a, .user-dd button { display: block; width: 100%; text-align: left; padding: 9px 12px; color: var(--text); border-radius: 8px; background: none; border: 0; font: inherit; font-size: 14px; cursor: pointer; }
.user-dd a:hover, .user-dd button:hover { background: var(--primary-bg); color: var(--primary-dd); }
.burger { display: none; background: none; border: 0; color: #fff; cursor: pointer; padding: 6px; margin-left: auto; }

.navbar { border-top: 1px solid rgba(255,255,255,.18); }
.navbar .in { display: flex; gap: 4px; height: 50px; align-items: center; padding: 0 12px; }
.navbar .nav-item { height: 38px; }
.navbar .nav-item > a { border-radius: 10px; }
.nav-item { position: relative; display: flex; align-items: center; }
.nav-item > a { color: #fff; padding: 0 14px; height: 100%; display: flex; align-items: center; gap: 7px; font-weight: 500; font-size: 14.5px; border-radius: 0; }
.nav-item > a:hover, .nav-item > a.active { background: rgba(255,255,255,.16); color: #fff; }
.nav-item > a.active { background: rgba(255,255,255,.2); box-shadow: none; }
.dropdown { position: absolute; top: calc(100% + 8px); left: 0; min-width: 240px; background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: none; }
.dropdown::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.nav-item:hover .dropdown { display: block; }
.dropdown a { display: flex; gap: 8px; padding: 8px 12px; color: var(--text); border-radius: 8px; font-size: 14px; }
.dropdown a:hover { background: var(--primary-bg); color: var(--primary-dd); }
.dropdown a.child { padding-left: 28px; color: var(--muted); }

/* Menu trượt (điện thoại) */
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; display: none; }
.drawer { position: fixed; top: 0; bottom: 0; right: 0; width: min(330px, 88vw); background: #fff; color: var(--text); z-index: 91; transform: translateX(100%); transition: transform .22s; overflow-y: auto; padding: 0 0 80px; }
.drawer.open { transform: none; }
.drawer-bg.open { display: block; }
.drawer .dh { background: var(--grad); color: #fff; padding: 18px 16px; display: flex; align-items: center; gap: 10px; }
.drawer .dh b { font-size: 17px; }
.drawer .dh button { margin-left: auto; background: none; border: 0; color: #fff; font-size: 28px; cursor: pointer; line-height: 1; }
.drawer .db { padding: 6px 12px; }
.drawer h4 { margin: 16px 6px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.drawer a { display: flex; gap: 10px; padding: 10px 10px; color: var(--text); border-radius: 10px; font-size: 15px; }
.drawer a.child { color: var(--muted); font-size: 14px; }
.drawer a:hover { background: var(--primary-bg); color: var(--primary-dd); }

/* Thanh điều hướng đáy (điện thoại) */
.bottom-nav { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(15,23,42,.06); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav .in { display: grid; grid-template-columns: repeat(5, 1fr); }
.bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; color: #4b5563; font-size: 12px; background: none; border: 0; font-family: inherit; cursor: pointer; }
.bottom-nav .active { color: var(--primary); }

/* ================= Footer ================= */
#site-footer { margin-top: auto; padding-bottom: 20px; }
.f-box { background: #fff; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid #e2e8f0; }
.f-strip { background: var(--grad); color: #fff; }
.f-strip .in { display: flex; align-items: center; gap: 30px; padding: 14px 24px; flex-wrap: wrap; font-size: 13px; }
.f-strip .it { display: flex; align-items: center; gap: 8px; color: #fff; }
.f-strip .it b { display: block; font-size: 15px; line-height: 1.2; }
.f-strip .it small { opacity: .85; font-size: 11px; }
.f-strip .btn-glass { margin-left: auto; }
.f-main { padding: 30px 0 0; }
.f-main .in { padding: 0 24px; }
.f-cols { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 28px; }
.f-brand { display: flex; gap: 10px; align-items: flex-start; }
.f-brand .t { color: var(--primary-d); font-weight: 800; font-size: 18px; line-height: 1.25; }
.f-brand .mark img { max-height: 40px; }
/* Logo dạng chân dung: khung tròn nền sáng */
.mark img.avatar { width: 48px; height: 48px; max-height: none; max-width: none; flex-shrink: 0; border-radius: 50%; object-fit: cover; object-position: center 18%;
  background: radial-gradient(circle at 50% 35%, #fff, var(--primary-soft)); border: 2px solid rgba(255,255,255,.85); box-shadow: 0 3px 10px rgba(0,0,0,.18); }
.f-brand .mark { flex-shrink: 0; }
.f-brand .mark img.avatar { width: 44px; height: 44px; border-color: var(--line); }
.f-cols h5 { margin: 0 0 12px; font-size: 16px; color: #111827; }
.f-cols a, .f-cols .li { display: flex; gap: 8px; align-items: center; color: #4b5563; padding: 4px 0; font-size: 14px; }
.f-cols a:hover { color: var(--primary-d); }
.f-bottom { border-top: 1px solid var(--border); margin-top: 22px; padding: 16px 0 18px; display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.f-bottom .r { margin-left: auto; display: flex; gap: 18px; }
.f-bottom a { color: var(--muted); }

/* ================= Nút & form ================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: #fff; color: var(--text); padding: 9px 16px; border-radius: 10px; font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1.2; transition: background .15s, box-shadow .15s; }
.btn:hover { background: #f9fafb; color: var(--text); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(var(--p-rgb),.25); }
.btn-primary:hover { background: var(--grad-hover); color: #fff; }
.btn-accent { background: linear-gradient(135deg, #f97316, #ea580c); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(234,88,12,.25); }
.btn-accent:hover { background: linear-gradient(135deg, #ea580c, #c2410c); color: #fff; }
.btn-danger { color: var(--paid); border-color: #fecdd3; }
.btn-danger:hover { background: var(--paid-soft); color: var(--paid); }
.btn-success { background: var(--free); border-color: var(--free); color: #fff; }
.btn-success:hover { background: #047857; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--primary-d); cursor: pointer; padding: 0; font: inherit; }
.btn-round { width: 42px; height: 42px; border-radius: 50%; padding: 0; box-shadow: var(--shadow); border-color: transparent; color: var(--primary-d); }
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; color: #374151; }
.field { margin-bottom: 14px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid #d1d5db; border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 15px; background: #fff; color: var(--text); }
.input:focus { outline: 3px solid rgba(var(--p-rgb),.2); border-color: var(--primary); }
textarea.input { min-height: 90px; resize: vertical; }
.help { font-size: 13px; color: var(--muted); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.check input { margin-top: 5px; accent-color: var(--primary); }

/* ================= Thẻ & khối ================= */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 1px solid #f1f5f9; }
.card + .card { margin-top: 16px; }
.card-title { margin: 0 0 14px; font-size: 18px; }
.section-head { display: flex; align-items: center; gap: 12px; margin: 30px 0 16px; }
.section-head h2 { margin: 0; font-size: 23px; font-weight: 800; }
.section-head h2.ul { font-size: 19px; padding-bottom: 8px; position: relative; }
.section-head h2.ul::after { content: ""; position: absolute; left: 0; bottom: 0; width: 38px; height: 3px; border-radius: 3px; background: var(--primary); }
.section-head .more { margin-left: auto; font-size: 14px; font-weight: 600; display: flex; gap: 4px; align-items: center; }

.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.tag-free { background: var(--free-soft); color: var(--free); }
.tag-paid { background: var(--paid-soft); color: var(--paid); }
.tag-owned { background: var(--primary-soft); color: var(--primary-dd); }
.tag-cat { background: var(--primary); color: #fff; }
.tag-soft { background: var(--primary-bg); color: var(--primary-dd); }
.tag-gray { background: #f3f4f6; color: var(--muted); }
.tag-hot { background: var(--hot); color: #fff; padding: 7px 14px; font-size: 14px; font-weight: 800; box-shadow: 0 4px 10px rgba(220,38,38,.35); }

/* Thẻ bài viết */
.items-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.item-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s; color: inherit; border: 1px solid #f1f5f9; }
.item-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: inherit; }
.thumb { aspect-ratio: 16/10; background: linear-gradient(135deg, #f1f5f9, #e2e8f0); display: grid; place-items: center; overflow: hidden; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.item-card:hover .thumb img { transform: scale(1.04); }
.thumb .ph { color: #94a3b8; }
.thumb .ph svg { width: 54px; height: 54px; }
.thumb .tl { position: absolute; top: 12px; left: 12px; }
.thumb .tr { position: absolute; top: 12px; right: 12px; }
.item-card .body { padding: 18px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.item-card h3 { margin: 0; font-size: 18px; font-weight: 700; color: #111827; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.item-card:hover h3 { color: var(--primary-dd); }
.item-card p { margin: 0; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta-line { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); align-items: center; }
.meta-line span { display: inline-flex; align-items: center; gap: 5px; }
.meta-line .au { color: var(--primary-d); font-weight: 600; }
.item-card .meta-line { margin-top: auto; padding-top: 4px; }

/* Thẻ ngang nhỏ */
.mini { display: flex; gap: 12px; padding: 10px; background: #fff; border-radius: 12px; box-shadow: var(--shadow); color: inherit; border: 1px solid #f1f5f9; transition: box-shadow .15s; }
.mini:hover { box-shadow: var(--shadow-lg); color: inherit; }
.mini .thumb { width: 104px; aspect-ratio: 4/3; flex-shrink: 0; border-radius: 9px; }
.mini .thumb .tl { top: 5px; left: 5px; }
.mini .thumb .tag { font-size: 10.5px; padding: 2px 7px; }
.mini h4 { margin: 0 0 6px; font-size: 14.5px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini:hover h4 { color: var(--primary-dd); }
.mini .meta-line { font-size: 12px; gap: 10px; }

/* ================= Icon (UIcons by Flaticon) ================= */
.fi { display: inline-flex; line-height: 1; vertical-align: -0.12em; }
.fi::before { line-height: 1; }
.fi-lg { font-size: 24px; }
.emo { line-height: 1; }

/* ================= Trang chủ: tổng hợp 24 giờ ================= */
.digest-hero { background: var(--grad); color: #fff; border-radius: var(--radius); padding: 22px 24px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; box-shadow: 0 8px 20px rgba(var(--pd-rgb),.2); }
.digest-hero .dh-icon { width: 58px; height: 58px; border-radius: 16px; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 28px; flex-shrink: 0; }
.digest-hero .dh-text { flex: 1; min-width: 200px; }
.digest-hero h1 { color: #fff; margin: 0; font-size: 26px; font-weight: 800; }
.digest-hero p { margin: 4px 0 0; opacity: .92; font-size: 14px; }
.digest-hero .dh-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.digest-hero .dh-stats div { background: rgba(255,255,255,.18); border-radius: 12px; padding: 8px 14px; text-align: center; min-width: 74px; }
.digest-hero .dh-stats b { display: block; font-size: 20px; line-height: 1.2; }
.digest-hero .dh-stats span { font-size: 12px; opacity: .9; }
.section-head .count, .side-box .count { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-dd); font-size: 13px; font-weight: 700; vertical-align: 3px; }
.section-head .sec-ic { color: var(--primary); font-size: 20px; vertical-align: -2px; }
.empty .empty-ic { font-size: 44px; color: var(--primary); }
.empty h3 { margin: 10px 0 4px; }

.home-grid { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; }

.cat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 14px; }
.cat-tile { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 10px 16px; text-align: center; color: var(--text); border: 1px solid #f1f5f9; transition: transform .15s, box-shadow .15s; }
.cat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: var(--primary-dd); }
.cat-tile .e { font-size: 30px; line-height: 1; height: 36px; color: var(--primary); display: grid; place-items: center; }
.cat-tile .e .fi { width: 54px; height: 54px; margin: -9px auto 0; border-radius: 16px; background: var(--primary-bg); display: grid; place-items: center; font-size: 26px; }
.cat-tile .n { font-size: 14px; font-weight: 600; margin-top: 14px; }
.cat-tile .c { font-size: 12px; color: var(--muted); margin-top: 6px; }
.load-more { display: flex; justify-content: center; margin-top: 26px; }

/* ================= Cột tệp tải về ================= */
.files-box h3 { color: var(--primary-dd); }
.dl-item { border: 1px solid var(--border); border-radius: 12px; padding: 12px; transition: border-color .15s; }
.dl-item + .dl-item { margin-top: 10px; }
.dl-item:hover { border-color: var(--line); }
.dl-top { display: flex; gap: 10px; align-items: flex-start; }
.dl-top .file-ico { width: 40px; height: 40px; font-size: 20px; }
.dl-top .file-info b { font-size: 14px; line-height: 1.35; }
.dl-top .small { margin-top: 3px; gap: 8px; font-size: 12px; }
.dl-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.files-jump { display: none; color: var(--primary-d); font-weight: 600; }
.paywall .pw-ic { font-size: 30px; color: var(--primary); margin-bottom: 4px; }
.page-head .h-ic { color: var(--primary); }
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; max-height: 190px; overflow-y: auto; padding: 4px; border: 1px solid var(--border); border-radius: 10px; }
.icon-pick button { height: 42px; border: 1px solid transparent; background: #f8fafc; border-radius: 9px; font-size: 19px; color: #374151; cursor: pointer; display: grid; place-items: center; }
.icon-pick button:hover { background: var(--primary-bg); color: var(--primary-dd); }
.icon-pick button.on { background: var(--primary); color: #fff; }
.thumb .ph .fi { font-size: 46px; color: #94a3b8; }
.mini .thumb .ph .fi { font-size: 28px; }
.bottom-nav .fi { font-size: 21px; }
.dropdown a .fi, .cat-nav a .fi, .drawer a .fi { color: var(--primary); width: 18px; }
.cat-nav a.active .fi { color: #fff; }
.user-dd .fi { color: var(--primary); margin-right: 4px; }
.dash-nav a .fi { width: 18px; }
.cta .icn { font-size: 20px; }

.side-box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border: 1px solid #f1f5f9; }
.side-box + .side-box { margin-top: 18px; }
.side-box h3 { margin: 0 0 12px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.tag-cloud a { color: var(--primary-d); font-size: 14px; padding: 3px 0; }
.pop a { display: block; padding: 9px 0; border-bottom: 1px solid #f3f4f6; color: var(--text); font-size: 14px; font-weight: 500; }
.pop a:last-child { border: 0; }
.pop a:hover { color: var(--primary-dd); }
.pop small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 2px; }
.cta { background: linear-gradient(135deg, var(--cyan), var(--primary-d)); color: #fff; border-radius: var(--radius); padding: 22px 18px; text-align: center; box-shadow: var(--shadow); }
.cta .icn { width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; margin: 0 auto 10px; }
.cta h3 { color: #fff; margin: 0 0 6px; font-size: 17px; justify-content: center; }
.cta p { margin: 0 0 14px; font-size: 13px; opacity: .92; }
.cta .btn { background: #fff; color: var(--primary-d); border: 0; }

/* ================= Danh sách ================= */
.crumb-bar { background: linear-gradient(135deg, var(--primary-bg), var(--primary-bg2)); border: 1px solid var(--primary-soft); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 20px; font-size: 14px; }
.crumb-bar a, .crumb-bar span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; color: var(--primary-dd); }
.crumb-bar a:hover { background: #fff; }
.crumb-bar .sep { color: #94a3b8; padding: 0 2px; }
.crumb-bar .cur { background: #fff; color: var(--text); box-shadow: var(--shadow); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb-bar .cur::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .page-add { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.page-head .page-add .fi { display: flex; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 800; }
.layout-side { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: start; }
.cat-nav { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; position: sticky; top: 150px; border: 1px solid #f1f5f9; }
.cat-nav a { display: flex; gap: 8px; padding: 9px 12px; border-radius: 9px; color: var(--text); font-size: 14.5px; }
.cat-nav a.child { color: var(--muted); font-size: 14px; }
.cat-nav a:hover { background: var(--primary-bg); color: var(--primary-dd); }
.cat-nav a.active { background: var(--primary); color: #fff; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filters .input { width: auto; flex: 1; min-width: 180px; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.pager button { min-width: 40px; }
.pager button.cur { background: var(--primary); color: #fff; border-color: var(--primary); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }

/* ================= Chi tiết ================= */
.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 26px; align-items: start; }
.article { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; border: 1px solid #f1f5f9; overflow: hidden; }
.article .head { padding: 26px 30px 22px; border-bottom: 1px solid var(--border); }
.article .bodyc { padding: 26px 30px 30px; }
.article h1 { font-size: 34px; font-weight: 800; margin: 14px 0 0; letter-spacing: -.3px; }
.article .meta-line { gap: 18px; }
.article .meta-line .share { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; display: inline-flex; gap: 5px; align-items: center; }
.article .meta-line .share:hover { color: var(--primary-d); }
.article .summary { font-weight: 600; font-size: 17px; color: #374151; margin: 0 0 18px; }
/* Nội dung bài: căn đều 2 bên; khoảng cách giữa các đoạn bằng khoảng cách giữa các dòng (0.75em) */
.content { --gap: .75em; font-size: 16.5px; line-height: 1.75; overflow-wrap: anywhere; text-align: justify; hyphens: manual; }
.content p, .content > div, .content li, .content blockquote, .content figure { margin-top: 0; margin-bottom: var(--gap); }
.content p, .content li, .content > div { line-height: 1.75; text-align: justify; }
.content ul, .content ol { margin: 0 0 var(--gap); padding-left: 1.6em; }
.content li { margin-bottom: calc(var(--gap) / 2); }
.content h1, .content h2, .content h3, .content h4 { text-align: left; line-height: 1.35; margin: 1.2em 0 var(--gap); }
.content:not([contenteditable]) p:empty { display: none; }
.content > :first-child { margin-top: 0; }
.content > :last-child { margin-bottom: 0; }
.content td, .content th, .content figcaption { text-align: left; }
.content img { border-radius: 10px; display: block; margin: 14px auto; }
.content table { border-collapse: collapse; width: 100%; margin: 14px 0; display: block; overflow-x: auto; }
.content td, .content th { border: 1px solid var(--border); padding: 8px 10px; }
.content blockquote { margin: 16px 0; padding: 12px 18px; border-left: 4px solid var(--primary); background: var(--primary-bg); border-radius: 0 10px 10px 0; }
.content pre { background: #f3f4f6; padding: 12px; border-radius: 10px; overflow-x: auto; }
.content h2, .content h3 { color: var(--primary-dd); }
.content iframe { max-width: 100%; }
.preview { position: relative; max-height: 220px; overflow: hidden; color: #4b5563; }
.preview::after { content: ""; position: absolute; inset: auto 0 0 0; height: 120px; background: linear-gradient(transparent, #fff); }
.paywall { border: 2px dashed var(--line-2); background: var(--primary-bg); border-radius: 14px; padding: 26px; text-align: center; margin-top: 12px; }
.paywall .price { font-size: 30px; font-weight: 800; color: var(--paid); margin: 6px 0 14px; }
.files { margin-top: 28px; }
.files h3 { font-size: 18px; margin: 0 0 12px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; transition: border-color .15s; }
.file-row:hover { border-color: var(--line); }
.file-ico { width: 44px; height: 44px; border-radius: 10px; background: var(--primary-bg); color: var(--primary-dd); display: grid; place-items: center; font-size: 11px; font-weight: 800; flex-shrink: 0; text-transform: uppercase; }
.file-info { flex: 1; min-width: 0; }
.file-info b { display: block; overflow-wrap: anywhere; font-size: 15px; }
.file-info .small { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ================= Đăng nhập ================= */
.auth-box { max-width: 440px; margin: 30px auto; }
.auth-box h1 { margin: 0 0 4px; font-size: 25px; }
.auth-box .sub { margin: 0 0 20px; color: var(--muted); }
.auth-box .badge-top { width: 56px; height: 56px; border-radius: 16px; background: var(--grad); display: grid; place-items: center; margin-bottom: 14px; color: #fff; }

/* ================= Cá nhân / Quản trị ================= */
.dash { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: start; }
.dash-nav { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; position: sticky; top: 150px; border: 1px solid #f1f5f9; }
.dash-nav .profile { display: flex; gap: 10px; align-items: center; padding: 8px 8px 14px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dash-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text); border-radius: 9px; font-size: 14.5px; }
.dash-nav a:hover { background: var(--primary-bg); color: var(--primary-dd); }
.dash-nav a.active { background: var(--primary); color: #fff; }
.dash-nav .badge { margin-left: auto; background: var(--hot); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; }
.dash-main { min-width: 0; }
.dash-main > h1 { margin: 0 0 16px; font-size: 25px; font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; border: 1px solid #f1f5f9; border-top: 3px solid var(--primary); }
.stat .n { font-size: 24px; font-weight: 800; color: var(--primary-dd); }
.stat .l { font-size: 13px; color: var(--muted); }
.wallet-hero { background: var(--grad); color: #fff; border-radius: var(--radius); padding: 24px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; box-shadow: 0 8px 20px rgba(var(--pd-rgb),.2); }
.wallet-hero .n { font-size: 34px; font-weight: 800; }
.amount-quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.amount-quick .btn { transition: none; }
.amount-quick .btn.on, .amount-quick .btn.on:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
/* Mã QR nạp tiền */
/* Máy tính: mã QR ở cột phải; điện thoại: mã QR nằm ngay sau ô số tiền/ghi chú */
.topup-grid { margin-top: 14px; }
.topup-grid form { display: grid; grid-template-columns: minmax(0, 1fr) 300px; column-gap: 22px; align-content: start; }
.topup-grid form > * { grid-column: 1; }
.topup-grid form > .qr-box { grid-column: 2; grid-row: 1 / span 9; align-self: start; }
.topup-grid form > .btn { justify-self: start; }
.topup-grid form > label { display: block; font-weight: 700; margin-bottom: 8px; }
.qr-box { border: 1px solid var(--line); background: var(--primary-bg2); border-radius: 14px; padding: 14px; text-align: center; }
.qr-img { position: relative; background: #fff; border-radius: 12px; padding: 8px; min-height: 240px; display: grid; place-items: center; }
.qr-img img { width: 100%; max-width: 260px; display: block; margin: 0 auto; opacity: 0; transition: opacity .25s; }
.qr-img.ready img { opacity: 1; }
.qr-load { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.qr-img.ready .qr-load { display: none; }
.qr-info { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; text-align: left; font-size: 13.5px; margin: 12px 0; }
.qr-info dt { color: var(--muted); }
.qr-info dd { margin: 0; overflow-wrap: anywhere; }
.qr-info .amt { color: var(--primary); font-size: 15px; }
.qr-info .copy { background: none; border: 0; cursor: pointer; color: var(--primary); padding: 0 2px; vertical-align: middle; }
.qr-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 30px 8px; color: var(--muted); font-size: 14px; }
.qr-empty .fi { font-size: 44px; color: var(--line-2); display: flex; }
@media (max-width: 760px) {
  .topup-grid form { grid-template-columns: minmax(0, 1fr); }
  .topup-grid form > .qr-box { grid-column: 1; grid-row: auto; margin-bottom: 16px; }
  .topup-grid form > .btn { justify-self: stretch; }
}
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 10px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:hover td { background: #fafafa; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl .actions { white-space: nowrap; text-align: right; }
.plus { color: var(--free); font-weight: 600; }
.minus { color: var(--paid); font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; color: var(--muted); border: 0; background: none; font: inherit; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs .active { color: var(--primary-dd); border-bottom-color: var(--primary); font-weight: 700; }
.perm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; }
.cat-tree .cat-line { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cat-tree .cat-line .name { flex: 1; min-width: 160px; }

/* ================= Trình soạn thảo ================= */
.editor { border: 1px solid #d1d5db; border-radius: 10px; background: #fff; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); background: #f9fafb; border-radius: 10px 10px 0 0; position: sticky; top: 92px; z-index: 5; }
.editor-toolbar button, .editor-toolbar select { border: 1px solid transparent; background: none; border-radius: 6px; min-width: 32px; height: 32px; cursor: pointer; font: inherit; font-size: 14px; color: #374151; padding: 0 6px; }
.editor-toolbar button:hover { background: var(--primary-soft); }
.editor-toolbar select { border-color: var(--border); background: #fff; }
.editor-toolbar .sep { width: 1px; background: var(--border); margin: 4px 3px; }
.editor-area { min-height: 380px; padding: 16px 18px; outline: none; }
.editor-area:empty::before { content: attr(data-placeholder); color: #9ca3af; }
.editor-src { width: 100%; min-height: 380px; border: 0; padding: 14px; font-family: Consolas, monospace; font-size: 13px; outline: none; resize: vertical; }
.editor-status { padding: 6px 12px; font-size: 13px; border-top: 1px solid var(--border); color: var(--muted); background: #f9fafb; border-radius: 0 0 10px 10px; }
.editor-status.busy { color: #92400e; background: var(--warn-soft); }
.editor-status.ok { color: var(--free); }
.editor-status.err { color: var(--paid); }
.thumb-prev { width: 160px; aspect-ratio: 16/9; border-radius: 10px; background: #f3f4f6; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.thumb-prev img { width: 100%; height: 100%; object-fit: cover; }
.thumb-prev { position: relative; }
.thumb-prev .thumb-note { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; }
.thumb .cover { width: 100%; height: 100%; object-fit: cover; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-bottom: 6px; }
.swatch { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px; border: 2px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer; font: inherit; text-align: left; margin: 0; }
.swatch span, .swatch input[type=color] { width: 100%; height: 38px; border-radius: 8px; display: block; margin-bottom: 4px; }
.swatch input[type=color] { border: 0; padding: 0; background: none; cursor: pointer; }
.swatch b { font-size: 13px; font-weight: 600; color: var(--text); }
.swatch small { font-size: 11px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.swatch:hover { border-color: var(--line-2); }
.swatch.on { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--p-rgb), .18); }
.thumb-prev.logo-prev { width: 120px; aspect-ratio: 1; background: var(--primary); }
.thumb-prev.logo-prev img { object-fit: contain; padding: 10px; }
.upload-zone { border: 2px dashed #cbd5e1; border-radius: 12px; padding: 16px; text-align: center; color: var(--muted); }
.upload-zone.drag { border-color: var(--primary); background: var(--primary-bg); }
.progress { height: 6px; background: #f3f4f6; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--primary); width: 0; transition: width .2s; }

/* ================= Hộp thoại & thông báo ================= */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 720px; }
.modal-h { padding: 18px 22px 0; display: flex; align-items: center; }
.modal-h h3 { margin: 0; font-size: 19px; }
.modal-h .x { margin-left: auto; background: none; border: 0; font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-b { padding: 16px 22px; }
.modal-f { padding: 0 22px 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
#toasts { position: fixed; bottom: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast { background: #1f2937; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; max-width: 380px; animation: tin .2s; }
.toast.ok { background: var(--primary-d); }
.toast.err { background: #be123c; }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }
.notice { padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; }
.notice.warn { background: var(--warn-soft); color: #92400e; }
.notice.info { background: var(--primary-bg); color: var(--primary-dd); border: 1px solid var(--primary-soft); }
.notice.err { background: var(--paid-soft); color: var(--paid); }

/* ================= Responsive ================= */
/* ---------- Thông báo ---------- */
.notif-wrap { position: relative; flex-shrink: 0; }
.bell-btn { position: relative; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); color: #fff; }
.bell-btn .fi { font-size: 19px; display: flex; }
.bell-btn:hover { background: rgba(255,255,255,.24); }
.bell-btn:hover .fi { animation: ring .6s ease; }
@keyframes ring { 0%,100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 45% { transform: rotate(-12deg); } 70% { transform: rotate(6deg); } }
.nt-badge { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: #e11d48; color: #fff; font-size: 11px; font-weight: 800; line-height: 19px; text-align: center; border: 2px solid var(--primary); box-sizing: content-box; }
.notif-dd { position: absolute; right: 0; top: calc(100% + 10px); width: 370px; max-width: calc(100vw - 24px); background: #fff; color: var(--text); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 70; display: none; overflow: hidden; }
.notif-dd.open { display: block; }
.nt-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.nt-head .btn-link { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; background: none; border: 0; cursor: pointer; color: var(--primary); font-family: inherit; }
.nt-list { max-height: 420px; overflow-y: auto; padding: 4px; }
.nt-foot { display: block; text-align: center; padding: 10px; border-top: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.nt-item { display: flex; gap: 11px; padding: 10px; border-radius: 10px; color: var(--text); position: relative; }
.nt-item:hover { background: var(--primary-bg2); color: var(--text); }
.nt-item.unread { background: var(--primary-bg); }
.nt-item.unread::after { content: ''; position: absolute; right: 10px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.nt-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--primary-soft); color: var(--primary); }
.nt-ic .fi { display: flex; font-size: 16px; }
.nt-ic.ok { background: #dcfce7; color: #15803d; }
.nt-ic.bad { background: #ffe4e6; color: #be123c; }
.nt-ic.warn { background: #fef3c7; color: #b45309; }
.nt-tx { display: flex; flex-direction: column; min-width: 0; padding-right: 14px; }
.nt-tx b { font-size: 14px; line-height: 1.35; }
.nt-tx span { font-size: 13px; color: #4b5563; line-height: 1.4; margin-top: 2px; }
.nt-tx small { font-size: 12px; color: var(--muted); margin-top: 3px; }
.nt-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 10px; color: var(--muted); font-size: 14px; }
.nt-empty .fi { font-size: 28px; color: var(--line-2); display: flex; }
.nt-page { padding: 8px; }
.nt-page .nt-item { padding: 12px; }
.nt-page .nt-item + .nt-item { margin-top: 2px; }
.nt-count { background: #e11d48; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 800; padding: 1px 7px; margin-left: 4px; }
.bn-ic { position: relative; display: flex; }
.bn-ic .nt-badge { top: -5px; right: -10px; border-color: #fff; }
.nt-pop { display: flex; gap: 11px; align-items: flex-start; background: #fff; color: var(--text); padding: 12px 14px; border-radius: 14px; box-shadow: var(--shadow-lg); width: 340px; max-width: calc(100vw - 32px); border-left: 4px solid var(--primary); animation: tin .25s; transition: opacity .4s, transform .4s; }
.nt-pop:hover { color: var(--text); }
.nt-pop.out { opacity: 0; transform: translateX(20px); }

@media (max-width: 1100px) {
  .files-jump { display: inline-flex; }
  .detail-grid > aside .files-box { order: -1; }
  .home-grid, .detail-grid { grid-template-columns: 1fr; }
  .home-grid > aside, .detail-grid > aside { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; align-items: start; }
  .side-box + .side-box { margin-top: 0; }
}
@media (max-width: 960px) {
  #site-header { top: -10px; padding-top: 10px; }
  .hdr-box { border-radius: 16px; }
  .hdr { padding: 0 14px 0 16px; }
  .topbar, .navbar, .hdr-search, .hdr-right { display: none; }
  .burger { display: grid; }
  .notif-wrap { margin-left: auto; }
  .notif-wrap + .hdr-right + .burger { margin-left: 0; }
  .notif-dd { position: fixed; left: 12px; right: 12px; top: 74px; width: auto; max-width: none; }
  .hdr { height: 70px; gap: 12px; }
  .logo .t { font-size: 18px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
  .bottom-nav { display: block; }
  body { padding-bottom: 66px; }
  #toasts { bottom: 80px; }
  .items-grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .layout-side, .dash { grid-template-columns: 1fr; }
  .cat-nav, .dash-nav { position: static; display: flex; overflow-x: auto; gap: 6px; padding: 8px; -webkit-overflow-scrolling: touch; }
  .cat-nav a, .dash-nav a { white-space: nowrap; flex-shrink: 0; border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; }
  .cat-nav a.child { padding-left: 14px !important; }
  .dash-nav .profile { display: none; }
  .f-cols { grid-template-columns: 1fr 1fr; }
  .editor-toolbar { top: 70px; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .hdr { height: 64px; }
  .logo .mark { width: 42px; }
  .logo .mark img { max-height: 36px; }
  .logo .t { font-size: 16px; }
  .logo .sub { font-size: 12px; }
  .items-grid { grid-template-columns: 1fr; gap: 16px; }
  .digest-hero { padding: 18px 16px; }
  .digest-hero h1 { font-size: 21px; }
  .digest-hero .dh-stats { width: 100%; }
  .digest-hero .dh-stats div { flex: 1; min-width: 0; padding: 8px 6px; }
  .section-head h2 { font-size: 20px; }
  .article .head, .article .bodyc { padding: 18px 16px; }
  .article h1 { font-size: 25px; }
  .content { font-size: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .perm-grid { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .file-row { flex-wrap: wrap; }
  .file-row .btn { width: 100%; }
  .page-head h1 { font-size: 23px; }
  .editor-toolbar { top: 64px; }
  .f-cols { grid-template-columns: 1fr; }
  .f-strip .in { gap: 14px; padding: 14px 16px; }
  .f-main .in { padding: 0 16px; }
  .f-box { border-radius: 16px; }
  #site-footer { padding-bottom: 12px; }
  .f-bottom .r { margin-left: 0; }
  .tbl { font-size: 13px; }
  .modal-f .btn { flex: 1; }
  .cat-tiles { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .cat-tile { padding: 14px 6px 12px; }
}

/* ===== Ô nhập cùng hàng với tên mục: "Mục: [Phần mềm]" ===== */
.field.inl { display: grid; grid-template-columns: var(--lw, 84px) minmax(0, 1fr); column-gap: 10px; align-items: center; }
.field.inl > label { margin: 0; line-height: 1.3; }
.field.inl.top { align-items: start; }
.field.inl.top > label { padding-top: 10px; }
.field.inl > .help { grid-column: 2; }
.ed-main .field.inl { --lw: 112px; }
.ed-side .field.inl { --lw: 76px; }
.att-edit .field.inl, .att-new .field.inl { --lw: 44px; margin-bottom: 8px; }
.money-in { display: flex; align-items: center; gap: 6px; }
.money-in .input { flex: 1; min-width: 0; }
.money-in span { color: var(--muted); font-size: 13px; }
@media (max-width: 520px) { .ed-main .field.inl { --lw: 84px; } }

/* ===== Tệp đính kèm: dòng thu gọn / ô sửa / ô thêm mới ===== */
.att-item { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 7px 8px 7px 10px; background: #fff; }
.att-ico { color: var(--primary); display: flex; flex-shrink: 0; }
.att-title { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.att-title .tag { font-size: 10.5px; padding: 1px 6px; vertical-align: 1px; }
.att-price { font-weight: 700; color: var(--paid); font-size: 13.5px; white-space: nowrap; }
.att-item .btn { padding: 5px 9px; display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.att-item .btn .fi { display: flex; }
.att-edit, .att-new { border: 1px solid var(--primary); border-radius: 10px; padding: 10px; background: var(--primary-bg2); box-shadow: 0 0 0 3px rgba(var(--p-rgb), .10); }
.att-new { border-style: dashed; box-shadow: none; }
.att-edit-head { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--primary); font-size: 13.5px; margin-bottom: 8px; }
.att-edit-head .fi { display: flex; }
.att-edit-head .muted { margin-left: auto; font-weight: 400; display: inline-flex; gap: 3px; align-items: center; }
.att-actions { display: flex; justify-content: flex-end; gap: 6px; margin: 2px 0 6px; }
.att-actions .btn { display: inline-flex; align-items: center; gap: 5px; }
.att-actions .btn .fi { display: flex; }
.att-new .att-tabs { display: flex; margin-bottom: 10px; }
.att-new .att-tabs button { flex: 1; justify-content: center; padding: 7px 8px; font-size: 13px; }
.att-new .upload-zone { padding: 12px 10px; margin-bottom: 8px; font-size: 13.5px; }
.att-add { justify-content: center; display: flex; align-items: center; gap: 6px; border-style: dashed; color: var(--primary); font-weight: 600; }
.att-add .fi { display: flex; }

/* ===== Sau khi lưu bài ===== */
.ed-saved { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding: 8px 10px; border-radius: 9px; background: var(--free-soft); color: var(--free); font-weight: 600; font-size: 13.5px; }
.ed-saved .fi { display: flex; }
.ed-next { margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; }
.ed-next .fi { display: flex; }

/* ===== Cấu hình: logo và biểu tượng tab ===== */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 16px; }
.brand-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--primary-bg2); display: flex; flex-direction: column; gap: 10px; }
.brand-h { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--primary-d); }
.brand-h .fi { display: flex; }
.brand-btns { gap: 6px; }
.brand-btns .btn { display: inline-flex; align-items: center; gap: 5px; }
.brand-btns .btn .fi { display: flex; }
.brand-box .help { margin: 0; }
.logo-stage { background: var(--grad); border-radius: 12px; height: 96px; display: grid; place-items: center; }
.logo-stage-in { display: grid; place-items: center; }
.logo-stage-in img { max-height: 64px; max-width: 220px; }
.logo-stage-in img.avatar { width: 64px; height: 64px; max-width: none; border-radius: 50%; object-fit: cover; object-position: center 18%;
  background: radial-gradient(circle at 50% 35%, #fff, var(--primary-soft)); border: 2px solid rgba(255,255,255,.85); }
.logo-stage-in span { color: #fff; opacity: .85; font-size: 13px; }
.tab-mock { height: 96px; border-radius: 12px; background: #dfe3e8; padding: 10px 12px 0; display: flex; align-items: flex-end; gap: 14px; position: relative; overflow: hidden; }
.tab-mock-tab { background: #fff; border-radius: 10px 10px 0 0; padding: 9px 12px; display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; max-width: 230px; font-size: 13px; box-shadow: 0 -1px 4px rgba(0,0,0,.06); }
.tab-mock-tab img { width: 16px; height: 16px; object-fit: contain; flex-shrink: 0; }
.tab-mock-tab span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-mock-tab i { font-style: normal; color: #6b7280; }
.tab-mock-big { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 3px; margin-left: auto; padding-bottom: 8px; }
.tab-mock-big img { width: 48px; height: 48px; object-fit: contain; border-radius: 10px; }
.tab-mock-big small { font-size: 11px; color: #4b5563; }
