/* ===== 登录页 ===== */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(1000px 500px at 10% -10%, var(--brand-soft), transparent 60%),
        var(--bg);
}
.login-card {
    width: min(400px, 100%);
    padding: 2rem;
    border-radius: 20px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: .4rem; }
.login-brand h1 { font-size: 1.2rem; margin: 0; }
.login-tip { color: var(--text-soft); font-size: .85rem; margin: 0 0 1.2rem; }
.login-error {
    padding: .6rem .8rem;
    border-radius: 10px;
    background: rgba(239, 68, 68, .12);
    color: #ef4444;
    font-size: .85rem;
    margin-bottom: .8rem;
}
.back-link { display: block; text-align: center; margin-top: 1rem; color: var(--text-soft); font-size: .85rem; }
.back-link:hover { color: var(--brand); }

/* ===== 表单 ===== */
.field { display: block; margin-bottom: .9rem; }
.field > span { display: block; font-size: .82rem; color: var(--text-soft); margin-bottom: .35rem; }
.input {
    width: 100%;
    height: 40px;
    padding: 0 .7rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text);
    font-size: .9rem;
    outline: none;
    font-family: inherit;
    transition: border-color .2s, box-shadow .2s;
}
textarea.input { height: auto; padding: .6rem .7rem; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.check { display: flex; align-items: center; gap: .45rem; font-size: .85rem; margin-bottom: .8rem; color: var(--text-soft); }
.row { display: flex; gap: .8rem; flex-wrap: wrap; }
.grow { flex: 1 1 180px; }
.block { width: 100%; }
.stack-form { margin-top: 1rem; }
.link-btn {
    border: 0; background: none; padding: 0;
    color: var(--brand); cursor: pointer; font-size: inherit; text-decoration: underline;
}

/* ===== 布局 ===== */
.admin { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
@media (max-width: 860px) { .admin { grid-template-columns: 1fr; } }

.sidebar {
    border-right: 1px solid var(--border);
    background: var(--bg-soft);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
@media (max-width: 860px) { .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; } }

.menu { display: flex; flex-direction: column; gap: .3rem; flex: 1; }
@media (max-width: 860px) { .menu { flex-direction: row; flex: 1; flex-wrap: wrap; } }

.menu-item {
    text-align: left;
    padding: .6rem .8rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-soft);
    font-size: .9rem;
    cursor: pointer;
    font-family: inherit;
    transition: background .18s, color .18s;
}
.menu-item:hover { background: var(--brand-soft); color: var(--text); }
.menu-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.sidebar-foot { display: flex; flex-direction: column; gap: .5rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-soft);
}
.topbar h1 { margin: 0; font-size: 1.15rem; }
.topbar p { margin: .15rem 0 0; font-size: .8rem; color: var(--text-soft); }
.topbar-right { display: flex; align-items: center; gap: .6rem; }
.user-chip {
    padding: .35rem .8rem;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: .82rem;
}

.view { display: none; padding: 1.5rem; }
.view.active { display: block; animation: fadeUp .25s ease both; }

/* ===== 概览 ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    padding: 1.1rem 1.2rem;
    border-radius: var(--radius);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.stat-card .label { font-size: .8rem; color: var(--text-soft); }
.stat-card .value { font-size: 1.7rem; font-weight: 700; margin-top: .3rem; }

.panel {
    padding: 1.2rem 1.3rem;
    border-radius: var(--radius);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 1.2rem;
}
.panel.narrow { max-width: 460px; }
.panel h2 { margin: 0 0 .9rem; font-size: 1rem; }
.panel code { background: var(--brand-soft); color: var(--brand); padding: .1rem .35rem; border-radius: 5px; }
.hint { color: var(--text-soft); font-size: .82rem; margin: .8rem 0 0; }

/* ===== 工具栏与图片网格 ===== */
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.2rem; }
.toolbar .input { width: 260px; height: 38px; }
.toolbar .primary-btn { margin-left: auto; }
@media (max-width: 640px) { .toolbar .input { width: 100%; } .toolbar .primary-btn { margin-left: 0; width: 100%; } }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1rem;
}
.admin-card {
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}
.admin-card .thumb {
    aspect-ratio: 4 / 3;
    background: var(--brand-soft);
    cursor: pointer;
    position: relative;
}
.admin-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-card .thumb .private-flag {
    position: absolute; top: 6px; left: 6px;
    font-size: .7rem; padding: .1rem .45rem; border-radius: 6px;
    background: rgba(15, 17, 24, .7); color: #fff;
}
.admin-card .info { padding: .6rem .7rem; font-size: .82rem; }
.admin-card .info .t {
    font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-card .info .m { color: var(--text-soft); font-size: .74rem; margin-top: .2rem; }
.admin-card .ops {
    display: flex; gap: .3rem; padding: 0 .7rem .7rem;
}
.admin-card .ops button {
    flex: 1;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-soft);
    border-radius: 8px;
    padding: .35rem 0;
    font-size: .76rem;
    cursor: pointer;
    font-family: inherit;
}
.admin-card .ops button:hover { color: var(--brand); border-color: var(--brand); }
.admin-card .ops button.danger:hover { color: #ef4444; border-color: #ef4444; }

/* ===== 表格 ===== */
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { padding: .65rem .5rem; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-soft); font-weight: 600; font-size: .8rem; }
.table td .ops { display: flex; gap: .4rem; }
.inline-form { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.inline-form .input { width: 200px; }
@media (max-width: 640px) { .inline-form .input { width: 100%; } }

.mini-btn {
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-soft);
    border-radius: 8px;
    padding: .25rem .6rem;
    font-size: .78rem;
    cursor: pointer;
    font-family: inherit;
}
.mini-btn:hover { color: var(--brand); border-color: var(--brand); }
.mini-btn.danger:hover { color: #ef4444; border-color: #ef4444; }
.ghost-btn.danger { color: #ef4444; }

/* ===== 抽屉 / 弹窗 ===== */
.drawer, .modal { position: fixed; inset: 0; z-index: 120; }
.drawer[hidden], .modal[hidden] { display: none; }
.drawer-mask, .modal-mask {
    position: absolute; inset: 0;
    background: rgba(10, 12, 20, .55);
    backdrop-filter: blur(3px);
}
.drawer-body {
    position: absolute; top: 0; right: 0; bottom: 0;
    width: min(460px, 100%);
    background: var(--bg);
    border-left: 1px solid var(--border);
    padding: 1.2rem 1.4rem 2rem;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideIn .25s ease;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }

.modal-body {
    position: relative;
    width: min(520px, calc(100% - 2rem));
    margin: 6vh auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem 1.4rem 1.6rem;
    box-shadow: var(--shadow-lg);
    max-height: 88vh;
    overflow-y: auto;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.drawer-head h2 { margin: 0; font-size: 1.05rem; }

/* ===== 上传区 ===== */
.dropzone {
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    text-align: center;
    background: var(--bg-soft);
    transition: border-color .2s, background .2s;
}
.dropzone.dragover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone-icon { font-size: 1.6rem; }
.dropzone p { margin: .4rem 0 .2rem; font-size: .88rem; }
.dropzone small { color: var(--text-soft); font-size: .76rem; }
.preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: .5rem; margin-top: .8rem; }
.preview img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.edit-preview {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-soft);
    margin-bottom: .8rem;
}
