/* FT3M shell: top bar, menu drawer and tree. Layout follows ft3mweb (TreeMenu + MainMenu); colours are FT3M tokens. */

:root {
    --ft-topbar-h: 60px;
    --ft-drawer-w: 340px;
}

/* ---------- Top bar ---------- */

.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 1200;
    height: var(--ft-topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    background: linear-gradient(180deg, var(--ft-apron) 0%, var(--ft-sky) 140%);
    color: #FFFFFF;
}

.topbar__horizon {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(227, 179, 65, 0) 0%, rgba(227, 179, 65, 0.85) 50%, rgba(227, 179, 65, 0) 100%);
}

.topbar__left,
.topbar__right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: none;
}

.topbar__right {
    margin-left: auto;
    position: relative;
}

.topbar__btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}

.topbar__btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
}

.topbar__btn:focus-visible,
.topbar__profile:focus-visible {
    outline: 2px solid var(--ft-caution);
    outline-offset: 2px;
}

.topbar__brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 14px;
    color: #FFFFFF;
    text-decoration: none;
    white-space: nowrap;
}

.topbar__wordmark {
    font-family: var(--ft-font-display);
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: 0.32em;
}

.topbar__divider {
    width: 1px;
    height: 24px;
    background: linear-gradient(180deg, transparent, rgba(227, 179, 65, 0.8), transparent);
}

.topbar__tagline {
    font-family: var(--ft-font-display);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    color: rgba(255, 255, 255, 0.65);
}

.topbar__profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 4px 4px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.04);
    color: #FFFFFF;
    cursor: pointer;
}

.topbar__profile:hover {
    background: rgba(255, 255, 255, 0.1);
}

.topbar__who {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
    text-align: left;
}

.topbar__name {
    font-size: 0.85rem;
}

.topbar__role {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
}

.ft-avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ft-altimeter);
    color: #FFFFFF;
    font-family: var(--ft-font-display);
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}

.ft-avatar--lg {
    width: 44px;
    height: 44px;
    font-size: 0.95rem;
}

/* A person's picture fills their avatar circle (UserAvatar); without one the circle shows the initials. */
.user-avatar {
    overflow: hidden;
    flex: none;
}

.user-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- Profile card ---------- */

.profile-scrim {
    position: fixed;
    inset: 0;
    z-index: 1;
}

.profile-card {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 2;
    width: 300px;
    padding: 16px;
    background: #FFFFFF;
    color: var(--ft-stencil);
    border: 1px solid var(--ft-line);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(11, 30, 54, 0.22);
}

.profile-card__head {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ft-line);
}

.profile-card__name {
    font-family: var(--ft-font-display);
    font-weight: 600;
    font-size: 1.02rem;
}

.profile-card__meta {
    font-size: 0.8rem;
    color: var(--ft-stencil-soft);
}

.profile-card__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 6px;
    font-size: 0.88rem;
    color: var(--ft-stencil-soft);
}

.profile-card__link,
.profile-card__signout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    margin-top: 4px;
    border: 0;
    border-radius: var(--ft-radius);
    background: none;
    color: var(--ft-stencil);
    font: inherit;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
}

.profile-card__link:hover {
    background: var(--ft-chalk);
}

.profile-card__signout {
    color: var(--ft-streamer);
}

.profile-card__signout:hover {
    background: rgba(200, 16, 46, 0.06);
}

.profile-card__version {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--ft-line);
    font-family: var(--ft-font-display);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--ft-stencil-soft);
}

.profile-card__switch {
    margin: 0;
}

/* ---------- Notifications ---------- */

.notif-bell {
    position: relative;
}

/* The unread count on the bell: a red disc on its top-right corner (a pill for "99+"), the number centred, the bell left uncovered. */
.notif-bell__count {
    position: absolute;
    top: -5px;
    right: -5px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border: 2px solid var(--ft-apron);
    border-radius: var(--ft-radius-pill);
    background: var(--ft-streamer);
    color: #FFFFFF;
    font-family: var(--ft-font-display);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    box-sizing: border-box;
    pointer-events: none;
}

.notif-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    width: min(380px, calc(100vw - 32px));
    max-height: min(560px, calc(100vh - var(--ft-topbar-h) - 24px));
    background: #FFFFFF;
    color: var(--ft-stencil);
    border: 1px solid var(--ft-line);
    border-radius: var(--ft-radius-sm);
    box-shadow: 0 12px 32px rgba(11, 30, 54, 0.22);
    overflow: hidden;
}

.notif-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--ft-line);
}

.notif-panel__title {
    font-family: var(--ft-font-display);
    font-weight: 600;
    font-size: 1.02rem;
}

.notif-panel__action {
    border: 0;
    background: none;
    color: var(--ft-altimeter-deep);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

.notif-panel__action:hover {
    text-decoration: underline;
}

.notif-panel__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 28px 16px;
    color: var(--ft-stencil-soft);
    font-size: 0.88rem;
}

.notif-panel__all {
    display: block;
    padding: 11px 16px;
    border-top: 1px solid var(--ft-line);
    color: var(--ft-altimeter-deep);
    font-size: 0.86rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.notif-panel__all:hover {
    background: var(--ft-chalk);
}

.notif-list {
    margin: 0;
    padding: 4px 0;
    list-style: none;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.notif-item:hover,
.notif-item:focus-visible {
    background: var(--ft-chalk);
    outline: none;
}

.notif-item.is-unread {
    background: rgba(47, 127, 184, 0.06);
}

.notif-item.is-unread:hover {
    background: rgba(47, 127, 184, 0.12);
}

/* The kind's icon in its tone (the badge--* colours). */
.notif-item__icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--badge-bg, var(--ft-chalk));
    color: var(--badge-fg, var(--ft-stencil-soft));
}

.notif-item__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.notif-item__text {
    font-size: 0.86rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.notif-item.is-unread .notif-item__text {
    font-weight: 600;
}

.notif-item__meta {
    color: var(--ft-stencil-soft);
    font-size: 0.75rem;
}

.notif-item__dot {
    flex: none;
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--ft-altimeter);
}

/* The notifications page: unread rows read bold. */
.lt__row.is-unread > td {
    font-weight: 600;
}

/* ---------- Content ---------- */

.shell-main {
    min-height: 100vh;
    padding-top: var(--ft-topbar-h);
    background: var(--ft-chalk);
}

/* ---------- Menu drawer ---------- */

.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1300;
    background: rgba(11, 30, 54, 0.45);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

.drawer-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1301;
    width: var(--ft-drawer-w);
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    border-right: 1px solid var(--ft-line);
    transform: translateX(-100%);
    transition: transform 240ms cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 240ms ease;
    outline: none;
}

.drawer.is-open {
    transform: translateX(0);
    box-shadow: 10px 0 32px rgba(11, 30, 54, 0.22);
}

.drawer__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px 14px 16px;
    background: var(--ft-apron);
    color: #FFFFFF;
    border-bottom: 2px solid var(--ft-caution);
}

.drawer__mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--ft-sky);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.drawer__mark svg {
    width: 26px;
    height: 8px;
}

.drawer__mark path {
    fill: none;
    stroke: var(--ft-caution);
    stroke-width: 2.4;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.drawer__mark circle {
    fill: var(--ft-caution);
}

.drawer__brand {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 3px;
}

.drawer__wordmark {
    font-family: var(--ft-font-display);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.3em;
}

.drawer__tagline {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawer__close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: none;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
}

.drawer__close:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.1);
}

.drawer__search {
    position: relative;
    padding: 10px 12px;
    border-bottom: 1px solid var(--ft-line);
}

.drawer__search input {
    width: 100%;
    padding: 8px 32px 8px 32px;
    border: 1px solid var(--ft-line);
    border-radius: 6px;
    background: var(--ft-chalk);
    font: inherit;
    font-size: 0.88rem;
    color: var(--ft-stencil);
    outline: none;
}

.drawer__search input:focus {
    border-color: var(--ft-altimeter);
    background: #FFFFFF;
}

.drawer__search-icon.mud-icon-root {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ft-stencil-soft);
    pointer-events: none;
}

.drawer__search-clear {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--ft-stencil-soft);
    cursor: pointer;
}

.drawer__nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 16px;
    scrollbar-width: thin;
}

.drawer__empty {
    margin: 0;
    padding: 28px 16px;
    text-align: center;
    font-size: 0.88rem;
    color: var(--ft-stencil-soft);
}

/* ---------- Menu tree ---------- */

/*
 * One rule for every depth: a page and a group head at the same level line up (both keep a 3px left edge for the active marker), and
 * nesting indents through .tree-group__inner only, so a group three levels down looks like one level down.
 */
.tree-leaf,
.tree-group__head {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    padding: 8px 12px 8px 15px;
    border: 0;
    border-left: 3px solid transparent;
    background: none;
    font: inherit;
    font-size: 0.88rem;
    line-height: 1.3;
    text-align: left;
    color: var(--ft-stencil);
    cursor: pointer;
}

.tree-leaf > .mud-icon-root,
.tree-group__head > .mud-icon-root:first-child {
    flex: none;
    color: var(--ft-altimeter);
    opacity: 0.75;
}

.tree-leaf:hover,
.tree-group__head:hover {
    background: rgba(47, 127, 184, 0.07);
}

.tree-leaf:hover {
    border-left-color: rgba(47, 127, 184, 0.5);
}

.tree-leaf:focus-visible,
.tree-group__head:focus-visible {
    outline: 2px solid var(--ft-altimeter);
    outline-offset: -2px;
}

.tree-leaf.is-active {
    background: rgba(47, 127, 184, 0.1);
    border-left-color: var(--ft-caution);
    font-weight: 600;
}

.tree-leaf.is-active > .mud-icon-root {
    opacity: 1;
}

/* A group inside a group: the same row as a page, its title a little heavier. */
.tree-group__head .tree-group__title {
    font-weight: 500;
}

/* The home page, the top-level groups and a top-level page (a group the user sees one page of): the drawer's section bars. */
.tree-leaf--root,
.tree-leaf--d0,
.tree-group--d0 > .tree-group__head {
    padding-top: 11px;
    padding-bottom: 11px;
    border-bottom: 1px solid var(--ft-line);
    font-family: var(--ft-font-display);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.tree-group--d0 > .tree-group__head {
    background: var(--ft-chalk);
}

.tree-group--d0 > .tree-group__head:hover {
    background: var(--ft-chalk-deep);
}

.tree-group--d0 > .tree-group__head .tree-group__title {
    font-weight: 600;
}

.tree-leaf--root > .mud-icon-root,
.tree-leaf--d0 > .mud-icon-root,
.tree-group--d0 > .tree-group__head > .mud-icon-root:first-child {
    opacity: 1;
}

.tree-group__title {
    flex: 1;
    min-width: 0;
}

.tree-group__dot {
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ft-caution);
}

.tree-group__chevron.mud-icon-root {
    flex: none;
    color: var(--ft-stencil-soft);
    transition: transform 200ms ease;
}

.tree-group__chevron.is-open {
    transform: rotate(90deg);
}

.tree-group__body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 220ms ease;
}

.tree-group__body.is-open {
    grid-template-rows: 1fr;
}

.tree-group__inner {
    overflow: hidden;
    margin-left: 26px;
    border-left: 1px solid rgba(47, 127, 184, 0.18);
}

@media (prefers-reduced-motion: reduce) {
    .drawer,
    .drawer-backdrop,
    .tree-group__body,
    .tree-group__chevron.mud-icon-root {
        transition: none;
    }
}

@media (max-width: 900px) {
    .topbar__tagline,
    .topbar__divider,
    .topbar__who {
        display: none;
    }
}

/* On a phone the bell joins the right group: the profile button drops its chevron so the group stays clear of the centred brand. */
@media (max-width: 480px) {
    .topbar__profile {
        gap: 0;
        padding: 4px;
    }

    .topbar__profile > .mud-icon-root {
        display: none;
    }
}

/* ---------- Preview marker ---------- */

/* Sample data must never pass for the database: preview mode says so in the bar that is always on screen. */
.topbar__preview {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 10px;
    padding: 4px 12px 4px 10px;
    border: 1px solid rgba(227, 179, 65, 0.65);
    border-radius: var(--ft-radius-pill);
    background: rgba(227, 179, 65, 0.14);
    color: #F6D27A;
    font-family: var(--ft-font-display);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* On a phone the badge keeps its icon and colour; the wording is in its tooltip. */
@media (max-width: 600px) {
    .topbar__preview {
        margin-right: 6px;
        padding: 4px 6px;
    }

    .topbar__preview-text {
        display: none;
    }
}
