/* ==========================================================
   后台管理 - 浅色侧栏 + 紫色品牌
   登录页 - 紫色渐变 + 中央卡片
   ========================================================== */

:root {
    --primary: #7c3aed;
    --primary-hover: #6d28d9;
    --primary-soft: #f5f3ff;
    --primary-soft-hover: #ede9fe;
    --bg: #f8fafc;
    --side-bg: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --text-2: #4b5563;
    --text-3: #9ca3af;
    --danger: #ef4444;
    --danger-soft: #fef2f2;
    --success: #10b981;
    --success-soft: #ecfdf5;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    overflow-x: hidden;
    touch-action: manipulation;
}
a { color: inherit; text-decoration: none; }
code {
    background: var(--primary-soft);
    color: var(--primary-hover);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}

/* ==========================================================
   登录页
   ========================================================== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(ellipse at 80% 0%, #5b21b6 0%, transparent 55%),
        radial-gradient(ellipse at 20% 100%, #4c1d95 0%, transparent 50%),
        linear-gradient(135deg, #1a0a2e 0%, #2e1065 100%);
    background-attachment: fixed;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #ffffff;
    border-radius: 16px;
    padding: 40px 32px 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-brand-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(124, 58, 237, 0.4);
}

.login-brand-name {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
}

.login-brand-sub {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-3);
}

.login-form { display: flex; flex-direction: column; gap: 14px; }

.login-field { display: block; }
.login-field > span {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
}

.login-field input {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: #f9fafb;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.login-field input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
}

.login-field input::placeholder { color: var(--text-3); }

.login-error {
    background: var(--danger-soft);
    color: #b91c1c;
    border: 1px solid #fecaca;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
}

.login-btn {
    margin-top: 6px;
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .1s, box-shadow .15s;
    font-family: inherit;
}
.login-btn:hover { box-shadow: 0 8px 20px rgba(124, 58, 237, .4); }
.login-btn:active { transform: translateY(1px); }

/* ==========================================================
   后台主框架
   ========================================================== */
.admin-shell {
    display: flex;
    min-height: 100vh;
}

/* === 侧边栏 (浅色) === */
.admin-side {
    width: 230px;
    background: var(--side-bg);
    border-right: 1px solid var(--border);
    padding: 22px 14px 16px;
    display: flex;
    flex-direction: column;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.admin-brand-logo {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(124, 58, 237, .3);
}

.admin-brand-text {
    min-width: 0;
    line-height: 1.25;
}

.admin-brand-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0;
}

.admin-brand-sub {
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === 导航 === */
.admin-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 6px;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-2);
    transition: background .12s, color .12s;
    position: relative;
}

.admin-nav a:hover {
    background: #f3f4f6;
    color: var(--text);
}

.admin-nav a.active {
    background: var(--primary-soft);
    color: var(--primary-hover);
    font-weight: 600;
}

.admin-nav a.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-ico {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-ext {
    width: 13px;
    height: 13px;
    margin-left: auto;
    color: var(--text-3);
    opacity: .7;
}

/* === 退出登录 === */
.admin-logout {
    margin-top: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 8px;
    color: var(--danger);
    font-size: 13px;
    font-weight: 500;
    transition: background .12s;
    border-top: 1px solid var(--border);
    border-radius: 0;
    padding-top: 14px;
    padding-bottom: 6px;
}

.admin-logout:hover { color: #b91c1c; }

/* === 主内容区 === */
.admin-main {
    flex: 1;
    padding: 32px 36px;
    overflow-y: auto;
    min-width: 0;
}

.page-head h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text);
    letter-spacing: -0.3px;
}

.page-head p {
    margin: 0 0 20px;
    color: var(--text-3);
    font-size: 13px;
}

/* === 卡片 === */
.admin-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 26px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

/* === 表单 === */
.form-row { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
}

.form-help {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-3);
}

.form-actions { margin-top: 22px; }

.btn-primary {
    height: 40px;
    padding: 0 22px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: box-shadow .15s, transform .1s;
}
.btn-primary:hover { box-shadow: 0 6px 16px rgba(124, 58, 237, .35); }
.btn-primary:active { transform: translateY(1px); }

/* === 提示条 === */
.admin-toast {
    margin-bottom: 20px;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-toast.success { background: var(--success-soft); color: #047857; border-color: #a7f3d0; }
.admin-toast.error { background: var(--danger-soft); color: #b91c1c; border-color: #fecaca; }
.admin-toast.info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* ==========================================================
   生成记录页
   ========================================================== */

.btn-ghost {
    height: 40px;
    padding: 0 18px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text-2);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-ghost:hover { background: #f3f4f6; color: var(--text); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.stat-label {
    font-size: 12px;
    color: var(--text-3);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.stat-sub {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-3);
}

.top-ip-card {
    grid-column: span 1;
}
.top-ip-list {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.top-ip-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
    color: var(--text-2);
    border-bottom: 1px dashed transparent;
    border-radius: 0;
}
.top-ip-row:hover { color: var(--primary-hover); }
.top-ip-addr {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
.top-ip-count {
    color: var(--primary);
    font-weight: 600;
}

/* 工具栏 */
.logs-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.toolbar-input {
    flex: 1;
    min-width: 200px;
    height: 40px;
}
.toolbar-input-sm { flex: 0 1 200px; min-width: 140px; }
.toolbar-btn {
    height: 40px;
    padding: 0 18px;
}

/* 表格卡 */
.logs-card {
    padding: 0;
    overflow: hidden;
}

.logs-table-wrap {
    overflow-x: auto;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.logs-table thead th {
    background: #f9fafb;
    color: var(--text-2);
    font-weight: 600;
    font-size: 12px;
    text-align: left;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.logs-table tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}

.logs-table tbody tr:last-child td { border-bottom: none; }

.logs-table tbody tr:hover { background: #fafbfc; }

.col-time { width: 150px; white-space: nowrap; }
.col-ip { width: 130px; }
.col-num, .col-size, .col-ref { width: 70px; text-align: center; }
.col-imgs { width: 220px; }
.col-prompt { min-width: 280px; }

.cell-time {
    color: var(--text-2);
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 12px;
}

.ip-link {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    color: var(--primary-hover);
    border-bottom: 1px dashed transparent;
}
.ip-link:hover { border-bottom-color: var(--primary-hover); }

.prompt-text {
    max-width: 540px;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    line-height: 1.5;
}

.cell-num {
    text-align: center;
    font-weight: 600;
    color: var(--primary-hover);
}

/* 行内落盘图缩略图 */
.row-thumbs {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
}

.row-thumb {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
    transition: transform .12s ease, box-shadow .12s ease;
}

.row-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.row-thumb:hover {
    transform: scale(1.6);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    z-index: 5;
    position: relative;
    border-color: var(--primary);
}

.row-thumb-more {
    flex: 0 0 auto;
    min-width: 36px;
    height: 40px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #4338ca;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}

.row-thumb-none {
    color: var(--text-3);
    font-size: 13px;
}

.cell-size, .cell-ref {
    text-align: center;
    color: var(--text-2);
    font-size: 12px;
}

/* 翻页 */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--border);
}

.pager-btn {
    padding: 7px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text-2);
    font-size: 13px;
    text-decoration: none;
}
.pager-btn:hover:not(.disabled) {
    border-color: var(--primary);
    color: var(--primary-hover);
}
.pager-btn.disabled { opacity: .4; cursor: not-allowed; }

.pager-info {
    font-size: 13px;
    color: var(--text-2);
}
.pager-info-only {
    text-align: center;
    padding: 14px;
    color: var(--text-3);
    font-size: 12px;
    border-top: 1px solid var(--border);
}

.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-3);
    font-size: 13px;
}

/* ==========================================================
   生成记录主页: IP 卡片网格 (按 IP 收纳)
   ========================================================== */
.logs-card-grid { padding: 18px; }

.ip-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.ip-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    overflow: hidden;
}

.ip-card:hover {
    transform: translateY(-2px);
    border-color: #a5b4fc;
    box-shadow: 0 8px 24px rgba(99, 102, 241, .15);
}

.ip-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ip-card-ip {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-hover);
    word-break: break-all;
}

.ip-card-cid-badge {
    flex-shrink: 0;
    background: linear-gradient(135deg, #fde68a, #fbbf24);
    color: #92400e;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.ip-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px;
    background: #f9fafb;
    border-radius: 8px;
}

.ip-card-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.ip-card-stat-num {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    line-height: 1.2;
}

.ip-card-stat-label {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 2px;
}

.ip-card-thumbs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.ip-card-thumb {
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

.ip-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ip-card-thumb-more {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #4338ca;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}

.ip-card-thumbs-empty {
    padding: 20px 12px;
    text-align: center;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    color: var(--text-3);
    font-size: 12px;
}

.ip-card-prompt {
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #f9fafb;
    border-left: 3px solid #c7d2fe;
    padding: 6px 8px;
    border-radius: 0 6px 6px 0;
}

.ip-card-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 6px;
    border-top: 1px dashed #e5e7eb;
    font-size: 11px;
}

.ip-card-time {
    color: var(--text-3);
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}

.ip-card-arrow {
    color: var(--primary-hover);
    font-weight: 500;
}

/* ===== IP 卡 移动端适配 ===== */
@media (max-width: 768px) {
    .logs-card-grid { padding: 12px; }
    .ip-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 12px;
    }
    .ip-card { padding: 12px 14px 10px; }
    .ip-card-ip { font-size: 14px; }
    .ip-card-stat-num { font-size: 16px; }
}

@media (max-width: 480px) {
    .ip-cards-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .ip-card-thumbs { grid-template-columns: repeat(4, 1fr); }
    .ip-card-thumb img { height: auto; }
}

/* ==========================================================
   IP 详情页
   ========================================================== */
.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    color: var(--text-2);
    text-decoration: none;
    margin-right: 4px;
    transition: background .15s, color .15s;
}
.back-link:hover { background: #eef2ff; color: var(--primary-hover); }

.ip-mono {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    color: var(--primary-hover);
}

.stat-value-sm {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    color: var(--text);
}

.client-id-card { padding: 16px 18px; }
.card-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.client-id-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.client-id-chip {
    background: #eef2ff;
    color: #4338ca;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
.muted-hint {
    font-size: 12px;
    color: var(--text-3);
}

/* 文件夹分组 */
.ip-folder-group {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 14px;
    background: #fff;
}

.ip-folder-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-bottom: 1px solid #fde68a;
}

.ip-folder-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.ip-folder-path {
    background: rgba(255, 255, 255, .7);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 12px;
    color: #92400e;
    word-break: break-all;
}

.ip-folder-meta {
    font-size: 11px;
    color: #92400e;
}

.ip-folder-body {
    padding: 12px 14px;
}

.ip-task-row {
    border-bottom: 1px dashed #e5e7eb;
    padding: 10px 0;
}
.ip-task-row:last-child { border-bottom: none; }

.ip-task-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-2);
}
.ip-task-time {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
.ip-task-tag {
    background: #ecfdf5;
    color: #065f46;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
}
.ip-task-tag.style {
    background: #eff6ff;
    color: #1d4ed8;
}
.ip-task-id {
    font-size: 11px;
    color: var(--text-3);
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 4px;
}

.ip-task-prompt {
    margin-top: 6px;
    font-size: 12px;
}
.ip-task-prompt summary {
    cursor: pointer;
    color: var(--primary-hover);
    user-select: none;
}
.ip-task-prompt-text {
    margin-top: 6px;
    padding: 8px 10px;
    background: #f9fafb;
    border-radius: 6px;
    color: var(--text-2);
    line-height: 1.6;
    word-break: break-word;
}

.ip-thumb-grid {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.ip-thumb-card {
    display: block;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    transition: transform .12s, border-color .12s;
    background: #f3f4f6;
}
.ip-thumb-card:hover {
    transform: scale(1.02);
    border-color: var(--primary);
}
.ip-thumb-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.col-cid { width: 100px; }
.cell-cid code {
    font-size: 11px;
    color: var(--text-3);
}

@media (max-width: 768px) {
    .ip-thumb-grid { grid-template-columns: repeat(3, 1fr); }
    .ip-thumb-card img { height: 90px; }
    .ip-folder-path { font-size: 11px; }
    .ip-folder-head { padding: 8px 10px; }
    .ip-folder-body { padding: 10px; }
    .col-cid { display: none; }
    .cell-cid { display: none; }
}

@media (max-width: 480px) {
    .ip-thumb-grid { grid-template-columns: repeat(2, 1fr); }
    .ip-thumb-card img { height: 110px; }
}

/* ==========================================================
   响应式
   ========================================================== */

/* 平板 / 大手机: 侧栏折叠成顶部水平菜单 */
@media (max-width: 768px) {
    .admin-shell { flex-direction: column; min-height: 100vh; }

    .admin-side {
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 10px 14px;
        gap: 10px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 0;
        z-index: 50;
    }

    .admin-brand {
        padding: 0;
        margin-bottom: 0;
        border-bottom: none;
        border-right: 1px solid var(--border);
        padding-right: 12px;
    }

    .admin-brand-logo { width: 32px; height: 32px; border-radius: 8px; }
    .admin-brand-logo svg { width: 16px; height: 16px; }
    .admin-brand-name { font-size: 13px; }
    .admin-brand-sub { font-size: 10px; }

    .admin-nav {
        flex-direction: row;
        flex: 1;
        padding-top: 0;
        gap: 4px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
    }
    .admin-nav::-webkit-scrollbar { display: none; }

    .admin-nav a {
        flex-shrink: 0;
        padding: 8px 12px;
        font-size: 13px;
    }
    .admin-nav a.active::before { display: none; }
    .admin-nav .nav-ext { display: none; }

    .admin-logout {
        margin-top: 0;
        margin-left: auto;
        padding: 8px 12px;
        border-top: none;
        border-radius: 8px;
        flex-shrink: 0;
    }
    .admin-logout span { display: none; }

    .admin-main { padding: 18px 14px; }
    .page-head h1 { font-size: 19px; }
    .admin-card { padding: 18px 16px; border-radius: 10px; }
    .form-input { height: 42px; font-size: 16px; }
    .btn-primary { width: 100%; height: 44px; }

    /* 生成记录页 */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }
    .top-ip-card { grid-column: 1 / -1; }
    .logs-toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-input, .toolbar-input-sm { width: 100%; flex: none; }
    .toolbar-btn { width: 100%; }
    .logs-table { font-size: 12px; }
    .logs-table thead th,
    .logs-table tbody td { padding: 10px 12px; }
    .col-prompt { min-width: 220px; }
    .prompt-text { max-width: 280px; -webkit-line-clamp: 3; }
    .pager { flex-wrap: wrap; padding: 12px; gap: 8px; }
    .pager-btn { flex: 1; text-align: center; }
    .pager-info { width: 100%; text-align: center; order: -1; }
}

/* 主流手机 */
@media (max-width: 480px) {
    .login-card { padding: 32px 22px 22px; border-radius: 14px; }
    .login-brand-logo { width: 50px; height: 50px; border-radius: 12px; }
    .login-brand-name { font-size: 19px; }
    .login-field input { height: 44px; font-size: 16px; }
    .login-btn { height: 46px; }

    .admin-side { padding: 8px 10px; gap: 6px; }
    .admin-brand-text { display: none; }
    .admin-brand { padding-right: 10px; }
    .admin-nav a span { font-size: 12px; }
    .admin-main { padding: 14px 10px; }
}

/* 小屏手机 */
@media (max-width: 360px) {
    .admin-nav a span { font-size: 11px; }
    .admin-nav a { padding: 8px 10px; gap: 8px; }
    .nav-ico { width: 16px; height: 16px; }
}

/* iOS 安全区 */
@supports (padding: env(safe-area-inset-bottom)) {
    .login-body {
        padding-top: max(env(safe-area-inset-top), 24px);
        padding-bottom: max(env(safe-area-inset-bottom), 24px);
    }
    @media (max-width: 768px) {
        .admin-side {
            padding-top: max(env(safe-area-inset-top), 10px);
            padding-left: max(env(safe-area-inset-left), 14px);
            padding-right: max(env(safe-area-inset-right), 14px);
        }
        .admin-main { padding-bottom: max(env(safe-area-inset-bottom), 16px); }
    }
}

/* 触摸优化 */
@media (hover: none) {
    .login-btn:hover,
    .btn-primary:hover { box-shadow: none; }
    .admin-nav a:hover { background: transparent; color: var(--text-2); }
    .admin-nav a.active { background: var(--primary-soft); color: var(--primary-hover); }
}

/* === 对象存储 (COS) 页 === */
.cos-form .form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 24px;
}
.cos-toggle-row {
    display: flex !important;
    align-items: center;
    gap: 10px;
    flex-direction: row !important;
    cursor: pointer;
    user-select: none;
}
.cos-toggle-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.cos-badge {
    margin-left: auto;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.cos-badge-ok {
    background: #dcfce7;
    color: #166534;
}
.cos-badge-off {
    background: #fef3c7;
    color: #92400e;
}
.req {
    color: #dc2626;
    font-weight: 700;
}
.btn-secondary {
    height: 38px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 500;
    background: #fff;
    color: var(--text-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all .15s;
}
.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.btn-secondary:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.cos-migrate-card {
    margin-top: 22px;
}
.cos-migrate-head h2 {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 6px;
}
.cos-migrate-head p {
    color: var(--text-2);
    font-size: 13px;
    margin: 0 0 18px;
}
.cos-migrate-form {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.cos-migrate-status {
    margin-top: 8px;
}
.cos-migrate-progress {
    width: 100%;
    height: 10px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 10px;
}
.cos-migrate-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #38bdf8);
    transition: width .3s;
}
.cos-migrate-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 24px;
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 12px;
}
.cos-migrate-meta b {
    color: var(--text-1);
    font-weight: 600;
}
.cos-migrate-log {
    background: #0f172a;
    color: #e2e8f0;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 12px;
    line-height: 1.55;
    padding: 12px 14px;
    border-radius: 8px;
    max-height: 220px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 60px;
}

@media (max-width: 768px) {
    .cos-form .form-grid-2 {
        grid-template-columns: 1fr;
    }
    .cos-migrate-meta {
        gap: 8px 18px;
        font-size: 12px;
    }
}

