:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfcfd;
  --line: #e8ebf0;
  --line-strong: #d9dee6;
  --ink: #14161a;
  --ink-2: #5b6472;
  --ink-3: #98a1b0;
  --brand: #2f6fed;
  --brand-dark: #245cd0;
  --brand-soft: #eaf0ff;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- 通用控件 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(47, 111, 237, 0.28);
}
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }

.btn-dark { background: #1b1f26; color: #fff; }
.btn-dark:hover:not(:disabled) { background: #10131a; }

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--ink-2);
  background: var(--surface);
}
.btn-ghost:hover:not(:disabled) { background: #f3f5f8; color: var(--ink); }

.btn-text { color: var(--ink-3); padding: 0 8px; }
.btn-text:hover { color: var(--ink); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #cf3b40; }

.btn-danger-ghost { border-color: #f2d3d4; color: var(--danger); background: var(--surface); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }

.btn-block { width: 100%; height: 44px; font-size: 14.5px; border-radius: 11px; }
.btn-icon { width: 38px; padding: 0; }

.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(47, 111, 237, 0.18);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 启动态 ---------- */

.boot {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--ink-3);
  font-size: 13.5px;
}

/* ---------- 登录页 ---------- */

.auth-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 18px 40px;
  background:
    radial-gradient(900px 460px at 50% -8%, #eaf0ff 0%, rgba(246, 247, 249, 0) 72%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 396px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 34px 30px 28px;
  box-shadow: var(--shadow-lg);
}

.auth-brand { margin-bottom: 18px; }

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.2px;
}

.auth-sub {
  margin: 0 0 26px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 20px;
  color: var(--ink-3);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.phone-form,
.login-form { display: flex; flex-direction: column; }

/* 首次绑定面板 */
.bind-box {
  margin-top: 18px;
  padding: 16px 16px 6px;
  border: 1px solid #e4e9f2;
  border-radius: 13px;
  background: #fbfcff;
}

.bind-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 550;
}

.bind-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e8a33d;
  box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.16);
  flex: 0 0 auto;
}

.bind-sub {
  margin: 7px 0 14px;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.55;
}

.bind-toggle {
  margin: 14px 0 0;
  text-align: center;
  font-size: 12.5px;
}
.bind-toggle a {
  color: var(--ink-3);
  text-decoration: none;
}
.bind-toggle a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.field { display: block; margin-bottom: 13px; }

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
}

.field input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface-2);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.field input::placeholder { color: #b3bbc7; }
.field input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3.5px rgba(47, 111, 237, 0.12);
}

.code-row { display: flex; gap: 9px; }
.code-row input { flex: 1; min-width: 0; }
.btn-code {
  height: 44px;
  flex: 0 0 auto;
  padding: 0 14px;
  border-radius: 11px;
  font-size: 13px;
}

.field-error {
  margin: -7px 0 11px;
  color: var(--danger);
  font-size: 12.5px;
}

.form-error {
  margin: 2px 0 12px;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--danger-soft);
  color: #b4282d;
  font-size: 12.5px;
  line-height: 1.45;
}

.auth-hint {
  margin: 12px 0 0;
  text-align: center;
  color: var(--ink-3);
  font-size: 12px;
}

.auth-foot {
  margin: 22px 0 0;
  color: var(--ink-3);
  font-size: 12px;
}

/* ---------- 主界面 ---------- */

.app-view { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
  max-width: 940px;
  margin: 0 auto;
  padding: 0 24px;
}

.brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.brand-name { font-size: 15px; font-weight: 620; letter-spacing: -0.1px; }

.usage {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: 6px;
  min-width: 0;
}
.usage-bar {
  width: 92px;
  height: 5px;
  border-radius: 99px;
  background: #edf0f4;
  overflow: hidden;
}
.usage-fill {
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #4d86f7, #2f6fed);
  transition: width 0.4s ease;
}
.usage-text { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.who {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
  font-size: 12.5px;
}

.main {
  flex: 1;
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 24px 24px 60px;
}

.sys-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 11px 12px 11px 14px;
  border: 1px solid #f3d7d8;
  border-radius: 11px;
  background: #fdf3f3;
  color: #a8323a;
  font-size: 12.5px;
  line-height: 1.55;
  word-break: break-word;
}
.sys-banner span { flex: 1; min-width: 0; }
.sys-banner-close {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #a8323a;
  font-size: 16px;
  line-height: 1;
  opacity: 0.6;
}
.sys-banner-close:hover { opacity: 1; background: rgba(168, 50, 58, 0.08); }

/* 上传区 */
.dropzone {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 22px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  outline: none;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: #a9c2f7;
  background: #fbfcff;
}
.dropzone.is-drag {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.1);
}
.dropzone.is-busy { opacity: 0.6; pointer-events: none; }

.dz-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
}

.dz-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dz-text strong { font-size: 14px; font-weight: 550; }
.dz-text span { color: var(--ink-3); font-size: 12.5px; }

/* 上传进度 */
.upload-panel {
  margin-top: 12px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.up-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}
#up-label { font-size: 13px; font-weight: 500; }
.up-count {
  color: var(--ink-3);
  font-size: 12px;
  text-align: right;
  max-width: 58%;
  line-height: 1.45;
  word-break: break-word;
}
.up-bar { height: 5px; border-radius: 99px; background: #edf0f4; overflow: hidden; }
.up-fill {
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #4d86f7, #2f6fed);
  transition: width 0.25s ease;
}
.up-fill.is-fail { background: var(--danger); }

/* 工具栏 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 12px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
}
.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-wrap input::placeholder { color: #aeb6c2; }
.search-wrap input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.1);
}

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

.select {
  height: 38px;
  min-width: 0;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b6472' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 11px center;
  appearance: none;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 13px;
  outline: none;
}
.select:focus { border-color: var(--brand); }

/* 文件列表 */
.list-wrap { position: relative; }

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.file-list:empty { display: none; }

.file-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 16px 11px 13px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: #fafbfd; }
.file-row.is-selected { background: var(--brand-soft); }

.row-check {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
  cursor: pointer;
  margin: 0;
}

.file-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: #eef1f6;
  color: #5b6472;
}
.file-icon[data-kind="image"] { background: #e8f4ec; color: #23804a; }
.file-icon[data-kind="pdf"]   { background: #fdecec; color: #c2353a; }
.file-icon[data-kind="doc"]   { background: #e8effc; color: #2b5fc4; }
.file-icon[data-kind="sheet"] { background: #e6f5ef; color: #17754a; }
.file-icon[data-kind="slide"] { background: #fdf0e6; color: #b7602a; }
.file-icon[data-kind="zip"]   { background: #f2ecfb; color: #6b45b8; }
.file-icon[data-kind="media"] { background: #fdeef5; color: #b23a76; }
.file-icon[data-kind="code"]  { background: #eaf1f6; color: #33607d; }

.file-main { flex: 1 1 auto; min-width: 0; }

.file-name {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  font-size: 13.8px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.12s ease;
}
.file-name:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

.file-meta {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 11.5px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.file-meta .dot { opacity: 0.6; }

.row-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.34;
  transition: opacity 0.14s ease;
}
.file-row:hover .row-actions,
.file-row:focus-within .row-actions { opacity: 1; }
@media (hover: none) { .row-actions { opacity: 1; } }

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  transition: background 0.13s ease, color 0.13s ease;
}
.icon-btn:hover { background: #eef1f6; color: var(--ink); }
.icon-btn.is-danger:hover { background: var(--danger-soft); color: var(--danger); }

/* 空态 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 64px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-3);
  box-shadow: var(--shadow-sm);
}
.empty svg { color: #ccd4e0; margin-bottom: 6px; }
.empty p { margin: 0; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.empty span { font-size: 12.5px; }
.empty span.err-detail {
  max-width: 480px;
  color: #b4282d;
  text-align: center;
  line-height: 1.55;
  word-break: break-word;
}

.list-loading { display: flex; justify-content: center; padding: 40px 0; }

.foot {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin-top: 26px;
  color: var(--ink-3);
  font-size: 11.5px;
}
.foot-dot { opacity: 0.5; }

/* ---------- 对话框 / 提示 ---------- */

.mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 22, 30, 0.34);
  backdrop-filter: blur(2px);
  animation: fade 0.16s ease;
}
@keyframes fade { from { opacity: 0; } }

.dialog {
  width: 100%;
  max-width: 356px;
  padding: 24px 24px 18px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: pop 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes pop { from { transform: scale(0.96); opacity: 0; } }

.dialog h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.dialog p { margin: 0 0 20px; color: var(--ink-2); font-size: 13px; line-height: 1.55; word-break: break-word; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 80;
  max-width: min(90vw, 420px);
  padding: 10px 16px;
  border-radius: 10px;
  background: #1b1f26;
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: #b4282d; }

/* ---------- 响应式 ---------- */

@media (max-width: 720px) {
  .topbar-inner { height: 58px; padding: 0 14px; gap: 10px; }
  .brand-name { display: none; }
  .usage-text { display: none; }
  .usage-bar { width: 60px; }
  .who { display: none; }
  .main { padding: 16px 14px 48px; }
  .dropzone { padding: 16px; gap: 12px; }
  .dz-icon { width: 40px; height: 40px; }
  .dz-text span { display: none; }
  .toolbar { gap: 8px; }
  .toolbar-actions { width: 100%; margin-left: 0; }
  .select { flex: 1 1 auto; min-width: 0; max-width: 50%; }
  .btn { padding: 0 12px; }
  .file-row { padding: 10px 12px; gap: 10px; }
  .file-icon { width: 34px; height: 34px; }
  .file-meta .file-date { display: none; }
  .foot { flex-wrap: wrap; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
