/* ============ 后台布局 ============ */
.admin-body { background: #f5f6fa; }
.admin-layout { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 238px; z-index: 60;
    background: #171a2e; color: #c7cbe0; display: flex; flex-direction: column;
    padding: 20px 14px; overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; color: #fff; font-size: 17px; font-weight: 800; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-label { font-size: 10px; letter-spacing: .16em; color: #6f7596; padding: 22px 12px 8px; font-weight: 700; }
.sidebar-nav { display: grid; gap: 4px; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 10px; font-weight: 600; font-size: 13px; color: #aeb3cd; transition: .18s; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: linear-gradient(135deg, #6d5efc, #8b5cf6); color: #fff; box-shadow: 0 8px 20px rgba(109,94,252,.3); }
.sidebar-bottom { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.08); display: grid; gap: 2px; }
.sidebar-bottom a { padding: 9px 13px; border-radius: 9px; font-size: 12px; color: #969bb9; }
.sidebar-bottom a:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-main { margin-left: 238px; min-height: 100vh; }
.admin-topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-version { color: var(--muted); font-size: 11px; border: 1px solid var(--border); padding: 2px 8px; border-radius: 99px; }
.avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #6d5efc, #a855f7); color: #fff; font-weight: 800; font-size: 13px; }
.avatar.small { width: 34px; height: 34px; flex-shrink: 0; }
.admin-name { font-weight: 650; font-size: 13px; }
.menu-toggle { display: none; border: 0; background: transparent; font-size: 20px; cursor: pointer; }
.admin-content { padding: 28px 30px 60px; }
.page-title { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-title h1 { font-size: 24px; letter-spacing: -.03em; margin: 0 0 3px; }
.page-title p { color: var(--muted); margin: 0; font-size: 13px; }

/* ============ 统计卡片 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { display: flex; align-items: center; gap: 14px; padding: 18px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.stat-card strong { display: block; font-size: 22px; line-height: 1.2; letter-spacing: -.03em; }
.stat-card span:last-child { color: var(--muted); font-size: 12px; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.stat-icon.purple { background: #efedff; }
.stat-icon.green { background: #e8f8ef; }
.stat-icon.orange { background: #fff3e3; }
.stat-icon.blue { background: #e9f2ff; }
.stat-icon.pink { background: #fce9f5; }
.stat-icon.teal { background: #e4f7f5; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head a { color: var(--primary); font-size: 12px; font-weight: 650; }
.panel-note { margin-top: 16px; padding: 11px 13px; border-radius: 9px; background: #f8f7ff; color: #6d648f; font-size: 12px; }
.panel-note code { background: #eceaff; padding: 1px 5px; border-radius: 4px; }

.recent-list { display: grid; }
.recent-item { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.recent-item:last-child { border-bottom: 0; }
.recent-item img { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: var(--surface-soft); }
.recent-info { flex: 1; min-width: 0; }
.recent-info strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-info span { color: var(--muted); font-size: 11px; }
.recent-item time { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* ============ 表格 ============ */
.admin-filter { padding: 12px; gap: 10px; }
.admin-filter select { width: auto; min-width: 130px; }
.admin-filter input[type="search"] { width: 220px; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 12px; padding: 12px 16px; background: #fff; border: 1px solid var(--border); border-radius: 12px 12px 0 0; }
.check-all { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 650; cursor: pointer; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.bulk-actions { display: flex; gap: 8px; }
.bulk-actions select { width: auto; padding: 6px 10px; font-size: 12px; }
.table-wrap { background: #fff; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 12px 12px; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 860px; }
.data-table th { text-align: left; padding: 12px 14px; background: #fafbfe; color: #6b7289; font-weight: 700; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid #f1f2f7; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fcfbff; }
.table-image { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.table-image img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--surface-soft); flex-shrink: 0; }
.table-image strong { display: block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.table-image span { display: block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }
.status { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.status-public { background: #e8f8ef; color: #15803d; }
.status-pending { background: #fff3e3; color: #b45309; }
.row-actions { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.link-btn { border: 0; background: transparent; color: var(--primary); cursor: pointer; font-size: 12px; font-weight: 650; padding: 2px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: #dc2626; }
.row-actions form { display: inline; }

/* ============ 表单 / 设置 ============ */
.admin-form { margin-bottom: 12px; }
.admin-form .btn-block { margin-top: 6px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.settings-grid .panel:first-child { grid-column: 1 / -1; }
.settings-actions { margin-top: 20px; display: flex; justify-content: flex-end; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-row { display: flex; flex-wrap: wrap; gap: 10px 18px; padding: 10px 0; }
.checkbox-row label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #535b72; cursor: pointer; }
.checkbox-row input[type="checkbox"] { width: 15px; height: 15px; }
.switch-field { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px dashed var(--border); margin-bottom: 10px; cursor: pointer; }
.switch-field strong { display: block; font-size: 13px; }
.switch-field small { display: block; color: var(--muted); font-size: 11px; }
.switch-field input { width: 18px; height: 18px; flex-shrink: 0; }

.category-list { display: grid; }
.category-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.category-item:last-child { border-bottom: 0; }
.category-item > div:nth-child(2) { flex: 1; min-width: 0; }
.category-item strong { display: block; font-size: 13px; }
.category-item span:not(.avatar):not(.tag) { color: var(--muted); font-size: 11px; }
.color-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 4px rgba(0,0,0,.03); }
.edit-preview { margin-bottom: 18px; text-align: center; }
.edit-preview img { max-height: 320px; margin: 0 auto; border-radius: 10px; object-fit: contain; }

/* ============ 登录页 ============ */
.login-body { background: #f5f6fa; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-wrap { width: min(880px, 100%); display: grid; grid-template-columns: 1fr 1fr; background: #fff; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.login-art { background: linear-gradient(145deg, #211d4d, #4c2f8f 55%, #7c3aed); color: #fff; padding: 52px 40px; display: flex; align-items: center; }
.login-art-inner h1 { font-size: 28px; margin: 22px 0 8px; letter-spacing: -.03em; }
.login-art-inner p { color: #d8d0fa; }
.login-art-inner ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; font-size: 13px; color: #e9e5ff; }
.login-panel { padding: 52px 44px; display: flex; align-items: center; }
.login-form { width: 100%; }
.login-form h2 { font-size: 22px; margin-bottom: 3px; }
.login-form > p.muted { font-size: 12px; margin-bottom: 22px; }
.login-form .field { margin-bottom: 18px; }
.login-tip { margin-top: 18px; font-size: 11px; color: var(--muted); text-align: center; }
.login-tip code { background: var(--surface-soft); padding: 2px 6px; border-radius: 5px; color: var(--primary); font-weight: 700; }
.back-site { display: block; text-align: center; margin-top: 14px; color: var(--muted); font-size: 12px; }

/* ============ 存储配置页（精致版） ============ */
.storage-page-title { align-items: center; }
.title-with-icon { display: flex; align-items: center; gap: 14px; }
.title-icon { width: 46px; height: 46px; flex-shrink: 0; display: grid; place-items: center; border-radius: 14px; color: #fff; background: linear-gradient(135deg, #6d5efc, #a855f7); box-shadow: 0 8px 20px rgba(109,94,252,.28); }
.storage-page-title h1 { margin-bottom: 1px; }
.page-title-actions { display: flex; align-items: center; gap: 12px; }
.driver-state { font-size: 12px; color: var(--muted); border: 1px solid var(--border); background: #fff; padding: 7px 13px; border-radius: 99px; }
.driver-state strong { color: var(--text); margin-left: 4px; }
.btn-test { background: linear-gradient(135deg, #6d5efc, #8b5cf6); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(109,94,252,.22); }
.btn-test:hover { box-shadow: 0 10px 22px rgba(109,94,252,.32); }
#storageTestResult .flash { margin-top: 14px; }

/* 状态概览 */
.storage-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.overview-item { display: flex; align-items: center; gap: 12px; padding: 15px 17px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.ov-icon { width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center; border-radius: 11px; }
.ov-purple { color: #6d5efc; background: #efedff; }
.ov-blue { color: #0284c7; background: #e8f5ff; }
.ov-green { color: #15803d; background: #e8f8ef; }
.ov-orange { color: #b45309; background: #fff3e3; }
.overview-item strong { display: block; font-size: 14px; line-height: 1.3; }
.overview-item span:last-child { color: var(--muted); font-size: 11px; }

/* 表单整体 */
.storage-form { display: grid; gap: 18px; }
.storage-form .panel { padding: 22px; border-radius: 16px; box-shadow: var(--shadow); }
.config-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.config-icon { width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center; border-radius: 11px; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.config-icon.neutral { color: var(--primary); background: var(--primary-soft); }
.config-icon.oss { color: #fff; background: linear-gradient(135deg, #ff8a3d, #f2600c); box-shadow: 0 6px 14px rgba(242,96,12,.22); }
.config-icon.cos { color: #fff; background: linear-gradient(135deg, #38bdf8, #0284c7); box-shadow: 0 6px 14px rgba(2,132,199,.22); }
.config-heading { flex: 1; min-width: 0; }
.config-heading h2 { margin: 0; font-size: 15px; }
.config-heading p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.config-badge { font-size: 10px; font-weight: 700; color: #6b7289; border: 1px solid var(--border); background: var(--surface-soft); padding: 4px 10px; border-radius: 99px; white-space: nowrap; }

/* 驱动卡片 */
.driver-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.driver-card { --d-color: #6d5efc; --d-soft: #f1efff; position: relative; display: block; cursor: pointer; }
.driver-oss { --d-color: #f2600c; --d-soft: #fff5ec; }
.driver-cos { --d-color: #0284c7; --d-soft: #ebf7ff; }
.driver-card input { position: absolute; opacity: 0; pointer-events: none; }
.driver-body { position: relative; display: block; min-height: 156px; padding: 18px; border: 1.5px solid var(--border); border-radius: 14px; background: #fff; transition: transform .2s, border-color .2s, box-shadow .2s, background .2s; overflow: hidden; }
.driver-body::after { content: ''; position: absolute; right: -34px; bottom: -44px; width: 110px; height: 110px; border-radius: 50%; background: var(--d-soft); opacity: 0; transition: opacity .2s; }
.driver-card:hover .driver-body { transform: translateY(-2px); border-color: var(--d-color); box-shadow: 0 10px 24px -14px var(--d-color); }
.driver-card input:checked + .driver-body { border-color: var(--d-color); background: linear-gradient(160deg, var(--d-soft) 0%, #fff 68%); box-shadow: 0 14px 28px -14px var(--d-color); }
.driver-card input:checked + .driver-body::after { opacity: .7; }
.driver-check { position: absolute; top: 14px; right: 14px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; font-weight: 800; color: #fff; background: var(--d-color); opacity: 0; transform: scale(.5); transition: .2s; }
.driver-card input:checked + .driver-body .driver-check { opacity: 1; transform: scale(1); }
.driver-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; margin-bottom: 12px; color: var(--d-color); background: var(--d-soft); }
.driver-body strong { display: block; font-size: 14px; margin-bottom: 5px; position: relative; z-index: 1; }
.driver-body small { display: block; color: var(--muted); font-size: 11px; line-height: 1.55; position: relative; z-index: 1; }
.driver-tag { display: inline-block; margin-top: 12px; font-size: 10px; font-weight: 700; color: var(--d-color); background: var(--d-soft); border-radius: 6px; padding: 3px 8px; position: relative; z-index: 1; }

/* 配置字段 */
.config-fields { display: grid; gap: 15px; }
.config-fields .field-row { gap: 14px; }
.storage-form .field { margin-bottom: 0; }
.storage-form .field > span { display: flex; flex-direction: column; gap: 1px; font-size: 12px; }
.storage-form .field > span small { font-weight: 400; color: #9aa1b5; font-size: 10px; }
.storage-form input[type="text"], .storage-form input[type="password"], .storage-form select { border-radius: 9px; padding: 10px 12px; }
.secret-input { display: flex; gap: 7px; }
.secret-input input { flex: 1; min-width: 0; }
.secret-toggle { width: 40px; flex-shrink: 0; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface-soft); border-radius: 9px; color: var(--muted); cursor: pointer; transition: .18s; }
.secret-toggle:hover { color: var(--primary); border-color: var(--primary); background: #fff; }
.notice-box { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: #f7f8fc; border: 1px solid var(--border); }
.notice-box > span { width: 18px; height: 18px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: #e5e7f5; color: #6b7289; font-size: 11px; font-weight: 800; }
.notice-box p { margin: 0; font-size: 11px; color: #6b7289; line-height: 1.6; }
.storage-form .switch-field { margin-bottom: 0; border-bottom: 0; padding: 2px 0 4px; }
.storage-common-panel .notice-box { margin-top: 14px; }

/* 未选中的配置面板弱化 */
.storage-config-panel { animation: configFade .25s ease both; }
.storage-config-panel.inactive { display: none; }
@keyframes configFade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* 保存栏 */
.storage-submit-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-radius: 16px; background: linear-gradient(110deg, #211d4d, #4c2f8f 55%, #6d5efc); color: #fff; box-shadow: 0 12px 28px -14px rgba(77,47,143,.6); }
.storage-submit-bar strong { display: block; font-size: 14px; }
.storage-submit-bar span { display: block; font-size: 11px; color: #d8d0fa; }
.btn-save { background: #fff; color: #4c2f8f; border-color: #fff; font-weight: 750; }
.btn-save:hover { background: #f4f1ff; color: #3b2472; box-shadow: none; }

/* ============ 响应式 ============ */
/* ============ 响应式 ============ */
@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-grid, .settings-grid, .driver-grid { grid-template-columns: 1fr; }
    .settings-grid .panel:first-child { grid-column: auto; }
}
@media (max-width: 850px) {
    .sidebar { transform: translateX(-100%); transition: transform .22s; }
    .sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .menu-toggle { display: block; }
    .admin-content { padding: 20px 16px 50px; }
    .admin-topbar { padding: 0 16px; }
    .login-wrap { grid-template-columns: 1fr; }
    .login-art { display: none; }
}
@media (max-width: 560px) {
    .stat-grid { grid-template-columns: 1fr; }
    .field-row { grid-template-columns: 1fr; }
    .admin-filter select, .admin-filter input[type="search"] { width: 100%; }
}
