/* cm-ui: ColorME design system for redesigned (non-landing) pages. Docs + the CLEAN RULES: docs/redesign/DESIGN-SYSTEM.md
   Everything is scoped under .cm-ui, so landing pages and unconverted pages never change. Include: @include('components.colorme.ui.styles') */

/* ---------- 1. Tokens ---------- */
.cm-ui {
    /* Colours, type sizes, font, radius, focus ring and shadows come from the root tokens (public/css/cm-tokens.css),
       so cm-ui pages follow light/dark. Only the page rhythm lives here. */
    --cm-gap: 20px;                    /* grid gutter (32px from 768) */
    --cm-row-gap: 32px;                /* grid row gap, card text included (40px from 768) */
    --cm-section: 56px;                /* between major sections (72px from 992). Related blocks: --cm-block */
    --cm-block: 32px;                  /* between related blocks (40px from 992) */
    --cm-top: 32px;                    /* page top, same on every page (48px from 768) */
    --cm-head: 32px;                   /* page head -> content (40px from 768) */
    --cm-rail: 320px;                  /* side rail width on detail pages (from 992) */

    font-family: var(--cm-font);
    font-size: var(--cm-fs-body);
    line-height: 1.6;
    color: var(--cm-text);
    background: var(--cm-bg);
    -webkit-font-smoothing: antialiased;
}
@media (min-width: 768px) { .cm-ui { --cm-gap: 32px; --cm-row-gap: 40px; --cm-top: 48px; --cm-head: 40px; } }
@media (min-width: 992px) { .cm-ui { --cm-section: 72px; --cm-block: 40px; } }
.cm-ui *, .cm-ui *::before, .cm-ui *::after { box-sizing: border-box; }
.cm-ui a { color: inherit; text-decoration: none; }
.cm-ui button { font-family: inherit; }
.cm-ui img { max-width: 100%; }
.cm-ui [hidden] { display: none !important; }
.cm-ui :focus-visible { outline: 2px solid var(--cm-focus-color); outline-offset: 2px; border-radius: 6px; }
.cm-ui .cm-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 2. Layout ---------- */
.cm-ui .cm-page { padding-top: var(--cm-top); padding-bottom: 64px; }
.cm-ui.min-h-screen { min-height: 0 !important; }             /* no empty band above the footer on short pages */
/* one container site-wide: Bootstrap default (1320px), same as header, footer and landing pages */
.cm-ui .cm-narrow { max-width: 720px; margin-left: auto; margin-right: auto; }
.cm-ui .cm-section { margin-top: var(--cm-section); }
.cm-ui .cm-grid { display: grid; gap: var(--cm-row-gap) var(--cm-gap); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 576px) { .cm-ui .cm-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 992px) { .cm-ui .cm-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* image grids (portfolio, people, palettes): 2 on phones, 3 from 768. Bigger images, never 4 across */
.cm-ui .cm-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
@media (min-width: 768px) { .cm-ui .cm-grid--4 { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--cm-gap); } }
@media (min-width: 1200px) { .cm-ui .cm-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cm-ui .cm-grid > .cm-empty { grid-column: 1 / -1; }
/* adapt to the item count: 1-2 items -> 2 wide columns, never a third of a row with a blank band beside it */
@media (min-width: 768px) {
    .cm-ui .cm-grid--3:not(:has(> :nth-child(3))), .cm-ui .cm-grid--4:not(:has(> :nth-child(3))) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* main + side rail (detail pages): 8/4, rail sticky; one column on phones (rail after main) */
.cm-ui .cm-layout { display: grid; gap: var(--cm-section) 48px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 992px) {
    .cm-ui .cm-layout { grid-template-columns: minmax(0, 1fr) var(--cm-rail); }
    .cm-ui .cm-rail--sticky { position: sticky; top: 88px; }   /* only for short rails */
}
@media (min-width: 1200px) { .cm-ui { --cm-rail: 360px; } }
.cm-ui .cm-rail > * + * { margin-top: var(--cm-block); }
.cm-ui .cm-rail__title { margin: 0 0 12px; font-size: var(--cm-fs-body); font-weight: 600; line-height: 1.4; }
.cm-ui .cm-rail__card { padding: 24px; border-radius: var(--cm-radius-lg); background: var(--cm-surface-2); }
.cm-ui .cm-rail__card > * { margin: 0; }
.cm-ui .cm-rail__card > * + * { margin-top: 12px; }
.cm-ui .cm-block { margin-top: var(--cm-block); }
.cm-ui .cm-divider { height: 1px; border: 0; margin: 0; background: var(--cm-line); opacity: 1; }

/* ---------- 3. Type: title / body / small, 400 / 600, ink / muted ---------- */
.cm-ui .cm-h1 { margin: 0; font-size: var(--cm-fs-title); font-weight: var(--cm-fw-heading, 700); line-height: 1.2; letter-spacing: -0.02em; color: var(--cm-text); }
.cm-ui .cm-h2 { margin: 0 0 32px; font-size: var(--cm-fs-h2); font-weight: var(--cm-fw-heading, 700); line-height: 1.3; letter-spacing: -0.01em; color: var(--cm-text); }
.cm-ui .cm-muted { color: var(--cm-muted); }
.cm-ui .cm-small { font-size: var(--cm-fs-small); line-height: 1.5; color: var(--cm-muted); }
.cm-ui .cm-num { font-variant-numeric: tabular-nums; }
.cm-ui .cm-clamp-2 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.cm-ui .cm-link { color: inherit; text-decoration: underline; text-decoration-color: var(--cm-line); text-underline-offset: 3px; }
.cm-ui .cm-link:hover { text-decoration-color: currentColor; }
.cm-ui .cm-text-btn { padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }

/* page head: title + one line, an optional control on the right (search) */
.cm-ui .cm-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: var(--cm-head); }
.cm-ui .cm-head__text { flex: 1 1 320px; min-width: 0; }
.cm-ui .cm-head__sub { margin: 10px 0 0; font-size: var(--cm-fs-body); line-height: 1.55; color: var(--cm-muted); max-width: 60ch; }
@media (max-width: 767.98px) { .cm-ui .cm-head__sub { font-size: var(--cm-fs-body); } }
.cm-ui .cm-head > .cm-search { flex: 0 1 320px; }
@media (max-width: 767.98px) { .cm-ui .cm-head > .cm-search { flex-basis: 100%; } }

/* ---------- 4. Buttons ---------- */
.cm-ui .cm-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
    border: 0; border-radius: var(--cm-radius); background: var(--cm-surface); color: var(--cm-text); box-shadow: inset 0 0 0 1px var(--cm-line);
    font: inherit; font-size: var(--cm-fs-small); font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer; transition: background-color .15s, opacity .15s;
}
.cm-ui .cm-btn:hover { background: var(--cm-surface-2); }
.cm-ui .cm-btn[disabled] { opacity: .5; pointer-events: none; }
.cm-ui .cm-btn--primary { background: var(--cm-grad); color: var(--cm-on-grad, #fff); box-shadow: none; }
.cm-ui .cm-btn--primary:hover { background: var(--cm-grad); opacity: .92; }
.cm-ui .cm-btn--zoom { background: #0B5CFF; color: #fff; box-shadow: none; }      /* Zoom brand button (fixed colour, same in both themes) */
.cm-ui .cm-btn--zoom:hover { background: #0A4FE0; color: #fff; }
.cm-ui .cm-btn--zoom svg { flex: 0 0 auto; width: 18px; height: 18px; }
.cm-ui .cm-btn--ghost { background: transparent; box-shadow: none; color: var(--cm-muted); }
.cm-ui .cm-btn--ghost:hover { color: var(--cm-text); }
.cm-ui .cm-btn--icon { width: 40px; padding: 0; }
.cm-ui .cm-btn .icon { font-size: 16px; }
.cm-ui .cm-btn.dropdown-toggle::after { display: none; }

/* ---------- 5. Text tabs (profile sections, blog categories) + segmented control ---------- */
.cm-ui .cm-tabs { display: flex; gap: 32px; margin: 0; padding: 0; list-style: none; border-bottom: 1px solid var(--cm-line);
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cm-ui .cm-tabs::-webkit-scrollbar { display: none; }
/* tabs that overflow (cm-ui.js sets .is-overflow / .is-end): fade the cut-off edge instead of chopping a word */
.cm-ui .cm-tabs.is-overflow:not(.is-end) { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent); }
.cm-ui .cm-tabs > li { flex: 0 0 auto; }
.cm-ui .cm-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 46px; padding: 0; border: 0; background: none;
    color: var(--cm-muted); font-size: var(--cm-fs-body); font-weight: 400; white-space: nowrap; cursor: pointer; }
.cm-ui .cm-tab:hover { color: var(--cm-text); }
.cm-ui .cm-tab.active, .cm-ui .cm-tab[aria-selected="true"], .cm-ui .cm-tab[aria-current] { color: var(--cm-text); font-weight: 600; }
.cm-ui .cm-tab.active::after, .cm-ui .cm-tab[aria-selected="true"]::after, .cm-ui .cm-tab[aria-current]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--cm-text); }
.cm-ui .cm-tab:focus-visible { outline-offset: 4px; border-radius: 6px; } /* vong focus thoang, khong om sat chu (chu 09/10) */
.cm-ui .cm-tabs.nav { flex-wrap: nowrap; }                        /* cm-tabs on Bootstrap pill/tab markup (data-bs-target) */
.cm-ui .cm-tab.tab-view.active { background-color: transparent !important; color: var(--cm-text) !important; } /* legacy .tab-view.active (black pill) css */
.cm-ui .cm-tab.filter-item { width: auto !important; height: 52px !important; }                   /* app.css squeezes .filter-item to 35px on phones */
.cm-ui .cm-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--cm-radius); background: var(--cm-surface-2); }
.cm-ui .cm-seg button, .cm-ui .cm-seg > a { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: var(--cm-muted); font-size: var(--cm-fs-small); font-weight: 600; cursor: pointer; white-space: nowrap; }
.cm-ui .cm-seg button:hover, .cm-ui .cm-seg > a:hover { color: var(--cm-text); }
.cm-ui .cm-seg button[aria-pressed="true"], .cm-ui .cm-seg > a[aria-pressed="true"], .cm-ui .cm-seg > a[aria-current] { background: var(--cm-elevated); color: var(--cm-text); box-shadow: var(--cm-shadow-1); }
/* one row of controls; scrolls instead of wrapping on phones */
.cm-ui .cm-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 40px; }
.cm-ui .cm-controls > .cm-search { margin-left: auto; flex: 0 1 280px; }
@media (max-width: 767.98px) { .cm-ui .cm-controls > .cm-search { flex-basis: 100%; margin-left: 0; order: -1; } }

/* ---------- 6. Forms ---------- */
.cm-ui .cm-input, .cm-ui .cm-select {
    width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--cm-line); border-radius: var(--cm-radius); background: var(--cm-surface);
    color: var(--cm-text); font: inherit; font-size: var(--cm-fs-body); -webkit-appearance: none; appearance: none; transition: border-color .15s, box-shadow .15s;
}
.cm-ui .cm-input::placeholder { color: var(--cm-muted); }
.cm-ui .cm-input:focus, .cm-ui .cm-select:focus { outline: none; border-color: var(--cm-focus-color); box-shadow: var(--cm-focus); }
.cm-ui .cm-select { width: auto; padding-right: 36px; font-size: var(--cm-fs-small); font-weight: 600;
    background: var(--cm-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23667085' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right 14px center; }
/* search: the icon is the control's label */
.cm-ui .cm-search { position: relative; display: flex; align-items: center; min-width: 0; }
.cm-ui .cm-search > .icon { position: absolute; left: 14px; color: var(--cm-muted); pointer-events: none; }
.cm-ui .cm-search .cm-input { padding-left: 40px; }

/* ---------- 7. Images + cards: image, title, one quiet line ---------- */
.cm-ui .cm-media { position: relative; display: block; overflow: hidden; aspect-ratio: 4 / 3; border-radius: var(--cm-radius-lg); background: var(--cm-surface-2); }
.cm-ui .cm-media > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; color: transparent; transition: transform .3s ease; }
.cm-ui .cm-media--square { aspect-ratio: 1 / 1; }
/* image failed or missing (cm-ui.js adds .is-broken + data-initial): a soft tint with the item's initial, not a grey void.
   Pastel category tints + a dark initial: a fixed-colour surface, identical in both themes. */
.cm-ui .is-broken[data-tint] { background: #FDEEE8; }
.cm-ui .is-broken[data-tint="1"] { background: #EAF1FB; }
.cm-ui .is-broken[data-tint="2"] { background: #EAF6EE; }
.cm-ui .is-broken[data-tint="3"] { background: #F3EEFB; }
.cm-ui .is-broken[data-tint="4"] { background: #FBF3E3; }
.cm-ui .is-broken > img, .cm-ui .is-broken > .card-img { visibility: hidden; }
.cm-ui .is-broken::after { content: attr(data-initial); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 48px; font-weight: 600; line-height: 1; color: rgba(16, 24, 40, .28); pointer-events: none; }
.cm-ui .cm-media--wide { aspect-ratio: 16 / 9; }
.cm-ui a:hover > .cm-media > img, .cm-ui .cm-post:hover .cm-media > img { transform: scale(1.02); }
.cm-ui .cm-post { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cm-ui .cm-post__title { margin: 0; font-size: var(--cm-fs-body); font-weight: 600; line-height: 1.45; color: var(--cm-text); }
.cm-ui .cm-post__title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.cm-ui .cm-post__excerpt { margin: 8px 0 0; color: var(--cm-muted); }
.cm-ui .cm-post__meta { margin: 4px 0 0; font-size: var(--cm-fs-small); color: var(--cm-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-ui .cm-post__meta a:hover { color: var(--cm-text); }
/* feature: big image + title + excerpt, side by side from 992 */
.cm-ui .cm-post--feature { gap: 20px; }
.cm-ui .cm-post--feature .cm-media { aspect-ratio: 16 / 9; }
.cm-ui .cm-post--feature .cm-post__title { font-size: clamp(24px, 1rem + 1.2vw, 32px); line-height: 1.25; letter-spacing: -0.02em; }
.cm-ui .cm-post__kicker { margin: 0 0 8px; font-size: var(--cm-fs-small); color: var(--cm-muted); }
.cm-ui .cm-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
/* row: small image left + title (side column next to a lead post) */
.cm-ui .cm-post--row { flex-direction: row; align-items: flex-start; gap: 16px; }
.cm-ui .cm-post--row > .cm-media { flex: 0 0 128px; border-radius: 12px; }
.cm-ui .cm-post--row > div { flex: 1 1 auto; min-width: 0; }
@media (min-width: 1200px) { .cm-ui .cm-post--row > .cm-media { flex-basis: 200px; } }
/* lead block: 1 big post (7) + up to 3 stacked rows (5); fills the row instead of a floating text block */
.cm-ui .cm-lead { display: grid; gap: var(--cm-row-gap) var(--cm-gap); margin-bottom: var(--cm-section); }
.cm-ui .cm-lead__side { display: grid; gap: 24px; align-content: start; }
@media (min-width: 992px) { .cm-ui .cm-lead { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 48px; } .cm-ui .cm-lead__side { grid-template-rows: repeat(3, auto); align-content: space-between; } }

/* avatar (always PigAvatar: src = PigAvatar::forUser, data-pig-seed = PigAvatar::seedOf) */
.cm-ui .cm-avatar { flex: 0 0 auto; display: inline-block; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--cm-surface-2); vertical-align: middle; }
.cm-ui .cm-avatar--xs { width: 20px; height: 20px; }
.cm-ui .cm-avatar--lg { width: 72px; height: 72px; }

/* pills: certificates, skills, tags (one quiet row; "+N" reveals the rest via cm-ui.js) */
.cm-ui .cm-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.cm-ui .cm-pill { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--cm-surface-2);
    color: var(--cm-text); font-size: var(--cm-fs-small); white-space: nowrap; cursor: default; }
.cm-ui a.cm-pill, .cm-ui button.cm-pill { cursor: pointer; }
.cm-ui a.cm-pill:hover, .cm-ui button.cm-pill:hover { background: var(--cm-surface-3); }
.cm-ui .cm-pill--more { background: transparent; box-shadow: inset 0 0 0 1px var(--cm-line); color: var(--cm-muted); }

/* ---------- 8. Empty state + load more ---------- */
.cm-ui .cm-empty { padding: 56px 16px; text-align: center; }
.cm-ui .cm-empty__title { margin: 0; font-size: var(--cm-fs-h2); font-weight: 600; line-height: 1.3; }
.cm-ui .cm-empty__text { margin: 8px auto 0; max-width: 44ch; color: var(--cm-muted); }
.cm-ui .cm-empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.cm-ui .cm-loadmore { display: flex; padding-top: var(--cm-block); }
/* cuon vo han: khung xuong cung hinh the that (cm-ui.js cmInfinite), sentinel, "Thu lai" */
.cm-ui .cm-skel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cm-ui .cm-skel__img { aspect-ratio: 4 / 3; border-radius: var(--cm-r-img, 16px); }
.cm-ui .cm-skel__img, .cm-ui .cm-skel__line, .cm-ui .cm-skel__dot { position: relative; overflow: hidden; background: var(--cm-skeleton); }
.cm-ui .cm-skel__line { display: block; height: 12px; width: 80%; border-radius: 6px; }
.cm-ui .cm-skel__line + .cm-skel__line { margin-top: -4px; }
.cm-ui .cm-skel__row { display: flex; align-items: center; gap: 8px; }
.cm-ui .cm-skel__dot { width: 20px; height: 20px; border-radius: 50%; flex: 0 0 20px; }
.cm-ui .cm-skel__rowitem { display: flex; gap: 16px; align-items: center; }
.cm-ui .cm-skel__img::after, .cm-ui .cm-skel__line::after, .cm-ui .cm-skel__dot::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, var(--cm-skel-shine, rgba(255, 255, 255, .55)), transparent); animation: cm-shimmer 1.4s ease-in-out infinite; }
:root[data-theme="dark"] .cm-ui { --cm-skel-shine: rgba(255, 255, 255, .06); }
@keyframes cm-shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .cm-ui .cm-skel__img::after, .cm-ui .cm-skel__line::after, .cm-ui .cm-skel__dot::after { animation: none; display: none; } }
.cm-ui .cm-inf-sentinel { height: 1px; }
.cm-ui .cm-inf-retry { margin: var(--cm-block) 0 0; text-align: center; font-size: var(--cm-fs-body-sm, 14px); color: var(--cm-muted); }
.cm-ui .cm-loadmore a, .cm-ui .cm-loadmore button { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; height: 48px; padding: 0 16px; border: 0; border-radius: var(--cm-radius);
    background: var(--cm-surface-2); color: var(--cm-text); font: inherit; font-size: var(--cm-fs-small); font-weight: 600; cursor: pointer; }
.cm-ui .cm-loadmore a:hover, .cm-ui .cm-loadmore button:hover { background: var(--cm-surface-3); }
.cm-ui .cm-loadmore .is-loading { opacity: .5; pointer-events: none; }

/* ---------- 9. Person header (profile): no box, left aligned ---------- */
.cm-ui .cm-person { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "avatar actions" "body body"; gap: 24px; align-items: start; }
.cm-ui .cm-person > :first-child { grid-area: avatar; }
.cm-ui .cm-person__body { grid-area: body; min-width: 0; }
.cm-ui .cm-person__body > * { margin: 0; }
.cm-ui .cm-person__body > * + * { margin-top: 8px; }
.cm-ui .cm-person__bio { max-width: 60ch; white-space: pre-line; }
.cm-ui .cm-person__actions { grid-area: actions; display: flex; justify-content: flex-end; gap: 8px; align-self: center; }
.cm-ui .cm-person .cm-pills { padding-top: 8px; }
@media (min-width: 768px) {
    .cm-ui .cm-person { grid-template-columns: 72px minmax(0, 1fr) auto; grid-template-areas: "avatar body actions"; }
    .cm-ui .cm-person__actions { align-self: start; }
}
.cm-ui .cm-avatar-edit { position: relative; display: inline-block; }
.cm-ui .cm-avatar-edit__btn { position: absolute; right: -4px; bottom: -4px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--cm-elevated);
    color: var(--cm-text); box-shadow: 0 0 0 1px var(--cm-line); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 14px; }

/* ---------- 10. Article (blog-detail): one centred 720px column; ToC in the left margin from 1280 ---------- */
.cm-ui .cm-article { max-width: 720px; margin: 0 auto; }
.cm-ui .cm-article__head > * { margin: 0; }
.cm-ui .cm-article__head > * + * { margin-top: 16px; }
.cm-ui .cm-byline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.cm-ui .cm-article__hero { margin: 32px 0; }
.cm-ui .cm-article__hero img { display: block; width: 100%; height: auto; border-radius: var(--cm-radius-lg); background: var(--cm-surface-2); }
.cm-ui .cm-prose-body { font-size: 17px; line-height: 1.75; color: var(--cm-text); overflow-wrap: anywhere; }
@media (max-width: 575.98px) { .cm-ui .cm-prose-body { font-size: 16px; } }
.cm-ui .cm-prose-body > * { max-width: 100%; }
.cm-ui .cm-prose-body p { margin: 0 0 1.2em; }
.cm-ui .cm-prose-body h2, .cm-ui .cm-prose-body h3, .cm-ui .cm-prose-body h4 { margin: 1.8em 0 .6em; font-size: 1.2em; font-weight: 600; line-height: 1.35; color: var(--cm-text); scroll-margin-top: 88px; }
.cm-ui .cm-prose-body h3, .cm-ui .cm-prose-body h4 { font-size: 1em; }
.cm-ui .cm-prose-body h2 *, .cm-ui .cm-prose-body h3 * { font-size: inherit !important; font-weight: inherit !important; }
.cm-ui .cm-prose-body a { color: var(--cm-link); text-decoration: underline; text-underline-offset: 3px; }
.cm-ui .cm-prose-body img { height: auto; border-radius: var(--cm-radius-lg); cursor: zoom-in; }
.cm-ui .cm-prose-body img.fr-dib { display: block; width: 100% !important; margin: 1.5em 0 .5em; }
.cm-ui .cm-prose-body ul, .cm-ui .cm-prose-body ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.cm-ui .cm-prose-body li { margin: .3em 0; }
.cm-ui .cm-prose-body blockquote { margin: 1.5em 0; padding-left: 1em; border-left: 2px solid var(--cm-line); color: var(--cm-muted); }
.cm-ui .cm-prose-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: var(--cm-fs-body); margin: 0 0 1.2em; }
.cm-ui .cm-prose-body td, .cm-ui .cm-prose-body th { border: 1px solid var(--cm-line); padding: 8px 12px; }
.cm-ui .cm-prose-body iframe, .cm-ui .cm-prose-body video { max-width: 100%; border-radius: var(--cm-radius-lg); }
.cm-ui .cm-prose-body em:only-child, .cm-ui .cm-prose-body p[style*="center"] em { font-size: var(--cm-fs-small); color: var(--cm-muted); }
/* table of contents (cm-ui.js fills [data-cm-toc] when the article has 3+ h2/h3): plain links, only where there is room */
.cm-ui .cm-toc { display: none; }
@media (min-width: 1280px) {
    .cm-ui .cm-read { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 720px) minmax(0, 1fr); column-gap: 48px; }
    .cm-ui .cm-read > .cm-article { grid-column: 2; margin: 0; }
    .cm-ui .cm-toc:not([hidden]) { display: block; grid-column: 1; grid-row: 1; justify-self: end; width: 100%; max-width: 220px; position: sticky; top: 96px; align-self: start;
        max-height: calc(100vh - 128px); overflow-y: auto; scrollbar-width: none; font-size: var(--cm-fs-small); }
    .cm-ui .cm-toc ol { margin: 0; padding: 0; list-style: none; }
    .cm-ui .cm-toc a { display: block; padding: 4px 0; color: var(--cm-muted); line-height: 1.45; }
    .cm-ui .cm-toc li.is-sub a { padding-left: 12px; }
    .cm-ui .cm-toc a:hover, .cm-ui .cm-toc a.is-active { color: var(--cm-text); }
}

/* ---------- 11. Detail actions (product): icon buttons with counts ---------- */
.cm-ui .cm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.cm-ui .cm-action { display: inline-flex; align-items: center; gap: 6px; height: 40px; min-width: 40px; padding: 0 10px; border: 0; border-radius: var(--cm-radius);
    background: transparent; color: var(--cm-text); font-size: var(--cm-fs-small); font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }
.cm-ui .cm-action:hover { background: var(--cm-surface-2); }
.cm-ui .cm-action .icon { font-size: 20px; }
/* like heart + featured star: fixed icon colours, readable on both themes */
.cm-ui .icon.liked { color: #F04438; fill: currentColor; }
.cm-ui .icon.featured, .cm-ui .icon.is-on { color: #F79009; fill: currentColor; }

/* ---------- 12. Quiet course promo (end of a page at most) ---------- */
.cm-ui .cm-promo { display: flex; align-items: center; gap: 16px; padding: 20px 24px; border-radius: var(--cm-radius-lg); background: var(--cm-surface-2); color: inherit; }
.cm-ui .cm-promo__icon { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 12px; object-fit: cover; }
.cm-ui .cm-promo__body { flex: 1 1 auto; min-width: 0; }
.cm-ui .cm-promo__name { display: block; font-weight: 600; }
.cm-ui a.cm-promo:hover .cm-promo__name { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 575.98px) { .cm-ui .cm-promo > .cm-btn { display: none; } }

/* ---------- 13. Legacy pieces inside cm-ui pages ---------- */
.cm-ui .dropdown-menu { max-width: calc(100vw - 32px); border: 0; border-radius: var(--cm-radius); box-shadow: var(--cm-shadow-2); padding: 6px; font-size: var(--cm-fs-small); max-height: 60vh; overflow-y: auto; }
.cm-ui .dropdown-item { border-radius: 6px; padding: 8px 10px; color: var(--cm-text); }
.cm-ui .dropdown-item:hover { background: var(--cm-surface-2); color: var(--cm-text); }
.cm-ui .dropdown-item.active, .cm-ui .dropdown-item:active, .cm-ui .dropdown-item[aria-current] { background: var(--cm-surface-2); color: var(--cm-text); font-weight: 600; }
/* course icon tiles in "Linh vuc" menus (components/colorme/ui/course-tile) */
.cm-ui .cm-tile { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--cm-surface-2); color: var(--cm-muted); font-size: 13px; font-weight: 600; line-height: 1; }
.cm-ui .cm-tile .icon { font-size: 14px; }
.cm-ui .dropdown-menu .cm-dd-sep { height: 1px; margin: 4px 6px; background: var(--cm-line); }   /* hairline, never the heavy Bootstrap rule */
.cm-ui .dropdown-menu .dropdown-divider { border-top-color: var(--cm-line); opacity: 1; margin: 4px 6px; }
.cm-ui svg.cm-tile { background: none; border-radius: 0; }
.cm-ui .cm-ci { flex: 0 0 auto; display: inline-block; vertical-align: middle; }
/* course icons are brand artwork (dark tiles, CourseIcon.php): never recoloured; a hairline keeps them off a dark page */
:root[data-theme="dark"] .cm-ui .cm-ci { border-radius: 22%; box-shadow: 0 0 0 1px var(--cm-line-2); }
.cm-ui .dropdown-item:has(> .cm-tile), .cm-ui .cm-btn:has(> .cm-tile) { display: flex; align-items: center; gap: 10px; }
.cm-ui .cm-btn:has(> .cm-tile) { display: inline-flex; }
/* TopCV jobs block (injected on page 2 of /blog): flat, no box */
.cm-ui .job-footer-model { margin: var(--cm-section) 0 0 !important; padding: 0 !important; background: none !important; }
.cm-ui .job-footer-model > .container { max-width: none; padding: 0; }
.cm-ui .job-footer-model .text-model { font-family: var(--cm-font) !important; font-size: var(--cm-fs-body) !important; font-weight: 600 !important; color: var(--cm-text); margin: 0 0 8px !important; }
.cm-ui .job-footer-model .text-model br { display: none; }
.cm-ui .job-footer-model .gray-500.fs-5 { font-size: var(--cm-fs-body) !important; color: var(--cm-muted); }
/* comments (product detail; markup from store-product.js) */

/* Humans of ColorME (/palette): 1 the lon 2x2 + luoi 4 cot chan dung 4:5; ten + cau noi luon hien. Khong chu tren anh. */
.cm-ui .cm-humans { display: grid; gap: var(--cm-row-gap) var(--cm-gap); grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: dense; }
@media (min-width: 768px) { .cm-ui .cm-humans { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .cm-ui .cm-humans { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cm-ui .cm-human { display: flex; flex-direction: column; gap: 12px; min-width: 0; color: inherit; }
.cm-ui .cm-human__media { aspect-ratio: 4 / 5; }
.cm-ui .cm-human:hover .cm-media > img { transform: scale(1.02); }
.cm-ui .cm-human__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cm-ui .cm-human__kicker { font-size: var(--cm-fs-body-sm, 14px); color: var(--cm-muted); }
.cm-ui .cm-human__name { margin: 0; font-size: var(--cm-fs-body); font-weight: 600; line-height: 1.4; color: var(--cm-text); }
.cm-ui .cm-human:hover .cm-human__name { text-decoration: underline; text-underline-offset: 3px; }
.cm-ui .cm-human__quote { font-size: var(--cm-fs-body-sm, 14px); line-height: 1.5; color: var(--cm-muted); }
/* the lon: 2 cot (dien thoai, anh 4:3) / 2x2 tu 768; anh lon + khung chu dac ben duoi */
.cm-ui .cm-human--feature { grid-column: span 2; }
.cm-ui .cm-human--feature .cm-human__media { aspect-ratio: 4 / 3; }
@media (min-width: 768px) {
    .cm-ui .cm-human--feature { grid-row: span 2; }
    .cm-ui .cm-human--feature .cm-human__media { aspect-ratio: auto; flex: 1 1 auto; min-height: 360px; }
}
.cm-ui .cm-human--feature .cm-human__text { gap: 6px; padding: 20px 24px; border-radius: var(--cm-radius-lg); background: var(--cm-surface-2); }
.cm-ui .cm-human--feature .cm-human__name { font-size: var(--cm-fs-h3, 20px); line-height: 1.3; }
.cm-ui .cm-human--feature .cm-human__quote { font-size: var(--cm-fs-body); color: var(--cm-text-2, var(--cm-muted)); }
.cm-ui .cm-human--feature:hover .cm-human__name { text-decoration: none; }

/* ---------- 14. Phase 2/3 patterns: panels, rows, tables, pager, progress, split, forms, choices ---------- */
.cm-ui .cm-panel { padding-top: 40px; }                         /* content under .cm-tabs */
.cm-ui .cm-grid > .cm-span-all { grid-column: 1 / -1; }         /* a full-width row inside a grid (expanded list, empty state) */
.cm-ui .cm-trows { display: grid; gap: 24px; }          /* thumbnail rows: group topics, lesson lists */
.cm-ui .cm-trow { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px 16px; align-items: center; }
.cm-ui .cm-trow__thumb { border-radius: 12px; }
.cm-ui .cm-trow__body > * { margin: 0; }
.cm-ui .cm-trow__body > * + * { margin-top: 4px; }
.cm-ui .cm-trow__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cm-ui .cm-trow__progress { display: flex; align-items: center; gap: 12px; max-width: 360px; padding-top: 4px; }
.cm-ui .cm-trow__progress .cm-progress { flex: 1 1 auto; }
@media (min-width: 768px) {
    .cm-ui .cm-trow { grid-template-columns: 160px minmax(0, 1fr) auto; gap: 24px; }
    .cm-ui .cm-trow__actions { grid-column: auto; justify-content: flex-end; }
}
.cm-ui .cm-post__actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
/* plain rows (people, members, leaderboard, links): no boxes, whitespace between */
.cm-ui .cm-rows { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.cm-ui .cm-row { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 8px 0; min-width: 0; }
.cm-ui .cm-row__rank { flex: 0 0 24px; color: var(--cm-muted); font-variant-numeric: tabular-nums; text-align: right; }
.cm-ui .cm-row__body { flex: 1 1 auto; min-width: 0; }
.cm-ui .cm-row__title, .cm-ui .cm-row__meta { display: block; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-ui .cm-row__title { font-weight: 600; }
.cm-ui a.cm-row__title:hover, .cm-ui .cm-row__title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.cm-ui .cm-row__meta { font-size: var(--cm-fs-small); color: var(--cm-muted); }
.cm-ui .cm-row__end { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--cm-muted); font-size: var(--cm-fs-small); font-variant-numeric: tabular-nums; }
/* table: always inside .cm-table-wrap so it scrolls on phones */
.cm-ui .cm-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cm-ui .cm-table { width: 100%; border-collapse: collapse; }
.cm-ui .cm-table th { padding: 8px 12px; border-bottom: 1px solid var(--cm-line); text-align: left; font-size: var(--cm-fs-small); font-weight: 400; color: var(--cm-muted); white-space: nowrap; }
.cm-ui .cm-table td { padding: 12px; border-bottom: 1px solid var(--cm-line); vertical-align: middle; }
.cm-ui .cm-table th:first-child, .cm-ui .cm-table td:first-child { padding-left: 0; }
.cm-ui .cm-table th:last-child, .cm-ui .cm-table td:last-child { padding-right: 0; }
.cm-ui .cm-table .is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* pager: previous / page x of y / next, quiet text */
.cm-ui .cm-pager { display: flex; align-items: center; justify-content: center; gap: 32px; padding-top: var(--cm-block); font-size: var(--cm-fs-small); color: var(--cm-muted); }
.cm-ui .cm-pager a { display: inline-flex; align-items: center; min-height: 40px; font-size: var(--cm-fs-body); font-weight: 600; color: var(--cm-muted); }
.cm-ui .cm-pager a:hover { color: var(--cm-text); }
.cm-ui .cm-pager [aria-disabled="true"] { opacity: .4; pointer-events: none; }
/* progress: a thin ink bar */
.cm-ui .cm-progress { height: 4px; border-radius: 999px; background: var(--cm-surface-2); overflow: hidden; }
.cm-ui .cm-progress > span { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: var(--cm-text); }
/* split: media | details from 992 (topic, challenge, quiz) */
.cm-ui .cm-split { display: grid; gap: 32px; }
@media (min-width: 992px) { .cm-ui .cm-split { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 48px; align-items: start; } }
.cm-ui .cm-stack > * { margin: 0; }
.cm-ui .cm-stack > * + * { margin-top: 16px; }
/* forms: label above field, 24px between fields */
.cm-ui .cm-field { display: grid; gap: 8px; }
.cm-ui .cm-field + .cm-field { margin-top: 24px; }
.cm-ui .cm-label { font-size: var(--cm-fs-small); font-weight: 600; color: var(--cm-text); }
.cm-ui .cm-hint { font-size: var(--cm-fs-small); color: var(--cm-muted); }
.cm-ui textarea.cm-input { height: auto; min-height: 96px; padding: 12px 14px; line-height: 1.6; resize: vertical; }
/* choices (survey, quiz answers): one tappable row per option, the checked one gets an ink ring */
.cm-ui .cm-choice { display: flex; align-items: center; gap: 12px; min-height: 48px; margin: 0; padding: 12px 16px; border-radius: var(--cm-radius); box-shadow: inset 0 0 0 1px var(--cm-line); cursor: pointer; }
.cm-ui .cm-choice:hover { background: var(--cm-surface-2); }
.cm-ui .cm-choice:has(input:checked) { box-shadow: inset 0 0 0 2px var(--cm-text); }
.cm-ui .cm-choice input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; accent-color: var(--cm-text); }

@media (prefers-reduced-motion: reduce) { .cm-ui .cm-media > img { transition: none; } .cm-ui a:hover > .cm-media > img, .cm-ui .cm-post:hover .cm-media > img { transform: none; } }

/* ---------- Elevation: soft card shadows (tokens --cm-shadow-card / -hover, light + dark) ----------
   Surfaces that read as cards get a soft shadow at rest; image cards (project, post, people, Humans) stay flat at rest
   (clean rules) and lift with a soft shadow on hover. */
.cm-ui .cm-rail__card, .cm-ui .cm-lq, .cm-ui .cm-promo, .cm-ui .cm-badge, .cm-ui .cm-human--feature .cm-human__text { box-shadow: var(--cm-shadow-card, 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px -4px rgba(16, 24, 40, .08)); }
.cm-ui .cm-promo, .cm-ui .cm-lq { transition: box-shadow .2s ease, transform .2s ease; }
.cm-ui a.cm-promo:hover, .cm-ui .cm-lq:hover { box-shadow: var(--cm-shadow-card-hover, 0 2px 4px rgba(16, 24, 40, .05), 0 14px 32px -10px rgba(16, 24, 40, .18)); }
.cm-ui .cm-badge:hover { box-shadow: var(--cm-shadow-card-hover, 0 2px 4px rgba(16, 24, 40, .05), 0 14px 32px -10px rgba(16, 24, 40, .18)); }
.cm-ui .cm-media { transition: box-shadow .25s ease; }
.cm-ui a:hover > .cm-media, .cm-ui .cm-post:hover .cm-media, .cm-ui .cm-human:hover .cm-media, .cm-ui .cm-trow:hover .cm-media { box-shadow: var(--cm-shadow-card-hover, 0 2px 4px rgba(16, 24, 40, .05), 0 14px 32px -10px rgba(16, 24, 40, .18)); }

/* Muc dropdown co icon (menu nhom lop, menu chu de...) */
.cm-ui .dropdown-item:has(> .icon) { display: flex; align-items: center; gap: 10px; }
.cm-ui .dropdown-item > .icon { width: 17px; height: 17px; flex-shrink: 0; color: var(--cm-muted); }
.cm-ui .dropdown-item:hover > .icon { color: var(--cm-text); }
/* Hang chu de nhom lop: re chuot thanh the (nen + bong + bo goc), le am de khong lech thang hang */
.cm-ui .cm-topics .cm-trow { margin: -12px; padding: 12px; border-radius: 18px; transition: background-color .2s ease; }
.cm-ui .cm-topics .cm-trow:hover, .cm-ui .cm-topics .cm-trow:focus-within { background: var(--cm-surface-2); }
.cm-ui .cm-topics .cm-trow--link .cm-post__title a:hover { text-decoration: none; }
.cm-ui .cm-topics .cm-trow:hover .cm-trow__thumb img { transform: scale(1.03); }
.cm-ui .cm-topics .cm-trow__thumb img { transition: transform .4s ease; }
.cm-ui .cm-fb-ico { display: inline-grid; place-items: center; flex-shrink: 0; width: 20px; height: 20px; border-radius: 22%; background: #1877F2; }
.cm-ui .cm-fb-ico svg { width: 18px; height: 18px; translate: 0 1px; }
/* Hang chu de: ca the bam duoc (link tieu de gian ra ca the), anh 16:9, nut hanh dong noi len tren link */
.cm-ui .cm-topics .cm-trow { position: relative; }
.cm-ui .cm-topics .cm-trow--link { cursor: pointer; }
.cm-ui .cm-topics .cm-trow--link .cm-post__title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 1; }
.cm-ui .cm-topics .cm-trow--link .cm-post__title a:focus-visible { outline: none; }
.cm-ui .cm-topics .cm-trow--link:has(.cm-post__title a:focus-visible) { outline: 2px solid var(--cm-text); outline-offset: 2px; }
.cm-ui .cm-topics .cm-trow__actions { position: relative; z-index: 2; }
.cm-ui .cm-topics .cm-trow__thumb { aspect-ratio: 16 / 9; overflow: hidden; }
.cm-ui .cm-topics .cm-trow__thumb img { width: 100%; height: 100%; object-fit: cover; }
/* Hang tab + nut hanh dong (Them chu de) cung 1 hang, gach chan tab keo dai ca hang */
.cm-ui .cm-tabs-row { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--cm-line); }
.cm-ui .cm-tabs-row > .cm-tabs { flex: 1 1 auto; min-width: 0; border-bottom: 0; margin-bottom: 0; }
.cm-ui .cm-tabs-row__act { flex: 0 0 auto; height: 38px; padding: 0 14px; font-size: 14px; }
@media (max-width: 575.98px) { .cm-ui .cm-tabs-row__act span { display: none; } .cm-ui .cm-tabs-row__act { width: 38px; padding: 0; justify-content: center; } }
/* Menu "..." cua 1 chu de bi nut cua hang duoi de len: moi hang la 1 lop rieng, hang dang mo menu noi len tren */
.cm-ui .cm-topics .cm-trow { z-index: 0; }
.cm-ui .cm-topics .cm-trow:has(.dropdown-menu.show) { z-index: 4; }
