/* MiSans：门户与主站同一套字体（可变字重 150–700，子集文件约 2.6 MB） */
@font-face {
  font-family: "MiSans";
  src: url("assets/fonts/MiSans.woff2?v=20261030") format("woff2");
  font-weight: 150 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* 和课程表 / 密码管家官网同一档：近白底，卡片纯白 */
  --bg: #fbfbf9;
  --surface: #ffffff;
  --surface-soft: #f4f3ef;
  --ink: #1b1d1b;
  --ink-soft: #4d524d;
  --muted: #6b706a;
  --line: #e6e4de;
  --line-strong: #d3d1ca;
  --hover: #f1f0eb;
  --accent: #2f6a58;
  --accent-ink: #245446;
  --accent-soft: rgba(47, 106, 88, 0.09);
  --sky: #cfe9fb;
  --sky-deep: #a9d6f4;
  --code: #f3f2ed;
  --danger: #b04436;
  --danger-soft: rgba(176, 68, 54, 0.08);
  --sans: "MiSans", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "MiSans", ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 12px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  /* 顶栏高度：和「大学课程表」官网同一档，宽屏放大一档 */
  --topbar-h: 68px;
}

@media (min-width: 900px) {
  :root {
    --topbar-h: 82px;
  }
}

/* 手动深色（theme-init.js 写在 html 上）优先；没有脚本时才按系统深色兜底。 */
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    color-scheme: dark;
    --bg: #0e100f;
    --surface: #151816;
    --surface-soft: #121513;
    --ink: #e9ebe6;
    --ink-soft: #b7bdb5;
    --muted: #8a9188;
    --line: #242925;
    --line-strong: #363c36;
    --hover: #191d19;
    --accent: #7fb9a4;
    --accent-ink: #a3d0bd;
    --accent-soft: rgba(127, 185, 164, 0.12);
    --sky: #14232e;
    --sky-deep: #0f1a22;
    --code: #161a17;
    --danger: #e08272;
    --danger-soft: rgba(224, 130, 114, 0.14);
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e100f;
  --surface: #151816;
  --surface-soft: #121513;
  --ink: #e9ebe6;
  --ink-soft: #b7bdb5;
  --muted: #8a9188;
  --line: #242925;
  --line-strong: #363c36;
  --hover: #191d19;
  --accent: #7fb9a4;
  --accent-ink: #a3d0bd;
  --accent-soft: rgba(127, 185, 164, 0.12);
  --sky: #14232e;
  --sky-deep: #0f1a22;
  --code: #161a17;
  --danger: #e08272;
  --danger-soft: rgba(224, 130, 114, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

/* 套餐页刚打开时内容还没渲染出来，会短到没有滚动条，等 JS 填上卡片又出现滚动条，
   页面就会横向抖一下。让根滚动条常驻，各页可用宽度始终一致。 */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--sans);
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent-ink);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.micro {
  font-size: 12px;
  color: var(--muted);
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 8px;
  top: 8px;
  z-index: 9;
  background: var(--surface);
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

[hidden] {
  display: none !important;
}

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

.shell {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
}

.brand:hover {
  text-decoration: none;
}

/* 品牌一行：图标、放大的 LiangDrive、右侧小字「个人云盘」，
   小字和 LiangDrive 共用一条基线，底部对齐 */
.brand > span {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.brand-mark,
.brand-logo {
  width: 34px;
  height: 34px;
  color: var(--accent);
  flex: none;
}

.brand-mark {
  object-fit: contain;
}

.brand-logo {
  border-radius: 6px;
  object-fit: cover;
}

.brand strong {
  display: block;
  font-size: 18px;
  line-height: 1;
  letter-spacing: -0.01em;
}

.brand small {
  display: block;
  font-size: 11px;
  line-height: 1;
  color: var(--muted);
}

/* 宽屏顶栏放大一档：图标和字一起变大 */
@media (min-width: 900px) {
  .brand {
    gap: 12px;
  }

  .brand-mark,
  .brand-logo {
    width: 42px;
    height: 42px;
  }

  .brand strong {
    font-size: 22px;
  }
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.topnav a,
.topnav button {
  font: inherit;
  font-size: 13.5px;
  color: var(--ink-soft);
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.topnav a:hover,
.topnav button:hover {
  background: var(--hover);
  text-decoration: none;
}

/* 当前页只加粗，不画框、不上底色，和首页顶栏的「首页」一致 */
.topnav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  border-color: transparent;
  background: transparent;
}

/* 首页入口和左上角品牌是同一个去处，这里只是做得更显眼一点 */
.topnav a.nav-home {
  color: var(--ink);
  font-weight: 600;
}

main {
  flex: 1;
  padding: 28px 0 40px;
}

.footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  padding: 16px 20px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- 卡片：一行一排 ---------- */

.stack {
  display: grid;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 320px;
}

.card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.card-head h2 {
  font-size: 16px;
}

.card-head .spacer {
  margin-left: auto;
}

.section-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--hover);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
}

.btn.danger {
  color: var(--danger);
  border-color: var(--line-strong);
}

.btn.danger:hover {
  background: var(--danger-soft);
}

.btn.block {
  width: 100%;
}

/* 侧栏退出这类次要动作：去掉边框和底色，免得和输入框长得一样 */
.btn.quiet {
  background: none;
  border-color: transparent;
  color: var(--muted);
}

.btn.quiet:hover {
  background: var(--hover);
  color: var(--ink);
}

.btn.small {
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

.icon-btn.is-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- 主题切换：后台同一套三模式动画 ---------- */

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

.topnav + .topbar-actions {
  margin-left: 10px;
}

.topbar-actions .land-cta {
  margin-left: 0;
}

/* 主题按钮放进导航里时，不要被 .topnav button 的文字按钮样式带偏 */
.topnav .icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-color: transparent;
  background: none;
  color: var(--muted);
}

.topnav .icon-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

.theme-btn.is-animating {
  background: var(--hover);
}

.theme-btn svg {
  width: 21px;
  height: 21px;
  display: block;
}

.theme-icon {
  width: 21px;
  height: 21px;
  display: block;
  background: currentColor;
  --theme-icon: url("/portal/icons/theme/light.svg");
  -webkit-mask: var(--theme-icon) center / contain no-repeat;
  mask: var(--theme-icon) center / contain no-repeat;
}

html:not([data-theme]) .theme-icon,
html[data-theme="light"][data-mode="light"] .theme-icon {
  --theme-icon: url("/portal/icons/theme/light.svg");
}

html[data-theme="dark"][data-mode="dark"] .theme-icon {
  --theme-icon: url("/portal/icons/theme/dark.svg");
}

html[data-theme="light"][data-mode="auto"] .theme-icon {
  --theme-icon: url("/portal/icons/theme/light-a.svg");
}

html[data-theme="dark"][data-mode="auto"] .theme-icon {
  --theme-icon: url("/portal/icons/theme/dark-a.svg");
}

html.theme-anim *:not(svg):not(svg *) {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

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

.field {
  display: block;
}

.field > span {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 5px;
}

.field input,
.field select {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 9px 11px;
}

.field input:focus,
.field select:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.field small {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-error {
  font-size: 13px;
  color: var(--danger);
  min-height: 1em;
}

.note {
  font-size: 12.5px;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 3px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  font: inherit;
  font-size: 14px;
  padding: 7px 0;
  background: none;
  border: 0;
  border-radius: 8px;
  color: var(--ink-soft);
  cursor: pointer;
}

.tab:hover {
  background: var(--hover);
}

.tab.is-active {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

.tab:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- 首页 ---------- */

.hero {
  padding: 26px 0 30px;
}

.hero h1 {
  font-size: 30px;
  line-height: 1.25;
  margin-bottom: 10px;
}

.hero .lede {
  color: var(--ink-soft);
  max-width: 58ch;
}

.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.facts b {
  color: var(--ink);
  font-weight: 600;
}

.steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 14px;
  color: var(--ink-soft);
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  flex: none;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 11px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 套餐：左中右三列，每列最多五份 ---------- */

.pkg-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.pkg-col {
  min-width: 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

@media (max-width: 760px) {
  .pkg-cols {
    grid-template-columns: 1fr;
  }
}

.pkg-col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.pkg-col-head h3 {
  font-size: 14.5px;
}

.pkg-rows {
  display: grid;
  gap: 8px;
}

.pkg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 9px 11px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.pkg:hover {
  border-color: var(--line-strong);
  background: var(--hover);
}

.pkg-info {
  display: flex;
  /* 用 center 不用 baseline：等宽小字号的价格按基线排会低 1px 出头，中轴对不上卡片和按钮 */
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.pkg-size {
  font-size: 14px;
  color: var(--ink);
}

.pkg-price {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.pkg-actions {
  margin-left: auto;
}

.pkg-actions .btn {
  padding: 4px 10px;
}

.pkg-col-empty {
  padding: 12px 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.confirm-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------- 用量条 ---------- */

.usage-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 7px;
}

.bar {
  height: 6px;
  background: var(--hover);
  border-radius: 999px;
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.bar.is-over > span {
  background: var(--danger);
}

.split {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.split b {
  color: var(--ink);
  font-weight: 600;
}

.split span {
  white-space: nowrap;
}

.warn {
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--danger);
  border-radius: 8px;
  background: var(--danger-soft);
  font-size: 13px;
  color: var(--ink);
}

/* ---------- 身份与连接信息 ---------- */

.identity {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.avatar {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 650;
  color: var(--accent-ink);
}

.identity-main strong {
  display: block;
  font-size: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  font-size: 11.5px;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
}

.pill.is-paid {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.endpoint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.endpoint code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  background: none;
  padding: 0;
  font-size: 12.5px;
}

.kv {
  display: grid;
  gap: 0;
  margin: 14px 0 0;
  border-top: 1px solid var(--line);
}

.kv > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  color: var(--ink);
  text-align: right;
  overflow-wrap: anywhere;
}

.kv-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.kv-copy span {
  font-family: var(--mono);
}

/* ---------- 文件管理 ---------- */

/* ---------- 网盘外壳：左侧栏 + 整页文件区 ---------- */

.shell-wide {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0 20px;
}

.drive {
  flex: 1;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: start;
  width: 100%;
  padding: 0;
}

.drive-side {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  min-height: calc(100vh - var(--topbar-h));
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 14px 24px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.drive-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drive-user .avatar {
  width: 34px;
  height: 34px;
  font-size: 14px;
}

.drive-user .identity-main {
  min-width: 0;
  flex: 1 1 auto;
}

.identity-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.drive-user .identity-main strong {
  min-width: 0;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-id {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.identity-id span {
  font-family: var(--mono);
}

.drive-user .pill {
  flex: none;
  font-size: 10.5px;
  padding: 1px 7px;
}

.drive-usage {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.drive-nav {
  display: grid;
  align-content: start;
  gap: 2px;
  flex: 1 1 auto;
}

.side-label {
  padding: 14px 8px 6px;
  font: 10.5px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.drive-link {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.drive-link:hover {
  background: var(--hover);
  color: var(--ink);
}

.drive-link.is-active {
  background: var(--hover);
  border-color: var(--line-strong);
  color: var(--ink);
  font-weight: 600;
}

.drive-link svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}

.drive-link.is-active svg {
  color: var(--accent);
}

.drive-link span {
  flex: 1 1 auto;
  min-width: 0;
}

.drive-link .count {
  font: 11px var(--mono);
  font-style: normal;
  color: var(--muted);
}

.drive-side-foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.drive-main {
  position: relative;
  min-width: 0;
  padding: 20px clamp(16px, 3vw, 30px) 56px;
}

.drive-head,
.pane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.pane-head h2 {
  font-size: 17px;
  margin-right: auto;
}

.drive-head .crumb {
  margin-right: auto;
}

.drive-head .crumb strong {
  font-size: 15px;
  color: var(--ink);
  margin-right: 8px;
}

/* 文件面板的左上角标题，和回收站一样 */
.drive-head .crumb .crumb-root {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.drive-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
}

.search svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.search input {
  border: 0;
  outline: none;
  background: none;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  width: 180px;
  min-width: 90px;
}

.file-head {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 0 10px 6px;
  border-bottom: 1px solid var(--line);
  font: 10.5px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.file-head button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.file-head button:hover {
  color: var(--ink);
}

.file-head .is-sorted {
  color: var(--accent-ink);
}

.file-head .is-sorted::after {
  content: "\2191";
}

.file-head .is-sorted[aria-sort="descending"]::after {
  content: "\2193";
}

.fh-size,
.fh-time {
  text-align: right;
}

.fh-actions {
  width: 96px;
}

.file-head,
.file {
  grid-template-columns: 18px minmax(0, 1fr) 92px 116px 96px;
}

.file-list[data-mode="category"] .file,
.file-head[data-mode="category"],
.file-list[data-mode="search"] .file,
.file-head[data-mode="search"] {
  grid-template-columns: 18px minmax(0, 1fr) 92px 116px minmax(0, 170px) 96px;
}

/* 文件区多了勾选框一列；回收站的行没有勾选框，所以只给 .is-pickable 加 */
.file.is-pickable,
.file-head[data-mode] {
  grid-template-columns: 22px 18px minmax(0, 1fr) 92px 116px 96px;
}

.file-list[data-mode="search"] .file.is-pickable,
.file-head[data-mode="search"] {
  grid-template-columns: 22px 18px minmax(0, 1fr) 92px 116px minmax(0, 170px) 96px;
}

.fh-check,
.file-check {
  display: flex;
  align-items: center;
}

.file-check input,
.fh-check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.file.is-selected {
  background: var(--accent-soft);
}

.bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 10px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
}

.bulk-count {
  font-size: 13px;
  color: var(--ink-soft);
}

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

.bulk .tip {
  font-size: 12.5px;
  color: var(--muted);
}

.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  color: var(--muted);
}

.crumb button {
  font: inherit;
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 3px 7px;
  color: var(--accent-ink);
  cursor: pointer;
}

.crumb button:hover {
  background: var(--hover);
}

.crumb button[aria-current="path"] {
  color: var(--ink);
  cursor: default;
}

.crumb button[aria-current="path"]:hover {
  background: none;
}

.crumb i {
  font-style: normal;
  color: var(--line-strong);
}

.file-list {
  min-height: 240px;
}

.file {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  min-height: 44px;
}

.file:hover {
  background: var(--hover);
}

.file-icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--muted);
}

.file.is-dir .file-icon {
  color: var(--accent);
}

.file-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.file-sub {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

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

.file-name a:hover,
.file-name button:hover {
  text-decoration: underline;
}

.file-size,
.file-date {
  font-size: 12.5px;
  color: var(--muted);
  font-family: var(--mono);
  text-align: right;
  min-width: 0;
}

.file-where {
  min-width: 0;
  font-size: 12px;
}

.file-where button {
  font: inherit;
  background: none;
  border: 0;
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-where button:hover {
  background: var(--surface);
  color: var(--accent-ink);
}

.file-actions {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
}

.file input[type="text"] {
  font: inherit;
  font-size: 14px;
  width: 100%;
  padding: 3px 7px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

/* 行内确认（删除）：换到第二行并靠右，勾选框那一列加进来后仍然对齐 */
.file-confirm {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 12.5px;
  color: var(--danger);
}

.list-note {
  padding: 12px 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.drop-hint {
  position: absolute;
  inset: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--accent);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 14px;
  pointer-events: none;
}

.drive-main.is-dragging .drop-hint {
  display: flex;
}

.uploads {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 12;
  display: grid;
  gap: 6px;
  width: min(320px, calc(100vw - 36px));
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
}

.uploads:empty {
  display: none;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.upload-row .name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.upload-row .bar {
  width: 90px;
  flex: none;
}

.pane-sub {
  margin: 26px 0 10px;
  font-size: 14px;
}

#trash-note {
  margin-bottom: 8px;
}

.setting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

/* 只有设置页的三张卡片用 block 的外观；.btn.block 只是「占满一行」，
   不能被这里的 padding / 圆角带高，否则购买、退出、提交按钮都会变成 52px 高。 */
.setting-grid > .block {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.setting-grid > .block h3 {
  font-size: 14px;
}

.empty-row {
  padding: 40px 0;
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
}

/* ---------- 订单 ---------- */

.orders {
  display: grid;
  gap: 8px;
}

.order {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  font-size: 13px;
}

.order.is-void {
  color: var(--muted);
  border-style: dashed;
}

.order .when {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.order .what {
  font-weight: 600;
  color: var(--ink);
}

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

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

body[data-view="login"] {
  background:
    radial-gradient(1000px 520px at 50% -140px, var(--sky-deep), transparent 70%),
    linear-gradient(180deg, var(--sky) 0%, var(--bg) 62%);
}

body[data-view="login"] .topbar,
body[data-view="login"] .footer {
  background: none;
  border-color: transparent;
}

.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px 48px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 22px;
}

.auth-card h1 {
  font-size: 19px;
  margin-bottom: 4px;
}

.auth-card .sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 18px;
}

.auth-back {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 14px;
  display: inline-block;
}

/* ---------- 提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  max-width: min(92vw, 420px);
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-error {
  border-color: var(--danger);
  color: var(--danger);
}

/* ---------- 窄屏 ---------- */

@media (max-width: 640px) {
  .hero h1 {
    font-size: 25px;
  }

  .card {
    min-width: 0;
  }

  .file-date {
    display: none;
  }

  .file-size {
    width: 66px;
  }

  .topbar-inner {
    height: 58px;
    gap: 12px;
  }

  .brand-mark,
  .brand-logo {
    width: 30px;
    height: 30px;
  }

  .brand small {
    display: none;
  }

  /* 窄屏先让出位置，品牌本身就是回首页的入口 */
  .topnav a.nav-home {
    display: none;
  }
}

/* ---------- 网盘外壳：窄屏 ---------- */

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

  .drive-side {
    position: static;
    min-height: 0;
    max-height: none;
    display: grid;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .drive-user,
  .drive-usage,
  .drive-nav,
  .drive-side-foot {
    grid-column: span 1;
  }

  .drive-user,
  .drive-usage {
    grid-column: 1 / -1;
  }

  .drive-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-label {
    grid-column: 1 / -1;
    padding-top: 4px;
  }

  .drive-side-foot {
    grid-column: 1 / -1;
    margin-top: 0;
  }
}

@media (max-width: 640px) {
  .search input {
    width: 100%;
  }

  .drive-tools {
    width: 100%;
  }

  .drive-nav {
    grid-template-columns: 1fr;
  }

  .file-head,
  .file {
    grid-template-columns: 18px minmax(0, 1fr) 100px;
  }

  .file-list[data-mode="category"] .file,
  .file-head[data-mode="category"],
  .file-list[data-mode="search"] .file,
  .file-head[data-mode="search"] {
    grid-template-columns: 18px minmax(0, 1fr) 100px;
  }

  .file.is-pickable,
  .file-head[data-mode] {
    grid-template-columns: 22px 18px minmax(0, 1fr) 100px;
  }

  .file-list[data-mode="search"] .file.is-pickable,
  .file-head[data-mode="search"] {
    grid-template-columns: 22px 18px minmax(0, 1fr) 100px;
  }

  .file-date,
  .fh-time,
  .file-where,
  .fh-where {
    display: none;
  }
}

/* ---------- 弹窗（移动 / 复制的目标选择、详细信息） ---------- */
.modal {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.modal::backdrop {
  background: rgba(12, 16, 14, 0.45);
}

.modal-panel {
  display: grid;
  gap: 12px;
  padding: 14px 16px 16px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-head h2 {
  margin: 0;
  font-size: 15px;
}

.modal-body {
  display: grid;
  gap: 10px;
  min-height: 120px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
}

.modal-body .crumb {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.pick-list {
  display: grid;
  gap: 2px;
}

.pick-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pick-row:hover {
  background: var(--hover);
  border-color: var(--line);
}

.pick-row svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}

.pick-empty {
  padding: 14px 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.detail-list {
  display: grid;
  gap: 8px;
  margin: 0;
  font-size: 13px;
}

.detail-list > div {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.detail-list dt {
  color: var(--muted);
  flex: none;
}

.detail-list dd {
  margin: 0;
  text-align: right;
  word-break: break-all;
}
