/* Hallmark · genre: playful · macrostructure: Workbench · design-system: design.md · designed-as-app
 * theme: custom · vibe: "playful, youthful, soft community" · paper: oklch(97% 0.012 220) · accent: oklch(64% 0.135 190)
 * display: Bricolage Grotesque 700 · body: Manrope · axes: light / geometric-sans / cool-teal
 * studied: no · context: user-provided · v1.1.0 · pre-emit critique: P5 H5 E4 S5 R4 V5
 * contrast: pass (40–41) · nav: app-bottom-5 · footer: none · slop: pass (42–45)
 * honest: pass (46) · chrome: pass (47) · tokens: pass (48) · icons: pass (30) · mobile: pass (34, 49, 50–57)
 */
@import url("tokens.css");

/* Home-indicator safe area at the bottom of the device. Mobile uses the real
   inset; the desktop iPhone frame and flow thumbnails override it to 16px. */
:root {
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overflow-x: clip;
}

html {
  background: var(--color-paper-2);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--color-paper-2);
  color: var(--color-ink);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

button {
  min-height: var(--control-min);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: var(--rule-fine) solid var(--color-focus);
  outline-offset: var(--space-3xs);
  box-shadow: 0 0 0 var(--space-3xs) var(--color-paper);
}

button:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
}

svg {
  display: block;
  flex: none;
}

h1,
h2,
h3,
p {
  margin-block: 0;
}

h1,
h2,
h3 {
  min-width: 0;
  font-family: var(--font-display);
  font-style: normal;
  font-weight: var(--display-weight);
  letter-spacing: var(--tracking-display);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

h1 {
  font-size: var(--text-xl);
}

h2 {
  font-size: var(--text-lg);
}

h3 {
  font-size: var(--text-md);
}

.prototype-shell {
  min-height: 100dvh;
}

.prototype-rail {
  display: none;
}

/* On mobile the wrapper is inert; it only becomes a sized box on desktop. */
.device-viewport {
  display: contents;
}

.app-canvas {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 100dvh;
  margin-inline: auto;
  background: var(--color-paper);
}

.screen-shell {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  /* Top clears the notch (status-bar), bottom clears the home-indicator safe area. */
  padding: max(0.5rem, env(safe-area-inset-top), var(--status-top, 0px)) var(--space-sm) max(0.5rem, var(--safe-bottom));
}

/* Entrance chỉ chạy khi ĐỔI màn (JS thêm .enter-screen), không replay ở mỗi re-render. */
.screen.enter-screen {
  animation: screen-settle var(--dur-short) var(--ease-out) both;
}

/* Đổi tab trong cùng màn: crossfade nhẹ, không trượt/không stagger. */
.screen.enter-tab {
  animation: screen-fade var(--dur-micro) var(--ease-out) both;
}

/* The primary content stack grows to fill the screen height. */
.screen > .stack {
  flex: 1;
}

@keyframes screen-settle {
  from {
    opacity: 0;
    transform: translateY(var(--space-xs));
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes screen-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* List stagger: con trực tiếp của các danh sách nổi lên tuần tự khi vào màn mới. */
.enter-screen .event-list > *,
.enter-screen .club-grid > *,
.enter-screen .management-list > *,
.enter-screen .conversation-list > *,
.enter-screen .notif-list > *,
.enter-screen .metric-grid > *,
.enter-screen .settings-list > *,
.enter-screen .language-grid > * {
  animation: item-rise var(--dur-short) var(--ease-out) both;
}
.enter-screen .event-list > *:nth-child(1),
.enter-screen .club-grid > *:nth-child(1),
.enter-screen .management-list > *:nth-child(1),
.enter-screen .conversation-list > *:nth-child(1),
.enter-screen .notif-list > *:nth-child(1),
.enter-screen .metric-grid > *:nth-child(1),
.enter-screen .settings-list > *:nth-child(1),
.enter-screen .language-grid > *:nth-child(1) { animation-delay: 40ms; }
.enter-screen .event-list > *:nth-child(2),
.enter-screen .club-grid > *:nth-child(2),
.enter-screen .management-list > *:nth-child(2),
.enter-screen .conversation-list > *:nth-child(2),
.enter-screen .notif-list > *:nth-child(2),
.enter-screen .metric-grid > *:nth-child(2),
.enter-screen .settings-list > *:nth-child(2),
.enter-screen .language-grid > *:nth-child(2) { animation-delay: 90ms; }
.enter-screen .event-list > *:nth-child(3),
.enter-screen .club-grid > *:nth-child(3),
.enter-screen .management-list > *:nth-child(3),
.enter-screen .conversation-list > *:nth-child(3),
.enter-screen .notif-list > *:nth-child(3),
.enter-screen .metric-grid > *:nth-child(3),
.enter-screen .settings-list > *:nth-child(3),
.enter-screen .language-grid > *:nth-child(3) { animation-delay: 140ms; }
.enter-screen .event-list > *:nth-child(4),
.enter-screen .club-grid > *:nth-child(4),
.enter-screen .management-list > *:nth-child(4),
.enter-screen .conversation-list > *:nth-child(4),
.enter-screen .notif-list > *:nth-child(4),
.enter-screen .metric-grid > *:nth-child(4),
.enter-screen .settings-list > *:nth-child(4),
.enter-screen .language-grid > *:nth-child(4) { animation-delay: 190ms; }
.enter-screen .event-list > *:nth-child(n+5),
.enter-screen .club-grid > *:nth-child(n+5),
.enter-screen .management-list > *:nth-child(n+5),
.enter-screen .conversation-list > *:nth-child(n+5),
.enter-screen .notif-list > *:nth-child(n+5),
.enter-screen .settings-list > *:nth-child(n+5),
.enter-screen .language-grid > *:nth-child(n+5) { animation-delay: 240ms; }

@keyframes item-rise {
  from { opacity: 0; transform: translateY(0.5rem); }
  to { opacity: 1; transform: none; }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.stack--tight {
  gap: var(--space-xs);
}

.section-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
}

.section-head > div {
  flex: 1;
  min-width: 0;
}

.section-head > :last-child {
  flex: none;
}

.section-head p {
  max-width: 26ch;
  color: var(--color-muted);
  font-size: var(--text-sm);
}

/* Link "Xem tất cả" nhẹ, chiếm ít chỗ hơn chip có viền → tiêu đề không bị ép xuống dòng. */
.see-all {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  padding: var(--space-3xs) var(--space-2xs);
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--color-accent-ink);
  font-size: var(--text-sm);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.see-all:active { transform: translateY(var(--rule-hair)); }

/* Header kiểu large-title (mobile-first): tiêu đề lớn, phụ đề xuống dòng riêng
   (không cắt), hành động gọn bên phải. Không còn ô "L" thừa. */
.app-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  margin-block-end: var(--space-md);
}

.app-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.app-title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-subtitle {
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: 1.35;
}

.header-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
}

.icon-button,
.back-button {
  display: grid;
  width: var(--control-min);
  height: var(--control-min);
  min-height: var(--control-min);
  padding: 0;
  place-items: center;
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink);
  cursor: pointer;
  transition: background-color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}

.back-button {
  border-radius: var(--radius-card);
}

.icon-button:active,
.back-button:active,
.chip:active,
.nav-button:active,
.card-button:active {
  transform: translateY(var(--rule-hair));
}

/* CTA chính: phản hồi nhấn rõ hơn bằng scale nhẹ. */
.button:active {
  transform: scale(0.97);
}

.page-title-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
  margin-block-end: var(--space-md);
}

/* Cột giữa (tiêu đề) có thể co để không ép ngắt giữa từ. */
.page-title-row > div { min-width: 0; }

.page-title-row h1 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-title-row p {
  margin-block-start: var(--space-3xs);
  color: var(--color-muted);
  font-size: var(--text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hành động bên phải (vd "Đánh dấu đã đọc") gọn, không chiếm quá nhiều chỗ. */
.page-title-row > :last-child { flex: none; }

.role-chip {
  flex: none;
  display: inline-flex;
  min-height: var(--control-min);
  align-items: center;
  gap: var(--space-3xs);
  padding-inline: var(--space-xs);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 700;
  white-space: nowrap;
}
.role-chip svg { color: var(--color-accent-ink); }

/* Badge số chưa đọc trên nút chuông. */
.icon-button { position: relative; }
.icon-badge {
  position: absolute;
  inset-block-start: -3px;
  inset-inline-end: -3px;
  min-width: 1.1rem;
  height: 1.1rem;
  display: grid;
  place-items: center;
  padding-inline: 0.2rem;
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-surface);
  background: var(--color-accent-ink);
  color: var(--color-paper);
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
}

.search-wrap {
  position: relative;
}

.search-wrap svg {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: var(--space-sm);
  color: var(--color-muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.search-input,
.form-input,
.form-select,
.form-textarea,
.chat-input {
  width: 100%;
  min-height: var(--control-min);
  border: var(--rule-hair) solid var(--color-rule-2);
  outline: var(--rule-fine) solid transparent;
  outline-offset: var(--rule-hair);
  border-radius: var(--radius-input);
  background: var(--color-surface);
  color: var(--color-ink);
  transition: background-color var(--dur-short) var(--ease-out);
}

.search-input {
  padding: var(--space-xs) var(--space-sm) var(--space-xs) var(--space-2xl);
}

.search-input::placeholder,
.form-input::placeholder,
.form-textarea::placeholder,
.chat-input::placeholder {
  color: var(--color-muted);
  opacity: 1;
}

.search-status {
  min-height: 1lh;
  margin-block-start: var(--space-3xs);
  color: var(--color-muted);
  font-size: var(--text-xs);
}

.chip-row,
.date-strip,
.avatar-row {
  display: flex;
  gap: var(--space-xs);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding-block: var(--space-3xs);
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar,
.date-strip::-webkit-scrollbar,
.avatar-row::-webkit-scrollbar {
  display: none;
}

/* Wrapping variant: options flow onto multiple lines instead of scrolling sideways. */
.chip-wrap {
  flex-wrap: wrap;
  overflow: visible;
}

.chip {
  display: inline-flex;
  min-height: var(--control-min);
  flex: none;
  align-items: center;
  gap: var(--space-2xs);
  padding-inline: var(--space-sm);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink-2);
  cursor: pointer;
  font-size: var(--text-sm);
  white-space: nowrap;
  transition: background-color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}

.chip.is-active,
.chip[aria-pressed="true"] {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--color-accent-ink);
  font-weight: 700;
}

.hero-card,
.club-card,
.event-row,
.conversation-card,
.management-card,
.profile-card,
.form-card,
.metric-card,
.info-card {
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.hero-card {
  position: relative;
  display: grid;
  min-height: 16rem;
  align-content: space-between;
  gap: var(--space-xl);
  overflow: clip;
  padding: var(--space-lg);
  background: var(--color-accent-soft);
  color: var(--color-accent-ink);
}

.hero-card::after {
  position: absolute;
  inline-size: 9rem;
  block-size: 9rem;
  inset-block-end: -3.5rem;
  inset-inline-end: -2rem;
  border: var(--rule-fine) solid var(--color-accent);
  border-radius: var(--radius-pill);
  content: "";
  opacity: 0.45;
}

.hero-card > * {
  position: relative;
  z-index: var(--z-base);
}

.hero-card .eyeline {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  font-size: var(--text-sm);
  font-weight: 700;
}

.hero-card h2 {
  max-width: 12ch;
  margin-block-start: var(--space-xs);
  font-size: var(--text-2xl);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.meta-pill,
.status-pill {
  display: inline-flex;
  min-height: 2rem;
  align-items: center;
  gap: var(--space-2xs);
  padding-inline: var(--space-xs);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink-2);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill--warning {
  background: var(--color-warning-soft);
  color: var(--color-ink-2);
}

.status-pill--positive {
  background: var(--color-positive-soft);
  color: var(--color-ink-2);
}

.button-row {
  display: flex;
  gap: var(--space-xs);
}

.button-row > * {
  min-width: 0;
  flex: 1;
}

.button {
  display: inline-flex;
  min-height: var(--control-min);
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  padding: var(--space-xs) var(--space-sm);
  border: var(--rule-hair) solid var(--color-ink);
  border-radius: var(--radius-button);
  background: var(--color-ink);
  color: var(--color-paper);
  cursor: pointer;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}

.button--secondary {
  border-color: var(--color-rule-2);
  background: var(--color-surface);
  color: var(--color-ink);
}

.button--soft {
  border-color: var(--color-accent-soft);
  background: var(--color-accent-soft);
  color: var(--color-accent-ink);
}

.button--danger {
  border-color: var(--color-error-soft);
  background: var(--color-error-soft);
  color: var(--color-error);
}

.button.is-success {
  border-color: var(--color-positive-soft);
  background: var(--color-positive-soft);
  color: var(--color-ink);
}

.club-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: var(--space-xs);
}

.club-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
  padding: var(--space-sm);
  color: var(--color-ink);
  cursor: pointer;
  text-align: start;
  transition: background-color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}

.club-card:first-child {
  grid-row: span 2;
  justify-content: space-between;
  background: var(--color-paper-3);
}

/* Màn danh sách CLB: lưới 2 cột đồng đều (không có thẻ nổi bật). */
.club-grid--uniform {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.club-grid--uniform .club-card:first-child {
  grid-row: auto;
  justify-content: flex-start;
  background: var(--color-surface);
}
.club-grid--uniform .club-card:first-child h3 {
  font-size: var(--text-base);
}

.club-card p,
.event-row p,
.management-card p,
.conversation-card p {
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.club-card h3 {
  font-size: var(--text-base);
}

.club-card:first-child h3 {
  font-size: var(--text-lg);
}

.club-monogram,
.avatar {
  display: grid;
  flex: none;
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--color-accent-soft);
  color: var(--color-accent-ink);
  font-family: var(--font-display);
  font-weight: 700;
}

.club-monogram {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-card);
  font-size: var(--text-md);
}

.avatar {
  width: 2.75rem;
  height: 2.75rem;
  border: var(--rule-fine) solid var(--color-surface);
  font-size: var(--text-sm);
}

.avatar--violet {
  background: var(--color-avatar-violet);
}

.avatar--coral {
  background: var(--color-avatar-coral);
}

.avatar--lime {
  background: var(--color-avatar-lime);
}

.avatar-row .avatar + .avatar {
  margin-inline-start: calc(var(--space-sm) * -1);
}

.event-list,
.conversation-list,
.management-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.event-row,
.conversation-card,
.management-card {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  color: var(--color-ink);
  cursor: pointer;
  text-align: start;
  transition: background-color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}

.event-time {
  display: grid;
  min-width: 3.25rem;
  align-self: stretch;
  place-items: center;
  border-radius: var(--radius-input);
  background: var(--color-paper-3);
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.event-copy,
.conversation-copy,
.management-copy {
  min-width: 0;
}

.event-copy strong,
.conversation-copy strong,
.management-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-copy p,
.conversation-copy p,
.management-copy p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-distance,
.message-time {
  color: var(--color-muted);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.date-button {
  display: grid;
  min-width: 3.5rem;
  min-height: 4.25rem;
  flex: none;
  place-items: center;
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  color: var(--color-ink-2);
  cursor: pointer;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.date-button strong {
  display: block;
  font-size: var(--text-md);
}

.date-button.is-active {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--color-accent-ink);
}

.detail-cover {
  display: grid;
  min-height: 11rem;
  align-content: end;
  overflow: clip;
  padding: var(--space-lg);
  border-radius: var(--radius-card);
  background: var(--color-paper-3);
}

.detail-cover--event {
  background: var(--color-accent-soft);
}

.detail-cover .club-monogram {
  margin-block-end: var(--space-xl);
}

.detail-cover p {
  margin-block-start: var(--space-2xs);
  color: var(--color-muted);
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-xs);
}

.stat-cell {
  padding-block: var(--space-sm);
  border-block: var(--rule-hair) solid var(--color-rule);
}

.stat-cell strong,
.stat-cell span {
  display: block;
}

.stat-cell strong {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-variant-numeric: tabular-nums;
}

.stat-cell span {
  color: var(--color-muted);
  font-size: var(--text-xs);
}

.info-card,
.profile-card,
.form-card {
  padding: var(--space-md);
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.info-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--space-sm);
}

.info-item svg {
  margin-block-start: var(--space-3xs);
  color: var(--color-accent-ink);
}

.info-item strong,
.info-item span {
  display: block;
}

.info-item span {
  margin-block-start: var(--space-3xs);
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.sticky-actions {
  position: sticky;
  z-index: var(--z-sticky);
  inset-block-end: 0;
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-sm) max(var(--space-sm), env(safe-area-inset-left)) max(0.5rem, var(--safe-bottom));
  border-block-start: var(--rule-hair) solid var(--color-rule);
  background: var(--color-paper);
}

.sticky-actions > * {
  min-width: 0;
  flex: 1;
}

.bottom-nav {
  position: sticky;
  z-index: var(--z-sticky);
  inset-block-end: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: var(--space-2xs) max(var(--space-2xs), env(safe-area-inset-left)) max(var(--space-2xs), var(--safe-bottom));
  border-block-start: var(--rule-hair) solid var(--color-rule);
  background: var(--color-surface);
}

.nav-button {
  display: flex;
  min-width: 0;
  min-height: 3.75rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3xs);
  padding: var(--space-2xs);
  border: 0;
  border-radius: var(--radius-input);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  font-size: var(--text-xs);
  white-space: nowrap;
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}

.nav-button.is-active {
  background: var(--color-accent-soft);
  color: var(--color-accent-ink);
  font-weight: 700;
}

/* Thanh chỉ báo trượt theo tab đang chọn (5 cột đều nhau). */
.nav-indicator {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 20%;
  height: 2px;
  padding-inline: 1.25rem;      /* thu gọn thanh vào giữa ô */
  background-clip: content-box;
  background-color: var(--color-accent-ink);
  border-radius: 0 0 var(--radius-pill) var(--radius-pill);
  transform: translateX(calc(var(--nav-index, 0) * 100%));
  transition: transform var(--dur-short) var(--ease-out);
  pointer-events: none;
}

.nav-button--create {
  position: relative;
}

.nav-button--create svg {
  padding: var(--space-3xs);
  border-radius: var(--radius-pill);
  background: var(--color-ink);
  color: var(--color-paper);
}

.message-badge {
  display: grid;
  min-width: 1.25rem;
  min-height: 1.25rem;
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--color-error);
  color: var(--color-paper);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.chat-screen {
  display: flex;
  min-height: calc(100dvh - var(--space-xl));
  flex-direction: column;
}

.chat-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: end;
  gap: var(--space-xs);
  padding-block: var(--space-md);
}

.message {
  max-width: 82%;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-card);
  background: var(--color-paper-3);
  color: var(--color-ink);
}

.message--mine {
  align-self: end;
  background: var(--color-accent-soft);
  color: var(--color-accent-ink);
}

.message span {
  display: block;
  margin-block-start: var(--space-3xs);
  color: var(--color-muted);
  font-size: var(--text-xs);
  text-align: end;
}

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-xs);
  padding-block-start: var(--space-sm);
  border-block-start: var(--rule-hair) solid var(--color-rule);
}

.chat-input,
.form-input,
.form-select,
.form-textarea {
  padding: var(--space-xs) var(--space-sm);
}

.form-textarea {
  min-height: 7rem;
  resize: vertical;
}

.profile-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-radius: var(--radius-card);
  background: var(--color-accent-soft);
  color: var(--color-accent-ink);
}

.profile-hero .avatar {
  width: 4.5rem;
  height: 4.5rem;
  font-size: var(--text-lg);
}

.language-row {
  display: flex;
  min-height: var(--control-min);
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-block: var(--space-xs);
  border-block-end: var(--rule-hair) solid var(--color-rule);
}

/* Flat settings group — no nested card, just a heading over a divided list. */
.settings-list {
  display: flex;
  flex-direction: column;
}
.settings-list > h2 {
  margin-block-end: var(--space-3xs);
}

/* Settings list row: leading icon chip, stacked title + subtitle, trailing chevron. */
.setting-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  min-height: 3.5rem;
  padding: var(--space-xs) 0;
  border: 0;
  border-block-end: var(--rule-hair) solid var(--color-rule);
  border-radius: 0;
  background: none;
  text-align: start;
  cursor: pointer;
}

.setting-row:last-child {
  border-block-end: 0;
}

.setting-icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.7rem;
  background: var(--color-accent-soft);
  color: var(--color-accent-ink);
}

.setting-copy {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}
.setting-copy strong {
  font-size: var(--text-base);
  color: var(--color-ink);
}
.setting-copy > span {
  color: var(--color-muted);
  font-size: var(--text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setting-chevron {
  display: grid;
  place-items: center;
  color: var(--color-rule-2);
}
.setting-row:active {
  transform: translateY(var(--rule-hair));
}

.language-row:last-child {
  border-block-end: 0;
}
.language-row span {
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.mode-switch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-xs);
}

.mode-card {
  min-height: 8rem;
  padding: var(--space-sm);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  color: var(--color-ink);
  cursor: pointer;
  text-align: start;
}

.mode-card.is-active {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.mode-card strong,
.mode-card span {
  display: block;
}

.mode-card span {
  margin-block-start: var(--space-2xs);
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-xs);
}

.metric-card {
  padding: var(--space-sm);
  box-shadow: none;
}

.metric-card strong,
.metric-card span {
  display: block;
}

.metric-card strong {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
}

.metric-card span {
  color: var(--color-muted);
  font-size: var(--text-xs);
}

.capacity-track {
  height: var(--space-2xs);
  overflow: clip;
  margin-block-start: var(--space-xs);
  border-radius: var(--radius-pill);
  background: var(--color-paper-3);
}

.capacity-track span {
  display: block;
  width: var(--capacity, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--color-accent);
}

.management-actions {
  display: flex;
  gap: var(--space-2xs);
}

.small-action {
  display: inline-grid;
  min-width: var(--control-min);
  min-height: var(--control-min);
  place-items: center;
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-input);
  background: var(--color-surface);
  color: var(--color-ink);
  cursor: pointer;
}

.progress-dots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-xs);
  margin-block-end: var(--space-lg);
}

.progress-step {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-2xs);
  color: var(--color-muted);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.progress-step::before {
  display: grid;
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  place-items: center;
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  content: attr(data-step);
  font-variant-numeric: tabular-nums;
}

.progress-step.is-active,
.progress-step.is-done {
  color: var(--color-ink);
  font-weight: 700;
}

.progress-step.is-active::before,
.progress-step.is-done::before {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--color-accent-ink);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

.field-group label,
.field-label {
  font-size: var(--text-sm);
  font-weight: 700;
}

.field-helper {
  min-height: 1lh;
  color: var(--color-muted);
  font-size: var(--text-xs);
}

.field-helper.is-error {
  color: var(--color-error);
}

.field-group.has-error .form-input,
.field-group.has-error .form-select,
.field-group.has-error .form-textarea {
  border-color: var(--color-error);
}

.form-grid {
  display: grid;
  gap: var(--space-sm);
}

.toggle-row {
  display: flex;
  min-height: var(--control-min);
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.toggle-row input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--color-accent);
}

.preview-card {
  padding: var(--space-lg);
  border-radius: var(--radius-card);
  background: var(--color-paper-3);
}

.preview-card h2 {
  margin-block-end: var(--space-sm);
}

.preview-card .info-list {
  margin-block-start: var(--space-md);
}

.empty-state {
  display: grid;
  min-height: 18rem;
  place-items: center;
  text-align: center;
}

.empty-state > div {
  max-width: 28ch;
}

.empty-state svg {
  margin-inline: auto;
  margin-block-end: var(--space-sm);
  color: var(--color-accent-ink);
}

.empty-state p {
  margin-block: var(--space-xs) var(--space-md);
  color: var(--color-muted);
}

.prototype-brand {
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: var(--tracking-display);
  text-decoration: none;
}

.prototype-brand span {
  color: var(--color-accent-ink);
}

.rail-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.rail-label,
.rail-note {
  color: var(--color-muted);
  font-size: var(--text-xs);
}

.role-segment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr);
  gap: var(--space-2xs);
  padding: var(--space-2xs);
  border-radius: var(--radius-card);
  background: var(--color-paper-3);
}

.role-button,
.rail-link {
  min-height: var(--control-min);
  padding-inline: var(--space-sm);
  border: 0;
  border-radius: var(--radius-input);
  background: transparent;
  color: var(--color-ink-2);
  cursor: pointer;
  text-align: start;
  white-space: nowrap;
}

.role-button {
  text-align: center;
}

.role-button.is-active {
  background: var(--color-surface);
  color: var(--color-ink);
  font-weight: 700;
  box-shadow: var(--shadow-card);
}

.rail-link:hover,
.rail-link:focus-visible {
  background: var(--color-paper-3);
}

.is-hidden {
  display: none !important;
}

@media (hover: hover) and (pointer: fine) {
  .icon-button:hover,
  .back-button:hover,
  .chip:hover,
  .club-card:hover,
  .event-row:hover,
  .conversation-card:hover,
  .management-card:hover,
  .small-action:hover {
    background: var(--color-paper-3);
  }

  .button:hover {
    transform: translateY(calc(var(--rule-hair) * -1));
  }
}

@media (min-width: 48rem) {
  .app-canvas {
    max-width: var(--app-width);
    border-inline: var(--rule-hair) solid var(--color-rule);
    box-shadow: var(--shadow-card);
  }

  .screen {
    padding-inline: var(--space-lg);
  }
}

@media (min-width: 60rem) {
  /* Desktop: full-viewport stage. The phone fits and centers; when the window
     is shorter than the phone, the stage scrolls vertically instead of clipping. */
  .prototype-shell {
    display: grid;
    height: 100dvh;
    max-width: var(--content-width);
    grid-template-columns: var(--rail-width) auto;
    justify-content: center;
    align-items: center;
    gap: var(--space-2xl);
    margin-inline: auto;
    padding: var(--space-xl);
    overflow-x: hidden;
    overflow-y: auto;
  }

  .prototype-rail {
    display: flex;
    height: min(844px, calc(100dvh - (var(--space-xl) * 2)));
    flex-direction: column;
    gap: var(--space-xl);
    padding: var(--space-lg);
    border: var(--rule-hair) solid var(--color-rule);
    border-radius: var(--radius-card);
    background: var(--color-paper);
    box-shadow: var(--shadow-card);
    overflow: auto;
  }

  .prototype-rail > div:first-child p {
    margin-block-start: var(--space-xs);
    color: var(--color-muted);
    font-size: var(--text-sm);
  }

  .rail-note {
    margin-block-start: auto;
  }

  /* True iPhone 13 Pro logical size (390×844) at 1:1 — no transform scale.
     The viewport is the phone body: a thick dark bezel wrapping the screen,
     with the notch drawn as a pseudo-element over the top of the screen.
     margin:auto centers the phone when it fits and lets it scroll (rather
     than clip) inside the stage when the window is shorter than the phone. */
  .device-viewport {
    display: block;
    flex: none;
    position: relative;
    width: max-content;
    margin: auto;
    padding: 13px;
    background: #0b0f14;
    border-radius: 3.2rem;
    box-shadow:
      0 2px 6px rgba(11, 15, 20, 0.35),
      0 24px 60px -12px rgba(11, 15, 20, 0.55),
      inset 0 0 0 2px rgba(255, 255, 255, 0.04);
  }

  /* Subtle side buttons on the bezel. */
  .device-viewport::before {
    content: "";
    position: absolute;
    left: -2px;
    top: 150px;
    width: 3px;
    height: 78px;
    border-radius: 3px;
    background: #05080c;
    box-shadow:
      0 100px 0 0 #05080c,     /* second left button (volume) */
      417px 34px 0 0 #05080c;  /* right side/power button */
  }

  /* Notch / dynamic island — centered pill over the top of the screen. */
  .device-viewport::after {
    content: "";
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    width: 116px;
    height: 28px;
    border-radius: 999px;
    background: #05080c;
    z-index: 3;
  }

  .app-canvas {
    width: 390px;
    height: 844px;
    min-height: 0;
    max-width: none;
    margin: 0;
    border: 0; /* bỏ border-inline từ media ≥48rem (bezel đã có viền) — giữ đúng 390px */
    border-radius: 2.4rem;
    overflow: hidden;
    --safe-bottom: 16px;   /* chừa vùng home indicator ảo */
    --status-top: 3.25rem; /* content thụt xuống khỏi notch; nền vẫn tràn top 0 */
  }

  /* Content scrolls inside the device, not the page. Backgrounds bleed to the top;
     only content is inset from the notch via --status-top (see .screen/.auth-screen). */
  .app-canvas > #app {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; /* không để scrollbar ăn bớt width → mọi màn đúng 390px */
  }
  .app-canvas > #app::-webkit-scrollbar { display: none; }

  /* Full-height layouts fill the 844px device, then get scaled with it. */
  .screen-shell,
  .auth-screen,
  .boot {
    min-height: 100%;
  }
}

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

  .screen {
    transform: none;
  }

  /* Bỏ trượt/độ trễ tuần tự; chỉ giữ fade rất ngắn. */
  .enter-screen .event-list > *,
  .enter-screen .club-grid > *,
  .enter-screen .management-list > *,
  .enter-screen .conversation-list > *,
  .enter-screen .notif-list > *,
  .enter-screen .metric-grid > *,
  .enter-screen .settings-list > *,
  .enter-screen .language-grid > * {
    animation-delay: 0ms !important;
    transform: none !important;
  }
  .nav-indicator { transition: none !important; }
}

/* Auth (sign in / sign up) — clean centered card on a soft, brand-tinted field. */
.auth-screen {
  position: relative;
  min-height: 100dvh;
  display: flex;
  /* Top-anchored so the name field in sign-up grows downward instead of shifting
     the whole card (avoids layout shift when switching tabs). */
  align-items: flex-start;
  justify-content: center;
  /* Background bleeds to the very top; the card is inset below the notch. */
  padding: max(var(--space-2xl), var(--status-top, 0px), env(safe-area-inset-top)) var(--space-md) var(--space-xl);
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--color-accent-soft), transparent 60%),
    linear-gradient(180deg, var(--color-paper), var(--color-paper-2));
}
/* Entrance plays only on first mount, never on tab/password re-renders. */
.auth-screen.is-enter {
  animation: app-enter 460ms var(--ease-out) both;
}

/* Blurred teal orbs add depth behind the card. */
.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.5;
  pointer-events: none;
}
.auth-orb--1 { width: 16rem; height: 16rem; top: -4rem; right: -3rem; background: var(--color-accent); opacity: 0.28; }
.auth-orb--2 { width: 13rem; height: 13rem; bottom: -3rem; left: -3rem; background: oklch(80% 0.10 190); opacity: 0.32; }

.auth-card {
  position: relative;
  width: 100%;
  max-width: 23rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding: var(--space-xl) var(--space-lg);
  background: var(--color-paper);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: 1.25rem;
  box-shadow: 0 18px 48px oklch(30% 0.06 220 / 0.12);
}

/* Brand lockup: teal mark + wordmark, matching the app header. */
.auth-lockup {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
}
/* App logo: circular concentric teal rings + gold script initial (mini splash). */
.auth-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--color-paper);
  box-shadow: inset 0 0 0 1px var(--color-rule);
  overflow: hidden;
}
.auth-mark-rings {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.auth-mark-rings span {
  position: absolute;
  border-radius: 50%;
}
.auth-mark-rings span:nth-child(1) { width: 2.6rem; height: 2.6rem; background: oklch(93% 0.04 190); }
.auth-mark-rings span:nth-child(2) { width: 1.7rem; height: 1.7rem; background: oklch(82% 0.09 190); }
.auth-mark-initial {
  position: relative;
  font-family: "Pacifico", var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  padding-bottom: 3px;
  background: linear-gradient(120deg, oklch(88% 0.14 92), oklch(78% 0.16 66));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-word {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-ink);
}
.auth-word span { color: var(--color-accent); }

.auth-head { display: grid; gap: var(--space-3xs); }
.auth-head h1 { font-size: var(--text-xl); }
/* Reserve two lines so the sign-in (1 line) and sign-up (2 line) subtitles keep
   the same height — tabs and fields below don't shift when switching tabs. */
.auth-head p { margin: 0; min-height: 2.75rem; color: var(--color-muted); font-size: var(--text-sm); }

/* Segmented tabs with a sliding-feel active pill. */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xs);
  padding: var(--space-3xs);
  background: var(--color-paper-2);
  border-radius: var(--radius-input);
}
.auth-tab {
  min-height: 2.5rem;
  border: 0;
  border-radius: calc(var(--radius-input) - 2px);
  background: transparent;
  color: var(--color-muted);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}
.auth-tab.is-active {
  background: var(--color-paper);
  color: var(--color-ink);
  box-shadow: 0 1px 3px oklch(20% 0.05 220 / 0.12);
}

/* Inputs with a leading icon and optional trailing toggle. */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap > svg {
  position: absolute;
  inset-inline-start: var(--space-sm);
  color: var(--color-muted);
  pointer-events: none;
}
.form-input.has-icon { padding-inline-start: 2.75rem; }
.form-input.has-trailing { padding-inline-end: 2.75rem; }
.input-toggle {
  position: absolute;
  inset-inline-end: var(--space-2xs);
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
}
.input-toggle:hover { color: var(--color-ink); }

.auth-submit { margin-top: var(--space-2xs); }

.auth-switch {
  margin: 0;
  text-align: center;
  color: var(--color-muted);
  font-size: var(--text-sm);
}

.text-link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--color-focus);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.text-link:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-input);
}

@keyframes app-enter {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

/* ── Boot sequence: splash → loading (recreated from the ClubApp design) ── */
.boot {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--color-paper);
  --gold-a: oklch(86% 0.15 92);
  --gold-b: oklch(78% 0.16 66);
  --hello-indigo: oklch(45% 0.16 275);
  --hello-gold: oklch(86% 0.15 92);
  --hello-green: oklch(72% 0.17 145);
  --hello-pink: oklch(64% 0.21 358);
}
/* Exit transition into the app: rings bloom outward, center lifts away, all fades. */
.boot.is-done {
  opacity: 0;
  transition: opacity 460ms var(--ease-in);
}
.boot-rings {
  transition: transform 520ms var(--ease-in), opacity 520ms var(--ease-in);
}
.boot.is-done .boot-rings {
  transform: scale(2.6);
  opacity: 0;
}
.boot-center,
.boot-loading {
  transition: opacity 320ms var(--ease-in), transform 320ms var(--ease-in);
}
.boot.is-done .boot-center { opacity: 0; transform: scale(0.9); }
.boot.is-done .boot-loading { opacity: 0; }

/* Concentric teal rings, present in both frames of the design. */
.boot-rings {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.boot-rings span {
  position: absolute;
  border-radius: 50%;
  transform: scale(0.6);
  opacity: 0;
  /* ring-in animates transform+opacity; the wave animates the independent `scale`
     property so the two compose without fighting over one transform. */
  animation: boot-ring-in 700ms var(--ease-out) forwards, boot-ring-wave 3s ease-in-out infinite;
}
/* Two-value delays: first = ring-in stagger, second = wave stagger (inner first → wave travels outward). */
.boot-rings span:nth-child(1) { width: 22rem; height: 22rem; background: oklch(95% 0.028 190); animation-delay: 40ms, 720ms; }
.boot-rings span:nth-child(2) { width: 17rem; height: 17rem; background: oklch(91% 0.05 190); animation-delay: 120ms, 480ms; }
.boot-rings span:nth-child(3) { width: 12.5rem; height: 12.5rem; background: oklch(86% 0.08 190); animation-delay: 200ms, 240ms; }
.boot-rings span:nth-child(4) { width: 8.5rem; height: 8.5rem; background: oklch(80% 0.10 190); animation-delay: 280ms, 0ms; }
@keyframes boot-ring-in {
  to { transform: scale(1); opacity: 1; }
}
@keyframes boot-ring-wave {
  0%, 100% { scale: 1; }
  50% { scale: 1.045; }
}

.boot-center {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: min(80%, 18rem);
  min-height: 12rem;
}

/* Splash wordmark — script logo in the design's gold. */
.boot-logo {
  grid-area: 1 / 1;
  margin: 0;
  font-family: "Pacifico", var(--font-display);
  font-size: clamp(2.75rem, 14vw, 3.75rem);
  line-height: 1;
  background: linear-gradient(120deg, var(--gold-a), var(--gold-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transform: scale(0.85);
  opacity: 0;
  animation: boot-logo-in 620ms var(--ease-out) 260ms forwards;
}
@keyframes boot-logo-in {
  to { transform: scale(1); opacity: 1; }
}
.boot.is-loading .boot-logo {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 300ms var(--ease-in), transform 300ms var(--ease-in);
  animation: none;
}

/* Loading frame — multilingual greeting bubbles pop in. */
.hello-bubbles {
  grid-area: 1 / 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  max-width: 15rem;
}
.hello-bubble {
  padding: 0.3rem 0.7rem;
  border-radius: 999px 999px 999px 4px;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  transform: scale(0) rotate(var(--rot, -4deg));
  opacity: 0;
}
.boot.is-loading .hello-bubble {
  /* pop-in on transform, then a continuous float on the independent `translate`
     property so bubbles keep gently bobbing while the loading frame is up. */
  animation: boot-bubble-in 460ms var(--ease-out) forwards,
             boot-bubble-float calc(2600ms + var(--i) * 240ms) ease-in-out infinite;
  animation-delay: calc(var(--i) * 90ms), calc(var(--i) * 130ms + 380ms);
}
.hello-bubble:nth-child(odd) { --rot: 5deg; }
.hello-bubble--indigo { background: var(--hello-indigo); color: #fff; }
.hello-bubble--gold { background: var(--hello-gold); color: oklch(30% 0.05 80); }
.hello-bubble--green { background: var(--hello-green); color: oklch(28% 0.06 150); }
.hello-bubble--pink { background: var(--hello-pink); color: #fff; }
@keyframes boot-bubble-in {
  60% { transform: scale(1.08) rotate(var(--rot, -4deg)); }
  100% { transform: scale(1) rotate(var(--rot, -4deg)); opacity: 1; }
}
@keyframes boot-bubble-float {
  0%, 100% { translate: 0 0.25rem; }
  50% { translate: 0 -0.4rem; }
}

/* Progress + caption sit under the rings during the loading frame. */
.boot-loading {
  position: absolute;
  z-index: 1;
  bottom: 4.5rem;
  display: grid;
  justify-items: center;
  gap: var(--space-xs);
  opacity: 0;
}
.boot.is-loading .boot-loading {
  animation: boot-fade-in 320ms var(--ease-out) 120ms forwards;
}
.boot-progress {
  width: 10rem;
  height: 0.375rem;
  border-radius: 999px;
  background: oklch(88% 0.03 190);
  overflow: hidden;
}
.boot-progress > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--color-accent);
}
.boot.is-loading .boot-progress > span {
  animation: boot-progress 3200ms var(--ease-in-out) forwards;
}
.boot-caption {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--text-sm);
}
@keyframes boot-progress { to { width: 100%; } }
@keyframes boot-fade-in { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .boot-rings span,
  .boot-logo,
  .boot.is-loading .hello-bubble,
  .boot.is-loading .boot-loading,
  .boot.is-loading .boot-progress > span {
    animation: none;
  }
  .boot-rings span { transform: scale(1); opacity: 1; }
  .boot-logo { transform: scale(1); opacity: 1; }
}

/* ── Onboarding language grid (from ClubApp design) ── */
.language-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2xs);
  margin-top: var(--space-sm);
}
.lang-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3xs);
  padding: var(--space-sm) var(--space-2xs);
  background: var(--color-paper-2);
  border: 1.5px solid transparent;
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: border-color var(--dur-micro) var(--ease-out), background var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
.lang-card:active { transform: translateY(1px); }
.lang-card.is-active {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}
.lang-card:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
.lang-illustration {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  color: var(--color-ink-2);
}
.lang-illustration svg { width: 100%; height: 100%; }
.lang-card.is-active .lang-illustration { color: var(--color-focus); }
/* Biến thể ảnh landmark: lớn hơn, bo góc, phủ kín. */
.lang-illustration--img { width: 3.5rem; height: 3.5rem; border-radius: 0.75rem; overflow: hidden; }
.lang-illustration--img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.level-illustration--img { width: 1.9rem; height: 1.9rem; border-radius: 0.45rem; overflow: hidden; vertical-align: -0.45em; }
.level-illustration--img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.level-illustration {
  display: inline-grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  color: var(--color-accent);
  vertical-align: -0.2em;
}
.level-illustration svg { width: 100%; height: 100%; }
.level-block { display: flex; flex-direction: column; gap: var(--space-2xs); }
/* Sparse onboarding steps: let the body grow and sit centered so the screen
   fills the height instead of leaving a large empty gap above the actions. */
.onboarding-stack { flex: 1; }
.onboarding-fill { flex: 1; justify-content: center; gap: var(--space-lg); }
.level-block h2 { display: flex; align-items: center; gap: var(--space-2xs); font-size: var(--text-md); }
.lang-name {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: var(--color-ink);
  text-align: center;
}

/* ── Profile cover + tags (from ClubApp design) ── */
.profile-cover {
  display: grid;
  justify-items: center;
  gap: var(--space-3xs);
  padding: var(--space-lg) var(--space-md) var(--space-xl);
  background: var(--color-accent);
  border-radius: var(--radius-card);
  text-align: center;
}
.profile-cover h1 {
  margin: var(--space-2xs) 0 0;
  color: var(--color-accent-ink);
}
.profile-cover p {
  margin: 0;
  color: oklch(28% 0.04 220);
  font-size: var(--text-sm);
}
.avatar--xl {
  width: 5rem;
  height: 5rem;
  font-size: var(--text-lg);
  border: 3px solid var(--color-paper);
  box-shadow: 0 6px 18px oklch(20% 0.05 220 / 0.18);
}
.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs);
}
.tag-pill {
  padding: 0.35rem 0.8rem;
  background: var(--color-ink);
  color: var(--color-paper);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 700;
}
.tag-more {
  border: 0;
  background: none;
  padding: 0.35rem 0.4rem;
  color: var(--color-focus);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tag-more:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-input);
}

/* ─────────── Flow board (visual link map / whiteboard) ─────────── */
.flow-fab {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 1500;
  display: none;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-pill);
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-card);
}
@media (min-width: 60rem) {
  .flow-fab { display: inline-flex; }
}

.flow-root {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  background: var(--color-paper-2);
}
.flow-root.is-open { display: block; }

.flow-board {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  background-image: radial-gradient(var(--color-rule) 1.2px, transparent 1.2px);
  background-size: 26px 26px;
  touch-action: none;
}
.flow-board.is-panning { cursor: grabbing; }

.flow-world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}

.flow-links,
.flow-links-top {
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
}
/* Lớp link dưới màn (mặc định mờ); lớp link-top nổi trên màn (khi hover). */
.flow-links { z-index: 1; pointer-events: none; }
.flow-links-top { z-index: 3; pointer-events: none; }
.flow-link {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 2.5;
  stroke-opacity: 0.5;
}
/* Vùng bắt hover to hơn, trong suốt. */
.flow-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 22;
  pointer-events: stroke;
  cursor: pointer;
}
.flow-link-hi {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 3.5;
  stroke-opacity: 1;
}
.flow-dot { fill: var(--color-accent); opacity: 0.5; }
.flow-dot-hi { fill: var(--color-accent); }

.flow-node { position: absolute; z-index: 2; }
.flow-node-label {
  margin-bottom: 8px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--color-ink-2);
}
.flow-node-frame {
  position: relative;
  overflow: hidden;
  border: 1.5px solid var(--color-rule-2);
  border-radius: 16px;
  background: var(--color-paper);
  box-shadow: var(--shadow-card);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.flow-scale {
  transform-origin: top left;
  pointer-events: none;
}
.flow-node:hover .flow-node-frame {
  border-color: var(--color-accent);
  box-shadow: 0 10px 28px oklch(64% 0.135 190 / 0.4);
  transform: translateY(-3px);
}

.flow-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.flow-title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  color: var(--color-ink);
  background: var(--color-paper);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-card);
}
.flow-tools { display: flex; gap: 8px; }
.flow-btn {
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: 12px;
  background: var(--color-paper);
  color: var(--color-ink);
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-card);
}
.flow-btn:hover { background: var(--color-paper-2); }
.flow-close { color: var(--color-error); }
.flow-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  background: var(--color-paper);
  color: var(--color-muted);
  font-size: var(--text-xs);
  box-shadow: var(--shadow-card);
  white-space: nowrap;
}

/* Flow board — draggable nodes */
.flow-board { user-select: none; }
.flow-world { overflow: visible; }
.flow-node { cursor: grab; }
.flow-node.is-dragging { cursor: grabbing; z-index: 5; }
.flow-node.is-dragging .flow-node-frame { border-color: var(--color-accent); box-shadow: 0 14px 34px oklch(64% 0.135 190 / 0.5); }

/* Flow thumbnails: keep the iPhone min-height (bottom bar pinned) and reserve the
   home-indicator gap, while still growing for taller content. */
.flow-scale { --safe-bottom: 16px; }
.flow-scale > .screen-shell,
.flow-scale > .auth-screen,
.flow-scale > .boot {
  min-height: 844px;
}
/* Nhấc thanh nav/actions lên ~8px (16px × scale) để không bị góc bo của khung cắt. */
.flow-scale > .screen-shell {
  padding-bottom: 16px;
}
/* Trong thumbnail không có vùng cuộn: bỏ sticky để thanh nav/actions nằm đúng đáy
   (screen flex:1 đẩy xuống) thay vì neo lơ lửng theo flow-board. */
.flow-scale .bottom-nav,
.flow-scale .sticky-actions {
  position: static;
}

/* ── Phase 1: tabs, toast, sheet, confirm, notifications, courses ── */
.tab-bar {
  display: flex;
  gap: var(--space-2xs);
  overflow-x: auto;
  scrollbar-width: none;
  border-block-end: var(--rule-hair) solid var(--color-rule);
  padding-block-end: var(--space-2xs);
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 1 auto;             /* giãn lấp đầy nhưng theo bề rộng nội dung → không cắt tab dài */
  min-width: 0;
  border: 0;
  background: none;
  padding: var(--space-2xs) var(--space-3xs);
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  font-size: var(--text-sm);  /* nhỏ hơn body để 4 tab (club) vừa khung 390 */
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tab.is-active { background: var(--color-accent-soft); color: var(--color-accent-ink); }

.report-link { display: inline-flex; align-items: center; gap: var(--space-3xs); color: var(--color-muted); }

/* Toast */
.toast-host {
  position: absolute;
  inset-inline: 0;            /* trải đủ bề ngang khung → không lệch/tràn ra ngoài */
  bottom: calc(var(--safe-bottom) + 4.5rem);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;        /* căn giữa pill theo chiều ngang */
  gap: var(--space-2xs);
  padding-inline: var(--space-md);
  pointer-events: none;
}
.toast {
  max-width: 100%;            /* co trong khung; text dài mới xuống dòng */
  padding: var(--space-xs) var(--space-md);
  border-radius: 1.25rem;     /* bo mềm, đẹp cả khi 2 dòng (thay pill quá tròn) */
  background: var(--color-ink);
  color: var(--color-paper);
  font-size: var(--text-sm);
  font-weight: 700;
  text-align: center;
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.toast.is-in { opacity: 1; transform: none; }

/* Bottom sheet + confirm — bám trong khung thiết bị (.app-canvas) */
.sheet-scrim, .confirm-scrim {
  position: absolute;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: oklch(20% 0.03 240 / 0.38);
  opacity: 0;
  transition: opacity 200ms var(--ease-out);
}
.sheet-scrim.is-in { opacity: 1; }
.sheet, .confirm {
  width: 100%;
  max-width: 26rem;
  margin: var(--space-sm);
  margin-block-end: calc(var(--safe-bottom) + var(--space-sm));
  padding: var(--space-md);
  background: var(--color-paper);
  border-radius: 1.25rem;
  box-shadow: 0 -8px 40px oklch(20% 0.05 240 / 0.2);
  transform: translateY(24px);
  transition: transform 320ms var(--ease-spring);
}
.sheet-scrim.is-in .sheet, .sheet-scrim.is-in .confirm { transform: none; }
.confirm { align-self: center; margin-block: auto; }
.sheet-title { font-family: var(--font-display); font-size: var(--text-md); margin-block-end: var(--space-xs); }
.sheet-items { display: flex; flex-direction: column; gap: var(--space-3xs); margin-block-end: var(--space-xs); }
.sheet-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border: 0;
  border-radius: var(--radius-input);
  background: var(--color-paper-2);
  color: var(--color-ink);
  font-weight: 700;
  text-align: start;
  cursor: pointer;
}
.sheet-item.danger { color: var(--color-error); }
.confirm h3 { margin-block-end: var(--space-2xs); }
.confirm p { color: var(--color-muted); font-size: var(--text-sm); margin-block-end: var(--space-md); }
.confirm-actions { display: flex; gap: var(--space-xs); }
.confirm-actions .button { flex: 1; }
.confirm-yes { background: var(--color-error); }

/* Conversation unread + meta */
.conversation-meta { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-3xs); }
.unread-dot {
  min-width: 1.1rem; height: 1.1rem; padding: 0 0.3rem;
  display: grid; place-items: center;
  border-radius: 999px; background: var(--color-accent); color: var(--color-accent-ink);
  font-size: var(--text-xs); font-weight: 700;
}
.conversation-card.is-unread strong { font-weight: 700; }

/* Notifications */
.notif-list { display: flex; flex-direction: column; }
.notif-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm) 0;
  border: 0;
  border-block-end: var(--rule-hair) solid var(--color-rule);
  background: none;
  text-align: start;
  cursor: pointer;
}
.notif-icon { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 0.7rem; background: var(--color-accent-soft); color: var(--color-accent-ink); }
.notif-copy strong { display: block; }
.notif-copy p { color: var(--color-muted); font-size: var(--text-sm); }
.notif-time { color: var(--color-muted); font-size: var(--text-xs); }
.notif-item.is-unread { background: var(--color-accent-soft); border-radius: var(--radius-card); padding-inline: var(--space-sm); }
.unread-dot-sm { width: 0.55rem; height: 0.55rem; border-radius: 999px; background: var(--color-accent); margin-block-start: var(--space-2xs); }

/* Courses */
.course-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  text-align: start;
  cursor: pointer;
}
.course-cover { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: var(--radius-input); color: var(--color-accent-ink); }
.course-copy { min-width: 0; }
.course-copy strong { display: block; }
.course-copy p { color: var(--color-muted); font-size: var(--text-sm); }
.course-meta { display: flex; gap: var(--space-2xs); margin-block-start: var(--space-3xs); }
/* ── Chi tiết khóa học ── */
.course-facts { display: flex; flex-direction: column; gap: var(--space-sm); }
.course-fact { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--space-sm); }
.course-fact svg { color: var(--color-accent-ink); }
.course-fact span { display: block; color: var(--color-muted); font-size: var(--text-xs); }
.course-fact strong { display: block; font-size: var(--text-sm); }

.outcome-list { display: flex; flex-direction: column; gap: var(--space-xs); }
.outcome-item { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--space-xs); }
.outcome-item svg { margin-block-start: 0.15rem; color: var(--color-accent-ink); }
.outcome-item span { font-size: var(--text-sm); }

.module-list { display: flex; flex-direction: column; gap: 0; }
.module-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-sm);
  padding-block: var(--space-sm);
}
.module-item + .module-item { border-block-start: var(--rule-hair) solid var(--color-rule); }
.module-item:first-child { padding-block-start: 0; }
.module-item:last-child { padding-block-end: 0; }
.module-num {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-pill);
  background: var(--color-accent-soft);
  color: var(--color-accent-ink);
  font-weight: 700;
  font-size: var(--text-sm);
  line-height: 1;
}
.module-body strong { display: block; font-size: var(--text-base); }
.module-body p { margin-block-start: var(--space-3xs); color: var(--color-muted); font-size: var(--text-sm); }
.module-dur { flex: none; color: var(--color-muted); font-size: var(--text-xs); white-space: nowrap; }

.instructor-card { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--space-sm); }
.instructor-card strong { display: block; font-size: var(--text-base); }
.instructor-card p { color: var(--color-muted); font-size: var(--text-sm); }

/* Ô tìm kiếm dạng nút (điều hướng sang màn search): icon nằm trong flex,
   KHÔNG dùng absolute như .search-wrap để tránh đè lên placeholder. */
.search-entry svg { position: static; transform: none; flex: none; }

.chat-inline { display: flex; flex-direction: column; gap: var(--space-2xs); }
.avatar--gold { background: oklch(86% 0.12 92); color: oklch(30% 0.05 80); }

/* ── Phase 4: skeleton, error/full state, search entry ── */
.skeleton {
  border-radius: var(--radius-card);
  background: linear-gradient(100deg, var(--color-paper-2) 30%, var(--color-paper-3) 50%, var(--color-paper-2) 70%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}
@keyframes skeleton-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.state-full {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  text-align: center;
  padding: var(--space-xl);
  color: var(--color-muted);
}
.state-full svg { color: var(--color-rule-2); }
.state-full h2 { color: var(--color-ink); }
.state-full .button { margin-top: var(--space-sm); }

.search-entry {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-xs) var(--space-sm);
  border: var(--rule-hair) solid var(--color-rule-2);
  border-radius: var(--radius-input);
  background: var(--color-surface);
  cursor: pointer;
  min-height: var(--control-min);
}
.search-entry svg { color: var(--color-muted); }
.search-placeholder { color: var(--color-muted); }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ── Lịch (calendar) & Library "Của tôi" ── */
.library-cal {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-card);
  background: var(--color-accent-soft);
  color: var(--color-ink);
  cursor: pointer;
  text-align: start;
}
.library-cal-icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: var(--radius-card); background: var(--color-surface); color: var(--color-accent-ink); }
.library-cal-copy strong { display: block; font-size: var(--text-base); }
.library-cal-copy p { color: var(--color-muted); font-size: var(--text-sm); }

.cal-views .tab { min-width: 0; }
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}
.cal-nav strong { font-family: var(--font-display); font-size: var(--text-base); }
.cal-today-btn { align-self: flex-start; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  padding: var(--space-xs);
}
.cal-dow { display: grid; place-items: center; padding-block: var(--space-3xs); color: var(--color-muted); font-size: var(--text-xs); font-weight: 700; }
.cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  aspect-ratio: 1;
  min-width: 0;
  border: 0;
  border-radius: var(--radius-input);
  background: none;
  color: var(--color-ink);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 700;
}
.cal-cell.is-empty { visibility: hidden; cursor: default; }
.cal-cell.is-today { color: var(--color-accent-ink); background: var(--color-accent-soft); }
.cal-cell.is-selected { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.cal-dot { width: 5px; height: 5px; border-radius: 999px; background: var(--color-accent-ink); }

/* Mini month (year view) */
.cal-year { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
.cal-mini { display: block; width: 100%; padding: var(--space-xs); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-surface); cursor: pointer; text-align: start; }
.cal-mini-title { display: block; margin-block-end: var(--space-3xs); font-family: var(--font-display); font-size: var(--text-sm); font-weight: 700; }
.cal-grid--mini { padding: 0; gap: 1px; }
.cal-grid--mini .cal-dow { font-size: 0.5rem; padding: 0; }
.cal-grid--mini .cal-cell { font-size: 0.5rem; font-weight: 400; border-radius: 4px; gap: 0; }
.cal-grid--mini .cal-cell.is-today { background: var(--color-accent-soft); }
.cal-grid--mini .cal-dot { width: 3px; height: 3px; }

/* Agenda list */
.cal-agenda { display: flex; flex-direction: column; gap: var(--space-2xs); }
.cal-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm);
  border: var(--rule-hair) solid var(--color-rule);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-input);
  background: var(--color-surface);
  color: var(--color-ink);
  cursor: pointer;
  text-align: start;
}
.cal-item--note { border-left-color: var(--color-muted); }
.cal-item--todo { border-left-color: oklch(70% 0.12 250); }
.cal-item--event { border-left-color: var(--color-accent); }
.cal-item-time { min-width: 3rem; color: var(--color-muted); font-size: var(--text-sm); font-weight: 700; }
.cal-item-body strong { display: block; font-size: var(--text-base); }
.cal-item-body p { color: var(--color-muted); font-size: var(--text-xs); }
.cal-item--todo.is-done .cal-item-body strong { color: var(--color-muted); text-decoration: line-through; }
.cal-item input[type="checkbox"] { width: 1.25rem; height: 1.25rem; accent-color: var(--color-accent); }

/* Week view */
.cal-week { display: flex; flex-direction: column; gap: var(--space-sm); }
.cal-week-day { display: flex; flex-direction: column; gap: var(--space-2xs); padding-block-end: var(--space-sm); border-block-end: var(--rule-hair) solid var(--color-rule); }
.cal-week-day:last-child { border-block-end: 0; }
.cal-week-head { border: 0; background: none; color: var(--color-ink); text-align: start; cursor: pointer; font-family: var(--font-display); }
.cal-week-day.is-today .cal-week-head { color: var(--color-accent-ink); }
.cal-week-empty { color: var(--color-muted); font-size: var(--text-sm); }

/* ── Ảnh minh họa (cover sự kiện/CLB/khóa học) ── */
.detail-banner {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--color-paper-3);
}
.detail-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }

.course-cover--img { overflow: hidden; padding: 0; }
.course-cover--img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Ảnh: avatar chân dung, thumbnail sự kiện/CLB, empty-state ── */
.avatar--img { overflow: hidden; padding: 0; }
.avatar--img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.event-thumb {
  display: block;
  width: 3.25rem;
  height: 3.25rem;
  min-width: 3.25rem;
  border-radius: var(--radius-input);
  overflow: hidden;
  background: var(--color-paper-3);
}
.event-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.club-monogram--img { overflow: hidden; padding: 0; }
.club-monogram--img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.empty-illus {
  display: block;
  width: 8rem;
  height: 8rem;
  margin: 0 auto var(--space-sm);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.empty-illus img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Avatar người gửi trong luồng chat */
.message-row { display: flex; align-items: flex-end; gap: var(--space-2xs); max-width: 88%; align-self: start; }
.message-row .message { max-width: 100%; }
.avatar--sm { width: 2rem; height: 2rem; min-width: 2rem; font-size: var(--text-xs); }

/* ── Ảnh cover cho hồ sơ ── */
.profile-cover--photo { position: relative; overflow: hidden; }
.profile-cover-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.profile-cover--photo::after {
  content: '';
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, oklch(22% 0.04 220 / 0.2) 0%, oklch(18% 0.04 220 / 0.68) 100%);
}
.profile-cover--photo > .avatar,
.profile-cover--photo > h1,
.profile-cover--photo > p { position: relative; z-index: 2; }
.profile-cover--photo h1 { color: #fff; }
.profile-cover--photo p { color: rgba(255, 255, 255, 0.88); }

/* ── Hero khám phá: ảnh nền + lớp phủ ── */
.hero-card--photo::after { display: none; } /* ẩn vòng trang trí khi có ảnh */
.hero-card-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.hero-card--photo::before {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, oklch(20% 0.04 220 / 0.15) 0%, oklch(14% 0.04 220 / 0.82) 100%);
}
.hero-card--photo > *:not(.hero-card-bg) { position: relative; z-index: 2; }
.hero-card--photo .eyeline,
.hero-card--photo h2 { color: #fff; }
.hero-card--photo .meta-pill { background: rgba(255, 255, 255, 0.92); color: var(--color-ink); border-color: transparent; }

/* ── Thẻ CLB: ảnh full nền + chữ trắng dưới đáy (hết khoảng trống) ── */
.club-card--photo {
  position: relative;
  display: block;
  min-height: 9.5rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--color-paper-3);
  box-shadow: var(--shadow-card);
}
.club-card-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.club-card--photo::after {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, oklch(20% 0.04 220 / 0.05) 35%, oklch(15% 0.04 220 / 0.8) 100%);
}
.club-card-body {
  position: absolute; z-index: 2; inset-inline: 0; inset-block-end: 0;
  display: flex; flex-direction: column; gap: 3px;
  padding: var(--space-sm);
  text-align: start;
}
.club-card--photo h3 { color: #fff; font-size: var(--text-base); line-height: 1.15; }
.club-card-body p { color: rgba(255, 255, 255, 0.88); font-size: var(--text-xs); }
.club-card-rating {
  display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; margin-block-start: 4px;
  padding: 2px 8px; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.92); color: var(--color-ink);
  font-size: var(--text-xs); font-weight: 700;
}
.club-card-badge {
  position: absolute; z-index: 2; inset-block-start: var(--space-2xs); inset-inline-end: var(--space-2xs);
  display: grid; place-items: center; width: 1.65rem; height: 1.65rem;
  border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.92); color: var(--color-accent-ink);
}
