.teacher-quick-nav-host {
    min-width: 0;
}

.teacher-quick-nav-host--fixed,
.teacher-quick-nav-host--dashboard-fixed {
    --teacher-quick-nav-fixed-left: auto;
    --teacher-quick-nav-fixed-top: auto;
    align-self: start;
}

.teacher-quick-nav-host--desktop-only {
    --teacher-quick-nav-top: 12px;
    align-self: start;
}

.quick-nav-rail {
    position: sticky;
    top: var(--teacher-quick-nav-top, 20px);
    align-self: start;
    z-index: 1;
}

.teacher-quick-nav-host--fixed > .quick-nav-rail,
.teacher-quick-nav-host--dashboard-fixed > .quick-nav-rail {
    position: fixed;
    left: var(--teacher-quick-nav-fixed-left);
    top: var(--teacher-quick-nav-fixed-top);
    z-index: 12;
}

.teacher-quick-nav-subpage-layout {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.teacher-quick-nav-subpage-content {
    min-width: 0;
}

.quick-nav-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 76px;
    min-height: 0;
    max-height: calc(100vh - 40px);
    padding: 6px 6px 6px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(10px);
}

.quick-nav-head {
    display: flex;
    justify-content: center;
    width: 100%;
}

.quick-nav-sr-only,
.quick-nav-item__title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.quick-nav-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
    width: 100%;
    justify-items: center;
}

.quick-nav-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    border-radius: 11px;
    background: rgba(15, 23, 42, 0.16);
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.quick-nav-action-btn:hover:not(:disabled),
.quick-nav-action-btn:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(var(--accent-rgb), 0.52);
    background: rgba(var(--accent-rgb), 0.14);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.16);
    outline: none;
}

.quick-nav-action-btn.active {
    border-color: rgba(var(--accent-rgb), 0.58);
    background: rgba(var(--accent-rgb), 0.2);
    color: var(--accent);
}

.quick-nav-action-btn:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.quick-nav-action-btn--ghost {
    background: rgba(255, 255, 255, 0.02);
}

.quick-nav-save-status {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-sub);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    position: absolute;
    top: 8px;
    left: calc(100% + 8px);
    justify-content: flex-start;
    width: max-content;
    max-width: 240px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
    z-index: 2;
}

.quick-nav-save-status.is-saving {
    border-color: rgba(var(--accent-rgb), 0.4);
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--text-main);
}

.quick-nav-save-status.is-saved {
    border-color: rgba(34, 197, 94, 0.32);
    background: rgba(34, 197, 94, 0.12);
    color: #166534;
}

.quick-nav-save-status.is-error {
    border-color: rgba(239, 68, 68, 0.32);
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.quick-nav-save-status.is-local-only {
    border-color: rgba(245, 158, 11, 0.34);
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.quick-nav-save-status[hidden],
.quick-nav-save-status:empty {
    display: none !important;
}

.quick-nav-empty {
    padding: 18px 14px;
    border: 1px dashed rgba(148, 163, 184, 0.36);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.08);
    color: var(--text-sub);
    font-size: 0.84rem;
    line-height: 1.5;
    text-align: center;
}

#quickNavEmpty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width: 100%;
    min-height: 44px;
    gap: 1px;
    padding: 3px 0 2px;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.quick-nav-empty__icon {
    font-size: 1.38rem;
    line-height: 1;
}

.quick-nav-empty__label {
    font-size: 0.52rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.01em;
    color: inherit;
}

#quickNavEmpty:hover:not(:disabled),
#quickNavEmpty:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(var(--accent-rgb), 0.52);
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--accent);
    outline: none;
}

#quickNavEmpty:disabled,
#quickNavEmpty.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.quick-nav-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px;
    align-content: start;
    width: 100%;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-right: 0;
}

.quick-nav-grid::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.quick-nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    gap: 1px;
    padding: 0;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    background:
        radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.18), transparent 56%),
        linear-gradient(160deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.94));
    color: #f8fafc;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.quick-nav-item:hover {
    transform: translateX(1px);
    border-color: rgba(var(--accent-rgb), 0.55);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.22);
}

.quick-nav-item:focus-visible {
    transform: translateX(1px);
    border-color: rgba(var(--accent-rgb), 0.62);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.22), 0 12px 24px rgba(15, 23, 42, 0.22);
    outline: none;
}

.quick-nav-item.is-current {
    border-color: rgba(var(--accent-rgb), 0.72);
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.42), 0 10px 22px rgba(15, 23, 42, 0.18);
}

.quick-nav-item.is-editing {
    cursor: grab;
    box-shadow: inset 0 0 0 1px rgba(248, 250, 252, 0.08);
    touch-action: none;
    user-select: none;
}

.quick-nav-item.is-folder-drop-target {
    border-color: rgba(34, 197, 94, 0.84);
    box-shadow: inset 0 0 0 2px rgba(34, 197, 94, 0.36), 0 12px 26px rgba(21, 128, 61, 0.28);
    transform: scale(1.04);
}

.quick-nav-drag-clone {
    z-index: 9999;
    width: 44px !important;
    min-height: 44px !important;
    opacity: 0.94;
    pointer-events: none;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.36), 0 0 0 3px rgba(34, 197, 94, 0.24);
    transition: none !important;
    will-change: left, top;
}

.quick-nav-drag-ghost {
    opacity: 0.28;
    transition: none !important;
}

.quick-nav-drag-chosen,
.quick-nav-drag-active {
    cursor: grabbing;
    transition: none !important;
}

.quick-nav-item__icon {
    font-size: 1.68rem;
    line-height: 1;
}

.quick-nav-item__label {
    max-width: calc(100% - 6px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.58rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.01em;
    color: rgba(241, 245, 249, 0.88);
}

.quick-nav-item__remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.92);
    color: #fff;
    font-size: 0.55rem;
    cursor: pointer;
}

.quick-nav-folder-tile {
    overflow: hidden;
}

.quick-nav-folder-preview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 1px;
    width: 27px;
    height: 27px;
    padding: 2px;
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.16);
    box-shadow: inset 0 0 0 1px rgba(248, 250, 252, 0.1);
}

.quick-nav-folder-preview-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    border-radius: 5px;
    background: rgba(15, 23, 42, 0.42);
    font-size: 0.78rem;
    line-height: 1;
}

.quick-nav-folder-layer {
    position: absolute;
    top: var(--quick-nav-folder-top, 42px);
    left: 0;
    z-index: 18;
    width: min(286px, calc(100vw - 24px));
    max-height: min(420px, calc(100vh - 32px));
    animation: quickNavFolderOpen 0.16s ease-out;
    transform-origin: 24px 24px;
}

.quick-nav-folder-layer[hidden] {
    display: none !important;
}

.quick-nav-folder-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-height: inherit;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 22px;
    background: rgba(15, 23, 42, 0.94);
    color: #f8fafc;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(18px);
}

.quick-nav-folder-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 30px;
    gap: 8px;
    align-items: center;
}

.quick-nav-folder-title-input {
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 10px;
    background: rgba(248, 250, 252, 0.08);
    color: #f8fafc;
    font-size: 0.88rem;
    font-weight: 800;
}

.quick-nav-folder-title-input:focus {
    border-color: rgba(var(--accent-rgb), 0.62);
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2);
}

.quick-nav-folder-close,
.quick-nav-folder-unpack {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 10px;
    background: rgba(248, 250, 252, 0.08);
    color: #f8fafc;
    font-weight: 800;
    cursor: pointer;
}

.quick-nav-folder-close {
    width: 30px;
    height: 30px;
    font-size: 1rem;
}

.quick-nav-folder-unpack {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.78rem;
}

.quick-nav-folder-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    overflow-y: auto;
    padding: 2px;
    scrollbar-width: thin;
}

.quick-nav-folder-tool {
    min-height: 52px;
}

@keyframes quickNavFolderOpen {
    from {
        opacity: 0;
        transform: scale(0.72);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.quick-nav-candidate {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
}

.quick-nav-candidate:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.quick-nav-candidate__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(var(--accent-rgb), 0.14);
    font-size: 1.05rem;
}

.quick-nav-candidate__body {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.quick-nav-candidate__title {
    font-size: 0.88rem;
    font-weight: 700;
}

.quick-nav-candidate__meta {
    overflow: hidden;
    color: var(--text-sub);
    font-size: 0.74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-nav-candidate__action {
    flex-shrink: 0;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
}

@media (max-width: 1180px) {
    .teacher-quick-nav-host--desktop-only {
        display: none !important;
    }

    .teacher-quick-nav-subpage-layout {
        display: block;
    }
}

@media (max-width: 1120px) {
    .quick-nav-rail {
        position: static;
    }

    .teacher-quick-nav-host--fixed > .quick-nav-rail,
    .teacher-quick-nav-host--dashboard-fixed > .quick-nav-rail {
        left: auto;
        top: auto;
    }

    .quick-nav-card {
        width: 100%;
        max-height: none;
        padding: 10px 12px;
        align-items: stretch;
        border-radius: 18px;
    }

    .quick-nav-head {
        justify-content: flex-start;
    }

    .quick-nav-actions {
        width: auto;
        grid-template-columns: repeat(2, minmax(0, 32px));
        justify-content: flex-start;
    }

    .quick-nav-save-status {
        position: static;
        width: max-content;
        max-width: 100%;
        box-shadow: none;
    }

    .quick-nav-grid {
        grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    }

    .quick-nav-folder-layer {
        top: 58px;
        left: 12px;
        width: calc(100% - 24px);
        max-height: min(420px, calc(100vh - 96px));
    }

    #quickNavEmpty {
        width: min(52px, 100%);
    }
}

@media (max-width: 768px) {
    .quick-nav-card {
        padding: 10px;
    }

    .quick-nav-actions {
        grid-template-columns: repeat(2, minmax(0, 32px));
    }

    .quick-nav-item,
    #quickNavEmpty {
        min-height: 44px;
    }
}
