:root {
    --hh-bottom-nav-height: 76px;
    --hh-bottom-nav-safe: env(safe-area-inset-bottom, 0px);
}

body[data-hh-public-ui] > footer {
    padding-bottom: calc(var(--hh-bottom-nav-height) + var(--hh-bottom-nav-safe) + 28px);
}

.hh-bottom-nav {
    position: fixed;
    z-index: 260;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: calc(var(--hh-bottom-nav-height) + var(--hh-bottom-nav-safe));
    padding-bottom: var(--hh-bottom-nav-safe);
    border-top: 1px solid rgba(25, 92, 58, .18);
    background: rgba(250, 252, 249, .96);
    box-shadow: 0 -14px 38px rgba(20, 57, 36, .14);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    backdrop-filter: blur(18px) saturate(150%);
}

.hh-bottom-nav__inner {
    width: min(100%, 1180px);
    min-height: var(--hh-bottom-nav-height);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    padding: 0 16px;
}

.hh-bottom-nav__item {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 9px 7px 7px;
    color: #68756c;
    text-decoration: none;
    border-radius: 18px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: color .18s ease, background-color .18s ease, transform .18s ease;
}

.hh-bottom-nav__item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 3px;
    transform: translateX(-50%);
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, #ef8f37, #21794c);
    transition: width .18s ease;
}

.hh-bottom-nav__icon-wrap {
    position: relative;
    width: 34px;
    height: 29px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.hh-bottom-nav__icon {
    width: 23px;
    height: 23px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hh-bottom-nav__label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: "Prompt", "Noto Sans Thai", sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
}

.hh-bottom-nav__item:hover {
    color: #1b6e43;
    background: rgba(31, 122, 73, .06);
    transform: translateY(-1px);
}

.hh-bottom-nav__item:focus-visible {
    box-shadow: inset 0 0 0 3px rgba(35, 126, 78, .22);
}

.hh-bottom-nav__item[aria-current="page"] {
    color: #17663d;
}

.hh-bottom-nav__item[aria-current="page"]::before {
    width: 48px;
}

.hh-bottom-nav__item[aria-current="page"] .hh-bottom-nav__icon-wrap {
    background: linear-gradient(145deg, #e4f6eb, #fff7e8);
    box-shadow: 0 8px 18px rgba(31, 115, 70, .14);
    transform: translateY(-2px);
}

.hh-bottom-nav__live-dot {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 8px;
    height: 8px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #e5294f;
    box-sizing: content-box;
    box-shadow: 0 0 0 3px rgba(229, 41, 79, .12);
}

/* Placeholder hub pages */
.hh-hub-shell {
    min-height: 72vh;
    padding: 34px 0 52px;
    background:
        radial-gradient(circle at 12% 2%, rgba(38, 135, 83, .12), transparent 32%),
        radial-gradient(circle at 88% 10%, rgba(239, 143, 55, .12), transparent 30%),
        #f6f8f5;
}

.hh-hub-wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.hh-hub-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, .55fr);
    gap: 22px;
    align-items: stretch;
    margin-bottom: 22px;
}
.hh-hub-panel {
    border: 1px solid rgba(21, 89, 53, .12);
    border-radius: 28px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 18px 48px rgba(25, 71, 45, .08);
}
.hh-hub-copy { padding: clamp(24px, 4vw, 46px); }
.hh-hub-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 13px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #eaf6ef;
    color: #19623c;
    font-size: 12px;
    font-weight: 800;
}
.hh-hub-copy h1 {
    margin: 0 0 12px;
    color: #163d29;
    font: 800 clamp(30px, 4.4vw, 54px)/1.16 "Prompt", sans-serif;
}
.hh-hub-copy p { margin: 0; color: #5b6c61; font-size: 16px; line-height: 1.8; }
.hh-hub-status {
    min-height: 210px;
    display: grid;
    place-items: center;
    padding: 28px;
    text-align: center;
    color: #174b31;
    background: linear-gradient(145deg, #e8f7ee, #fff7e9);
}
.hh-hub-status__icon { font-size: 48px; line-height: 1; margin-bottom: 14px; }
.hh-hub-status b { display: block; font: 800 19px/1.35 "Prompt", sans-serif; }
.hh-hub-status span { display: block; margin-top: 7px; color: #66756b; font-size: 13px; line-height: 1.65; }
.hh-hub-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px;
    margin-bottom: 22px;
}
.hh-hub-search {
    flex: 1 1 300px;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border: 1px solid #dce7df;
    border-radius: 16px;
    background: #fff;
    color: #76847b;
}
.hh-hub-chip {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid #dbe7df;
    background: #fff;
    color: #52645a;
    font-size: 13px;
    font-weight: 700;
}
.hh-hub-chip.is-active { border-color: #2b7d50; background: #eaf6ef; color: #17633c; }
.hh-hub-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.hh-hub-card { padding: 20px; min-height: 190px; }
.hh-hub-card__media {
    height: 92px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    border-radius: 20px;
    background: linear-gradient(145deg, #edf7f1, #fff4e5);
    font-size: 34px;
}
.hh-hub-card h2 { margin: 0 0 8px; color: #203f2d; font: 800 18px/1.4 "Prompt", sans-serif; }
.hh-hub-card p { margin: 0; color: #718078; font-size: 13px; line-height: 1.7; }
.hh-hub-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 16px;
    padding: 0 18px;
    border-radius: 14px;
    background: #1d7045;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
}

@media (max-width: 820px) {
    .hh-hub-hero { grid-template-columns: 1fr; }
    .hh-hub-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
    :root { --hh-bottom-nav-height: 66px; }
    .hh-bottom-nav__inner { padding: 0 4px; }
    .hh-bottom-nav__item { gap: 2px; padding: 7px 3px 5px; border-radius: 13px; }
    .hh-bottom-nav__icon-wrap { width: 31px; height: 27px; }
    .hh-bottom-nav__icon { width: 21px; height: 21px; }
    .hh-bottom-nav__label { font-size: 9.5px; }
    .hh-bottom-nav__item[aria-current="page"]::before { width: 36px; }
    .hh-hub-shell { padding-top: 20px; }
    .hh-hub-wrap { width: min(100% - 20px, 1180px); }
    .hh-hub-panel { border-radius: 22px; }
    .hh-hub-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .hh-bottom-nav__item,
    .hh-bottom-nav__item::before,
    .hh-bottom-nav__icon-wrap { transition: none; }
}

@media print { .hh-bottom-nav { display: none !important; } }

/* v3: cached five-tab shell. Each page remains mounted until manual reload. */
.hh-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.hh-tab-stack,
.hh-tab-panel.is-active {
    display: contents;
}

.hh-tab-panel:not(.is-active) {
    display: none !important;
}

.hh-bottom-nav__progress {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    overflow: hidden;
    pointer-events: none;
}

.hh-bottom-nav__progress span {
    display: block;
    width: 34%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #ef8f37, #21794c);
    animation: hh-tab-progress 1s ease-in-out infinite;
}

.hh-bottom-nav.is-loading .hh-bottom-nav__item {
    opacity: .82;
}

.hh-tab-error {
    width: min(620px, calc(100% - 32px));
    min-height: 360px;
    margin: 42px auto 120px;
    padding: 48px 30px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    border: 1px solid rgba(25, 92, 58, .16);
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(20, 57, 36, .1);
}

.hh-tab-error__icon { font-size: 44px; }
.hh-tab-error h2 { margin: 14px 0 7px; color: #173e29; }
.hh-tab-error p { margin: 0; color: #68776d; }
.hh-tab-error button {
    min-height: 44px;
    margin-top: 20px;
    padding: 0 20px;
    border: 0;
    border-radius: 14px;
    background: #1d7045;
    color: #fff;
    font: 800 14px/1 "Prompt", sans-serif;
    cursor: pointer;
}

@keyframes hh-tab-progress {
    from { transform: translateX(-110%); }
    to { transform: translateX(310%); }
}

@media (prefers-reduced-motion: reduce) {
    .hh-bottom-nav__progress span { animation: none; width: 100%; }
}

/* v4: the navigation is part of the shared public layout and therefore stays
   visible on deeper pages. Root hubs still use the cached five-tab shell. */
body.hh-bottom-nav-visible {
    padding-bottom: calc(var(--hh-bottom-nav-height) + var(--hh-bottom-nav-safe));
}

body.hh-bottom-nav-visible > footer {
    margin-bottom: 0;
}

/* Avoid double spacing because older v3 already padded the public footer. */
body.hh-bottom-nav-visible[data-hh-public-ui] > footer {
    padding-bottom: 28px;
}

@media print {
    body.hh-bottom-nav-visible { padding-bottom: 0 !important; }
}
