:root{--cm-green:#14643e;--cm-green-hover:#0f5534} /* TASK 13:30: ONE brand green for /coach, /platform-account, /platform-profile, home, login */
.smart-header {
  --header-green: var(--cm-green);
  color: #0d2827;
  border-bottom-color: #e7ece9;
  position: relative;
  z-index: 10;
}

.smart-header .header-inner {
  min-height: 55px;
  max-width: 1320px;
  padding-inline: clamp(16px, 5.45vw, 72px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: clamp(12px, 2.5vw, 28px);
}

.smart-header .brand {
  width: max-content;
  max-width: 100%;
  font-size: var(--fs-page);
  letter-spacing: -.9px;
}

.smart-header .brand-icon {
  width: 28px;
  height: 30px;
  margin-right: 6px;
  background: none;
  color: var(--header-green);
}

.smart-header .brand-icon svg, .smart-header .brand-icon .cm-logo { width: 28px; height: 28px; }
.smart-header .header-nav { gap: clamp(24px, 4.35vw, 50px); font-size: var(--fs-meta); }
.smart-header .header-nav a { min-height: 53px; }
.smart-header .header-nav a[aria-current]::after { inset: auto 0 4px; height: 2px; background: var(--header-green); }
.smart-header .header-actions { justify-self: end; margin-left: 0; gap: 5px; }
.smart-header .header-role-controls { display: flex; align-items: center; gap: 12px; }

.smart-header .header-entry, .smart-header .header-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 15px;
  border: 1px solid var(--header-green);
  border-radius: 7px;
  color: #103326;
  background: white;
  white-space: nowrap;
  font: inherit;
  font-size: var(--fs-meta);
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.smart-header .header-entry:hover, .smart-header .header-avatar:hover { background: #edf6f0; }
.smart-header .header-register, .smart-header .header-destination {
  background: var(--header-green);
  color: white;
  min-height: 44px; /* TASK 04/12 10:28: nút mở menu "Đăng ký" đầu trang ≥44px (trước 36 ở 768/1280) */
  display: inline-flex;
  align-items: center;
}
.smart-header .header-register:hover, .smart-header .header-destination:hover { background: #0f5534; }
.smart-header .header-register::-webkit-details-marker, .smart-header .header-avatar::-webkit-details-marker { display: none; }
.smart-header .header-register::marker, .smart-header .header-avatar::marker { content: ''; }

.smart-header .header-avatar {
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 50%;
  border-color: #d2e1d5;
  background: #eaf4ed;
}
.smart-header .header-avatar svg { width: 21px; height: 21px; }
.smart-header .header-account-panel { z-index: 12; min-width: 208px; }
.smart-header .header-account-panel .header-pending { margin: 2px 8px; color: #435b50; }
.smart-header .header-role-switch { border-bottom: 1px solid #dce8df; margin-bottom: 4px; padding-bottom: 4px; }
.smart-header .header-role-switch button[aria-pressed='true'] { color: var(--header-green); background: #eaf4ed; font-weight: 800; }
.smart-header .header-account-loading { display: block; width: 190px; height: 34px; }
.smart-header .header-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (min-width: 741px) {
  .smart-header .header-nav { display: flex; transform: translateX(clamp(-45px, -4.4vw, -32px)); }
  .smart-header .header-login { min-width: 96px; }
  .smart-header .header-register { min-width: 100px; }
  .smart-header .header-menu-toggle, .smart-header .header-mobile:not([hidden]) { display: none; }
}

@media (max-width: 740px) {
  .smart-header .header-inner { grid-template-columns: minmax(0, 1fr) auto; }
  .smart-header .header-nav { display: none; }
  .smart-header .header-actions { gap: 4px; }
  .smart-header .header-role-controls { gap: 6px; }
  .smart-header .header-account-loading { width: 110px; }
  .smart-header .header-destination { display: none; }
  .smart-header .header-entry { min-height: 44px; padding-inline: 10px; }
  .smart-header .header-login, .smart-header .header-register { min-width: 84px; }
  .smart-header .header-avatar { min-width: 44px; min-height: 44px; }
  .smart-header .header-menu-toggle { display: grid; width: 44px; }
  .smart-header .header-mobile:not([hidden]) { display: grid; }
  .smart-header [data-header-register] { display: none; }
  .smart-header .header-mobile a { min-height: 44px; display: flex; align-items: center; font-size: var(--fs-body); }
}

@media (max-width: 430px) {
  .smart-header .header-inner { gap: 5px; padding-inline: 11px; }
  .smart-header .brand { font-size: var(--fs-section); }
  .smart-header .brand-icon { width: 22px; height: 24px; margin-right: 3px; }
  .smart-header .brand-icon svg, .smart-header .brand-icon .cm-logo { width: 22px; height: 22px; }
  .smart-header .header-entry { font-size: var(--fs-meta); padding-inline: 10px; }
  .smart-header .header-login, .smart-header .header-register { min-width: 76px; }
}

@media (max-width: 360px) {
  .smart-header .header-inner { padding-inline: 7px; gap: 4px; }
  .smart-header .brand { font-size: var(--fs-body); }
  .smart-header .brand-icon { width: 18px; height: 20px; }
  .smart-header .brand-icon svg, .smart-header .brand-icon .cm-logo { width: 18px; height: 18px; }
  .smart-header .header-actions, .smart-header .header-role-controls { gap: 3px; }
  .smart-header .header-entry { font-size: var(--fs-meta); padding-inline: 8px; }
  .smart-header .header-login, .smart-header .header-register { min-width: 67px; }
}

.smart-header .header-login[aria-busy='true'] { opacity: .75; }
@media (min-width: 741px) { .smart-header .header-mobile-register { display: none; } }
/* UI 19:59 A8: class rules (display:flex/grid) must not override [hidden] — signed-in users must not see sign-up links */
.smart-header [hidden], .smart-header .header-mobile a[hidden] { display: none !important; }
/* TASK 19:30 E4 — desktop header buttons ("Trang HLV", "Đăng nhập", "Đăng ký") follow the site's button set: 48px, radius 8, 16px / 650 */
@media (min-width: 700px) {
  .smart-header .header-entry:not(.header-avatar) { min-height: 48px; padding: 10px 18px; border-radius: 8px; font-size: var(--fs-body); font-weight: 600; }
}
/* TASK 09:25 — signed-in bar: the green button and the initials circle are the SAME height (44px), centred on one line, 8px clear of the
   top edge (bar 60px); the menu opens 8px under the circle, right edges flush. "Lớp của tôi" in the menu only when the green button is hidden. */
.smart-header .header-inner { min-height: 60px; }
.smart-header .header-account-loading { height: 44px; }
.smart-header .header-role-controls:not([data-header-state='guest']):not([data-header-state='checking']) .header-destination,
.smart-header .header-role-controls .header-avatar { box-sizing: border-box; height: 44px; min-height: 44px; padding-block: 0; }
.smart-header .header-role-controls .header-avatar { width: 44px; min-width: 44px; }
.smart-header .header-account-menu { position: relative; } /* 15:42: no display here — it overrode the phone rule hiding "Đăng ký" (09:25 regression) */
.smart-header .header-account-menu > .header-account-panel { right: 0; top: calc(100% + 8px); }
.smart-header .header-account-panel .header-menu-phone { display: none; }
@media (max-width: 740px) { .smart-header .header-account-panel .header-menu-phone { display: flex; } }
/* TASK 13:35 — phones, signed in: ONE header button (the initials circle); ☰ and its panel go away, their links are in the circle's menu.
   Signed out: ☰ unchanged. Wider than 740px: nothing changes (phone-only items hidden, coach's extra items shown). */
.smart-header .header-account-panel .header-menu-phone { display: none; }
@media (max-width: 740px) {
  .smart-header .header-account-panel .header-menu-phone { display: flex; }
  .smart-header .header-account-panel .header-menu-wide { display: none; }
  .smart-header[data-signed-in] .header-menu-toggle, .smart-header[data-signed-in] .header-mobile { display: none !important; }
  .smart-header .header-account-panel a, .smart-header .header-account-panel button { min-height: 44px; }
}
/* TASK 15:42 — phones, signed out: logo · "Đăng nhập" (outlined, 44px) · ☰. The green "Đăng ký" button is not on the bar (its two links are in
   the ☰ menu). Stronger than any later display rule. Signed in and >740px: unchanged. */
@media (max-width: 740px) {
  .smart-header .header-role-controls[data-header-state='guest'] .header-account-menu[data-header-register] { display: none; }
  .smart-header .header-role-controls[data-header-state='guest'] .header-login { box-sizing: border-box; height: 44px; min-height: 44px; padding-block: 0; }
}
