:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #6d7884;
  --line: #dce2e7;
  --line-soft: #e9edf0;
  --accent: #147d68;
  --accent-dark: #0d6252;
  --accent-soft: #e5f4f0;
  --amber: #b66b15;
  --danger: #bd3b3b;
  --shadow: 0 18px 50px rgba(23, 33, 43, .12);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 1.5px; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #26a77f; box-shadow: 0 0 0 3px rgba(38, 167, 127, .13); }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: linear-gradient(120deg, #edf3f2 0 49%, #f7f8f9 49% 100%); position: relative; overflow: hidden; }
.login-screen::before { content: ""; position: absolute; inset: 0; opacity: .23; background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px); background-size: 36px 36px; pointer-events: none; }
.login-panel { width: min(430px, 100%); padding: 45px 44px 38px; background: rgba(255, 255, 255, .96); border: 1px solid rgba(208, 217, 222, .9); border-radius: 8px; box-shadow: var(--shadow); position: relative; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; background: var(--ink); color: white; border-radius: 6px; font-weight: 900; font-size: 20px; }
.brand-mark.large { width: 48px; height: 48px; margin-bottom: 28px; font-size: 25px; }
.login-panel h1 { margin: 0; font-size: clamp(27px, 6vw, 36px); line-height: 1.15; letter-spacing: 0; }
.login-copy { margin: 12px 0 30px; color: var(--muted); line-height: 1.65; }
.login-form label, dialog label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.password-field { position: relative; }
input, select { width: 100%; min-height: 42px; padding: 0 13px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20, 125, 104, .12); }
.password-field input { height: 48px; padding-right: 48px; }
.password-toggle { position: absolute; top: 5px; right: 5px; }
.form-error { min-height: 20px; margin: 7px 0 5px; color: var(--danger); font-size: 12px; }
.primary-button, .secondary-button, .danger-button, .text-button, .icon-button { border: 0; border-radius: 6px; transition: background .2s, border-color .2s, color .2s, transform .1s; }
.primary-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 18px; background: var(--accent); color: white; font-weight: 750; box-shadow: 0 4px 12px rgba(20, 125, 104, .18); }
.primary-button:hover { background: var(--accent-dark); }
.primary-button:active, .secondary-button:active, .danger-button:active { transform: translateY(1px); }
.primary-button:disabled { opacity: .6; cursor: wait; }
.login-button { width: 100%; height: 48px; justify-content: space-between; padding: 0 17px; }
.login-footnote { margin: 28px 0 0; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.secondary-button { min-height: 38px; padding: 0 14px; color: #34414d; background: #fff; border: 1px solid var(--line); font-weight: 650; }
.secondary-button:hover { background: #f7f9fa; border-color: #c6d0d7; }
.danger-button { min-height: 40px; padding: 0 17px; background: var(--danger); color: white; font-weight: 700; }
.text-button { padding: 8px 10px; color: var(--muted); background: transparent; font-size: 13px; }
.text-button:hover { color: var(--ink); background: #edf0f2; }
.icon-button { width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0; color: #51606d; background: transparent; font-size: 20px; }
.icon-button:hover { color: var(--ink); background: #edf0f2; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); grid-template-rows: 64px minmax(calc(100vh - 64px), auto); }
.topbar { grid-column: 1 / -1; position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 25px; background: rgba(255, 255, 255, .95); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.05; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 1.8px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.connection-state { display: flex; align-items: center; gap: 9px; margin-right: 13px; color: var(--muted); font-size: 12px; }
.sidebar { position: sticky; top: 64px; height: calc(100vh - 64px); padding: 24px 16px; background: #eef1f3; border-right: 1px solid var(--line); }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { width: 100%; height: 43px; display: flex; align-items: center; gap: 12px; padding: 0 13px; color: #596773; background: transparent; border: 0; border-radius: 6px; text-align: left; font-weight: 650; }
.nav-item > span:first-child { width: 20px; font-size: 18px; }
.nav-item:hover { background: rgba(255, 255, 255, .7); color: var(--ink); }
.nav-item.active { color: var(--accent-dark); background: #fff; box-shadow: 0 1px 3px rgba(20, 32, 42, .08); }
.nav-count { margin-left: auto; min-width: 21px; padding: 2px 6px; border-radius: 10px; color: #fff; background: var(--accent); font-size: 10px; text-align: center; }
.storage-card { margin-top: 32px; padding: 17px 14px; border-top: 1px solid #d7dee3; border-bottom: 1px solid #d7dee3; }
.storage-card > div:nth-child(2) { display: flex; align-items: baseline; justify-content: space-between; margin: 10px 0 12px; }
.storage-card span { color: var(--muted); font-size: 11px; }
.storage-card strong { font-size: 16px; }
.storage-icon { color: var(--accent); font-size: 19px; }
.storage-meta { display: flex; justify-content: space-between; }
.sidebar-tip { margin: 23px 10px; }
.sidebar-tip strong { font-size: 12px; }
.sidebar-tip p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.content { min-width: 0; padding: 36px clamp(22px, 4vw, 58px) 70px; }
.content-heading { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 18px 24px; margin-bottom: 16px; }
.content-heading h1 { margin: 0; font-size: 27px; letter-spacing: 0; }
.content-heading p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.heading-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.heading-actions .secondary-button { display: inline-flex; align-items: center; gap: 7px; }
.breadcrumbs { min-height: 34px; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; color: var(--muted); font-size: 12px; }
.breadcrumb-button { min-height: 28px; padding: 0 7px; color: var(--muted); background: transparent; border: 0; border-radius: 4px; }
.breadcrumb-button:hover { color: var(--accent-dark); background: var(--accent-soft); }
.breadcrumb-current { padding: 0 7px; color: var(--ink); font-weight: 700; }
.breadcrumb-separator { color: #a8b1b8; }
.drop-zone { min-height: 112px; display: flex; align-items: center; gap: 18px; padding: 22px 25px; margin-bottom: 29px; background: #fff; border: 1px dashed #bcc8cf; border-radius: 8px; transition: border .2s, background .2s, transform .2s; }
.drop-zone.dragging { background: var(--accent-soft); border-color: var(--accent); transform: translateY(-2px); }
.drop-icon { width: 50px; height: 50px; display: grid; place-items: center; flex: 0 0 auto; color: var(--accent); background: var(--accent-soft); border-radius: 6px; font-size: 25px; }
.drop-zone > div:nth-child(2) { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.drop-zone strong { font-size: 14px; }
.drop-zone span { color: var(--muted); font-size: 12px; }
.drop-actions { margin-left: auto; display: flex; gap: 8px; }
.file-section { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.file-toolbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 17px 12px 20px; border-bottom: 1px solid var(--line-soft); }
.file-toolbar h2, .transfer-head h2 { margin: 0; font-size: 15px; }
.toolbar-controls { display: flex; gap: 8px; }
.search-field { width: min(230px, 35vw); position: relative; }
.search-field span { position: absolute; left: 12px; top: 9px; z-index: 1; color: var(--muted); font-size: 18px; }
.search-field input { height: 38px; min-height: 38px; padding-left: 35px; }
.toolbar-controls select { width: 120px; min-height: 38px; padding-right: 7px; font-size: 12px; }
.table-wrap { min-height: 300px; position: relative; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { height: 40px; padding: 0 17px; color: #8a949d; background: #fafbfc; border-bottom: 1px solid var(--line-soft); text-align: left; font-size: 10px; font-weight: 800; text-transform: uppercase; }
th:first-child { width: 48%; padding-left: 21px; }
th:nth-child(2) { width: 15%; }
th:nth-child(3) { width: 23%; }
th:last-child { width: 14%; text-align: right; }
td { height: 66px; padding: 0 17px; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfc; }
.file-name-cell { display: flex; align-items: center; gap: 13px; min-width: 0; color: var(--ink); }
.file-icon { width: 34px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; color: #66737f; background: #edf0f2; border-radius: 4px; font-size: 9px; font-weight: 900; text-transform: uppercase; }
.file-icon.image { color: #147d68; background: #e5f4f0; }
.file-icon.video { color: #8d5d20; background: #f5ecdf; }
.file-icon.archive { color: #70549a; background: #eee9f5; }
.file-icon.document { color: #326d9c; background: #e6eff6; }
.file-icon.folder { position: relative; color: #8b641b; background: #f4ead7; font-size: 0; }
.file-icon.folder::before { content: ""; width: 22px; height: 15px; margin-top: 4px; background: #d69a32; border-radius: 2px; }
.file-icon.folder::after { content: ""; position: absolute; width: 10px; height: 4px; top: 9px; left: 7px; background: #d69a32; border-radius: 2px 2px 0 0; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.file-name-button { max-width: 100%; overflow: hidden; padding: 6px 3px; color: var(--ink); background: transparent; border: 0; border-radius: 4px; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.file-name-button:hover { color: var(--accent-dark); text-decoration: underline; }
.file-actions { display: flex; justify-content: flex-end; gap: 2px; opacity: .35; transition: opacity .2s; }
tr:hover .file-actions, .file-actions:focus-within { opacity: 1; }
.file-actions .icon-button { width: 31px; height: 31px; font-size: 15px; }
.loading-state, .empty-state { min-height: 258px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.loading-state { gap: 10px; }
.spinner { width: 17px; height: 17px; border: 2px solid #d7dfe3; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { flex-direction: column; }
.empty-state strong { margin-top: 16px; color: var(--ink); font-size: 14px; }
.empty-state p { margin: 6px 0; }
.empty-illustration { width: 78px; height: 56px; position: relative; border: 1px solid #cad3d9; border-radius: 5px; background: #f7f9fa; }
.empty-illustration span { position: absolute; display: block; height: 5px; left: 14px; background: #d5dde2; border-radius: 2px; }
.empty-illustration span:nth-child(1) { top: 15px; width: 29px; }
.empty-illustration span:nth-child(2) { top: 26px; width: 49px; }
.empty-illustration span:nth-child(3) { top: 37px; width: 38px; }

.transfer-panel { position: fixed; right: 24px; bottom: 20px; z-index: 30; width: min(460px, calc(100vw - 32px)); max-height: min(520px, calc(100vh - 90px)); display: none; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.transfer-panel.open { display: flex; }
.transfer-head { min-height: 65px; display: flex; align-items: center; justify-content: space-between; padding: 12px 13px 12px 18px; border-bottom: 1px solid var(--line-soft); }
.transfer-head > div { display: flex; align-items: center; gap: 8px; }
.transfer-head > div:first-child { display: block; }
.transfer-head span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.transfer-list { overflow-y: auto; }
.transfer-empty { padding: 44px 20px; color: var(--muted); text-align: center; font-size: 13px; }
.transfer-item { padding: 15px 16px; border-bottom: 1px solid var(--line-soft); }
.transfer-item:last-child { border: 0; }
.transfer-row { display: flex; align-items: center; gap: 11px; }
.transfer-info { flex: 1; min-width: 0; }
.transfer-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; }
.transfer-status { display: flex; justify-content: space-between; margin-top: 5px; color: var(--muted); font-size: 10px; }
.transfer-actions { display: flex; }
.transfer-actions .icon-button { width: 30px; height: 30px; font-size: 14px; }
.progress-track { height: 3px; margin-top: 10px; overflow: hidden; background: #e8ecef; border-radius: 2px; }
.progress-bar { width: 0; height: 100%; background: var(--accent); transition: width .2s; }
.transfer-item.error .progress-bar { background: var(--danger); }
.transfer-item.done .progress-bar { background: #8ca29c; }

dialog { width: min(430px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(24, 33, 41, .35); backdrop-filter: blur(2px); }
dialog form { padding: 20px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin: -6px -7px 19px 0; }
.dialog-head h2 { margin: 0; font-size: 17px; }
dialog p { color: var(--muted); line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.toast-stack { position: fixed; right: 22px; top: 78px; z-index: 60; display: grid; gap: 8px; }
.toast { max-width: min(360px, calc(100vw - 32px)); padding: 12px 15px; color: white; background: #27333d; border-radius: 6px; box-shadow: 0 8px 25px rgba(0, 0, 0, .18); font-size: 12px; animation: toast-in .25s ease-out; }
.toast.error { background: #9f3333; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-7px); } }

@media (max-width: 800px) {
  .app-shell { display: block; padding-top: 64px; }
  .topbar { position: fixed; inset: 0 0 auto; }
  .sidebar { display: none; }
  .content { padding: 27px 16px 55px; }
  .connection-state { display: none; }
  .content-heading { align-items: center; }
  .drop-zone { padding: 18px; }
  .drop-zone > div:nth-child(2) { flex: 1; }
  .drop-zone .secondary-button { display: none; }
  .drop-actions { display: none; }
  th:nth-child(2), td:nth-child(2), th:nth-child(3), td:nth-child(3) { display: none; }
  th:first-child { width: 76%; }
  th:last-child { width: 24%; }
  .file-actions { opacity: 1; }
}

@media (max-width: 520px) {
  .login-screen { padding: 0; background: #fff; }
  .login-panel { min-height: 100vh; padding: 54px 25px; border: 0; box-shadow: none; }
  .topbar { padding: 0 15px; }
  .brand-mark { width: 34px; height: 34px; }
  .text-button#logoutButton { display: none; }
  .content-heading h1 { font-size: 23px; }
  .content-heading .eyebrow { display: none; }
  .heading-actions { width: 100%; justify-content: stretch; }
  .heading-actions button { flex: 1 1 auto; padding: 0 9px; font-size: 12px; }
  .breadcrumbs { margin-bottom: 10px; overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; }
  .primary-button { padding: 0 13px; }
  .drop-zone { min-height: 94px; gap: 13px; margin-bottom: 18px; }
  .drop-icon { width: 42px; height: 42px; }
  .drop-zone span { display: none; }
  .file-toolbar { align-items: flex-start; flex-direction: column; padding: 14px; }
  .toolbar-controls { width: 100%; }
  .search-field { width: 100%; }
  .toolbar-controls select { width: 112px; }
  td { height: 62px; padding: 0 10px; }
  th { padding: 0 10px; }
  th:first-child { padding-left: 10px; }
  .file-actions [data-action="rename"][data-type="file"] { display: none; }
  .transfer-panel { right: 8px; bottom: 8px; width: calc(100vw - 16px); }
}

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