/* CrossSub — quiet theme on top of Bootstrap 5.3.
   Black text, grey secondary text, white surfaces. Buttons and active tabs are Facebook blue (user 2026-12-01:
   black buttons looked dull); the button that opens YouTube to subscribe is YouTube red (.btn-youtube).
   Red is otherwise kept for the logo, overdue states and the task count. */

:root,
[data-bs-theme="light"] {
  --cs-text: #111827;
  --cs-muted: #6b7280;
  --cs-line: #e5e7eb;
  --cs-line-strong: #d1d5db;
  --cs-surface: #ffffff;
  --cs-surface-2: #f9fafb;
  --cs-chip: #f3f4f6;
  --cs-accent: #0866ff;          /* buttons, active tabs — Facebook blue (white text 4.8:1) */
  --cs-accent-hover: #0757d6;
  --cs-accent-active: #064bb8;
  --cs-accent-text: #ffffff;
  --cs-youtube: #e62117;         /* "open YouTube & subscribe" — YouTube red (white text 4.6:1) */
  --cs-youtube-hover: #c4140c;
  --cs-red: #dc2626;
  --cs-amber: #d97706;
  --cs-green: #16a34a;
  --cs-blue: #2563eb;
  --cs-shadow: 0 1px 2px rgba(17, 24, 39, .04);
  --cs-shadow-lg: 0 8px 24px rgba(17, 24, 39, .08);

  --bs-body-font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-bg: #f6f6f7;
  --bs-body-color: #111827;
  --bs-secondary-color: #6b7280;
  --bs-primary: #0866ff;
  --bs-primary-rgb: 8, 102, 255;
  --bs-primary-bg-subtle: #e7f0ff;
  --bs-primary-border-subtle: #b9d3ff;
  --bs-primary-text-emphasis: #0645ad;
  --bs-link-color: #111827;
  --bs-link-color-rgb: 17, 24, 39;
  --bs-link-hover-color: #000000;
  --bs-link-hover-color-rgb: 0, 0, 0;
  --bs-border-color: #e5e7eb;
  --bs-border-radius: .6rem;
  --bs-border-radius-lg: .8rem;
  --bs-focus-ring-color: rgba(17, 24, 39, .1);
}

[data-bs-theme="dark"] {
  --cs-text: #e5e7eb;
  --cs-muted: #9ca3af;
  --cs-line: #2a2d33;
  --cs-line-strong: #3a3e46;
  --cs-surface: #17181b;
  --cs-surface-2: #1c1d21;
  --cs-chip: #222428;
  --cs-accent: #0866ff;
  --cs-accent-hover: #2b7bff;
  --cs-accent-active: #4a8eff;
  --cs-accent-text: #ffffff;
  --cs-youtube: #e62117;
  --cs-youtube-hover: #f0352b;
  --cs-red: #f87171;
  --cs-amber: #fbbf24;
  --cs-green: #4ade80;
  --cs-blue: #60a5fa;
  --cs-shadow: none;
  --cs-shadow-lg: 0 8px 24px rgba(0, 0, 0, .4);

  --bs-body-bg: #0f1012;
  --bs-body-color: #e5e7eb;
  --bs-secondary-color: #9ca3af;
  --bs-primary: #0866ff;
  --bs-primary-rgb: 8, 102, 255;
  --bs-primary-bg-subtle: #10213f;
  --bs-primary-border-subtle: #1d3a6e;
  --bs-primary-text-emphasis: #8ab4ff;
  --bs-link-color: #e5e7eb;
  --bs-link-color-rgb: 229, 231, 235;
  --bs-link-hover-color: #ffffff;
  --bs-link-hover-color-rgb: 255, 255, 255;
  --bs-border-color: #2a2d33;
  --bs-tertiary-bg: #1c1d21;
  --bs-secondary-bg: #222428;
}

body {
  background: var(--bs-body-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1 0 auto; }
html { scroll-padding-top: 80px; }                               /* #anchors land below the sticky top bar */
@media (max-width: 991.98px) { html { scroll-padding-top: calc(68px + env(safe-area-inset-top)); } }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.btn:hover, .nav-link:hover, .dropdown-item:hover, .list-group-item-action:hover, .page-link:hover,
.cs-brand:hover, .cs-icon-btn:hover { text-decoration: none; }
h1, h2, h3, h4, h5, h6 { letter-spacing: -.015em; color: var(--cs-text); }
.text-muted, .text-body-secondary { color: var(--cs-muted) !important; }
.min-w-0 { min-width: 0; }
.fs-7 { font-size: .8125rem; }
.fs-8 { font-size: .75rem; }
.yt-mark { color: #ff0033; }
.text-overdue { color: var(--cs-red) !important; }

/* ---------- Buttons & form controls ---------- */
.btn { font-weight: 500; border-radius: .55rem; }
.btn-primary {
  --bs-btn-color: var(--cs-accent-text); --bs-btn-bg: var(--cs-accent); --bs-btn-border-color: var(--cs-accent);
  --bs-btn-hover-color: var(--cs-accent-text); --bs-btn-hover-bg: var(--cs-accent-hover); --bs-btn-hover-border-color: var(--cs-accent-hover);
  --bs-btn-active-color: var(--cs-accent-text); --bs-btn-active-bg: var(--cs-accent-active); --bs-btn-active-border-color: var(--cs-accent-active);
  --bs-btn-disabled-color: var(--cs-accent-text); --bs-btn-disabled-bg: var(--cs-accent); --bs-btn-disabled-border-color: var(--cs-accent);
  --bs-btn-focus-shadow-rgb: 8, 102, 255;
}
.btn-youtube {
  --bs-btn-color: #fff; --bs-btn-bg: var(--cs-youtube); --bs-btn-border-color: var(--cs-youtube);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--cs-youtube-hover); --bs-btn-hover-border-color: var(--cs-youtube-hover);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--cs-youtube-hover); --bs-btn-active-border-color: var(--cs-youtube-hover);
  --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: var(--cs-youtube); --bs-btn-disabled-border-color: var(--cs-youtube);
  --bs-btn-focus-shadow-rgb: 230, 33, 23;
}
.btn-soft, .btn-messenger, .btn-outline-primary {
  --bs-btn-color: var(--cs-text); --bs-btn-bg: var(--cs-surface); --bs-btn-border-color: var(--cs-line-strong);
  --bs-btn-hover-color: var(--cs-text); --bs-btn-hover-bg: var(--cs-chip); --bs-btn-hover-border-color: var(--cs-line-strong);
  --bs-btn-active-color: var(--cs-text); --bs-btn-active-bg: var(--cs-chip); --bs-btn-active-border-color: var(--cs-line-strong);
  --bs-btn-focus-shadow-rgb: 17, 24, 39;
}
.btn-outline-danger {
  --bs-btn-color: var(--cs-red); --bs-btn-bg: var(--cs-surface); --bs-btn-border-color: var(--cs-line-strong);
  --bs-btn-hover-color: var(--cs-red); --bs-btn-hover-bg: var(--cs-chip); --bs-btn-hover-border-color: var(--cs-red);
  --bs-btn-active-color: var(--cs-red); --bs-btn-active-bg: var(--cs-chip); --bs-btn-active-border-color: var(--cs-red);
}
.form-control, .form-select { border-radius: .55rem; padding: .6rem .85rem; border-color: var(--cs-line-strong); background-color: var(--cs-surface); }
.form-control:focus, .form-select:focus { border-color: var(--cs-muted); box-shadow: 0 0 0 .2rem rgba(17, 24, 39, .08); }
.form-check-input:checked { background-color: var(--cs-accent); border-color: var(--cs-accent); }
.form-check-input:focus { border-color: var(--cs-muted); box-shadow: 0 0 0 .2rem rgba(17, 24, 39, .08); }
.form-label { font-weight: 500; font-size: .9rem; margin-bottom: .35rem; }
.form-text { font-size: .8rem; }
.nav-pills {
  --bs-nav-pills-link-active-bg: var(--cs-accent); --bs-nav-pills-link-active-color: var(--cs-accent-text);
  --bs-nav-link-color: var(--cs-text); --bs-nav-link-hover-color: var(--cs-text);
}
.nav-pills .nav-link { border-radius: .5rem; font-weight: 500; }
.nav-pills .nav-link:not(.active):hover { background: var(--cs-chip); }
.pagination {
  --bs-pagination-color: var(--cs-text); --bs-pagination-hover-color: var(--cs-text); --bs-pagination-hover-bg: var(--cs-chip);
  --bs-pagination-active-bg: var(--cs-accent); --bs-pagination-active-border-color: var(--cs-accent); --bs-pagination-active-color: var(--cs-accent-text);
  --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(17, 24, 39, .08); --bs-pagination-focus-color: var(--cs-text);
  --bs-pagination-bg: var(--cs-surface); --bs-pagination-border-color: var(--cs-line);
}
.dropdown-menu {
  --bs-dropdown-link-active-bg: var(--cs-chip); --bs-dropdown-link-active-color: var(--cs-text);
  --bs-dropdown-bg: var(--cs-surface); --bs-dropdown-border-color: var(--cs-line);
  box-shadow: var(--cs-shadow-lg); border-radius: .7rem; padding: .35rem;
}
.dropdown-item { border-radius: .45rem; padding: .45rem .75rem; }
.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .75rem .9rem; border-color: var(--cs-line); }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--cs-muted); font-weight: 600; background: var(--cs-surface-2); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--cs-surface-2); }
.modal { --bs-modal-bg: var(--cs-surface); --bs-modal-border-color: var(--cs-line); }

/* Flash / inline alerts: white with a thin coloured edge, black text. */
.alert, .alert-success, .alert-danger, .alert-warning, .alert-info {
  --bs-alert-bg: var(--cs-surface); --bs-alert-color: var(--cs-text); --bs-alert-border-color: var(--cs-line);
  --bs-alert-link-color: var(--cs-text);
  border-left-width: 3px; border-radius: .6rem;
}
.alert-success { border-left-color: var(--cs-green); }
.alert-danger { border-left-color: var(--cs-red); }
.alert-warning { border-left-color: var(--cs-amber); }
.alert-info { border-left-color: var(--cs-line-strong); }
.alert-success > .bi { color: var(--cs-green); }
.alert-danger > .bi { color: var(--cs-red); }
.alert-warning > .bi { color: var(--cs-amber); }
.alert-info > .bi { color: var(--cs-muted); }
.flash-stack .alert { display: flex; gap: .6rem; align-items: flex-start; }
.flash-stack .alert .bi { font-size: 1.05rem; line-height: 1.35; }

/* ---------- Chips (status / reputation): grey pill + small coloured dot ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
  font-size: .75rem; font-weight: 500; line-height: 1; color: var(--cs-text);
  background: var(--cs-chip); border: 1px solid var(--cs-line); border-radius: 999px; padding: .3rem .6rem;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cs-line-strong); flex-shrink: 0; }
.chip-danger .dot { background: var(--cs-red); }
.chip-warning .dot { background: var(--cs-amber); }
.chip-success .dot { background: var(--cs-green); }
.chip-info .dot, .chip-primary .dot { background: var(--cs-blue); }
/* a chip with an icon (no dot) keeps its colour on the icon */
.chip-danger > .bi { color: var(--cs-red); }
.chip-warning > .bi { color: var(--cs-amber); }
.chip-success > .bi { color: var(--cs-green); }
.chip-info > .bi, .chip-primary > .bi { color: var(--cs-blue); }
.chip-due { font-weight: 600; }
.chip-due.chip-warning { color: var(--cs-amber); }
.chip-due.chip-danger { color: var(--cs-red); }
.chip-dark .dot { background: var(--cs-text); }
.chip .bi { font-size: .8rem; }
.count-pill { display: inline-block; min-width: 1.4rem; padding: .1rem .4rem; border-radius: 999px; font-size: .72rem; font-weight: 600; text-align: center; background: var(--cs-chip); color: var(--cs-muted); }
.nav-pills .nav-link.active .count-pill { background: rgba(255, 255, 255, .2); color: inherit; }
.badge-count { display: inline-flex; align-items: center; justify-content: center; min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; border-radius: 999px; background: var(--cs-red); color: #fff; font-size: .68rem; font-weight: 700; line-height: 1; }

/* ---------- Navbar ---------- */
.cs-navbar { background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--cs-line); }
[data-bs-theme="dark"] .cs-navbar { background: rgba(15, 16, 18, .9); }
.cs-brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em; color: var(--cs-text); }
.cs-brand:hover { color: var(--cs-text); }
.cs-brand img { width: 30px; height: 30px; }
.cs-brand small { display: block; font-size: .68rem; font-weight: 500; color: var(--cs-muted); letter-spacing: 0; margin-top: -2px; }
.cs-navbar .nav-link { font-weight: 500; color: var(--cs-muted); border-radius: .5rem; padding: .5rem .8rem !important; display: flex; align-items: center; gap: .45rem; white-space: nowrap; }
@media (min-width: 992px) and (max-width: 1199.98px) {          /* 1024-wide screens: menu on one line */
  .cs-brand small { display: none; }
  .cs-navbar .nav-link { padding: .5rem .6rem !important; gap: .35rem; }
}
.cs-navbar .nav-link:hover { color: var(--cs-text); background: var(--cs-chip); }
.cs-navbar .nav-link.active { color: var(--cs-text); background: var(--cs-chip); }
.cs-icon-btn { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: .55rem; color: var(--cs-muted); border: 1px solid var(--cs-line); background: var(--cs-surface); position: relative; }
.cs-icon-btn:hover { color: var(--cs-text); }
.cs-icon-btn .badge-count { position: absolute; top: -6px; right: -6px; }

/* ---------- Avatars ---------- */
.cs-avatar { width: var(--sz, 40px); height: var(--sz, 40px); border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--cs-chip); border: 1px solid var(--cs-line); }
.cs-avatar-initials { display: inline-flex; align-items: center; justify-content: center; font-weight: 600; color: var(--cs-text); font-size: calc(var(--sz, 40px) * .36); background: var(--cs-chip); }

/* ---------- Cards / surfaces ---------- */
.cs-card { background: var(--cs-surface); border: 1px solid var(--cs-line); border-radius: .9rem; box-shadow: var(--cs-shadow); }
.cs-card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--cs-line); display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.cs-card-header h2, .cs-card-header h3, .cs-card-header h5 { font-size: 1rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: .5rem; }
.cs-card-header h2 .bi { color: var(--cs-muted); }
.cs-card-body { padding: 1.25rem; }
.cs-card .list-group { --bs-list-group-bg: transparent; --bs-list-group-border-color: var(--cs-line); --bs-list-group-action-hover-bg: var(--cs-surface-2); --bs-list-group-action-active-bg: var(--cs-chip); }
.cs-section-title { font-size: 1.05rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; margin-bottom: .9rem; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; margin: 0; }
.page-head p { color: var(--cs-muted); margin: .25rem 0 0; }

.stat { padding: 1.1rem 1.25rem; display: flex; gap: .9rem; align-items: center; height: 100%; }
.icon-tile { width: 42px; height: 42px; border-radius: .65rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; flex-shrink: 0; background: var(--cs-chip); color: var(--cs-text); }
.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--cs-muted); font-weight: 500; }
.stat-box { padding: 1rem; border-radius: .7rem; background: var(--cs-surface-2); border: 1px solid var(--cs-line); }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--cs-muted); }
.empty .bi { font-size: 2.2rem; display: block; margin-bottom: .6rem; opacity: .5; }

/* ---------- Task highlight: white card, thin red edge ---------- */
.task-zone { background: var(--cs-surface); border: 1px solid var(--cs-line); border-left: 3px solid var(--cs-red); border-radius: .9rem; padding: 1.25rem; }
.task-zone h2 { font-size: 1.05rem; font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.task-item { background: var(--cs-surface); border: 1px solid var(--cs-line); border-left: 3px solid var(--cs-line-strong); border-radius: .7rem; padding: .85rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
/* a sub-back card (Nhiệm vụ): avatar beside the name (not a column of its own: the lines get the full width), then
   member · when, then deadline + asks + draft on one line, the time bar */
.ti-main { flex: 1 1 320px; display: flex; flex-direction: column; gap: .3rem; }
.ti-head { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.ti-line { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; min-width: 0; font-size: .82rem; }
.ti-title { display: flex; align-items: baseline; gap: .5rem; min-width: 0; }
.ti-title > .fw-semibold { min-width: 0; }
.ti-ago { margin-left: auto; flex-shrink: 0; color: var(--cs-muted); font-size: .76rem; white-space: nowrap; }
.ti-main .debt-meter { margin-top: .2rem; }
/* what is new (Nhiệm vụ, top): messages + notices as two pills on one row */
.inbox-strip { display: flex; gap: .5rem; }
.inbox-pill { display: flex; align-items: center; gap: .5rem; min-width: 0; padding: .55rem .85rem; border-radius: .8rem; font-size: .9rem;
  color: var(--cs-text); border: 1px solid transparent; text-decoration: none; }
.inbox-pill:hover { color: var(--cs-text); text-decoration: none; }
.inbox-pill.is-chat { flex: 1 1 auto; background: var(--c-sky-bg); }
.inbox-pill.is-chat .bi { color: var(--c-sky); }
.inbox-pill.is-chat:hover { border-color: var(--c-sky); }
.inbox-pill.is-bell { flex: 0 0 auto; background: var(--c-amber-bg); white-space: nowrap; }
.inbox-pill.is-chat { min-width: 0; flex-basis: 0; }
.inbox-pill.is-bell .bi { color: var(--c-amber); }
.inbox-pill.is-bell:hover { border-color: var(--c-amber); }
.inbox-pill:only-child { flex: 1 1 auto; }
.task-item.is-due_soon { border-left-color: var(--cs-amber); }
.task-text { flex: 1 1 0; }
.task-item.is-overdue { border-left-color: var(--cs-red); }
.deadline { font-size: .8rem; font-weight: 600; display: inline-flex; align-items: center; gap: .3rem; color: var(--cs-muted); white-space: nowrap; }
.deadline.due_soon { color: var(--cs-amber); }
.deadline.overdue { color: var(--cs-red); }

/* ---------- Market ---------- */
.channel-card { height: 100%; display: flex; flex-direction: column; transition: box-shadow .15s ease, border-color .15s; }
.channel-card:hover { box-shadow: var(--cs-shadow-lg); border-color: var(--cs-line-strong); }
.channel-card .cc-body { padding: 1.1rem 1.1rem .8rem; flex: 1; }
.channel-card .cc-title { font-weight: 600; font-size: 1rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-card .cc-handle { display: flex; min-width: 0; margin-top: .3rem; }
.channel-card .cc-desc { font-size: .82rem; color: var(--cs-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; margin: .7rem 0 0; }
.channel-card .cc-owner { font-size: .8rem; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; row-gap: .45rem; margin-top: .75rem; }
.channel-card .cc-owner > .name-tag { flex: 1 1 auto; }
/* under the member's name: subs given / received today, complaints (red when there are any) */
.channel-card .cc-today { display: flex; flex-wrap: wrap; gap: .15rem .7rem; margin-top: .4rem; font-size: .78rem; color: var(--cs-muted); }
.channel-card .cc-today b { color: var(--cs-text); font-weight: 600; }
.channel-card .cc-today .is-bad, .channel-card .cc-today .is-bad b { color: var(--cs-red); font-weight: 600; }
.channel-card .cc-foot { padding: .8rem 1.1rem 1rem; display: flex; gap: .5rem; border-top: 1px solid var(--cs-line); }
.channel-card.is-owe { border-left: 3px solid var(--cs-red); }
.channel-card.is-done { opacity: .62; }
.channel-card.is-done:hover { opacity: 1; }
.cc-ribbon { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem; margin-bottom: .85rem; min-height: 1.6rem; }
.cc-ribbon .deadline { font-size: .74rem; }

.filter-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.filter-bar .nav-pills { background: var(--cs-surface); border: 1px solid var(--cs-line); padding: .25rem; border-radius: .7rem; }
.filter-bar .nav-pills .nav-link { padding: .4rem .85rem; font-size: .9rem; }
.search-box { position: relative; min-width: 300px; }
.search-box .bi { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--cs-muted); }
.search-box input { padding-left: 2.3rem; }
/* Activity (/subs): search + "Tôi đã sub ai" / "Ai đã sub tôi" ticks, then the count */
.subs-filter { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.subs-filter .search-box { flex: 1 1 280px; min-width: 0; }
.subs-filter .esc-kind-filter { flex: 1 1 200px; max-width: 280px; min-height: 40px; }
/* phones: search + reason filter share one row (Khiếu nại) */
@media (max-width: 575.98px) { .subs-filter:has(.esc-kind-filter) .search-box { flex: 1 1 0; } .subs-filter .esc-kind-filter { flex: 0 0 42%; max-width: 42%; } }
.check-pills { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
/* phones: the three ticks on one row that scrolls sideways (they took two rows) */
@media (max-width: 575.98px) {
  .check-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; padding-bottom: .1rem; }
  .check-pills::-webkit-scrollbar { display: none; }
  .check-pill { flex: 0 0 auto; min-height: 36px; padding: .3rem .7rem; font-size: .86rem; }
}
.check-pill { display: inline-flex; align-items: center; gap: .45rem; min-height: 40px; margin: 0; padding: .35rem .85rem;
  border: 1px solid var(--cs-line); border-radius: 999px; background: var(--cs-surface); font-size: .9rem; font-weight: 500;
  cursor: pointer; user-select: none; }
.check-pill input { width: 1.1em; height: 1.1em; margin: 0; accent-color: var(--cs-accent); }
.check-pill .bi { color: var(--cs-muted); }
.check-pill:has(input:checked) { border-color: var(--cs-accent); color: var(--cs-accent); }
.check-pill:has(input:checked) .bi { color: var(--cs-accent); }
.subs-count { display: flex; justify-content: space-between; gap: .5rem; margin: 0 .25rem .5rem; font-size: .85rem; color: var(--cs-muted); }

/* ---------- Proof upload ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { position: relative; padding: 0 0 1rem 2.5rem; }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: -.05rem; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--cs-chip); border: 1px solid var(--cs-line); color: var(--cs-text); font-weight: 600; display: flex; align-items: center; justify-content: center; font-size: .85rem; }
.steps li strong { display: block; font-weight: 600; }

.dropzone {
  border: 1.5px dashed var(--cs-line-strong); border-radius: .9rem; background: var(--cs-surface-2);
  min-height: 260px; display: flex; align-items: center; justify-content: center; text-align: center;
  cursor: pointer; position: relative; overflow: hidden; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-drag, .dropzone:focus-within { border-color: var(--cs-muted); background: var(--cs-surface); outline: none; }
.dropzone.is-invalid { border-color: var(--cs-red); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .dz-empty { padding: 1.5rem; pointer-events: none; }
.dropzone .dz-empty .bi { font-size: 2rem; color: var(--cs-muted); }
.dropzone .dz-preview { position: absolute; inset: 0; display: none; background: var(--cs-chip); }
.dropzone .dz-preview img { width: 100%; height: 100%; object-fit: contain; }
.dropzone.has-file .dz-preview { display: block; }
.dropzone.has-file .dz-empty { visibility: hidden; }
.dropzone:not(.has-file) [data-dz-clear], .dropzone:not(.has-file) .dz-size { display: none; }
.dz-meta { position: absolute; left: .6rem; right: .6rem; bottom: .6rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; z-index: 2; pointer-events: none; }
.dz-meta [data-dz-clear] { pointer-events: auto; cursor: pointer; }
.dz-label { font-weight: 600; font-size: .95rem; margin-bottom: .5rem; display: flex; align-items: center; gap: .45rem; }
.dz-label .num { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; color: var(--cs-accent-text); background: var(--cs-accent); }

/* Small dark label laid over images (TRƯỚC / SAU, file size) */
.tag { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600; color: #fff; background: rgba(17, 24, 39, .78); border: 0; border-radius: .4rem; padding: .25rem .5rem; }
.tag:empty { display: none; }
.tag-light { color: #111827; background: rgba(255, 255, 255, .92); }

/* ---------- Proof view ---------- */
.proof-frame { border-radius: .8rem; overflow: hidden; border: 1px solid var(--cs-line); background: var(--cs-chip); display: block; position: relative; }
.proof-frame img { width: 100%; height: 340px; object-fit: contain; display: block; }
.proof-frame .tag { position: absolute; left: .6rem; top: .6rem; }
.proof-thumb { width: 60px; height: 46px; object-fit: cover; object-position: top; border-radius: .4rem; border: 1px solid var(--cs-line); background: var(--cs-chip); }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 1px; background: var(--cs-line-strong); }
.timeline li { position: relative; padding: 0 0 1.1rem 2.2rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .dot { position: absolute; left: 1px; top: 1px; width: 21px; height: 21px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .7rem; background: var(--cs-surface); border: 1px solid var(--cs-line-strong); color: var(--cs-text); }
.timeline .dot.is-red { color: var(--cs-red); border-color: var(--cs-red); }

/* ---------- Landing ---------- */
.hero { padding: 4.5rem 0 3.5rem; border-bottom: 1px solid var(--cs-line); background: var(--cs-surface); }
.hero h1 { font-size: clamp(2rem, 4.2vw, 3.2rem); font-weight: 800; line-height: 1.1; letter-spacing: -.035em; }
.hero h1 .soft { color: var(--cs-muted); }
.hero .lead { color: var(--cs-muted); font-size: 1.1rem; max-width: 540px; }
.mock { background: var(--cs-surface-2); border: 1px solid var(--cs-line); border-radius: 1rem; padding: 1rem; }
.mock-screen { height: 140px; border-radius: .7rem; border: 1px solid var(--cs-line); background: var(--cs-surface); display: flex; align-items: center; justify-content: center; position: relative; }
.mock-screen .tag { position: absolute; left: .5rem; top: .5rem; }
.mock-btn { font-size: .8rem; font-weight: 600; border-radius: 999px; padding: .35rem .9rem; border: 1px solid var(--cs-line-strong); background: var(--cs-surface); }
.mock-btn.is-dark { background: var(--cs-text); color: var(--cs-surface); border-color: var(--cs-text); }
.step-num { font-size: .72rem; font-weight: 600; color: var(--cs-muted); letter-spacing: .08em; text-transform: uppercase; }
.cta-box { background: var(--cs-surface); border: 1px solid var(--cs-line); border-radius: 1rem; padding: 2.5rem 2rem; text-align: center; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: calc(100vh - 140px); display: flex; align-items: center; padding: 2.5rem 0; }
.auth-card { overflow: hidden; }
.auth-side { background: var(--cs-surface-2); border-right: 1px solid var(--cs-line); padding: 2.5rem; height: 100%; }
.auth-side p { color: var(--cs-muted); }
.auth-side li { margin-bottom: .8rem; display: flex; gap: .6rem; }
.auth-side li .bi { color: var(--cs-muted); }
.auth-form { padding: 2.5rem; }
.input-icon { position: relative; }
.input-icon > .bi { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--cs-muted); z-index: 3; }
.input-icon > .form-control { padding-left: 2.5rem; }
.pw-toggle { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); z-index: 3; border: 0; background: transparent; color: var(--cs-muted); padding: .25rem .5rem; }

/* ---------- Admin ---------- */
.admin-nav .nav-link { display: flex; align-items: center; gap: .5rem; }
.table-actions { white-space: nowrap; }
.table-actions form { display: inline; }

/* ---------- Footer / misc ---------- */
.cs-footer { border-top: 1px solid var(--cs-line); color: var(--cs-muted); font-size: .85rem; padding: 1.1rem 0; margin-top: 2rem; background: var(--cs-surface); }
.cs-footer a { color: var(--cs-muted); }
.kbd-hint { font-size: .75rem; color: var(--cs-muted); }
kbd { background: var(--cs-surface); color: var(--cs-text); border: 1px solid var(--cs-line); box-shadow: inset 0 -1px 0 var(--cs-line); font-size: .72rem; }
.note-box { padding: .9rem 1rem; border-radius: .6rem; background: var(--cs-surface-2); border: 1px solid var(--cs-line); }
.lightbox-img { max-height: 85vh; width: auto; max-width: 100%; }
.rule-list li { margin-bottom: .55rem; }
.check-list li { display: flex; gap: .55rem; margin-bottom: .55rem; }
.check-list .bi { color: var(--cs-muted); }

.thread-time { white-space: nowrap; }
@media (min-width: 768px) { .w-md-auto { width: auto !important; } }

/* Phone list that replaces a wide table (history) */
.m-list { list-style: none; margin: 0; padding: 0; }
.m-list > li + li { border-top: 1px solid var(--cs-line); }
.m-row { display: flex; gap: .75rem; align-items: center; padding: .8rem 1rem; color: inherit; text-decoration: none; }
.m-row:hover { text-decoration: none; background: var(--cs-surface-2); }
.m-row:active { background: var(--cs-chip); }
.m-row .m-thumbs { display: flex; flex-shrink: 0; }
.m-row .m-thumbs .proof-thumb { width: 40px; height: 54px; }
.m-row .m-thumbs .proof-thumb + .proof-thumb { margin-left: -14px; box-shadow: -2px 0 0 var(--cs-surface); }
.m-row .m-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-row .m-sub { font-size: .8rem; color: var(--cs-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-row .m-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; align-items: center; }
.m-row .bi-chevron-right { color: var(--cs-line-strong); flex-shrink: 0; }
/* Sub lists as a table on wide screens (<ul class="m-list sub-table">, user 2026-12-01 "dàn dữ liệu sang bên phải"):
   proof | Kênh | Thành viên | Trạng thái | Thời gian, one line per sub, headings on top. Phones keep the stacked row. */
.sub-table-head { display: none; }
/* Phones / tablets (user 2026-12-02 "tối ưu không gian"): channels on line 1, members · time on line 2, the status
   chip on line 3 — and no proof thumbnails on a phone (too small to read; the sub page shows them) */
@media (max-width: 991.98px) {
  .m-row .m-cols { display: flex; flex-wrap: wrap; align-items: center; column-gap: .4rem; row-gap: .15rem; }
  .m-row .m-cols > .mc-ch, .m-row .m-cols > .mc-mem { flex: 1 0 100%; }
  .m-row .m-cols > .mc-mem .nt-value { font-weight: 600; }
  .m-row .m-cols > .mc-status { order: 3; flex: 0 1 auto; margin-top: .2rem; }           /* status chip …  */
  .m-row .m-cols > .mc-time { order: 4; margin-left: auto; margin-top: .2rem; white-space: nowrap; }   /* … time right */
}
@media (max-width: 575.98px) { .m-row .m-thumbs { display: none; } }
@media (min-width: 992px) {
  .sub-table .m-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, .9fr) 7rem;
    column-gap: 1.25rem; align-items: center; }
  .sub-table .mc-ch { grid-column: 1; grid-row: 1; }
  .sub-table .mc-mem { grid-column: 2; grid-row: 1; }
  .sub-table .mc-status { grid-column: 3; grid-row: 1; margin-top: 0; flex-direction: column; align-items: flex-start; gap: .25rem; }
  .sub-table .mc-time { grid-column: 4; grid-row: 1; text-align: right; }
  .sub-table .m-row { padding-top: .65rem; padding-bottom: .65rem; }
  .sub-table-head { display: flex; gap: .75rem; align-items: center; padding: .5rem 1rem; background: var(--cs-surface-2);
    color: var(--cs-muted); font-size: .75rem; font-weight: 600; }
  .sub-table-head .m-thumbs { width: 66px; flex-shrink: 0; white-space: nowrap; }
  .sub-table-head .m-cols { flex: 1 1 auto; min-width: 0; }
  .sub-table-head .bi { flex-shrink: 0; font-size: var(--bs-body-font-size); }   /* same width as a row's chevron */
}

/* ---------- Touch vs mouse copy ("chạm để chọn" / "kéo thả, Ctrl+V") ---------- */
@media (hover: none), (pointer: coarse) { .only-mouse { display: none !important; } }
@media (hover: hover) and (pointer: fine) { .only-touch { display: none !important; } }

/* ---------- Phone tab bar + "Tôi" sheet (below lg) ---------- */
.cs-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 0 max(env(safe-area-inset-right), .25rem) env(safe-area-inset-bottom) max(env(safe-area-inset-left), .25rem);
  background: rgba(255, 255, 255, .94); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--cs-line);
}
[data-bs-theme="dark"] .cs-tabbar { background: rgba(15, 16, 18, .92); }
.cs-tabbar > a, .cs-tabbar > button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  height: 58px; padding: 0 .1rem; border: 0; background: none; color: var(--cs-muted);
  font-size: .69rem; font-weight: 500; line-height: 1.1; text-align: center; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.cs-tabbar > a > span:last-child, .cs-tabbar > button > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-tabbar .tab-icon { position: relative; height: 26px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.cs-tabbar .tab-icon .badge-count { position: absolute; top: -5px; left: 58%; min-width: 1.25rem; height: 1.25rem; font-size: .7rem;
  box-shadow: 0 0 0 2px var(--cs-surface); }                     /* a white ring, like Facebook's tab numbers */
.cs-tabbar .tab-icon .badge-bal { left: 72%; padding: 0 .32rem; }      /* off the avatar's initials */
.badge-bal.is-pos { background: var(--c-green); }
.badge-bal.is-neg { background: var(--cs-red); }
[data-bs-theme="dark"] .badge-bal.is-pos { color: #0b1a10; }
.cs-tabbar .tab-icon .cs-avatar { font-size: .62rem; }
.cs-tabbar .active { color: var(--cs-text); font-weight: 600; }
.cs-tabbar .active .cs-avatar { border-color: var(--cs-text); }
.cs-tabbar a:active, .cs-tabbar button:active { background: var(--cs-chip); }

.cs-sheet { --bs-offcanvas-height: auto; --bs-offcanvas-bg: var(--cs-surface); border-radius: 1.1rem 1.1rem 0 0; max-height: 85vh; padding-bottom: env(safe-area-inset-bottom); }
.cs-sheet .sheet-grip { width: 38px; height: 4px; border-radius: 4px; background: var(--cs-line-strong); margin: .55rem auto 0; }
.sheet-list { border: 1px solid var(--cs-line); border-radius: .8rem; overflow: hidden; }
.sheet-list > a, .sheet-list > button {
  display: flex; align-items: center; gap: .8rem; width: 100%; min-height: 52px; padding: .7rem 1rem;
  border: 0; border-bottom: 1px solid var(--cs-line); background: var(--cs-surface); color: var(--cs-text);
  font-weight: 500; text-align: left; text-decoration: none;
}
.sheet-list > :last-child { border-bottom: 0; }
.sheet-list > a:active, .sheet-list > button:active { background: var(--cs-chip); }
.sheet-list .bi:first-child { font-size: 1.15rem; color: var(--cs-muted); width: 1.3rem; text-align: center; }
.sheet-list .bi-chevron-right { margin-left: auto; color: var(--cs-line-strong); font-size: .85rem; }

/* Horizontal pill bars that scroll instead of wrapping (market filter, history tabs, admin / profile menus). */
.scroll-x { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x .nav-link { white-space: nowrap; }

/* ---------- Phones & small tablets ---------- */
@media (max-width: 991.98px) {
  html { -webkit-text-size-adjust: 100%; }
  body { -webkit-tap-highlight-color: transparent; }
  body.has-tabbar { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .cs-navbar { padding-top: calc(.5rem + env(safe-area-inset-top)); padding-bottom: .5rem; }
  .cs-footer { margin-top: 2rem; padding: 1.1rem 0; font-size: .8rem; }
  .admin-nav-card { position: static !important; }
  .admin-nav-card .nav { flex-direction: row !important; }
  .admin-nav-card .text-uppercase { display: none; }
}

@media (max-width: 767.98px) {
  /* 16px side gutter on phones */
  .container { --bs-gutter-x: 2rem; }
  main > .container { padding-top: 1.1rem !important; padding-bottom: 1.5rem !important; }

  .cs-brand { margin-right: .25rem; font-size: 1.08rem; gap: .5rem; }
  .cs-brand img { width: 30px; height: 30px; }
  .cs-brand small { display: none; }
  .cs-icon-btn { width: 40px; height: 40px; }

  /* Comfortable touch targets: no control under ~40px high */
  .btn { --bs-btn-padding-y: .55rem; }
  .btn-sm { --bs-btn-padding-y: .5rem; --bs-btn-padding-x: .8rem; --bs-btn-font-size: .875rem; }
  .btn-lg { --bs-btn-padding-y: .75rem; --bs-btn-font-size: 1.05rem; }
  .form-control, .form-select { font-size: 16px; min-height: 46px; }   /* 16px: iOS does not zoom on focus */
  textarea.form-control { min-height: 0; }
  .form-check { min-height: 1.75rem; padding-left: 2rem; }
  .form-check .form-check-input { width: 1.3em; height: 1.3em; margin-left: -2rem; margin-top: .1em; }
  .form-check-label { padding-top: .1rem; }
  .pagination { --bs-pagination-padding-x: .9rem; --bs-pagination-padding-y: .55rem; }
  .dropdown-item { padding: .65rem .85rem; }
  .pw-toggle { right: .15rem; width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

  /* Page header: title, one-line hint, actions on their own full-width row */
  .page-head { gap: .75rem; margin-bottom: 1.1rem; align-items: stretch; }
  .page-head h1 { font-size: 1.35rem; }
  .page-head p { font-size: .9rem; }
  .page-head > .page-actions { width: 100%; }
  .page-head > .btn { align-self: flex-start; }
  .page-actions > .btn { flex: 1 1 0; }
  .page-actions .btn { white-space: nowrap; }

  .cs-card { border-radius: .85rem; }
  .cs-card-header { flex-wrap: wrap; row-gap: .2rem; padding: .85rem 1rem; }
  .cs-card-header > span.small.text-muted { flex-basis: 100%; order: 3; font-size: .8rem; }
  .cs-card-body { padding: 1rem; }
  .cs-section-title { font-size: 1rem; }
  .task-zone { padding: 1rem; border-radius: .85rem; }
  .task-item { padding: .85rem; }
  .task-actions { width: 100%; }
  .task-actions > .btn-primary { flex: 1 1 auto; justify-content: center; }
  .waiting-actions { width: 100%; }
  .waiting-actions > .btn-sm:not(.btn-messenger) { flex: 1 1 auto; }
  .alert { font-size: .9rem; }

  .stat { padding: .8rem .85rem; gap: .65rem; }
  .stat .icon-tile { width: 34px; height: 34px; font-size: 1rem; }
  .stat-value { font-size: 1.2rem; }
  .stat-label { font-size: .75rem; line-height: 1.25; }

  /* Market */
  .filter-bar { gap: .6rem; margin-bottom: 1rem; }
  .filter-bar .nav-pills { width: 100%; }
  .filter-bar .nav-pills .nav-item { flex: 1 1 0; }
  .filter-bar .nav-pills .nav-link { justify-content: center; display: flex; align-items: center; padding: .55rem .5rem; }
  .filter-bar .nav-pills .nav-link > .bi { display: none; }
  .search-box { min-width: 100%; }
  .channel-card .cc-body { padding: .95rem .95rem .8rem; }
  .channel-card .cc-ribbon { margin-bottom: .7rem; }
  .channel-card .cc-head .cs-avatar { --sz: 48px !important; }
  .channel-card .cc-desc { margin-top: .55rem; min-height: 0; }
  .channel-card .cc-foot { padding: .75rem .95rem .9rem; }
  .channel-card .cc-foot .btn-soft, .channel-card .cc-foot .btn-messenger { width: 44px; flex: 0 0 44px; padding-left: 0; padding-right: 0; }
  .channel-card.is-done { opacity: .75; }

  /* Proof upload: before / after side by side, portrait phone screenshots */
  .dropzone { min-height: 230px; border-radius: .8rem; }
  .dropzone .dz-empty { padding: 1rem .5rem; font-size: .85rem; }
  .dz-label { font-size: .85rem; }
  .dz-meta { left: .4rem; right: .4rem; bottom: .4rem; }
  .dz-meta .dz-size, .dz-meta > .tag:first-child { display: none; }
  .dz-meta [data-dz-clear] { margin-left: auto; padding: .4rem .6rem; }
  .proof-frame img { height: 300px; }
  .proof-frame .tag { left: .4rem; top: .4rem; }

  /* Notes thread */
  .thread-note { max-width: 92%; }
  .thread-body { font-size: .95rem; }

  /* Landing / auth */
  .hero { padding: 2rem 0 2.25rem; }
  .hero .lead { font-size: 1rem; }
  .hero-cta > .btn { width: 100%; padding-left: 1rem; padding-right: 1rem; }
  .hero-stats { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: .75rem !important; }
  .cta-box { padding: 1.75rem 1.25rem; }
  .auth-wrap { min-height: 0; padding: .5rem 0 1rem; }
  .auth-form, .auth-side { padding: 1.4rem 1.25rem; }

  .btn-row > a, .btn-row > form { flex: 1 1 auto; }
  .btn-row > form .btn { width: 100%; }
  .btn-row > a.btn-soft, .btn-row > .dropdown { flex: 0 0 auto; }      /* Sửa + ⋯: icon buttons beside the main one */
  .btn-row > form:last-child:has(.btn-outline-danger) { flex: 0 0 auto; }

  /* Tables that stay tables (admin): smaller cells, still scroll sideways */
  .table > :not(caption) > * > * { padding: .6rem .65rem; }
  .table-responsive .table td, .table-responsive .table th { white-space: nowrap; }
  .lightbox-img { max-height: 78vh; }
  .modal-dialog { margin: .75rem; }
}

@media (max-width: 374.98px) {   /* iPhone SE / mini */
  .cs-brand span { font-size: 1rem; }
  .cs-tabbar > a, .cs-tabbar > button { font-size: .64rem; }
  .stat .icon-tile { display: none; }
  .hero-stats { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---------- Notes & log thread on a subscription item ---------- */
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.thread-event { display: flex; align-items: baseline; gap: .15rem; font-size: .8rem; color: var(--cs-muted); padding: 0 .25rem; }
.thread-event .bi { color: var(--cs-line-strong); }
.thread-note { max-width: 85%; align-self: flex-start; }
.thread-note.is-mine { align-self: flex-end; text-align: right; }
.thread-meta { font-size: .75rem; color: var(--cs-muted); margin-bottom: .2rem; }
.thread-meta b { color: var(--cs-text); font-weight: 600; }
.thread-body { display: inline-block; text-align: left; white-space: pre-wrap; word-break: break-word; padding: .6rem .8rem; border-radius: .7rem; border: 1px solid var(--cs-line); background: var(--cs-surface); }
.thread-note.is-mine .thread-body { background: var(--cs-chip); }

/* ---------- "?" help button + popover ---------- */
.help-tip { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; position: relative;
  width: 1.15rem; height: 1.15rem; padding: 0; margin-left: .15rem; border: 0; background: none; color: var(--cs-muted);
  font-size: .85rem; line-height: 1; cursor: help; border-radius: 50%; }
.help-tip::after { content: ""; position: absolute; inset: -12px; }            /* 40px touch area */
.help-tip:hover, .help-tip:focus-visible { color: var(--cs-text); }
.help-pop { --bs-popover-max-width: 270px; --bs-popover-font-size: .85rem; --bs-popover-bg: var(--cs-surface);
  --bs-popover-border-color: var(--cs-line-strong); --bs-popover-header-bg: var(--cs-surface-2);
  --bs-popover-body-color: var(--cs-text); box-shadow: var(--cs-shadow-lg); }
.help-pop .popover-header { font-size: .85rem; font-weight: 600; }

/* ---------- Stars, balance ---------- */
.stars { display: inline-flex; gap: 1px; color: #f59e0b; font-size: .95rem; line-height: 1; white-space: nowrap; }
.stars.stars-sm { font-size: .78rem; }
.stars.is-new { color: var(--cs-muted); font-size: .72rem; font-weight: 600; background: var(--cs-chip); border: 1px solid var(--cs-line); border-radius: 999px; padding: .2rem .5rem; }
[data-bs-theme="dark"] .stars { color: #fbbf24; }
.bal { font-weight: 700; font-variant-numeric: tabular-nums; }
.bal.is-pos { color: var(--cs-green); }
.bal.is-neg { color: var(--cs-text); }
.bal.is-low { color: var(--cs-red); }
.bal-mini { font-size: .72rem; color: var(--cs-muted); font-variant-numeric: tabular-nums; }

/* ---------- KPI tiles (dashboard, member, channel): a big icon on the left, the number and its label big and
   right-aligned (user 2026-12-02 "chữ sang góc phải và to lên, icon góc trái to lên"); links under, full width ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.kpi { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "ic value" "ic label" "links links";
  align-items: center; column-gap: .65rem; row-gap: 0; min-width: 0; padding: .75rem .85rem;
  border: 1px solid var(--cs-line); border-radius: .8rem; background: var(--cs-surface-2); color: inherit; text-decoration: none; }
a.kpi:hover { text-decoration: none; border-color: var(--cs-line-strong); }
.kpi > .ic { grid-area: ic; align-self: center; width: 48px; height: 48px; border-radius: 14px; font-size: 1.5rem; margin: 0; }
.kpi-value { grid-area: value; justify-self: end; align-self: end; max-width: 100%; font-size: 1.7rem; font-weight: 800; line-height: 1.1;
  min-height: 1.9rem; display: flex; align-items: center; justify-content: flex-end; text-align: right; font-variant-numeric: tabular-nums; }
.kpi-value .stars { font-size: 1.05rem; }
.kpi-value .stars.is-new { font-size: .8rem; }
.kpi-label { grid-area: label; justify-self: end; align-self: start; max-width: 100%; margin-top: .15rem; font-size: .86rem; font-weight: 500;
  color: var(--cs-muted); line-height: 1.25; text-align: right; }
/* links under a KPI ("Đã sub" → Xem các bạn đã sub / chưa trả) */
.kpi-links { grid-area: links; display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; margin-top: .55rem;
  font-size: .8rem; font-weight: 600; line-height: 1.3; text-align: right; }
.kpi-links a { color: var(--cs-accent); text-wrap: balance; }          /* 2 even lines, never a lone word */
.ch-hero { padding: 1rem 1.1rem; }

/* ---------- Channel switcher ---------- */
.ch-switch { display: inline-flex; align-items: center; gap: .35rem; height: 40px; padding: 0 .55rem 0 .3rem; position: relative;
  border: 1px solid var(--cs-line); border-radius: 999px; background: var(--cs-surface); color: var(--cs-text); max-width: 220px; }
.ch-switch .bi-chevron-down { font-size: .7rem; color: var(--cs-muted); }
.ch-switch > .text-truncate { font-size: .85rem; font-weight: 600; max-width: 140px; }
.ch-switch .dot-alert { position: absolute; top: 2px; right: 2px; width: 9px; height: 9px; border-radius: 50%; background: var(--cs-red); border: 2px solid var(--cs-surface); }
/* The desktop header stays on one line at every width, however long the channel name (measured: 5 menu items
   ≈ 650–710 px). Below 1400 px the switcher shows the channel's avatar only (its name is in the button's tooltip
   and at the top of the menu); at 992–1199 px the menu items drop their icons. */
@media (min-width: 992px) and (max-width: 1399.98px) {
  .ch-switch > .text-truncate { display: none; }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
  .cs-navbar .nav-link > .bi:first-child { display: none; }
}
.switch-menu { width: 300px; }
.switch-menu form, .switch-list form { margin: 0; }
.switch-item { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .55rem .6rem; border: 0; border-radius: .5rem;
  background: none; color: var(--cs-text); text-align: left; }
.switch-item:hover { background: var(--cs-chip); }
.switch-item.is-current { background: var(--cs-chip); }
.switch-item .bi-check-lg { color: var(--cs-text); font-size: 1.1rem; }
.switch-list .switch-item { border-radius: 0; min-height: 60px; padding: .6rem 1rem; border-bottom: 1px solid var(--cs-line); }
.switch-list form:last-child .switch-item { border-bottom: 0; }
.acting { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border: 1px solid var(--cs-line);
  border-radius: .7rem; background: var(--cs-surface); min-width: 0; }
.acting b { min-width: 0; }
.acting > .small, .acting > .btn { white-space: nowrap; flex-shrink: 0; }
.acting > .name-tag { flex: 0 1 auto; flex-wrap: nowrap; }
.chip-btn { cursor: pointer; gap: .4rem; }
.chip-btn .cs-avatar { border: 0; }
.ch-link { display: inline-flex; align-items: center; gap: .4rem; min-width: 0; color: inherit; }

/* ---------- Members leaderboard ---------- */
.rank { flex: 0 0 auto; width: 1.7rem; height: 1.7rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: var(--cs-muted); background: var(--cs-chip); }
.rank-1 { background: #fef3c7; color: #92400e; }
.rank-2 { background: #e5e7eb; color: #374151; }
.rank-3 { background: #fde8d7; color: #9a3412; }
[data-bs-theme="dark"] .rank-1 { background: #422006; color: #fcd34d; }
[data-bs-theme="dark"] .rank-2 { background: #2a2d33; color: #e5e7eb; }
[data-bs-theme="dark"] .rank-3 { background: #431407; color: #fdba74; }
/* /members: one short card per member in a grid (4 / 3 / 2 / 1 columns) */
.member-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: .6rem; }
.member-box { display: flex; align-items: center; gap: .7rem; height: 100%; padding: .7rem .8rem; color: inherit; text-decoration: none;
  background: var(--cs-surface); border: 1px solid var(--cs-line); border-radius: .9rem; }
.member-box:hover { text-decoration: none; border-color: var(--cs-line-strong); background: var(--cs-surface-2); }
.member-box.is-me { border-color: var(--cs-accent); }
.member-box.is-low { opacity: .7; }
.mbx-av { position: relative; flex-shrink: 0; }
.mbx-av .rank { position: absolute; right: -6px; bottom: -4px; width: 1.35rem; height: 1.35rem; font-size: .68rem;
  box-shadow: 0 0 0 2px var(--cs-surface); }
.mbx-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.mbx-body .name-tag { flex-wrap: nowrap; }
.mbx-nick { font-size: .78rem; color: var(--cs-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbx-rep { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.mbx-bal { display: inline-flex; align-items: center; gap: .25rem; font-size: .9rem; }
.mbx-bal .bi { color: var(--cs-muted); font-size: .8rem; }
.mbx-stats { font-size: .74rem; color: var(--cs-muted); }
.member-row { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; color: inherit; text-decoration: none; }
.member-row:hover { text-decoration: none; background: var(--cs-surface-2); }
.member-row.is-low { opacity: .7; }
.member-bal { min-width: 3rem; text-align: right; font-size: 1.05rem; }

/* ---------- Market statistics (/stats) ---------- */
.top3 .member-row { padding: .65rem 1rem; }
.top3-n { flex: 0 0 auto; font-size: .85rem; color: var(--cs-muted); white-space: nowrap; }
.top3-n b { font-size: 1.15rem; color: var(--cs-text); }
.top3-none { padding: 1.1rem 1rem; font-size: .9rem; color: var(--cs-muted); }
.stats-table th, .stats-table td { vertical-align: middle; }
/* fixed layout: the name cell takes what is left — long @handles used to push "Được sub" off a phone screen */
.stats-table { table-layout: fixed; width: 100%; }
@media (max-width: 575.98px) {
  .stats-table th, .stats-table td { padding-left: .4rem; padding-right: .4rem; }
  .stats-table .stats-rank { width: 2.1rem; }
  .stats-table .stats-num { width: 3.9rem; font-size: .95rem; }
  .stats-table .stats-ch a.flex-shrink-0 { display: none; }           /* the avatar: room for the names */
  .stats-table thead .stats-num { font-size: .66rem; letter-spacing: 0; }
  /* a long @handle wraps in the narrow cell instead of being cut ("@dungreviewcong…") */
  .stats-table .stats-ch .nt-value { white-space: normal; overflow-wrap: anywhere; }
}
.stats-table .stats-rank { width: 2.6rem; text-align: center; }
.stats-table .stats-num { width: 5.5rem; white-space: nowrap; font-size: 1.05rem; }
.stats-table thead .stats-num { font-size: .72rem; }
.stats-table tr.is-mine > td { background: var(--cs-surface-2); }
.stats-table tr.is-idle .stats-num b { color: var(--cs-muted); font-weight: 400; }
.th-sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .2rem; }
.th-sort:hover { color: var(--cs-text); text-decoration: none; }
.th-sort.is-active { color: var(--cs-accent); }
@media (max-width: 575.98px) {
  .stats-table .stats-rank { width: 2.4rem; padding-left: .3rem !important; padding-right: .1rem !important; }
  .stats-table .stats-num { width: 4.2rem; padding-left: .3rem !important; }
}
/* Gold / silver / bronze laurel wreath around ranks 1–3 (macro wreath) */
.wreath { position: relative; flex: 0 0 auto; width: var(--wz, 40px); height: var(--wz, 40px); display: inline-flex;
  align-items: center; justify-content: center; vertical-align: middle; }
.wreath svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.wreath b { position: relative; width: 48%; height: 48%; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; font-size: calc(var(--wz, 40px) * .3); font-weight: 800; line-height: 1; }
.wreath-1 { color: #d4a017; } .wreath-1 b { background: #fef3c7; color: #92400e; }
.wreath-2 { color: #9ca3af; } .wreath-2 b { background: #e5e7eb; color: #374151; }
.wreath-3 { color: #c2703d; } .wreath-3 b { background: #fde8d7; color: #9a3412; }
[data-bs-theme="dark"] .wreath-1 { color: #fbbf24; } [data-bs-theme="dark"] .wreath-1 b { background: #422006; color: #fcd34d; }
[data-bs-theme="dark"] .wreath-2 { color: #cbd5e1; } [data-bs-theme="dark"] .wreath-2 b { background: #2a2d33; color: #e5e7eb; }
[data-bs-theme="dark"] .wreath-3 { color: #f59e0b; } [data-bs-theme="dark"] .wreath-3 b { background: #431407; color: #fdba74; }
/* Top 3: the row opens the member's subs of today */
.top3-item > summary { list-style: none; cursor: pointer; }
.top3-item > summary::-webkit-details-marker { display: none; }
.top3-meta { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: .9rem; row-gap: .1rem; }
.top3-toggle { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap;
  font-size: .8rem; font-weight: 500; color: var(--cs-accent); line-height: 1.25; }
.top3-toggle .bi { flex: 0 0 auto; transition: transform .15s; }
.top3-item[open] .top3-toggle .bi { transform: rotate(180deg); }
.top3-subs { list-style: none; margin: 0; padding: 0 1rem .7rem 3.6rem; display: flex; flex-direction: column; gap: .15rem; }
.top3-subs a { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border-radius: .5rem; color: inherit;
  text-decoration: none; font-size: .82rem; background: var(--cs-surface-2); }
.top3-subs a:hover { text-decoration: none; background: var(--cs-chip); }
.top3-subs .name-tag { flex: 1 1 auto; min-width: 0; }
.top3-time { flex: 0 0 auto; font-size: .75rem; color: var(--cs-muted); }
@media (max-width: 575.98px) {
  .top3-toggle { font-size: .76rem; }
  .top3-subs { padding-left: 1rem; }
}


/* ---------- Channel page charts ---------- */
.seg { --bs-nav-link-padding-y: .25rem; --bs-nav-link-padding-x: .6rem; --bs-nav-link-font-size: .8rem; flex-wrap: nowrap; }
.legend { display: flex; align-items: center; gap: .35rem; color: var(--cs-muted); }
.legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.lg-in, .bar-in { background: var(--cs-accent); }
.lg-out, .bar-out { background: var(--cs-line-strong); }
.bars { display: flex; align-items: stretch; gap: 3px; height: 170px; padding-top: 1rem; }
.bar-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.bar-pair { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; border-bottom: 1px solid var(--cs-line); }
.bar { flex: 1 1 0; max-width: 14px; min-height: 0; border-radius: 3px 3px 0 0; position: relative; }
.bar b { position: absolute; top: -1.05rem; left: 50%; transform: translateX(-50%); font-size: .62rem; font-weight: 600; color: var(--cs-muted); }
.bar-label { font-size: .62rem; color: var(--cs-muted); text-align: center; margin-top: .25rem; white-space: nowrap; overflow: hidden; }
.hours { display: flex; align-items: flex-end; gap: 2px; height: 110px; border-bottom: 1px solid var(--cs-line); }
.hour { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; }
.hour > span { width: 100%; background: var(--cs-accent); border-radius: 2px 2px 0 0; min-height: 0; }
.hours-axis { display: flex; justify-content: space-between; margin-top: .25rem; }
.fans { display: flex; gap: .5rem; overflow-x: auto; padding: .9rem 1rem; scrollbar-width: none; }
.fans::-webkit-scrollbar { display: none; }
.fan { flex: 0 0 auto; width: 92px; display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; color: inherit; font-size: .78rem; }
.fan:hover { text-decoration: none; }
.fan > span { max-width: 100%; }
.fan b { font-size: .8rem; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Escalations ---------- */
.esc-parties { display: flex; align-items: center; gap: .6rem; }
.esc-party { display: flex; align-items: center; gap: .55rem; min-width: 0; flex: 1; color: inherit; }
.esc-party:hover { text-decoration: none; }
.esc-party b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proof-frame .esc-img { height: 130px; object-fit: cover; object-position: top; }
.admin-box { padding: .85rem; border: 1px dashed var(--cs-line-strong); border-radius: .7rem; background: var(--cs-surface-2); }
.dropzone-sm { min-height: 110px !important; }
.dropzone-sm .dz-empty { padding: .5rem; }
.dropzone-sm .dz-empty .bi { font-size: 1.4rem; }
.steps-compact li { padding-bottom: .6rem; }
/* complaint form: 1 reason · 2 facts · 3 screenshots with what each shows */
.esc-step { padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--cs-line); }
.esc-step-title { display: flex; align-items: center; gap: .5rem; font-weight: 600; margin-bottom: .6rem; }
.esc-step-title .num { flex: 0 0 auto; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; color: var(--cs-accent-text); background: var(--cs-accent); }
.esc-step .req, .esc-ev .req { color: var(--cs-red); font-weight: 700; margin-left: .15rem; }
.esc-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.esc-subs { display: grid; gap: .4rem; }
.esc-kind, .esc-sub { position: relative; display: block; margin: 0; cursor: pointer; min-width: 0; }
.esc-kind input, .esc-sub input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.esc-kind-box, .esc-sub-box { display: flex; min-height: 48px; border: 1px solid var(--cs-line); border-radius: .7rem; background: var(--cs-surface); padding: .55rem .75rem; transition: border-color .15s, box-shadow .15s; }
.esc-kind-box { align-items: center; gap: .65rem; height: 100%; }
.esc-kind-box > .bi { flex: 0 0 auto; font-size: 1.15rem; color: var(--cs-muted); }
.esc-kind-box b { display: block; font-size: .92rem; font-weight: 600; line-height: 1.25; }
.esc-kind-box small { display: block; font-size: .78rem; line-height: 1.25; color: var(--cs-muted); }
.esc-sub-box { position: relative; flex-direction: column; justify-content: center; gap: .1rem; padding-left: 2.3rem; }
.esc-sub-box::before { content: ""; position: absolute; left: .8rem; top: 50%; width: 1.05rem; height: 1.05rem; margin-top: -.525rem; border-radius: 50%; border: 2px solid var(--cs-line-strong); background: var(--cs-surface); }
.esc-sub-box .m-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .2rem; }
.esc-kind input:checked + .esc-kind-box, .esc-sub input:checked + .esc-sub-box { border-color: var(--cs-accent); box-shadow: 0 0 0 1px var(--cs-accent); }
.esc-kind input:checked + .esc-kind-box > .bi { color: var(--cs-accent); }
.esc-sub input:checked + .esc-sub-box::before { border-color: var(--cs-accent); background: var(--cs-accent); box-shadow: inset 0 0 0 3px var(--cs-surface); }
.esc-kind input:focus-visible + .esc-kind-box, .esc-sub input:focus-visible + .esc-sub-box { outline: 2px solid var(--cs-accent); outline-offset: 2px; }
.esc-kinds.is-invalid .esc-kind-box, .esc-subs.is-invalid .esc-sub-box { border-color: var(--cs-red); }
.esc-ev { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: .65rem; align-items: start; margin-bottom: .65rem; }
.esc-ev textarea { min-height: 110px; resize: vertical; }
.esc-ev-caption { margin-top: .3rem; font-size: .78rem; line-height: 1.3; color: var(--cs-muted); word-break: break-word; }
/* complaint page: the facts an admin decides on */
.esc-facts { display: grid; gap: .55rem; margin: 0 0 1rem; padding: .75rem .9rem; border: 1px solid var(--cs-line); border-radius: .7rem; background: var(--cs-surface-2); }
.esc-facts > div { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: .5rem; align-items: start; }
.esc-facts dt { padding-top: .1rem; font-size: .85rem; font-weight: 500; color: var(--cs-muted); }
.esc-facts dd { margin: 0; min-width: 0; }
.esc-sub-link { display: block; color: inherit; }
.esc-sub-link:hover { text-decoration: none; }
.esc-sub-link .m-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .2rem; color: var(--cs-accent); }
.esc-h { display: flex; align-items: center; gap: .4rem; margin-bottom: .4rem; font-size: .95rem; font-weight: 600; }
@media (max-width: 575.98px) {
  .esc-kinds { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 576px) {
  .esc-ev { grid-template-columns: 140px minmax(0, 1fr); }
}

@media (max-width: 767.98px) {
  .kpis { gap: .45rem; }
  .kpi { padding: .65rem .7rem; column-gap: .5rem; }
  .kpi > .ic { width: 42px; height: 42px; border-radius: 12px; font-size: 1.3rem; }
  .kpi-value { font-size: 1.5rem; min-height: 1.7rem; }
  .kpi-value .stars { font-size: .9rem; }
  .kpi-label { font-size: .8rem; }
  .kpi-links { font-size: .78rem; }
  .bars { height: 150px; gap: 2px; }
  .bar-col:not(:nth-child(3n+1)) .bar-label { visibility: hidden; }
  .bar-label { overflow: visible; }
  .member-row { padding: .7rem .85rem; gap: .6rem; }
  .ch-switch { padding-right: .45rem; }
}
@media (max-width: 575.98px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 379.98px) {                                   /* small phones (SE, 360 px): tiles ≈ 140 px wide */
  .kpi { padding: .6rem .5rem; column-gap: .35rem; }
  .kpi > .ic { width: 32px; height: 32px; border-radius: 10px; font-size: 1.05rem; }
  .kpi-label .help-tip { margin-left: .05rem; }
}
@media (max-width: 339.98px) {                                   /* 320 px (iPhone SE 1st gen): tiles ≈ 125 px */
  .ch-hero { padding: .85rem .75rem; }
  .kpi > .ic { width: 28px; height: 28px; border-radius: 9px; font-size: .95rem; }
  .kpi-label { font-size: .72rem; }
  .kpi-value { font-size: 1.35rem; min-height: 1.6rem; }
  .kpi-value .stars { font-size: .76rem; }
  .kpi-label { font-size: .76rem; }
  .kpi-links { font-size: .74rem; }
}

/* =================================================================================================
   Colour for icons only: soft tint tile + saturated glyph. Surfaces stay white, text stays black.
   One hue per topic (see ICON_COLORS in app/__init__.py). No purple.
   ================================================================================================= */
:root, [data-bs-theme="light"] {
  --c-red: #dc2626;    --c-red-bg: #fee2e2;
  --c-orange: #ea580c; --c-orange-bg: #ffedd5;
  --c-amber: #d97706;  --c-amber-bg: #fef3c7;
  --c-green: #16a34a;  --c-green-bg: #dcfce7;
  --c-teal: #0d9488;   --c-teal-bg: #ccfbf1;
  --c-sky: #0284c7;    --c-sky-bg: #e0f2fe;
  --c-blue: #2563eb;   --c-blue-bg: #dbeafe;
  --c-pink: #db2777;   --c-pink-bg: #fce7f3;
  --c-slate: #475569;  --c-slate-bg: #f1f5f9;
  --art-bg: #f3f4f6; --art-surface: #ffffff; --art-line: #e5e7eb; --art-muted: #d1d5db; --art-ink: #111827;
}
[data-bs-theme="dark"] {
  --c-red: #f87171;    --c-red-bg: rgba(248, 113, 113, .16);
  --c-orange: #fb923c; --c-orange-bg: rgba(251, 146, 60, .16);
  --c-amber: #fbbf24;  --c-amber-bg: rgba(251, 191, 36, .16);
  --c-green: #4ade80;  --c-green-bg: rgba(74, 222, 128, .15);
  --c-teal: #2dd4bf;   --c-teal-bg: rgba(45, 212, 191, .15);
  --c-sky: #38bdf8;    --c-sky-bg: rgba(56, 189, 248, .15);
  --c-blue: #60a5fa;   --c-blue-bg: rgba(96, 165, 250, .16);
  --c-pink: #f472b6;   --c-pink-bg: rgba(244, 114, 182, .15);
  --c-slate: #94a3b8;  --c-slate-bg: rgba(148, 163, 184, .15);
  --art-bg: #1c1d21; --art-surface: #222428; --art-line: #2a2d33; --art-muted: #3a3e46; --art-ink: #e5e7eb;
}

.ic { --c: var(--c-slate); --cbg: var(--c-slate-bg);
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 32px; height: 32px; border-radius: 9px; background: var(--cbg); color: var(--c); font-size: 1rem; line-height: 1; }
.ic-sm { width: 26px; height: 26px; border-radius: 8px; font-size: .85rem; }
.ic-lg { width: 44px; height: 44px; border-radius: 12px; font-size: 1.3rem; }
.ic-xl { width: 56px; height: 56px; border-radius: 16px; font-size: 1.6rem; }
.ic-solid { background: var(--c); color: #fff; }
[data-bs-theme="dark"] .ic-solid { color: #111827; }
.ic-red { --c: var(--c-red); --cbg: var(--c-red-bg); }
.ic-orange { --c: var(--c-orange); --cbg: var(--c-orange-bg); }
.ic-amber { --c: var(--c-amber); --cbg: var(--c-amber-bg); }
.ic-green { --c: var(--c-green); --cbg: var(--c-green-bg); }
.ic-teal { --c: var(--c-teal); --cbg: var(--c-teal-bg); }
.ic-sky { --c: var(--c-sky); --cbg: var(--c-sky-bg); }
.ic-blue { --c: var(--c-blue); --cbg: var(--c-blue-bg); }
.ic-pink { --c: var(--c-pink); --cbg: var(--c-pink-bg); }
.ic-slate { --c: var(--c-slate); --cbg: var(--c-slate-bg); }
.cs-card-header h2 .ic, .cs-section-title .ic, .task-zone h2 .ic { margin-right: .1rem; }
.cs-card-header h2 > .bi:first-child { color: var(--cs-muted); }

/* Coloured initials avatars (stable colour per member / channel) */
.cs-avatar-initials.av-0 { background: var(--c-red-bg); color: var(--c-red); border-color: transparent; }
.cs-avatar-initials.av-1 { background: var(--c-orange-bg); color: var(--c-orange); border-color: transparent; }
.cs-avatar-initials.av-2 { background: var(--c-amber-bg); color: var(--c-amber); border-color: transparent; }
.cs-avatar-initials.av-3 { background: var(--c-green-bg); color: var(--c-green); border-color: transparent; }
.cs-avatar-initials.av-4 { background: var(--c-teal-bg); color: var(--c-teal); border-color: transparent; }
.cs-avatar-initials.av-5 { background: var(--c-sky-bg); color: var(--c-sky); border-color: transparent; }
.cs-avatar-initials.av-6 { background: var(--c-blue-bg); color: var(--c-blue); border-color: transparent; }
.cs-avatar-initials.av-7 { background: var(--c-pink-bg); color: var(--c-pink); border-color: transparent; }
/* Picture avatar: an emoji on the avatar colour */
.cs-avatar-emoji { font-size: calc(var(--sz, 40px) * .56); line-height: 1; font-weight: 400; overflow: hidden;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }

/* ---------- Profile: avatar picker ---------- */
.avatar-head { display: flex; align-items: center; gap: 1rem; }
.avatar-now { flex-shrink: 0; display: inline-flex; }
.avatar-now img.cs-avatar { object-position: 50% 40%; }
.avatar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.avatar-actions .btn { min-height: 40px; }
.avatar-pick { margin-top: 1rem; border-top: 1px solid var(--cs-line); padding-top: .75rem; }
.avatar-pick summary { cursor: pointer; font-weight: 600; min-height: 40px; display: flex; align-items: center; gap: .4rem; }
.avatar-pick summary::after { content: "\F282"; font-family: "bootstrap-icons"; font-weight: 400; color: var(--cs-muted); font-size: .8rem; }
.avatar-pick[open] summary::after { transform: rotate(180deg); }
.avatar-pick summary::-webkit-details-marker { display: none; }
.avatar-pick summary { list-style: none; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: .35rem; margin: .5rem 0 1rem; }
.emoji-opt, .tone-opt { position: relative; margin: 0; cursor: pointer; }
.emoji-opt input, .tone-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.emoji-opt span { display: flex; align-items: center; justify-content: center; height: 44px; border-radius: .6rem; font-size: 1.6rem; line-height: 1;
  border: 1px solid var(--cs-line); background: var(--cs-surface-2); font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.emoji-opt:hover span { border-color: var(--cs-line-strong); }
.emoji-opt input:checked + span { border-color: var(--cs-accent); box-shadow: 0 0 0 2px var(--cs-accent) inset; background: var(--cs-surface); }
.emoji-opt input:focus-visible + span, .tone-opt input:focus-visible + span { outline: 2px solid var(--cs-accent); outline-offset: 2px; }
.tone-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.tone-opt span { box-shadow: 0 0 0 2px var(--cs-surface); }
.tone-opt input:checked + span { box-shadow: 0 0 0 2px var(--cs-surface), 0 0 0 4px var(--cs-accent); }
.username-fixed { display: flex; align-items: center; gap: .6rem; }
.username-fixed .form-control[readonly] { background: var(--cs-surface-2); font-weight: 600; }
@media (max-width: 575.98px) {
  .avatar-head { align-items: flex-start; }
  .avatar-now .cs-avatar { --sz: 72px !important; }
}

/* Tab bar + desktop menu: grey until active, then the tab's own colour */
.cs-tabbar > a, .cs-tabbar > button { --tc: var(--cs-text); }
.cs-tabbar .active .tab-icon { color: var(--tc); }
.cs-tabbar .tab-icon .bi { transition: transform .15s; }
.cs-tabbar .active .tab-icon .bi { transform: translateY(-1px); }
.cs-navbar .nav-link .bi { color: var(--nc, var(--cs-muted)); opacity: .9; }
.cs-navbar .nav-link:not(.active) .bi { color: var(--cs-muted); }

.kpi-row { display: flex; align-items: center; gap: .45rem; }

/* Sheet / settings rows: iOS-style solid icons */
.sheet-list .ic { width: 30px; height: 30px; border-radius: 8px; font-size: .95rem; }
.sheet-list > a > .ic, .sheet-list > button > .ic { margin-right: .1rem; }

/* Charts in brand colours */
.lg-in, .bar-in { background: var(--c-red); }
.lg-out, .bar-out { background: var(--c-sky); }
.hour > span { background: var(--c-teal); }

/* Illustrations (templates/_art.html) */
.art { display: block; width: 100%; height: auto; }
.art .a-bg { fill: var(--art-bg); }
.art .a-surface { fill: var(--art-surface); }
.art .a-line { fill: none; stroke: var(--art-line); stroke-width: 2; }
.art .a-stroke { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.art .a-stroke:not([stroke-width]) { stroke-width: 3; }
.art .a-muted { fill: var(--art-muted); }
.art .a-ink { fill: var(--art-ink); }
.art .a-white { fill: #fff; }
.art .f-red { fill: var(--c-red); }      .art .s-red { stroke: var(--c-red); }
.art .f-red-bg { fill: var(--c-red-bg); }
.art .f-orange { fill: var(--c-orange); } .art .s-orange { stroke: var(--c-orange); }
.art .f-orange-bg { fill: var(--c-orange-bg); }
.art .f-amber { fill: var(--c-amber); }  .art .s-amber { stroke: var(--c-amber); }
.art .f-amber-bg { fill: var(--c-amber-bg); }
.art .f-green { fill: var(--c-green); }  .art .s-green { stroke: var(--c-green); }
.art .f-green-bg { fill: var(--c-green-bg); }
.art .f-teal { fill: var(--c-teal); }    .art .s-teal { stroke: var(--c-teal); }
.art .f-teal-bg { fill: var(--c-teal-bg); }
.art .f-sky { fill: var(--c-sky); }      .art .s-sky { stroke: var(--c-sky); }
.art .f-sky-bg { fill: var(--c-sky-bg); }
.art .f-blue { fill: var(--c-blue); }    .art .s-blue { stroke: var(--c-blue); }
.art .f-blue-bg { fill: var(--c-blue-bg); }
.art .f-pink { fill: var(--c-pink); }
.art-sm { max-width: 150px; margin: 0 auto; }
.art-md { max-width: 220px; margin: 0 auto; }
.art-lg { max-width: 360px; margin: 0 auto; }
.empty .art { margin-bottom: .75rem; }
.empty-art .fw-semibold { font-size: 1rem; }

/* Landing */
.hero-art { margin: -.25rem auto 1rem; max-width: 330px; }
.steps-ic { list-style: none; padding: 0; margin: 0; display: grid; gap: .85rem; }
.steps-ic li { display: flex; gap: .8rem; align-items: flex-start; }
.steps-ic li .ic { position: relative; }
.steps-ic li .ic small { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--cs-surface); border: 1px solid var(--cs-line); color: var(--cs-text); font-size: .65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; }
.steps-ic strong { display: block; font-weight: 600; line-height: 1.3; }
.feature { text-align: left; }
.feature .ic { margin-bottom: .6rem; }
.auth-art { max-width: 200px; margin: 0 auto .5rem; }

.page-head h1 { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.page-head h1 .ic-lg { width: 40px; height: 40px; font-size: 1.2rem; }
@media (max-width: 767.98px) { .page-head h1 .ic-lg { width: 34px; height: 34px; border-radius: 10px; font-size: 1.05rem; } }

.stat-pills { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin-top: .35rem; font-size: .85rem; color: var(--cs-muted); }
.stat-pills > span { display: inline-flex; align-items: center; gap: .35rem; }
.stat-pills b { color: var(--cs-text); }
.stat-pills .ic-sm { width: 22px; height: 22px; border-radius: 7px; font-size: .75rem; }
.steps-ic li > span:last-child { min-width: 0; }
.steps-ic li > span:last-child > span { display: block; }
.check-list .bi, .auth-side li .bi { color: var(--c-green); }
.auth-side .art { max-width: 220px; }

.sheet-list .ic .bi { color: inherit; width: auto; font-size: inherit; text-align: center; }

/* ---------- Market: reputation row, pick ---------- */
.ic-xs { width: 20px; height: 20px; border-radius: 6px; font-size: .7rem; }
/* stars + balance: one light line under the name (no box of its own — user 2026-12-02 "tối ưu không gian") */
.cc-rep { display: flex; align-items: center; gap: .9rem; margin-top: .55rem; }
.cc-rep .stars { font-size: .95rem; }
.cc-bal { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; }
.channel-card.is-picked { border-color: var(--c-sky); }
.channel-card .cc-foot form { margin: 0; }
.btn-success-soft { --bs-btn-color: var(--c-green); --bs-btn-bg: var(--c-green-bg); --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--c-green); --bs-btn-hover-bg: var(--c-green-bg); --bs-btn-hover-border-color: var(--c-green);
  --bs-btn-active-color: var(--c-green); --bs-btn-active-bg: var(--c-green-bg); font-weight: 600; }

/* ---------- Asks: Sub, Like 2, Comment 1 ---------- */
.asks { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.ask { --ac: var(--c-slate); display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem; border-radius: 999px;
  font-size: .76rem; font-weight: 500; color: var(--cs-text); background: var(--cs-surface); border: 1px solid var(--cs-line); white-space: nowrap; }
.ask .bi { color: var(--ac); }
.ask b { font-weight: 700; }
.asks-compact { flex-wrap: nowrap; align-items: center; gap: .25rem; }
.asks-compact .asks-label { font-size: .76rem; color: var(--cs-muted); margin-right: .1rem; }
.asks-compact .ask { padding: .1rem .45rem; gap: .25rem; }

/* ---------- Work page (/sub/<channel>): one screen on a laptop, no dead space ---------- */
/* 32px tap target; the negative top margin keeps the visible gaps as they were */
.back-link { display: inline-flex; align-items: center; gap: .35rem; min-height: 32px; padding-right: .5rem; margin: -.35rem 0 .3rem; font-size: .875rem; color: var(--cs-muted); }
.back-link:hover { color: var(--cs-text); text-decoration: none; }
.work-side { display: flex; flex-direction: column; gap: .75rem; }
.target-card { padding: .85rem 1rem; }
.target-note { display: flex; align-items: center; gap: .5rem; margin-top: .7rem; padding-top: .6rem; border-top: 1px solid var(--cs-line);
  font-size: .82rem; color: var(--cs-muted); }
.target-note > .bi { color: var(--c-teal); }
.acting.acting-sm { padding: .3rem .6rem; gap: .4rem; background: var(--cs-surface-2); }
.work-form .cs-card-header { padding: .6rem 1rem; flex-wrap: wrap; row-gap: .35rem; }
.work-form .cs-card-header > h2 { flex: 1 0 auto; }
.work-form .cs-card-header .count-pill { margin-left: .15rem; }
.dz-text { text-wrap: balance; }
.work-body { padding: .8rem 1rem; display: flex; flex-direction: column; gap: .75rem; }
.work-body .dz-label { font-size: .85rem; min-height: 24px; margin-bottom: .3rem; gap: .4rem; }
.flow { list-style: none; padding: 0; margin: 0; display: flex; align-items: center; gap: .35rem; font-size: .76rem; font-weight: 600; color: var(--cs-muted); }
@media (max-width: 575.98px) { .work-form .flow { display: none; } }   /* phones: the numbered slots + the button say it */
.flow li { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.flow li + li::before { content: ""; width: 14px; border-top: 2px dotted var(--cs-line-strong); }
/* Every screenshot in one box: 5 tiles a row (3 on phones), the "+" tile fills the rest of its row
   (--span / --span-sm, set by the page and app.js); every tile the same height (portrait phone screenshots) */
.proof-grid { --slot-h: 168px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; }
.proof-grid > * { min-width: 0; }
.proof-grid .dz-add { grid-column: span var(--span, 5); min-height: 0; height: var(--slot-h); border-radius: .7rem; }
.proof-grid .dz-add .dz-empty { padding: .5rem; }
.proof-grid .dz-add .dz-empty .bi { font-size: 1.5rem; }
.proofs > .dz-label > .text-truncate { min-width: 0; }
.proof-tips { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .9rem; margin-top: .4rem; font-size: .76rem; color: var(--cs-muted); }
.proof-tips b { display: inline-flex; align-items: center; justify-content: center; min-width: 1.15rem; height: 1.15rem; padding: 0 .25rem; border-radius: 999px;
  font-size: .68rem; color: var(--cs-accent-text); background: var(--cs-accent); }
.proof-tips [data-paste] { min-height: 32px; }
.shot-new .shot-tag { background: var(--cs-muted); }             /* chosen here, not saved yet */
.shot-new .shot-img img { cursor: default; }
.shot-size { position: absolute; left: .35rem; top: .35rem; padding: .1rem .4rem; border-radius: .35rem; font-size: .68rem; font-weight: 600;
  color: #fff; background: rgba(17, 24, 39, .72); pointer-events: none; }
.shot.is-bad { border-color: var(--cs-red); }
.dz-text { font-weight: 600; font-size: .8rem; line-height: 1.3; margin-top: .2rem; }
.dz-hint { font-size: .74rem; color: var(--cs-muted); margin-top: .2rem; }
.shot { position: relative; border-radius: .7rem; overflow: hidden; border: 1px solid var(--cs-line); background: var(--cs-chip); }
.shot-img { display: block; }
.shot-img img { display: block; width: 100%; height: var(--slot-h, 168px); object-fit: contain; }
.shot-tag { position: absolute; left: .5rem; top: .5rem; display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .5rem;
  border-radius: .4rem; font-size: .72rem; font-weight: 700; color: #fff; background: var(--c-green); }
[data-bs-theme="dark"] .shot-tag { color: #111827; }
.shot-x { position: absolute; right: .4rem; top: .4rem; width: 34px; height: 34px; border-radius: 50%; border: 0;
  display: inline-flex; align-items: center; justify-content: center; color: #fff; background: rgba(17, 24, 39, .72); }
.proof-grid .shot-x { width: 30px; height: 30px; font-size: .8rem; right: .3rem; top: .3rem; }
/* tag at the bottom (the whole width: phones' 3 narrow tiles), × top-right, size (not saved yet) top-left */
.proof-grid .shot-tag { display: block; left: .3rem; top: auto; bottom: .3rem; padding: .15rem .4rem; max-width: calc(100% - .6rem);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dropzone.dz-mini { min-height: 110px !important; border-radius: .7rem; }
.dropzone.dz-mini .dz-empty { padding: .5rem; }
.dropzone.dz-mini .dz-empty .bi { font-size: 1.4rem; }
.dropzone.dz-mini .dz-meta .tag:first-child, .dropzone.dz-mini .dz-size { display: none; }
/* Asks: Sub ✓ | Like, Comment | Watch — two columns, one line each */
.asks-box { border: 1px solid var(--cs-line); border-radius: .8rem; padding: .55rem .75rem .65rem; background: var(--cs-surface-2); }
.asks-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem 1.25rem; }
.ask-row, .ask-fixed { display: flex; align-items: center; gap: .5rem; min-width: 0; min-height: 32px; font-weight: 500; font-size: .9rem; line-height: 1.2; }
.ask-fixed { color: var(--cs-muted); }
.ask-fixed .bi-check-lg { flex: 0 0 auto; width: 98px; text-align: center; color: var(--c-green); font-size: 1.1rem; }   /* sits where the steppers sit */
.stepper { flex-shrink: 0; display: inline-flex; align-items: center; border: 1px solid var(--cs-line-strong); border-radius: .55rem; overflow: hidden; background: var(--cs-surface); }
.stepper button { width: 32px; height: 30px; border: 0; background: none; color: var(--cs-text); }
.stepper button:active { background: var(--cs-chip); }
.stepper input { width: 32px; height: 30px; border: 0; border-left: 1px solid var(--cs-line); border-right: 1px solid var(--cs-line);
  text-align: center; font-size: 16px; font-weight: 700; background: none; color: var(--cs-text); -moz-appearance: textfield; appearance: textfield; }   /* 16px: iOS does not zoom on focus */
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.work-note { padding: .5rem .75rem; resize: vertical; }
.work-actions { display: flex; flex-wrap: wrap; gap: .5rem; padding: .7rem 1rem; border-top: 1px solid var(--cs-line); }
.work-actions .btn { min-height: 44px; }
/* "Hoàn thành cần đủ 2 ảnh…": a full line above the buttons */
.work-missing { flex-basis: 100%; display: flex; align-items: center; gap: .4rem; color: var(--cs-red); font-size: .85rem; font-weight: 600; }
.dz-label .req { color: var(--cs-red); font-weight: 700; margin-left: -.25rem; }
.work-confirm { font-size: .78rem; color: var(--cs-muted); text-align: center; padding: 0 1rem .6rem; }
.target-card .bal { font-size: .85rem; }
@media (pointer: coarse) {                                       /* fingers: bigger − / + */
  .stepper button { width: 38px; height: 36px; }
  .stepper input { width: 38px; height: 36px; }
  .ask-fixed .bi-check-lg { width: 116px; }
}
@media (max-width: 575.98px) {                                   /* phones: 3 screenshots a row */
  .proof-grid { --slot-h: 150px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .proof-grid .dz-add { grid-column: span var(--span-sm, 3); }
  .asks-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Sub detail (/subs/<id>): one laptop screen — summary on the side, screenshots in one row ---------- */
.done-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem; padding: .5rem .6rem .5rem .75rem; border-radius: .8rem;
  background: var(--c-green-bg); }
.done-bar-btns { display: flex; gap: .5rem; }
@media (max-width: 575.98px) { .done-bar-btns { width: 100%; } .done-bar-btns .btn { flex: 1 1 0; min-height: 40px; } }
.summary-card { padding: .85rem 1rem; display: flex; flex-direction: column; gap: .7rem; }
.parties { display: flex; flex-direction: column; gap: .2rem; }
.party { display: flex; align-items: flex-start; gap: .65rem; min-width: 0; }
.party-av { flex-shrink: 0; }
.party-av:hover { text-decoration: none; }
.party-text { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; min-width: 0; }
.party-title { font-weight: 700; color: var(--cs-text); line-height: 1.3; overflow-wrap: anywhere; }
.party-arrow { display: flex; align-items: center; gap: .55rem; padding-left: .8rem; font-size: .75rem; color: var(--cs-muted); }   /* under the avatars */
.summary-status { display: flex; flex-direction: column; gap: .5rem; padding-top: .7rem; border-top: 1px solid var(--cs-line); }
.sub-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; font-size: .85rem; font-weight: 600; }
.sub-steps li { display: flex; align-items: center; gap: .4rem; min-width: 0; line-height: 1.25; }
.sub-steps li + li::before { content: ""; flex-shrink: 0; width: 16px; border-top: 2px solid var(--cs-line-strong); }
.sub-steps li.is-done + li.is-done::before { border-color: var(--c-green); }
.sub-steps li > .bi { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; background: var(--cs-chip); color: var(--cs-muted); }
.sub-steps .is-done > .bi { background: var(--c-green-bg); color: var(--c-green); }
.sub-steps .is-wait > .bi { background: var(--c-amber-bg); color: var(--c-amber); }
.sub-steps .is-late > .bi { background: var(--c-red-bg); color: var(--c-red); }
.sub-steps small { display: block; font-weight: 400; font-size: .74rem; color: var(--cs-muted); }
.summary-card .debt-time { font-size: .78rem; color: var(--cs-muted); }
.summary-asks { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.summary-actions { display: flex; flex-wrap: wrap; gap: .4rem; padding-top: .7rem; border-top: 1px solid var(--cs-line); }
.summary-actions .btn { flex: 1 1 auto; }
/* Start | End | the extras, side by side in one row; every frame the same height */
.proof-body, .notes-body { padding: .8rem 1rem; }
.proof-row { --ph: 236px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.proof-row.has-extras { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr); }
.proof-row .proof-frame img { height: var(--ph); object-fit: contain; }
.proof-row .proof-frame .tag { left: .4rem; top: .4rem; }
.proof-extras { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .4rem; min-width: 0; }
.proof-row .proof-frame-sm img { object-fit: cover; object-position: top; }
.notes-body .thread { gap: .45rem; }
.thread-form { display: flex; align-items: flex-end; gap: .5rem; margin-top: .75rem; }
.thread-form textarea { min-height: 42px; resize: vertical; }
.thread-form .btn { flex-shrink: 0; min-height: 42px; }
@media (max-width: 575.98px) {                                   /* phones: start + end side by side, the extras below */
  .proof-row, .proof-row.has-extras { --ph: 200px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proof-extras { grid-column: 1 / -1; }
  .proof-row .proof-frame-sm img { height: 96px; }
}
.proof-frame-sm img { height: 150px; object-fit: cover; object-position: top; }

/* ---------- Notifications ---------- */
.notice-bar { display: flex; align-items: center; gap: .6rem; padding: .65rem .9rem; border-radius: .8rem; color: var(--cs-text);
  background: var(--c-amber-bg); border: 1px solid transparent; text-decoration: none; }
.notice-bar:hover { text-decoration: none; color: var(--cs-text); border-color: var(--c-amber); }
.notice-title { font-weight: 600; line-height: 1.35; display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notice-detail { display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notice-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }
.notice-side .new-dot { margin-top: 0; }
.notice-delta.is-pos { color: var(--cs-green); }
.notice-delta.is-neg { color: var(--cs-red); }
.notice-list .m-chips { margin-top: .3rem; }
.new-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cs-red); flex-shrink: 0; margin-top: .45rem; }
.bell-btn.has-new { color: var(--c-amber); }
.bell-btn.active { border-color: var(--cs-text); }
.cs-navbar .nav-link .badge-count { margin-left: .25rem; }

/* ---------- Dashboard: my picked tasks ---------- */
.pick-row { display: flex; align-items: center; }
.pick-row form { margin: 0; padding-right: .5rem; }
.pick-x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; color: var(--cs-muted); }
.pick-x:hover, .pick-x:active { background: var(--cs-chip); color: var(--cs-red); }

/* ---------- Register: optional fields ---------- */
.more-fields summary { cursor: pointer; font-weight: 500; font-size: .92rem; list-style: none; }
.more-fields summary::-webkit-details-marker { display: none; }

@media (max-width: 767.98px) {
  .channel-card .cc-foot .cc-now { width: auto; flex: 0 0 auto; padding-left: .7rem; padding-right: .7rem; }
  /* Save and Done stay in reach above the tab bar */
  .work-actions { position: sticky; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 5; background: var(--cs-surface);
    border-radius: 0 0 .9rem .9rem; box-shadow: 0 -6px 16px rgba(17, 24, 39, .06); }
}

.empty .btn .bi { font-size: inherit; display: inline-block; margin: 0; opacity: 1; }

/* ================= E2E polish (phone-first) ================= */

/* Field icons sit in the middle of the INPUT, not of input + error text; the eye button replaces Bootstrap's ! icon */
.input-icon > .form-control { min-height: 46px; }
.input-icon > .bi { top: 0; height: 46px; display: flex; align-items: center; transform: none; }
.pw-toggle { top: 1px; height: 44px; transform: none; display: inline-flex; align-items: center; justify-content: center; }
.input-icon > .form-control.pe-5.is-invalid { background-image: none; }

/* Thin loading bar while the next page loads (every link tap / form submit) */
.load-bar { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 2000; background: var(--c-red); opacity: 0; pointer-events: none; }
.is-loading .load-bar { opacity: 1; animation: load-bar 8s cubic-bezier(.1, .7, .2, 1) forwards; }
@keyframes load-bar { from { width: 0; } 20% { width: 55%; } to { width: 92%; } }

/* One-line empty states (dashboard) */
.empty-line { display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; color: var(--cs-muted); font-size: .9rem; }
.empty-line > .bi { font-size: 1.15rem; flex-shrink: 0; }
.empty-line a:not(.btn) { color: var(--cs-text); font-weight: 600; }

/* Bigger tap areas */
.cs-footer a { display: inline-block; padding: .55rem 0; }
.more-fields summary { padding: .55rem 0; }
.channel-card .cc-owner > a { padding: .35rem 0; }
.ch-hero a.h5 { padding: .25rem 0; }
.seg .nav-link { min-height: 34px; display: inline-flex; align-items: center; }
.shot-x::after, .pick-x::after { content: ""; position: absolute; inset: -6px; }
.pick-x { position: relative; }

@media (max-width: 991.98px) {
  /* Messages float under the top bar (always seen, even after jumping to #anchor) and fade away */
  .flash-stack { position: fixed; top: calc(62px + env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 1085;
    margin: 0 !important; pointer-events: none; }
  .flash-stack .alert { pointer-events: auto; margin-bottom: .5rem; box-shadow: 0 12px 32px rgba(17, 24, 39, .18);
    animation: toast-in .25s ease-out; }
  [data-bs-theme="dark"] .flash-stack .alert { box-shadow: 0 12px 32px rgba(0, 0, 0, .55); }
  @keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

  /* Work page = focus mode: no tab bar, Save / Done at the very bottom */
  body.is-focus { padding-bottom: 0; }
  body.is-focus .work-actions { bottom: 0; padding-bottom: calc(.85rem + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .is-loading .load-bar { animation: none; width: 70%; }
  .flash-stack .alert { animation: none; }
}

/* ---------- Admin: roles, rights table, rows, danger zone ---------- */
.chip-role { font-weight: 600; }
.chip-role .bi { font-size: .7rem; }
.chip-role.role-admin { color: var(--c-red); background: var(--c-red-bg); border-color: transparent; }
.chip-role.role-mod { color: var(--c-blue); background: var(--c-blue-bg); border-color: transparent; }
.role-cards { display: grid; gap: .5rem; }
@media (min-width: 576px) { .role-cards { grid-template-columns: repeat(2, 1fr); } }
.role-card { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem; border: 1px solid var(--cs-line-strong); border-radius: .75rem;
  cursor: pointer; background: var(--cs-surface); }
.role-card input { margin-top: .3rem; accent-color: var(--cs-accent); width: 18px; height: 18px; flex-shrink: 0; }
.role-card:has(input:checked) { border-color: var(--cs-text); box-shadow: 0 0 0 1px var(--cs-text) inset; }
.role-card.is-disabled { opacity: .45; cursor: not-allowed; }
.perm-table { padding: .25rem 0; }
.perm-row { display: grid; grid-template-columns: 1fr repeat(2, 84px); align-items: center; gap: .25rem; padding: .55rem 1rem;
  border-top: 1px solid var(--cs-line); font-size: .88rem; }
.perm-row > span:not(.perm-label) { text-align: center; }
.perm-head { border-top: 0; font-weight: 700; font-size: .78rem; color: var(--cs-muted); text-transform: uppercase; letter-spacing: .03em; }
@media (max-width: 575.98px) { .perm-row { grid-template-columns: 1fr repeat(2, 70px); padding: .55rem .75rem; font-size: .82rem; }
  .perm-head { font-size: .68rem; } }
.admin-row { display: flex; align-items: center; }
.admin-row.is-off .m-row { opacity: .55; }
.admin-row-actions { display: flex; gap: .35rem; padding-right: .75rem; flex-shrink: 0; }
.admin-row-actions form { margin: 0; }
.admin-row-actions .btn { width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.danger-zone { border-color: color-mix(in srgb, var(--cs-red) 35%, var(--cs-line)); }
.kpis.kpis-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 991.98px) {
  .form-check { padding-left: 2.1em; min-height: 1.6em; }
  .form-check .form-check-input { width: 1.4em; height: 1.4em; margin-left: -2.1em; margin-top: .02em; }
}

/* Language switch: footer (small, text-like) and the profile setting (two cards) */
.lang-switch { display: inline-flex; align-items: center; gap: .15rem; margin: 0; }
.lang-switch .bi { color: var(--cs-muted); margin-right: .2rem; }
.lang-switch button { border: 0; background: none; color: var(--cs-muted); font: inherit; padding: .2rem .45rem; border-radius: .4rem; min-height: 32px; }
.lang-switch button:hover { color: var(--cs-text); background: var(--cs-chip); }
.lang-switch button.is-active { color: var(--cs-text); font-weight: 600; background: var(--cs-chip); }
.lang-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin: 0; }
.lang-card { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .8rem .9rem; min-height: 48px;
  border: 1px solid var(--cs-line-strong); border-radius: .75rem; background: var(--cs-surface); color: var(--cs-text); font: inherit; text-align: left; }
.lang-card:hover { background: var(--cs-surface-2); }
.lang-card.is-active { border-color: var(--cs-text); box-shadow: 0 0 0 1px var(--cs-text) inset; }
.lang-card .bi { color: var(--c-green); }
.sheet-list .sheet-meta { margin-left: auto; }
.sheet-list .sheet-meta + .bi-chevron-right { margin-left: .4rem; }

/* Guide & FAQ page */
.faq-page { max-width: 860px; margin: 0 auto; }
.faq-toc { gap: .4rem; }
.faq-toc a { flex-shrink: 0; padding: .45rem .9rem; min-height: 40px; display: inline-flex; align-items: center; border: 1px solid var(--cs-line);
  border-radius: 999px; background: var(--cs-surface); color: var(--cs-text); font-size: .88rem; font-weight: 500; text-decoration: none; }
.faq-toc a:hover { border-color: var(--cs-line-strong); }
.faq-page section[id] { scroll-margin-top: 84px; }
.faq-h { display: flex; align-items: center; gap: .55rem; font-size: 1.05rem; font-weight: 700; margin: 0 0 .9rem; }
.faq-rule { margin-bottom: .75rem; }
.faq-rule h3 { display: flex; align-items: flex-start; gap: .65rem; font-size: 1rem; font-weight: 700; margin: 0 0 .5rem; line-height: 1.4; }
.faq-rule p { margin: 0 0 .75rem; color: var(--cs-text); }
.faq-num { flex-shrink: 0; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--cs-chip); border: 1px solid var(--cs-line);
  display: inline-flex; align-items: center; justify-content: center; font-size: .82rem; font-weight: 700; }
.faq-ex { padding: .75rem .9rem; border-radius: .6rem; background: var(--cs-surface-2); border: 1px dashed var(--cs-line-strong); font-size: .92rem; line-height: 1.6; }
.faq-ex-label { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-amber); margin-bottom: .15rem; }
.faq-note { margin: .65rem 0 0 !important; font-size: .85rem; color: var(--cs-muted) !important; }
.faq-list { overflow: hidden; }
.faq-item { border-bottom: 1px solid var(--cs-line); }
.faq-item:last-child { border-bottom: 0; }
.faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 52px; padding: .8rem 1.1rem;
  font-weight: 600; cursor: pointer; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .bi { color: var(--cs-muted); transition: transform .15s ease; flex-shrink: 0; }
.faq-item[open] summary .bi { transform: rotate(180deg); }
.faq-item p { margin: 0; padding: 0 1.1rem 1rem; color: var(--cs-muted); line-height: 1.6; }
.faq-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.faq-cta > span:first-child { font-weight: 600; }
@media (max-width: 575.98px) { .faq-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Sub-back debts: the warning bar (every page) and the time bar on each debt */
.debt-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: .65rem; row-gap: .3rem; padding: .7rem .9rem; border-radius: .75rem; text-decoration: none;
  background: var(--cs-surface); border: 1px solid var(--cs-line-strong); color: var(--cs-text); font-size: .9rem; line-height: 1.35; }
.debt-bar:hover { text-decoration: none; color: var(--cs-text); border-color: var(--cs-text); }
.debt-bar > .bi { font-size: 1.15rem; flex-shrink: 0; }
.debt-bar.is-soon > .bi { color: var(--c-amber); }
.debt-bar.is-overdue { border-color: var(--c-red); }
.debt-bar.is-overdue > .bi { color: var(--c-red); }
.debt-bar-text { min-width: 0; }
.debt-bar-cta { flex-shrink: 0; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: .3rem; }
/* phones: ONE line (user 2026-12-02 "tối ưu không gian") — the main fact + an arrow; the rest is on the page it opens */
@media (max-width: 575.98px) { .debt-bar { padding: .55rem .8rem; } .debt-bar-more, .debt-bar-cta-text { display: none; } .debt-bar-text { font-size: .9rem; } }
.debt-meter { display: block; height: 4px; border-radius: 4px; background: var(--cs-line); overflow: hidden; margin-top: .45rem; max-width: 320px; }
.debt-meter > span { display: block; height: 100%; border-radius: 4px; background: var(--c-sky); }
.debt-meter.is-due_soon > span { background: var(--c-amber); }
.debt-meter.is-overdue > span { background: var(--c-red); }
.debt-time .debt-meter { max-width: none; height: 6px; margin-top: 0; }

/* Market: "Đã sub rồi" — a small button on each card; the card leaves the list; a toast offers Undo */
.cc-mark-form { margin: 0; align-self: flex-start; flex-shrink: 0; }
.cc-mark { display: inline-flex; align-items: center; gap: .25rem; min-height: 30px; padding: .25rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 500;
  line-height: 1.3; color: var(--cs-muted); background: var(--cs-surface); border: 1px solid var(--cs-line-strong); white-space: nowrap; cursor: pointer; }
.cc-mark .bi { font-size: .85rem; color: var(--c-green); }
.cc-mark:hover, .cc-mark:focus-visible { color: var(--cs-text); background: var(--cs-chip); border-color: var(--cs-muted); }
.cc-mark:disabled { opacity: .55; cursor: default; }
@media (max-width: 575.98px) { .cc-mark { min-height: 32px; } }
.col.is-leaving { transition: opacity .25s ease, transform .25s ease; opacity: 0; transform: scale(.96); }
.cs-toast { position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); z-index: 1090; transform: translate(-50%, 12px); opacity: 0;
  display: flex; align-items: center; gap: .9rem; width: max-content; max-width: min(560px, calc(100vw - 32px)); padding: .7rem .8rem .7rem 1rem; border-radius: .75rem;
  background: #111827; color: #f9fafb; font-size: .9rem; line-height: 1.35; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); transition: opacity .2s ease, transform .2s ease; }
.cs-toast.show { opacity: 1; transform: translate(-50%, 0); }
.cs-toast-btn { flex-shrink: 0; border: 0; background: transparent; color: #fff; font-weight: 600; text-decoration: underline; padding: .2rem .3rem; }
.cs-toast-btn:disabled { opacity: .6; }
[data-bs-theme="dark"] .cs-toast { background: #f3f4f6; color: #111827; }
[data-bs-theme="dark"] .cs-toast-btn { color: #111827; }
@media (max-width: 991.98px) { body.has-tabbar .cs-toast { bottom: calc(58px + .75rem + env(safe-area-inset-bottom)); } }

/* ---------- Labelled names: "Tên kênh: @cotichvui ⧉" / "Tên thành viên: kimdung ⧉" — never ambiguous, one tap to copy ---------- */
/* flex-wrap: a long name moves to the next line instead of being cut ("an…") — the name must stay readable */
.name-tag { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; row-gap: .15rem; min-width: 0; max-width: 100%; font-size: .82rem; line-height: 1.35; vertical-align: middle; }
.name-tag .nt-label { flex-shrink: 0; color: var(--cs-muted); font-weight: 500; }
.name-tag .nt-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--cs-text); }
.name-tag b.nt-value { -webkit-user-select: all; user-select: all; }          /* a tap selects the whole name */
.name-tag a.nt-value:hover { text-decoration: underline; }
.name-tag.nt-strong .nt-value { font-weight: 700; }
.name-tag .nt-arrow { flex-shrink: 0; color: var(--cs-muted); font-size: .75rem; }
.name-tag .nt-value { flex: 0 1 auto; max-width: 100%; }
.name-tag .nt-v { display: inline-flex; align-items: center; gap: .3rem; min-width: 0; max-width: 100%; }
.name-tag.nt-lg .nt-v { flex: 1 1 auto; }
.nt-copy { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: .25rem; width: 26px; height: 26px; margin: -3px 0; padding: 0;
  border: 1px solid var(--cs-line); border-radius: .45rem; background: var(--cs-surface); color: var(--cs-muted); font-size: .78rem; line-height: 1; cursor: pointer; }
.nt-copy:hover, .nt-copy:focus-visible { color: var(--cs-text); border-color: var(--cs-line-strong); background: var(--cs-chip); }
.nt-copy.is-copied { color: var(--c-green); border-color: var(--c-green); }
.nt-copy-text { width: auto; padding: 0 .55rem; font-weight: 600; font-size: .78rem; }
.name-lines { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; min-width: 0; max-width: 100%; }
@media (pointer: coarse) {                                       /* fingers: ≈ 44 px targets, same layout */
  .nt-copy { position: relative; z-index: 1; width: 32px; height: 32px; margin: -5px 0; }   /* wins where a name link's area overlaps */
  .nt-copy-text { width: auto; }
  .nt-copy::after { content: ""; position: absolute; inset: -6px; }           /* invisible: 32 → 44 px hit area */
  .name-tag a.nt-value { padding: 9px 0; margin: -9px 0; }                     /* name links ≈ 40 px tall to the finger */
  .name-lines { gap: .45rem; }
  .name-lines .nt-copy { margin: 0; }          /* stacked names: each line its own 32 px, so one copy never covers the next */
}
/* The big one on the work page: the name to find on YouTube */
.name-box { display: flex; flex-direction: column; gap: .35rem; margin-top: .6rem; padding: .5rem .65rem; border: 1px dashed var(--cs-line-strong); border-radius: .6rem; background: var(--cs-surface-2); }
.name-tag.nt-lg { font-size: .9rem; width: 100%; }
.name-tag.nt-lg .nt-value { font-size: 1rem; }
.name-tag.nt-lg .nt-copy { margin-left: auto; }
.m-row .name-tag { font-size: .8rem; }
.m-row .name-tag.nt-strong { font-size: .88rem; }

/* ---- Intro video (app/seo.py, macro intro_video): landing hero, login / sign-up side panel, guide ---- */
.intro-video { margin: 0; }
.iv-player { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: .7rem; background: #0f1012; object-fit: contain; }
.iv-chapters { list-style: none; padding: 0; margin: .65rem 0 0; gap: .4rem; position: relative; }
.iv-chapters li { flex-shrink: 0; }
.iv-chapters button { display: inline-flex; align-items: center; gap: .4rem; min-height: 36px; padding: .3rem .75rem; border: 1px solid var(--cs-line);
  border-radius: 999px; background: var(--cs-surface); color: var(--cs-text); font-size: .8rem; white-space: nowrap; }
.iv-chapters button:hover { border-color: var(--cs-line-strong); }
.iv-chapters button.is-on { border-color: var(--c-blue); background: var(--c-blue-bg); }
.iv-t { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--cs-muted); }
.iv-chapters button.is-on .iv-t { color: var(--c-blue); }
.iv-cap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 .9rem; margin-top: .4rem; font-size: .8rem; color: var(--cs-muted); }
.iv-cap > * { display: inline-flex; align-items: center; gap: .35rem; min-height: 32px; }
.iv-cap a { color: var(--cs-muted); text-decoration: none; }
.iv-cap a:hover { color: #1877f2; }
.hero-video { padding: .6rem .6rem .2rem; max-width: 620px; }
.auth-video { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--cs-line); }

/* the site's Facebook Page (macro fb_page_link): the Page card, a one-line note under it */
.fb-page { max-width: 460px; }
.fb-page-note { display: flex; gap: .4rem; margin: .45rem 0 0; padding: 0 .2rem; font-size: .8rem; line-height: 1.4; color: var(--cs-muted); }
.fb-page-note > .bi { color: #1877f2; flex-shrink: 0; margin-top: .05rem; }
.fb-page-link { display: flex; align-items: center; gap: .75rem; max-width: 460px; padding: .6rem .85rem; border: 1px solid var(--cs-line);
  border-radius: .75rem; background: var(--cs-surface); color: var(--cs-text); text-decoration: none; }
.fb-page-link:hover { border-color: #1877f2; color: var(--cs-text); }
.fb-page-link .fb-ic { width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: #1877f2; color: #fff; font-size: 1.2rem; }
.fb-page-link > span:nth-child(2) { min-width: 0; flex: 1 1 auto; }
.fb-page-link b { display: block; font-size: .9rem; line-height: 1.25; }
.fb-page-link small { display: block; color: var(--cs-muted); font-size: .78rem; line-height: 1.35; }
.fb-page-link > .bi:last-child { color: var(--cs-muted); font-size: .8rem; }

/* floating "talk on the fanpage" button (base.html, user 2026-12-03): bottom right, above the phone tab bar */
.fb-fab { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 1025;
  display: inline-flex; align-items: center; gap: .5rem; min-height: 46px; padding: .35rem 1rem .35rem .4rem; border-radius: 999px;
  background: #1877f2; color: #fff; font-size: .9rem; font-weight: 700; text-decoration: none; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(24, 119, 242, .45), 0 2px 6px rgba(0, 0, 0, .15); transition: transform .15s ease, background-color .15s ease; }
.fb-fab:hover, .fb-fab:focus-visible { background: #0f63d6; color: #fff; transform: translateY(-2px); }
.fb-fab-ic { position: relative; width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%;
  background: #fff; color: #1877f2; font-size: 1.35rem; }
/* a soft ring that pulses a few times after the page opens, so the button is noticed */
.fb-fab-ic::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #fff; opacity: 0;
  animation: fb-fab-pulse 1.8s ease-out 1.2s 4; }
@keyframes fb-fab-pulse { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.45); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .fb-fab-ic::after { animation: none; } .fb-fab { transition: none; } }
@media (max-width: 991.98px) { body.has-tabbar .fb-fab { bottom: calc(58px + 12px + env(safe-area-inset-bottom)); } }
@media (max-width: 575.98px) { .fb-fab { min-height: 42px; font-size: .84rem; padding-right: .85rem; } .fb-fab-ic { width: 32px; height: 32px; font-size: 1.2rem; } }
/* room under the footer so the button never covers its links */
body.has-fab .cs-footer { padding-bottom: 4.5rem; }

/* a member locked by an admin (base.html, user 2026-12-03): the reason on every page, sub buttons greyed out */
.lock-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .3rem .75rem; padding: .75rem .9rem;
  border: 1px solid var(--c-red); border-radius: .75rem; background: var(--c-red-bg, #fef2f2); color: var(--cs-text); font-size: .9rem; line-height: 1.4; }
.lock-bar > .bi { font-size: 1.25rem; color: var(--c-red); }
.lock-bar-text > * { display: block; }
.lock-bar-text b { color: var(--c-red); }
.lock-bar-reason { font-weight: 600; overflow-wrap: anywhere; }
.lock-bar-help { color: var(--cs-muted); font-size: .82rem; }
.btn-fb { background: #1877f2; border-color: #1877f2; color: #fff; font-weight: 600; white-space: nowrap; }
.btn-fb:hover, .btn-fb:focus-visible { background: #0f63d6; border-color: #0f63d6; color: #fff; }
@media (max-width: 575.98px) { .lock-bar { grid-template-columns: auto minmax(0, 1fr); } .lock-bar .btn-fb { grid-column: 1 / -1; } }
.m-row.is-locked { pointer-events: none; opacity: .6; }

/* landing: the 4 steps in a row (2 × 2 on tablets, a column on phones) */
@media (min-width: 576px) { .steps-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 992px) { .steps-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---- Login page (user 2026-12-02: wide, room to explain, Facebook, guide below) ---- */
.hero.auth-hero { padding: 2.5rem 0 3rem; }
.auth-story .auth-title { font-size: clamp(1.9rem, 3.6vw, 2.8rem); font-weight: 800; line-height: 1.1; letter-spacing: -.035em; margin: 1rem 0 .85rem; }
.auth-story .auth-title .soft { color: var(--cs-muted); }
.auth-story .lead { color: var(--cs-muted); font-size: 1.05rem; max-width: 640px; margin-bottom: 1.1rem; }
.auth-points { list-style: none; padding: 0; margin: 0 0 1.6rem; display: flex; flex-wrap: wrap; gap: .45rem 1.25rem; font-size: .9rem; }
.auth-points li { display: flex; align-items: center; gap: .45rem; }
.auth-points .bi { color: var(--c-green); }
.auth-video-h { display: flex; align-items: center; gap: .55rem; font-size: 1rem; font-weight: 700; margin: 0 0 .75rem; }
.auth-story .hero-video { max-width: none; }
.login-card { padding: 2rem; box-shadow: var(--cs-shadow-lg); scroll-margin-top: 88px; }
@media (min-width: 992px) { .login-card { position: sticky; top: 88px; } }
.hero .login-card h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin: 0 0 .35rem; }
.login-sub { color: var(--cs-muted); margin-bottom: 1.5rem; }
.auth-or { display: flex; align-items: center; gap: .75rem; color: var(--cs-muted); font-size: .85rem; margin: 1.4rem 0 1rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--cs-line); }
.login-trust { list-style: none; padding: 0; margin: 1.25rem 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem 1rem; font-size: .78rem; color: var(--cs-muted); }
.login-trust li { display: inline-flex; align-items: center; gap: .3rem; }
.login-trust .bi { color: var(--c-green); }

/* sections under a hero: kicker + title + one line, centred */
.sec { margin: 0 0 3rem; }
.sec-head { text-align: center; max-width: 680px; margin: 0 auto 1.5rem; }
.sec-kicker { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-blue); margin-bottom: .4rem; }
.sec-head h2 { font-size: clamp(1.35rem, 2.6vw, 1.85rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: .4rem; }
.sec-head p { color: var(--cs-muted); margin: 0; }
.why-card { height: 100%; }
.why-card h3 { font-size: 1rem; font-weight: 700; margin: .75rem 0 .3rem; }
.why-card p { color: var(--cs-muted); font-size: .88rem; line-height: 1.55; margin: 0; }
.login-faq { max-width: 820px; }

/* the Facebook community band */
.fb-band { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem 2rem; padding: 2rem; border-radius: 1rem; color: #fff;
  background: linear-gradient(135deg, #1877f2 0%, #0f63e0 55%, #0a4bb3 100%); box-shadow: var(--cs-shadow-lg); }
.fb-band-logo { width: 64px; height: 64px; border-radius: 50%; background: #fff; color: #1877f2; display: grid; place-items: center; font-size: 2.2rem; flex-shrink: 0; }
.fb-band-text { flex: 1 1 320px; min-width: 0; }
.fb-band h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; margin: 0 0 .35rem; color: #fff; }
.fb-band p { margin: 0; color: rgba(255, 255, 255, .88); }
.fb-band-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.btn-fb-white { background: #fff; color: #1877f2; font-weight: 600; border: 1px solid #fff; }
.btn-fb-white:hover, .btn-fb-white:focus { background: #eef4ff; color: #0f63e0; border-color: #eef4ff; }
.btn-fb-ghost { background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .5); font-weight: 600; }
.btn-fb-ghost:hover, .btn-fb-ghost:focus { background: rgba(255, 255, 255, .22); color: #fff; border-color: #fff; }

@media (max-width: 575.98px) {
  .hero.auth-hero { padding: 1rem 0 2rem; }
  .login-card { padding: 1.4rem 1.2rem; }
  .hero .login-card h1 { font-size: 1.5rem; }
  .sec { margin-bottom: 2.25rem; }
  .fb-band { padding: 1.5rem 1.25rem; gap: 1rem; }
  .fb-band-actions, .fb-band-actions .btn { width: 100%; }
}

/* ---------- Tin nhắn: private 1-1 chat (templates/chat/*, static/js/chat.js) ---------- */
.chat-btn.has-new { color: var(--cs-accent); }
.chat-btn.active, .chat-btn.active.has-new { border-color: var(--cs-text); }
.notice-bar.is-chat { background: var(--c-sky-bg); }
.notice-bar.is-chat:hover { border-color: var(--c-sky); }
.btn-chat .bi { color: var(--cs-accent); }
.btn-chat.btn-primary .bi { color: inherit; }

/* inbox */
.chat-inbox-page { max-width: 760px; margin: 0 auto; }
.chat-list .m-row { align-items: flex-start; }
.chat-list .cs-avatar { margin-top: .1rem; }
.chat-when { font-size: .75rem; color: var(--cs-muted); }
.chat-list li.is-unread { background: var(--cs-surface-2); }
.chat-list li.is-unread .m-sub { color: var(--cs-text); font-weight: 600; }
.chat-list li.is-unread .chat-when { color: var(--cs-accent); font-weight: 600; }
.chat-list .badge-count { flex-shrink: 0; background: var(--cs-accent); }

/* one chat: header card, the messages in the page flow, the writing box stuck to the bottom of the screen */
.chat-page { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; }
/* stays under the site's top bar (--chat-top = its height, chat.js); the page colour around it hides the messages
   scrolling underneath, right up to the bar */
.chat-head { display: flex; align-items: center; gap: .7rem; padding: .6rem 1rem .6rem .5rem; margin-bottom: .5rem;
  position: sticky; top: var(--chat-top, 0px); z-index: 7; box-shadow: 0 -8px 0 8px var(--bs-body-bg), var(--cs-shadow); }
.chat-online { font-size: .75rem; color: var(--cs-muted); }
.chat-back { width: 40px; height: 40px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  color: var(--cs-text); font-size: 1.15rem; }
.chat-back:hover { background: var(--cs-chip); color: var(--cs-text); text-decoration: none; }
.chat-log { display: flex; flex-direction: column; gap: .2rem; padding: .25rem 0; min-height: 40vh; }
.chat-older { align-self: center; margin: .25rem 0 .5rem; }
.chat-empty { margin: auto; padding: 2.5rem 1rem; text-align: center; display: flex; flex-direction: column; align-items: center; }
.msg-day { text-align: center; margin: .8rem 0 .4rem; }
.msg-day span { display: inline-block; font-size: .72rem; font-weight: 500; color: var(--cs-muted); background: var(--cs-chip); padding: .15rem .65rem; border-radius: 999px; }
.msg { display: flex; }
.msg.is-mine { justify-content: flex-end; }
.msg-bubble { max-width: min(80%, 560px); padding: .45rem .75rem .3rem; border-radius: 1.1rem; background: var(--cs-surface); border: 1px solid var(--cs-line);
  color: var(--cs-text); box-shadow: var(--cs-shadow); }
.msg.is-mine .msg-bubble { background: var(--cs-accent); border-color: var(--cs-accent); color: #fff; }
.msg.is-theirs + .msg.is-theirs .msg-bubble { border-top-left-radius: .4rem; }      /* one sender's run reads as a group */
.msg.is-mine + .msg.is-mine .msg-bubble { border-top-right-radius: .4rem; }
.msg + .msg-day, .msg.is-mine + .msg.is-theirs, .msg.is-theirs + .msg.is-mine { margin-top: .35rem; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.42; }
.msg-text a { color: var(--cs-accent); text-decoration: underline; }
.msg.is-mine .msg-text a { color: #fff; }
.msg-time { display: block; margin-top: .1rem; font-size: .66rem; line-height: 1.2; color: var(--cs-muted); text-align: right; }
.msg.is-mine .msg-time { color: rgba(255, 255, 255, .78); }
.msg.is-grouped .msg-time { display: none; }                         /* same sender, same minute: time on the last */
.msg.is-grouped .msg-bubble { padding-bottom: .45rem; }
.msg.is-grouped .msg-bubble.has-image { padding-bottom: .25rem; }
.msg-bubble.has-image { padding: .25rem; }
.msg-bubble.has-image .msg-text { padding: .3rem .5rem 0; }
.msg-bubble.has-image .msg-time { padding: 0 .45rem .1rem; }
.msg-img { display: block; }
/* width / height attributes give the ratio before the picture loads; very tall screenshots are cut (a tap opens it all) */
.msg-img img { display: block; width: min(260px, 62vw); height: auto; max-height: 380px; object-fit: cover; object-position: top;
  border-radius: .9rem; background: var(--cs-chip); }
.chat-seen { min-height: 1.1rem; padding: .1rem .25rem 0; text-align: right; font-size: .72rem; color: var(--cs-muted); }
.chat-new-pill { position: sticky; bottom: 88px; z-index: 6; align-self: center; margin: -2.2rem 0 .4rem; padding: .35rem .9rem; border: 0; border-radius: 999px;
  background: var(--cs-accent); color: #fff; font-size: .82rem; font-weight: 600; box-shadow: var(--cs-shadow-lg); }
.chat-new-pill[hidden] { display: none; }

.chat-compose { position: sticky; bottom: 0; z-index: 5; margin-top: .35rem; padding: .5rem 0 calc(.6rem + env(safe-area-inset-bottom)); background: var(--bs-body-bg); }
.chat-bar { display: flex; align-items: flex-end; gap: .35rem; padding: .3rem; border: 1px solid var(--cs-line-strong); border-radius: 1.5rem; background: var(--cs-surface);
  box-shadow: var(--cs-shadow); }
.chat-bar:focus-within { border-color: var(--cs-accent); }
.chat-bar textarea.form-control { flex: 1 1 auto; min-height: 40px; max-height: 160px; padding: .5rem .4rem; border: 0; background: transparent; box-shadow: none;
  resize: none; line-height: 1.4; overflow-y: auto; }
.chat-pic, .chat-send { width: 40px; height: 40px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 50%; }
.chat-pic { margin: 0; color: var(--cs-accent); font-size: 1.2rem; cursor: pointer; }
.chat-pic:hover, .chat-pic:focus-within { background: var(--cs-chip); }
.chat-send.is-busy .bi { animation: chat-send-busy .9s ease-in-out infinite; }
@keyframes chat-send-busy { 50% { opacity: .35; } }
.chat-attach { display: flex; align-items: center; gap: .6rem; margin-bottom: .4rem; padding: .4rem .5rem; border: 1px solid var(--cs-line); border-radius: .9rem;
  background: var(--cs-surface); }
.chat-attach[hidden], .chat-error[hidden] { display: none; }
.chat-attach img { width: 52px; height: 52px; object-fit: cover; border-radius: .6rem; background: var(--cs-chip); }
.chat-error { margin-bottom: .4rem; padding: 0 .75rem; color: var(--cs-red); font-size: .85rem; }
.chat-hint { padding: .3rem .9rem 0; font-size: .72rem; color: var(--cs-muted); }
.chat-blocked { margin-top: .5rem; padding: .8rem 1rem; border-radius: .9rem; background: var(--cs-chip); color: var(--cs-muted); text-align: center; font-size: .9rem; }
body.is-chat .cs-toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
/* the chat fills the screen (dvh: the phone's address bar never hides the box): a short chat still has its writing
   box at the bottom, a long one keeps it stuck there while scrolling */
body.is-chat { min-height: 100vh; min-height: 100dvh; }
body.is-chat main { display: flex; flex-direction: column; }
body.is-chat main > .container { flex: 1 0 auto; display: flex; flex-direction: column; }
body.is-chat .chat-page { flex: 1 0 auto; width: 100%; }
body.is-chat .chat-log { flex: 1 0 auto; }
@media (max-width: 991.98px) {
  body.is-chat .cs-footer { display: none; }                 /* app-like: the writing box is the bottom of the page */
  body.is-chat main > .container { padding-bottom: 0 !important; }
}
@media (max-width: 575.98px) {
  .chat-head { margin-left: -.25rem; margin-right: -.25rem; padding: .45rem .75rem .45rem .25rem; gap: .55rem; }
  .chat-head .cs-avatar { --sz: 38px !important; }
  .msg-bubble { max-width: 86%; }
}
@media (prefers-reduced-motion: reduce) { .chat-send.is-busy .bi { animation: none; opacity: .5; } }

/* ---------- Simpler pages (user 2026-12-02 "đơn giản hóa UX/UI … tối ưu không gian") ---------- */
/* phones with the tab bar: no footer — Hướng dẫn and Ngôn ngữ are in the "Tôi" sheet */
@media (max-width: 991.98px) { body.has-tabbar .cs-footer { display: none; } }
/* a text action that must look like a link (Quên mật khẩu?) */
.link-accent { color: var(--cs-accent); font-weight: 500; text-decoration: none; }
.link-accent:hover { color: var(--cs-accent-hover); text-decoration: underline; }
/* wide screens: action buttons as wide as their words (they stretched to ≈ 530 px each) */
@media (min-width: 768px) {
  .page-actions > .btn.flex-fill, .page-actions > form.flex-fill { flex: 0 0 auto !important; }
  .page-actions > .btn:not(.btn-messenger) { min-width: 9rem; }
}

/* ---------- Invite note (dashboard, user 2026-12-03): bold + highlighted, for members with > 5 subs given + received ---------- */
.invite-note { display: flex; align-items: center; gap: .55rem; padding: .5rem .75rem; border-radius: .6rem; font-size: .9rem;
  background: var(--c-amber-bg); border: 1px solid var(--c-amber); }
.invite-note > .bi { font-size: 1.05rem; color: var(--c-amber); flex-shrink: 0; }
.invite-note p { min-width: 0; font-weight: 700; line-height: 1.4; }
.invite-note mark { padding: .05em .2em; border-radius: .2em; background: #fde047; color: #1f2937;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.invite-copy { flex-shrink: 0; display: inline-flex; align-items: center; gap: .2rem; padding: .25rem 0; border: 0; background: none;
  color: var(--cs-accent); font-weight: 600; white-space: nowrap; }
.invite-copy:hover, .invite-copy:focus-visible { color: var(--cs-accent-hover); text-decoration: underline; }
