/* Trang quản trị Cao đẳng HCM */
:root { --red: #e3141b; --red2: #c40f15; --ink: #16181d; --text: #2b2f38; --muted: #6b7280; --line: #e5e7eb; --bg: #f4f5f7; --ok: #16a34a; --warn: #b45309; }
* { box-sizing: border-box; }
body.ad, body.ad-login { margin: 0; font: 14.5px/1.55 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
code { background: #f1f2f4; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

.ad { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.ad-side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: #1e2026; color: #fff; padding: 18px 12px; overflow-y: auto; }
.ad-brand { display: block; padding: 6px 12px 18px; color: #fff; font: 800 20px/1 inherit; text-decoration: none; letter-spacing: .02em; }
.ad-brand small { display: block; margin-top: 4px; font: 500 12px inherit; color: #ff6b70; letter-spacing: 0; }
.ad-nav { display: grid; gap: 2px; }
.ad-nav a { padding: 9px 12px; border-radius: 8px; color: rgba(255, 255, 255, .78); text-decoration: none; font-weight: 500; }
.ad-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.ad-nav a[aria-current="page"] { background: var(--red); color: #fff; }
.ad-me { margin-top: auto; display: grid; gap: 6px; padding: 14px 12px 4px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 13px; }
.ad-me a { color: rgba(255, 255, 255, .8); text-decoration: none; }
.ad-me button { all: unset; cursor: pointer; color: #ff8a8e; }
.ad-main { padding: 24px 32px 60px; min-width: 0; }
.ad-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.ad-head h1 { margin: 0; font-size: 24px; color: var(--ink); }

.ad-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; }
.ad-card--flush { padding: 0; overflow: auto; }
.ad-card h2 { margin: 0 0 12px; font-size: 15.5px; color: var(--ink); }
.ad-card summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.ad-card label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 13px; color: var(--ink); }
.ad-card label input:not([type=checkbox]), .ad-card label select, .ad-card label textarea, .ad-card > textarea, .ad-card > input, details textarea { display: block; width: 100%; margin-top: 5px; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--red); outline: none; box-shadow: 0 0 0 3px rgba(227, 20, 27, .12); }
.ad-muted { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.ad-narrow { max-width: 520px; }
.ad-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.ad-grid2--terms { grid-template-columns: 340px 1fr; }
.ad-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.ad-row label { flex: 1; min-width: 180px; margin: 0; }

.ad-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border: 1px solid var(--red); border-radius: 8px; background: var(--red); color: #fff !important; font: 600 14px inherit; text-decoration: none; cursor: pointer; white-space: nowrap; }
.ad-btn:hover { background: var(--red2); }
.ad-btn--ghost { background: #fff; color: var(--ink) !important; border-color: #d1d5db; }
.ad-btn--ghost:hover { background: #f9fafb; border-color: #9ca3af; }
.ad-btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.ad-btn--danger { background: #fff; color: #b91c1c !important; border-color: #fca5a5; }
.ad-btn--danger:hover { background: #fef2f2; }
.ad-btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ad-link { all: unset; cursor: pointer; color: var(--red); font-size: 13px; }
.ad-link--danger { color: #b91c1c; }
.ad-inline { display: inline; }

.ad-flash { padding: 11px 14px; border-radius: 8px; margin: 0 0 16px; font-weight: 500; }
.ad-flash--ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.ad-flash--err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.ad-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.ad-stat { display: block; padding: 18px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 12px; text-decoration: none; color: var(--text); }
.ad-stat strong { display: block; font-size: 28px; color: var(--ink); }
.ad-list { list-style: none; margin: 0; padding: 0; }
.ad-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ad-list li small { margin-left: auto; color: var(--muted); white-space: nowrap; }

.ad-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ad-tabs { display: flex; gap: 4px; }
.ad-tabs a { padding: 7px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
.ad-tabs a[aria-current="page"] { background: #fff; color: var(--red); box-shadow: 0 0 0 1px var(--line); }
.ad-search { display: flex; gap: 8px; margin-bottom: 14px; }
.ad-toolbar .ad-search { margin: 0; }
.ad-table { width: 100%; border-collapse: collapse; }
.ad-table th, .ad-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.ad-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafafa; }
.ad-table tr:hover td { background: #fcfcfd; }
.ad-card--flush .ad-table { min-width: 940px; }
.ad-title { font-weight: 700; color: var(--ink); text-decoration: none; }
.ad-rowact { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.ad-badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #f3f4f6; color: #374151; white-space: nowrap; }
.ad-badge--published { background: #ecfdf5; color: #047857; }
.ad-badge--draft { background: #fef3c7; color: #92400e; }
.ad-badge--future { background: #eff6ff; color: #1d4ed8; }
.ad-pager { display: flex; gap: 6px; align-items: center; margin: 14px 0; }
.ad-pager a, .ad-pager span { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.ad-pager span { background: var(--red); color: #fff; border-color: var(--red); }
.ad-pager em { margin-left: 6px; color: var(--muted); font-style: normal; }

/* Soạn bài */
.ad-edit { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
.ad-edit__side { position: sticky; top: 16px; }
.ad-titlein { width: 100%; font-size: 24px !important; font-weight: 700; padding: 12px 14px !important; margin-bottom: 8px; }
.ad-slug { display: flex; align-items: center; gap: 2px; margin: 0 0 14px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.ad-slug input { padding: 4px 8px; font-size: 13px; min-width: 260px; }
.ad-editor { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 18px; }
.ad-tb { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 2px; padding: 8px; border-bottom: 1px solid var(--line); background: #fafafa; border-radius: 12px 12px 0 0; }
.ad-tb button { min-width: 34px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; font: 600 13px inherit; color: var(--ink); }
.ad-tb button:hover { background: #fff; border-color: var(--line); }
.ad-tb__src { margin-left: auto; }
.ad-tb button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.ad-visual { min-height: 460px; padding: 20px 26px; outline: none; font-size: 16px; line-height: 1.8; }
.ad-visual img { max-width: 100%; height: auto; }
.ad-visual:empty::before { content: "Viết nội dung ở đây…"; color: #9ca3af; }
.ad-code { width: 100%; font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; padding: 14px; border-radius: 0 0 12px 12px; border: 0; background: #0f172a; color: #e2e8f0; tab-size: 2; }
.ad-card .ad-code { border-radius: 8px; }
.ad-code.is-bad { box-shadow: 0 0 0 2px #ef4444; }
.ad-checks { max-height: 240px; overflow-y: auto; }
.ad-check { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; margin: 0 0 6px !important; }
.ad-feat img { display: block; width: 100%; border-radius: 8px; margin-bottom: 8px; }
.ad-serp { padding: 12px 14px; border: 1px dashed var(--line); border-radius: 8px; }
.ad-serp span { display: block; color: #1a0dab; font-size: 17px; }
.ad-serp em { display: block; color: #006621; font-size: 13px; font-style: normal; }
.ad-serp p { margin: 4px 0 0; color: #545454; font-size: 13px; }
.ad-count { float: right; color: var(--muted); font-weight: 400; }
.ad-count.is-over { color: #b91c1c; }
.ad-danger { border-color: #fecaca; }

/* Thư viện ảnh */
.ad-upload { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.ad-upload label { flex: 1; margin: 0; }
.ad-upload p { width: 100%; margin: 0; }
.ad-mlib { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.ad-mitem { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.ad-mitem img, .ad-mfile { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #f3f4f6; color: var(--muted); font-size: 12px; }
.ad-mitem figcaption { padding: 8px; display: grid; gap: 4px; }
.ad-mitem input { width: 100%; padding: 4px 6px; font-size: 11.5px; }

.ad-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(15, 23, 42, .55); padding: 20px; }
.ad-modal[hidden] { display: none; }
.ad-modal__box { width: min(1000px, 100%); max-height: 88vh; display: flex; flex-direction: column; background: #fff; border-radius: 14px; overflow: hidden; }
.ad-modal__box header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ad-modal__box header strong { margin-right: auto; }
.ad-modal__box footer { padding: 10px 16px; border-top: 1px solid var(--line); text-align: center; }
.ad-x { all: unset; cursor: pointer; font-size: 26px; line-height: 1; padding: 0 6px; }
.ad-mgrid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; padding: 14px; }
.ad-mgrid button { all: unset; cursor: pointer; border-radius: 8px; overflow: hidden; border: 2px solid transparent; background: #f3f4f6; aspect-ratio: 1; display: grid; place-items: center; font-size: 11px; color: var(--muted); text-align: center; }
.ad-mgrid button:hover, .ad-mgrid button:focus-visible { border-color: var(--red); }
.ad-mgrid img { width: 100%; height: 100%; object-fit: cover; }

.ad-steps { padding-left: 20px; }
.ad-log { max-height: 420px; overflow: auto; background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 8px; font: 12.5px/1.55 ui-monospace, Consolas, monospace; white-space: pre-wrap; }
progress { width: 100%; height: 10px; accent-color: var(--red); margin-bottom: 10px; }

/* Đăng nhập */
.ad-login { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(135deg, #1e2026, #3a0d10); }
.ad-loginbox { width: min(380px, calc(100% - 32px)); padding: 28px; }
.ad-loginbox h1 { margin: 0; color: var(--red); font-size: 26px; letter-spacing: .03em; }
.ad-loginbox > p { margin: 2px 0 18px; color: var(--muted); }
.ad-loginbox .ad-btn { width: 100%; height: 44px; margin: 4px 0 12px; }
.ad-loginbox > a { font-size: 13px; color: var(--muted); }
.ad-stat { transition: transform .15s ease, box-shadow .15s ease; }
.ad-stat:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(22, 24, 29, .07); }
.ad-toolbar .ad-search select { min-width: 160px; }

@media (max-width: 980px) {
  .ad { grid-template-columns: 1fr; }
  .ad-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .ad-nav { display: flex; flex-wrap: wrap; }
  .ad-me { margin: 0; border: 0; padding: 8px 12px; display: flex; gap: 14px; }
  .ad-main { padding: 18px 14px 60px; }
  .ad-edit, .ad-grid2, .ad-grid2--terms { grid-template-columns: 1fr; }
  .ad-edit__side { position: static; }
  .ad-stats { grid-template-columns: 1fr 1fr; }
}

/* Thống kê truy cập + Content SEO */
.ad-chart { display: flex; align-items: flex-end; gap: 2px; height: 160px; }
.ad-chart div { flex: 1; height: 100%; min-width: 0; background: rgba(0, 0, 0, .03); }
.ad-chart svg { display: block; width: 100%; height: 100%; fill: #d9232a; }
.ad-bars { list-style: none; margin: 0; padding: 0; }
.ad-bars li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin-bottom: 10px; }
.ad-bars li span { overflow-wrap: anywhere; }
.ad-bars progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: #d9232a; }
.ad-audit { list-style: none; margin: 0; padding: 0; }
.ad-audit li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid rgba(0, 0, 0, .07); }
.ad-audit li > span:not(.ad-sr) { flex: 1; }
.ad-audit i { font-style: normal; font-weight: 700; width: 16px; }
.ad-audit .is-ok i { color: #15803d; }
.ad-audit .is-no i { color: #b91c1c; }
.ad-audit small { color: #64748b; }
.ad-audit em { display: block; font-style: normal; font-size: 13px; color: #92400e; }
.ad-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ad-badge--low { background: #fee2e2; color: #991b1b; }
.ad-up { color: #15803d; white-space: nowrap; }
.ad-down { color: #b91c1c; white-space: nowrap; }
.ad-badge--low { background: #fee2e2; color: #991b1b; }
/* Công cụ SEO: menu con, phần đầu trang, lưới chức năng */
.ad-nav .ad-mg { display: flex; align-items: center; gap: 8px; }
.ad-nav .ad-mg svg { width: 18px; height: 18px; flex: none; }
.ad-nav .ad-mg.is-open { background: #e3141b; color: #fff; }
.ad-mgsub { display: flex; flex-direction: column; margin: 2px 0 8px; padding: 4px 0 4px 12px; border-radius: 8px; background: rgba(0, 0, 0, .28); }
.ad-nav .ad-mgsub a { padding: 6px 10px; font-size: 13px; font-weight: 500; background: transparent; opacity: .8; }
.ad-nav .ad-mgsub a:hover { opacity: 1; }
.ad-nav .ad-mgsub a[aria-current="page"] { background: transparent; color: #fff; font-weight: 700; opacity: 1; }
.ad-mghero { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 26px; border-radius: 14px; background: linear-gradient(115deg, #161b29, #2f384d); color: #fff; }
.ad-mghero span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em; color: #ff8a7a; }
.ad-mghero strong { display: block; margin: 4px 0; font-size: 26px; font-weight: 700; }
.ad-mghero p { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .8); }
.ad-mghero b { display: grid; place-items: center; flex: none; width: 62px; height: 46px; border-radius: 12px; background: #e3141b; font-size: 22px; }
.ad-mglabel { margin: 16px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #64748b; }
.ad-mgtiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; padding: 14px; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; }
.ad-mgtiles a { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 8px 14px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; color: #1e293b; font-size: 13px; font-weight: 600; text-decoration: none; transition: border-color .15s, transform .15s; }
.ad-mgtiles a:hover { border-color: #e3141b; transform: translateY(-1px); }
.ad-mgtiles a[aria-current="page"] { border-color: #c40f15; background: linear-gradient(135deg, #e3141b, #b80c12); color: #fff; box-shadow: 0 8px 18px -10px rgba(227, 20, 27, .8); }
.ad-mgtiles svg { width: 20px; height: 20px; flex: none; }
.ad-big { font-size: 30px; }
a.ad-stat { text-decoration: none; color: inherit; }
@media (max-width: 1250px) { .ad-mgtiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px) { .ad-mgtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ad-mghero b { display: none; } }
