.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.app-header .header-inner,
.app-header.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(100% - 32px, 1240px);
  min-height: 68px;
  margin: 0 auto;
}

.app-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  color: var(--text-main);
  text-decoration: none;
}

.app-header .brand-logo { width: 34px; height: 34px; }
.app-header .brand strong,
.app-header .brand small { display: block; }
.app-header .brand strong { font: 700 16px/1 sans-serif; letter-spacing: 0.04em; }
.app-header .brand small { margin-top: 3px; color: var(--text-muted); font: 600 8px/1 sans-serif; letter-spacing: 0.08em; }
.app-header nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.app-header nav > a,
.app-header .desktop-nav-more > summary { padding: 8px 9px; color: var(--text-muted); font: 600 13px/1 sans-serif; text-decoration: none; cursor: pointer; list-style: none; }
.app-header .desktop-nav-more { position: relative; }
.app-header .desktop-nav-more > summary::-webkit-details-marker { display: none; }
.app-header .desktop-nav-menu { position: absolute; top: calc(100% + 12px); right: 0; display: grid; min-width: 210px; padding: 8px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-surface); box-shadow: var(--shadow-card); }
.app-header .desktop-nav-menu a { padding: 10px; border-radius: 6px; color: var(--text-main); font: 600 13px/1.2 sans-serif; text-decoration: none; }
.app-header .desktop-nav-menu a:hover { background: var(--bg-app); }
.app-header .language-switch { display: flex; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 4px; }
.app-header .language-switch { display: none !important; }
.app-header .language-switch button { min-width: 34px; min-height: 30px; border: 0; border-right: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--brand-dark); font: 700 11px/1 sans-serif; cursor: pointer; }
.app-header .language-switch button:last-child { border-right: 0; }
.app-header .language-switch button[aria-pressed="true"] { color: #fff; background: var(--brand-dark); }
.app-header .line-sign-in { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 11px 0 5px; border: 1px solid #06a94f; border-radius: var(--radius-sm); background: #06a94f; color: #fff; font: 700 12px/1 sans-serif; text-decoration: none; cursor: pointer; }
.app-header .line-sign-in-mark { display: inline-grid; width: 26px; height: 26px; place-items: center; border-radius: 5px; background: #fff; color: #06a94f; font: 800 8px/1 sans-serif; letter-spacing: .02em; }
.app-header .beta-launch-badge { min-height: 26px; padding: 0 8px; border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--brand-dark); font: 700 10px/1 sans-serif; letter-spacing: 0.05em; cursor: pointer; }
.app-header .header-user { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; color: var(--text-main); font: 700 12px/1 sans-serif; text-decoration: none; }
.app-header .header-user-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.app-header .header-admin { display: inline-flex; align-items: center; min-height: 32px; padding: 0 8px; border: 1px solid var(--brand-primary); border-radius: var(--radius-sm); background: var(--brand-tint); color: var(--brand-dark); font: 700 11px/1 "Noto Sans Thai", sans-serif; text-decoration: none; }
.app-header .header-admin:hover, .app-header .header-admin:focus-visible { background: var(--brand-primary); color: #fff; }
.app-header .header-logout { display: inline-flex; align-items: center; min-height: 32px; margin-left: 4px; padding: 0 8px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: var(--text-muted); font: 700 11px/1 "Noto Sans Thai", sans-serif; text-decoration: none; }
.app-header .header-logout:hover, .app-header .header-logout:focus-visible { border-color: var(--brand-primary); color: var(--brand-primary); background: var(--brand-tint); }
.app-header .menu-button { display: none; }
.line-login-progress { position: fixed; z-index: 1000; inset: 0; display: grid; place-content: center; gap: 10px; padding: 24px; background: rgba(16, 34, 42, .5); color: #fff; opacity: 1; text-align: center; transition: opacity .18s ease; }
.line-login-progress.is-leaving { pointer-events: none; opacity: 0; }
.line-login-progress::before { position: absolute; inset: 0; content: ""; backdrop-filter: blur(2px); }
.line-login-progress > * { position: relative; }
.line-login-progress strong { font-size: 18px; }
.line-login-progress span:last-child { color: rgba(255, 255, 255, .86); font-size: 13px; }
.line-login-progress-spinner { width: 34px; height: 34px; justify-self: center; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: line-login-progress-spin .8s linear infinite; }
@keyframes line-login-progress-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .line-login-progress-spinner { animation: none; } }

[data-app-shell] .app-header .header-inner { width: min(100% - 32px, 1440px); }
[data-app-shell] .app-header .beta-launch-badge { display: none; }
[data-app-shell] .app-header .header-login,
[data-app-shell] .app-header .header-user { margin-left: auto; }
[data-app-shell] .app-header .header-user + .header-logout { margin-left: 4px; }

@media (max-width: 860px) {
  body.has-mobile-bottom-nav { --mobile-bottom-nav-height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: var(--mobile-bottom-nav-height); }
  .app-header .header-inner,
  .app-header.header-inner { width: min(100% - 24px, 720px); min-height: 58px; gap: 9px; }
  .app-header .brand-logo { width: 30px; height: 30px; }
  .app-header .brand strong { font-size: 14px; }
  .app-header .brand small { font-size: 7px; }
  .app-header nav,
  .app-header .beta-launch-badge { display: none; }
  .app-header .language-switch { margin-left: auto; }
  .app-header .menu-button { display: inline-grid; min-width: 42px; height: 34px; margin-left: auto; place-items: center; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--brand-dark); font: 700 11px/1 "Noto Sans Thai", sans-serif; cursor: pointer; }
  .app-header .mobile-nav-panel { position: fixed; z-index: 110; top: 58px; right: 0; bottom: calc(var(--mobile-bottom-nav-height) + 1px); left: auto; display: none !important; width: min(360px, calc(100% - 20px)); margin: 0; padding: 4px 16px 8px; overflow-y: auto; border: 1px solid var(--border-color); border-right: 0; border-radius: 14px 0 0 0; background: var(--bg-surface); box-shadow: -14px 10px 30px rgba(23, 43, 42, 0.18); }
  .app-header .mobile-nav-panel.is-open { display: block !important; }
  .app-header .mobile-nav-panel[hidden] { display: none !important; }
  .app-header .mobile-nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 4px; border-bottom: 1px solid var(--border-color); background: transparent; color: var(--text-main); font: 700 13px/1.2 sans-serif; text-decoration: none; }
  .app-header .mobile-nav-link svg { width: 20px; height: 20px; stroke-width: 1.8; }
  .app-header .mobile-nav-line-login { justify-content: center; gap: 8px; margin: 14px 0 4px; padding: 0 14px; border: 1px solid #06a94f; border-radius: var(--radius-sm); background: #06a94f; color: #fff; font-family: "Noto Sans Thai", sans-serif; }
  .app-header .mobile-nav-line-login .line-sign-in-mark { display: inline-grid; width: 24px; height: 24px; place-items: center; border-radius: 4px; background: #fff; color: #06a94f; font: 800 8px/1 sans-serif; }
  .app-header .mobile-nav-account { padding: 5px 0 12px; border-bottom: 1px solid var(--border-color); }
  .app-header .mobile-nav-profile { display: flex; align-items: center; gap: 10px; min-height: 50px; color: var(--text-main); font: 700 14px/1.2 sans-serif; text-decoration: none; }
  .app-header .mobile-nav-profile::after { margin-left: auto; color: var(--text-muted); content: ">"; }
  .app-header .mobile-nav-profile img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
  .mobile-bottom-nav { position: fixed; z-index: 120; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5, 1fr); min-height: 64px; padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--border-color); background: var(--bg-surface); box-shadow: 0 -7px 18px rgba(23, 43, 42, 0.09); }
  .mobile-bottom-nav-item { display: grid; min-width: 0; min-height: 64px; place-content: center; gap: 4px; padding: 6px 4px; border: 0; background: transparent; color: var(--text-muted); font: 700 10px/1 "Noto Sans Thai", sans-serif; text-align: center; text-decoration: none; cursor: pointer; }
  .mobile-bottom-nav-item svg { width: 20px; height: 20px; margin: 0 auto; stroke-width: 1.9; }
  .mobile-bottom-nav-item[aria-current="page"] { color: var(--brand-dark); }
  .mobile-bottom-nav-primary { color: var(--brand-dark); }
  .mobile-bottom-nav-primary svg { width: 28px; height: 28px; padding: 5px; border-radius: 50%; background: var(--brand-primary); color: #fff; }

  [data-app-shell] .app-header .header-inner { width: min(100% - 24px, 720px); }
  [data-app-shell] .app-header .header-user,
  [data-app-shell] .app-header .header-login,
  [data-app-shell] .app-header .header-admin,
  [data-app-shell] .app-header .header-logout { display: none; }
}

@media (min-width: 861px) {
  .mobile-bottom-nav { display: none !important; }
}
