/* Shell: left nav rail + top bar + content column. */

.shell {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    min-height: 100vh;
}

/* ---- nav rail ---------------------------------------------------------- */
.rail {
    position: sticky; top: 0;
    height: 100vh;
    display: flex; flex-direction: column;
    background: var(--rail);
    border-right: 1px solid var(--line);
    overflow-y: auto;
    z-index: 30;
}
.wordmark {
    display: flex; align-items: center; gap: 11px;
    padding: 16px 18px 15px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
}
.wordmark:hover { color: var(--ink); }
.wordmark svg { flex: none; }
.wordmark-text { display: flex; flex-direction: column; line-height: 1.1; }
.wordmark-hta { font-weight: 700; font-size: 17px; letter-spacing: 0.16em; }
.wordmark-sub { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.22em; color: var(--ink-3); margin-top: 3px; }

.nav { padding: 10px 10px 16px; flex: 1; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 4px; }
.nav-label {
    padding: 0 10px 6px;
    font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.2em;
    color: var(--ink-4);
}
.nav a {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    height: 31px; padding: 0 10px;
    border-radius: var(--r-2);
    color: var(--ink-2);
    font-weight: 500; font-size: 13px;
}
.nav a svg { flex: none; width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.8; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--surface-2); color: var(--ink); }
.nav a.active::before {
    content: ''; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px;
    border-radius: 0 2px 2px 0; background: var(--accent);
}
.nav a.active svg { opacity: 1; color: var(--accent); }
.nav-count {
    margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px;
    display: inline-grid; place-items: center;
    border-radius: 9px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
    background: var(--crit-wash); color: #ff9b9e; border: 1px solid rgba(229, 72, 77, 0.35);
}
.nav-count.warn { background: var(--warn-wash); color: var(--warn); border-color: rgba(240, 196, 25, 0.3); }

.rail-foot { border-top: 1px solid var(--line); padding: 10px; }
.me {
    display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-2);
}
.me:hover { background: var(--surface-2); }
.me-avatar {
    width: 28px; height: 28px; flex: none; border-radius: 6px;
    display: grid; place-items: center;
    background: var(--surface-3); border: 1px solid var(--line-2);
    font-family: var(--font-mono); font-weight: 600; font-size: 11px; color: var(--ink-2);
}
.me-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; color: var(--accent); }

/* ---- main column ------------------------------------------------------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20;
    height: var(--top-h);
    display: flex; align-items: center; gap: 14px;
    padding: 0 24px;
    background: rgba(7, 9, 13, 0.86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--ink-4); }
.crumbs .here { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.clock { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.04em; white-space: nowrap; }
.clock b { color: var(--ink-2); font-weight: 500; }
.env-chip {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; padding: 3px 7px;
    border-radius: 3px; border: 1px solid var(--line-2); color: var(--ink-3);
}
.env-chip.prod { color: var(--crit); border-color: rgba(229, 72, 77, 0.45); }

.content { padding: 22px 24px 60px; min-width: 0; }
.content.refreshing { opacity: 0.55; transition: opacity 0.15s; }

.page-head {
    display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
    margin-bottom: 18px;
}
.page-head h1 { font-size: 20px; line-height: 1.2; }
.page-kicker { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.18em; color: var(--ink-3); margin-bottom: 5px; }
.page-sub { color: var(--ink-3); margin-top: 4px; font-size: 12.5px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.scrim { display: none; }

/* ---- login -------------------------------------------------------------- */
.login {
    min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
    background:
        radial-gradient(1200px 500px at 50% -10%, rgba(57, 135, 229, 0.07), transparent 60%),
        var(--bg);
}
.login-card {
    width: 100%; max-width: 400px;
    background: var(--surface-1);
    border: 1px solid var(--line-2);
    border-radius: var(--r-3);
    padding: 28px 28px 24px;
    box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
}
.login-card.wide { max-width: 520px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .wordmark-hta { font-size: 19px; }
.login-title { font-size: 15px; margin-bottom: 4px; }
.login-note { color: var(--ink-3); font-size: 12.5px; margin-bottom: 18px; }
.login-foot {
    margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line);
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; color: var(--ink-4);
    display: flex; justify-content: space-between; gap: 10px;
}

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 960px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .rail {
        position: fixed; left: 0; top: 0; bottom: 0; width: 260px;
        transform: translateX(-102%); transition: transform 0.18s ease;
        box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5);
    }
    .shell.nav-open .rail { transform: none; }
    .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 25; }
    .menu-btn { display: inline-grid; }
    .topbar { padding: 0 16px; gap: 10px; }
    .content { padding: 18px 16px 50px; }
    .clock .clock-date { display: none; }
}
@media (max-width: 560px) {
    .clock, .env-chip { display: none; }
    .page-actions { margin-left: 0; width: 100%; }
}
