/**
 * common.css —— 全站共享样式合并包（原 style.css + menu.css + bottom-nav.css + add-food-modal.css）
 * 2026-07-28 合并，目的是减少每个页面的 HTTP 请求数；这4个文件本来就每页都加载、内容完全一样，
 * 合并零成本。按来源文件分区块，各区块内部结构未改动。
 */

/* ============================================================
 * 共享色板（2026-10-24）：页面样式里原来写死的颜色都换成了这里的变量，值完全不变。
 * 跟深浅模式无关；要让某套主题/某个模式换颜色，在主题文件里重新定义同名变量即可，
 * 不用再一个组件一个组件地写覆盖规则。命名沿用 Tailwind 色板，dk-* 是原版深色模式自己调的几档。
 * ============================================================ */
:root {
    --pal-gray-50: #f9fafb;
    --pal-gray-100: #f3f4f6;
    --pal-gray-300: #d1d5db;
    --pal-gray-350: #c7c7c7;
    --pal-gray-400: #9ca3af;
    --pal-gray-500: #6b7280;
    --pal-gray-600: #4b5563;
    --pal-gray-700: #374151;
    --pal-gray-800: #1f2937;
    --pal-gray-900: #111827;
    --pal-stone-800: #292524;
    --pal-stone-900: #1c1917;
    --pal-red-100: #fee2e2;
    --pal-red-200: #fecaca;
    --pal-red-300: #fca5a5;
    --pal-red-400: #f87171;
    --pal-red-500: #ef4444;
    --pal-red-600: #dc2626;
    --pal-red-800: #991b1b;
    --pal-red-900: #7f1d1d;
    --pal-amber-50: #fffbeb;
    --pal-amber-100: #fef3c7;
    --pal-amber-200: #fde68a;
    --pal-amber-300: #fcd34d;
    --pal-amber-400: #fbbf24;
    --pal-amber-500: #f59e0b;
    --pal-amber-600: #d97706;
    --pal-amber-700: #b45309;
    --pal-amber-800: #92400e;
    --pal-amber-900: #78350f;
    --pal-amber-950: #451a03;
    --pal-yellow-100: #fef9c3;
    --pal-green-50: #f0fdf4;
    --pal-green-950: #052e16;
    --pal-emerald-50: #ecfdf5;
    --pal-emerald-100: #d1fae5;
    --pal-emerald-200: #a7f3d0;
    --pal-emerald-300: #6ee7b7;
    --pal-emerald-400: #34d399;
    --pal-emerald-500: #10b981;
    --pal-emerald-600: #059669;
    --pal-emerald-700: #047857;
    --pal-emerald-800: #065f46;
    --pal-emerald-900: #064e3b;
    --pal-cyan-600: #0891b2;
    --pal-sky-50: #f0f9ff;
    --pal-blue-50: #eff6ff;
    --pal-blue-100: #dbeafe;
    --pal-blue-200: #bfdbfe;
    --pal-blue-300: #93c5fd;
    --pal-blue-400: #60a5fa;
    --pal-blue-500: #3b82f6;
    --pal-blue-600: #2563eb;
    --pal-blue-700: #1d4ed8;
    --pal-blue-800: #1e40af;
    --pal-blue-900: #1e3a8a;
    --pal-indigo-50: #eef2ff;
    --pal-indigo-100: #e0e7ff;
    --pal-indigo-200: #c7d2fe;
    --pal-indigo-300: #a5b4fc;
    --pal-indigo-500: #6366f1;
    --pal-indigo-700: #4338ca;
    --pal-indigo-900: #312e81;
    --pal-violet-50: #f5f3ff;
    --pal-violet-100: #ede9fe;
    --pal-violet-300: #c4b5fd;
    --pal-violet-500: #8b5cf6;
    --pal-violet-600: #7c3aed;
    --pal-violet-900: #4c1d95;
    --pal-pink-500: #ec4899;
    --pal-dk-slate-850: #1a2535;
    --pal-dk-slate-800: #1f2d3d;
    --pal-dk-slate-750: #253246;
    --pal-dk-slate-700: #2d3f55;
    --pal-dk-blue-800: #1e3a5f;
    --pal-dk-green-900: #1a2e1a;
    --pal-dk-teal-900: #1a2e26;
    --pal-dk-violet-900: #2d1c5e;
    --pal-dk-violet-700: #4c3d9e;
    --pal-dk-indigo-900: #2d2060;
}

/* ============================================================
 * 区块一：原 style.css —— 全局基础样式（按钮/表单/消息提示/表格/徽章等）
 * ============================================================ */
/**
 * 冰箱食材管理系统 - 全局样式
 * 
 * 移动端优先，响应式设计
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 自定义背景图上叠的遮罩色：跟皮肤（data-skin）无关，只看深浅模式，
   服务端直出的 <style>（includes/bg_style.php）和 js/common.js 的实时预览
   共用这一个变量，深浅模式切换靠 CSS 属性选择器自动反应，不需要 JS 重新赋值 */
html[data-theme="dark"]  { --bg-scrim: rgba(0, 0, 0, .45); }
html[data-theme="light"] { --bg-scrim: rgba(255, 255, 255, .45); }

body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* iOS/iPadOS Safari 日期输入框原生样式会额外撑宽，统一用 CSS box model */
input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
}

/* ==================== 表单样式 ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* ==================== 工具栏筛选控件（全站统一） ==================== */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--pal-blue-700);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: var(--pal-emerald-600);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--pal-red-600);
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background-color: var(--pal-amber-600);
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-info:hover:not(:disabled) {
    background-color: var(--pal-cyan-600);
}

.btn-secondary {
    background-color: var(--text-secondary);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--pal-gray-600);
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

/* 通用：列表页操作按钮横向排列不换行（页面使用 .action-buttons 时生效） */
.action-buttons {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.action-buttons .btn {
    flex: 0 0 auto;
}

/* 通用：表格"操作"列（编辑/删除）在各端保持一行 */
th.col-actions,
td.col-actions {
    width: 160px;
    white-space: nowrap;
}

/* ==================== 消息提示 ==================== */
.error-message,
.success-message,
.info-message {
    padding: 12px;
    border-radius: var(--border-radius);
    margin-top: 15px;
    font-size: 14px;
}

.error-message {
    background-color: var(--pal-red-100);
    color: var(--pal-red-800);
    border: 1px solid var(--pal-red-200);
}

.success-message {
    background-color: var(--pal-emerald-100);
    color: var(--pal-emerald-800);
    border: 1px solid var(--pal-emerald-200);
}

.info-message {
    background-color: var(--pal-blue-100);
    color: var(--pal-blue-800);
    border: 1px solid var(--pal-blue-200);
}

/* 浮动消息容器：z-index 必须高于全站所有弹窗/遮罩（目前最高是图片预览的 99999），
   提示信息不管在哪个弹窗上弹出都要盖在最上面，不能被弹窗挡住 */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    padding: 12px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    min-width: 200px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s;
    pointer-events: none; /* 纯视觉提示，点击穿透到下面的元素，不阻挡操作 */
}

.message--show {
    opacity: 1;
    transform: translateX(0);
}

.message--success {
    background-color: var(--pal-emerald-100);
    color: var(--pal-emerald-800);
    border-left: 4px solid var(--success-color);
}

.message--error {
    background-color: var(--pal-red-100);
    color: var(--pal-red-800);
    border-left: 4px solid var(--danger-color);
}

.message--warning {
    background-color: var(--pal-amber-100);
    color: var(--pal-amber-800);
    border-left: 4px solid var(--warning-color);
}

.message--info {
    background-color: var(--pal-blue-100);
    color: var(--pal-blue-800);
    border-left: 4px solid var(--info-color);
}

/* ==================== 加载/空状态占位文字（全站共用） ==================== */
.loading-spinner {
    text-align: center; padding: 40px; color: var(--text-light, #9ca3af);
}

/* ==================== 容器布局 ==================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================== 表格样式 ==================== */
.table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    background-color: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

table tr:hover {
    background-color: var(--bg-secondary);
}

/* ==================== 状态徽章 ==================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: var(--pal-emerald-100);
    color: var(--pal-emerald-800);
}

.badge-warning {
    background: var(--pal-amber-100);
    color: var(--pal-amber-800);
}

.badge-danger {
    background: var(--pal-red-100);
    color: var(--pal-red-800);
}

.badge-info {
    background: var(--pal-blue-100);
    color: var(--pal-blue-800);
}

.badge-secondary {
    background: var(--pal-gray-100);
    color: var(--pal-gray-500);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .message-container {
        right: 10px;
        left: 10px;
    }
    
    .message {
        max-width: 100%;
    }
    
    table {
        font-size: 13px;
    }
    
    table th,
    table td {
        padding: 8px;
    }
}

/* ==================== 加载状态 ==================== */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* ==================== 工具类 ==================== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

/* ==================== 日期时间（两行） ==================== */
.dt-2line {
    line-height: 1.2;
}
.dt-2line__date {
    font-weight: 700;
}
.dt-2line__time {
    color: var(--pal-gray-500);
    font-size: 12px;
    margin-top: 4px;
}

/* ==================== 消息提示样式 ==================== */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    pointer-events: none;
}

.message {
    padding: 16px 20px;
    border-radius: 8px;
    pointer-events: none; /* 纯视觉提示，点击穿透到下面的元素，不阻挡操作 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: white;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
}

.message::before {
    content: '';
    font-size: 18px;
}

.message--show {
    opacity: 1;
    transform: translateX(0);
}

.message--success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.message--success::before {
    content: '✓';
}

.message--error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.message--error::before {
    content: '✕';
}

.message--warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.message--warning::before {
    content: '⚠';
}

.message--info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.message--info::before {
    content: 'ℹ';
}

/* 移动端优化 - 移除媒体查询，应用到所有屏幕 */
.message-container {
    left: 10px;
    right: 10px;
    max-width: none;
}

.message {
    min-width: auto;
}

/* 食材列表显示规则由 bottom-nav.css 统一管理 */

.dark-mode-btn {
    position: fixed;
    top: 12px;
    right: 58px;
    z-index: 9990;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.3s, transform 0.15s, box-shadow 0.2s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: var(--pal-gray-700);
    padding: 0;
}

.dark-mode-btn:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dark-mode-btn:active {
    transform: scale(0.9);
}

/* ==================== 主题（皮肤）切换下拉——放在深浅模式按钮右侧 ==================== */
.skin-switch-btn {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 9990;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.3s, transform 0.15s, box-shadow 0.2s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: var(--pal-gray-700);
    padding: 0;
    font-size: 16px;
}

.skin-switch-btn:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.skin-switch-btn:active {
    transform: scale(0.9);
}

/* 有弹窗打开时先把右上角两个悬浮按钮藏起来：它们层级比弹窗高，会盖住弹窗右上角的关闭按钮（2026-10-24） */
body:has(.modal[style*="display: block"], .add-food-modal[style*="display: block"], .cat-modal-overlay[style*="display: flex"], .cat-modal-overlay[style*="display: block"]) > .dark-mode-btn,
body:has(.modal[style*="display: block"], .add-food-modal[style*="display: block"], .cat-modal-overlay[style*="display: flex"], .cat-modal-overlay[style*="display: block"]) > .skin-switch-btn,
body:has(.modal[style*="display: block"], .add-food-modal[style*="display: block"], .cat-modal-overlay[style*="display: flex"], .cat-modal-overlay[style*="display: block"]) > .skin-switch-menu {
    visibility: hidden;
}

.skin-switch-menu {
    position: fixed;
    top: 56px;
    right: 12px;
    z-index: 9991;
    min-width: 168px;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    padding: 6px;
    display: none;
}

.skin-switch-menu.open {
    display: block;
}

.skin-switch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary, #111827);
    cursor: pointer;
    white-space: nowrap;
}

.skin-switch-item:hover {
    background: var(--bg-secondary, #f3f4f6);
}

.skin-switch-item.active {
    color: var(--primary-color, #3b82f6);
    font-weight: 700;
}

.skin-switch-item .skin-switch-check {
    opacity: 0;
    font-size: 12px;
}

.skin-switch-item.active .skin-switch-check {
    opacity: 1;
}

/* ==================== 弹窗层级：高于底部导航（z-index 1000） ==================== */
.modal,
.add-food-modal {
    z-index: 1001 !important;
}


/* ============================================================
 * 区块二：原 menu.css —— 全局布局与通用组件（含通用模态框基础款）
 * ============================================================ */
/**
 * 全局布局与通用组件样式
 */

/* ==================== 全局重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
    background: var(--bg-secondary, #f5f5f5);
    min-height: 100vh;
}

/* ==================== 主内容区 ==================== */
.main-wrapper {
    min-height: 100vh;
}

/* ==================== 内容容器 ==================== */
.container {
    padding: 15px;
    max-width: 1400px;
}

.page {
    padding: 15px;
    max-width: 1200px;
}

.page__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-top: 20px;
}

.page__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-primary, white);
    padding: 16px;
    border-radius: var(--card-radius, 8px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid;
}

.stat-card.blue   { border-left-color: #3b82f6; }
.stat-card.pink   { border-left-color: #e211f1; }
.stat-card.orange { border-left-color: #f59e0b; }
.stat-card.green  { border-left-color: #10b981; }
.stat-card.purple { border-left-color: #8b5cf6; }
.stat-card.red    { border-left-color: #ef4444; }

.stat-card h3 {
    font-size: 13px;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
}

.stat-card .sub-value {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    margin-top: 6px;
}

/* ==================== 内容网格 ==================== */
.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.content-card {
    background: var(--bg-primary, white);
    border-radius: var(--card-radius, 8px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 16px;
}

.content-card h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary, #1f2937);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color, #e5e7eb);
}

.data-list { list-style: none; padding: 0; margin: 0; }

.data-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--bg-tertiary, #f3f4f6);
}

.data-item:last-child { border-bottom: none; }

.item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.item-name    { font-weight: 600; color: var(--text-primary, #1f2937); }
.item-details { font-size: 13px; color: var(--text-secondary, #6b7280); margin-top: 4px; }

.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-light, #9ca3af);
}

/* ==================== 通用模态框（基础款，foods.css/shopping-list.css 各自只保留跟这份不同的部分） ==================== */
.modal {
    display: none; position: fixed; z-index: 1000;
    left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    overflow-y: auto;
    padding: 20px 16px;
    box-sizing: border-box;
}
.modal-content {
    background: var(--bg-primary, #fff); margin: 0 auto; padding: 0;
    border-radius: 8px; max-width: 500px; width: 100%;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 24px; border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.modal-header h2 { font-size: 18px; font-weight: 700; margin: 0; }
.modal-close {
    font-size: 26px; cursor: pointer; color: var(--text-light, #9ca3af);
    background: none; border: none; line-height: 1;
}
.modal-close:hover { color: var(--text-primary, #1f2937); }
.modal-body { padding: 24px; }

/* ============================================================
 * 区块三：原 bottom-nav.css —— 底部导航栏 + 全局布局覆盖
 * ============================================================ */
/**
 * 底部导航栏 + 全局布局（统一模式，手机电脑一致）
 */

/* ==================== 底部导航栏 ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-primary, #ffffff);
    border-top: 1px solid var(--border-color, #e5e7eb);
    box-shadow: var(--shadow-nav, 0 -2px 10px rgba(0, 0, 0, 0.08));
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 10px 12px;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-light, #9ca3af);
    transition: color 0.2s;
    padding: 8px 5px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:hover { color: var(--text-secondary, #6b7280); }
.bottom-nav-item.active { color: var(--brand-color, #6aaa64); }

.bottom-nav-item svg {
    width: 25px;
    height: 25px;
    margin-bottom: 4px;
    stroke-width: 2;
}

.bottom-nav-item .nav-label {
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

/* 中间大加号按钮 */
.bottom-nav-add {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, var(--brand-color, #6aaa64) 0%, var(--brand-color-strong, #5a9a54) 100%);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(106, 170, 100, 0.4);
    margin: 0 15px;
    cursor: pointer;
    border: none;
    position: relative;
    top: -15px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s, box-shadow 0.2s;
}

.bottom-nav-add:hover  { transform: scale(1.05); box-shadow: 0 6px 16px rgba(106, 170, 100, 0.5); }
.bottom-nav-add:active { transform: scale(0.95); }

.bottom-nav-add svg {
    width: 30px;
    height: 30px;
    color: #ffffff;
    stroke-width: 2.5;
}

/* 为底部导航腾出空间——只在 .main-wrapper 上留一份就够：它自己还带着 min-height:100vh，
   border-box 下 padding 会被这个 100vh 封顶，内容再少也刚好撑满一屏。body 之前也重复留了
   一份 70px，但 body 的 min-height:100vh 是"内容(main-wrapper, 已经=100vh)+这份 padding"
   算出来的、封不住自己这份 padding，于是永远比一屏多出 70px 空白可滚——这就是内容明明没
   多少却还能上下滚动的原因，去掉 body 这份重复的就好。 */
.main-wrapper { padding-bottom: 70px; }

/* ==================== 全局布局覆盖 ==================== */
/* 无侧边栏、无顶部 header，内容直接从顶部开始 */
.sidebar { display: none !important; }
.header  { display: none !important; }

.main-wrapper {
    margin-left: 0 !important;
    margin-top: 0 !important;
}

/* 页面标题区 */
.page__header {
    margin-bottom: 16px;
    padding-top: 20px;
}

/* 隐藏页面右上角添加按钮（用底部大加号代替）——按专门的标记class隐藏，
   不能按 .btn-primary 笼统匹配，否则会连带藏掉页头里其他跟"新增"无关、
   只是同样用主色样式的按钮（曾经误伤过食谱页的"推荐食谱"按钮） */
.page__header .page-header-add-btn { display: none; }

/* ==================== 分类标签栏 ==================== */
.category-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 15px;
    background: var(--bg-primary, #ffffff);
    border-radius: var(--card-radius, 0);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--bg-tertiary, #f3f4f6);
    position: sticky;
    top: 0;
    z-index: 100;
    scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar { display: none; }

@media (hover: hover) {
    .category-tabs { scrollbar-width: thin; scrollbar-color: #d1d5db transparent; }
    .category-tabs::-webkit-scrollbar { display: block; height: 3px; }
    .category-tabs::-webkit-scrollbar-thumb { background: var(--pal-gray-300); border-radius: 3px; }
}

.category-tab {
    padding: 7px 16px;
    border-radius: var(--pill-radius, 20px);
    background: var(--bg-tertiary, #f3f4f6);
    color: var(--text-secondary, #6b7280);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s, color 0.2s;
}

.category-tab:hover  { background: var(--border-color, #e5e7eb); }
.category-tab.active { background: var(--brand-color, #6aaa64); color: #ffffff; }


/* ==================== 分类子标签栏 ==================== */
.category-sub-tabs {
    display: flex;
    gap: 6px;
    padding: 8px 15px;
    background: var(--bg-tertiary, #f3f4f6);
    border-radius: var(--card-radius, 0);
    margin-bottom: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    scrollbar-width: none;
}

.category-sub-tabs::-webkit-scrollbar { display: none; }

@media (hover: hover) {
    .category-sub-tabs { scrollbar-width: thin; scrollbar-color: #c7c7c7 transparent; }
    .category-sub-tabs::-webkit-scrollbar { display: block; height: 3px; }
    .category-sub-tabs::-webkit-scrollbar-thumb { background: var(--pal-gray-350); border-radius: 3px; }
}

.category-sub-tab {
    padding: 5px 12px;
    border-radius: var(--pill-radius, 6px);
    background: var(--border-color, #e5e7eb);
    color: var(--text-secondary, #6b7280);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, color 0.15s;
}
.category-sub-tab:hover  { background: var(--pal-gray-300); color: var(--pal-gray-700); }
.category-sub-tab.active { background: var(--tab-color, #3b82f6); color: #ffffff; }


/* ==================== 分页 ==================== */
.pagination {
    padding: 15px;
    text-align: center;
    background: var(--bg-primary, #ffffff);
    border-radius: var(--card-radius, 0);
    margin-top: 8px;
    border-top: 1px solid var(--bg-tertiary, #f3f4f6);
}


/* ==================== 食材列表：始终使用行列式 ==================== */
/* 桌面表格永远隐藏 */
.content-card .table { display: none !important; }
.table                { display: none !important; }

/* 行列式列表始终显示 */
.food-list-mobile { display: block !important; overflow: visible; }
.food-table-inner { width: 100%; }


/* ============================================================
 * 区块四：原 add-food-modal.css —— 添加/编辑食材弹窗组件（5个页面共用）
 * ============================================================ */
/**
 * 添加/编辑食材模态框组件样式（被 foods/recipes/settings/shopping-list/statistics 五个页面共用）
 */

.add-food-modal { display:none; position:fixed; z-index:1000; left:0; top:0; width:100%; height:100%; background:rgba(0,0,0,0.5); animation:fadeIn 0.2s; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.add-food-modal-content { background:var(--bg-primary, #fff); margin:50px auto; padding:0; border-radius:8px; max-width:600px; max-height:90vh; overflow-y:auto; box-shadow:0 4px 6px rgba(0,0,0,0.1); animation:slideDown 0.3s; }
@keyframes slideDown { from{transform:translateY(-50px);opacity:0} to{transform:translateY(0);opacity:1} }
.add-food-modal-header { display:flex; justify-content:space-between; align-items:center; padding:20px 30px; border-bottom:1px solid var(--border-color, #e5e7eb); }
.add-food-modal-header h2 { font-size:20px; font-weight:700; margin:0; }
.add-food-modal-close { font-size:28px; cursor:pointer; color:var(--text-light, #9ca3af); line-height:1; background:none; border:none; }
.add-food-modal-close:hover { color:var(--text-primary, #1f2937); }
.add-food-modal-body { padding:30px; }
.barcode-input-row { display:flex; gap:8px; align-items:center; }
.barcode-input-row input { flex:1; }
.barcode-input-row .btn { white-space:nowrap; flex-shrink:0; }
/* 编辑食材：条码列表（一个食材多个条码，每个可记规格） */
#globalBarcodeEditor { display:none; }
#globalBarcodeList { margin-bottom:8px; }
.fib-row {
    display:flex; align-items:center; gap:8px;
    padding:6px 10px; margin-bottom:6px;
    border:1px solid var(--border-color); border-radius:var(--border-radius);
    background:var(--bg-secondary);
}
.fib-row .fib-code {
    flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
    font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:13px;
    color:var(--text-primary);
}
.fib-row .fib-pack {
    display:flex; align-items:center; gap:4px; margin:0;
    font-size:12px; font-weight:400; color:var(--text-secondary); white-space:nowrap;
}
.fib-row .fib-pack input.fib-pack-input { width:64px; padding:4px 6px; font-size:13px; }
.fib-row .fib-unit { min-width:1em; }
.fib-row .fib-del {
    flex-shrink:0; border:none; background:none; cursor:pointer;
    font-size:14px; line-height:1; padding:4px 6px; color:var(--text-light);
}
.fib-row .fib-del:hover { color:var(--danger-color); }
.fib-add-row input { min-width:0; }
.fib-add-row .btn { padding:8px 12px; font-size:13px; }
.fib-empty { font-size:12px; color:var(--text-light); margin:2px 0 8px; }
.fib-note { font-size:11px; color:var(--text-light); margin-top:6px; line-height:1.5; }
/* .form-row 之前一直没有实际布局样式，所有"两列一行"的字段其实都是纵向堆叠的，这里补上 */
.form-row { display:flex; gap:12px; }
.form-row .form-group { flex:1; min-width:0; }
@media (max-width:480px) {
    .form-row { flex-direction:column; gap:0; }
}
@media (max-width:768px) {
    .add-food-modal-content { margin:20px; max-width:calc(100% - 40px); }
    .add-food-modal-body { padding:20px; }
}
/* is_homemade 复选框行 */
.form-check-row { display:flex; align-items:center; gap:8px; margin-bottom:4px; }
.form-check-row input[type=checkbox] { width:16px; height:16px; cursor:pointer; }
.form-check-row label { cursor:pointer; font-size:14px; }
/* 条码/名称匹配拦截横幅 */
#globalBarcodeBanner {
    display: none;
    background: var(--pal-emerald-50);
    border: 1px solid var(--pal-emerald-300);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--pal-emerald-800);
    line-height: 1.6;
}
#globalBarcodeBanner .banner-title {
    font-weight: 600;
    margin-bottom: 2px;
}
#globalBarcodeBanner .banner-detail {
    color: var(--pal-emerald-700);
    font-size: 12px;
    margin-bottom: 8px;
}
#globalBarcodeBanner .banner-attach {
    display: none;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin: 0 0 8px;
    cursor: pointer;
    word-break: break-all;
}
#globalBarcodeBanner .banner-attach input { width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }
#globalBarcodeBanner .banner-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 4px;
}
#globalBannerBuyBtn {
    font-size: 13px;
    padding: 5px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: var(--pal-emerald-500);
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
#globalBannerBuyBtn:hover { background: var(--pal-emerald-600); }
#globalBannerNewBtn {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    padding: 2px 0;
    white-space: nowrap;
}
#globalBannerNewBtn:hover { color: var(--text-primary, #1f2937); }
/* 自动填充高亮动画 */
.autofill-highlight {
    animation: autofillPulse 1.2s ease;
}
@keyframes autofillPulse {
    0%   { background-color: var(--pal-emerald-100); }
    60%  { background-color: var(--pal-emerald-100); }
    100% { background-color: transparent; }
}
/* Typeahead 下拉 */
.typeahead-wrap { position: relative; }
#globalNameSuggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 2000;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--pal-gray-300);
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    max-height: 260px;
    overflow-y: auto;
}
.suggestion-item {
    padding: 9px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--bg-tertiary, #f3f4f6);
    transition: background 0.1s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover,
.suggestion-item.active { background: var(--pal-blue-50); }
.suggestion-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #111827);
    margin-bottom: 2px;
}
.suggestion-name mark {
    background: var(--pal-yellow-100);
    color: var(--pal-amber-800);
    padding: 0 1px;
    border-radius: 2px;
    font-weight: 700;
}
.suggestion-meta {
    font-size: 11px;
    color: var(--text-light, #9ca3af);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.suggestion-meta span { white-space: nowrap; }
.suggestion-empty {
    padding: 12px;
    text-align: center;
    font-size: 13px;
    color: var(--text-light, #9ca3af);
}
/* 单位换算提示行 */
#globalUnitConversionRow {
    display: none;
    background: var(--pal-amber-50);
    border: 1px solid var(--pal-amber-300);
    border-radius: 6px;
    padding: 10px 14px;
    margin-top: -4px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--pal-amber-800);
}
#globalUnitConversionRow label { font-weight: 600; display: block; margin-bottom: 6px; }
#globalUnitConversionRow .conv-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#globalUnitConversionRow input[type=number] { width: 100px; padding: 4px 8px; border: 1px solid var(--pal-amber-300); border-radius: 4px; font-size: 13px; }
#globalUnitConversionRow .conv-hint { font-size: 11px; color: var(--pal-amber-700); margin-top: 4px; }

/* ===== 保质期 / 过期日期 并排 ===== */
.shelf-expiry-row { display:flex; align-items:flex-end; gap:8px; }
.shelf-expiry-row .form-group { flex:1; margin-bottom:0; }
.shelf-expiry-or { flex-shrink:0; font-size:12px; color:var(--text-secondary,#9ca3af); padding-bottom:14px; }

/* ===== 字段小提示（分类/存储区域/单位）：跟在 label 文字后同一行，不占额外空间 ===== */
.field-hint { font-size:11px; font-weight:400; color:var(--text-secondary,#9ca3af); margin-left:4px; white-space:nowrap; }

/* ===== 弹窗内价格对比区块 ===== */
#globalPriceSection {
    display: none;
    margin-top: 16px;
    border-top: 1px dashed #e5e7eb;
    padding-top: 14px;
}
.gps-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.gps-title {
    font-size: 13px; font-weight: 600; color: var(--pal-gray-700);
}
.gps-add-toggle {
    font-size: 12px; color: var(--pal-blue-600); cursor: pointer;
    text-decoration: underline; background: none; border: none; padding: 0;
}
.gps-add-toggle:hover { color: var(--pal-blue-700); }
.gps-record-row {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 7px 10px; border-radius: var(--card-radius, 6px); margin-bottom: 5px;
    border: 1px solid var(--border-color, #e5e7eb); background: var(--bg-secondary, #f9fafb); font-size: 13px;
}
.gps-record-row.cheapest { border-color: var(--pal-emerald-300); background: var(--pal-emerald-50); }
.gps-record-row.wanted   { border-color: var(--pal-blue-300); background: var(--pal-blue-50); }
.gps-store  { font-weight: 600; flex: 1; min-width: 70px; color: var(--text-primary, #1f2937); }
.gps-price  { font-weight: 700; color: var(--text-primary, #1f2937); }
.gps-price.cheapest { color: var(--pal-emerald-600); }
/* .cheapest/.wanted 背景固定用浅色底（不跟主题变量走），深色模式下 --text-primary 会变浅色，
   浅底配浅字看不清——这两行强制文字用深色，配合固定的浅色底自成一套，不受主题影响 */
.gps-record-row.cheapest .gps-store,
.gps-record-row.wanted   .gps-store,
.gps-record-row.wanted   .gps-price { color: var(--pal-gray-800); }
.gps-unit   { font-size: 11px; color: var(--text-light, #9ca3af); }
.gps-memo   { font-size: 11px; color: var(--text-secondary, #6b7280); width: 100%; }
.gps-cheap-badge {
    font-size: 10px; padding: 1px 5px; border-radius: 3px;
    background: var(--pal-emerald-100); color: var(--pal-emerald-800); margin-left: 3px;
}
.gps-want-btn {
    font-size: 11px; padding: 2px 7px; border-radius: 4px;
    border: 1px solid var(--pal-gray-300); cursor: pointer; background: var(--bg-primary, white);
    transition: all 0.15s; white-space: nowrap; margin-left: auto;
}
.gps-want-btn.active { background: var(--pal-blue-600); color: white; border-color: var(--pal-blue-600); }
.gps-want-btn:hover:not(.active) { background: var(--pal-blue-50); border-color: var(--pal-blue-300); }
.gps-row-actions { display: flex; gap: 3px; }
.gps-add-form {
    display: none; background: var(--bg-secondary, #f9fafb); border-radius: 6px;
    padding: 12px; border: 1px dashed var(--pal-gray-300); margin-top: 8px;
}
.gps-add-form.open { display: block; }

/* ===== 店铺名自动完成下拉 ===== */
.store-ac-wrap { position: relative; }
.store-ac-drop {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    z-index: 4000; background: var(--bg-primary, #fff); border: 1px solid var(--pal-gray-300);
    border-top: none; border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    max-height: 180px; overflow-y: auto;
}
.store-ac-item {
    padding: 8px 12px; cursor: pointer; font-size: 13px;
    border-bottom: 1px solid var(--bg-tertiary, #f3f4f6);
}
.store-ac-item:last-child { border-bottom: none; }
.store-ac-item:hover,
.store-ac-item.active { background: var(--pal-blue-50); }
.store-ac-item mark { background: var(--pal-yellow-100); color: var(--pal-amber-800); padding: 0 1px; border-radius: 2px; font-weight: 700; }

/* ===== 品牌 → 分店 懒加载选择 ===== */
.branch-chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.branch-chip {
    padding: 4px 10px; border-radius: 999px; font-size: 12px; cursor: pointer;
    border: 1px solid var(--pal-gray-300); background: var(--pal-gray-50); color: var(--pal-gray-700);
}
.branch-chip:hover { background: var(--pal-blue-50); border-color: var(--pal-blue-300); }
.branch-chip.active { background: var(--primary-color, #3b82f6); border-color: var(--primary-color, #3b82f6); color: #fff; }
.branch-chip.add-new { border-style: dashed; color: var(--pal-gray-500); }
.branch-new-input-wrap { display: flex; gap: 4px; align-items: center; margin-top: 6px; }
.branch-new-input-wrap input { flex: 1; padding: 4px 8px; font-size: 12px; }
.branch-hint-link { font-size: 11px; color: var(--pal-gray-500); cursor: pointer; text-decoration: underline; }

/* ===== 快速选日期（js/date-field.js） =====
 * 原生日期框隐藏，换成只读的显示框（.qd-display，type=text，样式跟着 .form-group input 走）；
 * 点它弹出面板：快捷按钮 + 年/月/日三级网格，任意日期点几下就能选到 */
.qd-native { display: none !important; }
.qd-display { cursor: pointer; caret-color: transparent; }
.qd-overlay {
    position: fixed; inset: 0; z-index: 20000;
    display: flex; align-items: center; justify-content: center; padding: 16px;
    background-color: color-mix(in srgb, black 45%, transparent);
}
.qd-overlay[hidden] { display: none; }
.qd-panel {
    width: 100%; max-width: 360px; max-height: calc(100vh - 32px); overflow-y: auto;
    padding: 14px 16px 12px; border-radius: var(--card-radius, 12px);
    background-color: var(--bg-primary); color: var(--text-primary);
    box-shadow: 0 20px 40px rgba(0, 0, 0, .25);
}
.qd-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.qd-title { font-size: 15px; font-weight: 600; }
.qd-close {
    border: none; background-color: transparent; color: var(--text-secondary);
    font-size: 24px; line-height: 1; padding: 0 4px; cursor: pointer;
}
.qd-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.qd-quick:empty { display: none; }
.qd-chip {
    padding: 6px 10px; border-radius: 999px; font-size: 13px; cursor: pointer;
    border: 1px solid var(--border-color); background-color: var(--bg-secondary); color: var(--text-primary);
}
.qd-chip:active { border-color: var(--primary-color); color: var(--primary-color); }
.qd-hint { margin-top: 6px; font-size: 12px; color: var(--text-secondary); }
.qd-hint:empty { display: none; }
.qd-nav {
    display: flex; align-items: center; justify-content: space-between;
    margin: 12px 0 6px; padding-top: 10px; border-top: 1px solid var(--border-color);
}
.qd-nav-title { display: flex; gap: 4px; font-size: 15px; font-weight: 600; }
.qd-arrow, .qd-nav-btn {
    border: none; background-color: transparent; color: var(--text-primary); cursor: pointer;
    font-size: 15px; font-weight: 600; padding: 6px 10px; border-radius: var(--border-radius, 8px);
}
.qd-arrow { font-size: 22px; line-height: 1; padding: 4px 12px; }
.qd-nav-btn { color: var(--primary-color); }
.qd-arrow:active, .qd-nav-btn:active { background-color: var(--bg-secondary); }
.qd-grid { display: grid; gap: 4px; }
.qd-days { grid-template-columns: repeat(7, 1fr); }
.qd-months, .qd-years { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.qd-wd { text-align: center; font-size: 12px; color: var(--text-secondary); padding: 4px 0; }
.qd-cell {
    border: 1px solid transparent; background-color: transparent; color: var(--text-primary);
    border-radius: var(--border-radius, 8px); cursor: pointer; font-size: 14px;
    min-height: 38px; padding: 0;
}
.qd-months .qd-cell, .qd-years .qd-cell { min-height: 46px; background-color: var(--bg-secondary); }
.qd-cell.is-today { border-color: var(--primary-color); color: var(--primary-color); }
.qd-cell.is-before { color: var(--text-light, var(--text-secondary)); }
.qd-cell.is-sel { background-color: var(--primary-color); border-color: var(--primary-color); color: white; font-weight: 600; }
.qd-cell:active { opacity: .7; }
.qd-foot { display: flex; justify-content: flex-end; margin-top: 8px; }
.qd-foot:empty { display: none; }
.qd-link {
    border: none; background-color: transparent; color: var(--danger-color); cursor: pointer;
    font-size: 13px; padding: 6px 4px;
}
/* ===== 选图来源菜单 + 裁剪框（js/image-field.js） =====
 * 菜单：安卓上点「上传」弹出的「拍照 / 照片图库 / 选取文件」，样式仿 iPhone 系统菜单，贴底弹出。
 * 裁剪框：手机上全屏，电脑上居中一个大框；画布区固定深色（看图片用），不跟深浅模式走。
 * 两者 z-index 30000：盖住所有弹窗和全屏面板（店铺批量编辑 9995），低于消息提示（100000）。 */
.imgpick-mask {
    position: fixed; inset: 0; z-index: 30000;
    display: flex; align-items: flex-end; justify-content: center;
    padding: 0 10px calc(10px + env(safe-area-inset-bottom, 0px));
    background-color: color-mix(in srgb, black 40%, transparent);
}
.imgpick-mask[hidden] { display: none; }
.imgpick-sheet { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 8px; }
.imgpick-group { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; }
.imgpick-group button,
.imgpick-cancel {
    appearance: none; border: none; margin: 0; width: 100%;
    padding: 15px 12px; font-size: 17px; cursor: pointer;
    background-color: var(--bg-primary); color: var(--text-primary);
}
.imgpick-group button + button { border-top: 1px solid var(--border-color); }
.imgpick-cancel { border-radius: 14px; font-weight: 600; color: var(--primary-color); }
.imgpick-group button:active,
.imgpick-cancel:active { background-color: var(--bg-secondary); }

.imgcrop-mask {
    position: fixed; inset: 0; z-index: 30000;
    display: flex; align-items: center; justify-content: center;
    background-color: color-mix(in srgb, black 60%, transparent);
    overscroll-behavior: contain;
}
.imgcrop-mask[hidden] { display: none; }
.imgcrop-box {
    display: flex; flex-direction: column;
    width: 100%; height: 100%;
    background-color: var(--pal-gray-900); color: white;
}
.imgcrop-head { padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 8px; }
.imgcrop-title { font-size: 16px; font-weight: 600; }
.imgcrop-hint { margin-top: 2px; font-size: 12px; line-height: 1.5; color: color-mix(in srgb, white 70%, transparent); }
/* 左右留 24px：裁剪框不贴屏幕边（安卓从屏幕边缘拖会触发返回手势），边上的角点露在留白里 */
.imgcrop-stage { position: relative; flex: 1 1 0; min-height: 0; margin: 12px 24px; }
.imgcrop-stage > img { display: block; max-width: 100%; max-height: 100%; visibility: hidden; }   /* 原图只给 Cropper 读，显示的是它自己生成的那份 */
.imgcrop-tools { display: flex; justify-content: center; gap: 10px; padding: 10px 16px 4px; }
.imgcrop-tools button {
    border: 1px solid color-mix(in srgb, white 35%, transparent); border-radius: 999px;
    background-color: transparent; color: white;
    padding: 7px 16px; font-size: 14px; cursor: pointer;
}
.imgcrop-tools button:active:not(:disabled) { background-color: color-mix(in srgb, white 15%, transparent); }
.imgcrop-tools button:disabled { opacity: .4; cursor: default; }
.imgcrop-foot { display: flex; gap: 10px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
.imgcrop-foot .btn { flex: 1; justify-content: center; }
@media (min-width: 760px) {
    .imgcrop-box {
        width: min(900px, calc(100vw - 48px)); height: min(760px, calc(100vh - 48px));
        border-radius: var(--card-radius, 12px); overflow: hidden;
        box-shadow: 0 20px 50px rgba(0, 0, 0, .4);
    }
    .imgcrop-head { padding-top: 14px; }
    .imgcrop-foot { justify-content: flex-end; padding-bottom: 14px; }
    .imgcrop-foot .btn { flex: 0 0 auto; min-width: 96px; }
}
/* 触屏：Cropper 默认的角点只有 5px、边线 5px，手指拖不动；角点放大到 16px，边线触摸区放宽到 24px（透明） */
@media (pointer: coarse) {
    .imgcrop-stage .cropper-crop-box .cropper-point { width: 16px; height: 16px; opacity: .9; }
    .imgcrop-stage .cropper-crop-box .cropper-point.point-e,
    .imgcrop-stage .cropper-crop-box .cropper-point.point-w { margin-top: -8px; }
    .imgcrop-stage .cropper-crop-box .cropper-point.point-n,
    .imgcrop-stage .cropper-crop-box .cropper-point.point-s { margin-left: -8px; }
    .imgcrop-stage .cropper-crop-box .point-e, .imgcrop-stage .cropper-crop-box .point-ne, .imgcrop-stage .cropper-crop-box .point-se { right: -8px; }
    .imgcrop-stage .cropper-crop-box .point-w, .imgcrop-stage .cropper-crop-box .point-nw, .imgcrop-stage .cropper-crop-box .point-sw { left: -8px; }
    .imgcrop-stage .cropper-crop-box .point-n, .imgcrop-stage .cropper-crop-box .point-ne, .imgcrop-stage .cropper-crop-box .point-nw { top: -8px; }
    .imgcrop-stage .cropper-crop-box .point-s, .imgcrop-stage .cropper-crop-box .point-se, .imgcrop-stage .cropper-crop-box .point-sw { bottom: -8px; }
    .imgcrop-stage .cropper-crop-box .cropper-line { opacity: 0; }
    .imgcrop-stage .cropper-crop-box .line-e { right: -12px; width: 24px; }
    .imgcrop-stage .cropper-crop-box .line-w { left: -12px; width: 24px; }
    .imgcrop-stage .cropper-crop-box .line-n { top: -12px; height: 24px; }
    .imgcrop-stage .cropper-crop-box .line-s { bottom: -12px; height: 24px; }
}
