:root {
    --lf-nav-width: 64px;
    --lf-nav-bg: #070708;
    --lf-nav-border: rgba(255, 255, 255, 0.08);
    --lf-nav-text: rgba(255, 255, 255, 0.52);
    --lf-nav-text-strong: #f5f5f5;
    --lf-nav-accent: #d7b56d;
    --lf-nav-accent-strong: #b8893f;
    --lf-nav-hover: rgba(255, 255, 255, 0.06);
    --lf-nav-active: rgba(184, 137, 63, 0.11);
}

/* 使用全局导航的页面不再显示旧主题脚本动态注入的 MioFlow 侧栏。 */
.mio-global-nav {
    display: none !important;
}

.sidebar[data-global-nav] {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    z-index: 1000 !important;
    width: var(--lf-nav-width) !important;
    height: 100vh !important;
    min-height: 0 !important;
    flex: 0 0 var(--lf-nav-width) !important;
    padding: 12px 8px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0 !important;
    overflow: hidden !important;
    background: var(--lf-nav-bg) !important;
    border: 0 !important;
    border-right: 1px solid var(--lf-nav-border) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.sidebar[data-global-nav]::before,
.sidebar[data-global-nav]::after {
    display: none !important;
    content: none !important;
}

.lf-global-nav__brand {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    margin: 0 0 14px;
    padding: 4px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 11px;
    background: transparent;
    transition: background 0.18s ease;
}

.lf-global-nav__brand:hover {
    background: var(--lf-nav-hover);
}

.lf-global-nav__brand img {
    width: 32px;
    height: 32px;
    display: block;
    object-fit: contain;
}

.lf-global-nav__menu {
    width: 100%;
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
}

.lf-global-nav__menu::-webkit-scrollbar {
    display: none;
}

.lf-global-nav__item {
    position: relative;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--lf-nav-text);
    text-decoration: none;
    border-radius: 10px;
    transition: color 0.16s ease, background 0.16s ease;
}

.lf-global-nav__item:hover {
    color: var(--lf-nav-text-strong);
    background: var(--lf-nav-hover);
}

.lf-global-nav__item.is-active {
    color: var(--lf-nav-accent);
    background: var(--lf-nav-active);
}

.lf-global-nav__item.is-active::before {
    content: "";
    position: absolute;
    left: -8px;
    top: 14px;
    width: 2px;
    height: 20px;
    border-radius: 0 2px 2px 0;
    background: var(--lf-nav-accent-strong);
    box-shadow: 0 0 10px rgba(184, 137, 63, 0.38);
}

.lf-global-nav__icon {
    width: 19px;
    height: 19px;
    display: block;
}

.lf-global-nav__label {
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
}

.lf-global-nav__footer {
    width: 100%;
    flex: 0 0 auto;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.lf-global-nav__workspace {
    position: relative;
    width: 34px;
    height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
    color: #f4e6bd;
    border: 1px solid rgba(215, 181, 109, 0.42);
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(215, 181, 109, 0.18), rgba(184, 137, 63, 0.08));
    cursor: pointer;
}

.lf-global-nav__workspace:hover {
    border-color: rgba(215, 181, 109, 0.8);
    background: rgba(215, 181, 109, 0.2);
}

.lf-global-nav__workspace span {
    font-size: 13px;
    font-weight: 700;
}

.lf-global-nav__workspace i {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 8px;
    height: 8px;
    border: 2px solid var(--lf-nav-bg);
    border-radius: 50%;
    background: #55d6a8;
}

.lf-global-nav__workspace.is-team {
    color: #dce8ff;
    border-color: rgba(103, 148, 255, 0.48);
    background: linear-gradient(145deg, rgba(69, 115, 225, 0.24), rgba(38, 63, 123, 0.12));
}

.lf-workspace-menu {
    position: fixed;
    z-index: 10050;
    width: 286px;
    max-height: min(620px, calc(100vh - 24px));
    overflow-y: auto;
    padding: 8px;
    color: #f3f1ec;
    border: 1px solid rgba(215, 181, 109, 0.24);
    border-radius: 14px;
    background: rgba(17, 17, 18, 0.98);
    box-shadow: 0 20px 54px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
}

.lf-workspace-menu__head {
    padding: 9px 10px 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lf-workspace-menu__head strong,
.lf-workspace-menu__head small {
    display: block;
}

.lf-workspace-menu__head strong {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 650;
}

.lf-workspace-menu__head small {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 10px;
    font-weight: 400;
}

.lf-workspace-menu__section {
    padding-top: 8px;
}

.lf-workspace-menu__section-title {
    padding: 2px 9px 5px;
    color: rgba(255, 255, 255, 0.34);
    font-size: 10px;
    font-weight: 650;
}

/* 行容器：左边按钮切空间，右边下拉切小组，两个交互区互不干扰 */
.lf-workspace-menu__row {
    min-height: 52px;
    padding: 7px 9px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    border-radius: 9px;
    color: rgba(255, 255, 255, 0.78);
    transition: background 0.16s, color 0.16s;
}

.lf-workspace-menu__row:hover,
.lf-workspace-menu__row.is-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.lf-workspace-menu__item {
    min-width: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    color: inherit;
    font: inherit;
    text-align: left;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.lf-workspace-menu__row.is-active .lf-workspace-menu__item { cursor: default; }

.lf-workspace-menu__go {
    color: rgba(255, 255, 255, 0.26);
    font-size: 13px;
}

/* 行内小组下拉（团队行专有） */
/* mio 主题用 !important 统一了所有 select 的背景与 background-image（会吃掉下拉箭头），
   所以这里用更高特异性 + !important 抢回自己的样式。 */
.lf-workspace-menu select.lf-workspace-menu__group-select {
    max-width: 118px;
    padding: 5px 21px 5px 8px !important;
    border: 1px solid rgba(215, 181, 109, 0.34) !important;
    border-radius: 8px !important;
    background-color: rgba(215, 181, 109, 0.12) !important;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23d7b56d' stroke-width='3'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 6px center !important;
    color: #f2d792 !important;
    font-family: inherit;
    font-size: 11px;
    font-weight: 650;
    appearance: none;
    cursor: pointer;
    text-overflow: ellipsis;
}

.lf-workspace-menu select.lf-workspace-menu__group-select:hover {
    border-color: rgba(215, 181, 109, 0.6) !important;
    background-color: rgba(215, 181, 109, 0.2) !important;
}

.lf-workspace-menu select.lf-workspace-menu__group-select option {
    background: #131315 !important;
    color: #f3f1ed !important;
}

.lf-workspace-menu__badge {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    color: #f2d792;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(215, 181, 109, 0.3);
    border-radius: 8px;
    background: rgba(215, 181, 109, 0.1);
}

.lf-workspace-menu__badge.is-team {
    color: #bcd0ff;
    border-color: rgba(103, 148, 255, 0.34);
    background: rgba(69, 115, 225, 0.14);
}

.lf-workspace-menu__badge.is-pending {
    color: #d7b56d;
    border-color: rgba(215, 181, 109, 0.34);
    background: rgba(184, 137, 63, 0.12);
}

.lf-workspace-menu__pending {
    width: 100%;
    min-height: 48px;
    padding: 7px 9px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.lf-workspace-menu__pending:hover { background: rgba(184, 137, 63, 0.09); color: #fff; }
.lf-workspace-menu__pending strong,
.lf-workspace-menu__pending small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lf-workspace-menu__pending strong { font-size: 13px; font-weight: 600; }
.lf-workspace-menu__pending small { margin-top: 3px; color: #d7b56d; font-size: 10px; }
.lf-workspace-menu__item strong,
.lf-workspace-menu__item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lf-workspace-menu__item strong {
    font-size: 13px;
    font-weight: 600;
}

.lf-workspace-menu__item small {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.38);
    font-size: 10px;
}

.lf-workspace-menu__check {
    color: var(--lf-nav-accent);
    font-size: 13px;
}

.lf-workspace-menu__actions {
    margin-top: 8px;
    padding: 8px 2px 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.lf-workspace-menu__create,
.lf-workspace-menu__limit {
    min-height: 48px;
    padding: 7px 9px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    border-radius: 9px;
    text-decoration: none;
}

.lf-workspace-menu__create {
    width: 100%;
    border: 0;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    color: #f2d792;
    background: rgba(215, 181, 109, 0.08);
}

.lf-workspace-menu__create:hover {
    background: rgba(215, 181, 109, 0.14);
}

.lf-workspace-menu__limit {
    color: rgba(255, 255, 255, 0.56);
    background: rgba(255, 255, 255, 0.035);
}

.lf-workspace-menu__create > span:first-child,
.lf-workspace-menu__limit > span:first-child {
    display: grid;
    place-items: center;
    font-size: 17px;
}

.lf-workspace-menu__create strong,
.lf-workspace-menu__create small,
.lf-workspace-menu__limit strong,
.lf-workspace-menu__limit small {
    display: block;
}

.lf-workspace-menu__create strong,
.lf-workspace-menu__limit strong {
    font-size: 12px;
    font-weight: 650;
}

.lf-workspace-menu__create small,
.lf-workspace-menu__limit small {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.38);
    font-size: 9.5px;
}

.lf-workspace-menu__actions p {
    margin: 8px 9px 4px;
    color: rgba(255, 255, 255, 0.32);
    font-size: 9.5px;
    line-height: 1.5;
}

/* ── 创建团队空间弹窗（黑金） ──
   由 global-nav.js 注入，任意页面都能通过
   LumenFlowWorkspace.openCreateTeam() 打开，无需各页自带 DOM。 */
.lf-create-team {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(3, 3, 4, 0.72);
    backdrop-filter: blur(12px);
}

.lf-create-team__card {
    width: min(400px, 100%);
    padding: 22px;
    border: 1px solid rgba(215, 181, 109, 0.26);
    border-radius: 16px;
    background:
        radial-gradient(340px 180px at 82% -14%, rgba(184, 137, 63, 0.16), transparent 72%),
        rgba(12, 12, 13, 0.99);
    box-shadow: inset 0 1px 0 rgba(215, 181, 109, 0.18), 0 28px 64px rgba(0, 0, 0, 0.72);
    animation: lfCreateTeamIn 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes lfCreateTeamIn {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.lf-create-team__head strong {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    font-weight: 650;
}

.lf-create-team__head small {
    display: block;
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 11.5px;
    line-height: 1.6;
}

.lf-create-team__label {
    display: block;
    margin: 18px 0 7px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.lf-create-team__input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: rgba(5, 5, 6, 0.7);
    color: rgba(255, 255, 255, 0.88);
    font: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.lf-create-team__input::placeholder { color: rgba(255, 255, 255, 0.28); }

.lf-create-team__input:focus {
    border-color: rgba(215, 181, 109, 0.5);
    box-shadow: 0 0 0 3px rgba(184, 137, 63, 0.12);
}

.lf-create-team__error {
    display: none;
    margin: 8px 0 0;
    color: #c46f6f;
    font-size: 11px;
}

.lf-create-team__error.is-on { display: block; }

.lf-create-team__notes {
    margin: 14px 0 0;
    padding: 12px 14px;
    list-style: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.026);
}

.lf-create-team__notes li {
    display: flex;
    gap: 7px;
    color: rgba(255, 255, 255, 0.52);
    font-size: 11px;
    line-height: 1.7;
}

.lf-create-team__notes li::before {
    content: "✓";
    color: #d7b56d;
}

.lf-create-team__tip {
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid rgba(215, 181, 109, 0.22);
    border-radius: 11px;
    background: rgba(184, 137, 63, 0.08);
    color: rgba(255, 255, 255, 0.66);
    font-size: 11.5px;
    line-height: 1.6;
}

.lf-create-team__actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 9px;
}

.lf-create-team__actions button {
    padding: 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    font: inherit;
    font-size: 12.5px;
    font-weight: 650;
    cursor: pointer;
    transition: border-color 0.16s, background 0.16s, color 0.16s;
}

.lf-create-team__actions button:hover {
    border-color: rgba(215, 181, 109, 0.4);
    color: #f2d792;
}

.lf-create-team__actions .is-primary {
    border-color: transparent;
    background: linear-gradient(135deg, #d7b56d, #b8893f);
    color: #14110c;
    box-shadow: 0 8px 22px rgba(184, 137, 63, 0.26);
}

.lf-create-team__actions .is-primary:hover {
    color: #14110c;
    background: linear-gradient(135deg, #e6cd93, #c19a4e);
}

.lf-global-nav__avatar {
    width: 32px;
    height: 32px;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: #1a1a1c;
    cursor: pointer;
}

.lf-global-nav__avatar:hover {
    border-color: rgba(215, 181, 109, 0.7);
}

.lf-global-nav__avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.lf-global-nav__footer > #userAvatarBtn {
    width: 32px !important;
    height: 32px !important;
    flex: 0 0 32px !important;
    margin: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 50% !important;
    cursor: pointer;
}

.app > .sidebar[data-global-nav] + .main {
    margin-left: var(--lf-nav-width);
}

/* 后台管理页使用网格壳层，导航收窄后同步更新布局占位。 */
.shell:has(> .sidebar[data-global-nav]) {
    grid-template-columns: var(--lf-nav-width) minmax(0, 1fr) !important;
}

@media (max-width: 760px) {
    .sidebar[data-global-nav] {
        display: none !important;
    }

    .app > .sidebar[data-global-nav] + .main {
        margin-left: 0;
    }

    .shell:has(> .sidebar[data-global-nav]) {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}
