/* SaLy Build — giao diện platform theo bộ nhận diện SaLy Build (2026-10): xanh lá đậm #0B5D3B, cam #FF8A00, kem #FFF7E9,
   xám đậm #2E2E2E; Montserrat (tiêu đề) + Inter (nội dung) + Dancing Script (1 câu viết tay). Logo là ảnh cắt từ logo gốc.
   Font tự phục vụ từ brands/_shared/fonts qua /static/fonts/ (CSP 'self'). Tỉ lệ ghi cạnh màu = tương phản WCAG đã đo:
   chữ ≥ 4.5:1, chữ lớn ≥ 3:1, viền điều khiển ≥ 3:1. Cam #FF8A00 trên nền sáng chỉ 2.36:1 → không bao giờ làm chữ. */

@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500 800; font-display: swap; src: url("/static/fonts/montserrat-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500 800; font-display: swap; src: url("/static/fonts/montserrat-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/static/fonts/inter-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Dancing Script"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/static/fonts/dancing-script-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Dancing Script"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/static/fonts/dancing-script-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* Bảng màu SaLy Build (Brand Guideline mục 06) + sắc phái sinh để đạt tương phản */
  --sb-green-950: #063f28;   /* hover nút chính, tiêu đề; trắng 12:1, trên kem 11:1 */
  --sb-green-900: #0b5d3b;   /* XANH LÁ ĐẬM: nút chính, link, mục đang mở; trắng 7.95, kem 7.47 */
  --sb-green-500: #22a06b;   /* XANH LÁ PHỤ: icon, viền nhấn, chấm OK; 3.33 — không làm chữ nhỏ */
  --sb-green-100: #e3f4ea;   /* nền mint: chip, thông báo OK; chữ green-900 6.96 */
  --sb-green-50: #f1faf4;    /* hàng bảng khi rê chuột */
  --sb-orange-500: #ff8a00;  /* CAM CHỦ ĐẠO: mảng, ô icon, gradient; chữ trên nó dùng --sb-ink (5.75) */
  --sb-orange-300: #ffaa00;  /* vàng cam (điểm giao ∞) */
  --sb-orange-600: #d96800;  /* chữ cam CỠ LỚN (≥24px / ≥19px đậm) 3.54 */
  --sb-orange-700: #a85400;  /* chữ cam cỡ thường 5.34 / kem 5.02 / đào 4.60 */
  --sb-orange-100: #ffebd6;  /* nền đào: chip, cảnh báo nhẹ, tin người dùng */
  --sb-cream: #fff7e9;       /* KEM NHẠT: nền trang */
  --sb-cream-2: #fbefdc;     /* kem đậm: đầu bảng, ô hậu tố; muted 6.1 */
  --sb-ink: #2e2e2e;         /* XÁM ĐẬM: chữ chính 13.6 */
  --sb-on-dark-accent: #ffb54d; /* chữ cam trên nền xanh đậm 4.53 / 6.84 */
  --sb-gradient: linear-gradient(90deg, var(--sb-green-900), var(--sb-green-500) 42%, var(--sb-orange-300) 58%, var(--sb-orange-500));

  /* Tầng ngữ nghĩa — luật bên dưới chỉ dùng tầng này */
  --primary: var(--sb-green-900);
  --primary-hover: var(--sb-green-950);
  --primary-soft: var(--sb-green-100);
  --accent: var(--sb-orange-500);
  --accent-text: var(--sb-orange-700);
  --accent-soft: var(--sb-orange-100);
  --heading: var(--sb-green-950);
  --text: var(--sb-ink);
  --text-2: #444;                                              /* chữ phụ đậm: 9.7:1 trên trắng */
  --muted: #595959;                                            /* chữ phụ: 7:1 trên trắng, 6.6 trên kem */
  --red: #d63b2a;
  --red-strong: #b02a1b;                                       /* chữ/nút nguy hiểm: 6.2:1 với trắng */
  --red-soft: #fdecea;
  --surface-page: var(--sb-cream);
  --surface: #fff;
  --surface-2: #fffbf3;                                        /* khối phụ trong thẻ */
  --line: #efe3cf;                                             /* viền trang trí (ấm, nhạt) */
  --line-strong: #858585;                                      /* viền điều khiển: 3.7:1 trắng, 3.5 kem */
  --focus-ring: var(--sb-green-900);

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-heading: "Montserrat", "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-accent: "Dancing Script", "Segoe Script", cursive;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xl: 28px;
  --radius-pill: 999px;
  --shadow-1: 0 1px 2px rgb(46 46 46 / 5%), 0 1px 3px rgb(46 46 46 / 6%);
  --shadow-2: 0 12px 24px -8px rgb(46 46 46 / 12%), 0 4px 8px -4px rgb(46 46 46 / 5%);
  --shadow-brand: 0 14px 30px -14px rgb(11 93 59 / 38%);
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem; --space-5: 1.5rem; --space-6: 2rem; --space-7: 3rem;
  /* Chuyển động: xuất hiện dùng ease-out, biến mất ngắn hơn ~65% */
  --dur-fast: 150ms;
  --dur: 200ms;
  --dur-slow: 320ms;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  /* Khung: thanh trên (điện thoại/tablet) — builder.css dùng để dính tab/khung chat ngay dưới */
  --header-h: 60px;
  --tabbar-h: 64px;
  --sidebar-w: 264px;
}
@media (min-width: 1024px) { :root { --header-h: 0px; } }

/* ---------- Nền tảng ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--surface-page); color: var(--text); font-family: var(--font-body); font-size: 1rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 var(--space-3); font-family: var(--font-heading); font-weight: 700; line-height: 1.3; letter-spacing: -.01em; color: var(--heading); text-wrap: balance; }
h1 { font-size: clamp(1.625rem, 1.3rem + 1.2vw, 2.25rem); line-height: 1.2; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
p { margin: 0 0 var(--space-4); }
a { color: var(--primary); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
code { font-size: .875em; padding: .1em .35em; border-radius: 6px; background: var(--accent-soft); }
strong { font-weight: 700; }
small { font-size: .875rem; }
img, svg { max-width: 100%; }
svg { flex: none; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
::selection { background: var(--accent-soft); color: var(--text); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); font-weight: 400; }
.hint-ok { color: var(--primary); font-weight: 600; }
.hint-error { color: var(--red-strong); font-weight: 600; }
.brand-logo { display: block; width: auto; height: auto; max-width: 100%; }

/* Liên kết bỏ qua tới nội dung (bàn phím / trình đọc màn hình) */
.skip-link {
  position: absolute; left: var(--space-4); top: -4rem; z-index: 100; padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill); background: var(--primary); color: #fff; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: var(--space-2); }
[tabindex="-1"]:focus { outline: none; }

/* ---------- Khung trang: sidebar (≥1024px) · thanh trên + thanh đáy (<1024px) ----------
   Thang z-index: nội dung 0 · sidebar 20 · thanh trên / thanh đáy 40 · menu tài khoản 60 · skip link 100 */
/* viewport-fit=cover: iPhone xoay ngang có tai thỏ → chừa vùng an toàn hai bên (máy không tai thỏ: 0) */
.page {
  display: flex; flex-direction: column; min-width: 0; min-height: 100vh; min-height: calc(100dvh - var(--header-h));
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
.avatar {
  display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary); font: 700 .9375rem/1 var(--font-heading); text-transform: uppercase;
}
.who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar { display: none; }
.nav-link {
  position: relative; display: inline-flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: 0 var(--space-3);
  border-radius: var(--radius-sm); color: var(--text-2); font-weight: 600; font-size: .9375rem; text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-link svg { width: 1.25rem; height: 1.25rem; color: var(--muted); transition: color var(--dur) var(--ease); }
.nav-link:hover { background: var(--surface-2); color: var(--heading); }
.nav-link:hover svg { color: var(--primary); }
.nav-link[aria-current] { background: var(--primary-soft); color: var(--primary); }
.nav-link[aria-current] svg { color: var(--primary); }

@media (min-width: 1024px) {
  body.has-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  body.has-shell.is-focus { --sidebar-w: 76px; }
  .sidebar {
    position: sticky; top: 0; z-index: 20; grid-column: 1; grid-row: 1; display: flex; flex-direction: column; gap: var(--space-4);
    height: 100vh; height: 100dvh; padding: 0 var(--space-4) var(--space-4); overflow-y: auto; overscroll-behavior: contain;
    background: var(--surface); border-right: 1px solid var(--line); scrollbar-width: thin;
  }
  .sidebar::before { content: ""; flex: none; height: 3px; margin: 0 calc(var(--space-4) * -1); background: var(--sb-gradient); }
  .has-shell .page { grid-column: 2; grid-row: 1; }
  .site-header, .tabbar, .sub-nav { display: none !important; }
}
.sidebar__logo { display: flex; align-items: center; min-height: 64px; padding: var(--space-2) var(--space-2) 0; border-radius: var(--radius-sm); }
.sidebar__logo-full { width: 100%; max-width: 13rem; }
.sidebar__logo-mark { display: none; width: 2.75rem; }
.sidebar__nav { display: grid; gap: 2px; }
.sidebar__nav .nav-link { display: flex; }
.sidebar__nav .nav-link[aria-current]::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav-group { margin: var(--space-4) 0 var(--space-1); padding: 0 var(--space-3); font: 600 .6875rem/1.4 var(--font-heading); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.nav-group__links { display: grid; gap: 2px; }
/* Mục cha có con (<details class="nav-branch">, không JS vẫn mở/đóng): summary là một hàng như .nav-link + mũi tên xoay; mục con thụt vào,
   vạch dọc nối nhánh, chữ nhỏ hơn cha một bậc (14px). Mục đang xem: nền + chữ đậm + vạch đậm đè đường nhánh (không chỉ dựa vào màu). */
.nav-branch > summary { list-style: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.nav-branch > summary::-webkit-details-marker { display: none; }
.nav-branch__chev { display: inline-flex; margin-left: auto; }
.nav-branch__chev svg { width: 1rem; height: 1rem; transition: transform var(--dur) var(--ease); }
.nav-branch[open] > summary .nav-branch__chev svg { transform: rotate(180deg); }
.nav-branch:has(.nav-branch__items [aria-current]) > summary, .nav-branch:has(.nav-branch__items [aria-current]) > summary svg { color: var(--primary); }
.nav-branch--group { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--line); }
.nav-branch__items { display: grid; gap: 2px; margin: 2px 0 var(--space-2) calc(var(--space-3) + .625rem - 1px); padding-left: var(--space-2); border-left: 2px solid var(--line); }
.nav-sublink {
  position: relative; display: flex; align-items: center; gap: var(--space-2); min-height: 40px; padding: 0 var(--space-3) 0 var(--space-2);
  border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; font-size: .875rem; text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-sublink svg { width: 1.125rem; height: 1.125rem; color: var(--muted); transition: color var(--dur) var(--ease); }
.nav-sublink:hover { background: var(--surface-2); color: var(--heading); }
.nav-sublink:hover svg, .nav-sublink[aria-current] svg { color: var(--primary); }
.nav-sublink[aria-current] { background: var(--primary-soft); color: var(--primary); }
.nav-branch__items .nav-link { min-height: 40px; gap: var(--space-2); padding-left: var(--space-2); font-size: .875rem; font-weight: 500; }
.nav-branch__items .nav-link svg { width: 1.125rem; height: 1.125rem; }
.nav-branch__items > [aria-current] { font-weight: 700; }
.sidebar__nav .nav-branch__items > [aria-current]::before { left: calc(-1 * var(--space-2) - 2px); top: 8px; bottom: 8px; width: 2px; border-radius: 2px; }
.nav-sublink[aria-current]::before { content: ""; position: absolute; background: var(--primary); }
.nav-badge {
  margin-left: auto; min-width: 1.25rem; padding: 0 .35rem; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-text);
  font-size: .75rem; line-height: 1.25rem; font-weight: 700; text-align: center;
}
@media (pointer: coarse) { .nav-sublink, .nav-branch__items .nav-link { min-height: 44px; } }
/* Sidebar dài (nhiều mục con): chỉ vùng điều hướng cuộn, logo / khối promo / khối người dùng đứng yên; viền focus vẽ vào trong để không bị cắt */
@media (min-width: 1024px) {
  .sidebar__nav { flex: 1 1 auto; min-height: 12rem; align-content: start; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .sidebar__nav :focus-visible { outline-offset: -3px; }
}
.sidebar__promo {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: var(--space-2) var(--space-3); margin-top: auto;
  padding: var(--space-4); border-radius: var(--radius); background: linear-gradient(160deg, var(--sb-cream) 10%, var(--sb-orange-100));
  border: 1px solid var(--line); color: var(--heading); text-decoration: none; transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease);
}
.sidebar__promo:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.sidebar__promo-mark { grid-column: 1 / -1; width: 3.5rem; }
.sidebar__promo-text { font: 700 .9375rem/1.35 var(--font-heading); }
.sidebar__promo-go { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--primary); color: #fff; }
.sidebar__promo-go svg { width: 1rem; height: 1rem; }
.sidebar__user { display: flex; align-items: center; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.sidebar__who { display: grid; flex: 1; min-width: 0; line-height: 1.35; }
.sidebar__who .who { font-size: .8125rem; font-weight: 600; color: var(--text); }
.sidebar__role { font-size: .75rem; color: var(--muted); }

/* Chế độ tập trung (builder): sidebar thành dải icon 76px */
.is-focus .sidebar { padding-inline: var(--space-2); align-items: center; }
.is-focus .sidebar::before { margin-inline: calc(var(--space-2) * -1); align-self: stretch; }
.is-focus .sidebar__logo { justify-content: center; padding: var(--space-2) 0 0; }
.is-focus .sidebar__logo-full, .is-focus .sidebar__promo, .is-focus .sidebar__who, .is-focus .nav-group { display: none; }
.is-focus .sidebar__logo-mark { display: block; }
.is-focus .sidebar__nav { justify-items: center; }
.is-focus .sidebar__nav .nav-link { width: 48px; justify-content: center; padding: 0; }
.is-focus .sidebar__nav .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.is-focus .nav-group__links { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--line); }
.is-focus .sidebar__user { flex-direction: column; margin-top: auto; }

/* Thanh trên điện thoại / tablet */
.site-header {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  height: var(--header-h); padding: 3px max(var(--space-4), env(safe-area-inset-right)) 0 max(var(--space-4), env(safe-area-inset-left));
  background: rgb(255 255 255 / 94%); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
}
.site-header::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--sb-gradient); }
.site-header__logo { display: flex; align-items: center; min-height: 44px; min-width: 0; border-radius: var(--radius-sm); }
.site-header__logo .brand-logo { height: 30px; width: auto; }
.account-menu { position: relative; flex: none; }
.account-menu__toggle {
  display: inline-flex; align-items: center; gap: .25rem; min-width: 44px; min-height: 44px; padding: 0 .25rem; border-radius: var(--radius-pill);
  list-style: none; cursor: pointer; color: var(--muted); -webkit-tap-highlight-color: transparent;
}
.account-menu__toggle::-webkit-details-marker { display: none; }
.account-menu__toggle svg { width: 1rem; height: 1rem; transition: transform var(--dur) var(--ease); }
.account-menu[open] .account-menu__toggle svg { transform: rotate(180deg); }
.account-menu__panel {
  position: absolute; right: 0; top: calc(100% + var(--space-2)); z-index: 60; display: grid; gap: var(--space-2);
  width: min(19rem, calc(100vw - 2 * var(--space-3))); padding: var(--space-4); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2);
}
.account-menu__panel .btn, .account-menu__panel form { width: 100%; margin: 0; }
.account-menu__who { display: flex; align-items: center; gap: var(--space-3); margin: 0 0 var(--space-2); }
.account-menu__who > span:last-child { display: grid; gap: .25rem; justify-items: start; min-width: 0; }
.account-menu__who strong { font-size: .875rem; overflow-wrap: anywhere; }
.role-badge { font-size: .75rem; }
@media (prefers-reduced-motion: no-preference) {
  .account-menu[open] .account-menu__panel { animation: menu-in var(--dur) var(--ease-out); }
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* Thanh đáy điện thoại: 5 mục, nút (+) Tạo app tròn nổi ở giữa; tôn trọng vùng an toàn iPhone */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: rgb(255 255 255 / 96%); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -18px rgb(46 46 46 / 35%);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
}
.tabbar__item {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 56px;
  color: var(--muted); font-size: .6875rem; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; transition: color var(--dur) var(--ease);
}
.tabbar__item > svg { width: 1.375rem; height: 1.375rem; }
.tabbar__item[aria-current] { color: var(--primary); }
.tabbar__item[aria-current]:not(.tabbar__item--create)::before { content: ""; position: absolute; top: 0; width: 1.75rem; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
.tabbar__item:active > svg { transform: scale(.92); }
.tabbar__fab {
  display: inline-grid; place-items: center; width: 3.25rem; height: 3.25rem; margin-top: -1.5rem; border-radius: 50%;
  background: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--surface), var(--shadow-brand);
  transition: transform var(--dur) var(--ease-out), background-color var(--dur) var(--ease);
}
.tabbar__fab svg { width: 1.5rem; height: 1.5rem; stroke-width: 2.5; }
.tabbar__item--create { color: var(--primary); }
.tabbar__item--create:active .tabbar__fab { transform: scale(.94); background: var(--primary-hover); }
@media (max-width: 1023.98px) { /* .98: không hở khe với min-width: 1024px khi thu phóng cho bề rộng lẻ */
  .has-shell:not(.is-focus) .page { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
}

/* Khu quản trị trên điện thoại: dải chip cuộn ngang, mép mờ báo còn cuộn được */
.sub-nav { background: var(--surface); border-bottom: 1px solid var(--line); }
.sub-nav__inner {
  display: flex; gap: var(--space-1); max-width: 80rem; margin: 0 auto; padding: var(--space-2) var(--space-4); overflow-x: auto; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 24px), transparent);
}
.sub-nav__inner::-webkit-scrollbar { display: none; }
.sub-nav .nav-link { flex: none; gap: var(--space-2); font-size: .875rem; border-radius: var(--radius-pill); }
.sub-nav .nav-link svg { width: 1.125rem; height: 1.125rem; }

/* ---------- Bố cục trang ---------- */
.container { width: 100%; max-width: 80rem; margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-7); flex: 1 0 auto; }
.container-wide { max-width: 100rem; }
@media (min-width: 768px) { .container { padding: var(--space-6) var(--space-5) var(--space-7); } }
@media (min-width: 1280px) { .container { padding-inline: var(--space-6); } }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-4); margin-bottom: var(--space-5); }
.page-head h1 { margin: 0; }
.page-head p { margin: var(--space-1) 0 0; color: var(--muted); max-width: 46rem; }
.page-head h1 .muted { font-family: var(--font-body); font-size: .55em; font-weight: 500; letter-spacing: 0; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
/* Eyebrow: chữ in hoa giãn rộng + vạch gradient (motif Brand Guideline) */
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2);
  font: 600 .75rem/1.4 var(--font-heading); letter-spacing: .16em; text-transform: uppercase; color: var(--primary);
}
.eyebrow::before { content: ""; width: 1.5rem; height: 3px; flex: none; border-radius: 3px; background: var(--sb-gradient); }
.section-title { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-6) 0 var(--space-3); font-size: 1.25rem; }
.section-title:first-child { margin-top: 0; }
.site-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .15rem var(--space-3);
  padding: var(--space-5) var(--space-4); border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: .8125rem;
}
.site-footer p { margin: 0; }
.site-footer strong { font-family: var(--font-heading); color: var(--heading); }
.site-footer__mark { width: 2.25rem; }
.site-footer__sub { flex-basis: 100%; }
@media (min-width: 768px) { .site-footer__sub { flex-basis: auto; } .site-footer__sub::before { content: "·"; margin-right: var(--space-3); } }
.no-shell .site-footer { border-top: 0; }

/* ---------- Thẻ ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-5); box-shadow: var(--shadow-1); }
.card + .card { margin-top: var(--space-5); }
.card > :last-child { margin-bottom: 0; }
.card.narrow { max-width: 30rem; margin: var(--space-6) auto; text-align: center; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.card-head h1, .card-head h2 { margin: 0; }
@media (max-width: 479px) { .card { padding: var(--space-4); } }

/* Ô icon: nền đặc xanh/cam (icon trắng, trang trí cạnh nhãn chữ) hoặc nền mềm */
.icon-tile { display: inline-grid; place-items: center; width: 3rem; height: 3rem; flex: none; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); }
.icon-tile svg { width: 1.5rem; height: 1.5rem; }
.icon-tile--green { background: var(--primary); color: #fff; }
.icon-tile--orange { background: var(--accent); color: #fff; }
.icon-tile--peach { background: var(--accent-soft); color: var(--accent-text); }
/* Vạch gradient thương hiệu */
.brand-rule { display: block; width: 4rem; height: 4px; border: 0; border-radius: 4px; background: var(--sb-gradient); }

/* ---------- Nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 44px; padding: .55rem 1.15rem;
  border: 1px solid transparent; border-radius: var(--radius-pill); font: 600 .9375rem/1.25 var(--font-body); text-align: center; text-decoration: none;
  cursor: pointer; white-space: nowrap; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn svg { width: 1.125rem; height: 1.125rem; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-brand); }            /* 7.95:1 */
.btn-primary:hover { background: var(--primary-hover); }                                               /* 12:1 */
.btn-accent { background: var(--accent); color: var(--sb-ink); box-shadow: 0 12px 26px -14px rgb(255 138 0 / 80%); } /* 5.75:1 */
.btn-accent:hover { background: var(--sb-orange-300); }
.btn-secondary { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.btn-secondary:hover { background: var(--primary-soft); }
.btn-ghost { background: var(--primary-soft); color: var(--heading); }
.btn-ghost:hover { background: #d3ecdd; }
.btn-ghost.is-active, .btn-ghost[aria-pressed="true"] { background: var(--surface); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 45%, #fff); box-shadow: var(--shadow-1); }
.btn-icon { min-width: 44px; padding-inline: 0; }
.btn-link { min-height: 40px; padding: .35rem .6rem; background: none; color: var(--primary); text-decoration: underline; text-underline-offset: .15em; border-radius: var(--radius-sm); }
.btn-link:hover { background: var(--primary-soft); text-decoration: none; }
.btn-danger { background: var(--surface); color: var(--red-strong); border-color: var(--red-strong); }
.btn-danger:hover { background: var(--red-strong); color: #fff; }
.btn-link.btn-danger { background: none; border-color: transparent; }
.btn-link.btn-danger:hover { background: var(--red-soft); color: var(--red-strong); }
.btn-sm { min-height: 36px; padding: .35rem .85rem; font-size: .875rem; }
.btn-lg { min-height: 52px; padding: .75rem 1.5rem; font-size: 1rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
@media (pointer: coarse) { .btn-sm, .btn-link { min-height: 44px; } }
.btn-google { gap: var(--space-3); background: var(--surface); color: var(--text); border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.btn-google:hover { background: var(--surface-2); border-color: var(--text); }
.btn-google svg { width: 1.25rem; height: 1.25rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }

/* ---------- Form ---------- */
:where(input:not([type="checkbox"], [type="radio"], [type="hidden"]), select, textarea) {
  font: inherit; font-size: 1rem; line-height: 1.4; min-height: 44px; padding: .5rem .85rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
:where(input:not([type="checkbox"], [type="radio"]), select, textarea):hover { border-color: var(--sb-green-500); }
:where(input:not([type="checkbox"], [type="radio"]), select, textarea):focus-visible {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgb(34 160 107 / 28%);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--red-strong); }
select {
  min-width: 0; max-width: 100%; appearance: none; padding-right: 2.5rem; /* mục dài (vd. "Ghim: số CLI báo là riêng từng lần chạy") không kéo cột rộng hơn màn hình */ cursor: pointer; background-repeat: no-repeat; background-size: .375rem .375rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--primary) 50%), linear-gradient(135deg, var(--primary) 50%, transparent 50%);
  background-position: calc(100% - 1.25rem) 52%, calc(100% - .875rem) 52%;
}
input[type="checkbox"], input[type="radio"] { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--primary); flex: none; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); cursor: not-allowed; }
.field, .stack-form > label { display: grid; gap: .4rem; font-weight: 600; font-size: .9375rem; }
.field small, .stack-form small, .field .muted { font-weight: 400; font-size: .875rem; }
.stack-form { display: grid; gap: var(--space-5); max-width: 40rem; }
.stack-form > * { min-width: 0; }
.stack-form > .actions { margin-top: var(--space-1); }
.row-form {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3) var(--space-4); margin: 0 0 var(--space-5);
  padding: var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.row-form label {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: .3rem; max-width: 100%; min-width: 0;
  font-size: .8125rem; font-weight: 600; color: var(--text-2);
}
.row-form label input, .row-form label select { font-weight: 400; color: var(--text); }
.inline-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; }
.inline-form input:not([type="hidden"]) { min-height: 40px; padding: .35rem .65rem; font-size: .9375rem; }
@media (pointer: coarse) { .inline-form input:not([type="hidden"]) { min-height: 44px; } }
.check { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; font-weight: 500; cursor: pointer; }
.domain-input { display: flex; align-items: stretch; min-width: 0; font-weight: 400; }
.domain-input input { flex: 1 1 8rem; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.domain-suffix {
  display: inline-flex; align-items: center; padding: 0 .85rem; color: var(--text-2); background: var(--sb-cream-2);
  border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: .9375rem; font-weight: 600; white-space: nowrap;
}
fieldset.group { display: grid; gap: var(--space-4); min-width: 0; margin: 0; padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); }
fieldset.group > legend { padding: 0 var(--space-2); font-family: var(--font-heading); font-size: 1.125rem; font-weight: 700; color: var(--heading); }
fieldset.group > p { margin: 0; }
/* Con của grid không tự co: không có min-width:0 thì select có option dài hoặc bảng ghép cột kéo cả form tràn ngang ở 390 px. */
fieldset.group > *, fieldset.group .field > select, fieldset.group .field > input { min-width: 0; max-width: 100%; }
@media (max-width: 479px) {
  .domain-input { flex-wrap: wrap; }
  .domain-input input { border-radius: var(--radius-sm); }
  .domain-suffix { padding: var(--space-1) 0 0; border: 0; background: none; color: var(--muted); }
}

/* ---------- Thông báo: icon đầu dòng + màu (không chỉ dựa vào màu) ---------- */
.notice {
  position: relative; margin: 0 0 var(--space-4); padding: .85rem 1rem .85rem 2.9rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: .9375rem; line-height: 1.55; overflow-wrap: anywhere;
}
.notice::before {
  content: "i"; position: absolute; left: .95rem; top: .95rem; display: grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%;
  background: var(--muted); color: #fff; font: 700 .8125rem/1 var(--font-heading);
}
.notice strong:first-child { margin-right: .25rem; }
.notice-ok { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 22%, #fff); }
.notice-ok::before { content: "✓"; background: var(--primary); }
.notice-error { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 28%, #fff); }
.notice-error::before { content: "!"; background: var(--red-strong); }
.notice-warn { background: #fff4e6; border-color: color-mix(in srgb, var(--accent) 35%, #fff); }
.notice-warn::before { content: "!"; background: var(--accent); color: var(--sb-ink); }
.notice > :last-child { margin-bottom: 0; }

/* ---------- Nhãn trạng thái (viên thuốc có chấm) ---------- */
.tag {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 1.625rem; padding: 0 .65rem; border-radius: var(--radius-pill);
  background: #f3eee4; color: var(--text); font-size: .8125rem; font-weight: 600; line-height: 1.2; white-space: nowrap;
}
.tag-active, .tag-revoked, .tag-https-ready, .tag-https-working, .tag-https-retrying, .tag-https-rate-limited, .tag-ok, .tag-warn, .tag-bad, .tag-unknown { padding-left: .55rem; }
:is(.tag-active, .tag-revoked, .tag-https-ready, .tag-https-working, .tag-https-retrying, .tag-https-rate-limited, .tag-ok, .tag-warn, .tag-bad, .tag-unknown)::before {
  content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; flex: none;
}
.tag-active, .tag-https-ready, .tag-ok { background: var(--primary-soft); color: var(--primary); }
.tag-active::before, .tag-https-ready::before, .tag-ok::before { background: var(--sb-green-500); }
.tag-revoked, .tag-https-retrying, .tag-bad { background: var(--red-soft); color: var(--red-strong); }
.tag-https-working, .tag-https-rate-limited, .tag-warn { background: var(--accent-soft); color: var(--accent-text); }
.tag-https-working::before, .tag-https-rate-limited::before, .tag-warn::before { background: var(--accent); }
.tag-unknown { background: #eeeeee; color: #4a4a4a; }
.tag-admin { background: var(--primary); color: #fff; }
.tag-staff { background: var(--primary-soft); color: var(--primary); }
/* Chấm màu thương hiệu của app = màu chính trong brands/<id>/brand.json (không phải màu platform). Màu từng thương hiệu do /brands/brand-colors.css
   sinh động từ registry (layout nạp cho mọi trang đăng nhập); id lạ / chưa có màu → chấm xám dưới đây */
.brand-chip { display: inline-flex; align-items: center; gap: .4rem; min-height: 1.625rem; padding: 0 .65rem 0 .55rem; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.brand-chip[class*="brand-chip--"]::before { content: ""; width: .6rem; height: .6rem; flex: none; border-radius: 50%; background: #9a9a9a; }

/* ---------- Bảng ---------- */
.table-wrap { position: relative; width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); -webkit-overflow-scrolling: touch; }
.table-wrap + .table-wrap, .table-wrap + p { margin-top: var(--space-4); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9375rem; }
th, td { padding: .75rem .8rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
thead th { background: var(--sb-cream-2); color: var(--text-2); font-size: .8125rem; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
tbody tr { transition: background-color var(--dur) var(--ease); }
tbody tr:hover { background: var(--sb-green-50); }
tbody tr:last-child > * { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.cell-main { min-width: 10rem; font-weight: 600; overflow-wrap: break-word; }
td .inline-form { flex-wrap: nowrap; }
.cell-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.cell-actions .inline-form { flex-wrap: nowrap; }
.row-more { flex-basis: 100%; }
.row-more > summary { list-style: none; cursor: pointer; }
.row-more > summary::-webkit-details-marker { display: none; }
.row-more > summary::after { content: ""; width: .4rem; height: .4rem; margin-left: .15rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform var(--dur) var(--ease); }
.row-more[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.row-more__body { display: grid; gap: var(--space-2); justify-items: start; margin-top: var(--space-2); padding: var(--space-3); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.table-note { margin: var(--space-4) 0 0; font-size: .875rem; color: var(--muted); }
.user-cell { display: inline-flex; align-items: center; gap: var(--space-2); }
.user-cell .avatar { width: 2rem; height: 2rem; font-size: .8125rem; }

/* ---------- Khối số liệu ---------- */
.stat-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); margin-bottom: var(--space-5); }
.stat { position: relative; overflow: hidden; padding: var(--space-4) var(--space-4) var(--space-4) var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--sb-green-900), var(--sb-green-500) 45%, var(--sb-orange-300) 60%, var(--sb-orange-500)); }
.stat__label { display: block; font-size: .8125rem; font-weight: 600; color: var(--muted); }
.stat__value { display: block; font-family: var(--font-heading); font-size: 1.75rem; font-weight: 800; line-height: 1.25; color: var(--heading); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat__note { display: block; font-size: .8125rem; color: var(--muted); }
.meter { display: block; width: 100%; height: .5rem; border: 0; border-radius: var(--radius-pill); background: var(--primary-soft); overflow: hidden; appearance: none; }
.meter::-webkit-progress-bar { background: var(--primary-soft); border-radius: var(--radius-pill); }
.meter::-webkit-progress-value { background: linear-gradient(90deg, var(--sb-green-900), var(--sb-green-500)); border-radius: var(--radius-pill); }
.meter::-moz-progress-bar { background: linear-gradient(90deg, var(--sb-green-900), var(--sb-green-500)); border-radius: var(--radius-pill); }
.meter.is-high::-webkit-progress-value { background: var(--accent); }
.meter.is-high::-moz-progress-bar { background: var(--accent); }
.meter.is-over::-webkit-progress-value { background: var(--red); }
.meter.is-over::-moz-progress-bar { background: var(--red); }

/* Trạng thái trống: ∞ gốc mờ phía sau */
.empty { position: relative; overflow: hidden; display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-7) var(--space-4); text-align: center; }
.empty > svg { width: 3rem; height: 3rem; color: var(--accent); }
.empty__mark { width: 7rem; margin-bottom: var(--space-2); }
.empty h2 { margin: var(--space-2) 0 0; }
.empty p { margin: 0 0 var(--space-3); max-width: 32rem; color: var(--muted); }

/* ---------- Thẻ lối tắt (trang chủ, quản trị) ---------- */
.shortcut-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.shortcut {
  display: flex; align-items: center; gap: var(--space-3); min-height: 72px; padding: var(--space-3) var(--space-4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font-weight: 600; text-decoration: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease-out);
}
.shortcut:hover { border-color: color-mix(in srgb, var(--sb-green-500) 45%, #fff); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.shortcut .icon-tile { width: 2.75rem; height: 2.75rem; }
.shortcut .icon-tile svg { width: 1.25rem; height: 1.25rem; }
.shortcut small { display: block; font-weight: 400; color: var(--muted); }
.hero { display: grid; gap: var(--space-4); padding: var(--space-6) var(--space-5); margin-bottom: var(--space-5); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); }
.hero h1 { margin: 0; }
.hero p { margin: 0; max-width: 40rem; color: var(--text-2); font-size: 1.0625rem; }
.steps { display: grid; gap: var(--space-4); margin: 0; padding: 0; list-style: none; counter-reset: step; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.steps li { position: relative; padding: var(--space-5) var(--space-4) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); counter-increment: step; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 2rem; height: 2rem; margin-bottom: var(--space-2); border-radius: 50%; background: var(--primary); color: #fff; font-family: var(--font-heading); font-weight: 700; }
.steps h3 { margin: 0 0 var(--space-1); }
.steps p { margin: 0; color: var(--muted); font-size: .9375rem; }

/* ---------- Thẻ đăng nhập / không có quyền ---------- */
.auth-card { display: grid; gap: var(--space-4); justify-items: center; }
.auth-card p { margin: 0; color: var(--text-2); }
.auth-card .btn { width: 100%; max-width: 20rem; }
.auth-card__logo { width: min(15rem, 80%); }
.auth-icon { display: inline-grid; place-items: center; width: 3rem; height: 3rem; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-text); }
.auth-icon svg { width: 1.5rem; height: 1.5rem; }

/* ---------- Danh sách app dạng thẻ ---------- */
.app-grid { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); }
.app-card {
  display: grid; gap: var(--space-3); align-content: start; padding: var(--space-4) var(--space-5); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1); transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.app-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: color-mix(in srgb, var(--sb-green-500) 35%, #fff); }
.app-card__top { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.app-card__avatar {
  position: relative; display: inline-grid; place-items: center; width: 3rem; height: 3rem; flex: none; overflow: hidden; border-radius: 14px;
  background: linear-gradient(135deg, var(--sb-green-900), var(--sb-green-500)); color: #fff; font: 800 1.25rem/1 var(--font-heading); text-transform: uppercase;
}
.app-card__avatar::after { content: ""; position: absolute; right: -6px; bottom: -6px; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--accent); }
.app-card__head { display: grid; gap: .1rem; min-width: 0; }
.app-card__name { margin: 0; font-size: 1.1875rem; overflow-wrap: anywhere; }
.app-card__host { display: inline-flex; align-items: center; gap: .3rem; min-width: 0; font-size: .9375rem; overflow-wrap: anywhere; }
.app-card__host svg { width: 1rem; height: 1rem; color: var(--sb-green-500); }
.app-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); margin: 0; font-size: .875rem; color: var(--muted); }
.app-card__tags { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.app-card__tags .tag { white-space: normal; min-width: 0; }
.app-card__note { margin: 0; font-size: .8125rem; color: var(--muted); }
.app-card__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; padding-top: var(--space-3); border-top: 1px solid var(--line); }

/* ---------- Tạo app: form + cột "điều gì xảy ra tiếp theo" ---------- */
.create-layout { display: grid; gap: var(--space-5); align-items: start; }
@media (min-width: 1024px) { .create-layout { grid-template-columns: minmax(0, 1.5fr) minmax(18rem, 1fr); } }
.next-steps { display: grid; gap: var(--space-4); padding: var(--space-5); background: linear-gradient(165deg, var(--surface) 30%, var(--sb-orange-100)); border: 1px solid var(--line); border-radius: var(--radius); }
.next-steps h2 { margin: 0; font-size: 1.125rem; }
.next-steps ol { display: grid; gap: var(--space-4); margin: 0; padding: 0; list-style: none; }
.next-steps li { display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-3); align-items: start; }
.next-steps .icon-tile { grid-row: span 2; width: 2.5rem; height: 2.5rem; }
.next-steps .icon-tile svg { width: 1.25rem; height: 1.25rem; }
.next-steps strong { font-family: var(--font-heading); color: var(--heading); }
.next-steps span:last-child { font-size: .875rem; color: var(--muted); }

/* ---------- Chuyển cảnh giữa các trang (View Transitions cùng nguồn): khung đứng yên, nội dung trượt nhẹ ---------- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .sidebar { view-transition-name: sidebar; }
  .site-header { view-transition-name: site-header; }
  .tabbar { view-transition-name: tabbar; }
  ::view-transition-old(root) { animation: vt-out 140ms var(--ease-in) both; }
  ::view-transition-new(root) { animation: vt-in var(--dur-slow) var(--ease-out) both; }
}
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(12px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* ---------- Dữ liệu app: tính năng ở form tạo app / cài đặt, trang quản lý dữ liệu ---------- */
.feature-sub { display: grid; gap: var(--space-3); padding-left: var(--space-4); border-left: 3px solid var(--line); }
.feature-group .check { font-weight: 600; }
.sub-tabs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-4); }
.usage-line { margin: 0 0 var(--space-4); color: var(--text-2); }
.data-toolbar { margin: 0 0 var(--space-4); }
.data-preview { display: block; max-width: 36rem; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); }
.temp-password__value { font-size: 1.125rem; letter-spacing: .05em; user-select: all; }

.page-head .back-link { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 44px; font-size: .875rem; font-weight: 600; text-decoration: none; }
.page-head .back-link svg { width: 1rem; height: 1rem; }

/* ---------- App tạo từ mẫu: danh sách changelog (trang mẫu + thẻ "Có bản mới" ở Cài đặt app, trang Cài đặt không nạp CSS thư viện mẫu) ---------- */
.tpl-list { margin: 0; padding-left: 1.25rem; display: grid; gap: var(--space-1); }
.tpl-upgrade-card { display: grid; gap: var(--space-3); }
.tpl-upgrade-card h2, .tpl-upgrade-card p { margin: 0; }
.tpl-upgrade-card .btn { justify-self: start; }
