*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #e2e8f0;
  --card: #ffffff;
  --border: #cbd5e1;
  --green: #16a34a;
  --green-hover: #15803d;
  --text: #334155;
  --text-dim: #64748b;
  --text-muted: #94a3b8;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Microsoft YaHei', sans-serif;
  min-height: 100vh;
  padding-bottom: 50px;
}
input, select {
  outline: none; background: #f8fafc; border: 1px solid var(--border);
  color: var(--text); padding: 10px 15px; border-radius: 8px; width: 100%;
}
button { cursor: pointer; border: none; border-radius: 8px; transition: 0.2s; }
.mb16 { margin-bottom: 1rem; }
.mb24 { margin-bottom: 1.5rem; }

/* 顶部导航 */
.top-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 15px 40px; background: var(--card); 
  box-shadow: 0 1px 10px rgba(0,0,0,0.05);
  position: sticky; top: 0; z-index: 100;
}
.logo { display: flex; align-items: center; gap: 8px; font-size: 1.25rem; font-weight: bold; color: var(--green); }
.nav-actions { display: flex; gap: 15px; }
.btn-outline { padding: 8px 16px; background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--green); color: var(--green); }
.btn-primary { padding: 8px 16px; background: var(--green); color: white; display: flex; align-items: center; gap: 5px;}
.btn-primary:hover { background: var(--green-hover); }

/* 主体容器 */
.main-container { max-width: 1200px; margin: 0 auto; padding: 30px 20px; }
.section-block { margin-bottom: 40px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.section-title { font-size: 1.25rem; font-weight: bold; color: var(--text); }
.view-all { font-size: 0.875rem; color: var(--text-dim); text-decoration: none; }
.view-all:hover { color: var(--green); }

/* 顶部类别卡片 (参考图上半部) */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
.type-card {
  background: var(--card); border-radius: 12px; padding: 20px;
  display: flex; flex-direction: column; align-items: center; gap: 15px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02); transition: transform 0.2s;
}
.type-card:hover { transform: translateY(-4px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05); }
.type-icon { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.type-name { font-weight: bold; font-size: 0.9375rem; }

/* 选项卡 */
.tabs { display: flex; gap: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.tab { font-size: 0.9375rem; color: var(--text-dim); cursor: pointer; padding-bottom: 10px; margin-bottom: -11px; }
.tab.active { color: var(--green); font-weight: bold; border-bottom: 2px solid var(--green); }

/* 文件卡片网格 (参考图下半部) */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.file-card {
  background: var(--card); border-radius: 12px; padding: 20px;
  display: flex; flex-direction: column; align-items: center; position: relative;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02); transition: all 0.3s;
}
.file-card:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.08); }

.file-center-icon {
  width: 80px; height: 80px; border-radius: 16px; margin: 10px 0 20px 0;
  display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; font-size: 24px;
}
.icon-pdf { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.icon-word { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.icon-excel { background: linear-gradient(135deg, #22c55e, #15803d); }
.icon-zip { background: linear-gradient(135deg, #eab308, #a16207); }
.icon-default { background: linear-gradient(135deg, #94a3b8, #475569); }

.file-info { width: 100%; text-align: center; }
.file-title { font-weight: bold; font-size: 0.9375rem; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 15px; }

.file-footer {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  font-size: 0.75rem; color: var(--text-dim); border-top: 1px solid #f1f5f9; padding-top: 10px;
}
.footer-item { display: flex; align-items: center; gap: 4px; }

/* 拥有者的控制面板 */
.owner-controls {
  display: none; width: 100%; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border);
  flex-direction: column; gap: 8px; animation: fadeIn 0.3s;
}
.file-card.editing .owner-controls { display: flex; }
.file-card.editing .download-area { display: none; }
.btn-sm { padding: 6px 10px; font-size: 0.8125rem; }
.btn-danger { background: #fee2e2; color: #ef4444; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; z-index: 1000;
}
.modal-card { background: var(--card); padding: 30px; border-radius: 16px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.btn-login, .btn-add { background: var(--green); color: white; padding: 10px; width: 100%; }
.close-btn { background: transparent; padding: 5px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- Admin 专属样式 --- */
.admin-list { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 10px; max-height: 250px; overflow-y: auto; }
.admin-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; border-bottom: 1px solid var(--border); }
.admin-item:last-child { border-bottom: none; }
.badge { padding: 3px 8px; border-radius: 12px; font-size: 12px; font-weight: bold; }
.badge.pending { background: #fefce8; color: #ca8a04; }
.badge.approved { background: #f0fdf4; color: #16a34a; }
.badge.rejected { background: #fef2f2; color: #ef4444; }

/* --- 布局优化与新组件 --- */

/* 修复网格布局：强制一排至少6个 (当容器足够宽时) */
.file-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); 
    gap: 20px; 
}

/* 修复编辑网格时的空白排斥塌陷问题：使用绝对定位悬浮 */
.file-card { padding-bottom: 20px; position: relative; overflow: hidden; }
.download-area { transition: opacity 0.2s; }
.owner-controls {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    z-index: 10;
    padding: 15px;
    border-top: 1px solid var(--border);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column; gap: 8px;
}
.file-card.editing .owner-controls { transform: translateY(0); }
.file-card.editing .download-area { opacity: 0; pointer-events: none; }

/* 缩略图覆盖样式 */
.file-center-icon img {
    width: 100%; height: 100%; object-fit: cover; border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* 全局自定义 Toast 提示框 */
#toast-container {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast-msg {
    background: var(--card); color: var(--text); padding: 12px 24px;
    border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-left: 4px solid var(--green); font-size: 0.9375rem; font-weight: bold;
    animation: toastSlideDown 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.toast-msg.error { border-left-color: var(--red); }
@keyframes toastSlideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastFadeOut { to { opacity: 0; transform: translateY(-10px); } }

/* 鼠标手型反馈 */
.cursor-zoom { cursor: zoom-in; }