/* ── 侧栏业务导航 ─────────────────────────────────── */
.app-shell {
    display: grid;
    grid-template-columns: 208px minmax(0, 1fr);
    min-height: calc(100vh - 52px);
}
.app-sidebar {
    position: sticky;
    top: 0;
    z-index: 45;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 14px 10px;
    overflow-y: auto;
    background: var(--surface);
    border-right: 1px solid var(--border);
}
.app-sidebar__brand { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; padding: 2px 6px; }
.app-sidebar__brand-name { color: var(--text); font-size: 1rem; font-weight: 700; letter-spacing: .04em; }
.app-sidebar__brand-subtitle { margin-top: 3px; color: var(--text-dim); font-size: .72rem; white-space: nowrap; }
.app-sidebar__collapse { width: 26px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: 5px; background: transparent; color: var(--text-dim); cursor: pointer; font-size: 1.25rem; line-height: 1; }
.app-sidebar__collapse:hover { background: var(--surface-hover); color: var(--text); }
.module-nav {
    display: grid;
    gap: 4px;
    width: auto;
    margin: 18px 0 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    position: static;
}
.module-nav__btn {
    position: relative;
    display: flex;
    flex: 1;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}
.module-nav__icon { display: inline-grid; width: 18px; place-items: center; color: currentColor; font-size: 1rem; }
.module-nav__btn:hover { color: var(--text); background: var(--surface-hover); }
.module-nav__btn--active,
.module-nav__btn--active:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); box-shadow: inset 3px 0 0 var(--accent); }
.app-sidebar__auth { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.recent-work { margin-top: auto; padding: 14px 4px 0; border-top: 1px solid var(--border); }
.recent-work__title { margin-bottom: 7px; color: var(--text-dim); font-size: .72rem; font-weight: 600; }
.recent-work__list { display: grid; gap: 2px; }
.recent-work__list button { overflow: hidden; padding: 6px; border: 0; border-radius: 4px; background: transparent; color: var(--text-dim); cursor: pointer; font: inherit; font-size: .78rem; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.recent-work__list button:hover { color: var(--text); background: var(--surface-hover); }
.recent-work__list span { padding: 5px 6px; color: var(--text-dim); font-size: .75rem; }
.app-main { min-width: 0; width: 100%; max-width: none; min-height: 100vh; margin: 0; padding: 14px 18px 28px; box-sizing: border-box; }
.app-main .workspace-tabs { margin: 0 0 10px; }
.mobile-module-nav,
.mobile-more-sheet { display: none; }
.workspace-tab { min-width: max-content; max-width: none; }
.workspace-tab__activate { max-width: none; }
.sidebar--collapsed .app-shell { grid-template-columns: 56px minmax(0, 1fr); }
.sidebar--collapsed .app-sidebar { padding: 14px 8px; overflow: visible; }
.sidebar--collapsed .app-sidebar__brand-name,
.sidebar--collapsed .app-sidebar__brand-subtitle,
.sidebar--collapsed .module-nav__label,
.sidebar--collapsed .recent-work { display: none; }
.sidebar--collapsed .app-sidebar__brand { justify-content: center; }
.sidebar--collapsed .module-nav__btn { justify-content: center; padding: 0; }
.sidebar--collapsed .app-sidebar__auth .module-nav__btn { justify-content: center; }
.sidebar--collapsed .app-sidebar__collapse { position: absolute; top: 14px; right: -12px; background: var(--surface); }
@media (min-width: 768px) and (max-width: 1099px) {
    body:not(.sidebar--user-expanded) .app-shell { grid-template-columns: 56px minmax(0, 1fr); }
    body:not(.sidebar--user-expanded) .app-sidebar__brand-name,
    body:not(.sidebar--user-expanded) .app-sidebar__brand-subtitle,
    body:not(.sidebar--user-expanded) .module-nav__label,
    body:not(.sidebar--user-expanded) .recent-work { display: none; }
    body:not(.sidebar--user-expanded) .module-nav__btn { justify-content: center; padding: 0; }
}
@media (max-width: 767px) {
    .header { position: sticky; top: 0; z-index: 85; }
    .app-shell { display: block; min-height: 0; }
    .app-sidebar { display: none; }
    .app-main { width: 100%; max-width: none; min-height: calc(100dvh - 58px); margin: 0; padding: 8px 10px calc(76px + env(safe-area-inset-bottom)); }
    .app-main { overflow-x: clip; }
    .app-main .workspace-tabs { margin-bottom: 8px; }
    #section-stock .inv-table-wrap { max-width: 100%; overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; }
    .mobile-module-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 100; display: grid; grid-template-columns: repeat(5, 1fr); height: 58px; padding: 5px 4px env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0,0,0,.08); }
    .mobile-module-nav button { border: 0; border-radius: 5px; background: transparent; color: var(--text-dim); cursor: pointer; font: inherit; font-size: .75rem; }
    .mobile-module-nav button:hover,
    .mobile-module-nav__btn--active { color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
    .mobile-more-sheet { position: fixed; inset: 0; z-index: 99; padding: 0 10px 68px; background: rgba(0,0,0,.18); }
    .mobile-more-sheet:not([hidden]) { display: flex; align-items: flex-end; }
    .mobile-more-sheet__panel { display: grid; width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: 0 14px 34px rgba(0,0,0,.18); }
    .mobile-more-sheet__title { padding: 4px 6px 8px; color: var(--text-dim); font-size: .78rem; font-weight: 600; }
    .mobile-more-sheet__panel button { min-height: 38px; padding: 0 8px; border: 0; border-radius: 5px; background: transparent; color: var(--text); cursor: pointer; font: inherit; text-align: left; }
    .mobile-more-sheet__panel button:hover { background: var(--surface-hover); }
}
