:root {
  color-scheme: dark;
  --bg: #090b13;
  --panel: rgba(19, 23, 38, 0.82);
  --panel-solid: #141827;
  --panel-soft: rgba(255, 255, 255, 0.045);
  --text: #f4f6ff;
  --muted: #9299ae;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #8a7dff;
  --accent-2: #55d8ff;
  --danger: #ff7b8c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --radius: 22px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fb;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --panel-soft: rgba(20, 26, 46, 0.045);
  --text: #171a27;
  --muted: #6f7689;
  --line: rgba(25, 31, 50, 0.1);
  --accent: #6958ec;
  --accent-2: #168db6;
  --danger: #d94760;
  --shadow: 0 24px 70px rgba(33, 40, 70, 0.14);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(95, 74, 255, 0.12), transparent 28rem),
    radial-gradient(circle at 85% 90%, rgba(55, 201, 255, 0.1), transparent 32rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, label[for] { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.hidden { display: none !important; }

.ambient { position: fixed; width: 28rem; height: 28rem; border-radius: 50%; filter: blur(90px); opacity: .15; pointer-events: none; }
.ambient-one { left: -12rem; top: -8rem; background: #745fff; }
.ambient-two { right: -14rem; bottom: -10rem; background: #31c8ff; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; }
.login-card {
  width: min(100%, 430px);
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--panel);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
  text-align: center;
}
.brand-mark, .mini-mark {
  display: grid; place-items: center; margin-inline: auto;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 34px rgba(115, 99, 255, .28);
}
.brand-mark { width: 70px; height: 70px; border-radius: 23px; margin-bottom: 24px; }
.brand-mark svg { width: 36px; fill: none; stroke: white; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { margin: 0 0 8px; color: var(--accent-2); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(32px, 8vw, 44px); letter-spacing: -.045em; }
.login-copy { margin-bottom: 30px; color: var(--muted); line-height: 1.65; }
.login-form { display: grid; gap: 12px; text-align: left; }
label { color: var(--muted); font-size: 13px; font-weight: 650; }
input {
  width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 14px;
  padding: 0 15px; color: var(--text); background: var(--panel-soft); outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus { border-color: color-mix(in srgb, var(--accent) 70%, white); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px; }
.input-action { position: absolute; right: 7px; top: 7px; }
.primary-button, .secondary-button, .ghost-button, .icon-button, .nav-item {
  border: 0; cursor: pointer; transition: transform .18s, opacity .18s, background .18s, border-color .18s;
}
.primary-button, .secondary-button, .ghost-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; border-radius: 13px; padding: 0 17px; font-weight: 750; }
.primary-button { color: white; background: linear-gradient(135deg, var(--accent), #6758df 62%, var(--accent-2)); box-shadow: 0 12px 28px rgba(105, 88, 236, .22); }
.secondary-button { color: var(--text); border: 1px solid var(--line); background: var(--panel-soft); }
.ghost-button { color: var(--muted); background: transparent; }
.primary-button:hover, .secondary-button:hover, .icon-button:hover, .nav-item:hover { transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border-radius: 11px; color: var(--muted); background: transparent; }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.form-error { min-height: 20px; margin: 2px 0 0; color: var(--danger); font-size: 13px; text-align: center; }
.secure-note { margin: 22px 0 0; color: var(--muted); font-size: 12px; }
.secure-note span { color: #52dca2; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px; border-right: 1px solid var(--line); background: rgba(10, 12, 20, .42); backdrop-filter: blur(24px); }
:root[data-theme="light"] .sidebar { background: rgba(255, 255, 255, .46); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 34px; }
.mini-mark { width: 40px; height: 40px; margin: 0; border-radius: 13px; color: white; font-weight: 900; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { font-size: 17px; }
.sidebar-brand span { color: var(--muted); font-size: 12px; }
.side-nav { display: grid; gap: 7px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border-radius: 14px; color: var(--muted); background: transparent; text-align: left; font-weight: 700; }
.nav-item.active { color: var(--text); background: var(--panel-soft); }
.nav-icon { width: 22px; text-align: center; font-size: 20px; }
.storage-card { margin-top: auto; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel-soft); }
.storage-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.storage-head span, .storage-card p { color: var(--muted); }
.storage-track { height: 7px; margin: 13px 0 10px; border-radius: 99px; overflow: hidden; background: var(--line); }
.storage-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s ease; }
.storage-card p { margin: 0; font-size: 11px; line-height: 1.5; }
.sidebar-actions { display: grid; margin-top: 12px; }
.danger-text { color: var(--danger); }

.workspace { min-width: 0; padding: 34px clamp(20px, 4vw, 56px) 50px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.topbar h2 { margin-bottom: 0; font-size: clamp(28px, 4vw, 40px); letter-spacing: -.04em; }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.upload-label { cursor: pointer; }
.content-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); backdrop-filter: blur(20px); box-shadow: var(--shadow); overflow: hidden; }
.toolbar { min-height: 67px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.breadcrumbs { min-width: 0; display: flex; align-items: center; gap: 6px; overflow: auto; scrollbar-width: none; }
.breadcrumbs button { flex: 0 0 auto; padding: 7px 9px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; }
.breadcrumbs button:hover, .breadcrumbs button:last-child { color: var(--text); background: var(--panel-soft); }
.breadcrumb-separator { color: var(--muted); opacity: .5; }
.drop-zone { margin: 18px 20px 4px; border: 1px dashed transparent; border-radius: 14px; color: transparent; text-align: center; font-size: 13px; height: 0; overflow: hidden; transition: all .2s; }
.drop-zone.dragging { height: 68px; display: grid; place-items: center; border-color: var(--accent); color: var(--accent-2); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.table-head, .file-row { display: grid; grid-template-columns: minmax(220px, 1fr) 110px 170px 150px; gap: 14px; align-items: center; }
.table-head { min-height: 48px; padding: 0 22px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.file-row { min-height: 68px; padding: 8px 16px 8px 22px; border-top: 1px solid var(--line); transition: background .16s; }
.file-row:hover { background: var(--panel-soft); }
.file-name { min-width: 0; display: flex; align-items: center; gap: 13px; }
.file-icon { flex: 0 0 auto; width: 37px; height: 37px; display: grid; place-items: center; border-radius: 12px; color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 10%, transparent); font-size: 19px; }
.file-row.folder .file-icon { color: #ffd36e; background: rgba(255, 205, 82, .1); }
.file-title { min-width: 0; }
.file-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.file-title span { color: var(--muted); font-size: 11px; }
.file-meta { color: var(--muted); font-size: 12px; }
.file-actions { display: flex; justify-content: flex-end; gap: 3px; }
.empty-state { padding: 68px 20px 78px; border-top: 1px solid var(--line); text-align: center; }
.empty-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 19px; color: var(--accent-2); background: var(--panel-soft); font-size: 31px; }
.empty-state h3 { margin-bottom: 6px; }
.empty-state p { margin: 0; color: var(--muted); }

.modal { width: min(92vw, 470px); padding: 0; border: 1px solid var(--line); border-radius: 22px; color: var(--text); background: var(--panel-solid); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(4, 6, 12, .7); backdrop-filter: blur(8px); }
.modal form { display: grid; gap: 13px; padding: 25px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.modal-head h3 { margin: 0; font-size: 22px; }
.modal-close { font-size: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 5px; border-radius: 14px; background: var(--panel-soft); }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: grid; place-items: center; min-height: 39px; border-radius: 10px; color: var(--muted); }
.segmented input:checked + span { color: var(--text); background: var(--panel-solid); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.check-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check-row input { width: 17px; min-height: 17px; accent-color: var(--accent); }
.share-result { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

.toast-region { position: fixed; z-index: 50; right: 20px; top: 20px; display: grid; gap: 10px; width: min(360px, calc(100vw - 40px)); }
.toast { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: var(--panel-solid); box-shadow: var(--shadow); animation: toast-in .25s ease; }
.toast.error { border-color: color-mix(in srgb, var(--danger) 44%, var(--line)); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

.upload-panel { position: fixed; z-index: 40; right: 22px; bottom: 22px; width: min(390px, calc(100vw - 44px)); max-height: 55vh; overflow: auto; padding: 17px; border: 1px solid var(--line); border-radius: 19px; background: var(--panel-solid); box-shadow: var(--shadow); }
.upload-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.upload-panel-head strong, .upload-panel-head span { display: block; }
.upload-panel-head span { color: var(--muted); font-size: 11px; }
.upload-item { padding: 11px 0; border-top: 1px solid var(--line); }
.upload-item:first-child { border-top: 0; }
.upload-name { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 7px; font-size: 12px; }
.upload-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-track { height: 6px; overflow: hidden; border-radius: 99px; background: var(--line); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .15s linear; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 14px 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand { margin: 0 auto 0 0; }
  .side-nav, .storage-card { display: none; }
  .sidebar-actions { display: flex; margin: 0; }
  .sidebar-actions .ghost-button { padding-inline: 10px; font-size: 12px; }
  .workspace { padding-top: 26px; }
}

@media (max-width: 700px) {
  .login-card { padding: 34px 24px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; justify-content: stretch; }
  .top-actions > * { flex: 1 1 150px; }
  .table-head { display: none; }
  .file-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px 10px 12px 15px; }
  .file-meta { display: none; }
  .file-actions { grid-column: 2; grid-row: 1; }
  .file-actions .icon-button:nth-child(2) { display: none; }
  .toolbar { padding-inline: 13px; }
  .drop-zone { margin-inline: 13px; }
}

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

/* v2: batch actions, explicit theme switch, deployment diagnostics */
.floating-theme {
  position: fixed; z-index: 20; top: 20px; right: 20px; width: 44px; height: 44px;
  border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: var(--panel);
  backdrop-filter: blur(18px); box-shadow: var(--shadow); cursor: pointer; font-size: 19px;
}
.theme-button { justify-content: flex-start; }
.theme-button span:first-child { width: 20px; font-size: 17px; }
.build-hint { margin: 6px 0 0; color: var(--muted); font-size: 10px; opacity: .72; }
.compact { min-height: 36px; padding-inline: 13px; border-radius: 11px; font-size: 12px; }
.danger-outline { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }

.batch-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 18px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 7%, var(--panel-soft));
}
.batch-bar > div:first-child { min-width: 0; }
.batch-bar strong, .batch-bar span { display: block; }
.batch-bar strong { font-size: 13px; }
.batch-bar span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.batch-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }

.table-head, .file-row {
  grid-template-columns: 34px minmax(220px, 1fr) 110px 170px 150px;
}
.select-cell { display: grid; place-items: center; min-height: 34px; cursor: pointer; }
.select-cell input {
  width: 17px; min-height: 17px; margin: 0; padding: 0; border-radius: 5px; accent-color: var(--accent);
}
.file-row.selected { background: color-mix(in srgb, var(--accent) 10%, var(--panel-soft)); }
.file-row.selected:hover { background: color-mix(in srgb, var(--accent) 14%, var(--panel-soft)); }

.move-modal { width: min(94vw, 560px); }
.move-breadcrumbs { min-height: 42px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.move-folder-list { max-height: 330px; overflow: auto; display: grid; gap: 7px; }
.move-folder {
  width: 100%; min-height: 48px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px;
  padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: var(--panel-soft);
  text-align: left; cursor: pointer;
}
.move-folder:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-1px); }
.move-folder-icon { color: #ffd36e; font-size: 19px; }
.move-folder > span:last-child { color: var(--muted); font-size: 22px; }
.move-empty, .move-loading { margin: 0; padding: 30px 15px; color: var(--muted); text-align: center; font-size: 13px; }

@media (max-width: 800px) {
  .batch-bar { align-items: flex-start; flex-direction: column; }
  .batch-actions { width: 100%; justify-content: stretch; }
  .batch-actions > * { flex: 1 1 110px; }
}

@media (max-width: 700px) {
  .table-head { display: none; }
  .file-row { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 7px; padding: 12px 8px 12px 10px; }
  .file-row > .select-cell { grid-column: 1; grid-row: 1; }
  .file-row > .file-name { grid-column: 2; grid-row: 1; }
  .file-row > .file-actions { grid-column: 3; grid-row: 1; }
  .file-meta { display: none; }
  .file-actions .icon-button:nth-child(2) { display: none; }
  .floating-theme { top: 14px; right: 14px; }
  .build-hint { max-width: 80vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
