/* ============================================================
   LAYOUT — nav, secondary-nav, admin-bar, auth, main
   ============================================================ */

/* ── Primary nav ─────────────────────────────────────────────── */
.nav {
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
}

/* Left cluster: brand + primary nav */
.nav-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Brand link */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
    margin-right: 18px;
    padding-right: 18px;
    border-right: 1px solid rgba(255,255,255,.07);
}

/* Logo mark image */
.nav-brand-mark {
    width: 27px;
    height: 32px;
    background: url('/img/logo-mark-cream.png') center / contain no-repeat;
    flex-shrink: 0;
}

/* Wordmark + byline column */
.nav-brand-wordmark {
    display: flex;
    flex-direction: column;
    gap: 4px;
    line-height: 1;
}

/* Wordmark */
.nav-brand-text {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.005em;
    color: var(--nav-fg);
    white-space: nowrap;
}

/* Colored period in wordmark */
.nav-brand-dot {
    color: #E8C588;
}

/* Byline "by Eric B. Limegrover" */
.nav-brand-byline {
    font-size: 9.5px;
    font-weight: 500;
    font-family: var(--font-mono);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #7B89A8;
    white-space: nowrap;
}

.nav-brand-byline em {
    font-style: normal;
    color: #9AA9C5;
}

/* Admin role chip — shown next to brand */
.nav-role-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--role-admin-bg);
    color: var(--role-admin-fg);
    border: 1px solid var(--role-admin-bd);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
    margin-left: 10px;
}

/* Alias for test compatibility: admin-bar-tag doubles as the role chip in members nav */
.admin-bar-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--role-admin-bg);
    color: var(--role-admin-fg);
    border: 1px solid var(--role-admin-bd);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
    margin-left: 10px;
}

/* Primary nav pill links */
.nav-primary {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 8px;
}

.nav-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--nav-fg-muted);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-pill:hover {
    background: var(--nav-hover);
    color: var(--nav-fg);
}

.nav-pill.active {
    background: var(--nav-active);
    color: var(--nav-fg);
}

/* Inline SVG icons inside pills — override the global svg { display: block } reset */
.nav-pill svg {
    display: inline;
    flex-shrink: 0;
    width: 13px;
    height: 13px;
    max-width: none;
}

/* Active underline bar pinned to bottom of nav */
.nav-pill.active::after {
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: -13px;
    height: 2px;
    background: var(--accent-on-nav);
    border-radius: 2px 2px 0 0;
}

/* Legacy alias used in some module views */
.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--nav-fg-muted);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    background: var(--nav-active);
    color: var(--nav-fg);
}

/* Flex spacer */
.nav-spacer { flex: 1; }

/* Right cluster: search + bell + apps + hairline + user */
.nav-right {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 10px;
    flex-shrink: 0;
}

/* Search pill */
.nav-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 10px 0 12px;
    border-radius: 8px;
    background: rgba(255,255,255,.06);
    color: var(--nav-fg-dim);
    font-size: 13px;
    font-family: inherit;
    min-width: 240px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--transition-fast), border-color var(--transition-fast);
    text-align: left;
}

.nav-search:hover {
    background: rgba(255,255,255,.09);
    border-color: rgba(255,255,255,.06);
}

.nav-search-ph {
    flex: 1;
    color: #7B89A8;
    font-size: 13px;
}

/* Keyboard shortcut chip (⌘K, / , ↵ etc.) */
.nav-kbd {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 5px;
    border-radius: 5px;
    background: rgba(255,255,255,.08);
    font-size: 11px;
    font-family: var(--font-mono);
    font-weight: 500;
    color: #B7C2DA;
    border: 1px solid rgba(255,255,255,.06);
    white-space: nowrap;
}

/* Icon buttons: bell, apps grid */
.nav-icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--nav-fg-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
    padding: 0;
}

.nav-icon-btn:hover {
    background: var(--nav-hover);
    color: var(--nav-fg);
}

.nav-icon-btn.active {
    background: var(--nav-active);
    color: var(--nav-fg);
}

/* Notification count badge on bell */
.nav-notif-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #E5484D;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    border: 2px solid var(--nav-bg);
}

/* Vertical hairline between right controls and user pill */
.nav-vrule {
    width: 1px;
    height: 22px;
    background: var(--nav-rule);
    margin: 0 6px;
    flex-shrink: 0;
}

/* ── App launcher (9-dot) ────────────────────────────────────── */
.nav-app-launcher {
    position: relative;
    list-style: none;
}

/* Apps launcher — labelled pill so the affordance reads */
.nav .nav-apps-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 11px 0 9px;
    border-radius: 9px;
    color: var(--nav-fg-muted);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    background: transparent;
    border: 1px solid transparent;
}
.nav .nav-apps-btn:hover {
    background: rgba(255,255,255,.09);
    color: var(--nav-fg);
    border-color: rgba(255,255,255,.14);
}
.nav .nav-apps-btn.active {
    background: rgba(255,255,255,.12);
    color: var(--nav-fg);
    border-color: rgba(255,255,255,.16);
}
.nav .nav-apps-btn .lbl {
    font: 600 12.5px/1 'Inter', system-ui, sans-serif;
    letter-spacing: .01em;
}
.nav .nav-apps-btn .car {
    opacity: .55;
    margin-left: -2px;
}

/* ── User pill + dropdown ────────────────────────────────────── */
.nav-user {
    position: relative;
    list-style: none;
}

/* User pill trigger button */
.nav-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 36px;
    padding: 3px 10px 3px 4px;
    border-radius: 999px;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.nav-user-btn:hover,
.nav-user.open .nav-user-btn {
    background: var(--nav-hover);
}

/* User avatar circle */
.nav-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.18);
    flex-shrink: 0;
    color: #FAEBC8;
    background: linear-gradient(150deg, #B8893A, #8C6529);
}

.nav-user-avatar--member {
    background: linear-gradient(150deg, #2563eb, #1d4ed8);
    color: #fff;
}

/* Larger avatar used in user menu header */
.nav-user-avatar--lg {
    width: 42px;
    height: 42px;
    font-size: 15px;
}

/* Name + role stacked column */
.nav-user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}

.nav-user-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--nav-fg);
    line-height: 1;
}

.nav-user-role {
    font-size: 10.5px;
    font-weight: 500;
    color: var(--accent-on-nav);
    line-height: 1;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.nav-user-role--member {
    color: var(--nav-fg-dim);
}

.nav-user-caret {
    color: var(--nav-fg-dim);
    flex-shrink: 0;
}

/* ── Shared popover base ─────────────────────────────────────── */
.nav-pop {
    position: absolute;
    z-index: 400;
    background: #fff;
    border: 1px solid #E6E8EE;
    border-radius: 14px;
    box-shadow: var(--shadow-pop);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px) scale(.985);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity .14s ease, transform .14s ease;
    top: calc(100% + 6px);
    right: 0;
}

.nav-pop.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ── Apps popover ────────────────────────────────────────────── */
.nav-apps-pop {
    width: 460px;
}

/* Apps header row */
.nap-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
}

.nap-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #0B1220;
}

.nap-manage {
    font-size: 12px;
    font-weight: 500;
    color: #173FB0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    text-decoration: none;
}

.nap-manage:hover { text-decoration: underline; }

/* Apps search row */
.nap-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 10px;
    margin: 0 14px 8px;
    border-radius: 9px;
    background: #F4F6FB;
    border: 1px solid #EEF0F4;
    color: #6B7280;
}

.nap-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    font-family: inherit;
    color: #0B1220;
    min-width: 0;
}

.nap-kbd {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 5px;
    border-radius: 5px;
    background: #fff;
    border: 1px solid #E6E8EE;
    border-bottom-width: 2px;
    font-size: 11px;
    font-family: var(--font-mono);
    font-weight: 500;
    color: #1F2937;
    flex-shrink: 0;
}

/* Group section */
.nap-group {
    padding: 10px 8px 6px;
}

.nap-group-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 8px;
    font-size: 10.5px;
    font-weight: 600;
    color: #6B7280;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.nap-group-head::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #EEF0F4;
}

/* Tile grid */
.nap-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 0 6px;
}

.nap-tile {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-fast);
    position: relative;
}

.nap-tile:hover { background: #F4F6FB; }

/* Icon block with tonal swatch */
.nap-tile-ico {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(11,18,32,.06);
}

/* Per-module tonal swatches */
.nap-ico-sfs          { background: rgba(31,79,217,.08);   color: #1F4FD9; }
.nap-ico-ads          { background: rgba(107,91,210,.08);  color: #6B5BD2; }
.nap-ico-forum        { background: rgba(15,140,114,.08);  color: #0F8C72; }
.nap-ico-childsupport { background: rgba(184,137,58,.08);  color: #B8893A; }
.nap-ico-maintenance  { background: rgba(162,63,134,.08);  color: #A23F86; }
.nap-ico-notes        { background: rgba(63,125,216,.08);  color: #3F7DD8; }
.nap-ico-parenting    { background: rgba(28,124,156,.08);  color: #1C7C9C; }
.nap-ico-default      { background: rgba(107,114,128,.08); color: #6B7280; }

.nap-tile-lbl {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.nap-tile-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #0B1220;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.nap-tile-desc {
    font-size: 11.5px;
    font-weight: 400;
    color: #6B7280;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

/* Pin button revealed on hover */
.nap-pin-btn {
    margin-left: auto;
    color: #9AA3B2;
    opacity: 0;
    transition: opacity var(--transition-fast);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.nap-tile:hover .nap-pin-btn { opacity: .9; }

/* Apps footer */
.nap-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 12px;
    border-top: 1px solid #EEF0F4;
    background: #FAFBFD;
}

.nap-foot-hint {
    font-size: 11.5px;
    color: #6B7280;
}

.nap-foot-keys {
    font-size: 11.5px;
    color: #6B7280;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── User menu popover ───────────────────────────────────────── */
.nav-user-menu {
    width: 312px;
}

/* User menu header */
.nup-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px 12px;
}

.nup-who {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.nup-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #0B1220;
    line-height: 1.1;
}

.nup-email {
    font-size: 12px;
    color: #6B7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Role chip in user menu header */
.nup-role-chip {
    margin-top: 5px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 7px;
    border-radius: 6px;
    background: #F4ECD8;
    color: #7A5618;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    width: max-content;
}

.nup-role-chip--member {
    background: #E8EEFE;
    color: #173FB0;
}

/* Section dividers */
.nup-section {
    padding: 6px 8px;
    border-top: 1px solid #EEF0F4;
}

.nup-section-label {
    font-size: 10.5px;
    font-weight: 600;
    color: #6B7280;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 8px 8px 4px;
}

/* Menu rows */
.nup-row,
.nav-user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #1F2937;
    text-decoration: none;
    transition: background var(--transition-fast);
    width: 100%;
    background: none;
    border: none;
    font-family: inherit;
    text-align: left;
}

.nup-row:hover,
.nav-user-menu-item:hover {
    background: #F4F6FB;
}

.nup-row-icon {
    width: 18px;
    height: 18px;
    color: #6B7280;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nup-row-kbd {
    margin-left: auto;
    font-size: 11px;
    font-family: var(--font-mono);
    font-weight: 500;
    color: #9AA3B2;
    flex-shrink: 0;
}

/* Destructive logout row */
.nup-row--danger,
.nup-row-danger {
    color: #B42318;
}

.nup-row--danger .nup-row-icon,
.nup-row-danger .nup-row-icon {
    color: #B42318;
}

.nup-row--danger:hover,
.nup-row-danger:hover {
    background: #FEF3F2;
}

/* Theme segmented control in user menu */
.nup-theme-row {
    padding: 8px;
}

.nup-theme-seg {
    display: flex;
    background: #F4F6FB;
    border: 1px solid #EEF0F4;
    border-radius: 9px;
    padding: 3px;
    gap: 2px;
}

.nup-theme-seg button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 28px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    color: #6B7280;
    background: none;
    border: none;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.nup-theme-seg button.on {
    background: #fff;
    color: #0B1220;
    box-shadow: 0 1px 2px rgba(11,18,32,.06), 0 0 0 1px #E6E8EE;
}

/* Legacy separator (kept for compat) */
.nav-user-sep { height: 1px; background: #EEF0F4; margin: 4px 0; }
.nav-user-label {
    display: block;
    padding: 7px 14px 5px;
    font-size: 11px;
    color: #9AA9C5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 312px;
}

/* ── Primary nav item dropdowns (hover) ──────────────────────── */
.nav-item-dropdown { position: relative; }

.nav-item-dropdown:hover .nav-dropdown { display: block; }

.nav-dropdown-caret {
    font-size: 9px;
    margin-left: 2px;
    opacity: 0.55;
    pointer-events: none;
}

.nav-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 160px;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-default);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    padding: 4px 0;
    z-index: 400;
}

.nav-dropdown-link {
    display: block;
    padding: 7px 14px;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition-default), background var(--transition-default);
}

.nav-dropdown-link:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-hover);
}

/* ── Admin bar (fixed top strip when admin views front-end) ──── */
.admin-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--admin-bar-height);
    background: var(--color-bg-chrome);
    border-bottom: 1px solid var(--color-border-default);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    font-size: 12px;
    font-weight: 500;
    z-index: 9999;
}

.admin-bar-left { display: flex; align-items: center; gap: 4px; }

.admin-bar-link {
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-default), background var(--transition-default);
}

.admin-bar-link:hover { color: var(--color-text-primary); background: rgba(255,255,255,0.06); }

/* ── Admin secondary nav (Dashboard, Users, Roles…) ─────────── */
.admin-nav {
    position: sticky;
    top: var(--header-height);
    z-index: 190;
    background: var(--color-bg-chrome);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 0 2rem;
}

.admin-nav-inner {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.admin-nav-inner::-webkit-scrollbar { display: none; }

.admin-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 9px 12px;
    color: #ddd;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.12s ease, background 0.12s ease, border-color var(--transition-default);
    margin-bottom: -1px;
}

.admin-nav-link:hover { color: #fff; background: #111; border-radius: var(--radius-sm); }

.admin-nav-link.active {
    color: #fff;
    border-bottom-color: var(--color-accent);
}

.admin-nav-sub {
    font-size: 11px;
    padding-left: 8px;
    opacity: 0.85;
}

.admin-nav-sep {
    width: 1px;
    height: 14px;
    background: rgba(255,255,255,0.1);
    margin: 0 4px;
    flex-shrink: 0;
}

/* ── Member secondary nav (module strip) ────────────────────── */
.admin-nav ~ .secondary-nav {
    top: calc(var(--header-height) + var(--admin-nav-height));
}

.secondary-nav {
    position: sticky;
    top: var(--header-height);
    z-index: 190;
    background: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border-default);
    padding: 0 2rem;
}

.secondary-nav-inner {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.secondary-nav-inner::-webkit-scrollbar { display: none; }

.secondary-nav-module-title {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-primary);
    white-space: nowrap;
    padding: 0 4px;
}

.secondary-nav-module-sep {
    font-weight: 400;
    color: var(--color-text-muted);
}

.secondary-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 9px 12px;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color var(--transition-default), border-color var(--transition-default);
    margin-bottom: -1px;
}

.secondary-nav-link:hover { color: var(--color-text-primary); }

.secondary-nav-link.active {
    color: var(--color-text-primary);
    border-bottom-color: var(--color-accent);
}

.secondary-nav-sep {
    width: 1px;
    height: 14px;
    background: var(--color-border-light);
    margin: 0 4px;
    flex-shrink: 0;
}

/* ── Main content area ───────────────────────────────────────── */
.main-content-page {
    padding: 2.5rem 0;
    min-height: calc(100vh - var(--header-height));
}

.main-content-page:has(.container-fluid) {
    padding: 1rem 0 0;
}

/* ── Parenting Time Calendar (full-viewport React app) ───────── */
body.ptc-page { overflow: hidden; }

.main-content-page--calendar {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
    min-height: 0;
}

.ptc-subhead {
    height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 1.5rem;
    background: var(--color-bg-chrome);
    border-bottom: 1px solid var(--nav-border);
    flex-shrink: 0;
}

.ptc-subhead-sep {
    color: var(--nav-fg-dim);
    font-size: 14px;
    flex-shrink: 0;
}

.ptc-subhead-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--nav-fg);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.ptc-react-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* ── Theme toggle (used on auth.php) ─────────────────────────── */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-default), background var(--transition-default);
}

.theme-toggle:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-hover);
}

.theme-toggle-fixed {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 999;
    width: 38px;
    height: 38px;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

/* ── Auth pages ──────────────────────────────────────────────── */
.auth-page { background: var(--color-bg-page); }

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    background:
        radial-gradient(ellipse 60% 50% at 50% -10%, var(--color-accent-glow) 0%, transparent 70%),
        var(--color-bg-page);
}

.auth-box {
    width: 100%;
    max-width: 400px;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 2rem;
}

.auth-brand h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0;
    color: var(--color-text-primary);
}

.auth-card {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-card h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border-default);
    color: var(--color-text-primary);
}

.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 12px;
    color: var(--color-text-muted);
}

.auth-footer a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-default);
}

.auth-footer a:hover { color: var(--color-text-primary); }
.auth-footer .sep    { margin: 0 8px; opacity: 0.4; }

/* ── Modal overlay ───────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay-hidden { display: none; }

.modal {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.modal-title { font-size: 15px; font-weight: 700; margin-bottom: 0.75rem; }
.modal-text  { font-size: 13px; color: var(--color-text-muted); margin-bottom: 1.5rem; }

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1023px) {
    .nav-search { min-width: 0; }
    .nav-search-ph { display: none; }
    .nav-search {
        width: 36px;
        min-width: 36px;
        padding: 0;
        justify-content: center;
        border-radius: 9px;
    }
}

@media (max-width: 768px) {
    .nav { padding: 0 1rem; }
    .admin-nav { padding: 0 1rem; }
    .secondary-nav { padding: 0 1rem; }
    .nav-primary { display: none; }
    .nav-user-meta { display: none; }
    .nav-user-caret { display: none; }
    .nav-apps-pop { width: 320px; right: -8px; }
    .nap-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Public nav — logged-out visitors ───────────────────────────────────── */
nav.pub-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    background: #0B1220;
    border-bottom: 1px solid #18223A;
    color: #fff;
    font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.pub-nav-inner {
    display: flex;
    align-items: center;
    height: 64px;
    gap: 8px;
    padding: 0 2rem;
    width: 100%;
}
.pub-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding-right: 18px;
    border-right: 1px solid rgba(255,255,255,.10);
    height: 38px;
    margin-right: 6px;
    text-decoration: none;
    flex-shrink: 0;
}
.pub-brand-mark {
    width: 28px;
    height: 32px;
    background: url('/img/logo-mark-cream.png') center/contain no-repeat;
    flex: 0 0 28px;
    display: block;
}
.pub-brand-name {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}
.pub-brand-top {
    font: 600 15px/1.1 'Geist', sans-serif;
    color: #fff;
    letter-spacing: -.005em;
}
.pub-brand-dot {
    color: #E8C588;
}
.pub-brand-by {
    font: 500 9.5px/1 'Geist Mono', monospace;
    color: #9AA9C5;
    letter-spacing: .14em;
    margin-top: 4px;
    text-transform: uppercase;
}
.pub-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 6px;
}
.pub-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: 8px;
    font: 500 13.5px/1 'Geist', sans-serif;
    color: #C9D2E3;
    position: relative;
    transition: background .15s, color .15s;
    text-decoration: none;
}
.pub-tab svg { opacity: .8; }
.pub-tab:hover { background: rgba(255,255,255,.06); color: #fff; }
.pub-tab.active { color: #fff; background: rgba(255,255,255,.07); }
.pub-tab.active::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: -15px;
    height: 2px;
    background: #7FA7FF;
    border-radius: 2px 2px 0 0;
}
.pub-nav-spacer { flex: 1; }
.pub-nav-right { display: flex; align-items: center; gap: 10px; }
.pub-login {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    font: 600 13px/1 'Geist', sans-serif;
    color: #fff;
    border: 1px solid rgba(255,255,255,.22);
    background: rgba(255,255,255,.04);
    transition: background .15s, border-color .15s, transform .06s;
    text-decoration: none;
}
.pub-login:hover { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.36); }
.pub-login:active { transform: translateY(1px); }
.pub-login svg { opacity: .85; }
.pub-cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    background: #1F4FD9;
    color: #fff;
    font: 600 13px/1 'Geist', sans-serif;
    letter-spacing: .005em;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 4px 10px -3px rgba(31,79,217,.55);
    transition: background .15s, transform .06s;
    text-decoration: none;
}
.pub-cta:hover { background: #2858E6; }
.pub-cta:active { transform: translateY(1px); }

@media (max-width: 760px) {
    .pub-tabs { display: none; }
    .pub-brand { padding-right: 0; border-right: 0; }
    .pub-login { padding: 0 12px; height: 34px; font-size: 12.5px; }
    .pub-cta   { padding: 0 12px; height: 34px; font-size: 12.5px; }
}
