:root {
    --primary-red: #DA1A32;
    --dark-red: #4A0E0E;
    --emporium-pink: #E3A3A3;
    --cool-grey: #9CA3AF;
    --light-grey: #D1D5DB;
    --gold: #D4AF37;
    --dark-bg: #0F0F11;
    --glass-bg: rgba(20, 20, 22, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    --text-white: #F9FAFB;
    
    /* 动效曲线 */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out-circ: cubic-bezier(0.85, 0, 0.15, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif; /* High-end rounded sans-serif for a smoother feel */
}

body {
    background-color: var(--dark-bg);
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 50% 0%, rgba(218, 26, 50, 0.15) 0%, transparent 50%),
        linear-gradient(rgba(15, 15, 17, 0.9), rgba(15, 15, 17, 0.9)),
        url('dessert_hero_image_premium.png');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    line-height: 1.6;
}

/* ========== 全局滚动条 ========== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--dark-bg); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-red); }

/* ========== 页面切换与入场动画 ========== */
.page { display: none; opacity: 0; transition: opacity 0.5s var(--ease-out-expo); }
.page.active { display: block; opacity: 1; }
.panel { display: none; padding: 3rem 1.5rem; }
.panel.active { 
    display: block; 
    animation: slideUpFade 0.7s var(--ease-out-expo) forwards;
}

@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(30px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* 给子元素增加交错动画节奏 (Staggered Children) */
.panel.active .stagger-1 { animation: slideUpFade 0.6s var(--ease-out-expo) 0.1s both; }
.panel.active .stagger-2 { animation: slideUpFade 0.6s var(--ease-out-expo) 0.2s both; }
.panel.active .stagger-3 { animation: slideUpFade 0.6s var(--ease-out-expo) 0.3s both; }

/* ========== 玻璃卡片 (极致质感) ========== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-highlight); /* 顶部高光增加立体感 */
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.05);
    transition: transform 0.4s var(--ease-out-expo), box-shadow 0.4s var(--ease-out-expo);
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6), 0 0 20px rgba(218, 26, 50, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ========== 登录页面 ========== */
.login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-card {
    width: 100%;
    max-width: 440px;
    text-align: center;
    border-top: 3px solid var(--primary-red);
    position: relative;
    overflow: hidden;
}

/* 登录卡片柔光效果 */
.login-card::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(218,26,50,0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

.logo { width: 140px; margin-bottom: 2rem; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); }
.login-subtitle { color: var(--cool-grey); font-size: 0.9rem; margin-bottom: 2.5rem; letter-spacing: 2px; text-transform: uppercase; }
.login-hint { color: rgba(255,255,255,0.3); font-size: 0.75rem; margin-top: 1.5rem; letter-spacing: 1px; }

/* Typography System */
h1 { font-size: 2.2rem; margin-bottom: 0.5rem; color: var(--text-white); font-weight: 500; letter-spacing: 0.5px; }
h2 { font-size: 1.8rem; color: var(--emporium-pink); margin-bottom: 2rem; font-weight: 400; letter-spacing: 0.5px; }
h3 { font-size: 0.85rem; color: var(--cool-grey); text-transform: uppercase; letter-spacing: 2px; margin-bottom: 1rem; font-weight: 600; }

/* ========== 表单系统 ========== */
.input-group {
    margin-bottom: 1.5rem;
    position: relative;
    text-align: left;
}

label {
    display: block;
    color: var(--cool-grey);
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

input, select {
    width: 100%;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    font-size: 1.05rem;
    transition: all 0.3s var(--ease-out-expo);
}

select {
    width: 100%;
    padding: 12px 18px;
    background: rgba(30, 30, 35, 0.7);
    border: 1px solid rgba(212, 175, 55, 0.3); /* Subtle gold border */
    border-radius: 8px;
    color: var(--text-white);
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    /* Using a more elegant gold chevron for the dropdown icon */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23D4AF37' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem center;
    background-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

select:hover {
    border-color: rgba(212, 175, 55, 0.6);
    background: rgba(40, 40, 45, 0.8);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-red);
    background: rgba(218, 26, 50, 0.08);
    box-shadow: 0 0 0 4px rgba(218, 26, 50, 0.2), inset 0 2px 4px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}

/* 优化分组标题样式 */
optgroup {
    background: #1a1a1f;
    color: var(--gold);
    font-style: normal;
    font-weight: 600;
    letter-spacing: 1px;
    font-size: 0.8rem;
}

option {
    background: #1a1a1f;
    color: var(--text-white);
    padding: 10px;
}

/* ========== 按钮交互 ========== */
.btn-primary {
    width: 100%;
    padding: 15px;
    margin-top: 1rem;
    background: linear-gradient(135deg, var(--primary-red) 0%, #901020 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s var(--ease-out-expo);
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

/* 按钮扫光效果 */
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.2), transparent);
    transform: skewX(-20deg);
    transition: all 0.5s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(218, 26, 50, 0.4);
}

.btn-primary:hover::after {
    left: 150%;
}

.btn-primary:active {
    transform: translateY(1px);
}

/* ========== 全局顶栏 ========== */
#main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 3rem;
    background: rgba(15, 15, 17, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.mini-logo { width: 60px; height: auto; transition: transform 0.3s; }
.mini-logo:hover { transform: scale(1.05); }

nav { display: flex; gap: 1rem; align-items: center; }

.nav-btn {
    background: transparent;
    border: none;
    color: var(--cool-grey);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: sans-serif;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    position: relative;
    transition: color 0.3s;
}

.nav-btn::after {
    content: '';
    position: absolute;
    bottom: -5px; left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--primary-red);
    transition: width 0.3s var(--ease-out-expo);
}

.nav-btn.active { color: var(--text-white); }
.nav-btn.active::after { width: 100%; }
.nav-btn:hover { color: var(--text-white); }
.nav-btn:hover::after { width: 100%; }

.nav-logout { color: #888; margin-left: 2rem; border-left: 1px solid rgba(255,255,255,0.1); padding-left: 2rem; }
.nav-logout::after { display: none; }
.nav-logout:hover { color: var(--primary-red); }

/* ========== 布局容器 ========== */
.container { max-width: 1000px; margin: 0 auto; }
.mt-4 { margin-top: 2rem; }

/* ========== 仪表盘专属 ========== */
.welcome-banner p { color: var(--cool-grey); font-size: 1.1rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* 数字样式 */
.stat-item .value {
    font-size: 3.5rem;
    color: var(--gold);
    font-weight: 400;
    line-height: 1.2;
    font-variant-numeric: tabular-nums; /* 数字等宽对齐 */
}

.stat-item .warning-value { color: var(--primary-red); }

/* ========== 告警与消息框 (精细化) ========== */
.alerts { margin-bottom: 2rem; }

.alert-card {
    background: rgba(40, 40, 45, 0.4);
    border: 1px solid rgba(255,255,255,0.05);
    border-left: 4px solid var(--emporium-pink);
    padding: 1.2rem 1.5rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.alert-warning { border-left-color: #D4AF37; }
.alert-danger { border-left-color: var(--primary-red); background: rgba(218, 26, 50, 0.1); }
.alert-expired { border-left-color: #555; background: rgba(0,0,0,0.5); color: #999; }

/* ========== Directory Cards (Inventory) ========== */
.directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
}

.directory-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s var(--ease-out-expo);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.directory-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.4s;
}

.directory-card:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-8px) scale(1.02);
    border-color: var(--gold);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.directory-card:hover::before { opacity: 1; }

.directory-card .folder-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
    transition: transform 0.3s;
}

.directory-card:hover .folder-icon {
    transform: scale(1.1) rotate(-5deg);
}

.directory-card h4 {
    color: var(--gold);
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.directory-card .item-count {
    color: var(--cool-grey);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.back-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--cool-grey);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.back-btn:hover {
    color: var(--text-white);
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.05);
}

/* ========== 列表项增强 (Legacy Vertical Lists) ========== */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    transition: background 0.3s;
}

/* ========== Responsive Grid Layouts (Desserts) ========== */
.dessert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.dessert-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.2rem;
    transition: all 0.3s var(--ease-out-expo);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.dessert-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(212, 175, 55, 0.3);
    transform: translateY(-2px);
}

.dessert-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.8rem;
}

.dessert-card-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-white);
    line-height: 1.3;
}

.dessert-card-data {
    color: var(--cool-grey);
    font-size: 0.85rem;
    line-height: 1.5;
}

.dessert-card-action {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.list-item:hover { background: rgba(255,255,255,0.02); padding-left: 0.5rem; padding-right: 0.5rem; border-radius: 8px; border-bottom-color: transparent; }
.list-item:last-child { border-bottom: none; }

.list-item strong { font-size: 1.2rem; font-weight: 400; color: var(--text-white); }
.list-item small { display: block; margin-top: 0.4rem; font-family: sans-serif; font-size: 0.85rem; }

/* 状态标签 */
.status-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-family: sans-serif;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    backdrop-filter: blur(5px);
}
.tag-good { background: rgba(46, 204, 113, 0.15); color: #4ade80; border: 1px solid rgba(46, 204, 113, 0.3); }
.tag-warning { background: rgba(212, 175, 55, 0.15); color: #D4AF37; border: 1px solid rgba(212, 175, 55, 0.3); }
.tag-danger { background: rgba(218, 26, 50, 0.15); color: #ff6b81; border: 1px solid rgba(218, 26, 50, 0.3); }
.tag-expired { background: rgba(255, 255, 255, 0.05); color: #888; border: 1px solid rgba(255, 255, 255, 0.1); }

/* ========== 幽灵按钮 (删除等) ========== */
.btn-delete {
    background: transparent;
    color: var(--cool-grey);
    border: 1px solid var(--glass-border);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: sans-serif;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: rgba(218, 26, 50, 0.1);
    color: #ff6b81;
    border-color: rgba(218, 26, 50, 0.4);
}

/* ========== 自定义 Toast 通知 ========== */
#toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(20, 20, 22, 0.95);
    backdrop-filter: blur(10px);
    border-left: 4px solid var(--primary-red);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    font-family: sans-serif;
    font-size: 0.9rem;
    animation: toastIn 0.4s var(--ease-out-expo) forwards;
    transform-origin: right center;
}

.toast.toast-success { border-left-color: #4ade80; }

.toast.fade-out {
    animation: toastOut 0.4s var(--ease-in-out-circ) forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%) scale(0.9); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to { opacity: 0; transform: translateX(100%) scale(0.9); }
}

/* ========== 响应式微调 ========== */
/* ========== Advanced Inventory Styles ========== */
.inventory-item-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.2rem;
    transition: all 0.3s var(--ease-out-expo);
    display: flex;
    flex-direction: column;
}

.inventory-item-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(212, 175, 55, 0.3);
}

.inventory-item-card.expanded {
    grid-column: 1 / -1; /* Take full width when expanded */
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
    border-color: rgba(212, 175, 55, 0.2) !important;
}

.action-col label {
    display: block;
    color: var(--cool-grey);
    font-size: 0.7rem;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-list table th {
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.inventory-actions input {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-white);
    transition: border-color 0.3s;
}

.inventory-actions input:focus {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.05);
}

/* ========== Floating Device Switcher (Top-Right Corner) ========== */
.device-switcher-float {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 9999;
    display: flex;
    gap: 0.35rem;
    background: rgba(20, 20, 24, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.3rem 0.4rem;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 8px rgba(212, 175, 55, 0.08);
    transition: all 0.3s var(--ease-out-expo);
}

.device-switcher-float:hover {
    box-shadow: 0 6px 28px rgba(0,0,0,0.5), 0 0 12px rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.25);
}

.view-toggle-pill {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: 50px;
    transition: all 0.35s var(--ease-out-expo);
    line-height: 1;
    position: relative;
}

.view-toggle-pill .toggle-icon {
    font-size: 1.1rem;
    display: block;
    transition: transform 0.4s var(--ease-out-expo);
}

.view-toggle-pill:hover .toggle-icon {
    transform: scale(1.25) rotate(-8deg);
}

.view-toggle-pill.active {
    background: rgba(212, 175, 55, 0.2);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.15);
}

.view-toggle-pill.active .toggle-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 4px rgba(212, 175, 55, 0.4));
}

/* Compatibility: hide the old view-toggle if any remain */
.view-toggle { display: none; }

/* ========== Hide Manual Device Switcher — Now Auto-Responsive ========== */
.device-switcher-float { display: none !important; }

/* ========== Ripple Effect (Material Design Touch Feedback) ========== */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.35) 0%, transparent 70%);
    transform: scale(0);
    animation: rippleAnim 0.6s ease-out forwards;
    pointer-events: none;
    z-index: 10;
}

@keyframes rippleAnim {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(4); opacity: 0; }
}

/* ========== Universal Touch Feedback ========== */
.btn-primary, .btn-qty, .btn-delete, .nav-btn,
.dessert-tile, .dessert-card, .directory-card,
.inventory-item-card, .alert-card, .back-btn {
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-primary:active, .btn-qty:active, .btn-delete:active {
    transform: scale(0.95) !important;
    transition-duration: 0.08s !important;
}

.nav-btn:active {
    transform: scale(0.92) !important;
    transition-duration: 0.08s !important;
}

.directory-card:active {
    transform: scale(0.96) !important;
    transition-duration: 0.1s !important;
}

/* ========== Smooth Nav Indicator ========== */
#nav-indicator {
    position: absolute;
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-red), var(--gold));
    border-radius: 3px 3px 0 0;
    transition: left 0.35s var(--ease-out-expo), width 0.35s var(--ease-out-expo);
    pointer-events: none;
    box-shadow: 0 0 10px rgba(218, 26, 50, 0.4);
}

/* ========== Pull-to-Refresh Indicator ========== */
#pull-to-refresh-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gold), var(--primary-red), var(--gold));
    background-size: 200% 100%;
    animation: shimmerBar 1.5s infinite linear;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

#pull-to-refresh-indicator.active {
    opacity: 1;
}

@keyframes shimmerBar {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========== Status Tag Pulse Animation ========== */
.tag-danger {
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(218, 26, 50, 0); }
    50% { box-shadow: 0 0 8px 2px rgba(218, 26, 50, 0.25); }
}

/* ========== Smooth Panel Transitions ========== */
.panel {
    transition: opacity 0.4s var(--ease-out-expo), transform 0.4s var(--ease-out-expo);
}

.panel.active {
    animation: panelEnter 0.5s var(--ease-out-expo) forwards;
}

@keyframes panelEnter {
    0% { opacity: 0; transform: translateY(20px) scale(0.99); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ========== Stat Value Counter Glow ========== */
.stat-item .value {
    transition: color 0.3s, text-shadow 0.3s;
}

.stat-item:hover .value {
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

/* ========== Glass Card Subtle Shine on Touch ========== */
.glass-card {
    transition: transform 0.4s var(--ease-out-expo), box-shadow 0.4s var(--ease-out-expo), border-color 0.4s;
}

@media (hover: none) {
    /* Disable hover on touch devices to prevent sticky states */
    .glass-card:hover { transform: none; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
    .dessert-tile:hover { transform: none; }
    .directory-card:hover { transform: none; }
}

/* ========== Scroll Snap for Horizontal Nav ========== */
@media (max-width: 768px) {
    nav {
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    nav .nav-btn {
        scroll-snap-align: start;
    }
}


/* ========== 响应式布局 — iPhone Pro 手机 (≤480px) ========== */
/* Balanced: readable fonts + high density */
@media (max-width: 480px) {
    /* 导航栏 */
    #main-header { padding: 0.5rem 0.7rem; flex-direction: column; gap: 0.4rem; }
    .mini-logo { width: 40px; }
    nav { width: 100%; gap: 0.2rem; overflow-x: auto; padding-bottom: 0.2rem; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .nav-btn { font-size: 0.7rem; padding: 0.3rem 0.5rem; letter-spacing: 0.3px; white-space: nowrap; }
    .nav-logout { margin-left: 0; padding-left: 0.5rem; border: none; }

    /* 排版 */
    h1 { font-size: 1.2rem; line-height: 1.3; }
    h2 { font-size: 1rem; margin-bottom: 0.6rem; line-height: 1.3; }
    h3 { font-size: 0.72rem; letter-spacing: 0.5px; margin-bottom: 0.5rem; }
    .welcome-banner p { font-size: 0.82rem; }

    /* 面板 */
    .panel { padding: 0.6rem 0.5rem; }

    /* 玻璃卡片 */
    .glass-card { padding: 0.7rem; border-radius: 10px; }
    .glass-card:hover { transform: none; }

    /* 统计 */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 0.7rem; }
    .stat-item .value { font-size: 1.4rem; }

    /* ★ 动态网格列数 ★ */
    /* 恢复3列，深度优化卡片内部空间 */
    .dessert-grid { grid-template-columns: repeat(3, 1fr); gap: 0.35rem; }

    /* 甜品 Tile 按钮 */
    .dessert-tile { padding: 0.5rem 0.4rem; border-radius: 8px; }
    .dessert-tile .tile-name { font-size: 0.72rem; line-height: 1.3; }
    .dessert-tile .tile-hint { font-size: 0.58rem; margin-top: 0.15rem; }

    /* 甜品卡片（日志列表 - 适应超窄的三列） */
    .dessert-card { padding: 0.45rem; border-radius: 6px; }
    .dessert-card-header { flex-direction: column; align-items: flex-start; gap: 0.25rem; margin-bottom: 0.3rem; }
    .dessert-card-header > div { justify-content: flex-start; }
    .dessert-card-title { font-size: 0.72rem; margin-bottom: 0; }
    .dessert-card-data { font-size: 0.65rem; line-height: 1.3; }
    /* 调整状态标签大小以防溢出 */
    .status-tag { padding: 1px 4px; font-size: 0.5rem; border-radius: 4px; }

    /* 目录文件夹 — 每行2个 */
    .directory-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .directory-card { padding: 0.8rem 0.6rem; min-height: 85px; border-radius: 10px; }
    .directory-card .folder-icon { font-size: 1.4rem; margin-bottom: 0.3rem; }
    .directory-card h4 { font-size: 0.82rem; margin-bottom: 0.2rem; }
    .directory-card .item-count { font-size: 0.68rem; }

    /* 告警 */
    .alert-card { padding: 0.4rem 0.6rem; font-size: 0.72rem; gap: 0.4rem; margin-bottom: 0.5rem; border-radius: 6px; }

    /* 标签 */
    .status-tag { padding: 2px 6px; font-size: 0.55rem; border-radius: 20px; }

    /* 表单 */
    input, select { padding: 7px 9px; font-size: 0.82rem; border-radius: 6px; }
    select { padding: 6px 9px; font-size: 0.78rem; }
    label { font-size: 0.68rem; margin-bottom: 0.25rem; letter-spacing: 0.3px; }
    .input-group { margin-bottom: 0.6rem; }
    .btn-primary { padding: 8px; font-size: 0.78rem; letter-spacing: 0.3px; margin-top: 0.4rem; border-radius: 6px; }
    .btn-delete { padding: 4px 8px; font-size: 0.65rem; border-radius: 4px; }

    /* 库存卡片 */
    .inventory-item-card { padding: 0.6rem; border-radius: 8px; margin-bottom: 0.4rem; }
    .inventory-actions { grid-template-columns: 1fr !important; gap: 0.4rem; margin-top: 0.4rem; }
    .inventory-item-card.expanded { padding: 0.6rem; }
    .action-col { margin-bottom: 0.2rem; }
    .action-col label { font-size: 0.65rem; }
    .inventory-actions input { padding: 5px 7px; font-size: 0.78rem; }
    .inventory-section-header { margin: 1rem 0 0.5rem 0; font-size: 0.75rem; }

    /* 弹窗 */
    .modal-card { width: 94vw !important; padding: 1rem !important; border-radius: 12px; }
    .modal-icon { font-size: 1.4rem; margin-bottom: 0.3rem; }
    .modal-title { font-size: 0.92rem; margin-bottom: 0.5rem; }
    .modal-field label { font-size: 0.65rem; margin-bottom: 4px; }
    .modal-field input { padding: 6px 9px; font-size: 0.82rem; border-radius: 6px; }
    .modal-submit { padding: 8px; font-size: 0.82rem; margin-top: 0.7rem; border-radius: 8px; }
    .quick-qty-grid { gap: 0.25rem; margin-bottom: 0.4rem; }
    .btn-qty { padding: 6px; font-size: 0.78rem; border-radius: 6px; }
    .modal-close { top: 8px; right: 10px; width: 28px; height: 28px; font-size: 1.2rem; }

    /* Toast */
    #toast-container { bottom: 10px; right: 10px; left: 10px; }
    .toast { padding: 0.5rem 0.7rem; font-size: 0.72rem; border-radius: 8px; }

    /* 容器 */
    .container { max-width: 100%; padding: 0; }
    .mt-4 { margin-top: 0.6rem; }

    /* 杂项列表 */
    .list-item { padding: 0.5rem 0; }
    .list-item strong { font-size: 0.82rem; }
    .list-item small { font-size: 0.68rem; }
    .back-btn { font-size: 0.72rem; padding: 0.3rem 0.6rem; margin-bottom: 0.6rem; border-radius: 6px; }

    /* 登录 */
    .login-card { max-width: 85vw; padding: 1.2rem; }
    .logo { width: 70px; margin-bottom: 0.6rem; }
    h1 { font-size: 1.15rem; }
    .login-subtitle { font-size: 0.65rem; margin-bottom: 0.8rem; }
    .login-hint { font-size: 0.55rem; }

    /* Linkage */
    #linkage-form { grid-template-columns: 1fr !important; gap: 0.4rem; }
    .linkage-item { padding: 0.6rem 0.7rem; font-size: 0.75rem; border-radius: 6px; margin-bottom: 0.3rem; }
    .linkage-info { gap: 0.5rem; }
    .linkage-arrow { font-size: 0.9rem; }

    /* 浮动切换器在手机上稍微缩小 */
    .device-switcher-float { top: 8px; right: 8px; padding: 0.2rem 0.3rem; gap: 0.2rem; }
    .view-toggle-pill .toggle-icon { font-size: 0.9rem; }
}

/* ========== 响应式布局 — 平板 (481px ~ 1024px) ========== */
@media (min-width: 481px) and (max-width: 1024px) {
    /* 导航栏 */
    #main-header { padding: 0.8rem 1.5rem; }
    .mini-logo { width: 50px; }
    nav { gap: 0.5rem; flex-wrap: wrap; }
    .nav-btn { font-size: 0.78rem; padding: 0.4rem 0.7rem; }
    .nav-logout { margin-left: 1rem; padding-left: 1rem; }
    .nav-logout { margin-left: 1rem; padding-left: 1rem; }

    /* 排版 */
    h1 { font-size: 1.7rem; }
    h2 { font-size: 1.4rem; margin-bottom: 1.5rem; }
    h3 { font-size: 0.78rem; }
    .welcome-banner p { font-size: 0.95rem; }

    /* 面板 */
    .panel { padding: 2rem 1.2rem; }

    /* 卡片 */
    .glass-card { padding: 1.8rem; }

    /* 统计 */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-bottom: 2rem; }
    .stat-item .value { font-size: 2.5rem; }

    /* 甜品网格 */
    .dessert-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.8rem; }
    .dessert-card-title { font-size: 0.95rem; }
    .dessert-card-data { font-size: 0.8rem; }

    /* 目录文件夹 */
    .directory-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.2rem; }
    .directory-card { padding: 2rem 1.5rem; min-height: 160px; }
    .directory-card .folder-icon { font-size: 2.8rem; margin-bottom: 1rem; }
    .directory-card h4 { font-size: 1.1rem; }

    /* 告警 */
    .alert-card { padding: 0.9rem 1.2rem; font-size: 0.9rem; }

    /* 标签 */
    .status-tag { padding: 4px 10px; font-size: 0.68rem; }

    /* 表单 */
    input, select { padding: 12px 15px; font-size: 0.95rem; }
    .btn-primary { padding: 13px; font-size: 0.85rem; }

    /* 库存 */
    .inventory-actions { grid-template-columns: 1fr 1.5fr auto !important; }

    /* 弹窗 */
    .modal-card { width: 85vw; max-width: 400px; padding: 2rem; }

    /* 容器 */
    .container { max-width: 800px; }
}

/* ========== Clickable Dessert Tiles ========== */
.dessert-tile {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 1.2rem 1rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.35s var(--ease-out-expo);
    position: relative;
    overflow: hidden;
}

.dessert-tile::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 120%, rgba(212, 175, 55, 0.08), transparent 60%);
    opacity: 0;
    transition: opacity 0.4s;
}

.dessert-tile:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(212, 175, 55, 0.4);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3), 0 0 15px rgba(212, 175, 55, 0.08);
}

.dessert-tile:hover::before {
    opacity: 1;
}

.dessert-tile:active {
    transform: scale(0.97);
    transition-duration: 0.1s;
}

.dessert-tile .tile-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-white);
    position: relative;
    z-index: 1;
}

.dessert-tile .tile-hint {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.3);
    margin-top: 0.4rem;
    position: relative;
    z-index: 1;
    transition: color 0.3s;
}

.dessert-tile:hover .tile-hint {
    color: var(--gold);
}

/* ========== Modal Overlay & Card ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s var(--ease-out-expo), visibility 0s 0.35s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s var(--ease-out-expo), visibility 0s 0s;
}

.modal-card {
    width: 380px;
    max-width: 90vw;
    background: rgba(25, 25, 28, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(212, 175, 55, 0.05);
    position: relative;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.4s var(--ease-out-expo);
}

.modal-overlay.active .modal-card {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.6rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.25s;
}

.modal-close:hover {
    background: rgba(218, 26, 50, 0.15);
    color: var(--primary-red);
}

.modal-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
    animation: bounceIn 0.5s var(--ease-out-expo);
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.modal-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 1.5rem;
    letter-spacing: 0.5px;
}

.modal-fields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quick-qty-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.btn-qty {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-white);
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-qty:hover {
    background: var(--gold);
    color: var(--dark-bg);
    border-color: var(--gold);
    transform: translateY(-2px);
}

.btn-qty.active {
    background: var(--gold);
    color: var(--dark-bg);
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.btn-folder-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(218, 26, 50, 0.1);
    color: #ff6b81;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 5;
}

.directory-card:hover .btn-folder-delete {
    opacity: 1;
}

.btn-folder-delete:hover {
    background: var(--primary-red);
    color: white;
    transform: scale(1.1);
}

.directory-card.add-dir-card {
    border: 2px dashed rgba(255, 255, 255, 0.1);
    background: transparent;
}
/* ========== Linkage UI ========== */
.linkage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.linkage-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.linkage-arrow {
    color: var(--gold);
    font-size: 1.2rem;
}

.tag-insert {
    background: rgba(227, 163, 163, 0.1);
    color: var(--emporium-pink);
    border: 1px solid rgba(227, 163, 163, 0.3);
}

.tag-dessert {
    background: rgba(212, 175, 55, 0.1);
    color: var(--gold);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.inventory-section-header {
    margin: 2rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.insert-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--emporium-pink);
    border-radius: 50%;
    margin-right: 8px;
}

.directory-card.add-dir-card:hover {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.05);
}

.directory-card.add-dir-card .folder-icon {
    color: rgba(255, 255, 255, 0.2);
}

.modal-field label {
    display: block;
    font-size: 0.78rem;
    color: var(--cool-grey);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.modal-field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.4);
    color: white;
    font-size: 1.05rem;
    text-align: center;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: 'Outfit', sans-serif;
}

.modal-field input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.modal-field input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.modal-submit {
    width: 100%;
    margin-top: 1.5rem;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    letter-spacing: 0.5px;
    transition: all 0.3s var(--ease-out-expo);
}

.modal-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(218, 26, 50, 0.3);
}

.modal-submit:active {
    transform: scale(0.98);
}

/* Success flash animation on tile after saving */
@keyframes tileSaved {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0.1); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.dessert-tile.just-saved {
    border-color: #4ade80 !important;
    animation: tileSaved 0.8s ease-out;
}

/* ========== Easter Special Styles (Macaron Palette) ========== */
.easter-style-1 { border-color: rgba(187, 134, 252, 0.6) !important; box-shadow: 0 0 15px rgba(187, 134, 252, 0.15); }
.easter-style-2 { border-color: rgba(3, 218, 198, 0.6) !important; box-shadow: 0 0 15px rgba(3, 218, 198, 0.15); }
.easter-style-3 { border-color: rgba(255, 117, 140, 0.6) !important; box-shadow: 0 0 15px rgba(255, 117, 140, 0.15); }
.easter-style-4 { border-color: rgba(212, 175, 55, 0.6) !important; box-shadow: 0 0 15px rgba(212, 175, 55, 0.15); }
.easter-style-1:hover, .easter-style-2:hover, .easter-style-3:hover, .easter-style-4:hover { transform: translateY(-5px) scale(1.03) !important; }

