:root {
    color-scheme: dark;
    --bg: #070b13;
    --bg-soft: #0a101c;
    --panel: rgba(15, 23, 39, .88);
    --panel-solid: #101827;
    --panel-hover: #151f32;
    --field: #0b1220;
    --text: #edf3ff;
    --text-soft: #c5d0e3;
    --muted: #8190a8;
    --line: rgba(139, 161, 197, .16);
    --line-strong: rgba(139, 161, 197, .28);
    --primary: #4f8cff;
    --primary-bright: #6ba1ff;
    --primary-dark: #336fe4;
    --primary-soft: rgba(79, 140, 255, .13);
    --cyan: #46d9e7;
    --danger: #ff7383;
    --danger-bg: rgba(255, 83, 107, .10);
    --success: #62d69a;
    --success-bg: rgba(48, 190, 118, .10);
    --radius: 16px;
    --radius-small: 10px;
    --shadow: 0 22px 60px rgba(0, 0, 0, .28);
    --font: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-family: var(--font);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 9% 2%, rgba(42, 101, 216, .18), transparent 28rem),
        radial-gradient(circle at 96% 18%, rgba(37, 190, 209, .08), transparent 24rem),
        linear-gradient(155deg, #080d17 0%, #060a12 50%, #090f1a 100%);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .22;
    background-image: linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, black, transparent 72%);
}

button, input { font: inherit; }

button, a, input { -webkit-tap-highlight-color: transparent; }

::selection { color: #fff; background: rgba(79, 140, 255, .48); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #090e18; }
::-webkit-scrollbar-thumb { border: 2px solid #090e18; border-radius: 999px; background: #28354a; }
::-webkit-scrollbar-thumb:hover { background: #354762; }

.container {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--line);
    background: rgba(7, 11, 19, .76);
    box-shadow: 0 10px 34px rgba(0, 0, 0, .16);
    backdrop-filter: blur(18px) saturate(130%);
}

.topbar-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
    font-size: 17px;
    font-weight: 750;
    letter-spacing: .01em;
}

.brand-mark {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(131, 179, 255, .46);
    border-radius: 17px;
    color: #fff;
    background:
        radial-gradient(circle at 25% 20%, rgba(255, 255, 255, .28), transparent 32%),
        linear-gradient(145deg, #5e9cff, #2f6ee2 72%);
    box-shadow: 0 10px 30px rgba(37, 103, 229, .34), inset 0 1px 0 rgba(255, 255, 255, .20);
    font-size: 18px;
    font-weight: 800;
}

.brand-mark-small {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 14px;
}

.page-content { padding: 30px 0 58px; }

.breadcrumbs {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    padding: 0 3px 9px;
    color: #46556e;
    white-space: nowrap;
    scrollbar-width: none;
}

.breadcrumbs::-webkit-scrollbar { display: none; }

.breadcrumbs a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    transition: color .16s ease;
}

.breadcrumbs a:first-child::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    margin: 0 9px 1px 1px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 12px rgba(79, 140, 255, .8);
}

.breadcrumbs a:last-child { color: var(--text-soft); font-weight: 700; }
.breadcrumbs a:hover { color: var(--primary-bright); }

.panel {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(18, 28, 47, .92), rgba(12, 19, 32, .94));
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .025);
}

.workspace-panel { padding: 25px 26px; }

.workspace-panel::after {
    content: '';
    position: absolute;
    top: -95px;
    right: -75px;
    width: 240px;
    height: 190px;
    pointer-events: none;
    border-radius: 50%;
    background: rgba(65, 132, 255, .07);
    filter: blur(10px);
}

.workspace-heading {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(190px, 1fr) auto;
    align-items: center;
    gap: 28px;
}

h1, h2, p { margin-top: 0; }

h1 {
    margin-bottom: 6px;
    color: #f7faff;
    font-size: clamp(21px, 2.3vw, 27px);
    font-weight: 760;
    letter-spacing: -.025em;
}

h2 {
    margin-bottom: 0;
    color: #f2f6ff;
    font-size: 17px;
    font-weight: 720;
}

.muted { margin-bottom: 0; color: var(--muted); line-height: 1.65; }

.toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.upload-form {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: min(100%, 460px);
}

.upload-form.is-uploading { opacity: .62; pointer-events: none; }

.compact-upload { width: clamp(360px, 40vw, 505px); }

.file-picker {
    flex: 1;
    min-width: 0;
    height: 42px;
    display: flex;
    align-items: center;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: rgba(5, 10, 19, .58);
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.file-picker:hover {
    border-color: rgba(105, 157, 255, .46);
    background: rgba(11, 19, 33, .88);
}

.file-picker-label {
    align-self: stretch;
    display: flex;
    align-items: center;
    padding: 0 13px;
    border-right: 1px solid var(--line);
    color: var(--text-soft);
    background: rgba(255, 255, 255, .035);
    font-size: 14px;
    font-weight: 680;
    white-space: nowrap;
}

.file-picker-name {
    overflow: hidden;
    padding: 0 12px;
    color: var(--muted);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-picker input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 15px;
    cursor: pointer;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    color: var(--text-soft);
    background: rgba(255, 255, 255, .035);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
    font-weight: 680;
    text-decoration: none;
    white-space: nowrap;
    transition: color .16s ease, border-color .16s ease, background .16s ease, transform .16s ease, box-shadow .16s ease;
}

.button:hover {
    border-color: rgba(119, 151, 203, .44);
    color: #fff;
    background: rgba(255, 255, 255, .075);
    transform: translateY(-1px);
}

.button:active { transform: translateY(0); }

.button:focus-visible,
input:focus-visible,
.file-picker:focus-within {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, .18);
}

.button-primary {
    min-height: 42px;
    border-color: rgba(122, 171, 255, .5);
    color: #fff;
    background: linear-gradient(145deg, #5794ff, #346fe2);
    box-shadow: 0 9px 24px rgba(38, 102, 224, .26), inset 0 1px 0 rgba(255, 255, 255, .20);
}

.button-primary:hover {
    border-color: rgba(151, 190, 255, .7);
    background: linear-gradient(145deg, #67a0ff, #3c7aeb);
    box-shadow: 0 12px 28px rgba(38, 102, 224, .34), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.button-ghost { min-height: 37px; background: transparent; }
.button-small { min-height: 33px; padding: 0 12px; border-radius: 8px; font-size: 13px; }

.button-danger {
    border-color: rgba(255, 105, 124, .22);
    color: var(--danger);
    background: var(--danger-bg);
}

.button-danger:hover {
    border-color: rgba(255, 105, 124, .42);
    color: #ff9aa6;
    background: rgba(255, 83, 107, .16);
}

.button-full { width: 100%; }

[data-folder-toggle] {
    border-color: rgba(82, 146, 255, .28);
    color: #9fc0ff;
    background: var(--primary-soft);
}

[data-folder-toggle] span { color: var(--cyan); font-size: 19px; font-weight: 400; line-height: 1; }

.folder-upload-control { display: inline-flex; }

.folder-upload-button {
    border-color: rgba(70, 217, 231, .20);
    color: #8bdde5;
    background: rgba(44, 194, 210, .075);
}

.folder-upload-button:hover {
    border-color: rgba(70, 217, 231, .38);
    color: #b6f3f8;
    background: rgba(44, 194, 210, .12);
}

.folder-upload-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.folder-upload-icon { font-size: 17px; line-height: 1; }
.folder-upload-control.is-uploading { opacity: .62; pointer-events: none; }

.folder-upload-progress {
    position: relative;
    z-index: 1;
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(70, 217, 231, .16);
    border-radius: 12px;
    background: rgba(5, 10, 19, .48);
}

.folder-upload-progress[hidden] { display: none; }

.folder-upload-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 10px;
    color: var(--text-soft);
    font-size: 13px;
}

[data-folder-upload-status] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-folder-upload-count] { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; }

.folder-upload-progress-track {
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .07);
}

.folder-upload-progress-track span {
    width: 0;
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--cyan));
    box-shadow: 0 0 14px rgba(70, 217, 231, .34);
    transition: width .18s ease;
}

.archive-progress-overlay {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(1, 5, 13, .84);
    backdrop-filter: blur(5px);
}

.archive-progress-overlay[hidden] { display: none; }

.archive-progress-card {
    width: min(100%, 440px);
    padding: 28px;
    border: 1px solid rgba(70, 217, 231, .26);
    border-radius: 16px;
    color: var(--text-soft);
    background: #0c1626;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
    text-align: center;
}

.archive-progress-icon {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 13px;
    color: #b6f3f8;
    background: rgba(44, 194, 210, .14);
    font-size: 24px;
}

.archive-progress-card h2 { margin: 16px 0 8px; color: #f2f6ff; font-size: 20px; }
.archive-progress-card p { margin: 0; line-height: 1.7; }

.archive-progress-track {
    height: 7px;
    overflow: hidden;
    margin: 22px 0 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
}

.archive-progress-track span {
    width: 38%;
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--cyan));
    box-shadow: 0 0 14px rgba(70, 217, 231, .48);
    animation: archive-progress-slide 1.25s ease-in-out infinite;
}

.archive-progress-track.has-value span {
    width: 0;
    animation: none;
    transition: width .2s ease;
}

.archive-progress-hint { color: var(--muted); font-size: 13px; }
.archive-cancel-button { margin-top: 18px; }

@keyframes archive-progress-slide {
    from { transform: translateX(-115%); }
    to { transform: translateX(305%); }
}

.new-folder-form {
    position: relative;
    z-index: 1;
    margin-top: 20px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(79, 140, 255, .17);
    border-radius: 12px;
    background: rgba(5, 10, 19, .48);
}

.new-folder-form[hidden] { display: none; }
.new-folder-form label { color: var(--text-soft); font-size: 14px; font-weight: 680; white-space: nowrap; }

.new-folder-form input,
.stack-form input {
    height: 43px;
    padding: 0 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    color: var(--text);
    caret-color: var(--primary-bright);
    background: var(--field);
    transition: border-color .16s ease, box-shadow .16s ease;
}

.new-folder-form input { width: min(390px, 100%); }

.alert {
    margin-top: 16px;
    padding: 13px 16px;
    border: 1px solid;
    border-radius: 11px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .16);
}

.alert-success { color: #8ae5b7; border-color: rgba(80, 211, 145, .25); background: var(--success-bg); }
.alert-error { color: #ff9da9; border-color: rgba(255, 105, 124, .26); background: var(--danger-bg); }

.files-panel { margin-top: 18px; }

.section-heading {
    min-height: 66px;
    padding: 0 23px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .015);
}

.file-count {
    padding: 4px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(0, 0, 0, .12);
    font-size: 12px;
}

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td {
    padding: 15px 22px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: #72819a;
    background: rgba(5, 10, 19, .30);
    font-size: 12px;
    font-weight: 720;
    letter-spacing: .04em;
}

tbody tr { transition: background .16s ease; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(78, 132, 231, .055); }
td:nth-child(2), td:nth-child(3) { color: var(--muted); white-space: nowrap; }

.filename {
    display: block;
    max-width: 430px;
    overflow-wrap: anywhere;
    color: var(--text-soft);
    font-weight: 630;
}

.item-name {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 13px;
    color: var(--text);
    text-decoration: none;
}

.folder-row .item-name:hover .filename { color: #8db6ff; }

.item-icon { position: relative; flex: 0 0 auto; width: 30px; height: 30px; }

.folder-icon {
    height: 22px;
    margin-top: 6px;
    border-radius: 4px;
    background: linear-gradient(145deg, #629cff, #3977e9);
    box-shadow: 0 6px 14px rgba(47, 107, 222, .26), inset 0 1px 0 rgba(255, 255, 255, .18);
}

.folder-icon::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 2px;
    width: 14px;
    height: 7px;
    border-radius: 4px 4px 0 0;
    background: #6da4ff;
}

.file-icon {
    width: 24px;
    height: 29px;
    margin-left: 3px;
    border: 1.5px solid #667893;
    border-radius: 4px;
    background: rgba(255, 255, 255, .025);
}

.file-icon::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-bottom: 1.5px solid #667893;
    border-left: 1.5px solid #667893;
    background: var(--panel-solid);
}

.actions-heading { text-align: right; }
.actions { display: flex; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.inline-form { display: inline-flex; margin: 0; }

.empty-state {
    min-height: 330px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 35px 20px 45px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong { margin-top: 7px; color: var(--text-soft); font-size: 16px; }

.empty-icon {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(91, 153, 255, .19);
    border-radius: 22px;
    color: #76a8ff;
    background: linear-gradient(145deg, rgba(79, 140, 255, .14), rgba(55, 204, 219, .055));
    box-shadow: 0 16px 38px rgba(0, 0, 0, .20), inset 0 1px 0 rgba(255, 255, 255, .045);
    font-size: 25px;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 18% 12%, rgba(50, 114, 232, .23), transparent 30rem),
        radial-gradient(circle at 83% 85%, rgba(36, 190, 205, .10), transparent 28rem),
        #070b13;
}

.login-card {
    width: min(100%, 410px);
    padding: 38px;
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(18, 28, 47, .95), rgba(10, 16, 28, .96));
    box-shadow: 0 28px 80px rgba(0, 0, 0, .40), inset 0 1px 0 rgba(255, 255, 255, .035);
    backdrop-filter: blur(18px);
}

.login-card .brand-mark { margin-bottom: 25px; }
.login-card h1 { margin-bottom: 5px; font-size: 25px; }
.login-card .alert { margin-bottom: 20px; }

.stack-form { display: grid; gap: 9px; margin-top: 27px; }
.stack-form label { color: var(--text-soft); font-size: 14px; font-weight: 680; }
.stack-form .button { margin-top: 9px; }

@media (max-width: 980px) {
    .workspace-heading { align-items: stretch; grid-template-columns: 1fr; }
    .toolbar { justify-content: stretch; }
    .compact-upload { width: 100%; }
}

@media (max-width: 740px) {
    .container { width: min(100% - 24px, 1180px); }
    .page-content { padding-top: 20px; }
    .workspace-panel { padding: 20px; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .folder-upload-control, .folder-upload-button { width: 100%; }
    .upload-form { min-width: 0; }
    .new-folder-form { align-items: stretch; flex-wrap: wrap; }
    .new-folder-form label, .new-folder-form input { width: 100%; }
    th, td { padding-right: 16px; padding-left: 16px; }
}

@media (max-width: 620px) {
    .topbar-inner { min-height: 64px; }
    .brand-mark-small { width: 35px; height: 35px; }
    .page-content { padding-bottom: 34px; }
    .breadcrumbs { padding-bottom: 7px; }
    .workspace-panel { border-radius: 14px; }
    .workspace-heading { gap: 20px; }
    .upload-form { align-items: stretch; flex-direction: column; }
    .file-picker { flex: auto; }
    .new-folder-form { flex-direction: column; }
    .folder-upload-progress-head { align-items: flex-start; flex-direction: column; gap: 4px; }
    [data-folder-upload-status] { width: 100%; white-space: normal; }
    .new-folder-form .button { width: 100%; }
    .files-panel { overflow: visible; border: 0; background: transparent; box-shadow: none; }
    .section-heading { min-height: 58px; padding: 0 4px; border: 0; background: transparent; }
    table, tbody { display: block; }
    thead { display: none; }
    tr {
        display: block;
        margin-bottom: 11px;
        padding: 14px;
        border: 1px solid var(--line);
        border-radius: 13px;
        background: linear-gradient(145deg, rgba(18, 28, 47, .94), rgba(12, 19, 32, .96));
        box-shadow: 0 14px 35px rgba(0, 0, 0, .22);
    }
    tbody tr:last-child td, td {
        display: grid;
        grid-template-columns: 88px minmax(0, 1fr);
        gap: 9px;
        padding: 7px 0;
        border: 0;
    }
    td::before { content: attr(data-label); color: #65748d; font-size: 12px; font-weight: 700; }
    td.actions { display: flex; justify-content: flex-end; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
    td.actions::before { display: none; }
    .filename { max-width: none; }
    .empty-state {
        min-height: 290px;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: linear-gradient(145deg, rgba(18, 28, 47, .72), rgba(12, 19, 32, .8));
    }
    .login-card { padding: 30px 25px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
