/* ============================================================
   啵啵依后台管理系统 - 双端样式
   ------------------------------------------------------------
   ├─ 第一部分：公共基础（设计变量 / 组件 / 通用样式）
   ├─ 第二部分：【电脑端样式】≥1024px —— 双栏表单 / 精细交互
   └─ 第三部分：【手机端样式】≤768px —— 抽屉菜单 / 卡片列表 / 底部弹层
   ============================================================ */

/* ==================== 一、设计变量 ==================== */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #7c3aed;
    --pink: #ec4899;
    --gradient: linear-gradient(135deg, #ec4899 0%, #7c3aed 50%, #6366f1 100%);
    --gradient-soft: linear-gradient(135deg, rgba(236, 72, 153, .08), rgba(99, 102, 241, .10));

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --bg: #f5f6fa;
    --bg-soft: #eef0f8;
    --card-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --text: #1f2333;
    --text-secondary: #5b6472;
    --text-muted: #9aa3b2;
    --border: #e7e9f2;
    --border-light: #f0f1f8;

    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --shadow-sm: 0 1px 2px rgba(31, 35, 51, .04), 0 2px 8px rgba(31, 35, 51, .04);
    --shadow: 0 1px 3px rgba(31, 35, 51, .05), 0 6px 18px rgba(31, 35, 51, .06);
    --shadow-lg: 0 10px 36px rgba(31, 35, 51, .14);

    --sidebar-width: 240px;
    --topbar-height: 60px;
}

/* ==================== 二、基础 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

::selection { background: rgba(99, 102, 241, .18); }

a { color: var(--primary); text-decoration: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d4d7e5; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b9bdd4; }
::-webkit-scrollbar-track { background: transparent; }

/* ==================== 三、按钮 ==================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 18px; border: 1px solid transparent; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
    transition: all .18s ease; background: #fff; color: var(--text);
    line-height: 1.4; user-select: none; font-family: inherit;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 2px 8px rgba(124, 58, 237, .28); }
.btn-primary:hover:not(:disabled) { opacity: .93; transform: translateY(-1px); box-shadow: 0 5px 16px rgba(124, 58, 237, .38); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary-light); color: var(--primary); background: #f6f6ff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; transform: translateY(-1px); }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-lg { padding: 12px 26px; font-size: 15px; }
.btn-block { width: 100%; }

.btn.loading { pointer-events: none; opacity: .75; }
.btn.loading::before {
    content: ''; width: 14px; height: 14px; border: 2px solid currentColor;
    border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: none; background: transparent;
    border-radius: var(--radius-sm); cursor: pointer; color: var(--text-secondary);
    transition: all .18s;
}
.icon-btn:hover { background: #eceefb; color: var(--primary); }

/* ==================== 四、登录页 ==================== */
.login-view {
    position: relative; overflow: hidden;
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    padding: 24px;
}
@supports (min-height: 100dvh) { .login-view { min-height: 100dvh; } }

/* 装饰光斑 */
.login-view::before,
.login-view::after {
    content: ''; position: absolute; border-radius: 50%; pointer-events: none;
}
.login-view::before {
    width: 520px; height: 520px; top: -140px; left: -120px;
    background: radial-gradient(circle, rgba(236, 72, 153, .16), transparent 68%);
    animation: blobFloat 9s ease-in-out infinite;
}
.login-view::after {
    width: 560px; height: 560px; right: -140px; bottom: -160px;
    background: radial-gradient(circle, rgba(99, 102, 241, .18), transparent 68%);
    animation: blobFloat 11s ease-in-out 2s infinite reverse;
}
@keyframes blobFloat { 50% { transform: translateY(28px); } }

.login-card {
    position: relative; z-index: 1;
    width: 100%; max-width: 410px; background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 24px; padding: 46px 42px 32px; box-shadow: var(--shadow-lg);
    text-align: center;
    animation: cardIn .5s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

.login-logo { margin-bottom: 18px; }
.login-logo svg { filter: drop-shadow(0 8px 18px rgba(124, 58, 237, .35)); }
.login-title { font-size: 23px; font-weight: 700; margin-bottom: 6px; letter-spacing: .5px; }
.login-subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 30px; }
.login-form { text-align: left; }
.login-form .btn { margin-top: 10px; }
.login-footer { margin-top: 28px; font-size: 12px; color: var(--text-muted); }

/* ==================== 五、表单控件 ==================== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 500;
    color: var(--text-secondary); margin-bottom: 6px;
}
.form-group label .req { color: var(--danger); margin-left: 2px; }

.form-input,
.form-group input[type="text"], .form-group input[type="password"],
.form-group input[type="number"], .form-group input[type="date"],
.form-group input[type="time"], .form-group select, .form-group textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
    background: #fff; color: var(--text); transition: border-color .18s, box-shadow .18s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus, .form-input:focus {
    outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(99, 102, 241, .14);
}
.form-group textarea { min-height: 88px; resize: vertical; line-height: 1.55; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-group input[type="color"] {
    width: 100%; height: 40px; padding: 3px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: #fff; cursor: pointer;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* 长字段（textarea / 动态行 / JSON）在双列网格中占满整行 */
#single-form, #crud-form, #pwd-form, form[id^="form-"] {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 28px;
}
.form-group.wide { grid-column: 1 / -1; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 44px; height: 25px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; inset: 0; background: #d4d7e5; border-radius: 25px;
    cursor: pointer; transition: background .2s;
}
.switch .slider::before {
    content: ''; position: absolute; width: 19px; height: 19px; border-radius: 50%;
    background: #fff; top: 3px; left: 3px; transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(19px); }
.switch-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }

/* 图片上传字段 */
.image-field { display: flex; flex-direction: column; gap: 10px; }
.image-field-row { display: flex; gap: 8px; }
.image-field-row input { flex: 1; min-width: 0; }

/* 预览容器：头像字段=圆形，封面/照片字段=宽幅横条 */
.image-preview-box {
    position: relative; flex: none; overflow: hidden;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: #fafbfe;
}
.image-preview-box.is-banner { width: 100%; height: 128px; }
.image-preview-box.is-avatar { width: 88px; height: 88px; border-radius: 50%; }
.image-preview { width: 100%; height: 100%; object-fit: cover; display: none; }
/* 头像预览向上偏移取景，避免裁掉脸部 */
.image-preview-box.is-avatar .image-preview { object-position: center 20%; }
.image-preview-box.has-img .image-preview { display: block; }

/* 无图占位：棋盘格 + 图标，加载失败自动回退显示 */
.image-placeholder {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #b9c0d0; font-size: 22px;
    background:
        linear-gradient(45deg, #f0f2f9 25%, transparent 25%, transparent 75%, #f0f2f9 75%),
        linear-gradient(45deg, #f0f2f9 25%, #fafbfe 25%, #fafbfe 75%, #f0f2f9 75%);
    background-size: 16px 16px; background-position: 0 0, 8px 8px;
}
.image-preview-box.has-img .image-placeholder { display: none; }

/* 动态行编辑器（作息时间） */
.rows-editor { display: flex; flex-direction: column; gap: 8px; }
.rows-editor-row { display: flex; gap: 8px; align-items: center; }
.rows-editor-row input {
    flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 13px; font-family: inherit;
}
.rows-editor-row input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.rows-editor-row .row-del { flex: none; }

/* ==================== 六、整体布局 ==================== */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-width);
    background: var(--sidebar-bg); border-right: 1px solid var(--border-light);
    display: flex; flex-direction: column; z-index: 100;
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px; padding: 0 20px;
    border-bottom: 1px solid var(--border-light); height: var(--topbar-height); flex: none;
}
.sidebar-logo { display: inline-flex; }
.sidebar-logo svg { filter: drop-shadow(0 4px 10px rgba(124, 58, 237, .32)); }
.sidebar-brand-text {
    font-size: 18px; font-weight: 700;
    background: var(--gradient); -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-menu { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 12px 24px; }

.sidebar-group { margin-bottom: 4px; }
.sidebar-group-title {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 10px 6px; font-size: 11px; color: var(--text-muted);
    cursor: pointer; user-select: none; font-weight: 600; letter-spacing: 1.5px;
}
.sidebar-group-title .arrow { transition: transform .2s; font-size: 10px; color: var(--text-muted); }
.sidebar-group.collapsed .sidebar-group-title .arrow { transform: rotate(-90deg); }
.sidebar-group.collapsed .sidebar-items { display: none; }
.sidebar-items { display: flex; flex-direction: column; gap: 3px; }

.sidebar-item {
    display: flex; align-items: center; gap: 11px; padding: 10px 13px;
    border-radius: var(--radius-sm); color: var(--text-secondary);
    font-size: 13.5px; cursor: pointer; transition: all .16s; text-decoration: none;
    border: 1px solid transparent;
}
.sidebar-item svg { flex: none; opacity: .7; }
.sidebar-item:hover { background: #eef0fa; color: var(--primary); }
.sidebar-item.active {
    background: var(--gradient); color: #fff; font-weight: 500;
    box-shadow: 0 4px 12px rgba(124, 58, 237, .30);
}
.sidebar-item.active svg { opacity: 1; }

.sidebar-mask {
    display: none; position: fixed; inset: 0;
    background: rgba(17, 20, 35, .45); z-index: 99;
}

.main-wrapper { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    height: var(--topbar-height); background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-light); display: flex; align-items: center;
    justify-content: space-between; padding: 0 22px; position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text-secondary); }
.topbar-avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--gradient);
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; box-shadow: 0 3px 8px rgba(124, 58, 237, .3);
}
#menu-toggle { display: none; }

.main-content { padding: 22px; flex: 1; }

/* ==================== 七、卡片 ==================== */
.card {
    background: var(--card-bg); border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm); padding: 22px; margin-bottom: 20px;
}
.card-title {
    font-size: 15px; font-weight: 600; margin-bottom: 16px;
    display: flex; align-items: center; gap: 9px;
}
.card-title::before {
    content: ''; width: 4px; height: 16px; border-radius: 2px;
    background: var(--gradient); flex: none;
}

/* ==================== 八、仪表盘 ==================== */
.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px; margin-bottom: 20px;
}
.stat-card {
    background: var(--card-bg); border-radius: var(--radius); padding: 20px;
    border: 1px solid var(--border-light); box-shadow: var(--shadow-sm);
    display: flex; align-items: center; gap: 14px; position: relative; overflow: hidden;
    transition: transform .18s, box-shadow .18s;
}
.stat-card::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--gradient); opacity: .85;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-icon {
    width: 48px; height: 48px; border-radius: 13px; display: flex;
    align-items: center; justify-content: center; flex: none; color: #fff;
    font-size: 21px; line-height: 1; box-shadow: 0 4px 10px rgba(31, 35, 51, .16);
}
.stat-value { font-size: 25px; font-weight: 700; line-height: 1.25; }
.stat-label { font-size: 12px; color: var(--text-muted); }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .dashboard-grid { grid-template-columns: 1fr; } }

.recent-msg { display: flex; flex-direction: column; gap: 12px; }
.recent-msg-item {
    padding: 13px 15px; background: var(--bg-soft); border-radius: var(--radius-sm);
    border: 1px solid var(--border-light); transition: background .15s;
}
.recent-msg-item:hover { background: #f2f3fb; }
.recent-msg-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; gap: 10px; }
.recent-msg-name { font-weight: 600; }
.recent-msg-time { color: var(--text-muted); font-size: 12px; flex: none; }
.recent-msg-content { color: var(--text-secondary); font-size: 13px; word-break: break-all; }

.kv-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; }
.kv-item {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13px;
}
.kv-item .k { color: var(--text-muted); flex: none; }
.kv-item .v { font-weight: 500; text-align: right; word-break: break-all; }
.progress-bar { height: 8px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; }
.progress-bar > i { display: block; height: 100%; background: var(--gradient); border-radius: 4px; }

.weather-form { display: flex; gap: 10px; margin-bottom: 14px; }
.weather-form input { flex: 1; }
.weather-result { font-size: 13px; color: var(--text-secondary); }
.weather-result .w-line {
    padding: 7px 0; border-bottom: 1px dashed var(--border);
    display: flex; justify-content: space-between; gap: 10px;
}
.weather-result .w-line:last-child { border-bottom: none; }

/* ==================== 九、工具栏 / 表格 / 分页 ==================== */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.toolbar input, .toolbar select {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 13px; font-family: inherit; background: #fff; color: var(--text);
    min-width: 150px;
}
.toolbar input:focus, .toolbar select:focus {
    outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(99, 102, 241, .14);
}

.table-wrap {
    overflow-x: auto; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: #fff;
}
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
.data-table th, .data-table td {
    padding: 12px 15px; text-align: left;
    border-bottom: 1px solid var(--border-light); white-space: nowrap;
}
.data-table th {
    background: #f8f9fd; font-weight: 600; color: var(--text-muted);
    font-size: 12px; letter-spacing: .5px; position: sticky; top: 0;
}
.data-table td { color: var(--text-secondary); }
.data-table td:first-child { color: var(--text); font-weight: 500; }
.data-table tbody tr { transition: background .13s; }
.data-table tbody tr:hover { background: #f7f8ff; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .cell-ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.data-table .cell-actions { display: flex; gap: 6px; }
.table-empty { padding: 44px; text-align: center; color: var(--text-muted); }
.thumb-sm {
    width: 52px; height: 36px; object-fit: cover; border-radius: 8px;
    border: 1px solid var(--border); background: #f3f4f8; vertical-align: middle;
}
/* 表格/卡片中的头像缩略图：圆形，取景偏上 */
.thumb-sm.thumb-avatar { width: 40px; height: 40px; border-radius: 50%; object-position: center 20%; }
.color-chip {
    display: inline-block; width: 20px; height: 20px; border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, .08); vertical-align: middle;
}

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; }
.badge-green { background: #d1fae5; color: #047857; }
.badge-gray { background: #eef0f6; color: var(--text-secondary); }
.badge-pink { background: #fce7f3; color: #be185d; }

.pagination {
    display: flex; align-items: center; gap: 10px; justify-content: flex-end;
    margin-top: 14px; font-size: 13px; color: var(--text-secondary);
}

/* 手机端卡片列表（电脑端隐藏，由媒体查询切换显示） */
.mobile-cards { display: none; }

/* ==================== 十、Tab 页签 ==================== */
.tabs {
    display: flex; gap: 4px; border-bottom: 1px solid var(--border);
    margin-bottom: 22px; flex-wrap: wrap;
}
.tab-item {
    padding: 10px 18px; font-size: 14px; color: var(--text-secondary); cursor: pointer;
    border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
    font-family: inherit; transition: all .15s;
}
.tab-item:hover { color: var(--primary); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.form-actions {
    display: flex; justify-content: flex-end; gap: 10px;
    margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--border-light);
}

/* ==================== 十一、弹窗 ==================== */
/* 外层裁剪装饰、内层 .modal-scroll 负责实际滚动 */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(17, 20, 35, .46);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; padding: 20px; overflow: hidden;
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.modal-card {
    background: #fff; border-radius: 18px; width: 100%; max-width: 660px;
    max-height: calc(100vh - 60px); display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg); overflow: hidden;
    animation: modalIn .24s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 17px 24px; border-bottom: 1px solid var(--border-light); flex: none;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
    border: none; background: none; font-size: 24px; line-height: 1;
    color: var(--text-muted); cursor: pointer; padding: 0 4px;
    transition: color .15s;
}
.modal-close:hover { color: var(--text); }
.modal-scroll { padding: 22px 24px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer {
    padding: 15px 24px; border-top: 1px solid var(--border-light);
    display: flex; justify-content: flex-end; gap: 10px; flex: none;
}

.modal-confirm {
    max-width: 380px; text-align: center; padding: 32px 28px 26px;
    display: block;
}
.confirm-icon { margin-bottom: 12px; }
.confirm-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.confirm-text { color: var(--text-secondary); font-size: 13px; margin-bottom: 22px; }
.confirm-actions { display: flex; justify-content: center; gap: 10px; }

/* ==================== 十二、Toast ==================== */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 400;
    display: flex; flex-direction: column; gap: 10px;
}
.toast {
    min-width: 220px; max-width: 380px; padding: 12px 16px; border-radius: var(--radius-sm);
    color: #fff; font-size: 13px; box-shadow: var(--shadow-lg);
    display: flex; align-items: flex-start; gap: 8px; word-break: break-all;
    animation: toastIn .25s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
.toast.hide { opacity: 0; transform: translateX(20px); transition: all .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ==================== 十三、其它 ==================== */
.loading-box { padding: 64px 0; text-align: center; color: var(--text-muted); }
.loading-box::before {
    content: ''; display: inline-block; width: 26px; height: 26px;
    border: 3px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin .8s linear infinite;
    vertical-align: middle; margin-right: 10px;
}
.page-desc { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }

/* ============================================================
   第一套样式：【电脑端】（≥1024px 宽屏增强）
   ============================================================ */
@media (min-width: 1024px) {
    .main-content { padding: 26px 30px 44px; }
    .topbar { padding: 0 28px; }
    .sidebar-item { padding: 10px 14px; }
    .stat-grid { gap: 18px; }
    .card { padding: 24px; }
    .modal-card { max-width: 680px; }
}

/* ============================================================
   第二套样式：【手机端】
   —— ≤900px：侧栏抽屉化
   —— ≤768px：卡片列表 / 底部弹层 / 大触控目标
   ============================================================ */

/* ---- 平板及以下：侧栏改为抽屉 ---- */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-105%);
        border-right: none; width: 262px;
        border-radius: 0 18px 18px 0;
        box-shadow: var(--shadow-lg);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-mask { display: block; }
    .main-wrapper { margin-left: 0; }
    #menu-toggle { display: inline-flex; }
}

/* ---- 手机端完整样式 ---- */
@media (max-width: 768px) {
    body { font-size: 13.5px; }

    /* 布局 */
    .main-content { padding: 14px 14px 32px; }
    .topbar { height: 54px; padding: 0 14px; }
    .topbar-title { font-size: 16px; }
    .topbar-user span:last-child { display: none; }
    .sidebar-mask { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }

    /* 登录页 */
    .login-view { padding: 18px; }
    .login-card { padding: 34px 26px 26px; border-radius: 20px; }
    .login-title { font-size: 20px; }
    .login-subtitle { margin-bottom: 24px; }
    .login-form .btn { padding: 12px; font-size: 15px; }

    /* 表单：双列改单列，控件加大触控面积 */
    #single-form, #crud-form, #pwd-form, form[id^="form-"] { grid-template-columns: 1fr; column-gap: 0; }
    .form-input,
    .form-group input[type="text"], .form-group input[type="password"],
    .form-group input[type="number"], .form-group input[type="date"],
    .form-group input[type="time"], .form-group select, .form-group textarea {
        padding: 12px; font-size: 15px;
    }
    .form-actions { justify-content: stretch; }
    .form-actions .btn { flex: 1; padding: 12px; font-size: 15px; }
    .image-field-row { flex-direction: row; }
    .image-field-row .btn { flex: none; }
    .image-preview-box.is-banner { height: 150px; }
    .image-preview-box.is-avatar { width: 96px; height: 96px; }

    /* 仪表盘：统计卡两列 */
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; gap: 10px; }
    .stat-icon { width: 42px; height: 42px; border-radius: 11px; font-size: 18px; }
    .stat-value { font-size: 21px; }
    .kv-list { grid-template-columns: 1fr; gap: 2px 0; }
    .weather-form input { min-width: 0; }

    /* 工具栏：筛选项占满整行，按钮等宽排列 */
    .toolbar { gap: 8px; }
    .toolbar input, .toolbar select { flex: 1 1 100%; min-width: 0; padding: 11px 12px; font-size: 14px; }
    .toolbar .spacer { display: none; }
    .toolbar .btn { flex: 1; padding: 11px 10px; }

    /* 表格 → 卡片列表切换 */
    .table-wrap { display: none; }
    .mobile-cards { display: flex; flex-direction: column; gap: 12px; }
    .m-card {
        background: #fff; border: 1px solid var(--border-light);
        border-radius: var(--radius-sm); padding: 6px 14px 13px;
        box-shadow: var(--shadow-sm);
    }
    .m-row {
        display: flex; justify-content: space-between; align-items: flex-start; gap: 14px;
        padding: 9px 0; border-bottom: 1px dashed var(--border-light); font-size: 13px;
    }
    .m-row:last-of-type { border-bottom: none; }
    .m-label { color: var(--text-muted); font-size: 12px; flex: none; padding-top: 1px; }
    .m-val { text-align: right; word-break: break-all; color: var(--text); max-width: 68%; }
    .m-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
    .m-actions .btn { padding: 8px 18px; }

    /* Tab 页签：横向滑动 */
    .tabs {
        flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab-item { white-space: nowrap; padding: 10px 14px; flex: none; }

    /* 分页 */
    .pagination { flex-wrap: wrap; justify-content: center; gap: 8px; }
    .pagination > span { width: 100%; text-align: center; margin-bottom: 2px; }
    .pagination .btn { padding: 9px 22px; }

    /* 弹窗 → 底部抽屉 */
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal-card {
        max-width: 100%; max-height: 90vh;
        border-radius: 20px 20px 0 0;
        animation: sheetIn .28s cubic-bezier(.32, .72, .35, 1);
    }
    @keyframes sheetIn { from { transform: translateY(60px); opacity: .5; } to { transform: none; opacity: 1; } }
    .modal-header { padding: 15px 18px; border-bottom: 1px solid var(--border-light); }
    .modal-title { font-size: 15px; }
    .modal-scroll { padding: 16px 18px; }
    .modal-footer {
        padding: 13px 18px calc(14px + env(safe-area-inset-bottom));
        justify-content: stretch;
    }
    .modal-footer .btn { flex: 1; padding: 12px; font-size: 15px; }

    /* 确认框保持居中 */
    .modal-card.modal-confirm {
        align-self: center; max-width: 340px; margin: 0 16px;
        border-radius: 18px; padding: 26px 20px 20px;
        animation: modalIn .24s ease;
    }
    .confirm-actions .btn { flex: 1; padding: 11px; }

    /* Toast 顶部居中 */
    .toast-container { top: calc(12px + env(safe-area-inset-top)); left: 14px; right: 14px; }
    .toast { max-width: none; min-width: 0; }

    /* 动态行编辑器：允许换行 */
    .rows-editor-row { flex-wrap: wrap; }
    .rows-editor-row input { min-width: 120px; }
}

/* ---- 小屏微调 ---- */
@media (max-width: 380px) {
    .stat-grid { gap: 8px; }
    .stat-card { padding: 12px 10px; gap: 8px; }
    .stat-value { font-size: 19px; }
}

/* ============================================================
   第四部分：全站特效（入场交错动画 / 微交互 / 呼吸光晕）
   ============================================================ */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* 模块切换时内容依次浮现 */
.toolbar, .tabs, .table-wrap, .mobile-cards, #pagination,
.card, .stat-grid > .stat-card { animation: fadeInUp .45s ease both; }
.stat-grid > .stat-card { animation-delay: calc(min(var(--i, 0), 8) * 55ms); }
.card:nth-of-type(1) { animation-delay: .10s; }
.card:nth-of-type(2) { animation-delay: .16s; }
.card:nth-of-type(3) { animation-delay: .22s; }

/* 表格行 / 手机卡片交错淡入 */
.data-table tbody tr {
    animation: fadeIn .35s ease both;
    animation-delay: calc(min(var(--i, 0), 14) * 40ms);
}
.mobile-cards .m-card { animation-delay: calc(min(var(--i, 0), 10) * 55ms); }

/* 主按钮：悬停光泽扫过 */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
    content: ''; position: absolute; top: 0; left: -80%; width: 45%; height: 100%;
    background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .38), transparent);
    transform: skewX(-20deg); transition: left .55s ease; pointer-events: none;
}
.btn-primary:hover:not(:disabled)::after { left: 135%; }

/* 统计卡：悬停发光 */
.stat-card:hover { box-shadow: 0 10px 30px rgba(124, 58, 237, .18); }

/* 侧边栏：图标弹跳 + 活跃项渐变流动 */
.sidebar-item svg { transition: transform .2s; }
.sidebar-item:hover svg { transform: scale(1.18); }
@keyframes gradientShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.sidebar-item.active {
    background: linear-gradient(120deg, #ec4899, #7c3aed, #6366f1, #ec4899);
    background-size: 300% 300%;
    animation: gradientShift 6s ease infinite;
}

/* 登录页：渐变流动标题 + 卡片呼吸光晕 */
.login-title {
    background: linear-gradient(120deg, #ec4899, #7c3aed, #6366f1, #ec4899);
    background-size: 300% auto;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 6s ease infinite;
}
.login-card { animation: cardIn .5s ease both, breatheGlow 5.5s ease-in-out 1s infinite; }
@keyframes breatheGlow {
    0%, 100% { box-shadow: 0 10px 36px rgba(31, 35, 51, .14); }
    50% { box-shadow: 0 16px 48px rgba(124, 58, 237, .22); }
}

/* 弹窗：弹性入场（仅电脑/平板端；手机端保持底部滑入 sheetIn） */
@media (min-width: 769px) {
    @keyframes modalPop {
        0% { opacity: 0; transform: translateY(18px) scale(.96); }
        60% { opacity: 1; transform: translateY(-2px) scale(1.005); }
        100% { transform: none; }
    }
    .modal-card { animation: modalPop .32s cubic-bezier(.34, 1.3, .64, 1) both; }
}

/* 尊重系统"减少动态效果"设置 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ==================== 截图列表编辑器（多图字段） ==================== */
.shots-list { display: flex; flex-direction: column; gap: 10px; width: 100%; align-items: stretch; }
.shot-row { display: flex; align-items: center; gap: 8px; }
.shot-row .form-input { flex: 1; min-width: 0; }
.shot-row .btn { flex: none; }
.shot-preview {
    width: 64px; height: 44px; object-fit: cover; border-radius: 8px; flex: none;
    border: 1px solid var(--border); background: #f3f4f8;
}
img.shot-preview[src=""], .shot-preview.broken { visibility: hidden; }
.shots-list .shot-add { align-self: flex-start; }

/* 手机端：截图行允许换行，缩略图略小 */
@media (max-width: 768px) {
    .shot-row { flex-wrap: wrap; }
    .shot-preview { width: 48px; height: 40px; }
    .shot-row .form-input { flex: 1 1 calc(100% - 60px); }
}
