:root {
    --bg: #ffffff;
    --card: #ffffff;
    --line: #ece7e1;
    --text: #2f2a26;
    --muted: #8a8178;
    --btn: #b86a3d;
    --btn-text: #ffffff;
    --folder: #5c6b56;
    --folder-bg: #eef1ea;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #fff;
    color: var(--text);
    min-height: 100vh;
}

a { color: var(--text); text-decoration: none; }
a:visited { color: var(--text); }

.glow { display: none; }

.page-login { display: grid; place-items: center; padding: 24px; background: #faf7f3; }
.page-list { padding-bottom: 40px; background: #fff; }

.card {
    position: relative;
    z-index: 1;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.login-card {
    width: min(400px, 100%);
    padding: 32px 28px 24px;
    text-align: center;
}

.logo {
    width: 48px;
    height: 48px;
    margin: 0 auto 14px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #f4ebe3;
    border: 1px solid var(--line);
    color: var(--btn);
    font-size: 24px;
}
.logo.small {
    width: 28px;
    height: 28px;
    margin: 0;
    font-size: 14px;
    border-radius: 7px;
}

h1 { margin: 0 0 8px; font-size: 24px; font-weight: 700; }
.sub, .foot, .muted { color: var(--muted); }
.sub { margin: 0 0 20px; }
.foot { margin: 16px 0 0; font-size: 13px; }

.alert {
    background: #fdecea;
    border: 1px solid #f3c5c0;
    color: #a33b32;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 12px;
    font-size: 14px;
}

.field {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #faf7f3;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 12px;
    margin-bottom: 12px;
}
.field input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--text);
    height: 42px;
    font-size: 15px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    font-weight: 650;
    border-radius: 8px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
    width: 100%;
    height: 42px;
    background: var(--btn);
    color: var(--btn-text);
    font-size: 15px;
}
.btn-primary:visited { color: var(--btn-text); }
.btn-ghost {
    height: 28px;
    padding: 0 10px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 13px;
}
.btn-ghost:visited { color: var(--text); }
.btn-sm {
    height: 20px;
    padding: 0 7px;
    background: var(--btn);
    color: var(--btn-text);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}
.btn-sm:visited { color: var(--btn-text); }

.crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 13px;
}
.crumbs a, .crumbs a:visited { color: #6a5b4e; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: var(--muted); }

.folder-link, .folder-link:visited {
    color: var(--folder);
    font-weight: 600;
}
.folder-link::before {
    content: "";
    display: inline-block;
    width: 13px;
    height: 10px;
    margin-right: 7px;
    vertical-align: -1px;
    border-radius: 2px 2px 1px 1px;
    background: linear-gradient(#d9cbb0, #c9b896);
    box-shadow: 3px -2px 0 0 #e4d7be;
}
.folder-link:hover { color: #4a5746; text-decoration: underline; }

.file-link, .file-link:visited {
    color: var(--text);
    font-weight: 500;
}
.file-link:hover { color: #1f1b18; text-decoration: underline; }

.row-dir td { background: #e4eadc; }
.row-file.type-archive td { background: #efe0b8; }
.row-file.type-pdf td { background: #f0cfc8; }
.row-file.type-doc td { background: #d4e3f0; }
.row-file.type-sheet td { background: #d5ead6; }
.row-file.type-slide td { background: #eed9c4; }
.row-file.type-image td { background: #e2d6ee; }
.row-file.type-video td { background: #cfe0ee; }
.row-file.type-audio td { background: #ead4de; }
.row-file.type-text td { background: #e8e0c8; }
.row-file.type-app td { background: #e8cfcf; }
.row-file.type-other td { background: #e6e4df; }
.row-dir td:first-child { box-shadow: inset 3px 0 0 #8a9a7a; }
.row-file.type-archive td:first-child { box-shadow: inset 3px 0 0 #c4a35a; }
.row-file.type-pdf td:first-child { box-shadow: inset 3px 0 0 #c4847a; }
.row-file.type-doc td:first-child { box-shadow: inset 3px 0 0 #6a93b8; }
.row-file.type-sheet td:first-child { box-shadow: inset 3px 0 0 #6fa37a; }
.row-file.type-slide td:first-child { box-shadow: inset 3px 0 0 #c4926a; }
.row-file.type-image td:first-child { box-shadow: inset 3px 0 0 #9a7ab0; }
.row-file.type-video td:first-child { box-shadow: inset 3px 0 0 #6a92b0; }
.row-file.type-audio td:first-child { box-shadow: inset 3px 0 0 #b07a94; }
.row-file.type-text td:first-child { box-shadow: inset 3px 0 0 #b09a5a; }
.row-file.type-app td:first-child { box-shadow: inset 3px 0 0 #c47a7a; }
.row-file.type-other td:first-child { box-shadow: inset 3px 0 0 #a8a49a; }
.ext-dir {
    background: #d5e0cc !important;
    color: #4e5c48 !important;
    text-transform: none !important;
}

.topbar {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.badge {
    font-size: 12px;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 0 7px;
    border-radius: 999px;
}

.wrap { width: min(1100px, calc(100% - 32px)); margin: 12px auto 0; position: relative; z-index: 1; }
.table-card { padding: 8px 10px 2px; }
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.search-form {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}
.search {
    flex: 1;
    max-width: 420px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    padding: 0 8px;
    outline: none;
}
.meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.meta b { color: var(--text); }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: 1px 8px;
    line-height: 1.2;
    height: 22px;
    vertical-align: middle;
}
th {
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    border-bottom: 1px solid var(--line);
    height: 24px;
}
td { border-bottom: 1px solid #f3eee8; font-size: 13px; }
.ext {
    display: inline-block;
    padding: 0 4px;
    border-radius: 3px;
    background: #f4ebe3;
    color: #7a6b5e;
    font-size: 11px;
    text-transform: lowercase;
}
.empty-row td { text-align: center; color: var(--muted); padding: 14px 12px; height: auto; }
.col-action { width: 64px; white-space: nowrap; }
.path-link, .path-link:visited { color: var(--muted); font-size: 12px; }
.path-link:hover { text-decoration: underline; }

.page-preview { background: #fff; }
.page-preview .topbar {
    padding: 14px 48px 14px 80px;
}
.preview-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.back, .back:visited { color: #6a5b4e; flex-shrink: 0; }
.back:hover { text-decoration: underline; }
.preview-wrap {
    padding: 28px 64px 64px 96px;
    box-sizing: border-box;
}
.preview-body {
    display: block;
    margin: 0;
    padding: 32px 40px 32px 72px;
    background: #faf7f3;
    border: 1px solid var(--line);
    border-radius: 8px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.75;
    color: var(--text);
    tab-size: 4;
    text-align: left;
}

@media (max-width: 640px) {
    .toolbar { flex-direction: column; align-items: stretch; }
    .search { max-width: none; }
    .page-preview .topbar { padding: 10px 16px 10px 24px; }
    .preview-wrap { padding: 16px 16px 32px 32px; }
    .preview-body { padding: 20px 16px 20px 28px; }
}
