/* Approved portal visual layer. Loaded after each page's own CSS.
   Does not rename ids or change which controls exist. */

:root {
    --nihao-side: 252px;
    --nihao-bg: #f6f5f2;
    --nihao-ink: #1c2b2e;
    --nihao-muted: #5c6d71;
    --nihao-line: rgba(28, 43, 46, .12);
    --nihao-accent: #1f6f64;
    --nihao-radius: 12px;
    --nihao-shadow: 0 1px 2px rgba(28, 43, 46, .05);
    --nihao-mint: #f3f1ea;
    --nihao-mint-50: #f7f6f3;
}

body {
    background: var(--nihao-bg);
    color: var(--nihao-ink);
}

.card,
.login-card,
.auth-card,
#loginBlock,
.sec-card,
.container {
    border-radius: 16px;
    border-color: var(--nihao-line);
    box-shadow: 0 1px 2px rgba(0, 41, 51, .05), 0 10px 30px -18px rgba(0, 41, 51, .18);
}

.button,
.btn,
button.btn-primary,
.primary {
    border-radius: 999px;
}

.eyebrow,
.kicker {
    color: #1f6f64;
    letter-spacing: .14em;
}

h1, h2, .page-title {
    font-family: 'Noto Serif HK', 'Noto Serif TC', 'PingFang TC', serif;
}

/* Student / partner cards stay light — same white card as the homepage */
.student-id-card,
.partner-card {
    background: #fff !important;
    color: var(--nihao-ink);
    border: 1px solid var(--nihao-line);
    border-radius: var(--nihao-radius);
    box-shadow: var(--nihao-shadow);
}

/* ---------- Desktop sidebar (client + teacher) ---------- */
@media (min-width: 1080px) {
    body.nihao-sidebar.has-portal-header {
        padding-top: 0 !important;
        background: var(--nihao-bg);
    }
    body.nihao-sidebar .portal-site-header {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 40;
        display: flex;
        flex-direction: column;
        width: var(--nihao-side);
        height: 100vh;
        overflow: auto;
        background: #fff;
        border-right: 1px solid var(--nihao-line);
        box-shadow: none;
    }
    body.nihao-sidebar .portal-nav-wrap,
    body.nihao-sidebar .portal-identity {
        background: transparent;
        border: 0;
    }
    body.nihao-sidebar .portal-nav {
        width: auto;
        margin: 0;
        padding: 18px 16px 6px;
    }
    body.nihao-sidebar .portal-nav-brand img { height: 32px; }
    body.nihao-sidebar .portal-nav-actions {
        display: none;
    }
    body.nihao-sidebar .portal-identity-wrap,
    body.nihao-sidebar .portal-identity .brand {
        width: auto;
        margin: 0;
        padding: 4px 14px 8px;
        border: 0;
    }
    body.nihao-sidebar .student-id-card {
        border-radius: 12px;
        box-shadow: none;
    }
    body.nihao-sidebar .student-id-head { display: none; }
    body.nihao-sidebar .student-id-stripe { display: none; }
    body.nihao-sidebar .student-id-body {
        grid-template-columns: 40px minmax(0, 1fr);
        gap: 10px;
        padding: 10px;
    }
    body.nihao-sidebar .student-id-photo-btn,
    body.nihao-sidebar .student-id-photo {
        position: relative;
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        flex-basis: 40px;
        font-size: .95rem;
    }
    body.nihao-sidebar .student-id-copy { min-width: 0; }
    body.nihao-sidebar .student-id-copy h1 {
        overflow: hidden;
        max-width: 100%;
        margin: 0;
        font-family: inherit;
        font-size: 14px;
        font-weight: 800;
        line-height: 1.25;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    body.nihao-sidebar .student-id-meta { font-size: 12px; }
    body.nihao-sidebar .student-id-panda { display: none; }
    body.nihao-sidebar .student-id-photo img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    body.nihao-sidebar .student-id-photo img.is-panda { object-fit: contain; background: #fff; }
    body.nihao-sidebar .photo-edit-badge { display: none; }
    body.nihao-sidebar .client-tabs,
    body.nihao-sidebar #teacherTabs,
    body.nihao-sidebar .teacher-tabs {
        display: grid !important;
        gap: 0;
        align-content: start;
        margin: 8px 10px 12px;
        padding: 0;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }
    body.nihao-sidebar .client-tab-group,
    body.nihao-sidebar .teacher-tab-group {
        display: grid;
        gap: 4px;
        min-width: 0;
        position: relative;
    }
    body.teacher-onboarding.nihao-sidebar #teacherTabs,
    body.teacher-onboarding.nihao-sidebar .teacher-tabs,
    body.teacher-onboarding.nihao-sidebar .teacher-tab-group,
    body.teacher-onboarding.nihao-sidebar .teacher-nav-bar { display: none !important; }
    body.nihao-sidebar .client-tab-group + .client-tab-group,
    body.nihao-sidebar .teacher-tab-group + .teacher-tab-group {
        margin-top: 16px;
    }
    body.nihao-sidebar .client-tab-group + .client-tab-group::before,
    body.nihao-sidebar .teacher-tab-group + .teacher-tab-group::before {
        content: "";
        position: absolute;
        left: 12px;
        right: 12px;
        top: -9px;
        height: 1px;
        background: rgba(28, 43, 46, .16);
    }
    body.nihao-sidebar .client-tab-group-actions,
    body.nihao-sidebar .teacher-tab-group-actions {
        display: grid;
        gap: 2px;
        min-width: 0;
    }
    body.nihao-sidebar .client-tab-group-label,
    body.nihao-sidebar .teacher-tab-group-label {
        display: block;
        position: relative;
        margin: 0 0 4px;
        padding: 2px 12px 6px;
        color: #1c2b2e;
        font-family: var(--display), "Noto Serif HK", "Noto Serif TC", serif;
        font-size: 16px;
        font-weight: 700;
        letter-spacing: .01em;
        line-height: 1.3;
        text-align: left;
        white-space: nowrap;
    }
    body.nihao-sidebar .client-tab-group-label::before,
    body.nihao-sidebar .teacher-tab-group-label::before {
        content: "";
        position: absolute;
        left: 0;
        top: 50%;
        width: 3px;
        height: 16px;
        border-radius: 2px;
        background: #1f6f64;
        transform: translateY(-50%);
    }
    body.nihao-sidebar .client-tab,
    body.nihao-sidebar .teacher-tab {
        width: 100%;
        min-height: 38px;
        padding: 8px 12px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--nihao-muted);
        font-size: 14.5px;
        font-weight: 600;
        text-align: left;
        white-space: normal;
        box-shadow: none;
    }
    body.nihao-sidebar .client-tab:hover,
    body.nihao-sidebar .teacher-tab:hover { background: var(--nihao-mint-50); color: var(--nihao-ink); }
    body.nihao-sidebar .client-tab.active,
    body.nihao-sidebar .teacher-tab.active {
        background: #f3f1ea;
        background-color: #f3f1ea;
        color: var(--nihao-ink);
        border-color: transparent;
        box-shadow: none;
    }
    body.nihao-sidebar .shell,
    body.nihao-sidebar main.shell {
        width: auto;
        max-width: none;
        margin: 0 0 0 var(--nihao-side);
        padding: 28px 148px 140px 32px;
    }
    body.nihao-sidebar .notification-bell,
    body.nihao-sidebar #logoutButton,
    body.nihao-sidebar #teacherLogoutButton {
        position: static;
    }
}

/* Top actions stay reachable: lang, bell and logout float in the content corner */
@media (min-width: 1080px) {
    body.nihao-sidebar .portal-nav-actions {
        display: flex;
        align-items: center;
        gap: 12px;
        position: fixed;
        top: 16px;
        right: 28px;
        z-index: 45;
        padding: 0;
        background: transparent;
        isolation: isolate;
    }
    body.nihao-sidebar .portal-nav-actions .portal-lang-btn,
    body.nihao-sidebar .portal-nav-actions .notification-bell,
    body.nihao-sidebar .portal-nav-actions #logoutButton,
    body.nihao-sidebar .portal-nav-actions #teacherLogoutButton {
        box-sizing: border-box;
        height: 40px;
        min-height: 40px;
        margin: 0;
    }
    body.nihao-sidebar .portal-nav-actions .portal-lang-btn {
        width: auto;
        min-width: 40px;
        padding: 0 10px;
    }
    body.nihao-sidebar .portal-nav-actions .notification-bell {
        width: 40px;
        min-width: 40px;
        padding: 0;
    }
    body.nihao-sidebar .portal-nav-menu { display: none; }
}

#logoutButton.portal-nav-btn,
#teacherLogoutButton.portal-nav-btn {
    box-sizing: border-box;
    height: 40px;
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 12px;
    background: var(--mint, #83D7CA);
    color: #002933;
    font-size: .78rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}
#logoutButton.portal-nav-btn:hover,
#logoutButton.portal-nav-btn:focus-visible,
#teacherLogoutButton.portal-nav-btn:hover,
#teacherLogoutButton.portal-nav-btn:focus-visible {
    background: #6ac9ba;
    color: #002933;
}

/* Chip row / hamburger: keep every tab, hide section labels until the desktop rail. */
.client-tab-group,
.teacher-tab-group,
.client-tab-group-actions,
.teacher-tab-group-actions {
    display: contents;
}
.client-tab-group-label,
.teacher-tab-group-label {
    display: none;
}
.portal-nav-group {
    display: grid;
    align-content: start;
    min-width: 0;
    position: relative;
}
.portal-nav-group + .portal-nav-group { margin-top: 16px; }
.portal-nav-group + .portal-nav-group::before {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    top: -9px;
    height: 1px;
    background: rgba(28, 43, 46, .16);
}
.portal-nav-group-label {
    display: block;
    position: relative;
    margin: 0;
    padding: 2px 12px 4px;
    color: #1c2b2e;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1.25;
    text-align: left;
    white-space: nowrap;
}
.portal-nav-group-label::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: #1f6f64;
    transform: translateY(-50%);
}

/* ---------- Mobile bottom nav + help clearance ---------- */
@media (max-width: 900px) {
    .whatsapp,
    .nihao-help-launcher,
    .chat-launcher,
    body.nihao-sidebar .chat-launcher {
        right: 14px !important;
        bottom: calc(78px + env(safe-area-inset-bottom)) !important;
        z-index: 45;
    }
    body.has-portal-header .whatsapp-float {
        bottom: calc(14px + env(safe-area-inset-bottom)) !important;
        z-index: 70;
    }
    html.nihao-single-float body.has-portal-header .back-to-top {
        right: 14px;
        bottom: calc(78px + env(safe-area-inset-bottom)) !important;
        z-index: 71;
    }
    .shell,
    body.has-portal-header .shell,
    #adminContent,
    body > .container {
        padding-bottom: calc(88px + env(safe-area-inset-bottom)) !important;
    }
}
@media (max-width: 600px) {
    .whatsapp {
        display: inline-flex !important;
    }
    .mobile-bottom-nav,
    .admin-mobile-nav {
        background: rgba(255, 255, 255, .96);
        border-top: 1px solid var(--nihao-line);
        box-shadow: none;
    }
    .mobile-bottom-nav button.active,
    .admin-mobile-nav button.active {
        background: transparent;
        color: var(--nihao-ink);
    }
    .mobile-bottom-nav button.active .mobile-nav-icon,
    .admin-mobile-nav button.active .mobile-nav-icon {
        background: var(--nihao-mint);
        color: var(--nihao-accent);
    }
}

/* ---------- Candidate application ---------- */
body > .container {
    background: transparent;
    border: 0;
    box-shadow: none;
}
.progress-bar .step.active .step-circle,
.step.active .step-circle {
    background: var(--nihao-ink);
    border-color: var(--nihao-ink);
    color: #fff;
}
.progress-line-fill { background: var(--nihao-accent); }
.auth-card,
.form-section,
#stage1InterviewSection,
#stage2OnboardingSection,
#contractSection,
#statusNoticeCard {
    background: #fff;
    border: 1px solid var(--nihao-line);
    border-radius: 16px;
}
button, input, select, textarea { font-family: 'Noto Sans HK', 'PingFang TC', sans-serif; }
button.btn-primary:not([style*="background"]) {
    background: var(--mint, #83D7CA);
    color: #002933;
    border-radius: 999px;
}
button.btn-primary:not([style*="background"]):hover { background: #6ac9ba; color: #002933; }
.progress-container {
    padding: 22px 18px 16px;
    border: 1px solid var(--nihao-line);
    border-radius: 16px;
    background: #fff;
}
#studentsPanel .panel-hero,
#whatsappPanel .panel-hero,
#revenuePanel .panel-hero,
.course-panel-shell .panel-hero,
.panel-hero {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--nihao-line) !important;
    border-radius: var(--nihao-radius);
    background: #fff !important;
    color: var(--nihao-ink) !important;
    box-shadow: var(--nihao-shadow);
}
#studentsPanel .panel-hero h2,
#studentsPanel .panel-hero p,
#whatsappPanel .panel-hero h2,
#whatsappPanel .panel-hero p,
#revenuePanel .panel-hero h2,
#revenuePanel .panel-hero p,
.course-panel-shell .panel-hero h2,
.course-panel-shell .panel-hero p,
.panel-hero h2,
.panel-hero p { color: var(--nihao-ink) !important; opacity: 1; }
#studentsPanel .panel-eyebrow,
#whatsappPanel .panel-eyebrow,
#revenuePanel .panel-eyebrow,
.course-panel-shell .panel-eyebrow,
.panel-eyebrow { color: var(--nihao-accent) !important; }
#studentsPanel .teacher-mark,
#whatsappPanel .teacher-mark,
#revenuePanel .teacher-mark,
.course-panel-shell .teacher-mark,
.panel-hero .teacher-mark {
    background: #f3f1ea !important;
    color: var(--nihao-ink) !important;
}
.checkbox-group label,
.radio-group label {
    border-radius: 999px;
    background: #fff;
}
#candidatePublicHeader .header,
.header#candidatePublicHeader {
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--nihao-line);
}

/* ---------- Admin desktop sidebar ---------- */
@media (min-width: 1100px) {
    body.admin-ready {
        padding: 0 !important;
        background: var(--nihao-bg);
    }
    body.admin-ready #adminContent.page-shell {
        display: grid;
        grid-template-columns: 260px minmax(0, 1fr);
        align-items: start;
        width: 100%;
        max-width: none;
        min-height: 100vh;
        min-height: 100dvh;
    }
    body.admin-ready .admin-sticky-chrome {
        position: sticky;
        top: 0;
        z-index: 30;
        grid-column: 1;
        grid-row: 1 / span 80;
        align-self: start;
        box-sizing: border-box;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        margin: 0;
        padding: 0 12px 24px;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        background: #fff;
        border-right: 1px solid var(--nihao-line);
    }
    body.admin-ready #adminContent > :not(.admin-sticky-chrome) {
        grid-column: 2;
        min-width: 0;
        margin-left: 0;
        margin-right: 0;
    }
    body.admin-ready .header {
        position: sticky;
        top: 0;
        z-index: 2;
        display: flex;
        flex-direction: row;
        align-items: center;
        box-sizing: border-box;
        width: auto;
        height: 56px;
        min-height: 56px;
        margin: 0 -12px 0;
        padding: 0 12px 0 22px;
        gap: 0;
        background: #fff;
        border-bottom: 1px solid rgba(28, 43, 46, .12);
    }
    body.admin-ready .header::after { display: none; }
    body.admin-ready .brand {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-width: 0;
    }
    body.admin-ready .brand-divider { display: none; }
    body.admin-ready .brand-logo {
        width: auto;
        height: 44px;
        max-width: 148px;
        object-fit: contain;
        object-position: left center;
    }
    body.admin-ready .admin-title-full,
    body.admin-ready .admin-mobile-title { display: none; }
    body.admin-ready .header h1 {
        margin: 0;
        color: #5c6d71;
        font-size: .78rem;
        font-weight: 600;
        line-height: 1.2;
        letter-spacing: .01em;
        white-space: nowrap;
    }
    body.admin-ready .admin-tabs {
        display: grid;
        gap: 0;
        margin: 0;
        padding: 12px 0 0;
        border: 0;
        overflow: visible;
    }
    body.admin-ready .admin-tab-group,
    body.admin-ready .admin-people-cluster,
    body.admin-ready .admin-people-split {
        display: grid;
        gap: 4px;
        width: 100%;
        min-width: 0;
        padding: 0;
        border: 0;
        position: relative;
    }
    body.admin-ready .admin-people-split { gap: 0; }
    body.admin-ready .admin-tab-group + .admin-tab-group,
    body.admin-ready .admin-people-cluster,
    body.admin-ready .admin-people-cluster + .admin-tab-group,
    body.admin-ready .admin-people-split,
    body.admin-ready .admin-people-split > .admin-tab-group + .admin-tab-group {
        margin-top: 16px;
    }
    body.admin-ready .admin-tab-group + .admin-tab-group::before,
    body.admin-ready .admin-people-cluster::before,
    body.admin-ready .admin-people-cluster + .admin-tab-group::before,
    body.admin-ready .admin-people-split::before,
    body.admin-ready .admin-people-split > .admin-tab-group + .admin-tab-group::before {
        content: "";
        position: absolute;
        left: 10px;
        right: 10px;
        top: -9px;
        height: 1px;
        background: rgba(28, 43, 46, .16);
    }
    body.admin-ready .admin-people-split > .admin-tab-group[data-admin-group="students"] {
        margin: 0;
        padding: 0;
        border: 0;
    }
    body.admin-ready .admin-tab-group-label {
        display: block;
        position: relative;
        margin: 0;
        padding: 2px 10px 4px;
        color: #1c2b2e;
        font-size: 13px;
        font-weight: 700;
        letter-spacing: .04em;
        line-height: 1.25;
        text-align: left;
        text-transform: none;
        white-space: nowrap;
    }
    body.admin-ready .admin-tab-group-label::before {
        content: "";
        position: absolute;
        left: 0;
        top: 50%;
        width: 3px;
        height: 14px;
        border-radius: 2px;
        background: #1f6f64;
        transform: translateY(-50%);
    }
    body.admin-ready #adminSetupPrompt.admin-setup-prompt {
        grid-column: 2;
        grid-row: 1;
        align-self: start;
        position: static;
        height: auto;
        max-height: none;
        margin: 64px 0 18px;
    }
    body.admin-ready .admin-tab {
        display: flex;
        width: 100%;
        min-height: 34px;
        padding: 6px 10px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--nihao-muted);
        font-weight: 600;
        text-align: left;
        white-space: normal;
    }
    body.admin-ready .admin-tab.active,
    body.admin-ready .admin-tab-group[data-admin-group="students"] .admin-tab.active,
    body.admin-ready .admin-tab-group[data-admin-group="students"] .admin-tab.active:hover {
        background: var(--nihao-mint);
        color: var(--nihao-ink);
        border-color: transparent;
    }
    body.admin-ready .admin-tab-group[data-admin-group="students"] .admin-tab.active .admin-tab-count {
        background: #fff;
        color: var(--nihao-ink);
    }
    body.admin-ready .admin-sticky-chrome {
        overflow-x: hidden;
        overflow-y: auto;
    }
    body.admin-ready .admin-tab-group[data-admin-group="students"] .admin-tab-group-actions,
    body.admin-ready .student-status-list,
    body.admin-ready .student-status-nest,
    body.admin-ready .student-status-children {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    body.admin-ready .admin-tab-group[data-admin-group="students"] .admin-tab-group-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        overflow: visible;
    }
    body.admin-ready .student-status-list {
        overflow: visible;
    }
    body.admin-ready .admin-tab-group[data-admin-group="students"] .admin-tab {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        white-space: normal;
        box-sizing: border-box;
    }
    body.admin-ready #adminContent .tab-panel,
    body.admin-ready #adminContent .card {
        margin-left: 0;
        margin-right: 0;
    }
    body.admin-ready #adminContent > :not(.admin-sticky-chrome) {
        padding-left: 28px;
        padding-right: 28px;
    }
    body.admin-ready .admin-header-actions {
        position: static;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    body.admin-ready .admin-notice-bell,
    body.admin-ready .admin-refresh-btn {
        box-sizing: border-box;
        height: 44px;
        min-height: 44px;
    }
    body.admin-ready .admin-notice-bell {
        flex: 0 0 44px;
        width: 44px;
        overflow: visible;
    }
    body.admin-ready .admin-refresh-btn {
        position: relative;
        z-index: 2;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 16px;
    }
}

/* Tablet / narrow admin: one chip row plus the group bar, same idea as client and teacher.
   The desktop rail starts at 1100px; without this, 821–1099px stacks every group full width. */
@media (min-width: 821px) and (max-width: 1099px) {
    body.admin-ready {
        padding-bottom: calc(96px + env(safe-area-inset-bottom));
    }
    body.admin-ready #adminContent.page-shell {
        display: block;
        width: min(1200px, 100%);
    }
    body.admin-ready .admin-sticky-chrome {
        position: sticky;
        top: 0;
        z-index: 40;
        height: auto;
        max-height: none;
        margin: 0 0 12px;
        padding: 0;
        overflow: visible;
        background: var(--nihao-bg, #f6f5f2);
        border-right: 0;
    }
    body.admin-ready .admin-tabs {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0;
        width: auto;
        max-width: 100%;
        margin: 0;
        padding: 8px 0 10px;
        overflow-x: auto;
        border: 0;
        border-bottom: 1px solid rgba(28, 43, 46, .12);
        scrollbar-width: none;
    }
    body.admin-ready .admin-tabs::-webkit-scrollbar { display: none; }
    body.admin-ready .admin-people-cluster,
    body.admin-ready .admin-people-split { display: contents; }
    body.admin-ready .admin-tab-group {
        display: none;
        width: auto;
        min-width: 0;
        margin: 0;
        padding: 0;
        border: 0;
    }
    body.admin-ready .admin-tab-group.is-mobile-active {
        display: flex;
        align-items: center;
        width: max-content;
    }
    body.admin-ready .admin-tab-group-label { display: none; }
    body.admin-ready .admin-tab-group-actions {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        align-items: center;
        min-width: 0;
    }
    body.admin-ready .admin-tab {
        display: inline-flex;
        width: auto;
        min-height: 38px;
        padding: 8px 13px;
        border: 1px solid #d7ecee;
        border-radius: 999px;
        background: #fff;
        color: var(--nihao-muted);
        font-weight: 800;
        white-space: nowrap;
        text-align: center;
    }
    body.admin-ready .admin-tab.active {
        background: #e1f7f3;
        color: var(--nihao-ink);
        border-color: #83d7ca;
    }
    body.admin-ready #adminSetupPrompt.admin-setup-prompt {
        position: static;
        clear: both;
        width: auto;
        max-width: 100%;
        margin: 0 0 18px;
    }
    body.admin-ready .admin-mobile-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 80;
        display: grid !important;
        grid-template-columns: repeat(8, minmax(0, 1fr));
        gap: 2px;
        padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
        border: 1px solid rgba(18, 107, 104, .16);
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
        border-radius: 18px 18px 0 0;
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 -10px 28px -18px rgba(0, 41, 51, .5);
    }
    body.admin-sheet-open .admin-mobile-nav { display: none !important; }
    body.admin-ready .admin-mobile-nav button {
        display: grid;
        justify-items: center;
        gap: 3px;
        min-width: 0;
        min-height: 54px;
        padding: 6px 2px 5px;
        border: 0;
        border-radius: 12px;
        background: transparent;
        color: var(--nihao-muted);
        font-size: .72rem;
        font-weight: 800;
        cursor: pointer;
    }
    body.admin-ready .admin-mobile-nav button.active {
        background: #e8f7f5;
        color: var(--nihao-ink);
    }
    body.admin-ready .admin-mobile-nav button > span:not(.mobile-nav-icon) {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        line-height: 1.15;
    }
    body.admin-ready .admin-mobile-nav button[data-admin-group="company"] > span:not(.mobile-nav-icon) {
        white-space: normal;
        text-align: center;
        line-height: 1.05;
    }
    body.admin-ready .admin-mobile-nav .mobile-nav-icon {
        display: grid;
        place-items: center;
        width: 28px;
        height: 28px;
        border-radius: 10px;
        background: #e8f7f5;
        color: var(--nihao-accent);
        font-size: .78rem;
        font-weight: 800;
    }
    body.admin-ready .admin-chat-fab {
        bottom: calc(84px + env(safe-area-inset-bottom));
    }
    body.admin-ready .admin-refresh-full { display: none; }
    body.admin-ready .admin-refresh-short { display: inline; }
    body.admin-ready .admin-header-actions {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    body.admin-ready .admin-notice-bell,
    body.admin-ready .admin-refresh-btn {
        box-sizing: border-box;
        width: 44px;
        min-width: 44px;
        height: 44px;
        min-height: 44px;
        padding: 0;
    }
    body.admin-ready .admin-notice-bell { overflow: visible; }
    body.admin-ready .admin-tab-group[data-admin-group="students"].is-mobile-active {
        width: 100%;
        min-width: 0;
    }
    body.admin-ready .admin-tab-group[data-admin-group="students"] .admin-tab-group-actions,
    body.admin-ready .student-status-list {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
        max-width: 100%;
        overflow: visible;
    }
    body.admin-ready .student-status-list .admin-tab,
    body.admin-ready .student-status-children .admin-tab {
        display: flex;
        justify-content: flex-start;
        width: 100%;
        border-radius: 8px;
        text-align: left;
        white-space: normal;
    }
}

#adminSetupPrompt.admin-setup-prompt {
    position: static;
    inset: auto;
    width: auto;
    max-width: 100%;
}

/* Client, teacher, candidate, and admin share the same bell and count. */
.admin-notice-bell,
.notification-bell {
    position: relative;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    overflow: visible;
    color: var(--nihao-ink, var(--ink, #1c2b2e));
}
.admin-notice-bell .i {
    display: none;
}
.admin-notice-bell .nihao-bell-icon,
.notification-bell .nihao-bell-icon {
    display: block;
    width: 20px;
    height: 20px;
}
.admin-notice-badge,
.notification-badge,
.portal-nav-btn .notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    z-index: 2;
    display: grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--secondary, #FD7899);
    color: #fff;
    font-size: .65rem;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 0 0 2px #fff;
}
.admin-notice-badge[hidden],
.notification-badge[hidden] {
    display: none !important;
}

/* Logged-in pages: one left edge, even control size, no stray last lines. */
body.admin-ready #adminContent .panel-hero,
body.admin-ready #adminContent .card,
body.admin-ready #adminContent .editor-card,
body.admin-ready #adminContent .admin-ops-rules,
body.admin-ready #adminContent .overview-card,
body.nihao-sidebar .portal-section,
body.nihao-sidebar .card {
    text-align: left;
}
body.admin-ready #adminContent h2,
body.admin-ready #adminContent h3,
body.admin-ready #adminContent .summary,
body.admin-ready #adminContent .panel-hero p,
body.admin-ready #adminContent .admin-ops-rules li,
body.nihao-sidebar .shell h2,
body.nihao-sidebar .shell h3,
body.nihao-sidebar .shell p,
body.nihao-sidebar .shell li {
    text-wrap: pretty;
}
body.admin-ready #adminContent .management-panel > .card,
body.admin-ready #adminContent .management-panel > .editor-card,
body.admin-ready #adminContent .management-panel > section.card {
    margin-top: 16px;
}

/* KPI / stat cards stay light */
.overview-card,
.stat,
.kpi,
.card.stat {
    background: #fff;
    color: var(--nihao-ink);
}

/* Help buttons match the approved green pill and stay off the text */
.whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: #1f9d55;
    color: #fff;
    font-weight: 800;
    box-shadow: 0 24px 48px -20px rgba(0, 41, 51, .35);
}
.whatsapp:hover { background: #168456; }

@media (min-width: 901px) {
    .whatsapp,
    .chat-launcher,
    body.nihao-sidebar .chat-launcher {
        right: 28px;
        bottom: 28px;
    }
}
@media (min-width: 901px) and (max-width: 1079px) {
    .shell,
    main.shell {
        padding-right: 150px;
        padding-bottom: 120px;
    }
}

/* ---------- Logged-in surfaces: same tokens as the homepage ----------
   Class-level only. New admin tabs that use .card, .tab-panel, .panel-hero,
   .btn, table, or form controls inherit this without markup changes. */

h1, h2, h3, h4,
.page-title {
    font-family: "Noto Serif HK", "Noto Serif TC", "PingFang TC", serif;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--nihao-ink);
    text-wrap: balance;
}

p, li, .summary, blockquote {
    text-wrap: pretty;
}

#portalView h1,
#portalView h2,
#portalView h3,
#adminContent h1,
#adminContent h2,
#adminContent h3,
.modal-card h3,
.review-dialog h2 {
    max-width: none;
}

.card,
.sec-card,
.portal-section,
.tab-panel,
.login-card,
.auth-card,
.form-section,
#loginBlock,
#loginView,
.modal-card,
.review-dialog,
.teacher-settings-modal,
.birthday-gift-dialog,
.overview-card,
.management-panel,
.data-list,
.page-block,
.settings-pref-card,
.learning-pref-card,
.onboard-card,
.booking-notes,
.club-membership,
.receipt-card {
    background: #fff;
    color: var(--nihao-ink);
    border-color: var(--nihao-line);
    border-radius: var(--nihao-radius);
    box-shadow: var(--nihao-shadow);
}

#loginBlock {
    background: #fff !important;
    color: var(--nihao-ink) !important;
    border: 1px solid var(--nihao-line) !important;
    border-radius: var(--nihao-radius) !important;
    box-shadow: var(--nihao-shadow) !important;
    text-align: left !important;
}

#loginBlock h2,
#loginView h2,
.login-card h2,
.auth-card h2 {
    color: var(--nihao-ink) !important;
    text-align: left;
}

.button:not(.secondary):not([style*="background"]),
a.button:not(.secondary):not([style*="background"]),
button.primary:not([style*="background"]):not(#teacherOnboardNext):not(#teacherOnboardNotify),
.primary:not([style*="background"]):not(#teacherOnboardNext):not(#teacherOnboardNotify),
.btn:not(.secondary):not([style*="background"]),
button.btn:not(.secondary):not([style*="background"]),
.button.join {
    background: var(--mint, #83D7CA) !important;
    color: #002933 !important;
    border-radius: 999px !important;
    border-color: var(--mint, #83D7CA);
}

.button:not(.secondary):not([style*="background"]):hover,
button.primary:not([style*="background"]):not(#teacherOnboardNext):not(#teacherOnboardNotify):hover,
.primary:not([style*="background"]):not(#teacherOnboardNext):not(#teacherOnboardNotify):hover,
.btn:not(.secondary):not([style*="background"]):hover,
.button.join:hover {
    background: #6ac9ba !important;
    color: #002933 !important;
}

.user-row-menu-panel .btn:not(.secondary):not([style*="background"]),
.user-row-menu-panel button.btn:not(.secondary):not([style*="background"]) {
    min-height: 26px !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
    background: #fff !important;
    color: #145246 !important;
    font-size: .72rem !important;
    box-shadow: none !important;
}

.user-row-menu-panel .btn:not(.secondary):not([style*="background"]):hover,
.user-row-menu-panel button.btn:not(.secondary):not([style*="background"]):hover {
    background: #f3fbf9 !important;
    color: #145246 !important;
}

.user-row-menu-panel .btn.teacher-account-action.delete:not(.secondary):not([style*="background"]) {
    color: #b91c1c !important;
    background: #fff !important;
}

.user-row-menu-panel .btn.teacher-account-action.delete:not(.secondary):not([style*="background"]):hover {
    color: #b91c1c !important;
    background: #fff5f5 !important;
}

.button.secondary,
button.secondary,
a.button.secondary {
    background: #fff !important;
    color: var(--nihao-ink) !important;
    border: 1px solid var(--nihao-line) !important;
    border-radius: 999px !important;
    box-shadow: none;
}

.button.booking-slot.selected,
.change-slot-list button.selected,
.booking-calendar-day.selected,
.settings-tab.selected,
.admin-calendar-view-switch button.active,
.admin-inbox-tab.is-active {
    background: var(--nihao-ink) !important;
    color: #fff !important;
    border-color: var(--nihao-ink) !important;
}

.client-tab.active,
.teacher-tab.active,
.admin-tab.active,
.admin-tab-group[data-admin-group="students"] .admin-tab.active,
.admin-tab-group[data-admin-group="students"] .admin-tab.active:hover {
    background: #f3f1ea !important;
    background-color: #f3f1ea !important;
    color: #1c2b2e !important;
    border-color: transparent !important;
}

.admin-tab-group[data-admin-group="students"] .admin-tab.active .admin-tab-count {
    background: #fff !important;
    color: var(--nihao-ink) !important;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]),
select,
textarea {
    border: 1px solid var(--nihao-line);
    border-radius: 10px;
    background: #fff;
    color: var(--nihao-ink);
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--nihao-accent);
    outline-offset: 1px;
}

table {
    background: #fff;
    color: var(--nihao-ink);
}

th {
    color: var(--nihao-muted);
    font-weight: 700;
    text-align: left;
    background: #f7f6f3;
}

th, td {
    border-bottom: 1px solid rgba(28, 43, 46, .08);
}

.modal-overlay,
.review-overlay,
.birthday-gift-overlay,
.teacher-settings-overlay {
    background: rgba(28, 43, 46, .46);
}

.chat-context-chip.is-main,
.whatsapp-sales-chip.is-main,
.studio-host,
.teacher-score-stack .is-review {
    background: #f3f1ea !important;
    color: var(--nihao-ink) !important;
}

.chat-header-avatar,
.chat-contact-avatar {
    background: #24383c;
    color: #fff;
}

#portalView,
#adminContent,
#loginBlock,
#loginView,
.modal-card,
.review-dialog {
    text-align: left;
}

.eyebrow,
.kicker,
.panel-eyebrow,
.admin-tab-group-label {
    color: var(--nihao-accent);
}

body.nihao-sidebar .shell,
body.nihao-sidebar main.shell {
    width: auto !important;
    max-width: none !important;
    margin: 0 0 0 var(--nihao-side) !important;
    padding: 72px 36px 140px 28px !important;
}

@media (max-width: 1079px) {
    body:has(#portalView) .shell,
    body:has(#portalView) main.shell {
        width: min(1120px, calc(100% - 28px)) !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

.quest-unbox-dialog,
.quest-figure,
.birthday-gift-dialog {
    background: #fff !important;
    color: var(--nihao-ink) !important;
    border: 1px solid var(--nihao-line);
    border-radius: var(--nihao-radius) !important;
}

.button:disabled,
.primary:disabled,
.btn:disabled,
.button.join:disabled {
    opacity: .45;
}

.calendar-day.is-legacy-only .calendar-event {
    background: #d5dbdc !important;
    color: #1c2b2e !important;
}
.calendar-detail-row.is-legacy {
    background: #f4f3f0 !important;
    border-color: rgba(28, 43, 46, .12) !important;
    color: #5c6d71;
}
.calendar-detail-row.is-legacy .calendar-lesson-status.is-legacy {
    background: #e6e4de !important;
    color: #5c6d71 !important;
}
.legacy-date-hint {
    margin: 4px 0 0;
    color: #5c6d71;
    font-size: .75rem;
    line-height: 1.45;
}
.teacher-calendar-day.has-legacy:not(.has-events):not(.has-trial) {
    background: #f4f3f0 !important;
    border-color: rgba(28, 43, 46, .16) !important;
}
.teacher-calendar-dot.is-legacy { background: #8d989b !important; }
.teacher-calendar-badge.is-legacy {
    background: #e6e4de !important;
    color: #3d4c50 !important;
}
.teacher-calendar-lesson.is-legacy {
    background: #f4f3f0 !important;
    border-color: rgba(28, 43, 46, .12) !important;
    color: #3d4c50;
}
.teacher-calendar-lesson.is-legacy .teacher-calendar-tag {
    background: #e6e4de !important;
    color: #5c6d71 !important;
}

/* Logged-in polish: one eyebrow, one card, one button height. */
body .eyebrow,
body .panel-eyebrow,
body .kicker {
    margin: 0 0 6px;
    color: var(--nihao-accent);
    font-family: "Noto Sans HK", "PingFang HK", "PingFang TC", sans-serif;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
    line-height: 1.35;
    text-transform: none;
}

body.admin-ready .panel-hero h2,
body.admin-ready .editor-heading h3,
#portalView .client-tab-panel h2,
#portalView .booking-head h2,
#portalView .lessons-head h2,
#portalView .teacher-panel h2,
#portalView .course-section-header h2,
#portalView .salary-card > h2 {
    margin: 0 0 6px;
    font-size: 1.45rem;
    line-height: 1.3;
    font-weight: 600;
    text-wrap: balance;
}

body.admin-ready .panel-hero p,
#portalView .client-tab-panel > .summary,
#portalView .client-tab-panel .summary,
#portalView .teacher-panel p,
#portalView .course-section-header p {
    text-wrap: pretty;
}

@media (min-width: 1100px) {
    body.admin-ready #adminContent > .tab-panel > .management-panel > .panel-hero {
        padding: 20px 22px;
        border-radius: 12px;
    }
    body.admin-ready #adminContent .management-panel > .card,
    body.admin-ready #adminContent .management-panel > .editor-card,
    body.admin-ready #adminContent .management-panel > section.card,
    body.admin-ready #adminContent .overview-card {
        padding: 22px;
        border-radius: 16px;
        box-shadow: 0 1px 2px rgba(28, 43, 46, .05), 0 12px 28px -22px rgba(28, 43, 46, .28);
    }
}

@media (max-width: 1099px) {
    body.admin-ready .panel-hero,
    body.admin-ready #adminContent .management-panel > .card,
    body.admin-ready #adminContent .management-panel > .editor-card {
        padding: 18px;
        border-radius: 16px;
    }
}

#portalView .client-tab-panel.card,
#portalView .portal-section.card,
#portalView .teacher-panel > .card,
#portalView .salary-card,
#portalView .availability-panel {
    padding: 22px;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(28, 43, 46, .05), 0 12px 28px -22px rgba(28, 43, 46, .28);
}

#adminContent .btn:not(.admin-refresh-btn):not(.admin-notice-bell),
#portalView .button,
#portalView button.primary,
#portalView .primary,
#loginView .button,
#loginView .primary,
#loginBlock .btn {
    box-sizing: border-box;
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 800;
    line-height: 1.2;
}

.admin-notice-bell,
.notification-bell,
.portal-nav-menu {
    border-radius: 12px;
}

.empty,
.card.empty,
.admin-calendar-empty,
.overview-empty {
    margin: 0;
    padding: 18px 16px;
    border: 1px dashed rgba(28, 43, 46, .18);
    border-radius: 12px;
    background: #f7f6f3;
    color: var(--nihao-muted);
    text-align: left;
    font-weight: 700;
    line-height: 1.5;
}

body.admin-ready .management-panel,
body.admin-ready .table-container,
#portalView .table-container,
#portalView .table-wrap,
#portalView .data-list {
    min-width: 0;
    max-width: 100%;
}

body.admin-ready .table-container,
#portalView .table-wrap {
    overflow-x: auto;
}

body.admin-ready .revenue-record-table {
    width: max-content;
    min-width: 100%;
}

body.admin-ready .revenue-record-table th,
body.admin-ready .revenue-record-table td {
    white-space: nowrap;
}
