/* ==========================================================================
   App shell: sidebar, top navbar, content area, guest layout.
   ========================================================================== */

.app { min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background:
        radial-gradient(120% 35% at 0% 0%, var(--sidebar-glow), transparent 65%),
        radial-gradient(110% 30% at 100% 100%, rgba(20, 184, 166, 0.08), transparent 60%),
        var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .8rem;
    height: var(--topbar-height);
    padding: 0 1.1rem 0 1rem;
    color: var(--sidebar-text-active);
    border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-brand:hover { text-decoration: none; }
.brand-mark {
    width: 34px; height: 34px;
    border-radius: 9px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #6ee7b7, #10b981 45%, #047857);
    color: #022c22; font-weight: 800; font-size: .95rem; letter-spacing: -.02em;
    box-shadow: 0 8px 22px -6px rgba(16, 185, 129, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    flex-shrink: 0; overflow: hidden; line-height: 1; white-space: nowrap;
}
.brand-mark[data-length="3"] { font-size: .74rem; letter-spacing: -.03em; }
.brand-mark[data-length="4"] { font-size: .6rem; letter-spacing: -.03em; }
.brand-mark.has-image { background: #fff; box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.45); }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-text { min-width: 0; overflow: hidden; }
.brand-text strong { display: block; font-size: 1rem; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Long taglines wrap to two lines, then end in "…" (the full text is in the title tooltip). */
.brand-text small {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
    overflow: hidden; margin-top: 1px;
    color: var(--sidebar-muted); font-size: .68rem; line-height: 1.3;
}
/* Sidebar (and its Settings preview): the logo hangs in a ribbon from the top edge. */
.brand-ribbon {
    align-self: stretch;
    width: 54px;
    flex-shrink: 0;
    display: grid;
    place-items: start center;
    padding-top: 9px;
    background: var(--brand-ribbon);
    clip-path: polygon(0 0, 100% 0, 100% 80%, 50% 100%, 0 80%);
    transition: padding-top var(--transition);
}
.sidebar-brand:hover .brand-ribbon { padding-top: 12px; }
.brand-ribbon .brand-mark { width: 38px; height: 38px; border-radius: 50%; box-shadow: 0 4px 12px -3px var(--brand-ribbon-shadow); }
.brand-ribbon .brand-mark:not(.has-image) { background: var(--sidebar-bg); color: var(--brand-letter); }
:is(.sidebar-brand, .brand-preview-sidebar) .brand-text strong { font-size: 1.05rem; font-weight: 800; letter-spacing: .005em; }
/* The tagline's initials spelling the name ("S M A R T"); the full tagline stays readable for screen readers and in the tooltip. */
.brand-text small:has(.brand-letters) { display: block; }
.brand-letters { display: flex; gap: 4px; margin-top: 5px; }
.brand-letters b {
    width: 16px; height: 16px; display: grid; place-items: center;
    border-radius: 4px; background: var(--brand-letter-bg); color: var(--brand-letter);
    font-size: .6rem; font-weight: 700; line-height: 1;
    transition: background var(--transition), transform var(--transition);
}
.sidebar-brand:hover .brand-letters b { background: var(--brand-letter-bg-hover); }
.sidebar-brand:hover .brand-letters b:nth-child(odd) { transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) {
    .brand-ribbon, .brand-letters b { transition: none; }
    .sidebar-brand:hover .brand-ribbon { padding-top: 9px; }
    .sidebar-brand:hover .brand-letters b { transform: none; }
}

.sidebar-nav {
    flex: 1; overflow-y: auto; padding: .75rem .75rem 1.25rem;
    scrollbar-width: thin; scrollbar-color: rgba(167, 243, 208, 0.18) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(167, 243, 208, 0.16); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.nav-section { margin-top: .9rem; }
.nav-section:first-child { margin-top: 0; }
.nav-section-title {
    padding: 0 .75rem .35rem;
    font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--sidebar-muted);
}
.nav-link {
    position: relative;
    display: flex; align-items: center; gap: .7rem;
    padding: .55rem .75rem;
    border-radius: 9px;
    color: var(--sidebar-text);
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}
.nav-link svg { transition: color var(--transition); }
.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); text-decoration: none; }
.nav-link:hover svg { color: var(--sidebar-accent); }
.nav-link:focus-visible { box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.55); border-radius: 9px; }
/* Unread count on a menu entry (e.g. Messages), filled by the notification poll. */
.nav-badge { margin-left: auto; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; line-height: 19px; text-align: center; }
.nav-badge[hidden] { display: none; }
.nav-link.active {
    background: linear-gradient(90deg, var(--sidebar-active), rgba(16, 185, 129, 0.05));
    color: var(--sidebar-text-active);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.14);
}
.nav-link.active::before {
    content: ""; position: absolute; left: -.75rem; top: 50%;
    width: 3px; height: 60%; transform: translateY(-50%);
    border-radius: 0 3px 3px 0;
    background: var(--sidebar-accent);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.7);
}
.nav-link.active svg { color: var(--sidebar-accent); }

/* Collapsible groups: a toggle button plus a submenu that animates open. */
.nav-group-toggle { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.nav-group-toggle > span { flex: 1; min-width: 0; }
.nav-group-toggle.has-active { color: var(--sidebar-text-active); }
.nav-group-toggle.has-active svg { color: var(--sidebar-accent); }
.nav-group-chevron { width: 16px; height: 16px; color: var(--sidebar-muted); transition: transform var(--transition); }
.nav-group.open .nav-group-chevron { transform: rotate(180deg); }
.nav-submenu {
    display: grid; grid-template-rows: 0fr; visibility: hidden;
    transition: grid-template-rows .2s ease, visibility 0s linear .2s;
}
.nav-group.open .nav-submenu { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .2s ease, visibility 0s; }
.nav-submenu-inner {
    overflow: hidden; min-height: 0;
    margin-left: 1.35rem; padding-left: .7rem;
    border-left: 1px solid var(--sidebar-border);
}
.nav-sublink { gap: .6rem; padding: .42rem .75rem; margin-top: 2px; font-size: .9em; }
.nav-sublink .icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--sidebar-muted); }
.nav-sublink:first-child { margin-top: .2rem; }
.nav-sublink:last-child { margin-bottom: .2rem; }
.nav-sublink.active::before { left: calc(-.7rem - 1px); height: 70%; }
@media (prefers-reduced-motion: reduce) {
    .nav-submenu, .nav-group.open .nav-submenu, .nav-group-chevron { transition: none; }
}

.sidebar-footer { padding: .9rem 1.25rem; border-top: 1px solid var(--sidebar-border); font-size: .75rem; color: var(--sidebar-muted); }

.sidebar-backdrop { display: none; }

/* ---------- Main + top bar ---------- */
.main { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }
.app-standalone .main { margin-left: 0; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--topbar-height);
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1.5rem;
    background: color-mix(in srgb, var(--bg-secondary) 88%, transparent);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--border-color);
}
.topbar-title { font-size: 1.05rem; font-weight: 650; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: .35rem; }

/* Topbar breadcrumb (every page) and greeting (dashboard) */
.breadcrumb ol { display: flex; align-items: center; gap: .15rem; margin: 0; padding: 0; list-style: none; min-width: 0; }
.breadcrumb li { display: flex; align-items: center; gap: .15rem; min-width: 0; flex-shrink: 0; font-size: .9rem; font-weight: 500; }
.breadcrumb a, .breadcrumb-group { display: inline-flex; align-items: center; padding: .3rem .45rem; border-radius: var(--radius-sm); color: var(--text-secondary); white-space: nowrap; }
.breadcrumb a:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.breadcrumb-group { color: var(--text-muted); }
.breadcrumb-home svg.icon { width: 17px; height: 17px; }
.breadcrumb-sep { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-muted); }
.breadcrumb li.breadcrumb-current { flex-shrink: 1; }
.breadcrumb-current span { padding: .3rem .45rem; font-weight: 650; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-greeting { display: flex; align-items: center; gap: .9rem; }
.topbar-greeting p { display: flex; align-items: baseline; gap: .6rem; min-width: 0; margin: 0; overflow: hidden; }
.topbar-greeting strong { font-size: 1.05rem; white-space: nowrap; }
.topbar-date { font-size: .84rem; font-weight: 500; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-date::before { content: "·"; margin-right: .6rem; }
.topbar .topbar-term { flex-shrink: 0; background: var(--bg-tertiary); border-color: transparent; }
/* The dashboard's welcome card shows the term only where the topbar has no room for it. */
.welcome .term-pill { display: none; }
@media (max-width: 1100px) {
    .topbar .topbar-term { display: none; }
    .welcome .term-pill { display: inline-flex; }
}

.icon-button {
    position: relative;
    display: inline-grid; place-items: center;
    width: 38px; height: 38px;
    border: 0; border-radius: 9px;
    background: transparent; color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.icon-button:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-button .count-badge {
    position: absolute; top: 3px; right: 3px;
    min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: 9px; background: var(--danger); color: #fff;
    font-size: .66rem; font-weight: 700; line-height: 17px; text-align: center;
}
.menu-toggle { display: none; }

.user-chip {
    display: flex; align-items: center; gap: .55rem; padding: .25rem .6rem .25rem .25rem;
    border: 1px solid transparent; background: transparent; border-radius: 999px; cursor: pointer; color: var(--text-primary);
    transition: background var(--transition), border-color var(--transition);
}
.user-chip:hover { background: var(--bg-hover); }
.user-chip[aria-expanded="true"] { background: var(--primary-soft); }
.user-chip .avatar { box-shadow: 0 0 0 2px var(--bg-secondary), 0 0 0 3.5px var(--primary); }
.user-chip-chevron { width: 15px; height: 15px; color: var(--text-muted); transition: transform var(--transition); }
.user-chip[aria-expanded="true"] .user-chip-chevron { transform: rotate(180deg); color: var(--primary-text); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--primary-soft); color: var(--primary-text);
    font-weight: 700; font-size: .8rem;
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.user-chip-text { text-align: left; line-height: 1.15; }
.user-chip-text strong { display: block; font-size: .85rem; }
.user-chip-text small { color: var(--text-muted); font-size: .72rem; text-transform: capitalize; }

/* User menu: a profile card under the same ribbon as the sidebar brand, then items with icon tiles. */
.user-menu { width: 288px; padding: 0; overflow: hidden; border-radius: var(--radius-lg); animation: user-menu-in 160ms ease-out; }
@keyframes user-menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.user-menu-card { position: relative; display: grid; justify-items: center; gap: .1rem; padding: 2.1rem 1rem .9rem; text-align: center; }
.user-menu-card::before {
    content: ''; position: absolute; inset: 0 0 auto; height: 64px;
    background: var(--brand-ribbon);
    clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%);
}
.user-menu-role {
    position: absolute; top: .55rem; right: .6rem;
    padding: .12rem .5rem; border-radius: 999px;
    background: var(--brand-ribbon-shadow); color: var(--brand-on-ribbon);
    font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.avatar.user-menu-avatar {
    position: relative; width: 60px; height: 60px; font-size: 1.15rem; overflow: hidden; margin-bottom: .45rem;
    box-shadow: 0 0 0 4px var(--bg-secondary), 0 10px 22px -8px var(--brand-ribbon-shadow);
}
.user-menu-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-menu-name { font-size: .98rem; line-height: 1.25; max-width: 100%; }
.user-menu-email { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; color: var(--text-muted); }

.user-menu-items { display: grid; gap: 2px; padding: .4rem; border-top: 1px solid var(--border-color); }
.dropdown-item.user-menu-item { gap: .7rem; padding: .45rem .55rem; border-radius: var(--radius); }
.user-menu-icon {
    width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center;
    border-radius: 9px; background: var(--bg-tertiary); color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
}
.user-menu-icon .icon { width: 17px; height: 17px; }
.user-menu-label { display: grid; flex: 1; min-width: 0; font-size: .86rem; font-weight: 600; line-height: 1.25; }
.user-menu-label small { font-size: .72rem; font-weight: 400; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-item:hover .user-menu-icon, .user-menu-item[aria-current="page"] .user-menu-icon { background: var(--primary-soft); color: var(--primary-text); }
.user-menu-item[aria-current="page"] { background: var(--bg-hover); }
.user-menu-count {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    background: var(--danger); color: var(--text-inverse);
    font-size: .68rem; font-weight: 700; line-height: 20px; text-align: center;
}
.user-menu-count[hidden] { display: none; }
.user-menu-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.user-menu-dot[hidden] { display: none; }
.user-menu-footer { margin: 0; padding: .4rem; border-top: 1px solid var(--border-color); background: var(--bg-inset); }
/* An administrator who also teaches: Switch to Instructor / Administrator (AuthService::switchRole()). */
.user-menu-switch { margin: 0; padding: .4rem; border-top: 1px solid var(--border-color); }
.user-menu-switch .user-menu-icon { background: var(--info-soft); color: var(--info); }
.dropdown-item.user-menu-signout { color: var(--danger); }
.user-menu-signout .user-menu-icon { background: var(--danger-soft); color: var(--danger); }
.dropdown-item.user-menu-signout:hover { background: var(--danger-soft); }
.user-menu-signout:hover .user-menu-icon { background: var(--danger); color: var(--text-inverse); }
@media (prefers-reduced-motion: reduce) { .user-menu { animation: none; } }

.content { flex: 1; padding: 1.5rem; width: 100%; max-width: 1400px; margin: 0 auto; }

.page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-header h1 { margin-bottom: .2rem; }
.page-header p { margin: 0; color: var(--text-secondary); }
/* Menu icon beside the heading (added by app.js); the heading and its text sit in the second column. */
.page-title { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .9rem; align-items: center; }
.page-title > :not(.page-icon) { grid-column: 2; }
.page-icon {
    grid-row: 1 / span 2; align-self: center;
    width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
    color: var(--primary-text);
    background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--primary-soft) 45%, transparent));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent);
}
.page-icon svg.icon { width: 22px; height: 22px; }
@media (max-width: 480px) { .page-icon { width: 38px; height: 38px; border-radius: 10px; } .page-icon svg.icon { width: 18px; height: 18px; } }
@media print { .page-icon { display: none; } .page-title { display: block; } }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.breadcrumb { font-size: .8rem; color: var(--text-muted); margin-bottom: .35rem; }
.breadcrumb a { color: var(--text-secondary); }

/* ---------- Guest (login) ---------- */
/* Colors come from the global emerald tokens in base.css; only the panel glow is page-specific. */
.guest {
    --focus-ring: 0 0 0 4px rgba(16, 185, 129, 0.22);
    --guest-glow: rgba(16, 185, 129, 0.12);

    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    background: var(--bg-primary);
}
[data-theme="dark"] .guest {
    --focus-ring: 0 0 0 4px rgba(16, 185, 129, 0.26);
    --guest-glow: rgba(16, 185, 129, 0.10);
}

.guest-brand { display: flex; align-items: center; gap: .7rem; font-weight: 650; font-size: 1.02rem; letter-spacing: -.01em; }
.guest-hero .guest-brand { gap: .9rem; font-size: 1.4rem; font-weight: 700; letter-spacing: -.015em; line-height: 1.2; }

/* The logo hangs in the sidebar's ribbon from the top of the split between hero and form. */
.guest-ribbon {
    position: absolute; top: 0; left: 0; z-index: 2;
    width: 88px; height: 150px;
    display: grid; place-items: start center;
    padding-top: 44px;
    translate: -50% 0;
    background: var(--brand-ribbon);
    clip-path: polygon(0 0, 100% 0, 100% 80%, 50% 100%, 0 80%);
    filter: drop-shadow(0 10px 18px var(--brand-ribbon-shadow));
    transition: padding-top var(--transition);
    animation: guest-ribbon-drop 700ms cubic-bezier(.2, .8, .2, 1) both;
}
.guest-ribbon:hover { padding-top: 50px; }
.guest-ribbon .brand-mark { width: 60px; height: 60px; border-radius: 50%; font-size: 1.2rem; box-shadow: 0 6px 16px -4px var(--brand-ribbon-shadow); }
.guest-ribbon .brand-mark:not(.has-image) { background: #032b22; color: var(--brand-letter); }
.guest-ribbon .brand-mark[data-length="3"] { font-size: .95rem; }
.guest-ribbon .brand-mark[data-length="4"] { font-size: .78rem; }
/* A faint seam under the ribbon, fading down the split. */
.guest-panel::before {
    content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 1px;
    background: linear-gradient(180deg, rgba(52, 211, 153, 0.45), rgba(52, 211, 153, 0.08) 45%, transparent);
    pointer-events: none;
}
@keyframes guest-ribbon-drop { from { translate: -50% -100%; } }
@media (prefers-reduced-motion: reduce) {
    .guest-ribbon { animation: none; transition: none; }
    .guest-ribbon:hover { padding-top: 44px; }
}

/* Hero */
.guest-hero {
    position: relative; isolation: isolate; overflow: hidden;
    display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
    padding: clamp(2rem, 4vw, 3.25rem);
    color: var(--hero-text);
    background: var(--hero-bg);
}
.guest-hero::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background-image: radial-gradient(rgba(209, 250, 229, 0.12) 1px, transparent 1px);
    background-size: 24px 24px;
    -webkit-mask-image: radial-gradient(70% 60% at 25% 35%, #000 25%, transparent 80%);
    mask-image: radial-gradient(70% 60% at 25% 35%, #000 25%, transparent 80%);
}
.guest-hero::after {
    content: ""; position: absolute; z-index: -1;
    width: 640px; aspect-ratio: 1; right: -260px; top: -220px; border-radius: 50%;
    border: 1px solid rgba(110, 231, 183, 0.10);
    box-shadow: 0 0 0 80px rgba(110, 231, 183, 0.018), 0 0 0 160px rgba(110, 231, 183, 0.012);
}
.guest-hero-main { max-width: 36rem; animation: guest-rise 700ms cubic-bezier(.2, .8, .2, 1) both; }
/* The neural network drifting behind it all (auth/network.js), in place of the dot grid. */
.guest-network { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; }
.guest-hero.has-network::before { display: none; }

.guest-eyebrow {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .45rem 1.1rem .45rem .5rem; margin-bottom: 1.4rem;
    /* May be wider than the heading (up to the hero width), so long taglines stay on one line when there is room. */
    width: max-content; max-width: calc(52vw - 6.5rem);
    border-radius: 18px; border: 1px solid rgba(110, 231, 183, 0.22);
    background: rgba(16, 185, 129, 0.12); color: #a7f3d0;
    font-size: .95rem; font-weight: 600; letter-spacing: .01em; line-height: 1.35;
}
.guest-eyebrow-dot { width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(52, 211, 153, 0.2); }
.guest-eyebrow-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #34d399; animation: guest-pulse 2.2s ease-out infinite; }
/* The letters that spell the name ("S M A R T"), lit, with a glow running across them now and then. */
.guest-eyebrow-text b { color: #ecfdf5; font-weight: 800; text-shadow: 0 0 8px rgba(52, 211, 153, 0.55); animation: guest-initial 6s ease-in-out 1.2s infinite; }
.guest-eyebrow-text b:nth-of-type(2) { animation-delay: 1.38s; }
.guest-eyebrow-text b:nth-of-type(3) { animation-delay: 1.56s; }
.guest-eyebrow-text b:nth-of-type(4) { animation-delay: 1.74s; }
.guest-eyebrow-text b:nth-of-type(5) { animation-delay: 1.92s; }
.guest-eyebrow-text b:nth-of-type(6) { animation-delay: 2.1s; }

.guest-hero h1 { color: #fff; font-size: clamp(2rem, 3.1vw, 2.85rem); line-height: 1.1; letter-spacing: -.025em; font-weight: 750; margin-bottom: 1rem; }
.guest-hero h1 em {
    font-style: normal; color: #6ee7b7;
    background: linear-gradient(90deg, #a7f3d0, #34d399 55%, #5eead4);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.guest-hero p { color: #a3c9bb; max-width: 32rem; font-size: 1.02rem; line-height: 1.6; margin: 0; }

.guest-hero .feature-list { list-style: none; padding: 0; margin: 1.6rem 0 0; display: grid; gap: .7rem; }
.guest-hero .feature-list li { display: flex; gap: .75rem; align-items: center; color: #d1fae5; font-size: .92rem; }
.feature-icon {
    width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center;
    background: rgba(16, 185, 129, 0.14); border: 1px solid rgba(110, 231, 183, 0.18); color: #6ee7b7;
}
.feature-icon svg.icon { width: 16px; height: 16px; }

/* Decorative dashboard preview (the hero is aria-hidden) */
.guest-preview { position: relative; margin: 2.25rem 0 3.1rem; max-width: 25rem; padding-right: 2.5rem; }
.preview-card {
    border-radius: 16px; padding: 1rem 1.1rem;
    background: linear-gradient(160deg, rgba(236, 253, 245, 0.10), rgba(236, 253, 245, 0.04));
    border: 1px solid rgba(167, 243, 208, 0.16);
    box-shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px);
}
.preview-card strong { display: block; color: #fff; font-size: .86rem; font-weight: 650; }
.preview-card small { display: block; color: #8fb8a8; font-size: .74rem; }
.preview-head { display: flex; align-items: center; gap: .7rem; }
.preview-icon { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; background: linear-gradient(135deg, #34d399, #059669); color: #022c22; }
.preview-icon svg.icon { width: 17px; height: 17px; }
.preview-badge { padding: .2rem .55rem; border-radius: 999px; background: rgba(52, 211, 153, 0.16); color: #6ee7b7; font-size: .7rem; font-weight: 650; white-space: nowrap; }
.preview-bar { height: 6px; margin: .95rem 0; border-radius: 99px; background: rgba(236, 253, 245, 0.1); overflow: hidden; }
.preview-bar span { display: block; width: 72%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #10b981, #6ee7b7); animation: guest-fill 1.4s cubic-bezier(.2, .8, .2, 1) 300ms both; }
.preview-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.preview-stats span { padding: .5rem .6rem; border-radius: 10px; background: rgba(236, 253, 245, 0.05); }
.preview-stats strong { font-size: 1rem; }
/* What the LMS keeps you told of, one at a time in the same place (auth/login.js turns them), a light sweeping across as each comes. */
.preview-insights {
    position: absolute; right: 0; bottom: -3.1rem; overflow: hidden;
    min-width: 17.5rem; padding: .6rem .9rem .6rem .6rem;
    background: rgba(2, 30, 23, 0.82); border-radius: 14px;
    animation: guest-float 6s ease-in-out 1s infinite;
}
.preview-insights ul { list-style: none; margin: 0; padding: 0; display: grid; }
.preview-insights li {
    grid-area: 1 / 1; display: flex; align-items: center; gap: .65rem;
    opacity: 0; transform: translateY(8px); transition: opacity 450ms ease, transform 450ms ease;
}
.preview-insights li.is-active { opacity: 1; transform: none; }
.preview-insights li.is-leaving { opacity: 0; transform: translateY(-8px); }
.preview-insights .preview-icon { width: 30px; height: 30px; border-radius: 50%; }
.preview-insights::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(100deg, transparent 30%, rgba(167, 243, 208, 0.16) 50%, transparent 70%);
    transform: translateX(-100%); animation: guest-sweep 3.6s ease-in-out infinite;
}

.guest-copy { color: #6f9c8b; font-size: .78rem; }

/* Form panel */
.guest-panel {
    position: relative; display: grid; place-items: center;
    padding: 5rem 1.5rem 3rem;
    background: radial-gradient(60% 45% at 50% 0%, var(--guest-glow), transparent 70%), var(--bg-primary);
}
.guest-theme { position: absolute; top: 1.25rem; right: 1.25rem; }
.guest-card { width: 100%; max-width: 400px; animation: guest-rise 600ms cubic-bezier(.2, .8, .2, 1) 80ms both; }
.guest-brand-mobile { display: none; color: var(--text-primary); margin-bottom: 2rem; }
.guest-card-head { margin-bottom: 1.75rem; }
.guest-card-head h2 { font-size: 1.9rem; letter-spacing: -.025em; font-weight: 750; margin-bottom: .35rem; }
.guest-card-head p { margin: 0; color: var(--text-secondary); }

.guest-form { display: grid; gap: 1.1rem; }
.guest .field { gap: .4rem; }
.guest .field label { color: var(--text-primary); }
.guest .input { height: 48px; border-radius: 12px; padding-inline: .9rem; }
.guest .input:hover:not(:focus):not([aria-invalid="true"]) { border-color: color-mix(in srgb, var(--primary) 35%, var(--border-strong)); }
.guest .input-group > svg { left: .9rem; transition: color var(--transition); }
.guest .input-group:focus-within > svg { color: var(--primary); }
.guest .input-group .input { padding-left: 2.6rem; }
.guest .input-group.has-toggle .input { padding-right: 3rem; }

/* Error states */
.guest .input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 12%, transparent); }
.guest .input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 22%, transparent); }
.guest .input-group:has(.input[aria-invalid="true"]) > svg { color: var(--danger); }
.guest .field-error:not(:empty) { animation: guest-error-in 200ms ease both; }

.guest-form-error {
    display: flex; gap: .6rem; align-items: flex-start;
    margin: 0; padding: .7rem .85rem;
    border-radius: 12px; border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
    background: var(--danger-soft); color: var(--text-primary);
    font-size: .85rem; line-height: 1.45;
    animation: guest-error-in 240ms ease both;
}
.guest-form-error svg.icon { width: 17px; height: 17px; margin-top: 1px; color: var(--danger); }

.caps-hint { display: flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 600; color: var(--warning); animation: guest-error-in 200ms ease both; }
.caps-hint svg.icon { width: 14px; height: 14px; }

.guest-form.shake .field { animation: guest-shake 420ms cubic-bezier(.36, .07, .19, .97) both; }

/* Keep browser autofill on the theme's input colors instead of the browser's pale fill. */
.guest .input:-webkit-autofill,
.guest .input:-webkit-autofill:hover {
    -webkit-text-fill-color: var(--text-primary);
    caret-color: var(--text-primary);
    box-shadow: 0 0 0 100px var(--bg-secondary) inset;
    transition: background-color 100000s ease 0s;
}
.guest .input:-webkit-autofill:focus { box-shadow: 0 0 0 100px var(--bg-secondary) inset, var(--focus-ring); }
.guest .input[aria-invalid="true"]:-webkit-autofill { box-shadow: 0 0 0 100px var(--bg-secondary) inset, 0 0 0 4px color-mix(in srgb, var(--danger) 12%, transparent); }

.password-toggle {
    position: absolute; right: .4rem; top: 50%; transform: translateY(-50%);
    width: 38px; height: 38px; border: 0; border-radius: 9px;
    display: grid; place-items: center;
    background: transparent; color: var(--text-muted); cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.input-group .password-toggle svg.icon { position: static; transform: none; }
.password-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.password-toggle.is-active { color: var(--primary); }
.password-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Gradients can't be transitioned, so the hover shade is a pseudo-element that fades in
   instead of swapping the background (which made the button blink). */
.btn-primary.guest-submit,
.btn-primary.guest-submit:hover:not(:disabled) {
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 85%, #fff), var(--primary));
}
.btn-primary.guest-submit {
    position: relative; isolation: isolate; overflow: hidden;
    height: 50px; margin-top: .35rem; border-radius: 12px;
    font-size: .98rem; font-weight: 650;
    color: var(--on-primary);
    box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--primary) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: transform 200ms ease, box-shadow 300ms ease, opacity 300ms ease;
}
.btn-primary.guest-submit::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary-hover) 85%, #fff), var(--primary-hover));
    opacity: 0;
    transition: opacity 300ms ease;
}
.btn-primary.guest-submit:hover:not(:disabled) { box-shadow: 0 14px 28px -10px color-mix(in srgb, var(--primary) 85%, transparent); }
.btn-primary.guest-submit:hover:not(:disabled)::before { opacity: 1; }
.btn-primary.guest-submit:disabled { opacity: .85; cursor: progress; }
.guest-submit:active:not(:disabled) { transform: translateY(1px); }
.guest-submit:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.guest-submit svg.icon { transition: transform 250ms ease; }
.guest-submit:hover:not(:disabled) svg.icon { transform: translateX(3px); }
.guest-submit .spinner { width: 18px; height: 18px; border-width: 2px; border-color: color-mix(in srgb, var(--on-primary) 30%, transparent); border-top-color: var(--on-primary); }

.guest-help {
    display: flex; gap: .65rem; align-items: flex-start;
    margin: 1.75rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--border-color);
    color: var(--text-muted); font-size: .82rem; line-height: 1.5;
}
.guest-help svg.icon { width: 16px; height: 16px; margin-top: 2px; color: var(--primary-text); }
/* "First time here?" (auth/setup.js): the link under the sign-in button, and the email shown once set up. */
.guest-first { margin: 1.1rem 0 0; text-align: center; color: var(--text-secondary); font-size: .9rem; }
.guest-form .guest-first { margin: 0; }
.guest-link { padding: 0; border: 0; background: none; color: var(--primary-text); font: inherit; font-weight: 600; cursor: pointer; }
.guest-link:hover { text-decoration: underline; }
.guest-link:focus-visible { outline: none; border-radius: 4px; box-shadow: var(--focus-ring); }
.guest-done { display: grid; gap: 1rem; }
.guest-done p { margin: 0; color: var(--text-secondary); }
.guest-done .guest-done-email {
    padding: .9rem 1rem; border: 1px solid var(--border-color); border-radius: var(--radius); background: var(--bg-inset);
    color: var(--text-primary); font-family: var(--font-mono); font-size: 1rem; font-weight: 600; text-align: center; overflow-wrap: anywhere;
}
/* To the Download page. */
.guest-apps {
    display: flex; align-items: center; gap: .55rem; margin-top: .9rem; padding: .7rem .85rem;
    border-radius: var(--radius); border: 1px solid var(--border-color); background: var(--bg-inset);
    color: var(--text-primary); font-size: .84rem; font-weight: 600;
}
.guest-apps:hover { border-color: var(--primary); text-decoration: none; }
.guest-apps span { flex: 1; }
.guest-apps svg.icon { width: 16px; height: 16px; color: var(--primary-text); flex-shrink: 0; }
.guest-copy-mobile { display: none; position: absolute; bottom: 1.25rem; left: 0; right: 0; text-align: center; color: var(--text-muted); }

@keyframes guest-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes guest-fill { from { width: 0; } }
@keyframes guest-error-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes guest-shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(3px); }
    30%, 50%, 70% { transform: translateX(-5px); }
    40%, 60% { transform: translateX(5px); }
}
@keyframes guest-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes guest-pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); } 80%, 100% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } }
@keyframes guest-initial { 0%, 9%, 100% { color: #ecfdf5; } 4% { color: #fff; text-shadow: 0 0 14px rgba(52, 211, 153, 1), 0 0 3px #fff; } }
@keyframes guest-sweep { 0% { transform: translateX(-100%); } 30%, 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
    .guest-eyebrow-text b, .preview-insights, .preview-insights::after { animation: none; }
}

/* ---------- Minimal (errors) ---------- */
.minimal { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 35; }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-grid; }
}

@media (max-height: 820px) {
    /* A short screen keeps only the insights, under the features. */
    .guest-preview { margin: 1.6rem 0 0; padding-right: 0; }
    .guest-preview .preview-card:not(.preview-insights) { display: none; }
    .preview-insights { position: relative; right: auto; bottom: auto; display: inline-block; }
}
@media (max-height: 640px) {
    .guest-preview { display: none; }
}

/* A phone has no hero: the network goes behind the top of the page, and the tagline's letters under the name. */
.guest-panel-network, .guest-letters { display: none; }
@keyframes guest-tile {
    0%, 9%, 100% { transform: none; box-shadow: none; }
    4% { transform: translateY(-3px); box-shadow: 0 0 14px color-mix(in srgb, var(--primary) 55%, transparent); }
}

@media (max-width: 860px) {
    .guest { grid-template-columns: 1fr; }
    .guest-hero, .guest-panel::before { display: none; }
    .guest-panel { isolation: isolate; }
    .guest-panel-network { display: block; position: absolute; top: 0; left: 0; z-index: -1; width: 100%; height: 24rem; pointer-events: none; }
    .guest-letters { display: flex; justify-content: center; margin: -1rem 0 1.75rem; color: var(--text-muted); font-size: .85rem; text-align: center; }
    .guest-letters .brand-letters { gap: 6px; margin: 0; }
    .guest-letters .brand-letters b {
        width: 28px; height: 28px; border-radius: 8px; font-size: .82rem;
        background: color-mix(in srgb, var(--primary) 14%, var(--bg-primary)); /* solid: the network stays behind it */
        border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
        color: var(--primary-text);
        animation: guest-tile 6s ease-in-out 1.2s infinite;
    }
    .guest-letters .brand-letters b:nth-child(2) { animation-delay: 1.38s; }
    .guest-letters .brand-letters b:nth-child(3) { animation-delay: 1.56s; }
    .guest-letters .brand-letters b:nth-child(4) { animation-delay: 1.74s; }
    .guest-letters .brand-letters b:nth-child(5) { animation-delay: 1.92s; }
    .guest-letters .brand-letters b:nth-child(6) { animation-delay: 2.1s; }
    /* No split on one column: the ribbon hangs from the top center and holds the logo instead of the brand row. */
    .guest-ribbon { left: 50%; width: 72px; height: 118px; padding-top: 22px; }
    .guest-ribbon:hover { padding-top: 27px; }
    .guest-ribbon .brand-mark { width: 50px; height: 50px; font-size: 1rem; }
    .guest-brand-mobile { display: flex; justify-content: center; text-align: center; margin-bottom: 1.75rem; }
    .guest-brand-mobile .brand-mark { display: none; }
    .guest-copy-mobile { display: block; }
    .guest-panel { padding-block: 8.25rem 4rem; }
}
@media (max-width: 860px) and (prefers-reduced-motion: reduce) {
    .guest-ribbon:hover { padding-top: 22px; }
    .guest-letters .brand-letters b { animation: none; }
}

@media (max-width: 640px) {
    .content { padding: 1rem; }
    .topbar { padding: 0 .75rem; }
    .user-chip-text { display: none; }
    .breadcrumb li:not(:first-child):not(.breadcrumb-current) { display: none; }
    .topbar-date { display: none; }
    .page-header { flex-direction: column; align-items: stretch; }
}
