:root {
    color-scheme: light;
    --compact-bg: #f4f7fb;
    --compact-sidebar: #fbfdff;
    --compact-surface: #ffffff;
    --compact-surface-soft: #f7faff;
    --compact-line: #dfe7f2;
    --compact-line-strong: #cbd8ea;
    --compact-text: #162033;
    --compact-muted: #6f7f99;
    --compact-faint: #94a3b8;
    --compact-accent: #4f86e8;
    --compact-accent-strong: #2f6fe4;
    --compact-accent-soft: #eaf2ff;
    --compact-private-bg: #fff1df;
    --compact-private-text: #a35a15;
    --compact-shadow: 0 18px 46px rgba(31, 48, 78, 0.08);
    --compact-radius: 14px;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --compact-bg: #111827;
        --compact-sidebar: #151d2b;
        --compact-surface: #182234;
        --compact-surface-soft: #1f2b40;
        --compact-line: #2c3a52;
        --compact-line-strong: #40516e;
        --compact-text: #eef5ff;
        --compact-muted: #a8b6cb;
        --compact-faint: #7f8ca1;
        --compact-accent: #88b4ff;
        --compact-accent-strong: #a5c6ff;
        --compact-accent-soft: #243b60;
        --compact-private-bg: #3f2b1b;
        --compact-private-text: #f0b56e;
        --compact-shadow: 0 18px 46px rgba(0, 0, 0, 0.24);
    }
}

* {
    box-sizing: border-box;
}

[x-cloak] {
    display: none !important;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
    background: var(--compact-bg);
}

body {
    min-height: 100%;
    overflow: hidden;
    margin: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.68), transparent 240px),
        var(--compact-bg);
    color: var(--compact-text);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.compact-page {
    display: grid;
    grid-template-columns: 262px minmax(0, 1fr);
    grid-template-rows: 70px minmax(0, 1fr);
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
}

.compact-sidebar {
    grid-column: 1;
    grid-row: 2;
    align-self: stretch;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    gap: 18px;
    min-height: 0;
    padding: 18px 10px 18px;
    border-right: 1px solid var(--compact-line);
    background: color-mix(in srgb, var(--compact-sidebar) 94%, transparent);
    backdrop-filter: blur(18px);
}

.compact-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 48px;
}

.compact-brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    min-width: 34px;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--compact-accent), var(--compact-accent-strong));
    color: #fff;
    font-weight: 900;
}

.compact-brand strong,
.compact-brand small {
    display: block;
}

.compact-brand strong {
    font-size: 18px;
    line-height: 1.1;
}

.compact-brand small {
    margin-top: 3px;
    color: var(--compact-muted);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.compact-nav {
    display: grid;
    align-content: start;
    gap: 8px;
    min-height: 0;
    overflow: hidden;
}

.compact-nav-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 48px;
    padding: 6px 10px;
    border-radius: 12px;
    color: var(--compact-text);
    font-weight: 760;
    transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.compact-nav-item:hover,
.compact-nav-item.is-active {
    background: var(--compact-accent-soft);
    color: var(--compact-text);
}

.compact-nav-home {
    color: var(--compact-muted);
}

.compact-nav-child {
    margin-left: 18px;
    min-height: 40px;
    font-size: 13px;
}

.compact-nav-child .compact-nav-mark {
    width: 28px;
    height: 28px;
}

.compact-nav-child .group-icon-svg {
    width: 15px;
    height: 15px;
}

.compact-nav-item:active {
    transform: translateY(1px);
}

.compact-nav-mark {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 9px;
    background: var(--compact-surface-soft);
    color: var(--compact-accent-strong);
    font-size: 13px;
    font-weight: 900;
}

.group-icon-svg {
    width: 18px;
    height: 18px;
}

.compact-nav-item.is-active .compact-nav-mark {
    background: #fff;
}

.compact-sidebar-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 10px;
}

.compact-sidebar-meta span {
    display: grid;
    gap: 3px;
    padding: 10px;
    border: 1px solid var(--compact-line);
    border-radius: 12px;
    background: var(--compact-surface);
    color: var(--compact-muted);
    font-size: 12px;
    font-weight: 700;
}

.compact-sidebar-meta strong {
    color: var(--compact-text);
    font-size: 18px;
    line-height: 1;
}

.compact-beian {
    align-self: end;
    padding: 4px 10px 0;
    color: var(--compact-faint);
    font-size: 12px;
    font-weight: 650;
}

.compact-beian:hover {
    color: var(--compact-accent-strong);
}

.compact-workspace {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.compact-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-column: 1 / -1;
    grid-row: 1;
    grid-template-columns: 262px minmax(280px, 1fr) auto auto;
    gap: 18px;
    align-items: center;
    min-height: 70px;
    padding: 10px 28px 10px 18px;
    border-bottom: 1px solid var(--compact-line);
    background: color-mix(in srgb, var(--compact-surface) 86%, transparent);
    backdrop-filter: blur(18px);
}

.compact-clock {
    display: grid;
    gap: 1px;
}

.compact-clock strong {
    color: var(--compact-text);
    font-size: 18px;
    line-height: 1;
}

.compact-clock span {
    color: var(--compact-muted);
    font-size: 12px;
    font-weight: 700;
}

.compact-search {
    justify-self: end;
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr) auto auto;
    align-items: center;
    width: min(620px, 100%);
    min-height: 38px;
    padding: 4px;
    border: 1px solid var(--compact-line);
    border-radius: 16px;
    background: var(--compact-surface);
    box-shadow: 0 8px 24px rgba(31, 48, 78, 0.05);
}

.compact-search-label {
    padding: 0 10px;
    color: var(--compact-faint);
    font-size: 12px;
    font-weight: 800;
}

.compact-search input {
    width: 100%;
    min-width: 0;
    height: 30px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--compact-text);
}

.compact-search input::placeholder {
    color: var(--compact-muted);
}

.compact-engine {
    display: flex;
    gap: 3px;
    padding: 0 4px;
}

.compact-engine button,
.compact-search-submit,
.compact-login,
.compact-empty-action {
    border-radius: 12px;
    font-weight: 850;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.compact-engine button {
    height: 28px;
    padding: 0 8px;
    border: 0;
    background: transparent;
    color: var(--compact-muted);
    font-size: 12px;
}

.compact-engine button.active {
    background: var(--compact-accent-soft);
    color: var(--compact-accent-strong);
}

.compact-search-submit {
    height: 30px;
    padding: 0 12px;
    border: 0;
    background: var(--compact-accent);
    color: #fff;
}

.compact-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    min-height: 36px;
    padding: 0 16px;
    border: 0;
    background: var(--compact-accent);
    color: #fff;
}

.compact-search-submit:active,
.compact-login:active,
.compact-empty-action:active,
.compact-link:active {
    transform: translateY(1px);
}

.compact-content {
    display: grid;
    gap: 30px;
    width: min(1330px, calc(100% - 48px));
    margin: 0 auto;
    padding: 28px 24px 54px;
}

.compact-section {
    scroll-margin-top: 92px;
}

.compact-section-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 12px;
    padding: 0 4px;
}

.compact-section-title h2 {
    margin: 0;
    color: var(--compact-text);
    font-size: 25px;
    font-weight: 850;
    line-height: 1.15;
}

.compact-title-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.compact-title-link:hover {
    color: var(--compact-accent-strong);
}

.compact-heading-icon {
    display: grid;
    width: 30px;
    height: 30px;
    min-width: 30px;
    place-items: center;
    border-radius: 10px;
    background: var(--compact-accent-soft);
    color: var(--compact-accent-strong);
}

.compact-heading-icon .group-icon-svg {
    width: 17px;
    height: 17px;
}

.compact-section-title span,
.compact-section-title a {
    color: var(--compact-muted);
    font-size: 13px;
    font-weight: 800;
}

.compact-section-title a:hover {
    color: var(--compact-accent-strong);
}

.compact-panel {
    min-height: 110px;
    padding: 28px;
    border: 1px solid var(--compact-line);
    border-radius: var(--compact-radius);
    background: var(--compact-surface);
    box-shadow: var(--compact-shadow);
}

.compact-subgroup {
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid var(--compact-line);
}

.compact-subgroup:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.compact-subgroup-title,
.compact-subgroup-head h3 {
    margin: 0 0 14px;
    color: var(--compact-text);
    font-size: 16px;
    font-weight: 850;
    line-height: 1.2;
}

.compact-subgroup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.compact-subgroup-head h3 {
    margin: 0;
}

.compact-subgroup-head > a {
    flex: 0 0 auto;
    color: var(--compact-muted);
    font-size: 12px;
    font-weight: 850;
}

.compact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
    gap: 18px 26px;
}

.compact-grid-wide {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
}

.compact-link {
    position: relative;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
    min-height: 48px;
    padding: 4px;
    border-radius: 12px;
    color: var(--compact-text);
    overflow: hidden;
    transition: background 150ms ease, transform 150ms ease;
}

.compact-link:hover {
    background: var(--compact-surface-soft);
    transform: translateY(-1px);
}

.compact-favicon,
.compact-fallback {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 9px;
}

.compact-favicon {
    object-fit: contain;
}

.compact-fallback {
    display: grid;
    place-items: center;
    background: var(--compact-accent-soft);
    color: var(--compact-accent-strong);
    font-size: 12px;
    font-weight: 900;
}

.compact-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
    overflow: hidden;
}

.compact-title,
.compact-description {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compact-title {
    color: var(--compact-text);
    font-size: 14px;
    font-weight: 760;
    line-height: 1.2;
    white-space: nowrap;
}

.compact-description {
    display: -webkit-box;
    max-width: 100%;
    max-height: 2.5em;
    color: var(--compact-muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.compact-private {
    position: absolute;
    right: 4px;
    top: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--compact-private-bg);
    color: var(--compact-private-text);
    font-size: 10px;
    font-weight: 900;
}

.compact-section-empty {
    margin: 0;
    color: var(--compact-muted);
    font-weight: 700;
}

.compact-empty {
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 360px;
    padding: 48px 20px;
    border: 1px dashed var(--compact-line-strong);
    border-radius: var(--compact-radius);
    background: var(--compact-surface);
    text-align: center;
}

.compact-empty h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.15;
}

.compact-empty p {
    margin: 0;
    color: var(--compact-muted);
}

.compact-empty-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    margin-top: 8px;
    padding: 0 16px;
    border: 0;
    background: var(--compact-accent);
    color: #fff;
}

.compact-group-heading {
    min-width: 0;
}

.compact-group-heading h1 {
    margin: 0;
    font-size: 25px;
    line-height: 1.15;
}

.compact-group-heading p {
    margin: 5px 0 0;
    color: var(--compact-muted);
    font-weight: 650;
}

.compact-group-count {
    color: var(--compact-muted);
    font-weight: 850;
}

.compact-group-topbar {
    grid-template-columns: 262px minmax(0, 1fr) auto;
}

.compact-search:focus-within,
.compact-link:focus-visible,
.compact-nav-item:focus-visible,
.compact-login:focus-visible,
.compact-empty-action:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--compact-accent) 25%, transparent);
    outline-offset: 2px;
}

.error-page {
    width: min(520px, calc(100vw - 32px));
    margin: 12vh auto 0;
    padding: 32px;
    border: 1px solid var(--compact-line);
    border-radius: var(--compact-radius);
    background: var(--compact-surface);
    text-align: center;
}

.error-page h1 {
    margin: 0 0 8px;
    font-size: 44px;
}

.error-page p {
    color: var(--compact-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--compact-line);
    border-radius: 12px;
    background: var(--compact-surface);
    color: var(--compact-text);
    font-weight: 850;
}

.btn-primary {
    border-color: transparent;
    background: var(--compact-accent);
    color: #fff;
}

.site-footer {
    display: none;
}

.site-footer .container {
    width: min(1330px, calc(100vw - 310px));
    margin-left: calc(262px + max(24px, (100vw - 262px - 1330px) / 2));
}

.site-footer a {
    color: var(--compact-faint);
}

.site-footer a:hover {
    color: var(--compact-accent-strong);
}

.admin-float {
    display: none;
}

#toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 30;
    max-width: calc(100vw - 32px);
    padding: 10px 14px;
    border: 1px solid var(--compact-line-strong);
    border-radius: 12px;
    background: var(--compact-text);
    color: var(--compact-bg);
    box-shadow: var(--compact-shadow);
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
    transition: opacity 150ms ease, transform 150ms ease;
    pointer-events: none;
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media (max-width: 1080px) {
    .compact-page {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(0, 1fr);
    }

    .compact-sidebar {
        z-index: 20;
        grid-column: 1;
        grid-row: 2;
        min-height: auto;
        grid-template-rows: auto;
        gap: 8px;
        padding: 10px;
        border-right: 0;
        border-bottom: 1px solid var(--compact-line);
    }

    .compact-brand {
        min-height: 42px;
    }

    .compact-nav {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .compact-nav-item {
        flex: 0 0 auto;
        min-height: 42px;
        padding-right: 14px;
    }

    .compact-sidebar-meta {
        display: none;
    }

    .compact-beian {
        display: none;
    }

    .compact-topbar {
        grid-column: 1;
        grid-row: 1;
        grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.4fr) auto;
        gap: 10px;
        padding: 10px 14px;
    }

    .compact-clock {
        display: none;
    }

    .compact-search {
        justify-self: stretch;
        width: 100%;
    }

    .compact-workspace {
        grid-column: 1;
        grid-row: 3;
    }

    .compact-group-topbar {
        grid-template-columns: minmax(180px, auto) minmax(0, 1fr) auto;
    }

    .compact-content,
    .site-footer .container {
        width: min(100vw - 22px, 920px);
        margin: 0 auto;
    }

    .site-footer .container {
        margin-left: auto;
    }
}

@media (max-width: 760px) {
    .compact-topbar {
        grid-template-columns: 1fr auto;
    }

    .compact-search {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

@media (max-width: 680px) {
    .compact-topbar {
        position: static;
        grid-template-columns: 1fr;
    }

    .compact-login {
        justify-self: stretch;
    }

    .compact-search {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .compact-search-label,
    .compact-engine {
        display: none;
    }

    .compact-content {
        gap: 24px;
        padding: 20px 0 40px;
        width: min(100vw - 22px, 920px);
    }

    .compact-section-title h2,
    .compact-group-heading h1 {
        font-size: 22px;
    }

    .compact-panel {
        padding: 18px;
    }

    .compact-grid,
    .compact-grid-wide {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .compact-link {
        min-height: 54px;
    }
}

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