/* Nimbus · 界面样式
 *
 * 设计取向：纸质工作台，不是 SaaS 落地页。
 * - 层次只用「1px 细线 + 留白」，不用阴影、渐变、圆角大卡片。
 * - 强调色是墨色本身（深底反白），危险动作用一支暗红。
 * - 所有数字、路径、标识符用等宽字体；标签用小号大写 + 字距。
 * - 图标一律 1.5px 描边 SVG，不用 emoji（emoji 会跟字体/系统跑偏）。
 */

:root {
  --paper: #f6f5f2;
  --panel: #fffefc;
  --ink: #16150f;
  --ink-2: #413f37;
  --muted: #787468;
  --faint: #a8a396;
  --line: #dedad0;
  --line-strong: #b8b2a4;
  --hover: rgba(22, 21, 15, 0.045);
  --sel: rgba(22, 21, 15, 0.07);
  --danger: #9c3b23;
  --ok: #3f6b41;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --r: 2px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c0c0d;
    --panel: #131314;
    --ink: #ece9e1;
    --ink-2: #bdb9ad;
    --muted: #8b8779;
    --faint: #5f5c53;
    --line: #262628;
    --line-strong: #3d3d40;
    --hover: rgba(255, 255, 255, 0.05);
    --sel: rgba(255, 255, 255, 0.09);
    --danger: #e08a72;
    --ok: #86b088;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 13px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--ink); color: var(--paper); }

:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }

h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }

p { margin: 0; }

code, .mono { font-family: var(--mono); font-size: 0.94em; }

/* ---------- 按钮 ---------- */

.btn {
  appearance: none;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.2;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.btn:hover:not(:disabled) { background: var(--hover); border-color: var(--ink); }
.btn:active:not(:disabled) { background: var(--sel); }
.btn:disabled { opacity: 0.38; cursor: default; }

.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 500; }
.btn-primary:hover:not(:disabled) { background: var(--ink-2); border-color: var(--ink-2); }

.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 9%, transparent); border-color: var(--danger); }

.btn-sm { font-size: 11.5px; padding: 4px 9px; }
.btn-block { display: block; width: 100%; padding: 10px; font-size: 13px; }

/* ---------- 表单 ---------- */

.field { margin-bottom: 16px; }
.field:last-of-type { margin-bottom: 20px; }

.field label {
  display: block;
  margin-bottom: 7px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 10px;
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--ink);
}

.field input::placeholder { color: var(--faint); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 58px; }

.pw-eye {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  padding: 4px 7px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: var(--r);
  cursor: pointer;
}

.pw-eye:hover { color: var(--ink); background: var(--hover); }

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

.boot { display: grid; place-items: center; min-height: 100vh; }

.boot-spinner {
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-strong);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 登录 / 公开分享 ---------- */

.auth-wrap { min-height: 100vh; }

.auth-split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  min-height: 100vh;
}

/* 左栏：大字号排版说明这个产品是什么，不放插画 */
.auth-mast {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 56px;
  border-right: 1px solid var(--line);
}

.auth-mast .mark { display: block; width: 30px; height: 30px; color: var(--ink); }
.auth-mast .mark svg { display: block; width: 100%; height: 100%; }

.auth-mast h1 {
  margin: 0;
  font-size: clamp(38px, 4.4vw, 62px);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.auth-mast .lede {
  max-width: 32ch;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-2);
}

.meta {
  display: grid;
  gap: 9px;
  max-width: 330px;
  margin: auto 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.meta > div { display: flex; justify-content: space-between; gap: 16px; }

.meta dt, .meta dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.meta dt { color: var(--faint); }
.meta dd { color: var(--ink); }

.fine {
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  color: var(--faint);
}

/* 右栏：表单本体，靠一条竖线跟左栏分开，不再套卡片 */
.auth-split .auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 52px;
}

.auth-card { border: 0; background: none; }

.auth-tabs {
  display: flex;
  gap: 26px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.auth-tabs button {
  position: relative;
  padding: 0 0 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
}

.auth-tabs button:hover { color: var(--ink-2); }
.auth-tabs button.on { color: var(--ink); }

.auth-tabs button.on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--ink);
}

.auth-form-note { margin-top: 18px; }

/* 公开分享页：单卡片居中 */
.share-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.share-wrap .auth-card {
  width: min(430px, 100%);
  padding: 30px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.auth-brand img { width: 20px; height: 20px; }

.auth-sub {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}

.share-wrap .auth-card .kv + .btn-block { margin-top: 12px; }
.share-wrap .auth-card .field + .btn-block { margin-top: 4px; }

/* ---------- 主框架 ---------- */

.shell {
  display: grid;
  grid-template-columns: 196px 1fr;
  grid-template-rows: 46px 1fr;
  height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.brand svg { width: 18px; height: 18px; color: var(--ink); }

.search { flex: 0 1 290px; }

.search input {
  width: 100%;
  padding: 6px 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-bottom-color: var(--ink); }

.spacer { flex: 1; }

.quota-chip {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: var(--muted);
  white-space: nowrap;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}

.user-chip button {
  font: inherit;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}

.user-chip button:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* 侧栏：编号 + 文本，选中是左侧 2px 墨条 + 浅底 */
.sidebar {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 7px 16px;
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
}

.nav-item .nav-num {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.nav-item:hover { color: var(--ink); background: var(--hover); }

.nav-item.on { color: var(--ink); background: var(--sel); font-weight: 600; }
.nav-item.on .nav-num { color: var(--ink); }

.nav-item.on::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--ink);
}

.side-foot {
  margin-top: auto;
  padding: 14px 16px 4px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.side-foot .bar {
  position: relative;
  height: 2px;
  margin-bottom: 8px;
  background: var(--line);
}

.side-foot .bar i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: var(--ink);
}

.side-foot .bar.warn i { background: var(--danger); }

/* ---------- 主区 ---------- */

.main {
  grid-row: 2;
  padding: 22px 26px 64px;
  overflow: auto;
}

.main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}

.crumbs button {
  font: inherit;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.crumbs button:hover { color: var(--ink); text-decoration-color: var(--ink); }
.crumbs .cur { color: var(--ink); }
.crumbs .sep { color: var(--faint); }

.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { border: 0; background: none; }

/* ---------- 表格 ---------- */

table.files {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12.5px;
}

table.files th {
  padding: 0 10px 8px;
  text-align: left;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--line-strong);
}

table.files td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

table.files tbody tr:hover { background: var(--hover); }
table.files tbody tr:hover td { border-bottom-color: var(--line-strong); }

.fname {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.fname .ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.fname .ico svg { width: 16px; height: 16px; }

.fname .txt, .fname button {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fname button {
  padding: 0;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
}

.fname button:hover { text-decoration: underline; text-underline-offset: 3px; }

.col-size {
  width: 96px;
  text-align: right;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}

.col-time {
  width: 108px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}

.col-act { width: 236px; text-align: right; white-space: nowrap; }

/* 行内动作用文字按钮：悬停才上色，避免四颗描边按钮抢视线 */
table.files .col-act .btn {
  padding: 3px 6px;
  font-size: 11.5px;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: var(--r);
}

table.files .col-act .btn:hover:not(:disabled) { color: var(--ink); background: var(--sel); }

table.files .col-act .btn-danger { color: var(--muted); }

table.files .col-act .btn-danger:hover:not(:disabled) {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

/* ---------- 空态 ---------- */

.empty {
  padding: 64px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-tag {
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--faint);
}

.empty .fine { margin-top: 8px; }

/* ---------- 拖拽区 ---------- */

.dropzone {
  border: 1px dashed transparent;
  border-radius: var(--r);
  transition: background 0.12s, border-color 0.12s;
}

.dropzone .card { padding: 0 12px; }

/* 只有空态才画出虚线框：有内容时它就是一块安静的工作面 */
.dropzone:has(.empty) {
  display: grid;
  place-items: center;
  min-height: 260px;
  border-color: var(--line);
}

.dropzone.drag { background: var(--hover); border-color: var(--ink); border-style: solid; }

/* ---------- 标签 / 提示 ---------- */

.tag {
  display: inline-block;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
}

.tag.on { color: var(--ink); border-color: var(--ink); }

.kv {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

.kv code { font-family: var(--mono); font-size: 11.5px; color: var(--ink); }

.secret-box {
  margin: 12px 0;
  padding: 11px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  word-break: break-all;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  user-select: all;
}

/* ---------- 弹窗 ---------- */

#modal-root { position: relative; z-index: 80; }

.modal-mask {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 10, 10, 0.34);
  backdrop-filter: blur(1.5px);
}

.modal {
  width: min(460px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  box-shadow: 0 32px 70px -34px rgba(0, 0, 0, 0.7);
}

.modal .sub {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ---------- 通知 ---------- */

.toasts {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  padding: 9px 12px;
  font-size: 12px;
  color: var(--paper);
  background: var(--ink);
  border-left: 2px solid var(--faint);
  border-radius: var(--r);
}

.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }

.toast .hint {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.6;
  opacity: 0.72;
}

/* ---------- 上传进度 ---------- */

.uploader {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 70;
  width: 286px;
  padding: 11px 13px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
}

.uploader .row { display: flex; justify-content: space-between; gap: 10px; }
.uploader .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploader .pct { color: var(--muted); }
.uploader .bar { position: relative; height: 2px; margin-top: 8px; background: var(--line); }
.uploader .bar i { position: absolute; top: 0; bottom: 0; left: 0; background: var(--ink); transition: width 0.15s; }

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

@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; }

  .auth-mast {
    gap: 16px;
    padding: 34px 20px 26px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .auth-mast h1 { font-size: 34px; }
  .auth-mast .lede { font-size: 13px; }
  .meta { max-width: none; margin-top: 4px; }

  .auth-split .auth-card { padding: 28px 20px 40px; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 46px auto 1fr; height: auto; min-height: 100vh; }

  .topbar { grid-row: 1; grid-column: 1; gap: 10px; padding: 0 12px; }
  .brand span { display: none; }
  .search { flex: 1; min-width: 0; max-width: none; }
  .quota-chip { display: none; }
  .user-chip span { display: none; }
  .user-chip button { white-space: nowrap; }

  .sidebar {
    grid-row: 2;
    grid-column: 1;
    flex-direction: row;
    padding: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

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

  .nav-item { width: auto; padding: 10px 12px; white-space: nowrap; }

  .nav-item.on::before { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 2px; }

  .side-foot { display: none; }

  .main { grid-row: 3; grid-column: 1; padding: 14px 12px 76px; }

  table.files { table-layout: auto; }
  table.files .col-size, table.files .col-time { display: none; }
  .col-act { width: auto; white-space: normal; }

  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; text-align: center; }

  .dropzone, .dropzone .card { min-height: 160px; }
  .uploader { left: 12px; right: 12px; width: auto; }
  .toasts { right: 12px; left: 12px; max-width: none; }
}
