/* ============================================================
   多租户企业文档管理平台 — 前端设计系统
   风格：现代卡片式 / 圆角 / 分层阴影 / 悬浮反馈
   ============================================================ */
:root {
  --primary: #4f6ef2;
  --primary-dark: #3d5ae0;
  --primary-light: #eef2ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #1e293b;
  --text-2: #475569;
  --text-3: #94a3b8;
  --border: #e2e8f0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 4px 12px rgba(15, 23, 42, .08), 0 16px 40px rgba(15, 23, 42, .12);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, [role="button"], a.link, .clickable { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }

/* ---------- 表单控件 ---------- */
.input, .select, .textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 110, 242, .12);
}
.input::placeholder { color: var(--text-3); }
.select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.form-item { margin-bottom: 16px; }
.form-item label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.form-item .tip { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: var(--radius-sm);
  padding: 10px 18px; font-size: 14px; font-weight: 500;
  background: var(--primary); color: #fff;
  transition: transform .15s, box-shadow .15s, background .15s;
  font-family: inherit; white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); box-shadow: 0 6px 16px rgba(79, 110, 242, .35); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { background: #c7d2fe; box-shadow: none; transform: none; cursor: not-allowed; }
.btn.ghost { background: var(--primary-light); color: var(--primary); }
.btn.ghost:hover { background: #e0e7ff; box-shadow: none; }
.btn.plain { background: #fff; color: var(--text-2); border: 1.5px solid var(--border); }
.btn.plain:hover { border-color: var(--primary); color: var(--primary); box-shadow: none; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #dc2626; box-shadow: 0 6px 16px rgba(239, 68, 68, .3); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.lg { padding: 12px 24px; font-size: 15px; width: 100%; }
.btn.text { background: transparent; color: var(--primary); padding: 4px 8px; }
.btn.text:hover { background: var(--primary-light); box-shadow: none; transform: none; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  transition: box-shadow .2s, transform .2s;
}
.card.hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }

/* ---------- 徽标 / 标签 ---------- */
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.tag.blue  { background: var(--primary-light); color: var(--primary); }
.tag.green { background: #ecfdf5; color: #059669; }
.tag.orange{ background: #fffbeb; color: #d97706; }
.tag.red   { background: #fef2f2; color: #dc2626; }
.tag.gray  { background: #f1f5f9; color: var(--text-2); }

/* ---------- 进度条 ---------- */
.progress { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #6a8dff, var(--primary)); border-radius: 999px; transition: width .4s; }
.progress > i.warn { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.progress > i.danger { background: linear-gradient(90deg, #f87171, #ef4444); }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--text-3); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid #f1f5f9; color: var(--text-2); font-size: 13.5px; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: #f8faff; }
.table tbody tr:last-child td { border-bottom: none; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .icon { font-size: 40px; margin-bottom: 12px; opacity: .5; }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 16px; font-size: 13px; color: var(--text-2); }
.pagination .btn { min-width: 32px; }

/* ---------- 模态框 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: none; align-items: center; justify-content: center; z-index: 1000;
  backdrop-filter: blur(2px); padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 440px; max-width: 100%; max-height: 88vh; overflow: auto;
  padding: 26px; animation: pop .22s ease;
}
.modal.lg { width: 640px; }
@keyframes pop { from { transform: scale(.94) translateY(8px); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h3 { font-size: 17px; margin-bottom: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 11px 20px; font-size: 14px; display: flex; align-items: center; gap: 8px;
  animation: slideDown .25s ease;
}
.toast.ok::before { content: "✓"; color: var(--success); font-weight: 700; }
.toast.err::before { content: "✕"; color: var(--danger); font-weight: 700; }
@keyframes slideDown { from { transform: translateY(-14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------- 文件图标 ---------- */
.file-ico {
  width: 38px; height: 38px; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}

/* ============================================================
   登录页
   ============================================================ */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 600px at 10% -10%, #dbe4ff 0%, transparent 60%),
    radial-gradient(1000px 600px at 110% 110%, #e0e7ff 0%, transparent 55%),
    var(--bg);
  padding: 24px;
}
.login-card {
  width: 420px; max-width: 100%;
  background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}
.login-logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 26px; }
.login-logo .mark {
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(135deg, #6a8dff, var(--primary));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 26px; box-shadow: 0 10px 24px rgba(79, 110, 242, .35);
  margin-bottom: 14px;
}
.login-logo h1 { font-size: 20px; }
.login-logo p { font-size: 13px; color: var(--text-3); margin-top: 6px; }
.login-tabs { display: flex; background: #f1f5f9; border-radius: 12px; padding: 4px; margin-bottom: 22px; }
.login-tabs button {
  flex: 1; border: none; background: transparent; padding: 9px 0; border-radius: 9px;
  font-size: 14px; color: var(--text-2); font-family: inherit; transition: all .2s;
}
.login-tabs button.on { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 2px 8px rgba(15, 23, 42, .08); }
.code-row { display: flex; gap: 10px; }
.code-row .input { flex: 1; }
.code-row .btn { flex-shrink: 0; min-width: 110px; }
.login-foot { margin-top: 18px; text-align: center; font-size: 13px; color: var(--text-3); }
.login-foot a.link { cursor: pointer; }

/* ============================================================
   工作台 SPA 布局
   ============================================================ */
.spa { display: flex; min-height: 100vh; }
.side {
  width: 224px; background: #fff; border-right: 1px solid #eef1f6;
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
}
.side .brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; }
.side .brand .mark {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, #6a8dff, var(--primary));
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px;
  box-shadow: 0 6px 14px rgba(79, 110, 242, .3);
}
.side .brand b { font-size: 15px; display: block; }
.side .brand span { font-size: 11px; color: var(--text-3); }
.side nav { flex: 1; padding: 8px 12px; overflow-y: auto; }
.side nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin-bottom: 3px;
  border-radius: 10px; color: var(--text-2); font-size: 14px; transition: all .18s; cursor: pointer;
}
.side nav a .ico { width: 20px; text-align: center; font-size: 15px; }
.side nav a:hover { background: #f6f8fd; color: var(--text); }
.side nav a.on { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.side nav a .badge {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 11px;
  border-radius: 999px; padding: 1px 7px;
}
.side .side-user { padding: 14px; border-top: 1px solid #eef1f6; display: flex; align-items: center; gap: 10px; }
.side .avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #a5b8ff, #6a8dff);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px;
}
.side .side-user .u-name { font-size: 13.5px; font-weight: 600; }
.side .side-user .u-sub { font-size: 11.5px; color: var(--text-3); }
.side .side-user .logout { margin-left: auto; color: var(--text-3); font-size: 16px; cursor: pointer; transition: color .15s; }
.side .side-user .logout:hover { color: var(--danger); }

.main { flex: 1; margin-left: 224px; padding: 24px 28px 48px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.topbar h2 { font-size: 20px; }
.topbar .sub { font-size: 13px; color: var(--text-3); margin-top: 3px; }
.topbar .actions { display: flex; gap: 10px; align-items: center; }

/* 统计卡组 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; transition: transform .2s, box-shadow .2s; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card .num { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat-card .lbl { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.stat-card .num .unit { font-size: 13px; color: var(--text-3); font-weight: 400; }

/* 视图容器 */
.view { display: none; }
.view.on { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 列表行 */
.row-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border-radius: 12px; transition: background .15s; cursor: pointer;
}
.row-item:hover { background: #f8faff; }
.row-item + .row-item { border-top: 1px solid #f1f5f9; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .t { font-size: 14px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .d { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.row-item .ops { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.row-item:hover .ops { opacity: 1; }

/* 文件网格工具条 */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .input, .toolbar .select { width: auto; }

/* 树 */
.tree { font-size: 14px; user-select: none; }
.tree-node { margin: 2px 0; }
.tree-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px;
  cursor: pointer; transition: background .15s;
}
.tree-row:hover { background: #f6f8fd; }
.tree-row.on { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.tree-children { margin-left: 20px; border-left: 1px dashed var(--border); padding-left: 8px; }

/* 消息红点 / 通知 */
.notice-item { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; transition: background .15s; }
.notice-item:hover { background: #f8faff; }
.notice-item + .notice-item { border-top: 1px solid #f1f5f9; }
.notice-item.unread .t::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); margin-right: 8px; vertical-align: 2px; }

/* 进度弹窗（上传） */
.upload-item { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; }
.upload-item .progress { flex: 1; }

/* ============================================================
   分享页
   ============================================================ */
.share-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 600px at 85% -10%, #dbe4ff 0%, transparent 60%),
    var(--bg);
  padding: 24px;
}
.share-card {
  width: 520px; max-width: 100%; background: #fff; border-radius: 20px;
  box-shadow: var(--shadow-lg); padding: 36px; text-align: center;
}
.share-file {
  display: flex; align-items: center; gap: 16px; text-align: left;
  background: #f8faff; border-radius: 14px; padding: 18px; margin: 22px 0;
}
.share-meta { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }

@media (max-width: 900px) {
  .side { width: 64px; }
  .side .brand b, .side .brand span, .side nav a .txt, .side .side-user .u-info { display: none; }
  .side nav a { justify-content: center; }
  .side .side-user { justify-content: center; }
  .side .side-user .logout { margin: 0; }
  .main { margin-left: 64px; padding: 18px 14px 40px; }
}
