/* ============================================
   云帆分享 - 后台管理样式
   移动端优先 · 现代简约 · 自适应
   ============================================ */

/* --- CSS 变量 --- */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --header-height: 60px;
    --sidebar-width: 230px;
    --sidebar-collapsed: 60px;
    --transition: 0.2s ease;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

/* --- Reset & 基础 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; }

/* --- 登录页 --- */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.login-container { width: 100%; max-width: 400px; }
.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--primary-light), #ddd6fe);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    color: var(--primary);
}
.login-header h1 { font-size: 24px; font-weight: 700; color: var(--text); }
.login-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 20px; }
.login-footer { text-align: center; margin-top: 24px; font-size: 12px; color: var(--text-muted); }

/* --- 表单 --- */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 14px; font-weight: 600; color: var(--text); }
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: var(--font);
    background: var(--card-bg);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.form-input::placeholder { color: var(--text-muted); }
.form-text { font-size: 14px; color: var(--text); padding: 4px 0; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.form-tip { font-size: 13px; padding: 6px 0; margin: 0; }
.section-divider-light { height: 1px; background: var(--border-light); margin: 8px 0; }
.form-section-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 0 0 4px; }

/* --- 按钮 --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px;
    border: none; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }
.btn-outline {
    background: transparent; color: var(--text-secondary);
    border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-sm.copied { background: var(--success); color: #fff; border-color: var(--success); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* --- 日期预设按钮 --- */
.date-presets {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 8px;
}
.preset-btn {
    padding: 4px 12px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s ease;
}
.preset-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}
.preset-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}
.preset-forever {
    border-style: dashed;
}
.preset-forever.active {
    border-style: solid;
}

/* --- 弹窗 --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.6;
}
.alert code {
    background: rgba(0,0,0,0.08);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    word-break: break-all;
    display: inline-block;
    max-width: 100%;
}
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ===================== 侧边栏布局 ===================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* --- 侧边栏 --- */
.admin-sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 200;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
    text-decoration: none;
}
.sidebar-brand svg { color: var(--primary); }
.sidebar-brand:hover { color: var(--text); }

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

/* 导航菜单 */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
}
.sidebar-link:hover {
    background: var(--border-light);
    color: var(--text);
    border-left-color: var(--primary);
}
.sidebar-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    border-left-color: var(--primary);
}
.sidebar-link svg { flex-shrink: 0; }

/* ===== 顶部栏：标题居左 + 管理员居右 ===== */
.topbar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    margin: -24px -24px 20px -24px;
    background: #fff;
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    min-height: 64px;
    gap: 12px;
}

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.topbar-title { font-size: 18px; font-weight: 700; color: var(--text); margin: 0; }

.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    border: none;
    border-radius: 20px;
    background: var(--border-light);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font);
}
.topbar-user-btn:hover {
    background: var(--primary-light);
}

.topbar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.topbar-username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.topbar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-muted);
    transition: all 0.2s ease;
}
.topbar-logout:hover {
    background: #fef2f2;
    color: var(--danger);
}

/* 移动端右上角头像 */
.mobile-user-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.mobile-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- 侧边栏遮罩（移动端） --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    backdrop-filter: blur(4px);
}

/* --- 移动端顶部栏 --- */
.mobile-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 16px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.mobile-menu-btn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all var(--transition);
}

.mobile-topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

/* --- 主内容区 --- */
.admin-main {
    flex: 1;
    padding: 24px 24px 32px;
    max-width: 1200px;
    width: calc(100% - var(--sidebar-width));
}

.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 700; }
.page-desc { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* --- 响应式：小屏变侧滑菜单 --- */
@media (max-width: 900px) {
    .admin-layout {
        flex-direction: column;
    }
    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        z-index: 200;
        box-shadow: 4px 0 24px rgba(0,0,0,0.2);
        height: 100vh;
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close { display: block; }
    .sidebar-overlay.open { display: block; }
    .mobile-topbar {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 50;
    }
    .admin-main {
        width: 100%;
        padding: 0 0 20px 0;
    }
    .topbar-user {
        display: none;
    }
    .admin-main .stats-grid,
    .admin-main > .card,
    .admin-main > .links-list,
    .admin-main > .alert,
    .admin-main > .quick-share-card,
    .admin-main > .view-toggle-wrap {
        margin-left: 12px;
        margin-right: 12px;
    }
    .admin-main .stats-grid:first-child { margin-top: 12px; }
    .admin-main .card:first-child { margin-top: 12px; }
}

/* --- 统计卡片 --- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 20px; display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow);
}
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon-files { background: #eef2ff; color: var(--primary); }
.stat-icon-size { background: #f0fdf4; color: var(--success); }
.stat-icon-links { background: #fffbeb; color: var(--warning); }
.stat-icon-downloads { background: #fef2f2; color: var(--danger); }
.stat-body { display: flex; flex-direction: column; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* --- 卡片 --- */
.card {
    background: var(--card-bg); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-body { padding: 20px; }

/* 空状态 */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state p { color: var(--text-secondary); font-size: 15px; }

/* 快速操作 */
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.quick-action-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 20px; border-radius: var(--radius-sm);
    background: var(--border-light); color: var(--text);
    font-size: 14px; font-weight: 500; transition: all var(--transition);
}
.quick-action-btn:hover { background: var(--primary-light); color: var(--primary); }

/* --- 上传队列 --- */
.upload-queue {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.upload-queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--border-light);
    border-bottom: 1px solid var(--border);
}
.upload-queue-title { font-size: 13px; font-weight: 600; color: var(--text); }
.upload-queue-count { font-size: 12px; color: var(--text-muted); }

.upload-queue-list { max-height: 300px; overflow-y: auto; }

.upload-queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.upload-queue-item:last-child { border-bottom: none; }

.upload-qi-status {
    flex-shrink: 0;
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
}

.upload-qi-body { flex: 1; min-width: 0; }
.upload-qi-name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-qi-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.upload-qi-progress {
    margin-top: 6px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    display: none;
}
.upload-qi-progress.active { display: block; }
.upload-qi-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.2s;
    width: 0%;
}
.upload-qi-pct { font-size: 11px; color: var(--text-muted); flex-shrink: 0; min-width: 40px; text-align: right; }

.upload-qi-status .qi-waiting { color: var(--text-muted); }
.upload-qi-status .qi-uploading { color: var(--primary); animation: qiSpin 1s linear infinite; }
.upload-qi-status .qi-done { color: var(--success); }
.upload-qi-status .qi-error { color: var(--danger); }

@keyframes qiSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.upload-queue-item.done { opacity: 0.7; }
.upload-queue-item.done .upload-qi-name { color: var(--success); }
.upload-queue-item.error { background: #fef2f2; }
.upload-queue-item.error .upload-qi-name { color: var(--danger); }

#startUploadBtn { margin-top: 10px; border-radius: 0; }
.upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 40px 20px; text-align: center;
    transition: all var(--transition); position: relative;
    cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--primary-light); }
.upload-plus { color: var(--primary); margin-bottom: 6px; opacity: 0.6; transition: opacity 0.2s; }
.upload-zone:hover .upload-plus { opacity: 1; }
.upload-text { font-size: 15px; color: var(--text-secondary); margin-bottom: 4px; }
.upload-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.upload-input {
    position: absolute; inset: 0; opacity: 0; cursor: pointer;
    z-index: 1;
}
.upload-zone .btn {
    position: relative;
    z-index: 2;
}
.upload-progress { margin-top: 16px; }
.progress-bar {
    width: 100%; height: 6px;
    background: var(--border); border-radius: 3px; overflow: hidden;
}
.progress-fill {
    height: 100%; background: var(--primary);
    border-radius: 3px; transition: width 0.3s ease;
}
.progress-text { font-size: 13px; color: var(--text-secondary); margin-top: 6px; display: block; }

/* --- 表格 --- */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
    width: 100%; border-collapse: collapse;
    font-size: 14px;
}
.table th {
    text-align: left; padding: 12px 16px;
    font-weight: 600; font-size: 13px;
    color: var(--text-secondary); background: var(--border-light);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafafa; }
.file-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.time-cell { white-space: nowrap; color: var(--text-secondary); font-size: 13px; }
.action-cell { white-space: nowrap; display: flex; gap: 6px; align-items: center; }

/* 表格 - 移动端 */
@media (max-width: 768px) {
    .table { font-size: 13px; }
    .table th, .table td { padding: 10px 12px; }
    .file-name { max-width: 120px; }
}

/* 状态徽标 */
.status-badge {
    display: inline-block; padding: 2px 10px;
    border-radius: 20px; font-size: 12px; font-weight: 500;
}
.status-active { background: #d1fae5; color: #065f46; }
.status-disabled { background: #f3f4f6; color: #6b7280; }
.status-expired { background: #fef3c7; color: #92400e; }
.status-exhausted { background: #fee2e2; color: #991b1b; }

.badge {
    display: inline-block; padding: 2px 8px;
    border-radius: 4px; font-size: 11px; font-weight: 600;
    background: var(--border); color: var(--text-secondary);
    text-transform: uppercase;
}
.badge-warning { background: #fef3c7; color: #92400e; }

/* 链接单元格 */
.link-cell { display: flex; align-items: center; gap: 6px; }
.share-key { font-size: 12px; color: var(--text-secondary); }

/* 进度条 - 迷你 */
.progress-info { display: flex; flex-direction: column; gap: 4px; min-width: 100px; }
.progress-info .text-muted { font-size: 11px; }
.mini-progress { width: 100%; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.mini-progress-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width 0.3s; }
.small { font-size: 11px; }
.text-muted { color: var(--text-muted); }

/* ===================== 视图切换（卡片/列表） ===================== */
.view-toggle-wrap { margin-bottom: 20px; }

.view-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    padding: 3px;
    width: fit-content;
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s ease;
}
.view-toggle-btn.active {
    background: var(--card-bg);
    color: var(--primary);
    font-weight: 600;
    box-shadow: var(--shadow);
}
.view-toggle-btn:hover:not(.active) { color: var(--text); }

.view-list-table td { vertical-align: middle; }
.list-file-cell { display: flex; flex-direction: column; gap: 2px; }
.list-file-name { font-size: 13px; font-weight: 600; color: var(--text); }
.list-file-size { font-size: 11px; color: var(--text-muted); }
.list-link-row { display: flex; align-items: center; gap: 6px; }
.list-link-code { font-size: 11px; color: var(--text-secondary); background: var(--border-light); padding: 4px 8px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.list-dl-cell { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.list-dl-cell .mini-progress { width: 80px; }

@media (max-width: 768px) {
    .view-list-table { font-size: 12px; }
    .list-link-code { max-width: 100px; font-size: 10px; }
    .view-toggle { width: 100%; }
    .view-toggle-btn { flex: 1; justify-content: center; }
}

/* ===================== 链接卡片（保持不变） ===================== */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.link-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
.link-card:hover {
    box-shadow: var(--shadow-md);
}

.link-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
}

.link-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.link-file-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.link-file-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.link-file-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-file-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.link-status {
    flex-shrink: 0;
}

/* --- URL 区 --- */
.link-url-section {
    padding: 10px 18px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-light);
}

.link-url-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.link-url-text {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
}

.link-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 16px;
    border: 1.5px solid var(--primary);
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    white-space: nowrap;
}
.link-copy-btn:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}
.link-copy-btn.copied {
    background: var(--success);
    border-color: var(--success);
}

/* --- 详情区 --- */
.link-card-body {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-light);
}

.link-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.link-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.link-meta-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.link-meta-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.link-progress {
    width: 100%;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.link-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s;
}

.link-remaining {
    font-size: 11px;
    color: var(--text-muted);
}

.link-remaining strong {
    color: var(--text);
    font-weight: 700;
}

/* --- 操作栏 --- */
.link-card-actions {
    display: flex;
    gap: 8px;
    padding: 12px 18px;
    flex-wrap: wrap;
}

/* 响应式 */
@media (max-width: 600px) {
    .link-meta-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .link-url-row {
        flex-direction: column;
        align-items: stretch;
    }
    .link-copy-btn {
        justify-content: center;
    }
    .link-card-top {
        flex-wrap: wrap;
    }
}

/* --- 搜索 --- */
.page-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.search-form { display: flex; gap: 8px; }
.search-box { display: flex; gap: 8px; flex: 1; }
.search-input { flex: 1; }

/* --- 分页 --- */
.pagination {
    display: flex; gap: 8px; padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    justify-content: center; flex-wrap: wrap;
}
.page-link, .page-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 10px;
    border-radius: 8px;
    font-size: 14px; color: var(--text); transition: all 0.15s;
    border: 1px solid var(--border); text-decoration: none;
    background: var(--card-bg);
}
.page-link:hover, .page-btn:hover {
    border-color: var(--primary); color: var(--primary); background: var(--primary-light);
}
.page-link.active, .page-btn.active {
    background: var(--primary); color: #fff; border-color: var(--primary);
    font-weight: 600;
}
.page-link.disabled, .page-btn.disabled {
    opacity: 0.4; pointer-events: none;
}

/* --- 弹窗 Modal --- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.modal {
    background: var(--card-bg); border-radius: var(--radius);
    width: 100%; max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: modalIn 0.25s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 0;
}
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close {
    background: none; border: none; font-size: 28px;
    cursor: pointer; color: var(--text-muted); line-height: 1;
    padding: 0 4px; transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 16px; }

/* --- 底部 --- */
.admin-footer {
    text-align: center; padding: 20px;
    font-size: 13px; color: var(--text-muted);
    border-top: 1px solid var(--border-light);
}

/* --- 响应式 --- */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .admin-main { padding: 16px; }
    .topbar-user { margin: -16px -16px 16px -16px; padding: 10px 16px; }
    .topbar-title { font-size: 15px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 18px; }
    .stat-icon { width: 40px; height: 40px; }
    .stat-icon svg { width: 20px; height: 20px; }
    .search-box { flex-direction: column; }
    .quick-actions { flex-direction: column; }
    .quick-action-btn { justify-content: center; }

    /* 文件列表 - 手机端：最大限度扩展文件名宽度 */
    .table thead { display: none; }
    .table tbody tr {
        display: block;
        background: var(--card-bg);
        border: 1px solid var(--border-light);
        border-radius: var(--radius-sm);
        padding: 10px 0;
        margin-bottom: 8px;
        box-shadow: var(--shadow);
    }
    .table tbody tr td {
        border: none;
        padding: 0;
        font-size: 13px;
        line-height: 1.7;
    }
    /* 第一行：文件名（全可用宽度，最多490px） */
    .table tbody tr td.file-name {
        display: block;
        width: 100%;
        max-width: 490px;
        font-weight: 600;
        font-size: 14px;
        margin-bottom: 4px;
        padding: 0 12px;
        overflow-wrap: break-word;
        word-break: break-word;
        line-height: 1.4;
    }
    /* 第二行：容量 + 类型 + 状态 */
    .table tbody tr td.td-info {
        display: inline;
        margin-right: 10px;
        padding: 0 0 0 12px;
        font-size: 12px;
        color: var(--text-secondary);
    }
    /* 第三行：上传时间 */
    .table tbody tr td.td-time {
        display: block;
        width: 100%;
        padding: 0 12px;
        font-size: 11px;
        color: var(--text-muted);
        margin-top: 2px;
    }
    /* 第四行：操作按钮 */
    .table tbody tr td.action-cell {
        display: flex;
        width: 100%;
        gap: 6px;
        margin-top: 8px;
        padding: 8px 12px 0;
        border-top: 1px solid var(--border-light);
    }
    /* 第二行：容量 + 类型 + 状态 横向排列 */
    .table tbody tr td.td-info {
        display: inline;
        margin-right: 10px;
        font-size: 12px;
        color: var(--text-secondary);
    }
    .table tbody tr td.td-info::before {
        content: attr(data-label) "：";
        color: var(--text-muted);
        font-size: 11px;
    }
    .table tbody tr td.td-info .badge { font-size: 10px; }
    .table tbody tr td.td-info .status-badge { font-size: 10px; padding: 0 6px; }
    /* 第三行：上传时间 */
    .table tbody tr td.td-time {
        display: block;
        width: 100%;
        font-size: 11px;
        color: var(--text-muted);
        margin-top: 2px;
    }
    .table tbody tr td.td-time::before {
        content: attr(data-label) "：";
        color: var(--text-muted);
    }
    /* 第四行：操作按钮 */
    .table tbody tr td.action-cell {
        display: flex;
        width: 100%;
        gap: 6px;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border-light);
    }
    .table tbody tr td.action-cell .btn {
        flex: 1;
        text-align: center;
        padding: 8px 12px;
        font-size: 13px;
        min-height: 36px;
        line-height: 22px;
    }

    /* 上传区域 - 手机端压缩 */
    .upload-zone {
        max-height: 160px;
        min-height: 140px;
        padding: 20px !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    .upload-zone .upload-plus svg { width: 32px; height: 32px; }
    .upload-zone .upload-text { font-size: 13px; margin-bottom: 0; }

    /* 分享链接列表 - 手机端 */
    .view-list-table thead { display: none; }
    .view-list-table tbody tr {
        display: block;
        background: var(--card-bg);
        border: 1px solid var(--border-light);
        border-radius: var(--radius-sm);
        padding: 12px 14px;
        margin-bottom: 8px;
        box-shadow: var(--shadow);
    }
    .view-list-table tbody tr td {
        border: none;
        padding: 0;
        font-size: 13px;
        line-height: 1.7;
    }
    .view-list-table tbody tr td.list-file-cell {
        display: block;
        width: 100%;
        margin-bottom: 4px;
    }
    .view-list-table tbody tr td.list-file-cell .list-file-name {
        display: block;
        font-weight: 600;
        font-size: 14px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .view-list-table tbody tr td[data-label="链接"] {
        display: block;
        width: 100%;
        margin-bottom: 6px;
    }
    .view-list-table tbody tr td[data-label="链接"]::before { display: none; }
    .view-list-table .list-link-code { max-width: 100%; font-size: 11px; }
    .view-list-table .list-link-row { flex-wrap: wrap; }
    /* 下载+剩余+状态 一行 */
    .view-list-table tbody tr td[data-label="下载"],
    .view-list-table tbody tr td[data-label="状态"] {
        display: inline;
        margin-right: 10px;
        font-size: 12px;
        color: var(--text-secondary);
    }
    .view-list-table tbody tr td[data-label="下载"]::before,
    .view-list-table tbody tr td[data-label="状态"]::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 11px;
    }
    .view-list-table tbody tr td[data-label="下载"] .mini-progress { display: none; }
    .view-list-table tbody tr td[data-label="下载"] .small { font-size: 11px; }
    .view-list-table tbody tr td[data-label="状态"] .status-badge { font-size: 10px; padding: 0 6px; }
    .view-list-table tbody tr td.action-cell {
        display: flex;
        width: 100%;
        gap: 6px;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border-light);
    }
    .view-list-table tbody tr td.action-cell .btn { flex: 1; text-align: center; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .login-card { padding: 28px 20px; }
    .card-body { padding: 16px; }
}

/* 复选框 */
.th-checkbox { width: 40px; text-align: center; }
.td-checkbox { width: 40px; text-align: center; vertical-align: middle; }
.th-checkbox input[type="checkbox"], .td-checkbox input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: #7c3aed; }
