/* club.css — "Hội quán" club shell (#446, DESIGN.md "Hội nhóm"), used by club.html and clubs.html.
   Everything is scoped under .cl-hq. --cc = the club's colour (club.color → --club-*), set inline by club.js;
   --cc-text = that colour readable as text (lightened in dark mode for AA), --cc-tint = a quiet fill. */

.cl-hq {
  --cc: var(--club-blue);
  --cc-text: color-mix(in srgb, var(--cc) 40%, #fff);
  --cc-tint: color-mix(in srgb, var(--cc) 18%, var(--c-surface));
  --cl-scrim: rgba(0, 0, 0, .78);
  --cl-crest-ring: rgba(255, 255, 255, .22);
  --cl-grid-line: rgba(255, 255, 255, .14);
  --cl-stone-b: rgba(0, 0, 0, .42);
  --cl-stone-w: rgba(255, 255, 255, .55);
  --cl-on-cc: #fff;
  --cl-nav-h: 56px;
  --cl-d: 240ms;   /* DESIGN.md Hội nhóm: 240ms */
  display: grid;
  grid-template-columns: 76px 250px minmax(0, 1fr) 270px;
  height: calc(100vh - var(--cl-nav-h));
  height: calc(100dvh - var(--cl-nav-h));
  min-height: 560px;
  color: var(--c-ink);
  font-size: calc(16px * var(--fs-scale, 1));
}
:root[data-mode="light"] .cl-hq { --cc-text: var(--cc); --cc-tint: color-mix(in srgb, var(--cc) 10%, var(--c-surface)); }
.cl-hq--dir { grid-template-columns: 76px minmax(0, 1fr); }
.cl-content { display: contents; }
.cl-status { grid-column: 2 / -1; margin: 0; padding: 24px; }
.cl-status:empty { display: none; }
.cl-hq h1, .cl-hq h2, .cl-hq h3 { margin: 0; }
.cl-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-hq .icon { width: 20px; height: 20px; flex: none; }

/* shared bits */
.cl-ib { width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--c-ink-2); cursor: pointer; }
.cl-ib:hover { background: var(--c-fill); color: var(--c-ink); }
.cl-ib--ring { width: 36px; height: 36px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--c-border); }
.cl-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill, 999px); background: var(--c-error); color: var(--c-bg); font-size: 12px; font-weight: 900; }
.cl-count { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: var(--radius-pill, 999px); background: var(--c-fill); color: var(--c-ink-2); font-size: 12px; font-weight: 800; letter-spacing: 0; }
.cl-grp { display: flex; align-items: center; gap: 8px; padding: 12px 10px 4px; font-size: 13px; font-weight: 800; color: var(--c-ink-2); }   /* sentence case: no caps on Vietnamese labels */
.cl-av36 { width: 36px; height: 36px; font-size: 13px; }
.cl-av40 { width: 40px; height: 40px; font-size: 14px; }
.cl-h3 { font-size: 16px; font-weight: 800; margin: 6px 0 10px; }
.cl-card > .prows + .cl-h3 { margin-top: 20px; } /* second heading in one card (activity panel) needs air above it */
.cl-card { padding: 16px; border-radius: var(--ctl-r-card); background: var(--c-surface); }

/* Controls (#474, CL4 shapes; aligned with shared widget tokens in components.css) */
.cl-hq {
  --cl-fast: var(--dur-fast);
  --cl-base: var(--dur-base);
  --cl-ease: var(--ease-out);
  --cl-tone: color-mix(in srgb, var(--c-ink) 8%, transparent);
  --cl-tone-hi: color-mix(in srgb, var(--c-ink) 14%, transparent);
  --cl-field-line: var(--c-border-strong);   /* field edge >=3:1 (COL-CONTRAST-UI) */
}
.cl-hq .pbtn { justify-content: center; min-height: var(--ctl-h-md); padding: 0 var(--ctl-px-md); box-shadow: none; font-weight: 700; white-space: nowrap; transition: background-color var(--cl-fast) var(--cl-ease), color var(--cl-fast) var(--cl-ease), box-shadow var(--cl-fast) var(--cl-ease), transform var(--cl-fast) var(--cl-ease); }
.cl-hq .pbtn:hover:not(:disabled) { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .cl-hq .pform input:not([type="checkbox"]):not([type="file"]):hover, .cl-hq .pform select:hover, .cl-hq .pform textarea:hover, .cl-hq .cb-inline input:hover { border-color: var(--c-ink-2); }
  }
.cl-hq .pbtn:active:not(:disabled) { opacity: 1; transform: scale(.96); transition-duration: 60ms; }
.cl-hq .pbtn--sm { min-height: var(--ctl-h-sm); padding: 0 var(--ctl-px-sm); font-size: var(--text-xs); }
.cl-hq .pbtn--primary { background: var(--c-brand); color: var(--c-on-brand); box-shadow: var(--shadow); }
.cl-hq .pbtn--primary:hover:not(:disabled) { background: var(--c-brand-dark); }
.cl-hq .pbtn--danger { background: color-mix(in srgb, var(--c-error) 10%, transparent); box-shadow: none; color: var(--c-error); }
.cl-hq .pbtn--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--c-error) 18%, transparent); }
.cl-hq .pbtn[aria-pressed="true"] { background: var(--cc-tint); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--cc-text) 60%, transparent); color: var(--cc-text); }
.cl-hq .cl-ib, .cl-hq .cl-send, .cl-hq .cl-ch, .cl-hq .cl-u, .cl-hq .cl-hint, .cl-hq .cb-poll__opt, .cl-list .prow { transition: background-color var(--cl-fast) var(--cl-ease), color var(--cl-fast) var(--cl-ease), box-shadow var(--cl-fast) var(--cl-ease), transform var(--cl-fast) var(--cl-ease); }
.cl-hq .cl-ib:active, .cl-hq .cl-send:active { transform: scale(.92); transition-duration: 60ms; }
.cl-hq .pchip { font-weight: 700; transition: background-color var(--cl-fast) var(--cl-ease), color var(--cl-fast) var(--cl-ease); }
.cl-hq .pbadge { border: 0; border-radius: var(--ctl-r-pill); background: var(--cl-tone); font-weight: 700; }
/* Sentence case for labels and table headers (platform.css sets caps + tracking site-wide). */
.cl-hq .pform label:not(.pcheck), .cl-hq .pform__label { font-size: 14px; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--c-ink-2); }
.cl-hq .pform label > select, .cl-hq .pform label > input { font-weight: 400; color: var(--c-ink); }   /* controls wrapped by a label keep field text, not label text */
.cl-hq .ptbl th { font-size: 13px; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--c-ink-2); }
/* Fields: filled, >=3:1 edge, focus ring from tokens.css; background-color preserves select chevron. */
.cl-hq .pform input:not([type="checkbox"]):not([type="file"]), .cl-hq .pform select, .cl-hq .pform textarea, .cl-hq .cb-inline input { min-height: var(--ctl-h-md); border: var(--ctl-bw) solid var(--cl-field-line); border-radius: var(--ctl-r); background-color: var(--c-field); transition: border-color var(--cl-fast) var(--cl-ease), box-shadow var(--cl-fast) var(--cl-ease); }
.cl-hq .pform input:not([type="checkbox"]):not([type="file"]):focus-visible, .cl-hq .pform select:focus-visible, .cl-hq .pform textarea:focus-visible, .cl-hq .cb-inline input:focus-visible { border-color: var(--c-focus); outline: var(--focus-w) solid var(--c-focus); outline-offset: 1px; }
.cl-hq .pform > :is(label, .pform__label) + :is(input, textarea, select, .pswatches) { margin-top: -8px; }
.cl-hq .psearch { min-height: var(--ctl-h-md); padding: 0 12px; border-radius: var(--ctl-r); background: var(--c-field); border: var(--ctl-bw) solid var(--cl-field-line); transition: border-color var(--cl-fast) var(--cl-ease); }
.cl-hq .psearch:hover { border-color: var(--c-ink-2); }
.cl-hq .psearch:focus-within { border-color: var(--c-focus); outline: var(--focus-w) solid var(--c-focus); outline-offset: 1px; }
.cl-hq .psearch input { flex: 1; width: auto; min-width: 0; color: inherit; }
.cl-search { max-width: 520px; }
/* A button beside fields takes the exact same --ctl-h-md height. */
.cl-hq :is(.pform__row, .cb-inline, .cl-filter__bulk) > .pbtn { min-height: var(--ctl-h-md); }
.cl-hq .cb-images__row .pform__label { min-width: 140px; }   /* sentence-case labels: both "Đổi ảnh" buttons line up */
/* Row select box (thành-viên bulk actions) */
.cl-hq .ptbl input[type="checkbox"] { appearance: none; position: relative; width: 20px; height: 20px; margin: 0 10px 0 0; vertical-align: middle; border-radius: var(--ctl-r-sm); background: var(--c-field); box-shadow: inset 0 0 0 1.5px var(--c-border-strong); cursor: pointer; transition: background-color var(--cl-fast) var(--cl-ease), box-shadow var(--cl-fast) var(--cl-ease); }
.cl-hq .ptbl input[type="checkbox"]:checked { background: var(--c-brand); box-shadow: none; }
.cl-hq .ptbl input[type="checkbox"]:checked::after { content: ""; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px; border: solid var(--c-on-brand); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.cl-hq .ptbl td { vertical-align: middle; }
.cl-check-slot { display: inline-block; width: 20px; height: 20px; margin-right: 10px; vertical-align: middle; }
.cl-hq .ptbl td.num > .pbtn { margin-left: 4px; }
.cl-hq .ptbl .pbtn--sm { min-height: var(--ctl-h-sm); padding: 0 var(--ctl-px-sm); font-size: var(--text-xs); }   /* row actions: compact so four fit beside name + role */
.cl-hq .pform output:empty { display: none; }   /* empty preview slot must not add two gaps (alerts stay rendered: live region) */
.cl-hq .cl-card > .cl-h3:first-child { margin: 0 0 14px; }

/* crest: the club avatar (tag on the club colour, or its image) */
.cl-crest { width: 48px; height: 48px; border-radius: 50%; font-size: 14px; font-weight: 900; letter-spacing: .02em; box-shadow: inset 0 0 0 2px var(--cl-crest-ring); transition: border-radius var(--cl-d) var(--ease-out); }
.cl-crest:not([class*="pav--c-"]) { background-color: var(--c-surface-2); }
.cl-crest--xl { display: flex; width: 96px; height: 96px; margin: -76px auto 12px; font-size: 30px; box-shadow: 0 0 0 6px var(--c-surface); }

/* rail */
.cl-rail { display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 0; padding: 14px 0; overflow-x: hidden; overflow-y: auto; scrollbar-width: none; background: var(--c-bg); border-right: 1px solid var(--c-border); }
.cl-rail__club, .cl-rail__btn { position: relative; display: flex; flex: none; color: inherit; text-decoration: none; }
.cl-rail__club.is-on .cl-crest, .cl-rail__club:hover .cl-crest, .cl-rail__club:focus-visible .cl-crest { border-radius: 30%; }
.cl-rail__club.is-on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c-ink); }
/* `.pl a { color: inherit }` is (0,1,1): link colours here need .cl-hq in front */
.cl-hq .cl-rail__btn { width: 48px; height: 48px; align-items: center; justify-content: center; border-radius: 50%; background: var(--c-surface); color: var(--c-brand-text); transition: border-radius var(--cl-d) var(--ease-out); }
.cl-rail__btn:hover { border-radius: 30%; }
.cl-hq .cl-rail__btn.is-on { border-radius: 30%; background: var(--c-brand); color: var(--c-on-brand); }
.cl-rail__btn .icon { width: 24px; height: 24px; }
.cl-rail__sep { width: 32px; margin: 2px 0; border: 0; border-top: 2px solid var(--c-border); }

/* channel pane */
.cl-chan { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--c-surface); border-right: 1px solid var(--c-border); }
.cl-banner { position: relative; flex: none; height: 120px; overflow: hidden; background: var(--cc); }
.cl-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 30%, var(--cl-scrim)); }
.cl-banner__img { position: absolute; inset: 0; background: center / cover no-repeat; }
.cl-banner__gen, .cl-genb { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.cl-genb__bg { fill: var(--cc); }
.cl-genb__ln { fill: none; stroke: var(--cl-grid-line); stroke-width: .5; }
.cl-genb__b { fill: var(--cl-stone-b); }
.cl-genb__w { fill: var(--cl-stone-w); }
.cl-banner__name { position: absolute; z-index: 1; left: 14px; right: 14px; bottom: 10px; display: flex; flex-direction: column; min-width: 0; color: var(--cl-on-cc); font-size: 19px; font-weight: 900; line-height: 1.2; }
.cl-banner__name small { font-size: 13px; font-weight: 700; opacity: .9; }
.cl-chans { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; overflow: auto; }
.cl-ch { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--c-ink-2); font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.cl-ch:hover { background: var(--c-hover); color: var(--c-ink); }
.cl-ch.is-on { background: var(--c-fill); color: var(--c-ink); }
.cl-ch .cl-badge, .cl-ch .cl-count { margin-left: auto; }
.cl-me { display: flex; flex: none; align-items: center; gap: 10px; padding: 10px 12px; background: var(--c-surface-2); }
.cl-me__x { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cl-me__x b { font-size: 14px; }
.cl-me__x small { font-size: 12px; color: var(--c-ink-2); }

/* centre */
.cl-mid { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--c-bg); }
.cl-head { display: flex; flex: none; align-items: center; gap: 10px; min-height: 56px; padding: 0 12px 0 18px; border-bottom: 1px solid var(--c-border); }
.cl-head__icon { display: inline-flex; color: var(--c-ink-2); }
.cl-head__title { flex: none; max-width: 45%; font-size: 17px; font-weight: 800; }
.cl-head__sub { flex: 1; font-size: 14px; color: var(--c-ink-2); }
.cl-msg { flex: none; margin: 0; padding: 8px 18px; font-size: 14px; color: var(--c-ink-2); background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
.cl-msg:empty { display: none; }
.cl-panel { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.cl-page { gap: 14px; padding: 18px; overflow: auto; }
.cl-page > * { flex: none; }

/* chat stream */
.cl-chat { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.cl-stream { display: flex; flex: 1; flex-direction: column; gap: 4px; min-height: 0; padding: 16px 18px; overflow: auto; }
.cl-pinned { display: flex; flex: none; gap: 12px; margin-bottom: 10px; padding: 12px 14px; border-radius: 12px; background: var(--cc-tint); }
.cl-pinned .icon { color: var(--cc-text); }
.cl-pinned b { display: block; font-size: 13px; color: var(--cc-text); }
.cl-pinned p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.cl-older { align-self: center; }
.cl-log { display: flex; flex-direction: column; gap: 2px; }
.cl-empty { align-self: center; margin: auto 0; }
.cl-day { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: 12px; font-weight: 900; color: var(--c-ink-2); }
.cl-day::before, .cl-day::after { content: ""; flex: 1; border-top: 1px solid var(--c-border); }
.cb-chat__msg { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: start; margin: 0 -8px; padding: 6px 8px; border-radius: 12px; animation: cl-rise var(--cl-d) var(--ease-out) both; }
.cb-chat__body { min-width: 0; }
.cb-chat__who { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.cb-chat__name { font-size: 15px; font-weight: 800; color: var(--c-ink); text-decoration: none; }
a.cb-chat__name:hover { text-decoration: underline; }
.cl-role { flex: none; font-size: 12px; font-weight: 900; color: var(--cc-text); }
.cb-chat__time { flex: none; font-size: 12px; color: var(--c-ink-2); }
.cb-chat__text { overflow-wrap: anywhere; }
.cb-chat__edited { flex: none; font-size: 12px; color: var(--c-ink-2); }

/* B476 message actions. Desktop: floating toolbar (role=toolbar, roving tabindex) on hover and keyboard focus. */
@media (hover: hover) and (pointer: fine) {
  .cb-chat__msg:hover, .cb-chat__msg:focus-within, .cb-chat__msg.is-hover { background: var(--c-hover); }
}
.cb-tools { position: absolute; z-index: 2; top: -14px; right: 8px; display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-border), var(--shadow-pop-soft); opacity: 0; pointer-events: none; transform: translateY(2px); transition: opacity var(--cl-fast) var(--cl-ease), transform var(--cl-fast) var(--cl-ease); }
.cl-log > .cb-chat__msg:first-child > .cb-tools, .cl-log > .cl-day:first-child + .cb-chat__msg > .cb-tools { top: 4px; }   /* the stream would clip it above the first row */
.cb-tools .cl-ib { width: 36px; height: 36px; border-radius: 9px; }
.cb-tools .cl-ib--danger:hover { background: color-mix(in srgb, var(--c-error) 14%, transparent); color: var(--c-error); }
@media (hover: hover) and (pointer: fine) {
  .cb-chat__msg:hover > .cb-tools { opacity: 1; pointer-events: auto; transform: none; }
}
.cb-chat__msg:focus-within > .cb-tools, .cb-chat__msg.is-hover > .cb-tools { opacity: 1; pointer-events: auto; transform: none; }   /* .is-hover = its ⋯ menu is open */
/* Touch: no toolbar; the ⋯ button stays in the accessibility tree, visible only when focused (Tab, screen-reader swipe). */
@media (hover: none), (pointer: coarse) {
  .cb-tools { top: 4px; right: 4px; padding: 0; background: none; box-shadow: none; }
  .cb-tools > :not(.cb-tools__more) { display: none; }
  .cb-tools:not(:focus-within) .cb-tools__more { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cb-chat__msg { -webkit-touch-callout: none; user-select: none; }   /* rows only: the long-press is ours; the sheet offers Sao chép + Chọn văn bản (Q5) */
  .cb-chat__msg.is-selecting { -webkit-touch-callout: default; user-select: text; }
}
.cb-chat__msg.is-selected, .cb-chat__msg.is-editing { background: var(--cc-tint); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--cc-text) 70%, transparent); }

/* Desktop ⋯ menu (APG menu button); flips up near the bottom of the stream */
.cb-menu { position: absolute; z-index: 5; top: 26px; right: 8px; display: flex; flex-direction: column; min-width: 200px; padding: 6px; border-radius: 14px; background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-border), var(--shadow-pop); }
.cb-menu--up { top: auto; bottom: calc(100% + 20px); }   /* above the toolbar, which sits 14px over the row */
.cb-act { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 9px; background: none; color: var(--c-ink); font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.cb-act:hover, .cb-act:focus-visible { background: var(--c-fill); }
.cb-act .icon { color: var(--c-ink-2); }
.cb-act--danger, .cb-act--danger .icon { color: var(--c-error); }

/* Sheets and dialogs: phone = bottom sheet, desktop = centred dialog; inside .cl-hq so --cc* and .cl-hq .pbtn apply */
dialog.cb-sheet { width: min(30rem, calc(100% - 2rem)); max-height: 88dvh; margin: auto; padding: 0; overflow: auto; }   /* surface + backdrop: components.css §10 (#543) */
dialog.cb-sheet:focus, dialog.cb-sheet:focus-visible { outline: 0 !important; }   /* opened by touch: focus sits on the sheet itself */
.cb-sheet__in { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px 22px; }
.cb-sheet__grip { display: none; }
.cb-sheet__head { display: flex; align-items: center; gap: 10px; }
.cb-sheet__head { align-items: flex-start; }
.cb-sheet__head h3 { flex: 1; margin: 0; font-size: calc(20px * var(--fs-scale, 1)); font-weight: 800; line-height: 1.25; }   /* = .modal__title (#543) */
.cb-sheet__head .cl-ib { margin: -6px -8px 0 0; border-radius: var(--ctl-r-pill); background-color: color-mix(in srgb, var(--c-ink) var(--ctl-fill-pct), var(--c-surface)); }   /* = .modal__close */
.cb-sheet__head .cl-ib:hover { background-color: color-mix(in srgb, var(--c-ink) var(--ctl-fill-hover-pct), var(--c-surface)); }
.cb-sheet__foot .pbtn { min-height: 44px; padding: 0 22px; font-size: calc(16px * var(--fs-scale, 1)); font-weight: 800; }
.cb-sheet__foot .pbtn:not(.pbtn--primary):not(.pbtn--danger) { background-color: color-mix(in srgb, var(--c-ink) var(--ctl-fill-pct), var(--c-surface)); color: var(--c-ink); }   /* cancel = neutral tonal, like every dialog */
.cb-sheet__foot .pbtn:not(.pbtn--primary):not(.pbtn--danger):hover { background-color: color-mix(in srgb, var(--c-ink) var(--ctl-fill-hover-pct), var(--c-surface)); }
.cb-sheet__foot .pbtn--danger { background-color: var(--c-error-bg); color: var(--c-error); }   /* destructive = tonal error, never filled (= .modal .btn-danger) */
.cb-sheet__foot .pbtn--danger:hover { background-color: color-mix(in srgb, var(--c-error) 20%, var(--c-surface)); color: var(--c-error); }
.cb-sheet__foot { display: flex; flex-direction: row-reverse; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
@media (max-width: 860px) {
  dialog.cb-sheet { width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-width: var(--ctl-bw) 0 0; border-radius: var(--ctl-r-modal) var(--ctl-r-modal) 0 0; }
  .cb-sheet__in { padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); }
  .cb-sheet__grip { display: block; width: 40px; height: 4px; margin: 2px auto 4px; border-radius: 2px; background: var(--c-border-strong); }
  .cb-sheet__foot { flex-wrap: nowrap; }   /* one 48px row, primary fills the rest (#543) */
  .cb-sheet__foot .pbtn { min-height: 48px; }
  .cb-sheet__foot .pbtn:first-child { flex: 1; }
  .cb-sheet__head .cl-ib { width: 44px; height: 44px; }
}
.cb-quote { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 12px; border-radius: 14px; background: var(--c-fill); }
.cb-quote .pav { width: 32px; height: 32px; font-size: 12px; }
.cb-quote b { display: block; font-size: 14px; }
.cb-quote p { margin: 2px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cb-sheet__list { display: flex; flex-direction: column; gap: 2px; }
.cb-sheet__list .cb-act { min-height: 52px; font-size: 16px; }
.cb-warn { margin: 0; color: var(--c-ink-2); font-size: 14px; }
.cb-err { margin: 0; color: var(--c-error); font-size: 14px; font-weight: 700; }
.cb-err:empty { display: none; }
.cb-radios { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; border: 0; }
.cb-radios legend { margin-bottom: 6px; font-size: 14px; font-weight: 700; color: var(--c-ink-2); }
.cb-radio { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 12px; cursor: pointer; font-weight: 700; }
.cb-radio:hover { background: var(--c-hover); }
.cb-radio input { width: 20px; height: 20px; margin: 0; accent-color: var(--c-brand); }
.cb-field { display: flex; flex-direction: column; gap: 6px; }
.cb-field[hidden] { display: none; }
.cb-field__top { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; font-weight: 700; color: var(--c-ink-2); }
.cb-field__top small { font-variant-numeric: tabular-nums; }
dialog .cb-in { width: 100%; min-height: 72px; padding: 10px 12px; border: 1px solid var(--cl-field-line); border-radius: 12px; background: var(--c-field, var(--c-surface)); color: var(--c-ink); font: inherit; font-size: 16px; box-sizing: border-box; resize: vertical; }
dialog .cb-in:focus-visible { outline: 0 !important; border-color: var(--c-brand-text); box-shadow: 0 0 0 2px var(--c-brand-text); }

/* Composer edit mode: bar above the input, ✓ on the send button */
.cb-editbar { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; padding: 6px 6px 6px 12px; border-radius: 12px; background: var(--cc-tint); }
.cb-editbar[hidden] { display: none; }
.cb-editbar > .icon { flex: none; color: var(--cc-text); }
.cb-editbar span { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cb-editbar b { font-size: 13px; color: var(--cc-text); }
.cb-editbar small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-ink-2); font-size: 13px; }
.cb-editbar .cl-ib { width: 36px; height: 36px; }
.cl-compose { flex: none; padding: 12px 18px 16px; }
.cl-compose__box { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 6px 0 16px; border-radius: 14px; background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-border); }
.cl-compose__box:focus-within { box-shadow: inset 0 0 0 2px var(--c-brand-text); }
.cl-compose input { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-size: 16px; }
.cl-compose input:focus, .cl-compose input:focus-visible { outline: 0 !important; }
.cl-send { width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; background: var(--c-brand); color: var(--c-on-brand); cursor: pointer; }
.cl-send:hover { background: var(--c-brand-dark); }

/* B447: system rows (/ghim, /giaohuu), @mentions, command hints, unread dot, chat toggles */
.cb-chat__tile { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--cc-tint); color: var(--cc-text); }
.cb-chat__sys-t { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-weight: 800; color: var(--c-ink); }
.cb-chat__terms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cb-chat__at { font-weight: 800; color: var(--cc-text); }
.cb-chat__at.is-me { margin: 0 -2px; padding: 0 2px; border-radius: 4px; background: var(--cc-tint); }
.cb-chat__msg.is-mentioned { background: var(--cc-tint); }
/* B477/B478: one popup row = leading tile or avatar, two lines, then alias or role */
.cl-hints { max-height: min(340px, var(--cl-hint-max, 340px)); margin: 0 0 6px; padding: 4px; overflow: auto; overscroll-behavior: contain; list-style: none; border-radius: 12px; background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-border), var(--shadow-pop-soft); }
.cl-hints[hidden] { display: none; }
.cl-hints__head { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px 4px; font-size: 12px; font-weight: 800; color: var(--c-ink-2); }
.cl-hint { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; min-height: 52px; padding: 6px 10px; scroll-margin: 4px; border-radius: 10px; cursor: pointer; }
.cl-hint:hover { background: var(--c-hover); }
.cl-hint[aria-selected="true"] { background: var(--c-fill); box-shadow: inset 3px 0 0 var(--cc-text); }
.cl-hint__av { width: 32px; height: 32px; font-size: 12px; }
.cl-hint__tile { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: var(--cc-tint); color: var(--cc-text); }
.cl-hint__main { display: flex; flex-direction: column; min-width: 0; }
.cl-hint__t, .cl-hint__sub { display: flex; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; }
.cl-hint__t { align-items: baseline; }
.cl-hint__t b { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.cl-hint__t mark { background: none; color: var(--cc-text); text-decoration: underline; text-underline-offset: 3px; }
.cl-hint__args { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--c-ink-2); font-family: var(--font-mono, monospace); font-size: 13px; }
.cl-hint__sub, .cl-hint__alias { color: var(--c-ink-2); font-size: 13px; }
.cl-hint__desc { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cl-compose__note { margin: 0 0 6px; font-size: 13px; color: var(--c-ink-2); }
.cl-compose__note[hidden] { display: none; }
.cl-dot { flex: none; width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: var(--c-ink); }

/* B449: poll card. The bar is the button's own background (--pct set inline from server counts). */
.cb-poll__q { margin-top: 2px; font-weight: 700; }
.cb-poll { display: flex; flex-direction: column; gap: 8px; max-width: 520px; margin-top: 8px; }
.cb-poll__opts { display: flex; flex-direction: column; gap: 6px; }
.cb-poll__opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 8px 14px; border: 0; border-radius: 10px; color: var(--c-ink); font: inherit; text-align: left; cursor: pointer;
  background: linear-gradient(90deg, var(--cc-tint) var(--pct, 0%), var(--c-fill) var(--pct, 0%)); box-shadow: inset 0 0 0 1px var(--c-border); }
.cb-poll__opt:hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--cc-text); }
.cb-poll__opt.is-mine { box-shadow: inset 0 0 0 2px var(--cc-text); font-weight: 800; }
.cb-poll__opt:disabled { cursor: default; }
.cb-poll__label { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.cb-poll__label .icon { flex: none; color: var(--cc-text); }
.cb-poll__n { flex: none; font-size: 13px; font-weight: 800; color: var(--c-ink-2); font-variant-numeric: tabular-nums; }
.cb-poll__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.cb-poll__open { color: var(--cc-text); }
.cb-poll__link { min-height: 32px; padding: 0 4px; border: 0; background: none; color: var(--c-brand-text); font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.cb-poll__link:hover { text-decoration: underline; }
.cb-poll__who { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--c-fill); font-size: 14px; }
.cb-poll__whorow { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.cb-poll__whorow b { flex: none; }
.cb-poll__names { color: var(--c-ink-2); overflow-wrap: anywhere; }
.cb-poll__names a { color: inherit; }
.cl-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.cl-toggles { display: grid; gap: 2px; max-width: none; margin-top: 8px; }

/* visitor gate: skeleton (never real messages) blurred behind the join card */
.cl-gate-wrap { position: relative; display: flex; flex: 1; align-items: center; justify-content: center; min-height: 0; padding: 24px; overflow: hidden; }
.cl-skel { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 16px; padding: 16px 18px; filter: blur(5px); opacity: .45; pointer-events: none; user-select: none; }
.cl-skel__pin { height: 64px; border-radius: 12px; background: var(--cc-tint); }
.cl-skel__row { display: flex; gap: 12px; }
.cl-skel__row i { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--c-fill); }
.cl-skel__row span { display: flex; flex: 1; flex-direction: column; gap: 8px; }
.cl-skel__row b { width: 140px; height: 12px; border-radius: 6px; background: var(--c-fill); }
.cl-skel__row em { width: 55%; height: 12px; border-radius: 6px; background: var(--c-fill); }
.cl-skel__row em.is-long { width: 85%; }
.cl-skel__card { height: 68px; margin-left: 52px; border-radius: 14px; background: var(--c-surface); }
.cl-gate { position: relative; width: min(440px, 100%); margin-top: 48px; padding: 28px; border-radius: 20px; background: var(--c-surface); box-shadow: var(--shadow-card); text-align: center; animation: cl-rise var(--cl-d) var(--ease-out) both; }
.cl-gate__name { font-size: 24px; font-weight: 900; overflow-wrap: anywhere; }
.cl-gate__desc { margin: 8px 0 0; color: var(--c-ink-2); white-space: pre-line; overflow-wrap: anywhere; }
.cl-kv { display: flex; justify-content: center; gap: 22px; margin: 16px 0 12px; }
.cl-kv div { display: flex; flex-direction: column; }
.cl-kv dd { margin: 0; font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.cl-kv dt { font-size: 13px; color: var(--c-ink-2); }
.cl-gate__act { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 18px; }
.cl-gate__act .pnote { margin: 0; }
.cl-hq .cl-gate__join { min-height: 48px; padding: 0 28px; border-radius: var(--radius-pill, 999px); font-size: 16px; font-weight: 800; }

/* members pane */
.cl-mem { min-height: 0; padding: 8px 10px; overflow: auto; background: var(--c-surface); border-left: 1px solid var(--c-border); }
.cl-mem .cl-grp { padding: 14px 6px 6px; }
.cl-u { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 4px 6px; border-radius: 8px; }
.cl-u:hover { background: var(--c-hover); }
.cl-u__link { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.cl-u__x { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.cl-u__x b { font-size: 15px; }
.cl-u__x small { font-size: 12px; color: var(--c-ink-2); }
.cl-mem__more { margin: 8px 6px; }

/* channel pages (tables and forms from the old tabs) */
.cl-page .ptbl-wrap { margin: 0; }
/* thành-viên filter bar: search + labelled selects share one bottom edge (labels stacked above, 6px);
   the staff bulk bar is its own quiet panel below, same 44px row. */
.cl-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.cl-filter .psearch { flex: 1 1 240px; min-height: 44px; padding: 0 14px; }
.cl-filter .psearch input { flex: 1; width: auto; min-width: 0; }
.cl-filter .pform, .cl-filter__bulk { max-width: none; }
.cl-hq :is(.cl-filter, .cl-filter__bulk) .pform__row { align-items: flex-end; gap: 12px; }
.cl-hq :is(.cl-filter, .cl-filter__bulk) label:not(.psearch) { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.cl-filter select { min-width: 150px; }
.cl-filter select, .cl-filter__bulk select, .cl-filter__bulk input[type="number"] { min-height: 44px; }
.cl-filter__bulk input[type="number"] { width: 110px; }
.cl-hq .cl-filter__bulk { padding: 12px 14px; border-radius: 16px; background: var(--c-surface); }
.cl-hq .cl-filter__bulk .pbtn { margin-left: auto; }
.cl-page .prows--tickets .prow > .icon { color: var(--cc-text); }
.cl-danger { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--c-border); }
.cl-page__top:not(:has(> :not([hidden]))) { display: none; }

/* discover (clubs.html) */
.cl-dir { flex: 1; min-height: 0; padding: 22px; overflow: auto; }
.cl-dir__in { max-width: 980px; }
.cl-dir__title { font-size: 28px; font-weight: 900; }
.cl-lead { margin: 4px 0 16px; color: var(--c-ink-2); }
.cl-dir .psearch { margin-bottom: 14px; min-height: 44px; padding: 0 14px; border-radius: 12px; background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-border); }
.cl-dir .psearch input { flex: 1; width: auto; min-width: 0; font-size: 16px; color: inherit; }
.cl-dir__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.cl-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cl-chips .ptab { font-weight: 800; }
.cl-chips .ptab::after { content: none; }
.cl-feat { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.cl-fc { position: relative; display: block; height: 190px; overflow: hidden; border-radius: 16px; background: var(--cc); text-decoration: none; animation: cl-rise var(--duration-slow, .6s) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms); transition: transform var(--cl-d) var(--ease-out), box-shadow var(--cl-d) var(--ease-out); }
.cl-hq .cl-fc { color: var(--cl-on-cc); }
.cl-fc::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 20%, var(--cl-scrim)); }
.cl-fc__in { position: absolute; z-index: 1; left: 14px; right: 14px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.cl-fc__name { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 19px; font-weight: 900; }
.cl-fc__name .cl-crest { width: 40px; height: 40px; font-size: 12px; }
.cl-fc__meta { font-size: 13px; font-weight: 800; }
@media (hover: hover) { .cl-fc:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); } }
.cl-list { display: flex; flex-direction: column; gap: 2px; }
.cl-list .prow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px; border: 0; border-radius: 12px; color: inherit; text-decoration: none; }
.cl-list .prow:hover { background: var(--c-surface); }
.cl-list .prow .cl-crest { width: 48px; height: 48px; }
.cl-list .prow__t { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-side { display: flex; align-items: center; gap: 8px; }
.cl-act { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: var(--radius-pill, 999px); box-shadow: inset 0 0 0 1.5px var(--c-border-strong, var(--c-border)); font-size: 14px; font-weight: 800; white-space: nowrap; }
.cl-pill { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: var(--radius-pill, 999px); background: var(--cc-tint); color: var(--cc-text); font-size: 13px; font-weight: 800; white-space: nowrap; }
.cl-dir #cl-create-panel { margin-bottom: 18px; }

/* Motion (#474 follow-up "I need something smooth"): DESIGN.md Hội nhóm = subtle. State changes 160ms,
   entrances 240ms, ease-out; transform/opacity only. Reduced motion: the .cl-hq kill-switch below. */
.cl-hq .cl-panel:not([hidden]) { animation: cl-enter var(--cl-base) var(--cl-ease) both; }   /* channel switch: hidden → shown restarts it */
.cl-hq .cl-hints:not([hidden]) { animation: cl-pop var(--cl-fast) var(--cl-ease) both; transform-origin: bottom left; }
@property --pct { syntax: "<percentage>"; inherits: false; initial-value: 0%; }   /* lets the vote bar glide */
/* --pct (registered) is animated by club.js renderPoll via WAAPI: the option buttons are rebuilt on each update. */
dialog.cl-editor { opacity: 1; transform: none; transition: opacity var(--cl-fast) var(--cl-ease), transform var(--cl-base) var(--cl-ease), overlay var(--cl-fast) allow-discrete, display var(--cl-fast) allow-discrete; }
dialog.cl-editor:not([open]) { opacity: 0; transform: translateY(8px) scale(.97); }
@starting-style { dialog.cl-editor[open] { opacity: 0; transform: translateY(8px) scale(.97); } }
dialog.cl-editor::backdrop { transition: background-color var(--cl-base) var(--cl-ease), overlay var(--cl-base) allow-discrete, display var(--cl-base) allow-discrete; }
@starting-style { dialog.cl-editor[open]::backdrop { background-color: transparent; } }
@keyframes cl-enter { from { opacity: 0; transform: translateY(6px); } }
@keyframes cl-pop { from { opacity: 0; transform: translateY(4px) scale(.98); } }
@media (prefers-reduced-motion: reduce) {
  dialog.cl-editor, dialog.cl-editor::backdrop { transition: none; transform: none; }
}

@keyframes cl-rise { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1180px) {
  .cl-hq { grid-template-columns: 76px 230px minmax(0, 1fr); }
  .cl-hq--dir { grid-template-columns: 76px minmax(0, 1fr); }
  .cl-mem { display: none; }
}

/* phone: rail and channels become horizontal strips above the centre; the shell ends at the tab bar
   (one scroll area: the stream/page), so the composer always sits above the tab bar. */
@media (max-width: 860px) {
  body.pshell.cl-body { padding-bottom: 0; }
  .cl-hq .pbtn, .cl-hq .pbtn--sm, .cl-hq .ptbl .pbtn--sm, .cl-hq .pchip { min-height: 44px; }   /* touch targets (platform.css B306, restated past the scoped sizes) */
  .cl-hq, .cl-hq--dir { display: flex; flex-direction: column; min-height: 0; height: calc(100vh - var(--cl-nav-h) - var(--ptabbar-h) - env(safe-area-inset-bottom)); height: calc(100dvh - var(--cl-nav-h) - var(--ptabbar-h) - env(safe-area-inset-bottom)); }
  .cl-hq > *, .cl-content > * { min-width: 0; max-width: 100%; }
  .cl-rail { flex: none; flex-direction: row; padding: 8px 12px 10px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--c-border); }
  .cl-rail .cl-crest, .cl-hq .cl-rail__btn { width: 44px; height: 44px; }
  .cl-rail__club.is-on::before { left: 8px; right: 8px; top: auto; bottom: -8px; width: auto; height: 3px; border-radius: 3px; }
  .cl-rail__sep { align-self: center; width: 0; height: 32px; margin: 0 2px; border-top: 0; border-left: 2px solid var(--c-border); }
  .cl-chan { flex: none; border-right: 0; }
  .cl-mid { flex: 1; }   /* B483: take the rest of the shell, else a short stream leaves the composer mid-screen */
  .cl-banner { height: 72px; }
  .cl-banner__name { font-size: 17px; }
  .cl-chans { flex: none; flex-direction: row; gap: 6px; padding: 8px; overflow-x: auto; }
  .cl-ch { flex: none; width: auto; min-height: 44px; background: var(--c-fill); }
  .cl-chans .cl-grp { display: none; }
  .cl-me { display: none; }
  .cl-hq[data-ch="members"] .cl-me:not([hidden]) { display: flex; }   /* leave lives in my row: shown with thành-viên */
  .cl-head { min-height: 48px; padding: 0 8px 0 12px; }
  .cl-head__title { max-width: none; flex: 1; font-size: 16px; }
  .cl-head__sub { display: none; }
  .cl-stream { padding: 12px; }
  .cl-compose { padding: 8px 12px 10px; }
  .cl-hq.is-kbd :is(.cl-rail, .cl-chan) { display: none; }   /* B478: keyboard open */
  .cl-page { padding: 12px; }
  /* thành-viên table → one card per member: name + role, then the actions wrapped full-width (no sideways scroll) */
  #cb-panel-members thead { display: none; }
  #cb-panel-members .ptbl, #cb-panel-members tbody { display: block; }
  #cb-members-body tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 10px 12px; border-bottom: 1px solid var(--c-border); }
  #cb-members-body td { display: block; padding: 0; border: 0; min-width: 0; }
  #cb-members-body td:first-child { display: flex; align-items: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #cb-members-body td:nth-child(2) { color: var(--c-ink-2); font-size: 14px; white-space: nowrap; }
  #cb-members-body td:nth-child(3) { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; text-align: left; }
  #cb-members-body td:nth-child(3):empty { display: none; }
  .cl-gate-wrap { align-items: flex-start; padding: 12px; overflow: auto; }
  .cl-skel { display: none; }
  .cl-gate { margin: 56px 0 16px; padding: 22px 18px; }
  .cl-kv { gap: 16px; }
  .cl-dir { padding: 14px; }
  .cl-dir__title { font-size: 24px; }
  .cl-feat { grid-template-columns: 1fr; }
  .cl-fc { height: 140px; }
  .cl-list .prow { grid-template-columns: auto minmax(0, 1fr); }
  .cl-list .cl-side { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .cl-hq *, .cl-hq *::before, .cl-hq *::after { animation: none !important; transition: none !important; }
}

/* Poll sheet (B479): a .cb-sheet, 560px on desktop, full-width bottom sheet on phones */
dialog.cb-sheet--wide { width: min(35rem, calc(100% - 2rem)); }
@media (max-width: 860px) { dialog.cb-sheet--wide { width: 100%; } }
.cb-field { display: flex; flex-direction: column; gap: 6px; }
.cb-field__top { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; font-weight: 700; color: var(--c-ink-2); }
.cb-field__top small, .cb-opt__count { font-weight: 700; font-variant-numeric: tabular-nums; }
.cb-field > .pbtn { align-self: flex-start; gap: 6px; }
dialog input.cb-in { min-height: 44px; padding: 0 12px; resize: none; }
dialog .cb-in[aria-invalid="true"], dialog .cb-in[aria-invalid="true"]:focus-visible { border-color: var(--c-error); box-shadow: 0 0 0 2px var(--c-error); }
.cb-opts { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.cb-opt { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 6px 8px; }
.cb-opt__n { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--c-fill); color: var(--c-ink-2); font-size: 13px; font-weight: 900; }
.cb-opt__field { position: relative; min-width: 0; }
.cb-opt__count { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: none; color: var(--c-ink-2); font-size: 12px; pointer-events: none; }
.cb-opt__field:focus-within .cb-opt__count { display: block; }
dialog .cb-opt__field input.cb-in:focus { padding-right: 52px; }
.cb-opt__btns { display: flex; gap: 2px; }
.cb-opt__btns .cl-ib:disabled { opacity: .35; cursor: default; background: none; }
.cb-opt__err { grid-column: 2 / -1; display: flex; align-items: center; gap: 6px; margin: 0; color: var(--c-error); font-size: 13px; font-weight: 700; }
.cb-opt__err[hidden], .cb-summary[hidden] { display: none; }
.cb-summary { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--c-error) 10%, transparent); color: var(--c-ink); font-size: 14px; }
.cb-summary > .icon { flex: none; color: var(--c-error); }
.cb-summary ul { display: flex; flex-wrap: wrap; gap: 0 14px; margin: 2px 0 0; padding: 0; list-style: none; }
.cb-summary a { display: inline-block; padding: 3px 0; color: var(--c-error); font-weight: 800; }
.cb-preview { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 16px; background: var(--c-bg); box-shadow: inset 0 0 0 1px var(--c-border); }
.cb-preview__label { font-size: 12px; font-weight: 800; color: var(--c-ink-2); }
.cb-pollprev { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: start; overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .cb-opt { grid-template-columns: 22px minmax(0, 1fr) auto; column-gap: 4px; }
  .cb-opt__n { width: 22px; height: 22px; }
  .cb-opt__btns { gap: 0; }
  .cb-opt__btns .cl-ib { width: 36px; }
}

/* sự-kiện calendar (B480): month grid (APG grid, cells are the focus targets) + the selected day's agenda */
.cb-cal { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 12px 18px; align-items: start; }
.cb-cal__bar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cb-cal__title { min-width: 9.5em; margin: 0 4px; font-size: 18px; font-weight: 900; white-space: nowrap; text-align: center; }
.cb-cal__tz { flex-basis: 100%; display: inline-flex; align-items: center; gap: 6px; color: var(--c-ink-2); font-size: 13px; font-weight: 700; }
.cb-cal__tz .icon, .cb-tzline .icon { flex: none; width: 18px; height: 18px; }
.cb-cal__bar .pbtn--primary { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.cb-cal__bar .pbtn--primary[hidden] { display: none; }
.cb-grid { padding: 10px; border-radius: 16px; background: var(--c-surface); }
.cb-grid table { width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; }
.cb-grid th { padding: 4px 0 6px; font-size: 13px; font-weight: 800; color: var(--c-ink-2); }
.cb-grid abbr { text-decoration: none; }
.cb-grid td.cb-day { height: 46px; padding: 7px 0 0; border-radius: 12px; color: var(--c-ink); font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; vertical-align: top; cursor: pointer; }
.cb-grid td.cb-day:hover { background: var(--c-hover); }
.cb-grid td.cb-day:focus-visible { outline: 2px solid var(--c-brand-text); outline-offset: 1px; }
.cb-grid td.cb-day.is-out { color: var(--c-ink-3); font-weight: 600; }
.cb-grid td.cb-day.is-past:not(.is-out) { color: var(--c-ink-2); }
.cb-grid td.cb-day[aria-current="date"] { box-shadow: inset 0 0 0 2px var(--cc-text); }
.cb-grid td.cb-day[aria-selected="true"] { background: var(--c-ink); color: var(--c-on-ink); }
.cb-day__n { display: block; line-height: 1.3; }
.cb-day__dots { display: flex; justify-content: center; gap: 3px; min-height: 6px; margin-top: 3px; }
.cb-day__dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--cc-text); }
.cb-day[aria-selected="true"] .cb-day__dots i { background: var(--c-on-ink); }
.cb-agenda, .cb-agenda__list { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cb-agenda__h { margin: 0; font-size: 16px; font-weight: 900; }
.cb-ev { display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: start; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--c-surface); }
.cb-ev__time { display: flex; flex-direction: column; font-size: 18px; font-weight: 900; line-height: 1.2; font-variant-numeric: tabular-nums; }
.cb-ev__time small { font-size: 12px; font-weight: 700; color: var(--c-ink-2); }
.cb-ev__body { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.cb-ev__t { font-weight: 800; overflow-wrap: anywhere; }
.cb-ev__m { margin-top: -4px; font-size: 13px; color: var(--c-ink-2); }
.cb-ev__acts { display: flex; align-items: center; gap: 6px; }
.cb-ev__acts .pbtn { display: inline-flex; align-items: center; gap: 6px; }
.cb-ev__acts .pbtn .icon { width: 18px; height: 18px; }
.cb-ev.is-past { opacity: .75; }
.cb-empty { margin: 0; padding: 18px; border-radius: 16px; background: var(--c-surface); color: var(--c-ink-2); text-align: center; }
.cb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cb-tzline { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--c-ink-2); font-size: 13px; }
.cb-preview .cb-ev { background: var(--c-surface); }
.cb-preview .cb-agenda__h { font-size: 14px; }
@media (max-width: 860px) {
  .cb-cal { grid-template-columns: minmax(0, 1fr); }
  .cb-cal__bar .pbtn--primary { order: 9; width: 100%; justify-content: center; margin: 4px 0 0; }
  .cb-cal__title { flex: 1; min-width: 0; font-size: 17px; }
  .cb-grid { padding: 6px; }
  .cb-grid td.cb-day { height: 44px; padding-top: 6px; border-radius: 10px; }
}
