﻿:root {
    color-scheme: light;
    --bg: #f4f7fb;
    --panel: #ffffff;
    --text: #162033;
    --muted: #6b7688;
    --line: #dde4ee;
    --soft-line: #eef2f7;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --shadow-sm: 0 8px 22px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 18px 46px rgba(15, 23, 42, 0.18);
}

* {
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    margin: 0;
    height: 100vh;
    padding: 14px 0;
    font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
    font-size: 13px;
    line-height: 1.45;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
}

body.auth-checking .app-shell {
    visibility: hidden;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.hidden {
    display: none !important;
}

.app-shell {
    width: min(1200px, calc(100vw - 24px));
    height: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

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

.topbar h1 {
    margin: 0 0 2px;
    font-size: 23px;
    line-height: 1.15;
    letter-spacing: 0;
}

.topbar p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.workspace {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 7px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.pathbar,
.toolbar,
.stats {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--soft-line);
}

#breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
}

#breadcrumb button {
    border: 0;
    background: transparent;
    color: var(--primary);
    padding: 3px 2px;
}

#breadcrumb span {
    color: var(--muted);
}

.path-search {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: min(260px, 34vw);
    height: 31px;
    margin-left: auto;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fff;
    color: var(--muted);
}

.path-search:focus-within {
    border-color: #bfdbfe;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.path-search svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
}

.path-search input {
    width: 100%;
    min-width: 0;
    height: 28px;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 12px;
}

.path-search input::placeholder {
    color: #9aa6b7;
}

.toolbar {
    flex-wrap: wrap;
    justify-content: space-between;
}

.toolbar-left,
.selection-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selection-actions {
    margin-left: auto;
}

.selection-actions span {
    color: var(--muted);
    font-size: 12px;
}

.stats {
    background: #fbfcfe;
}

.stats div {
    min-width: 96px;
}

.stats strong {
    display: block;
    font-size: 17px;
    line-height: 1.15;
}

.stats span {
    color: var(--muted);
    font-size: 12px;
}

.icon-text,
.icon-button,
.actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 5px;
    min-height: 31px;
    line-height: 1;
    text-decoration: none;
}

.icon-text {
    padding: 0 11px;
    font-size: 13px;
}

.icon-button {
    width: 31px;
    padding: 0;
}

.icon-text:hover,
.icon-button:hover,
.actions button:hover,
.sheet-tabs button:hover {
    border-color: #c4cedd;
    background: #f8fafc;
    box-shadow: 0 2px 7px rgba(15, 23, 42, 0.06);
}

.icon-text.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.icon-text.primary:hover {
    background: var(--primary-dark);
}

.icon-text.danger,
.danger-link {
    color: var(--danger);
    border-color: #fecaca;
}

.icon-text.danger-fill {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.icon-text.danger-fill:hover {
    background: #b91c1c;
}

.settings-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 4px 0 10px;
    margin-bottom: -10px;
}

.settings-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: #475569;
}

.settings-trigger:hover,
.settings-menu.open .settings-trigger {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: var(--primary);
}

.settings-trigger svg {
    width: 16px;
    height: 16px;
}

.settings-dropdown {
    position: absolute;
    top: calc(100% - 3px);
    right: 0;
    z-index: 30;
    display: none;
    min-width: 132px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    box-shadow: var(--shadow-lg);
}

.settings-dropdown::before {
    content: "";
    position: absolute;
    top: -12px;
    right: 0;
    width: 100%;
    height: 12px;
}

.settings-menu.open .settings-dropdown,
.settings-menu:hover .settings-dropdown {
    display: grid;
    gap: 3px;
}

.settings-dropdown button {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 30px;
    padding: 0 9px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    text-align: left;
}

.settings-dropdown button:hover {
    background: #f1f5f9;
}

.settings-dropdown .danger-link {
    color: var(--danger);
}

.file-table {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.file-row {
    display: grid;
    grid-template-columns: 28px minmax(260px, 1fr) 86px 146px 102px;
    gap: 8px;
    align-items: center;
    padding: 6px 14px;
    border-bottom: 1px solid var(--soft-line);
}

.file-row:not(.file-head):hover {
    background: #fbfdff;
}

.file-row.selected,
.explorer-row.selected {
    background: #eff6ff;
}

.file-head {
    position: sticky;
    top: 0;
    z-index: 2;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    background: #f8fafc;
    padding-top: 6px;
    padding-bottom: 6px;
}

.name-head {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.select-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

.select-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.select-box input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.select-box span {
    width: 14px;
    height: 14px;
    border: 1px solid #b7c2d2;
    border-radius: 3px;
    background: #fff;
}

.select-box input:checked + span {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: inset 0 0 0 2px #fff;
}

.view-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    min-height: 16px;
    flex: 0 0 16px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: #475569;
    font-size: 12px;
    line-height: 1;
}

.view-toggle:hover,
.view-toggle.active {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: var(--primary);
    box-shadow: none;
}

.view-toggle svg {
    width: 12px;
    height: 12px;
    pointer-events: none;
}

.head-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.table-tools {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.table-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    min-height: 20px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #475569;
}

.table-tool:hover,
.sort-tool:hover .sort-trigger {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: var(--primary);
}

.table-tool svg {
    width: 13px;
    height: 13px;
    pointer-events: none;
}

.sort-tool {
    position: relative;
    display: inline-flex;
}

.sort-menu {
    position: fixed;
    z-index: 1200;
    display: none;
    min-width: 112px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
}

.sort-menu.open {
    display: grid;
    gap: 2px;
}

.sort-menu button {
    width: 100%;
    min-height: 28px;
    padding: 0 8px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    text-align: left;
    font-size: 12px;
}

.sort-menu button:hover,
.sort-menu button.active {
    background: #eff6ff;
    color: var(--primary);
}

.file-name {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    padding: 0;
    min-width: 0;
}

.file-name span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 26px;
    flex: 0 0 34px;
    border-radius: 5px;
    background: #e8eefb;
    color: #1e3a8a;
    font-size: 10px;
    font-weight: 700;
    overflow: hidden;
    isolation: isolate;
}

.explorer-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.folder-icon {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 15px;
    border-radius: 3px;
    background: #f4b63f;
    box-shadow: inset 0 -2px 0 rgba(146, 91, 15, 0.18);
}

.folder-icon::before {
    content: "";
    position: absolute;
    left: 2px;
    top: -4px;
    width: 10px;
    height: 6px;
    border-radius: 4px 4px 0 0;
    background: #f8ca66;
}

.folder-icon::after {
    content: "";
    position: absolute;
    inset: 3px 2px auto;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.22);
}

.type-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 23px;
    border-radius: 3px;
    background: #64748b;
    color: #fff;
    box-shadow: inset 0 -2px 0 rgba(15, 23, 42, 0.12);
}

.explorer-view .folder-icon {
    width: 16px;
    height: 12px;
    border-radius: 1px 2px 2px 2px;
    background: linear-gradient(#ffd75e, #f6b52d);
    box-shadow: inset 0 -1px 0 rgba(124, 79, 9, 0.22);
}

.explorer-view .folder-icon::before {
    left: 1px;
    top: -3px;
    width: 8px;
    height: 4px;
    border-radius: 2px 2px 0 0;
    background: #f4c34f;
}

.explorer-view .folder-icon::after {
    inset: 4px 1px auto;
    height: 2px;
    background: rgba(255, 255, 255, 0.28);
}

.explorer-view .type-icon {
    width: 14px;
    height: 17px;
    border-radius: 1px;
    background: #fff;
    border: 1px solid #b9c3d0;
    box-shadow: none;
    color: #334155;
}

.explorer-view .type-icon::before {
    width: 5px;
    height: 5px;
    background: linear-gradient(135deg, #e5e7eb 50%, #fff 50%);
    border-left: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
    border-radius: 0;
}

.explorer-view .type-icon::after {
    font-size: 5px;
    font-weight: 800;
}

.explorer-view .pdf-icon {
    border-color: #ef4444;
}

.explorer-view .pdf-icon::after {
    position: absolute;
    left: -1px;
    bottom: 2px;
    width: 16px;
    padding: 1px 0;
    background: #ef4444;
    color: #fff;
    content: "PDF";
    font-size: 5px;
}

.explorer-view .image-icon {
    border-color: #60a5fa;
}

.explorer-view .image-icon::after {
    width: 9px;
    height: 7px;
    border: 1px solid #3b82f6;
    border-radius: 1px;
    background: linear-gradient(135deg, transparent 50%, #3b82f6 51%);
}

.explorer-view .sheet-icon {
    border-color: #22c55e;
}

.explorer-view .sheet-icon::after {
    position: absolute;
    left: -1px;
    bottom: -1px;
    width: 10px;
    height: 10px;
    border: 1px solid #15803d;
    background:
        linear-gradient(#15803d, #15803d) 0 3px / 10px 1px no-repeat,
        linear-gradient(#15803d, #15803d) 0 6px / 10px 1px no-repeat,
        linear-gradient(#15803d, #15803d) 3px 0 / 1px 10px no-repeat,
        linear-gradient(#15803d, #15803d) 6px 0 / 1px 10px no-repeat,
        #dcfce7;
    content: "";
}

.explorer-view .json-icon::after,
.explorer-view .code-icon::after,
.explorer-view .sql-icon::after {
    position: absolute;
    left: 1px;
    bottom: 2px;
    color: #0f172a;
}

.explorer-view .json-icon {
    border-color: #f59e0b;
}

.explorer-view .json-icon::after {
    content: "{}";
    font-size: 6px;
}

.explorer-view .sql-icon {
    border-color: #06b6d4;
}

.explorer-view .sql-icon::after {
    content: "SQL";
    font-size: 4px;
}

.explorer-view .text-icon::after {
    width: 8px;
    height: 8px;
    border-top: 1px solid #64748b;
    border-bottom: 1px solid #64748b;
    box-shadow: 0 3px 0 #64748b;
}

.explorer-view .word-icon::after {
    color: #2563eb;
    content: "W";
    font-size: 8px;
}

.explorer-view .ppt-icon::after {
    color: #ea580c;
    content: "P";
    font-size: 8px;
}

.type-icon::before {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    width: 6px;
    height: 6px;
    border-radius: 0 3px 0 3px;
    background: rgba(255, 255, 255, 0.45);
}

.type-icon::after {
    position: relative;
    z-index: 1;
    font-size: 7px;
    font-weight: 800;
    line-height: 1;
}

.pdf-icon {
    background: #dc2626;
}

.pdf-icon::after {
    content: "PDF";
}

.text-icon {
    background: #475569;
}

.text-icon::after {
    content: "";
    width: 12px;
    height: 11px;
    border-top: 2px solid #fff;
    border-bottom: 2px solid #fff;
    box-shadow: 0 4px 0 #fff;
}

.image-icon {
    background: #0ea5e9;
}

.image-icon::after {
    content: "";
    width: 12px;
    height: 9px;
    border: 2px solid #fff;
    border-radius: 2px;
    background: linear-gradient(135deg, transparent 54%, #fff 55%);
}

.sheet-icon {
    background: #16a34a;
}

.sheet-icon::after {
    content: "";
    width: 13px;
    height: 13px;
    background:
        linear-gradient(#fff, #fff) 0 4px / 13px 1px no-repeat,
        linear-gradient(#fff, #fff) 0 8px / 13px 1px no-repeat,
        linear-gradient(#fff, #fff) 4px 0 / 1px 13px no-repeat,
        linear-gradient(#fff, #fff) 8px 0 / 1px 13px no-repeat;
    border: 1px solid #fff;
}

.word-icon {
    background: #2563eb;
}

.word-icon::after {
    content: "W";
    font-size: 11px;
}

.ppt-icon {
    background: #ea580c;
}

.ppt-icon::after {
    content: "P";
    font-size: 11px;
}

.json-icon {
    background: #f59e0b;
}

.json-icon::after {
    content: "{}";
    font-size: 10px;
}

.sql-icon {
    background: #0891b2;
}

.sql-icon::after {
    content: "SQL";
}

.code-icon {
    background: #334155;
}

.code-icon::after {
    content: "</>";
    font-size: 8px;
}

.config-icon {
    background: #64748b;
}

.config-icon::after {
    content: "⚙";
    font-size: 12px;
}

.archive-icon {
    background: #a16207;
}

.archive-icon::after {
    content: "";
    width: 5px;
    height: 16px;
    background: repeating-linear-gradient(to bottom, #fff 0 2px, rgba(255, 255, 255, 0.25) 2px 4px);
}

.video-icon {
    background: #7c3aed;
}

.video-icon::after {
    content: "";
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 9px solid #fff;
    margin-left: 2px;
}

.audio-icon {
    background: #db2777;
}

.audio-icon::after {
    content: "♪";
    font-size: 15px;
}

.font-icon {
    background: #9333ea;
}

.font-icon::after {
    content: "A";
    font-size: 13px;
}

.app-icon {
    background: #0f766e;
}

.app-icon::after {
    content: "APP";
}

.design-icon {
    background: #be185d;
}

.design-icon::after {
    content: "◆";
    font-size: 12px;
}
.file-generic-icon::after {
    content: "FILE";
    font-size: 7px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.actions button {
    width: 26px;
    min-height: 26px;
    padding: 0;
    font-size: 12px;
}

.action-icon-placeholder {
    display: inline-flex;
    width: 26px;
    min-height: 26px;
    flex: 0 0 26px;
    visibility: hidden;
    pointer-events: none;
}

.action-icon {
    color: #475569;
}

.action-icon svg {
    width: 15px;
    height: 15px;
    pointer-events: none;
}

.action-download {
    color: #2563eb;
}

.action-delete {
    color: var(--danger);
    border-color: #fecaca;
}

.explorer-view {
    min-height: 0;
    padding: 0 12px 14px;
    background: #fff;
}

.explorer-row {
    display: grid;
    grid-template-columns: 28px minmax(230px, 1.4fr) minmax(140px, 0.75fr) minmax(160px, 0.8fr) minmax(80px, 0.45fr) 102px;
    align-items: center;
    width: 100%;
    min-height: 27px;
    color: #1f2937;
    font-size: 12px;
}

.explorer-head {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 30px;
    color: #24517f;
    background: #fff;
    border-bottom: 0;
}

.explorer-head > span {
    display: flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-right: 1px solid #e5e7eb;
    font-weight: 400;
}

.explorer-head > span:last-child {
    border-right: 0;
}

.explorer-head .head-actions {
    overflow: visible;
}

.explorer-row:not(.explorer-head) {
    border-radius: 0;
}

.explorer-row:not(.explorer-head):hover {
    background: #eef6ff;
}

.explorer-row:not(.explorer-head):focus-within {
    background: #dff0ff;
}

.explorer-row > span {
    min-width: 0;
    overflow: hidden;
    padding: 0 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.explorer-name {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    width: 100%;
    min-height: 28px;
    padding: 0 6px 0 0;
    border: 0;
    background: transparent;
    color: #111827;
    text-align: left;
}

.explorer-name span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.explorer-size {
    text-align: right;
}

.explorer-actions {
    justify-content: flex-start;
    gap: 5px;
    padding-left: 8px;
}

.explorer-actions button {
    width: 24px;
    min-height: 24px;
    padding: 0;
    font-size: 12px;
}

.explorer-actions .action-icon-placeholder {
    width: 24px;
    min-height: 24px;
    flex-basis: 24px;
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--muted);
}

.inline-upload-box {
    margin: 14px;
    min-height: 156px;
    border: 2px dashed #c8d1df;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--muted);
    outline: none;
    cursor: default;
    transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

.explorer-view .inline-upload-box {
    margin: 14px 0 2px;
}

.inline-upload-box:hover,
.inline-upload-box:focus,
.inline-upload-box.dragover {
    border-color: var(--primary);
    background: #eff6ff;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.inline-upload-box.uploading {
    pointer-events: none;
    opacity: 0.78;
}

.inline-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.inline-upload-inner {
    display: grid;
    min-height: 152px;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 18px;
    text-align: center;
}

.inline-upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: #64748b;
}

.inline-upload-icon svg {
    width: 36px;
    height: 36px;
    stroke-width: 1.5;
}

.inline-upload-title {
    color: #334155;
    font-size: 13px;
    font-weight: 600;
}

.inline-upload-or {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1;
}

.inline-upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
    padding: 0 13px;
    border: 1px solid var(--primary);
    border-radius: 5px;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.inline-upload-button:hover {
    background: var(--primary-dark);
}

.inline-upload-button svg {
    width: 14px;
    height: 14px;
}

.inline-upload-status {
    min-height: 16px;
    color: var(--muted);
    font-size: 12px;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.38);
}

.modal.open {
    display: flex;
}

.modal-panel {
    position: relative;
    z-index: 1001;
    isolation: isolate;
    width: min(430px, 100%);
    background: #fff;
    border: 1px solid rgba(221, 228, 238, 0.8);
    border-radius: 7px;
    padding: 15px;
    box-shadow: var(--shadow-lg);
}

.modal-header,
.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.modal-header {
    margin-bottom: 12px;
}

.modal-header h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.25;
}

.modal-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.modal-panel input {
    width: 100%;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 0 10px;
    margin-bottom: 12px;
}

.modal-actions {
    justify-content: flex-end;
}

.delete-panel {
    width: min(450px, 100%);
}

.delete-warning {
    display: grid;
    gap: 6px;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #fecaca;
    border-radius: 6px;
    background: var(--danger-bg);
}

.delete-warning strong {
    color: #991b1b;
}

.delete-warning span {
    color: #7f1d1d;
    font-size: 12px;
    word-break: break-all;
}

.move-target-label {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
}

.move-target-label strong {
    color: var(--text);
}

.folder-tree {
    max-height: 300px;
    min-height: 180px;
    overflow: auto;
    margin-bottom: 12px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfcfe;
}

.folder-tree .empty-state {
    padding: 42px 12px;
}

.folder-tree-item {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    min-height: 30px;
    padding: 0 8px 0 calc(8px + var(--depth) * 18px);
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--text);
    text-align: left;
}

.folder-tree-item:hover {
    background: #eef6ff;
}

.folder-tree-item.active {
    background: #dbeafe;
    color: var(--primary);
}

.folder-tree-item svg {
    width: 15px;
    height: 15px;
    color: #f59e0b;
    flex: 0 0 auto;
}

.permission-panel {
    display: flex;
    flex-direction: column;
    width: min(780px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    min-height: 0;
}

.permission-editor {
    display: grid;
    grid-template-columns: 220px 1fr;
    height: min(520px, calc(100vh - 190px));
    min-height: 320px;
    border: 1px solid var(--line);
    border-radius: 7px;
    overflow: hidden;
}

.permission-users {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    border-right: 1px solid var(--line);
    background: #f8fafc;
}

.permission-add {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    padding: 10px;
    border-bottom: 1px solid var(--soft-line);
}

.permission-add input {
    height: 30px;
    margin: 0;
    font-size: 12px;
}

.permission-user-list,
.permission-root-list {
    min-height: 0;
    overflow: auto;
}

.permission-user-list {
    display: grid;
    align-content: start;
    gap: 3px;
    padding: 8px;
}

.permission-user-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 5px 9px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #334155;
    text-align: left;
}

.permission-user-item span,
.permission-user-item small {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.permission-user-item span {
    font-size: 12px;
    font-weight: 600;
}

.permission-user-item small {
    margin-top: 2px;
    color: #64748b;
    font-size: 11px;
}

.permission-user-item:hover,
.permission-user-item.active {
    background: #dbeafe;
    color: var(--primary);
}

.permission-user-item:hover small,
.permission-user-item.active small {
    color: #2563eb;
}

.permission-items {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: #fff;
}

.permission-items-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 43px;
    padding: 0 12px;
    border-bottom: 1px solid var(--soft-line);
}

.permission-items-head span {
    color: var(--muted);
    font-size: 12px;
}

#permissionCurrentUser {
    display: grid;
    gap: 2px;
}

#permissionCurrentUser > span {
    color: #1f2937;
    font-size: 13px;
    font-weight: 700;
}

#permissionCurrentUser small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
}

.permission-root-list {
    display: grid;
    align-content: start;
    gap: 6px;
    padding: 10px;
    flex: 1 1 auto;
}

.permission-root-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 7px 9px;
    border: 1px solid var(--soft-line);
    border-radius: 6px;
    background: #fff;
}

.permission-root-item:hover {
    border-color: #bfdbfe;
    background: #f8fbff;
}

.permission-root-item input {
    width: 15px;
    height: 15px;
    margin: 0;
}

.permission-root-name {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.permission-root-name span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.permission-root-meta {
    color: var(--muted);
    font-size: 12px;
}

.permission-panel .modal-actions {
    margin-top: 12px;
}

.upload-panel {
    width: min(520px, 100%);
}

.upload-dropzone {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 7px;
    padding: 26px 20px;
    margin-bottom: 12px;
    border: 2px dashed #b9c6da;
    border-radius: 7px;
    background: #f8fafc;
    color: var(--muted);
    text-align: center;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--primary);
    background: #eff6ff;
    transform: translateY(-1px);
}

.upload-dropzone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #dbeafe;
    color: var(--primary);
    font-size: 24px;
    font-weight: 700;
}

.upload-dropzone strong {
    color: var(--text);
    font-size: 16px;
}

.upload-dropzone span:last-child {
    font-size: 12px;
}

.upload-selected {
    display: block;
    max-height: 180px;
    overflow: auto;
    padding: 9px 10px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.upload-selected-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
}

.upload-selected-header .icon-text {
    min-height: 30px;
}

.upload-file-list {
    display: grid;
    gap: 6px;
}

.upload-file-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 7px;
    border-radius: 5px;
    background: #f8fafc;
}

.upload-file-item div {
    min-width: 0;
}

.upload-file-item strong,
.upload-file-item span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-file-item span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.upload-file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 28px;
    flex: 0 0 34px;
    padding: 0;
    line-height: 1;
    text-align: center;
}

.upload-status {
    min-height: 18px;
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 12px;
}

.icon-text:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.preview-modal {
    align-items: stretch;
    padding: 16px;
}

.preview-panel {
    width: min(980px, 80vw);
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.preview-titlebar {
    flex: 0 0 auto;
    margin-bottom: 10px;
}

.preview-titlebar h2 {
    max-width: 680px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-titlebar p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-actions a {
    text-decoration: none;
}

.preview-stage {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fff;
    padding: 10px;
}

.inline-preview-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    margin: 0 auto;
    object-fit: contain;
}

.inline-preview-media,
.inline-preview-frame {
    width: 100%;
    height: 100%;
    min-height: 520px;
    border: 0;
    border-radius: 4px;
    background: #111827;
}

.inline-preview-audio {
    display: block;
    width: min(760px, 100%);
    margin: 160px auto 0;
}

.inline-text-preview {
    min-height: 100%;
    margin: 0;
    padding: 13px;
    overflow: auto;
    border-radius: 4px;
    background: #0f172a;
    color: #e5e7eb;
    line-height: 1.58;
    font-size: 13px;
}

.inline-markdown {
    max-width: 860px;
    margin: 0 auto;
    line-height: 1.66;
    font-size: 13px;
}

.inline-markdown h1,
.inline-markdown h2,
.inline-markdown h3 {
    margin: 18px 0 10px;
    line-height: 1.3;
}

.inline-markdown h1 {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    font-size: 24px;
}

.inline-markdown h2 {
    font-size: 19px;
}

.inline-markdown h3 {
    font-size: 16px;
}

.inline-markdown p,
.inline-markdown ul,
.inline-markdown ol,
.inline-markdown blockquote,
.inline-markdown table {
    margin: 0 0 11px;
}

.inline-markdown ul,
.inline-markdown ol {
    padding-left: 22px;
}

.inline-markdown blockquote {
    padding: 8px 12px;
    border-left: 4px solid var(--primary);
    background: #f8fafc;
    color: var(--muted);
}

.inline-markdown code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #eef2f7;
    color: #be123c;
    font-family: Consolas, "Courier New", monospace;
}

.inline-markdown pre {
    overflow: auto;
    padding: 12px;
    border-radius: 5px;
    background: #0f172a;
    color: #e5e7eb;
}

.inline-markdown pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.inline-markdown table {
    width: 100%;
    border-collapse: collapse;
}

.inline-markdown th,
.inline-markdown td {
    padding: 6px 8px;
    border: 1px solid var(--line);
    text-align: left;
}

.inline-markdown th {
    background: #f8fafc;
}

.inline-markdown img {
    max-width: 100%;
}

.preview-notice {
    max-width: 860px;
    margin: 10px auto 0;
    color: var(--muted);
}

.inline-generic-preview {
    width: min(560px, 100%);
    margin: 64px auto;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
}

.inline-generic-preview strong {
    display: block;
    font-size: 20px;
    margin-bottom: 8px;
}

.inline-generic-preview p {
    color: var(--muted);
}

.inline-generic-preview dl {
    display: grid;
    gap: 8px;
    margin: 18px 0;
}

.inline-generic-preview dl div {
    display: grid;
    grid-template-columns: 76px 1fr;
    gap: 10px;
}

.inline-generic-preview dt {
    color: var(--muted);
}

.inline-generic-preview dd {
    margin: 0;
    word-break: break-all;
}

.spreadsheet-preview {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sheet-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.sheet-tabs button {
    min-height: 29px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fff;
    color: var(--text);
}

.sheet-tabs button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.sheet-panel {
    display: none;
    min-height: 0;
    flex: 1;
}

.sheet-panel.active {
    display: flex;
    flex-direction: column;
}

.sheet-table-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.sheet-table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 100%;
    font-size: 12px;
}

.sheet-table th,
.sheet-table td {
    min-width: 88px;
    max-width: 240px;
    height: 27px;
    padding: 5px 7px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.sheet-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #eef2f7;
    color: var(--muted);
    text-align: center;
    font-weight: 700;
}

.sheet-table .row-head,
.sheet-table .corner {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 42px;
    width: 42px;
    background: #eef2f7;
    color: var(--muted);
    text-align: center;
    font-weight: 700;
}

.sheet-table .corner {
    z-index: 3;
}

.toast-container {
    position: fixed;
    z-index: 1100;
    top: 14px;
    right: 14px;
    display: grid;
    gap: 8px;
}

.toast {
    min-width: 180px;
    max-width: 320px;
    padding: 9px 12px;
    border-radius: 5px;
    background: #0f172a;
    color: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

.toast.success {
    background: #15803d;
}

.toast.warning {
    background: #b45309;
}

.toast.error {
    background: var(--danger);
}

.login-page {
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(390px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 24px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 24px;
}

.login-card p {
    margin: 0 0 18px;
    color: var(--muted);
}

.login-card label {
    display: grid;
    gap: 6px;
    margin-bottom: 13px;
    font-weight: 700;
}

.login-card input {
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
}

.full {
    width: 100%;
}

@media (max-width: 760px) {
    body {
        padding: 0;
        font-size: 12px;
    }

    .app-shell {
        width: 100%;
        height: 100vh;
        margin: 0;
    }

    .topbar {
        padding: 12px;
        margin: 0;
        background: #fff;
        border-bottom: 1px solid var(--line);
    }

    .topbar h1 {
        font-size: 18px;
    }

    .topbar p {
        max-width: calc(100vw - 86px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .pathbar {
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 8px 10px;
    }

    #breadcrumb {
        flex: 1 1 calc(100% - 40px);
        min-height: 31px;
        overflow: hidden;
    }

    #breadcrumb button,
    #breadcrumb span {
        max-width: 112px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .path-search {
        width: 100%;
        margin-left: 0;
    }

    .toolbar {
        align-items: stretch;
        gap: 7px;
        padding: 8px 10px;
    }

    .toolbar-left,
    .selection-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 6px;
    }

    .toolbar-left .icon-text,
    .selection-actions .icon-text {
        min-height: 30px;
        padding: 0 9px;
        font-size: 12px;
    }

    .selection-actions {
        margin-left: 0;
        padding-top: 7px;
        border-top: 1px solid var(--soft-line);
    }

    .selection-actions span {
        width: 100%;
    }

    .stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0;
        padding: 7px 10px;
    }

    .stats div {
        min-width: 0;
    }

    .stats strong {
        font-size: 15px;
    }

    .workspace {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .file-table {
        padding: 8px;
        background: #f8fafc;
    }

    .file-head,
    .explorer-head {
        display: none;
    }

    .file-row {
        position: relative;
        grid-template-columns: 24px minmax(0, 1fr) auto;
        gap: 5px 8px;
        align-items: start;
        margin-bottom: 7px;
        padding: 9px;
        border: 1px solid var(--soft-line);
        border-radius: 7px;
        background: #fff;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    }

    .file-row > span:nth-child(3),
    .file-row > span:nth-child(4) {
        grid-column: 2 / 4;
        color: var(--muted);
        font-size: 11px;
    }

    .file-row .actions {
        grid-column: 2 / 4;
        justify-content: flex-end;
        padding-top: 3px;
    }

    .file-row .file-name {
        min-width: 0;
    }

    .explorer-view {
        padding: 8px;
        background: #f8fafc;
    }

    .explorer-row {
        display: grid;
        grid-template-columns: 24px minmax(0, 1fr) auto;
        gap: 5px 8px;
        align-items: start;
        width: 100%;
        min-width: 0;
        min-height: 0;
        margin-bottom: 7px;
        padding: 9px;
        border: 1px solid var(--soft-line);
        border-radius: 7px;
        background: #fff;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    }

    .explorer-row > span {
        padding: 0;
    }

    .explorer-row > span:nth-child(3),
    .explorer-row > span:nth-child(4),
    .explorer-row > span:nth-child(5) {
        grid-column: 2 / 4;
        color: var(--muted);
        font-size: 11px;
        text-align: left;
    }

    .explorer-actions {
        grid-column: 2 / 4;
        justify-content: flex-end;
        padding-left: 0;
    }

    .actions button,
    .explorer-actions button {
        width: 30px;
        min-height: 30px;
    }

    .action-icon-placeholder,
    .explorer-actions .action-icon-placeholder {
        display: none;
    }

    .inline-upload-box {
        min-height: 112px;
        margin: 8px 0 0;
    }

    .preview-panel {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .preview-titlebar {
        align-items: flex-start;
        gap: 8px;
    }

    .preview-titlebar h2 {
        max-width: calc(100vw - 140px);
        font-size: 14px;
    }

    .preview-actions {
        flex-wrap: nowrap;
    }

    .modal {
        padding: 0;
    }

    .modal-panel {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
        padding: 12px;
    }

    .upload-panel,
    .delete-panel {
        width: 100%;
    }

    .permission-panel {
        width: 100%;
        max-height: 100vh;
    }

    .permission-editor {
        grid-template-columns: 1fr;
        height: calc(100vh - 160px);
        min-height: 360px;
    }

    .permission-users {
        min-height: 210px;
        max-height: 260px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .permission-add {
        padding: 8px;
    }

    .permission-user-list {
        gap: 6px;
        padding: 8px 10px 10px;
    }

    .permission-user-item {
        min-height: 50px;
        padding: 7px 10px;
        justify-content: center;
    }

    .permission-user-item span {
        font-size: 13px;
        line-height: 1.25;
    }

    .permission-user-item small {
        margin-top: 3px;
        font-size: 12px;
        line-height: 1.25;
    }

    .permission-root-list {
        padding: 8px;
    }

    .permission-root-item {
        grid-template-columns: auto 1fr;
    }

    .permission-root-meta {
        grid-column: 2;
        text-align: left;
    }

    .sheet-table-wrap,
    .inline-text-preview,
    .inline-markdown {
        max-width: calc(100vw - 24px);
    }
}

