:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e4e7ec;
  --text: #1f2933;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --shadow: 0 8px 30px rgba(15, 23, 42, .08);
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error-text { color: var(--danger); min-height: 20px; font-size: 13px; }

/* 登录 */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 55%, #ecfeff 100%); }
.login-card { width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 36px; box-shadow: var(--shadow); }
.login-logo { width: 52px; height: 52px; border-radius: 14px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; margin-bottom: 18px; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-sub { margin: 0 0 24px; color: var(--muted); }
.login-card label { display: block; margin: 14px 0 6px; font-weight: 600; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; outline: none; }
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.login-foot { text-align: center; margin: 20px 0 0; font-size: 13px; color: var(--muted); }

/* 布局 */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 220px; flex: 0 0 220px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; font-weight: 700; border-bottom: 1px solid var(--border); }
.brand-icon { width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.sidebar nav { padding: 12px; flex: 1; overflow: auto; }
.nav-item { display: block; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 4px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--text); }
.nav-item:hover { background: #f1f5f9; }
.nav-item.active { background: #e8f0fe; color: var(--primary); font-weight: 600; }
.nav-divider { padding: 14px 12px 6px; color: var(--muted); font-size: 12px; }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); }
.user-label { font-size: 13px; margin-bottom: 8px; color: var(--muted); }
.main { flex: 1; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 26px; background: var(--surface); border-bottom: 1px solid var(--border); }
.breadcrumb { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 15px; }
.breadcrumb button { border: 0; background: transparent; color: var(--primary); cursor: pointer; padding: 2px 4px; }
.breadcrumb span { color: var(--muted); }
.top-actions { display: flex; gap: 8px; }
.section { padding: 22px 26px; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

/* 按钮 */
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f8fafc; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; padding: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; }

/* 文件列表 */
.drop-zone { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-height: 300px; }
.drop-zone.dragging { border: 2px dashed var(--primary); background: #eff6ff; }
.file-table { width: 100%; border-collapse: collapse; }
.file-table th { text-align: left; padding: 12px 16px; background: #fafbfc; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.file-table td { padding: 11px 16px; border-bottom: 1px solid #f1f3f5; }
.file-table tr:last-child td { border-bottom: 0; }
.file-table tr:hover td { background: #fafbfc; }
.file-name { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.file-icon { font-size: 18px; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 70px 20px; }

/* 卡片列表 */
.card-list { display: grid; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.card-title { font-weight: 600; margin-bottom: 4px; word-break: break-all; }
.card-meta { color: var(--muted); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.section h2 { margin: 0 0 16px; font-size: 19px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); width: min(620px, 96vw); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.modal.wide { width: min(900px, 96vw); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px; }
.modal-body { padding: 20px; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.close-x { border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; margin-bottom: 6px; font-weight: 600; }
.form-row input, .form-row select, .form-row textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; outline: none; background: #fff; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--primary); }
.form-row.checkbox-row { display: flex; align-items: center; gap: 8px; }
.form-row.checkbox-row input { width: auto; }
.link-box { display: flex; gap: 8px; margin-top: 12px; }
.link-box input { flex: 1; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: #f9fafb; }
.editor { width: 100%; min-height: 52vh; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; line-height: 1.6; border: 1px solid var(--border); border-radius: 8px; padding: 12px; resize: vertical; }
.preview-box { min-height: 50vh; background: #f8fafc; border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: auto; }
.preview-box img, .preview-box video { max-width: 100%; max-height: 68vh; }
.preview-box iframe { width: 100%; height: 68vh; border: 0; }
.preview-box audio { width: 100%; max-width: 420px; }
.md-body { width: 100%; padding: 20px; background: #fff; line-height: 1.7; }
.comment { border-bottom: 1px solid var(--border); padding: 10px 0; }
.comment-meta { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.progress-wrap { margin: 16px 0; }
.progress-bar { height: 8px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.progress-bar > div { height: 100%; background: var(--primary); width: 0; transition: width .15s; }
table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th, table.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data-table th { color: var(--muted); font-size: 12px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; background: #eef2ff; color: #4338ca; font-size: 12px; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.red { background: #fee2e2; color: #991b1b; }

/* 分享内子文件夹分发授权 */
.rule-list { display: flex; flex-direction: column; gap: 12px; }
.rule-row { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fcfcfd; }
.rule-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.rule-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rule-grid label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.rule-grid input, .rule-grid select, .rule-row input[type=text] { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: #fff; outline: none; }
.rule-grid input:focus, .rule-grid select:focus { border-color: var(--primary); }
.rule-options { display: flex; gap: 18px; flex-wrap: wrap; margin: 10px 0 4px; }
.rule-options .checkbox, .rule-row .checkbox { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.rule-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 820px) { .rule-grid { grid-template-columns: 1fr; } }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 100; box-shadow: var(--shadow); max-width: 90vw; }

/* 公开分享页 */
.share-page { max-width: 860px; margin: 40px auto; padding: 0 20px; }
.share-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 26px; box-shadow: var(--shadow); }
.share-file { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.share-file:last-child { border-bottom: 0; }
.share-file .grow { flex: 1; min-width: 0; word-break: break-all; }
.share-file .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
/* 文件列表缩略图与筛选 */
.filter-bar { flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.filter-dropdown { position: relative; }
.filter-dropdown summary { cursor: pointer; list-style: none; padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: var(--surface); }
.filter-dropdown summary::-webkit-details-marker { display: none; }
.filter-pop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 10px; min-width: 180px; display: grid; gap: 6px; }
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--primary); }
.sort-ind { color: var(--primary); font-size: 12px; }
.thumb { position: relative; display: inline-flex; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 6px; overflow: hidden; background: var(--border); align-items: center; justify-content: center; margin-right: 8px; font-size: 20px; vertical-align: middle; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb-ph { font-size: 20px; line-height: 1; }
.thumb-fallback .thumb-ph { display: inline; }
.thumb:not(.thumb-fallback) .thumb-ph { display: none; }
.video-thumb.thumb-ready .thumb-ph { display: none; }
/* 服务器本机目录浏览器 */
.path-browser-list { border: 1px solid var(--border); border-radius: 8px; min-height: 180px; max-height: 320px; overflow: auto; padding: 6px; }
.pb-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.pb-item:hover { background: var(--border); }
.pb-icon { flex: 0 0 20px; text-align: center; }
@media (max-width: 720px) {
  .sidebar { width: 64px; flex-basis: 64px; }
  .brand span:last-child, .nav-item, .sidebar-foot { font-size: 0; }
  .nav-item { text-align: center; }
  .section, .topbar { padding: 14px; }
  .file-table th:nth-child(3), .file-table td:nth-child(3), .file-table th:nth-child(4), .file-table td:nth-child(4) { display: none; }
}
