:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-d: #1d4ed8;
  --ok: #0f9d58;
  --warn: #b45309;
  --bad: #dc2626;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.6 "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

/* ---------------------------------------------------------- 通用 */
.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  border-radius: 9px;
  padding: 0 14px;
  height: 36px;
  cursor: pointer;
  transition: .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.danger { color: var(--bad); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }

/* 禁用态必须看得出来。图纸还在转换时「外发」是 disabled 的，
   如果外观还是蓝色实心，用户会一直点它并以为没反应 */
.btn:disabled, .btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: auto;   /* 保留光标提示，但下面把 hover 效果关掉 */
}
.btn:disabled:hover, .btn[disabled]:hover {
  background: #fff;
  border-color: var(--line);
}
.btn.primary:disabled:hover, .btn.primary[disabled]:hover {
  background: var(--brand);
  border-color: var(--brand);
}

input[type=text], input[type=email], input[type=password], input[type=number] {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 12px;
  outline: none;
  background: #fff;
  transition: .15s;
}
input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

label { display: block; font-size: 12.8px; color: var(--muted); margin-bottom: 12px; }
label > input { margin-top: 6px; }
.tip { display: block; font-size: 11.6px; color: #94a3b8; margin-top: 4px; }
.err { color: var(--bad); font-size: 12.5px; min-height: 18px; }

/* ---------------------------------------------------------- 登录 */
/* ------------------------------------------------------------------------
 *  hidden 属性必须真的隐藏。
 *
 *  浏览器默认样式里 [hidden] 是 display:none，但一条作者样式
 *  （.auth-wrap{display:grid} / .shell{display:grid}）就能把它盖掉 ——
 *  结果是登录页和控制台同时渲染、互相遮住，JS 里设 el.hidden 完全不起作用。
 *  这个坑之前只在 .modal 上踩到过一次（那里单独写了 .modal[hidden]），
 *  其实所有用 hidden 做显隐的地方都有同样问题。
 * ---------------------------------------------------------------------- */
[hidden] { display: none !important; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 26px;
  padding: 40px 20px;
  background:
    radial-gradient(900px 400px at 15% 0%, #e8effd 0%, transparent 60%),
    radial-gradient(700px 340px at 90% 100%, #e9f6f0 0%, transparent 55%),
    var(--bg);
}
.auth-brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  color: #fff; display: grid; place-items: center;
  font-size: 19px; font-weight: 700; letter-spacing: 0;
  box-shadow: 0 8px 20px rgba(37,99,235,.28);
}
.auth-brand h1 { font-size: 21px; }
.auth-brand p { margin: 2px 0 0; font-size: 12.8px; color: var(--muted); }

.auth-card {
  width: 372px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px 20px;
  box-shadow: 0 18px 50px rgba(15,23,42,.08);
}
.tabs { display: flex; gap: 6px; background: #f1f5f9; padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.tab {
  flex: 1; height: 32px; border: 0; background: transparent; border-radius: 7px;
  color: var(--muted); cursor: pointer; font-size: 13px;
}
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15,23,42,.1); }
.pane { display: none; }
.pane.on { display: block; }
.hint { margin: 10px 0 0; font-size: 11.8px; color: #94a3b8; text-align: center; }

/* ---------------------------------------------------------- 控制台 */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }

.side {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex; flex-direction: column;
}
.side-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; padding: 0 6px; }
.side-brand .brand-mark { width: 30px; height: 30px; border-radius: 9px; font-size: 14px; box-shadow: none; }
.side-brand span { font-weight: 650; font-size: 14.5px; }

.side nav { display: grid; gap: 3px; }
.nav {
  text-align: left; border: 0; background: transparent; color: var(--ink-2);
  padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 13.4px;
}
.nav:hover { background: #f8fafc; }
.nav.on { background: #eff6ff; color: var(--brand-d); font-weight: 600; }

.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; }
.who { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.quota { font-size: 11.8px; color: var(--muted); margin-bottom: 10px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 26px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.75);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5;
}
.top h2 { font-size: 17px; }
.top-actions { display: flex; gap: 8px; }

.view { display: none; padding: 22px 26px 60px; }
.view.on { display: block; }

/* 拖拽区 */
.drop {
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius);
  background: #fbfdff;
  padding: 26px;
  text-align: center;
  margin-bottom: 18px;
  transition: .15s;
}
.drop.over { border-color: var(--brand); background: #eff6ff; }
.drop-inner { display: grid; gap: 4px; }
.drop-inner strong { font-size: 13.6px; }
.drop-inner span { font-size: 12.2px; color: var(--muted); }

/* 列表 */
.list { display: grid; gap: 10px; }
.row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.row .ext {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; color: #fff;
  background: #64748b; letter-spacing: .02em;
}
.row .ext.dwg { background: #2563eb; }
.row .ext.dxf { background: #7c3aed; }
.row .ext.pdf { background: #dc2626; }
.row .body { min-width: 0; flex: 1; }
.row .name { font-weight: 600; font-size: 13.6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { font-size: 11.9px; color: var(--muted); margin-top: 2px; }
.row .acts { display: flex; gap: 6px; flex: none; }

/* ------------------------------------------- 我的文件：路径 / 搜索 / 文件夹
   单层文件夹：根目录显示「文件夹 + 文件」，进目录后只显示文件。
   文件夹行做成整行可点（不仅是按钮），更接近网盘的使用习惯。 */
.fm-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.fm-path { display: flex; align-items: center; gap: 4px; min-width: 0; }
.crumb {
  border: 0; background: transparent; color: var(--ink-2);
  padding: 5px 9px; border-radius: 8px; cursor: pointer;
  font-size: 13px; max-width: 280px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crumb:hover { background: #f1f5f9; }
.crumb.on { background: #eff6ff; color: var(--brand-d); font-weight: 600; }
.crumb-sep { color: #cbd5e1; font-size: 12px; user-select: none; }

.fm-tools { display: flex; align-items: center; gap: 8px; }
#doc-q { width: 220px; height: 32px; font-size: 12.6px; }

.row.folder { cursor: pointer; }
.row.folder:hover { border-color: #bfd4f5; background: #fbfdff; }
/* 文件夹图标是自带的 3D 位图，去掉浅黄底方块，让它直接立在行里 */
.row .ext.folder-ico { background: transparent; color: inherit; }
.row .ext.folder-ico .fm-ico {
  width: 38px; height: 38px; display: block; user-select: none;
}
/* 我的文件里文件夹已整包外发时，meta 行给个绿色提示 */
.ok-dot { color: #15803d; font-weight: 600; }

/* 命名弹窗：输入框右侧带一个固定的扩展名标签 */
.nm-card { width: 420px; }
.nm-row { display: flex; align-items: stretch; margin-top: 6px; }
.nm-row input { flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.nm-row input:focus { position: relative; z-index: 1; }
.nm-suffix {
  display: flex; align-items: center; padding: 0 12px; flex: none;
  border: 1px solid var(--line); border-left: 0;
  border-radius: 0 9px 9px 0; background: #f8fafc;
  color: var(--muted); font-size: 12.8px;
}

.empty {
  text-align: center; color: var(--muted); font-size: 13px;
  padding: 40px 20px; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius);
}

.pill {
  display: inline-block; font-size: 11.4px; padding: 1px 8px; border-radius: 999px;
  background: #eef2f7; color: var(--muted); margin-left: 6px;
}
.pill.ok { background: #ecfdf5; color: #047857; }
.pill.warn { background: #fffbeb; color: var(--warn); }
.pill.bad { background: #fef2f2; color: var(--bad); }

.link-box {
  display: flex; gap: 8px; align-items: center; margin-top: 8px;
}
.link-box input {
  height: 32px; font-size: 12.2px; color: var(--ink-2);
  background: #f8fafc; font-family: Consolas, monospace;
}

/* ---------------------------------------------------------- 弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15,23,42,.38);
  display: grid; place-items: center; padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
  width: 460px; max-width: 100%;
  background: #fff; border-radius: 16px; padding: 22px 24px;
  box-shadow: 0 24px 60px rgba(15,23,42,.22);
}
.modal-card h3 { font-size: 16px; }
.modal-sub { margin: 4px 0 18px; font-size: 12.5px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.switches { display: grid; gap: 8px; align-content: start; padding-top: 6px; }
.check { display: flex; align-items: center; gap: 7px; font-size: 12.8px; color: var(--ink-2); margin: 0; }
.check input { width: 15px; height: 15px; margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------------------------------------------------------- 提示 */
#toast-host { position: fixed; right: 20px; bottom: 22px; z-index: 90; display: grid; gap: 8px; }
.toast {
  background: #0f172a; color: #fff; font-size: 12.8px;
  padding: 9px 14px; border-radius: 9px;
  box-shadow: 0 10px 24px rgba(15,23,42,.25);
  animation: tin .18s ease-out;
}
.toast.ok { background: #0f766e; }
.toast.bad { background: #b91c1c; }
@keyframes tin { from { opacity: 0; transform: translateY(6px); } }

/* -------------------------------------------------- 外发链接表格（独立作用域）
   参考网盘式文件管理：工具栏 + 表格 + 分页。只在本页生效，不影响 admin.css */
.share-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.share-search { display: flex; align-items: center; gap: 8px; }
.share-search input {
  width: 280px; height: 34px; font-size: 12.6px;
  padding-left: 12px; border-radius: 8px;
}
.share-search select {
  height: 34px; font-size: 12.4px; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; padding: 0 10px;
}
.share-count { font-size: 12.2px; color: var(--muted); }

.table-wrap {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow-x: auto;
}
.share-tbl { width: 100%; min-width: 960px; table-layout: fixed; border-collapse: collapse; font-size: 12.2px; }
.share-tbl th, .share-tbl td {
  padding: 9px 8px; text-align: left; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; border-bottom: 1px solid #f1f5f9;
}
.share-tbl th {
  position: sticky; top: 0; z-index: 1;
  background: #f8fafc; color: var(--muted);
  font-weight: 600; font-size: 11.8px;
}
.share-tbl tbody tr:last-child td { border-bottom: 0; }
.share-tbl tbody tr:hover { background: #fafbfd; }
.share-tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.share-tbl .mono { font-family: Consolas, monospace; font-size: 11.8px; color: var(--muted); }
.share-tbl .muted { color: var(--muted); }
.share-tbl .doc-cell { display: flex; align-items: center; gap: 9px; }
.share-tbl .ext {
  width: 28px; height: 28px; border-radius: 6px; flex: none;
  display: grid; place-items: center; font-size: 9px; font-weight: 700;
  color: #fff; background: #64748b;
}
.share-tbl .ext.dwg { background: #2563eb; }
.share-tbl .ext.dxf { background: #7c3aed; }
.share-tbl .ext.pdf { background: #dc2626; }
/* 文件夹整包外发：行首用同一套立体文件夹图标，右侧挂「整包 N 个文件」标签 */
.share-tbl .ext.folder-ico { background: transparent; }
.share-tbl .ext.folder-ico .fm-ico { width: 28px; height: 28px; display: block; }
.grp-tag {
  display: block; width: fit-content; margin: 3px 0 0; padding: 1px 7px;
  font-size: 10.5px; font-weight: 600; color: #b45309;
  background: #fef3c7; border-radius: 999px; white-space: nowrap;
}
.share-tbl .doc-name { font-weight: 600; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.share-tbl .remark-edit {
  border: 0; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 12px; padding: 2px 4px; border-radius: 4px;
}
.share-tbl .remark-edit:hover { background: #eef2f7; color: var(--brand); }
.share-tbl .link-num {
  color: var(--brand); cursor: pointer; font-weight: 600;
  border-bottom: 1px dashed var(--brand);
}
.share-tbl .empty-row td {
  text-align: center; color: #94a3b8; padding: 34px 12px; font-size: 12.5px;
}

/* 上下架开关 */
.switch { position: relative; width: 34px; height: 19px; display: inline-block; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #cbd5e1; border-radius: 19px; transition: .18s;
}
.switch .slider:before {
  content: ''; position: absolute; width: 13px; height: 13px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .18s;
}
.switch input:checked + .slider { background: #16a34a; }
.switch input:checked + .slider:before { transform: translateX(15px); }

/* 操作下拉菜单 */
.row-acts { position: relative; display: inline-block; }
.row-acts > button {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 11.8px; padding: 3px 9px; border-radius: 6px; cursor: pointer;
}
.row-acts > button:hover { border-color: var(--brand); color: var(--brand); }
.act-menu {
  position: absolute; right: 0; top: 26px; z-index: 30;
  min-width: 116px; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(15,23,42,.14);
  padding: 4px; display: none;
}
.act-menu.open { display: block; }
/* 表格单元格为了省略长文件名设了 overflow:hidden，会把下拉菜单一起裁掉。
   菜单打开的那一行临时放开裁剪；外层 .table-wrap 同理（overflow-x:auto
   会让 overflow-y 也变成 auto），否则菜单还是看不见。 */
.share-tbl td.menu-host { overflow: visible; }
.table-wrap.menu-open { overflow: visible; }
.act-menu button {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent; cursor: pointer;
  font-size: 12px; color: var(--ink-2); padding: 6px 9px; border-radius: 5px;
}
.act-menu button:hover { background: #f1f5f9; }
.act-menu button.danger { color: var(--bad); }

/* 分页 */
.share-pager {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; margin-top: 14px; font-size: 12.2px; color: var(--muted);
}
.share-pager button {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  min-width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.share-pager button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.share-pager button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.share-pager button:disabled { opacity: .45; cursor: default; }
.share-pager select {
  height: 28px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--ink-2); font-size: 12px; padding: 0 6px;
}

@media (max-width: 760px) {
  .share-search input { width: 180px; }
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; overflow-x: auto; }
  .side-brand { margin: 0; }
  .side nav { display: flex; }
  .side-foot { margin: 0; border: 0; padding: 0; display: flex; align-items: center; gap: 10px; }
  .quota, .who { display: none; }
  .top { padding: 14px 16px; }
  .view { padding: 16px; }
}

/* ------------------------------------- 浏览人数 / 浏览次数 明细弹窗
   复用 .modal 的遮罩，卡片单独放宽到 780px，表格自己滚动，
   避免几十条打开记录把屏幕撑爆。 */
.opens-card {
  width: 780px; max-width: 100%; max-height: 86vh;
  display: flex; flex-direction: column;
  padding: 20px 22px 16px;
}
.opens-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.opens-head h3 { font-size: 16px; }
.opens-head .modal-sub { margin-bottom: 12px; }
.opens-x {
  border: 0; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--muted); padding: 0 3px;
}
.opens-x:hover { color: var(--ink); }
.opens-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.opens-tabs button {
  border: 0; border-bottom: 2px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 12.8px;
  padding: 8px 14px; margin-bottom: -1px;
}
.opens-tabs button span {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 3px;
  background: #f1f5f9; border-radius: 9px; font-size: 11px; font-variant-numeric: tabular-nums;
}
.opens-tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.opens-tabs button.on span { background: #e0ecff; }
.opens-pane { overflow: auto; min-height: 110px; max-height: 52vh; }
.opens-pane[hidden] { display: none; }
.opens-tbl { width: 100%; border-collapse: collapse; font-size: 12.3px; }
.opens-tbl th, .opens-tbl td {
  padding: 8px 10px; text-align: left; white-space: nowrap;
  border-bottom: 1px solid #f1f5f9;
}
.opens-tbl th {
  position: sticky; top: 0; z-index: 1;
  background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 11.8px;
}
.opens-tbl tbody tr:last-child td { border-bottom: 0; }
.opens-tbl tbody tr:hover { background: #fafbfd; }
.opens-tbl .mono { font-family: Consolas, monospace; font-size: 11.8px; color: var(--ink-2); }
.opens-tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.opens-empty { padding: 28px 10px; text-align: center; color: #94a3b8; font-size: 12.5px; }
.opens-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.opens-foot span { font-size: 11.8px; color: var(--muted); }
