/* ==========================================================================
   Shell – HALO top bar, icon rail, sign-in.
   ========================================================================== */

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Top bar (HALO .hf-top) ---------- */

.topbar {
    position: sticky; top: 0; z-index: 30;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
    height: 79px;
    padding: 0 27px;
    background: linear-gradient(180deg, #fff, var(--face-2));
    border-bottom: 1px solid #dedfe7;
}

.topbar-left { display: flex; align-items: center; gap: 22px; min-width: 0; }

.brand { display: inline-flex; align-items: center; gap: 13px; color: var(--ink); text-decoration: none; flex: none; }
.brand-name { font: 500 22px/1 var(--font-display); letter-spacing: 0.22em; text-transform: uppercase; }
.brand-mark {
    position: relative; flex: none; width: 31px; height: 31px;
    border: 1px solid #b9b4ca; border-radius: 50%;
    display: grid; place-items: center;
    box-shadow: 0 1px 1px #fff, inset 0 1px 3px #a8a6bb30;
}
.brand-mark::before {
    content: ""; width: 20px; height: 20px; border-radius: 50%;
    border: 4px solid var(--accent); border-right-color: var(--accent-light);
    transform: rotate(-35deg);
}
.brand-mark::after { content: ""; position: absolute; width: 4px; height: 4px; right: 2px; top: 3px; border-radius: 50%; background: var(--face-2); }

/* Project switcher */
.switcher { position: relative; min-width: 0; }
.switcher > summary {
    list-style: none; display: flex; align-items: center; gap: 8px;
    max-width: 280px; padding: 6px 10px; border: 1px solid transparent; border-radius: var(--radius-sm);
    cursor: pointer; color: var(--ink-2); font-size: var(--text-sm);
    transition: background-color 140ms, border-color 140ms;
}
.switcher > summary::-webkit-details-marker { display: none; }
.switcher > summary:hover, .switcher[open] > summary { background: var(--face); border-color: var(--plate); }
.switcher-current { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-current.is-placeholder { color: var(--ink-3); }
.switcher .icon { color: var(--ink-4); }

.menu {
    position: absolute; top: calc(100% + 8px); left: 0; z-index: 40;
    min-width: 280px; max-width: min(360px, 90vw); max-height: min(420px, 70vh); overflow-y: auto;
    padding: 6px;
    background: var(--face); border: 1px solid var(--plate); border-radius: var(--radius);
    box-shadow: 0 18px 40px -12px #252c4b2e, 0 2px 6px #252c4b0d;
}
.menu-right { left: auto; right: 0; min-width: 220px; }
.menu-label { display: block; padding: 8px 10px 6px; }
.menu a, .menu button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: transparent;
    color: var(--ink-2); font: 400 var(--text-sm)/1.3 var(--font-ui); text-align: left; text-decoration: none; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--panel); color: var(--ink); }
.menu a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); }
.menu .menu-sub { display: block; color: var(--ink-3); font-size: var(--text-xs); }
.menu .pip { flex: none; }
.menu hr { border: 0; height: 1px; background: var(--plate-2); margin: 6px 4px; }
.menu form { margin: 0; }
.menu-filter { padding: 4px 4px 6px; }
.menu-filter input {
    width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--plate); border-radius: var(--radius-sm);
    font: inherit; font-size: var(--text-sm); color: var(--ink); background: var(--face-2); outline: none;
}
.menu-filter input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-dim); }
.menu-empty { padding: 8px 10px; color: var(--ink-3); font-size: var(--text-sm); }

/* Top navigation (HALO .hf-topnav) */
.topnav { display: flex; align-self: stretch; justify-content: center; gap: 25px; min-width: 0; font-size: 12px; }
.topnav a, .topnav span {
    position: relative; display: flex; align-items: center; gap: 5px; padding: 0 2px;
    color: #6f7180; text-decoration: none; white-space: nowrap;
}
.topnav a:hover { color: var(--ink); }
.topnav a.active { color: #2c2b36; }
.topnav a.active::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
    background: var(--accent); border-radius: 3px 3px 0 0;
    box-shadow: 0 -3px 12px var(--accent-dim);
}
.topnav .is-locked { color: #a3a5b1; cursor: not-allowed; }
.topnav .is-locked .icon { width: 11px; height: 11px; }

/* Profile */
.profile { display: flex; align-items: center; gap: 13px; }
.profile .tag { white-space: nowrap; }
.profile-menu { position: relative; }
.profile-menu > summary { list-style: none; cursor: pointer; border-radius: 50%; }
.profile-menu > summary::-webkit-details-marker { display: none; }
.avatar {
    width: 31px; height: 31px; border: 1px solid #dbdde7; border-radius: 50%;
    background: linear-gradient(135deg, #fff, #e7e8f1);
    display: grid; place-items: center; font-size: 10px; color: var(--ink-2);
    box-shadow: 0 2px 4px #3c3b4f06;
}
.profile-menu[open] .avatar, .profile-menu > summary:hover .avatar { border-color: var(--accent-line); }
.profile-head { padding: 8px 10px; }
.profile-head strong { display: block; font-weight: 500; color: var(--ink); font-size: var(--text-sm); }
.profile-head span { color: var(--ink-3); font-size: var(--text-xs); }

/* ---------- Body: rail + main (HALO .hf-shell) ---------- */

.app-body {
    flex: 1; display: grid; grid-template-columns: 67px minmax(0, 1fr);
    /* The rail column keeps its tint below the sticky rail on long pages. */
    background: linear-gradient(90deg, #f3f4f7 66px, #e0e2e9 66px 67px, transparent 67px);
}

.rail {
    position: sticky; top: 79px; align-self: start; height: calc(100vh - 79px);
    z-index: 20; /* above the page content, so rail tooltips aren't covered by the deck */
    display: flex; flex-direction: column; align-items: center; gap: 22px;
    padding: 26px 0;
    border-right: 1px solid #e0e2e9;
    background: linear-gradient(90deg, #f6f7f9, #f0f1f5);
}
.rail a {
    position: relative; width: 34px; height: 34px; display: grid; place-items: center;
    color: #858897; border-radius: 10px; transition: color 140ms, background-color 140ms;
}
.rail a:hover { color: var(--ink); background: #fff; }
.rail a.active { background: #fff; color: var(--accent); box-shadow: 0 2px 4px #252c4b0a, inset 0 0 0 1px #e3e0ef; }
.rail a .icon { width: 17px; height: 17px; }
.rail .rail-end { margin-top: auto; }

/* Tooltip label for icon-only rail links */
.rail a[data-label]:hover::after, .rail a[data-label]:focus-visible::after {
    content: attr(data-label); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    padding: 5px 8px; border-radius: var(--radius-sm); background: #292733; color: #fff;
    font-size: var(--text-xs); white-space: nowrap; pointer-events: none; z-index: 50;
}

.main {
    min-width: 0;
    background: radial-gradient(ellipse at 29% 28%, color-mix(in oklab, var(--accent) 7%, transparent) 0, transparent 48%);
}

/* Module strip under the top bar (replaces the top nav under 1080px) */
.modnav {
    display: none; gap: 20px; overflow-x: auto; scrollbar-width: none;
    padding: 0 20px; height: 44px; border-bottom: 1px solid #e0e2e9; background: var(--face-2);
}
.modnav::-webkit-scrollbar { display: none; }
.modnav a, .modnav span { position: relative; display: flex; align-items: center; gap: 5px; font-size: 12px; color: #6f7180; text-decoration: none; white-space: nowrap; }
.modnav a.active { color: #2c2b36; }
.modnav a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); border-radius: 3px 3px 0 0; }
.modnav .is-locked { color: #a3a5b1; }

/* Nine modules next to the brand, project switcher and profile: tighten before anything collides. */
@media (max-width: 1440px) {
    .topnav { gap: 18px; }
    .topbar-left { gap: 16px; }
    .brand-name { font-size: 18px; letter-spacing: 0.16em; }
}

@media (max-width: 1280px) {
    .brand-name { display: none; }
    .profile .tag { display: none; }
}

@media (max-width: 1080px) {
    .topbar { grid-template-columns: minmax(0, 1fr) auto; }
    .topnav { display: none; }
    .modnav { display: flex; }
    .brand-name { display: inline; }
}

@media (max-width: 860px) {
    .topbar { padding: 0 20px; gap: 15px; }
    .app-body { grid-template-columns: 54px minmax(0, 1fr); background: linear-gradient(90deg, #f3f4f7 53px, #e0e2e9 53px 54px, transparent 54px); }
}

@media (max-width: 680px) {
    .topbar { height: 68px; padding: 0 17px; }
    .rail { display: none; }
    .app-body { grid-template-columns: minmax(0, 1fr); background: none; }
    .brand-name { font-size: 18px; letter-spacing: 0.16em; }
    .switcher > summary { max-width: 42vw; }
}

@media (max-width: 420px) {
    .brand-name { display: none; }
}

/* ---------- Sign-in ---------- */

.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
    background: var(--panel);
}
.auth-panel {
    display: flex; flex-direction: column;
    padding: 36px 44px;
    background: linear-gradient(180deg, #fff, var(--face-2));
    border-right: 1px solid #dedfe7;
}
.auth-body { flex: 1; display: grid; align-content: center; padding: var(--s-12) 0; }
.auth-body h1 { font: 400 var(--text-3xl)/1.15 var(--font-display); letter-spacing: -0.047em; }
.auth-body h1::after { content: "."; color: var(--accent); }
.auth-body .lede { margin-top: var(--s-3); color: var(--ink-3); max-width: 36ch; }
.auth-body .form { margin-top: var(--s-8); }
.auth-body .auth-links { margin-top: var(--s-6); font-size: var(--text-sm); color: var(--ink-3); }
.auth-sender { font: 400 var(--text-2xs) var(--font-mono); letter-spacing: var(--tracking-mono); text-transform: uppercase; color: var(--ink-3); }

.auth-visual {
    display: grid; place-items: center; padding: 48px;
    background: radial-gradient(ellipse at 45% 40%, color-mix(in oklab, var(--accent) 9%, transparent) 0, transparent 55%), var(--panel);
}
.auth-visual .deck { width: min(520px, 100%); padding: 48px 40px 36px; }

@media (max-width: 860px) {
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth-panel { padding: 24px 20px; border-right: 0; min-height: 100vh; }
    .auth-visual { display: none; }
}
