/* ============================================================
   EzTakeoff - Modern Professional Design System
   ============================================================ */

:root {
    /* 🎨 Color Scheme - Modern Engineering */
    --primary: #2563eb;       /* Royal Blue */
    --primary-hover: #1d4ed8;
    --bg-body: #f3f4f6;       /* Cool Gray 100 */
    --bg-surface: #ffffff;    /* White */
    --text-main: #111827;     /* Gray 900 */
    --text-muted: #6b7280;    /* Gray 500 */
    --border: #e5e7eb;        /* Gray 200 */
    --danger: #ef4444;        /* Red 500 */
    --success: #10b981;       /* Emerald 500 */
    
    /* 🎨 Extended Color Palette (保持向后兼容) */
    --bg-app: #f3f4f6;
    --bg-panel: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-active: #eff6ff;
    --border-subtle: #e5e7eb;
    --border-medium: #cbd5e1;
    --border-active: #bfdbfe;
    --text-light: #94a3b8;
    --primary-light: #3b82f6;
    --warning: #f59e0b;
    
    /* 📐 Dimensions */
    --header-height: 60px;
    --sidebar-width: 320px;
    
    /* 💧 Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-float: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-panel: -4px 0 20px rgba(0, 0, 0, 0.02);
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    --mobile-vw: 100vw;
    --mobile-vh: 100dvh;
}

/* ============================================================
   基础重置与全局样式
   ============================================================ */

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

/* 🔧 全局容器：Flexbox 垂直布局 (修复 iPad 遮挡问题) */
html, body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100dvh; /* 适配 Safari 动态视口高度 */
    overflow: hidden; /* 禁止全局滚动 */
    position: fixed; /* 防止移动端橡皮筋效果 */
    
    /* 关键改动：启用垂直 Flex 布局 */
    display: flex;
    flex-direction: column; /* 从上到下排列：工具栏 -> 内容区 */
}

html.phone-layout-viewport,
body.phone-layout-viewport {
    width: var(--mobile-vw) !important;
    height: var(--mobile-vh) !important;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-body);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar Styling for a clean look */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================================
   顶部工具栏 (Toolbar) - 现代化设计
   ============================================================ */

/* 🌟 Navbar Styles */
.app-header {
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
    flex-shrink: 0;
    gap: 16px;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.header-left {
    flex: 1 1 auto;
}

.header-right {
    justify-content: flex-end;
    flex: 0 0 auto;
}

.header-center {
    display: flex;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 0;
}

.app-mode-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    flex-wrap: nowrap;
}

.canvas-toolbar-shell {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
    z-index: 30;
    flex: 0 0 auto;
}

.canvas-toolbar-shell .app-mode-toolbar {
    flex: 1 1 auto;
}

.toolbar-toggle {
    height: 34px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

.toolbar-toggle i {
    font-size: 15px;
}

.canvas-toolbar-shell.is-collapsed {
    position: absolute;
    top: 10px;
    left: 54px; /* 10px (left inset) + 36px (#btn-sidebar-toggle) + 8px gap */
    z-index: 40;
    padding: 0;
    border-bottom: none;
    background: transparent;
}

.canvas-toolbar-shell.is-collapsed .app-mode-toolbar {
    display: none;
}

.canvas-toolbar-shell.is-collapsed .toolbar-toggle {
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.header-scale-display {
    min-width: 96px;
    padding: 7px 10px;
    border-radius: 8px;
    background: #eef2f7;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn-icon {
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    flex-shrink: 0;
}

.mode-btn-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

#mode-calibrate .mode-btn-icon svg,
#mode-length .mode-btn-icon svg,
#mode-area .mode-btn-icon svg {
    width: 22px;
    height: 22px;
}

.mode-btn.active .mode-btn-icon {
    color: #1d4ed8;
}

#mode-calibrate.mode-btn .mode-btn-icon,
#mode-calibrate.mode-btn.active .mode-btn-icon {
    color: #8b5cf6;
}

#mode-area.mode-btn .mode-btn-icon,
#mode-area.mode-btn.active .mode-btn-icon {
    color: #f97316;
}

#mode-length.mode-btn .mode-btn-icon,
#mode-length.mode-btn.active .mode-btn-icon {
    color: #eab308;
}

.mode-count-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: currentColor;
    color: #64748b;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.mode-btn.active .mode-count-dot {
    color: #1d4ed8;
}

.mode-btn:hover {
    background: #e2e8f0;
    color: #334155;
}

.mode-btn.active {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

@media (max-width: 1100px) {
    .app-mode-toolbar {
        gap: 4px;
        padding: 4px;
    }

    .header-scale-display {
        min-width: 84px;
        padding: 6px 8px;
        font-size: 11px;
    }

    .mode-btn {
        padding: 6px 8px;
        font-size: 11px;
    }

    .mode-btn-icon {
        min-width: 16px;
        height: 16px;
    }

    .mode-btn-icon svg {
        width: 16px;
        height: 16px;
    }

    #mode-calibrate .mode-btn-icon svg,
    #mode-length .mode-btn-icon svg,
    #mode-area .mode-btn-icon svg {
        width: 20px;
        height: 20px;
    }

    .mode-count-dot {
        width: 12px;
        height: 12px;
    }
}

/* 品牌 Logo */
/* 🌟 高级 Logo 样式 */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800; /* 字体加粗，更有力量感 */
    font-size: 17px;
    color: var(--text-main); /* 文字用深色，显得稳重 */
    letter-spacing: -0.5px;
}

.logo-icon {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--primary), #0ea5e9); /* 皇家蓝到天蓝的微渐变 */
    color: white;
    border-radius: 8px; /* 苹果风格的圆角 */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.3); /* 蓝色光晕阴影 */
}

.logo-icon i {
    font-size: 18px; /* 图标稍小于底座 */
}

/* 🌟 双色文字 Logo */
.brand-text {
    font-size: 18px;
    letter-spacing: -0.5px;
    display: flex;
    align-items: baseline;
}

.brand-ez {
    color: var(--primary); /* 品牌蓝 */
    font-weight: 800; /* 极粗，强调"简单" */
}

.brand-takeoff {
    color: #f59e0b; /* 活力工程橙 */
    font-weight: 600;
}

/* 项目名称 */
.project-info {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
}
.project-name {
    display: block;
    min-width: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 项目编辑按钮 - 确保显示 */
#btn-edit-project-name {
    flex-shrink: 0;
}

#btn-edit-project-name.hidden {
    display: none !important;
}

/* 分割线 */
.divider {
    width: 1px;
    height: 16px;
    background: var(--border);
    margin: 0 4px;
}
.divider-vertical {
    width: 1px;
    height: 24px;
    background: var(--border);
}

/* 居中工具栏组 */
.tool-group {
    background: var(--bg-body);
    padding: 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border);
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}
.tool-btn i { font-size: 16px; }
.tool-btn:hover { background: rgba(0,0,0,0.05); color: var(--text-main); }
.tool-btn.active {
    background: var(--bg-surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* 图标按钮 */
.btn-icon-small {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.btn-icon-small i {
    font-size: 16px;
}
.btn-icon-small:hover { 
    background: var(--bg-body); 
    color: var(--text-main); 
}

.user-greeting { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.header-right .btn-ghost { padding: 6px 10px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.header-right .btn-ghost i { font-size: 16px; }

/* 修复导航栏按钮图标重复显示问题 */
.app-header button i::before,
.app-header button i::after {
    content: none !important;
}

/* ============================================================
   旧导航栏样式 (保持向后兼容) - 已废弃
   ============================================================ */

.action-icon {
    cursor: pointer;
    color: #9ca3af;
    font-size: 14px;
    transition: color 0.2s;
}

.action-icon:hover {
    color: #2563eb;
}

/* 用户问候语样式 */
.user-greeting {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    margin-right: 8px;
    white-space: nowrap;
}

#nav-user-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 顶部保存状态指示器（小号版本） */
#save-status-top {
    font-size: 11px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: #f9fafb;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    transition: all 0.3s;
    font-weight: 500;
    white-space: nowrap;
}

#save-status-top i {
    font-size: 10px;
}

#save-status-top.saving {
    color: #f59e0b;
    background: #fffbeb;
    border-color: #fcd34d;
}

#save-status-top.saving i {
    animation: spin 1s linear infinite;
}

#save-status-top.saved {
    color: #10b981;
    background: #ecfdf5;
    border-color: #6ee7b7;
}

#save-status-top.error {
    color: #ef4444;
    background: #fef2f2;
    border-color: #fca5a5;
}

/* 导航栏按钮样式 */
.nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    border-radius: 6px;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.nav-btn:active {
    transform: scale(0.97);
}

.nav-btn.primary {
    background: #2563eb;
    color: #ffffff;
    border-color: transparent;
}

.nav-btn.primary:hover {
    background: #1d4ed8;
}

.nav-btn i {
    font-size: 14px;
}

.nav-btn .icon-svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

/* 激活状态（用于工具按钮） */
.nav-btn.active {
    background: #1e293b;
    color: #ffffff;
    border-color: transparent;
}

.nav-btn.active:hover {
    background: #0f172a;
}

/* ═══════════════════════════════════════════════════════════
   实时保存状态指示器 (Real-time Auto-save Indicator)
   位置：右侧列表底部
   ═══════════════════════════════════════════════════════════ */
.save-status {
    font-size: 11px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
    opacity: 0.8;
    text-align: center;
}

.save-status i {
    font-size: 10px;
}

/* 保存中状态 - 橙色 + 旋转动画 */
.save-status.saving {
    color: #f59e0b;
    opacity: 1;
}

.save-status.saving i {
    animation: spin 1s linear infinite;
}

/* 保存完成状态 - 绿色 */
.save-status.saved {
    color: #10b981;
    opacity: 1;
}

/* 保存失败状态 - 红色 */
.save-status.error {
    color: #ef4444;
    opacity: 1;
}

/* 旋转动画（用于保存中的图标） */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.logo img {
    height: 24px;
    width: auto;
}

#info-name {
    font-weight: 400;
    font-size: 14px;
    color: var(--text-muted);
    margin-left: 10px;
}

.tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* 工具栏分隔线 */
.tools > div[style*="width:1px"] {
    width: 1px !important;
    height: 24px !important;
    background: var(--border-subtle) !important;
    margin: 0 8px !important;
}

/* ============================================================
   按钮系统 (Button System)
   ============================================================ */

button {
    height: 36px;
    padding: 0 16px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid transparent;
    outline: none;
    white-space: nowrap;
}

button:active {
    transform: scale(0.98);
}

/* 图标按钮专用 */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--text-muted);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.btn-icon i {
    font-size: 20px;
}

/* 主要按钮 */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 13px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

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

/* 次要/幽灵按钮 */
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 13px;
}

.btn-ghost:hover {
    background: var(--bg-body);
    color: var(--text-main);
}

input, select {
    font-family: inherit;
    color: var(--text-main);
}

/* 激活状态 (Active Tool) */
.btn-dark,
.btn-active,
button.active {
    background: var(--bg-active);
    color: var(--primary);
    border-color: var(--border-active);
}

/* 危险按钮 */
.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #dc2626;
}

/* ============================================================
   布局容器
   ============================================================ */

/* 🔧 主体区域自适应：包裹 Canvas 和 Sidebar 的容器 */
#workspace {
    flex: 1; /* 关键：自动霸占剩余的所有空间 */
    height: 0; /* 关键技巧：配合 flex:1 触发内部滚动 */
    display: flex; /* 左右布局：canvas-wrapper + sidebar */
    width: 100%;
    position: relative;
    overflow: hidden;
    /* 已移除 margin-top，因为 Flexbox 布局会自动处理间距 */
}

#canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg-app);
}

#c {
    display: block;
}

/* ===== 🎯 动态光标控制系统 (CSS 增强版) ===== */
/* 只在画线模式下强制十字准星，编辑模式保持默认 */

/* 画线模式：强制十字准星（PC 端） */
@media (hover: hover) and (pointer: fine) {
    .canvas-container.drawing-mode,
    .canvas-container.drawing-mode canvas,
    .canvas-container.drawing-mode .upper-canvas,
    .canvas-container.drawing-mode .lower-canvas {
        cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cg fill='none' stroke-linecap='square'%3E%3Cpath d='M24 2v44M2 24h44' stroke='white' stroke-width='3'/%3E%3Cpath d='M24 2v44M2 24h44' stroke='%23000' stroke-width='1.4'/%3E%3Ccircle cx='24' cy='24' r='2.4' fill='%23000'/%3E%3C/g%3E%3C/svg%3E") 24 24, crosshair !important;
    }
}

/* 编辑模式：允许正常的光标切换 */
/* 不添加任何 CSS，让 Fabric.js 的 hoverCursor 生效 */

/* ============================================================
   侧边栏 (Sidebar)
   ============================================================ */

/* 🔧 侧边栏：内部滚动修复 */
#sidebar {
    width: var(--sidebar-width);
    background: var(--bg-panel);
    border-left: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-panel);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden; /* 外层禁止滚动 */
    padding-bottom: env(safe-area-inset-bottom); /* 避开底部安全区域 */
}

.sidebar-header {
    height: 56px;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.sidebar-header > span {
    font-size: 14px !important;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-main);
}

#length-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 8px;
}

#length-list::-webkit-scrollbar {
    width: 8px;
}

#length-list::-webkit-scrollbar-track {
    background: transparent;
}

#length-list::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-full);
}

#length-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================================
   分组系统 (Groups) - Groundplan Style
   ============================================================ */

/* 分组标题栏 */
.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    margin: 6px 0 4px 0;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-left: 3px solid #e5e7eb;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.group-header:hover {
    background: #f3f4f6;
    border-left-color: #cbd5e1;
}

/* 激活状态 (Pre-selection 预选模式) */
.group-header.active {
    background: #eff6ff; /* 浅蓝背景 */
    border-color: #3b82f6; /* 蓝色边框 */
    border-left: 4px solid #2563eb; /* 加粗左边框 */
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.1);
}

.group-header.active:hover {
    background: #dbeafe;
}

/* 组名与图标 */
.group-title-section {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.group-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
    flex-shrink: 0;
}

.group-header.active .group-title {
    color: var(--primary);
}

/* 组内统计信息 */
.group-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.group-stats {
    font-weight: 600;
    color: var(--text-main);
}

.group-header.active .group-stats {
    color: var(--primary);
}

/* 组内项目列表容器 */
.group-items {
    padding-left: 16px; /* 缩进 */
    border-left: 2px solid #f3f4f6; /* 连接线效果 */
    margin-left: 14px;
    margin-bottom: 6px;
    padding-bottom: 4px;
}

/* 折叠指示器 */
.group-toggle-icon {
    font-size: 14px;
    color: var(--text-light);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.group-toggle-icon.expanded {
    transform: rotate(90deg);
}

/* 颜色标识点 */
.color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* ============================================================
   Measurement 行样式 (三层架构)
   ============================================================ */

/* ═══════════════════════════════════════════════════════════
   Measurement Row - 优化版本：Flex 布局 + 悬停按钮
   ═══════════════════════════════════════════════════════════ */

.measurement-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    gap: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.measurement-row:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateX(2px);
}

.measurement-row.active {
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.15);
}

/* 左侧部分：图标 + 名称 */
.measurement-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;           /* 关键：占据所有剩余空间 */
    min-width: 0;      /* 关键：允许子元素收缩，防止溢出 */
    overflow: hidden;  /* 防止内容溢出 */
}

/* 名称文本：截断处理 */
.measurement-name {
    font-weight: 500;
    color: #374151;
    font-size: 13px;
    white-space: nowrap;      /* 不换行 */
    overflow: hidden;         /* 超出隐藏 */
    text-overflow: ellipsis;  /* 显示省略号 */
    cursor: pointer;
    flex: 1;                  /* 占据剩余空间 */
    min-width: 0;             /* 允许收缩 */
}

.measurement-row.active .measurement-name {
    font-weight: 600;
    color: #2563eb;
}

/* 右侧部分：按钮 + 数值 */
.measurement-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;    /* 防止右侧被挤压 */
}

/* 数值样式 */
.measurement-val {
    font-weight: 700;
    color: #374151;
    font-size: 14px;
    min-width: 50px;
    text-align: right;
    flex-shrink: 0;    /* 数值永远完整显示 */
}

.measurement-row.active .measurement-val {
    color: #2563eb;
}

/* 按钮组：默认隐藏，悬停显示 */
.measurement-actions {
    display: flex;
    gap: 2px;
    opacity: 0;              /* 默认不可见 */
    width: 0;                /* 默认不占空间 */
    overflow: hidden;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* 🎯 关键：只有悬停在行上时，才显示按钮 */
.measurement-row:hover .measurement-actions {
    opacity: 1;
    width: auto;             /* 恢复宽度 */
    overflow: visible;
}

/* 按钮样式：纯图标风格 */
.measurement-row .action-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    color: #9ca3af;
    background: transparent;
    border: none;
    padding: 0;
    transition: all 0.15s;
    flex-shrink: 0;
}

.measurement-row .action-btn:hover {
    background: #f3f4f6;
    color: #4b5563;
}

.measurement-row .action-btn.delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* 向后兼容：保留旧的 category-header 样式 */
.category-header {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin: 4px 0;
    transition: all 0.1s;
    border: 1px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.category-header:hover {
    background: var(--bg-hover);
}

.category-header.active {
    background: var(--bg-active);
    border-color: var(--border-active);
}

/* 测量项目 */
.length-item {
    padding: 8px 16px 8px 32px;
    margin: 2px 0;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.1s;
}

.length-item:hover {
    background: var(--bg-hover);
}

/* 🔗 列表项高亮样式 (Active List Item - Canvas Sync) */
.active-list-item {
    background-color: #e0f2fe !important; /* 淡蓝色背景 */
    border-left: 4px solid #00bfff; /* 左侧蓝条指示 */
    padding-left: 28px !important; /* 补偿左边框占用的 4px */
    animation: pulse-highlight 0.6s ease-in-out;
}

@keyframes pulse-highlight {
    0%, 100% { 
        background-color: #e0f2fe; 
    }
    50% { 
        background-color: #bae6fd; /* 中间帧更亮一点 */
    }
}

/* ============================================================
   模态窗口 (Modals)
   ============================================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-panel);
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-float);
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-full);
}

.new-project-modal-content {
    max-width: 1180px;
    width: min(96vw, 1180px);
    max-height: 92vh;
    padding: 24px;
}

#new-project-page-picker-state {
    display: flex;
    flex-direction: column;
    min-height: 68vh;
}

.page-picker-header {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 14px;
}

.page-picker-file-name {
    margin-top: 4px;
    font-size: 18px;
    font-weight: 700;
    color: #374151;
    word-break: break-word;
}

.page-picker-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: 12px 0;
}

.btn-page-picker-tool {
    min-width: 62px;
    padding: 6px 10px;
}

.page-picker-grid-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    padding: 14px;
}

.page-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.page-picker-card {
    position: relative;
    border: 3px solid #93c5fd;
    border-radius: 10px;
    background: #fff;
    padding: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    cursor: pointer;
}

.page-picker-card:hover {
    border-color: #60a5fa;
    box-shadow: 0 3px 12px rgba(37, 99, 235, 0.14);
    transform: translateY(-1px);
}

.page-picker-card.unselected {
    border-color: #d1d5db;
    opacity: 0.72;
}

.page-picker-thumb-wrap {
    width: 100%;
    min-height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 8px;
    overflow: hidden;
}

.page-picker-thumb-wrap canvas {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 230px;
}

.page-picker-caption {
    margin-top: 8px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #374151;
}

.page-picker-footer {
    border-top: 1px solid #e5e7eb;
    margin-top: 12px;
    padding-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.page-picker-count {
    font-size: 20px;
    font-weight: 700;
    color: #374151;
}

.page-picker-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 900px) {
    .new-project-modal-content {
        width: 96vw;
        max-height: 95vh;
        padding: 16px;
    }

    .page-picker-grid {
        grid-template-columns: 1fr;
    }

    .page-picker-count {
        font-size: 16px;
    }
}

/* 登录/注册模态框 */
#modal-auth .modal-content {
    max-width: 420px;
}

#modal-auth .logo {
    font-size: 24px;
    margin-bottom: 24px;
    justify-content: center;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* 表单输入 */
label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: var(--bg-panel);
    color: var(--text-main);
}

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

input::placeholder {
    color: var(--text-light);
}

/* ============================================================
   浮动元素
   ============================================================ */

/* 页码控制 */
#canvas-wrapper > div[style*="position: absolute; bottom:"] {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-panel);
    padding: 8px 15px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-float);
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--border-subtle);
}

#page-indicator {
    font-weight: 600;
    font-size: 14px;
    min-width: 60px;
    text-align: center;
    color: var(--text-main);
}

/* 浮动操作菜单 */
#floating-action-menu {
    position: absolute;
    display: none;
}

#floating-action-menu button {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-float);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--danger);
    font-size: 20px;
    font-weight: 700;
}

#floating-action-menu button:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.1);
}

/* 状态提示 */
#status-hint {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
}

/* 活跃锚点 */
.active-anchor {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #10b981, 0 2px 6px rgba(16, 185, 129, 0.3);
    pointer-events: none;
    z-index: 50;
}

/* 内联 SVG 图标样式 - 现代工程 SaaS 风格 */
.icon-svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1.5px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

/* 按钮内的图标 - 增加呼吸感 */
button .icon-svg {
    margin-right: 8px;
}

/* 纯图标按钮 */
.btn-icon .icon-svg {
    margin-right: 0;
    width: 24px;
    height: 24px;
}

/* 模态框标题中的图标 */
.modal-title .icon-svg {
    margin-right: 10px;
    width: 22px;
    height: 22px;
}

/* ============================================================
   完成绘制按钮 (Finish Drawing FAB)
   ============================================================ */

#btn-finish-drawing {
    position: fixed;
    bottom: calc(30px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    height: 44px;
    padding: 0 24px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.3s ease-out;
}

#btn-finish-drawing:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.5), 0 4px 8px rgba(0, 0, 0, 0.15);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ============================================================
   加载遮罩
   ============================================================ */

#loading-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-subtle);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-text {
    margin-top: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

/* ============================================================
   Toast 通知
   ============================================================ */

#toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    z-index: 3000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

#toast.show {
    opacity: 1;
}

/* ============================================================
   移动端只读模式 (Mobile Read-Only Mode)
   ============================================================ */

.sidebar-panel.mobile-read-only-mode {
    width: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.sidebar-panel.mobile-read-only-mode .sidebar-header {
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    color: white;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-panel.mobile-read-only-mode .sidebar-content {
    padding: 12px;
    background: #f8fafc;
}

/* 优化移动端测量项目卡片 */
@media (max-width: 768px) {
    /* 移动端头部优化 */
    .app-header {
        padding: 8px 16px !important;
        min-height: auto !important;
        gap: 8px !important;
    }
    
    .brand-logo {
        padding: 8px 12px !important;
        gap: 8px !important;
    }
    
    .brand-logo > div:first-child {
        width: 24px !important;
        height: 24px !important;
        font-size: 14px !important;
    }
    
    .brand-logo > div:last-child {
        gap: 1px !important;
        font-size: 1.1rem !important;
    }
    
    /* 项目名称在手机端显示为小标题 */
    .project-info {
        display: flex !important;
    }
    
    .project-name {
        font-size: 13px !important;
        font-weight: 500 !important;
        color: #6b7280 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-left: 4px;
        max-width: 120px;
    }
    
    .divider {
        width: 1px !important;
        height: 16px !important;
        background: #e5e7eb !important;
        margin: 0 4px !important;
    }
    
    .measurement-row {
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        padding: 16px !important;
        margin: 8px 0 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .measurement-row:hover {
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    
    .measurement-name {
        font-size: 14px !important;
        font-weight: 600 !important;
        color: #1f2937 !important;
    }
    
    .measurement-val {
        font-size: 18px !important;
        color: #2563eb !important;
        font-weight: 700 !important;
    }
    
    /* 隐藏移动端不需要的操作按钮 */
    .measurement-actions {
        display: none !important;
    }
    
    .measurement-left {
        flex-direction: column;
        gap: 4px;
    }
}
@media (pointer: coarse) {
    button,
    .tool-button,
    .list-action-btn,
    .btn-icon-pill {
        min-width: 48px !important;
        min-height: 48px !important;
        padding: 12px !important;
    }
}

/* ============================================================
   响应式设计 - iPad
   ============================================================ */

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 280px;
        /* 移除固定 header-height，让工具栏自然撑开 */
    }

    .app-header {
        height: auto;
        align-items: stretch;
        flex-wrap: wrap;
        row-gap: 8px;
        padding: 8px 12px;
    }

    .header-left {
        flex: 1 1 auto;
        min-width: 0;
    }

    .header-right {
        flex: 0 0 auto;
        min-width: 0;
    }

    .header-center {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        min-width: 0;
    }

    .canvas-toolbar-shell {
        padding: 8px 10px;
    }

    .canvas-toolbar-shell .app-mode-toolbar {
        width: 100%;
    }
    
    #toolbar,
    .navbar {
        padding: 8px 12px;
        padding-top: calc(env(safe-area-inset-top) + 8px);
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        min-height: 56px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .nav-left,
    .nav-center,
    .nav-right {
        gap: 6px;
    }
    
    .nav-center {
        order: 3;
        width: 100%;
        justify-content: flex-start;
    }
    
    .nav-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .nav-btn span {
        display: none;
    }
    
    .nav-logo {
        font-size: 16px;
    }
    
    .nav-project-info {
        margin-left: 8px;
        padding-left: 8px;
    }
    
    .project-name {
        max-width: clamp(140px, 35vw, 360px);
    }
    
    #save-status-top {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    #save-status-top span {
        display: none;
    }
    
    .user-greeting {
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: clamp(160px, 36vw, 240px);
    }

    .app-header {
        padding: 8px 12px !important;
    }

    .header-left {
        gap: 8px;
        min-width: 0;
    }

    .brand-logo {
        padding: 6px 8px !important;
        gap: 6px !important;
    }

    .brand-logo > div:last-child {
        display: none !important;
    }

    .divider {
        display: none;
    }

    .project-name {
        max-width: clamp(120px, 52vw, 240px);
    }

    .canvas-toolbar-shell {
        position: absolute;
        top: 10px;
        left: 10px;
        right: 10px;
        border: 1px solid var(--border);
        border-radius: 10px;
        box-shadow: 0 10px 22px rgba(15, 23, 42, 0.16);
        padding: 8px;
        z-index: 40;
    }

    .canvas-toolbar-shell.is-collapsed {
        top: 10px;
        left: 54px;
        right: auto;
        border: none;
        box-shadow: none;
        padding: 0;
    }

    .toolbar-toggle-label {
        font-size: 11px;
    }
    
    #sidebar {
        position: absolute;
        right: 0;
        top: 0;
        height: 100%;
        transform: translateX(100%);
        transition: transform 0.3s;
        z-index: 200;
    }
    
    #sidebar.open {
        transform: translateX(0);
    }
}

/* ============================================================
   Dashboard 抽屉式侧边栏 - 手机端优化 (≤768px)
   ============================================================ */

@media (max-width: 768px) {
    /* 显示移动端头部 */
    #mobile-dash-header {
        display: flex !important;
    }
    
    /* 关闭按钮显示 */
    #close-sidebar {
        display: flex !important;
    }
    
    /* Dashboard 布局调整 */
    #dashboard-view {
        flex-direction: column !important;
        padding-top: 56px !important;
        padding-top: max(56px, 56px + env(safe-area-inset-top)) !important;
    }
    
    /* 侧边栏改为抽屉式 */
    #dashboard-sidebar {
        position: fixed !important;
        top: 56px !important;
        top: calc(56px + env(safe-area-inset-top)) !important;
        left: -100% !important;
        bottom: 0 !important;
        width: 80% !important;
        max-width: 280px !important;
        border-right: 1px solid #eee !important;
        background: white !important;
        flex-direction: column !important;
        z-index: 1000 !important;
        transition: left 0.3s ease !important;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1) !important;
        overflow-y: auto !important;
    }
    
    /* 侧边栏打开状态 */
    #dashboard-sidebar.sidebar-open {
        left: 0 !important;
    }
    
    /* 遮罩层样式 */
    #sidebar-overlay {
        display: none !important;
    }
    
    #sidebar-overlay.sidebar-open {
        display: block !important;
    }
    
    /* Logo Section 适应移动端 */
    #dashboard-sidebar > div:nth-child(3) {
        padding: 20px 16px !important;
        font-size: 1.2rem !important;
    }
    
    #dashboard-sidebar > div:nth-child(3) > div:first-child {
        width: 26px !important;
        height: 26px !important;
        font-size: 12px !important;
    }
    
    #dashboard-sidebar > div:nth-child(3) > div:last-child {
        gap: 2px !important;
        font-size: 0.95rem !important;
    }
    
    /* 导航菜单 */
    #dashboard-sidebar nav {
        flex: 1 !important;
        padding: 8px 0 !important;
        overflow-y: auto !important;
    }
    
    #dashboard-sidebar nav button {
        padding: 12px 16px !important;
        margin: 4px 8px !important;
        font-size: 13px !important;
    }
    
    #dashboard-sidebar nav button i {
        font-size: 16px !important;
    }
    
    /* 返回按钮 */
    #dashboard-sidebar > div:last-child {
        padding: 12px 16px !important;
    }
    
    #btn-dash-back {
        padding: 10px 12px !important;
        font-size: 12px !important;
    }
    
    /* 主内容区域 */
    #dashboard-view > div:not(#mobile-dash-header):not(#sidebar-overlay) {
        flex: 1 !important;
        width: 100% !important;
    }
    
    #dashboard-view > div > main {
        padding: 16px !important;
        padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
    }
    
    /* Profile 页面适配 */
    #dash-tab-profile > div {
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    #dash-welcome-text {
        font-size: 1.5rem !important;
        margin-bottom: 12px !important;
    }
    
    #dash-welcome-stats {
        font-size: 0.9rem !important;
    }
    
    #dash-tab-profile > div > div:nth-child(2) {
        padding: 16px !important;
    }
    
    /* 表单字段单列 */
    #dash-tab-profile div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    #dash-tab-profile input {
        font-size: 16px !important;
        min-height: 44px !important;
        padding: 10px 12px !important;
    }
    
    #dash-tab-profile label {
        font-size: 0.8rem !important;
        font-weight: 600 !important;
    }
    
    /* Save Button */
    .btn-dash-save {
        width: 100% !important;
        max-width: none !important;
        padding: 12px 16px !important;
        font-size: 0.9rem !important;
    }
    
    /* Workspace Tab 适配 */
    #dash-tab-workspace > div {
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    #dash-tab-workspace h1 {
        font-size: 1.5rem !important;
    }
    
    .workspace-toolbar {
        flex-direction: column !important;
        gap: 12px !important;
        margin-bottom: 20px !important;
    }
    
    .segmented-control {
        width: 100% !important;
    }
    
    .seg-btn {
        flex: 1 !important;
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
    
    #btn-dash-new {
        width: 100% !important;
        justify-content: center !important;
        padding: 12px 16px !important;
    }
    
    #btn-dash-new i {
        font-size: 16px !important;
    }
    
    /* 项目网格单列 */
    .workspace-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    /* Account Tab 适配 */
    #dash-tab-account > div {
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    #dash-tab-account h1 {
        font-size: 1.5rem !important;
    }
    
    #dash-tab-account > div > div {
        padding: 16px !important;
        margin-bottom: 12px !important;
    }
    
    /* Account 行改为竖向 */
    #dash-tab-account div[style*="display: flex; justify-content: space-between; align-items: center; padding: 16px 0"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        padding: 12px 0 !important;
    }
    
    #dash-tab-account button {
        width: 100% !important;
        padding: 12px 16px !important;
        font-size: 13px !important;
    }
    
    /* Footer 适配 */
    #dashboard-view footer {
        padding: 12px !important;
        padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
        flex-direction: column !important;
        gap: 8px !important;
        text-align: center !important;
        font-size: 11px !important;
    }
    
    #dashboard-view footer nav {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
    }
}

/* 超小屏手机 Dashboard (≤480px) */
@media (max-width: 480px) {
    #mobile-dash-header {
        padding: 0 12px !important;
    }
    
    #mobile-menu-toggle {
        width: 36px !important;
        height: 36px !important;
    }
    
    #dashboard-sidebar {
        width: 85% !important;
    }
    
    #dashboard-sidebar > div:nth-child(3) {
        padding: 16px 12px !important;
    }
    
    #dashboard-sidebar nav button {
        padding: 10px 12px !important;
        margin: 3px 6px !important;
        font-size: 12px !important;
    }
    
    #dashboard-view > div > main {
        padding: 12px !important;
    }
    
    #dash-welcome-text {
        font-size: 1.25rem !important;
    }
    
    #dash-tab-profile > div > div:nth-child(2) {
        padding: 12px !important;
    }
    
    #dash-tab-workspace h1,
    #dash-tab-account h1 {
        font-size: 1.25rem !important;
    }
    
    #btn-dash-new {
        padding: 10px 12px !important;
        font-size: 12px !important;
    }
    
    #btn-dash-new i {
        display: none !important;
    }
    
    .seg-btn {
        padding: 8px 10px !important;
        font-size: 11px !important;
    }
}


/* ============================================================
   Landing Page 手机端响应式优化 (仅在手机端≤768px应用)
   PC端保持原布局
   ============================================================ */

/* ============================================================
   Landing Page 手机端响应式优化 (仅在手机端≤768px应用)
   PC端保持原布局
   ============================================================ */

/* Landing Page - Left Marketing Column */
.landing-nav-links {
    display: none;
    align-items: center;
    gap: 18px;
    font-size: 14px;
}

#landing-view .landing-nav-links {
    display: none !important;
}

.landing-nav-links a {
    transition: opacity 0.2s ease;
}

.landing-nav-links a:hover {
    opacity: 0.72;
}

.hero-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 44px 42px;
    background:
        radial-gradient(circle at 12% 15%, rgba(37, 99, 235, 0.24), transparent 42%),
        linear-gradient(160deg, #090f1c 0%, #121826 58%, #101725 100%);
    color: #fff;
    overflow-y: auto;
}

.hero-content {
    max-width: 980px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.hero-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hero-headline {
    margin: 0;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-size: clamp(34px, 4.3vw, 58px);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -1.2px;
    max-width: none;
}

.hero-subheadline {
    margin: 0;
    max-width: 48ch;
    font-size: clamp(18px, 1.8vw, 24px);
    line-height: 1.3;
    color: #dbeafe;
}

.hero-visual {
    border-radius: 14px;
    padding: 10px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(147, 197, 253, 0.28);
    max-width: 760px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.hero-video {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #020617;
    object-fit: cover;
}

.hero-image-fallback {
    display: none;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    object-fit: cover;
}

.hero-mobile-cta {
    display: none;
}

.hero-mobile-cta-copy {
    display: grid;
    gap: 4px;
}

.hero-mobile-cta-copy strong {
    font-size: 14px;
    color: #f8fafc;
}

.hero-mobile-cta-copy span {
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.45;
}

.hero-mobile-cta-btn {
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    padding: 12px 18px;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
    cursor: pointer;
    white-space: nowrap;
}

.hero-contrast {
    display: block;
    max-width: 1100px;
}

.hero-list {
    margin: 0;
    padding: 14px;
    list-style: none;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.62);
    display: grid;
    gap: 10px;
}

.hero-list li {
    font-size: clamp(15px, 1.4vw, 18px);
    line-height: 1.4;
}

.hero-list-pain li {
    color: #fca5a5;
    font-weight: 600;
}

.hero-list-win li {
    color: #86efac;
    font-weight: 700;
}

.hero-cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-cta-primary,
.hero-cta-secondary {
    border-radius: 10px;
    padding: 14px 22px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.hero-cta-primary {
    background: #2563eb;
    color: #fff;
    border: 1px solid #2563eb;
    box-shadow: 0 10px 28px rgba(37, 99, 235, 0.35);
}

.hero-cta-primary:hover {
    transform: translateY(-1px);
    background: #1d4ed8;
    box-shadow: 0 13px 32px rgba(29, 78, 216, 0.4);
}

.hero-cta-secondary {
    background: transparent;
    color: #eff6ff;
    border: 1px solid rgba(191, 219, 254, 0.4);
}

.hero-cta-secondary:hover {
    transform: translateY(-1px);
    background: rgba(37, 99, 235, 0.18);
    border-color: #93c5fd;
}

.hero-fomo {
    margin: 0;
    color: #fde68a;
    font-size: 13px;
    font-weight: 700;
}


/* 手机端优化 (≤768px) - 只在这个断点应用 */
@media (max-width: 768px) {
    #landing-view {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 导航栏紧凑化 */
    #landing-view nav {
        padding: 12px 16px !important;
        padding-top: max(12px, env(safe-area-inset-top)) !important;
        padding-left: max(16px, env(safe-area-inset-left)) !important;
        padding-right: max(16px, env(safe-area-inset-right)) !important;
    }
    
    #landing-view nav > div:first-child {
        gap: 6px !important;
    }
    
    #landing-view nav > div:first-child > div:nth-child(1) {
        width: 24px !important;
        height: 24px !important;
    }
    
    #landing-view nav > div:first-child > div:last-child {
        font-size: 1.2rem !important;
    }
    
    /* Hero + Auth 改为单列堆叠 */
    .landing-main-shell {
        display: block !important;
        flex: none !important;
        overflow: visible !important;
    }
    
    .landing-nav-links {
        display: none !important;
    }

    /* Hero Section 优化 */
    .hero-section {
        flex: none !important;
        padding: 28px 16px !important;
        justify-content: flex-start !important;
        gap: 20px;
        overflow: visible !important;
    }
    
    .hero-headline {
        font-size: clamp(32px, 8.3vw, 42px) !important;
        margin: 0 !important;
        line-height: 1.1 !important;
        white-space: normal !important;
    }
    
    .hero-subheadline {
        font-size: 1.05rem !important;
        margin: 0 !important;
    }

    .hero-contrast {
        grid-template-columns: 1fr !important;
    }

    .hero-cta-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .hero-cta-primary,
    .hero-cta-secondary {
        width: 100%;
    }

    .hero-video,
    .hero-image-fallback {
        width: 100% !important;
    }

    .hero-mobile-cta {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 14px 16px;
        border-radius: 16px;
        border: 1px solid rgba(96, 165, 250, 0.32);
        background: rgba(15, 23, 42, 0.78);
        box-shadow: 0 16px 36px rgba(2, 6, 23, 0.32);
    }
    
    /* Auth Card 改为全宽 */
    .landing-auth-shell {
        width: 100% !important;
        border-left: none !important;
        border-top: 1px solid #e5e7eb !important;
        padding: 20px 16px 28px !important;
        overflow: visible !important;
        max-height: none !important;
    }

    #landing-auth-card {
        scroll-margin-top: 16px;
    }
    
    /* 表单输入框 - 手机端改为44px最小高度 */
    #landing-auth-card input[type="email"],
    #landing-auth-card input[type="password"],
    #landing-auth-card input[type="text"] {
        min-height: 44px !important;
        font-size: 16px !important;
    }
    
    /* Landing 表单按钮 */
    #landing-login-form button,
    #landing-register-form button,
    #landing-reset-password-form button {
        min-height: 44px !important;
        font-size: 14px !important;
    }
    
    /* 选项卡 */
    .landing-auth-tab {
        padding: 12px 16px !important;
        font-size: 13px !important;
    }
    
    /* Footer 改为竖向堆叠 */
    #landing-view footer {
        padding: 16px !important;
        padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
        flex-direction: column !important;
        gap: 12px !important;
        text-align: center !important;
        font-size: 12px !important;
    }
    
    #landing-view footer nav {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    #landing-view footer nav a {
        display: block !important;
    }

}

/* 超小屏手机优化 (≤480px) */
@media (max-width: 480px) {
    #landing-view nav {
        padding: 10px 12px !important;
    }
    
    #landing-view nav > div:first-child > div:first-child {
        width: 20px !important;
        height: 20px !important;
    }
    
    #landing-view nav > div:first-child > div:last-child {
        font-size: 1rem !important;
    }
    
    .hero-section {
        padding: 24px 12px !important;
    }
    
    /* 超小屏也隐藏 demo preview */
    .demo-preview {
        display: none !important;
    }
    
    .hero-headline {
        font-size: 1.75rem !important;
        margin: 0 !important;
        white-space: normal !important;
    }
    
    .hero-subheadline {
        font-size: 0.95rem !important;
        margin: 0 !important;
    }

    .hero-list li {
        font-size: 0.9rem !important;
    }

    .hero-fomo {
        font-size: 12px !important;
    }
    
    .hero-mobile-cta {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-mobile-cta-btn {
        width: 100%;
    }

    .landing-auth-shell {
        padding: 16px 12px !important;
    }
    
    .landing-auth-tab {
        padding: 10px 12px !important;
        font-size: 12px !important;
    }
    
    #landing-auth-card input[type="email"],
    #landing-auth-card input[type="password"],
    #landing-auth-card input[type="text"] {
        font-size: 16px !important;
        min-height: 40px !important;
    }
    
    #landing-login-form button,
    #landing-register-form button,
    #landing-reset-password-form button {
        font-size: 13px !important;
        min-height: 40px !important;
    }
    
    #landing-view footer {
        padding: 12px !important;
        font-size: 11px !important;
        gap: 10px !important;
    }
}

/* ============================================================
   自定义模态框 (Custom Modal - 替代原生弹窗)
   ============================================================ */

/* Landing Google Sign-In */
#landing-login-form .google-signin-btn,
#landing-register-form .google-signin-btn {
    width: 100%;
    min-height: 48px !important;
    border: none;
    border-radius: 8px;
    margin-bottom: 12px;
    background: #1a73e8;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 14px;
    transition: transform 0.15s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

#landing-login-form .google-signin-btn:hover,
#landing-register-form .google-signin-btn:hover {
    opacity: 0.95;
}

#landing-login-form .google-signin-btn:active,
#landing-register-form .google-signin-btn:active {
    transform: translateY(1px);
}

#landing-login-form .google-signin-btn:disabled,
#landing-register-form .google-signin-btn:disabled {
    opacity: 0.72;
    cursor: not-allowed;
}

.google-signin-icon-wrap {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* 模态框遮罩层 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, visibility 0.2s;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

/* 模态框主体 */
.modal-box {
    background: var(--bg-panel);
    padding: 28px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.2s ease-out;
}

.modal-overlay:not(.hidden) .modal-box {
    transform: scale(1) translateY(0);
}

/* 内容样式 */
.modal-box h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.3px;
}

.modal-box p {
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

.modal-input {
    padding: 11px 14px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 15px;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    transition: all 0.2s;
    background: var(--bg-panel);
    color: var(--text-main);
}

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

.modal-box.manage-pages-modal {
    width: min(96vw, 1180px) !important;
    max-width: 1180px !important;
    max-height: 92vh !important;
    overflow: hidden;
}

.modal-box.manage-pages-modal #modal-content-body.manage-pages-body {
    display: flex;
    flex-direction: column;
    min-height: 64vh;
}

.modal-input::placeholder {
    color: var(--text-light);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.modal-actions button {
    min-width: 90px;
}

/* ============================================================
   辅助工具类
   ============================================================ */

.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-success {
    color: var(--success) !important;
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--border-subtle);
    margin: 0 12px;
}

/* ============================================================
   测量项创建表单样式 (Measurement Form)
   ============================================================ */

/* ============================================================
   🛡️ 通用隐藏类 (Universal Hidden Class)
   ============================================================ */
/* 必须使用 !important 确保能覆盖所有其他样式 */
.hidden {
    display: none !important;
}

/* ============================================================
   测量项创建表单样式 (Measurement Form)
   ============================================================ */

/* 表单容器布局 */
#measurement-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 10px;
}

/* 类型切换按钮组 */
.meas-type-toggle {
    display: flex;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.type-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px;
    border-radius: 6px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.type-btn.active {
    background: #fff;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.type-btn:hover:not(.active) {
    background: #e5e7eb;
}

/* 表单组 */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

/* 颜色选择器 */
.color-picker {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px #3b82f6;
}

/* =========================================
   🌟 Floating Workspace Layout
   ========================================= */

.app-body {
    flex: 1;
    display: flex;
    gap: 16px;
    padding: 16px;
    background-color: var(--bg-body); /* 浅灰底色，衬托悬浮感 */
    overflow: hidden;
}

#mobile-panel-toggle {
    display: none;
}

/* 🗺️ 图纸岛 (Canvas Panel) */
.canvas-panel {
    flex: 1;
    position: relative;
    background: var(--bg-surface);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

#canvas-wrapper {
    flex: 1;
    min-height: 0;
    position: relative;
    background-color: #f8fafc; /* 极浅蓝灰，区分图纸边界 */
}

/* 📋 控制台岛 (Sidebar Panel) */
.sidebar-panel {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#app-view.phone-panel-mode #mobile-panel-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    margin: 0;
    position: fixed;
    top: 74px;
    right: max(10px, env(safe-area-inset-right));
    z-index: 1450;
    padding: 4px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    width: fit-content;
}

#app-view.phone-panel-mode #mobile-panel-toggle.in-toolbar {
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin-left: 4px;
    flex-shrink: 0;
}

#app-view.phone-panel-mode #mobile-panel-toggle.in-header {
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: none;
    padding: 3px;
    margin-left: 8px;
    flex-shrink: 0;
}

#app-view.phone-panel-mode #mobile-panel-toggle button {
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    background: transparent;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    min-height: 36px;
}

#app-view.phone-panel-mode #mobile-panel-toggle.in-toolbar button {
    min-height: 34px;
    padding: 7px 10px;
}

#app-view.phone-panel-mode #mobile-panel-toggle.in-header button {
    min-height: 30px;
    padding: 6px 10px;
    font-size: 12px;
}

#app-view.phone-panel-mode #mobile-panel-toggle button.active {
    background: #2563eb;
    color: #ffffff;
}

#app-view.phone-panel-mode .app-body {
    padding-top: 10px;
}

#app-view.phone-panel-mode #btn-toggle-canvas-toolbar,
#app-view.phone-panel-mode #mobile-toolbar-break {
    display: none !important;
}

#app-view.phone-panel-mode .canvas-toolbar-shell {
    padding: 8px 10px;
}

#app-view.phone-panel-mode #app-mode-toolbar {
    gap: 6px;
    padding: 4px 6px;
    width: fit-content;
    max-width: 100%;
}

#app-view.phone-panel-mode:not(.phone-landscape) #app-mode-toolbar {
    width: 100%;
    flex-wrap: wrap;
    white-space: normal;
    overflow: visible;
    row-gap: 6px;
}

#app-view.phone-panel-mode:not(.phone-landscape) #mobile-toolbar-break {
    display: block !important;
    flex: 0 0 100%;
    width: 100%;
    height: 0;
    padding: 0;
    margin: 0;
}

#app-view.phone-panel-mode:not(.phone-landscape) #mode-select,
#app-view.phone-panel-mode:not(.phone-landscape) #mode-length,
#app-view.phone-panel-mode:not(.phone-landscape) #mode-area,
#app-view.phone-panel-mode:not(.phone-landscape) #mode-count {
    flex: 1 1 calc(25% - 6px);
    min-width: 72px;
    justify-content: center;
}

#app-view.phone-panel-mode .app-body.phone-show-canvas .canvas-panel {
    display: flex !important;
    flex: 1 1 auto;
}

#app-view.phone-panel-mode .app-body.phone-show-canvas .sidebar-panel {
    display: none !important;
}

#app-view.phone-panel-mode .app-body.phone-show-list .canvas-panel {
    display: none !important;
}

#app-view.phone-panel-mode .app-body.phone-show-list .sidebar-panel {
    display: flex !important;
    width: 100% !important;
}

#app-view.phone-panel-mode .floating-controls.page-controls {
    display: flex !important;
    bottom: max(6px, calc(env(safe-area-inset-bottom) + 6px)) !important;
    padding: 2px 4px !important;
    gap: 3px !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.86) !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.14) !important;
    z-index: 80 !important;
}

#app-view.phone-panel-mode .app-body.phone-show-list .floating-controls.page-controls {
    display: none !important;
}

#app-view.phone-panel-mode .app-body.phone-show-canvas .floating-controls.page-controls {
    bottom: max(6px, calc(env(safe-area-inset-bottom) + 6px)) !important;
}

#app-view.phone-panel-mode .app-body.phone-show-canvas .floating-controls.page-controls .btn-icon-pill {
    width: 22px !important;
    height: 22px !important;
}

#app-view.phone-panel-mode .app-body.phone-show-canvas .floating-controls.page-controls .btn-icon-pill i {
    font-size: 11px !important;
}

#app-view.phone-panel-mode .app-body.phone-show-canvas .floating-controls.page-controls .page-count {
    min-width: 48px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

#app-view.phone-panel-mode {
    width: var(--mobile-vw) !important;
    height: var(--mobile-vh) !important;
}

/* Phone landscape: reduce chrome, maximize drawing space */
#app-view.phone-panel-mode.phone-landscape .app-header {
    padding: 6px 10px !important;
    min-height: 46px !important;
}

#app-view.phone-panel-mode.phone-landscape .brand-logo {
    padding: 6px 8px !important;
}

#app-view.phone-panel-mode.phone-landscape .brand-logo > div:last-child {
    display: none !important;
}

#app-view.phone-panel-mode.phone-landscape .divider {
    display: none !important;
}

#app-view.phone-panel-mode.phone-landscape .project-name {
    font-size: 14px !important;
    max-width: 36vw !important;
}

#app-view.phone-panel-mode.phone-landscape #mobile-panel-toggle {
    top: 56px;
}

#app-view.phone-panel-mode.phone-landscape #mobile-panel-toggle.in-toolbar {
    top: auto;
}

#app-view.phone-panel-mode.phone-canvas-focus #mobile-panel-toggle:not(.in-toolbar) {
    position: fixed;
    top: max(6px, env(safe-area-inset-top));
    right: max(6px, env(safe-area-inset-right));
    margin: 0;
    z-index: 1400;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

#app-view.phone-panel-mode.phone-canvas-focus #mobile-panel-toggle.in-toolbar {
    position: static;
    top: auto;
    right: auto;
}

#app-view.phone-panel-mode.phone-landscape .app-body {
    padding: 6px !important;
    gap: 8px !important;
}

#app-view.phone-panel-mode.phone-landscape footer {
    display: none !important;
}

/* Phone canvas focus: immersive measuring mode */
#app-view.phone-panel-mode.phone-canvas-focus .app-header {
    display: none !important;
}

#app-view.phone-panel-mode.phone-canvas-focus footer {
    display: none !important;
}

#app-view.phone-panel-mode.phone-canvas-focus .app-body.phone-show-canvas {
    padding: 0 !important;
    gap: 0 !important;
}

#app-view.phone-panel-mode.phone-canvas-focus .app-body.phone-show-canvas .canvas-panel {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    height: 100% !important;
}

#app-view.phone-panel-mode.phone-canvas-focus .app-body.phone-show-canvas #canvas-wrapper {
    height: 100% !important;
}

#app-view.phone-panel-mode.phone-canvas-focus .app-body.phone-show-canvas .canvas-toolbar-shell {
    top: max(54px, calc(env(safe-area-inset-top) + 46px)) !important;
    left: 8px !important;
    right: 8px !important;
}

/* Sidebar Header (总计区域) */
.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: #fafaf9; /* 稍微不同的背景色以区分 */
}

.total-card {
    background: var(--primary);
    color: white;
    padding: 16px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.total-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
    margin-bottom: 4px;
}

.total-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

/* Sidebar Content (滚动区) */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg-surface);
}

.sidebar-panel > .sidebar-content {
    padding-top: 12px;
}

.workspace-onboarding-empty {
    padding: 32px 20px !important;
}

.workspace-onboarding-card {
    max-width: 560px;
    margin: 0 auto;
    padding: 28px;
    border-radius: 18px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #dbeafe;
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.08);
}

.workspace-onboarding-eyebrow,
.onboarding-checklist-eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #2563eb;
    margin-bottom: 10px;
}

.workspace-onboarding-card h3 {
    margin: 0 0 10px 0;
    font-size: 28px;
    line-height: 1.1;
    color: #0f172a;
}

.workspace-onboarding-card p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #475569;
}

.workspace-onboarding-actions {
    margin-top: 20px;
}

.workspace-onboarding-primary {
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    color: #fff;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
}

.onboarding-checklist-card {
    margin: 0 0 16px 0;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid #dbeafe;
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.onboarding-checklist-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.onboarding-checklist-header h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.2;
    color: #0f172a;
}

.onboarding-checklist-progress {
    min-width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 12px;
    font-weight: 800;
}

.onboarding-checklist-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.onboarding-step {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 10px 0;
}

.onboarding-step.is-current {
    background: rgba(37, 99, 235, 0.04);
    border-radius: 12px;
    padding: 10px;
    margin: 0 -4px;
}

.onboarding-step-marker {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}

.onboarding-step.is-done .onboarding-step-marker {
    background: #dcfce7;
    color: #166534;
}

.onboarding-step-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 3px;
}

.onboarding-step-description {
    font-size: 12px;
    line-height: 1.5;
    color: #64748b;
}

.onboarding-step-action {
    margin-top: 8px;
    border: none;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    justify-self: start;
}

.onboarding-checklist-card.is-phone {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 12px;
}

.onboarding-checklist-card.is-phone .onboarding-checklist-header {
    margin-bottom: 10px;
}

.onboarding-checklist-card.is-phone .onboarding-checklist-header h3 {
    font-size: 15px;
}

.onboarding-checklist-card.is-phone .onboarding-checklist-progress {
    min-width: 34px;
    height: 34px;
    font-size: 11px;
}

.onboarding-checklist-card.is-phone .onboarding-step {
    gap: 8px;
    padding: 8px 0;
}

.onboarding-checklist-card.is-phone .onboarding-step.is-current {
    padding: 10px;
    margin: 0;
}

.onboarding-checklist-card.is-phone .onboarding-step-title {
    font-size: 12px;
}

.onboarding-checklist-card.is-phone .onboarding-step-description {
    font-size: 11px;
}

.onboarding-checklist-card.is-phone .onboarding-step-action {
    width: 100%;
    justify-self: stretch;
    text-align: center;
}

.onboarding-pulse {
    animation: onboardingPulse 1.6s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35);
}

@keyframes onboardingPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(37, 99, 235, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.save-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--success);
}

/* ========================================= 🌟 Floating Card System (Sidebar List) ========================================= */

.group-container { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }

/* 📁 组标题卡片 */
.group-header { background: #f1f5f9; border-radius: 8px; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; transition: background 0.2s; }
.group-header:hover { background: #e2e8f0; }

.group-title-section { display: flex; align-items: center; gap: 6px; }
.group-meta { display: flex; align-items: center; gap: 2px; }

/* 📄 测量项卡片 (核心卡片) */
.measurement-container { margin-bottom: 4px; }

.measurement-row { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: 0 1px 2px rgba(0,0,0,0.02); }

/* 卡片悬停效果：微浮起 */
.measurement-row:hover { border-color: #cbd5e1; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); transform: translateY(-1px); }

/* 卡片激活效果：品牌蓝高亮 */
.measurement-row.active { background: #eff6ff; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

.measurement-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }

.measurement-name { font-weight: 500; font-size: 13px; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.measurement-right { display: flex; align-items: center; gap: 8px; }

/* 隐藏在背景中的操作按钮，Hover 时显现 */
.measurement-actions { display: flex; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.measurement-row:hover .measurement-actions { opacity: 1; pointer-events: auto; }

.measurement-val { font-weight: 700; font-size: 14px; color: var(--text-main); font-variant-numeric: tabular-nums; background: #f1f5f9; padding: 4px 8px; border-radius: 6px; }
.measurement-row.active .measurement-val { background: #dbeafe; color: var(--primary); }

/* 🕹️ 悬浮胶囊控件 (Floating Pills) */
.floating-controls {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px); /* 毛玻璃效果 */
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 999px; /* 胶囊形状 */
    padding: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    z-index: 50;
}

.btn-icon-pill {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
    transition: background 0.2s;
}
.btn-icon-pill:hover { background: rgba(0,0,0,0.05); }
.btn-icon-pill:disabled { color: var(--border); cursor: not-allowed; }

.page-count {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
    min-width: 48px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* --- 列表操作按钮样式 --- */

.list-action-btn {
    /* 去掉默认按钮样式 */
    background: transparent;
    border: none;
    cursor: pointer;
    
    /* 布局与尺寸 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px; /* 圆角，为了 Hover 效果更好看 */
    
    /* 颜色与过渡 */
    color: #9ca3af; /* 平时是中灰色 (Tailwind gray-400) */
    transition: all 0.2s ease; /*使得 Hover 效果丝滑 */
    
    /* 关键：确保能被点到 */
    pointer-events: auto;
}

/* 鼠标悬停效果 */
.list-action-btn:hover {
    background-color: #f3f4f6; /* 浅灰背景 (Tailwind gray-100) */
    color: #374151; /* 深灰图标 (Tailwind gray-700) */
}

/* 图标大小 */
.list-action-btn i {
    font-size: 17px; /* 稍微调整大小，让它看起来更精致 */
}

/* 特殊状态：当眼睛关闭（隐藏）时的样式 */
.list-action-btn.is-hidden {
    color: #d1d5db; /* 更淡的灰色，表示不可用 */
}
/* 隐藏状态下 Hover 依然变色，提示它可以点击恢复 */
.list-action-btn.is-hidden:hover {
    background-color: #f3f4f6;
    color: #6b7280;
}

/* ============================================================
   [修复] Toast 提示框 Z-Index 修复 (确保永远在最顶层)
   ============================================================ */

#toast,
.toast,
.toast-notification {
    z-index: 99999 !important;
}

/* ============================================================
   PDF 侧边栏 (Floating PDF Sidebar)
   ============================================================ */

#canvas-wrapper {
    position: relative;
    overflow: hidden;
}

#btn-sidebar-toggle {
    position: absolute;
    left: 10px;
    top: 10px;
    z-index: 20;
    background: white;
    border: 1px solid #e2e8f0;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all 0.2s;
}

#btn-sidebar-toggle:hover {
    background: #f1f5f9;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#pdf-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 180px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 30;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

#pdf-sidebar.hidden {
    display: flex !important; /* 确保即使有 hidden 也能显示基本结构 */
}

#pdf-sidebar.visible {
    transform: translateX(0);
    display: flex !important; /* 确保 visible 时强制显示 */
}

#pdf-sidebar .sidebar-header {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #334155;
    font-size: 14px;
    flex-shrink: 0;
}

#btn-close-sidebar {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    width: 24px;
    height: 24px;
}

#btn-close-sidebar:hover {
    background: #f1f5f9;
    color: #334155;
}

.btn-icon-tiny {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
}

.btn-icon-tiny i {
    font-size: 16px;
}

#thumbnail-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

#thumbnail-list::-webkit-scrollbar {
    width: 6px;
}

#thumbnail-list::-webkit-scrollbar-track {
    background: transparent;
}

#thumbnail-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

#thumbnail-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.thumbnail-item {
    margin-bottom: 12px;
    cursor: pointer;
    text-align: center;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 4px;
    transition: all 0.2s;
    background: #fff;
    border: 1px solid #e5e7eb;
    height: auto; /* [关键] 高度自动，适应内容 */
}

.thumbnail-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.thumbnail-item.active {
    border-color: #3b82f6;
    background: #eff6ff;
    border-width: 2px;
    box-shadow: 0 0 0 1px #3b82f6;
}

/* [修改] 强制 Canvas 保持原始比例，适应容器宽度 */
.thumbnail-item canvas {
    width: 100% !important;    /* 宽度占满容器 */
    height: auto !important;   /* [关键] 高度自动，根据宽度按比例缩放 */
    display: block;            /* 防止行内元素产生额外间距 */
    background: #f5f5f5;       /* 设置背景色 */
    border-radius: 3px;
}

.thumbnail-page-num {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   类型选择器：三等分网格
   ============================================================ */
.type-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.type-switcher label {
    text-align: center;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.type-switcher label:hover {
    border-color: #cbd5e1;
    background: #f9fafb;
}

.type-switcher input[type="radio"]:checked + label {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #2563eb;
}

/* ============================================================
   类型选择器：三等分网格
   ============================================================ */
.type-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.type-switcher input[type="radio"] {
    display: none !important;
}

.type-switcher label {
    text-align: center;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.type-switcher label:hover {
    border-color: #cbd5e1;
    background: #f9fafb;
}

/* 选中状态 */
.type-switcher input[type="radio"]:checked + label {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #2563eb;
}

.type-switcher input[type="radio"]:checked + label i {
    color: #2563eb;
}
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
}

.color-swatches .color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.color-swatches .color-swatch:hover {
    transform: scale(1.1);
}

.color-swatches .color-swatch.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px #3b82f6;
}

/* ============================================================
   Footer Styles
   ============================================================ */
footer a {
    color: #666;
    text-decoration: none;
    transition: color 0.2s ease;
}

footer a:hover {
    color: #2563eb;
}

/* ============================================================
   Account Tab Styles
   ============================================================ */
.workspace-plan-banner {
    margin: 0 0 24px 0;
    padding: 20px 24px;
    border-radius: 18px;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.20), transparent 38%),
        linear-gradient(135deg, #f8fbff 0%, #eef4ff 48%, #f5f3ff 100%);
    border: 1px solid rgba(37, 99, 235, 0.12);
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.08);
}

.workspace-plan-banner.subscription {
    background:
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.22), transparent 36%),
        linear-gradient(135deg, #f0fdfa 0%, #ecfeff 48%, #eef2ff 100%);
    border-color: rgba(14, 165, 233, 0.18);
}

.workspace-plan-banner.payg {
    background:
        radial-gradient(circle at top right, rgba(249, 115, 22, 0.16), transparent 36%),
        linear-gradient(135deg, #fff9f2 0%, #fff7ed 48%, #fef3c7 100%);
    border-color: rgba(249, 115, 22, 0.18);
}

.workspace-plan-banner.canceled {
    background:
        radial-gradient(circle at top right, rgba(156, 163, 175, 0.18), transparent 36%),
        linear-gradient(135deg, #f9fafb 0%, #f3f4f6 48%, #e5e7eb 100%);
    border-color: rgba(107, 114, 128, 0.18);
}

.workspace-plan-banner-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.workspace-plan-banner-copy h3 {
    margin: 10px 0 8px 0;
    font-size: 1.25rem;
    color: #111827;
}

.workspace-plan-banner-copy p {
    margin: 0;
    color: #4b5563;
    line-height: 1.6;
}

.workspace-plan-badge,
.billing-plan-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

.billing-plan-badge.payg {
    background: rgba(249, 115, 22, 0.14);
    color: #c2410c;
}

.billing-plan-badge.unlimited {
    background: rgba(14, 165, 233, 0.14);
    color: #0369a1;
}

.billing-plan-badge.subscription {
    background: rgba(14, 165, 233, 0.14);
    color: #0369a1;
}

.billing-plan-badge.canceled {
    background: rgba(107, 114, 128, 0.14);
    color: #4b5563;
}

.workspace-plan-banner.payg .workspace-plan-badge,
.pricing-plan-card[data-plan-card="payg"].is-current .pricing-plan-kicker {
    background: rgba(249, 115, 22, 0.14);
    color: #c2410c;
}

.pricing-plan-card[data-plan-card="payg"].is-current .pricing-plan-price {
    color: #c2410c;
}

.workspace-plan-banner.subscription .workspace-plan-badge,
.pricing-plan-card[data-plan-card="subscription-month"].is-current .pricing-plan-kicker,
.pricing-plan-card[data-plan-card="subscription-year"].is-current .pricing-plan-kicker {
    background: rgba(14, 165, 233, 0.14);
    color: #0369a1;
}

.pricing-plan-card[data-plan-card="subscription-month"].is-current .pricing-plan-price,
.pricing-plan-card[data-plan-card="subscription-year"].is-current .pricing-plan-price {
    color: #0369a1;
}

.workspace-plan-banner.canceled .workspace-plan-badge {
    background: rgba(107, 114, 128, 0.14);
    color: #4b5563;
}

.workspace-plan-banner-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.workspace-plan-banner-button,
.billing-primary-button,
.billing-secondary-button,
.pricing-plan-button {
    border: none;
    border-radius: 10px;
    padding: 11px 18px;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.workspace-plan-banner-button:hover,
.billing-primary-button:hover,
.pricing-plan-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

.workspace-plan-banner-button.secondary,
.billing-secondary-button {
    background: #fff;
    color: #1f2937;
    border: 1px solid #dbe2f0;
}

.billing-overview-card {
    background: white;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    padding: 28px;
    margin-bottom: 20px;
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.billing-overview-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.billing-overview-title {
    font-size: 22px;
    line-height: 1.25;
    color: #111827;
    margin: 14px 0 8px 0;
}

.billing-overview-description {
    margin: 0;
    color: #6b7280;
    line-height: 1.6;
    max-width: 560px;
}

.billing-price-block {
    min-width: 160px;
    text-align: right;
}

.billing-price {
    font-size: 34px;
    line-height: 1;
    font-weight: 800;
    color: #111827;
}

.billing-cycle {
    margin-top: 8px;
    color: #6b7280;
    font-size: 14px;
}

.billing-metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.billing-metric-card {
    border-radius: 14px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

.billing-metric-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.billing-metric-value {
    font-size: 16px;
    color: #111827;
}

.usage-progress {
    height: 8px;
    background: #E5E7EB;
    border-radius: 4px;
    overflow: hidden;
}

.usage-progress > div {
    background: linear-gradient(to right, #2563eb, #0ea5e9);
    height: 100%;
    transition: width 0.3s ease;
}

.billing-footnote {
    margin: 0;
    color: #6b7280;
    line-height: 1.6;
    font-size: 14px;
}

.billing-action-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.pricing-plan-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.pricing-plan-card {
    background: #fff;
    border-radius: 18px;
    padding: 24px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 18px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.pricing-plan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
}

.pricing-plan-card.featured {
    background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
    border-color: rgba(37, 99, 235, 0.18);
}

.pricing-plan-card.is-current {
    border-color: #2563eb;
    box-shadow: 0 18px 36px rgba(37, 99, 235, 0.12);
}

.pricing-plan-top h3 {
    margin: 10px 0 8px 0;
    color: #111827;
    font-size: 20px;
}

.pricing-plan-top p {
    margin: 0;
    color: #6b7280;
    line-height: 1.6;
}

.pricing-plan-kicker {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 12px;
    font-weight: 700;
}

.pricing-plan-price {
    margin: 0 0 12px 0;
    font-size: 34px;
    line-height: 1;
    font-weight: 800;
    color: #111827;
}

.pricing-plan-price span {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    margin-left: 4px;
}

.pricing-plan-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: #374151;
}

.pricing-plan-features li {
    position: relative;
    padding-left: 18px;
    line-height: 1.5;
}

.pricing-plan-features li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2563eb;
}

/* Highlight text for registration title */
.highlight-text {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    font-weight: 800;
}

/* ============================================================
   密码可见性切换按钮 (Password Toggle Button)
   ============================================================ */

.password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    color: #6b7280;
    transition: color 0.2s ease;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.password-toggle-btn:hover {
    color: #374151;
}

.password-toggle-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* Focus 状态 - 无框 */
.password-toggle-btn:focus {
    outline: none;
}

/* ============================================================
   Workspace New Project Tooltip
   ============================================================ */
.new-project-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 12000;
    width: min(300px, calc(100vw - 24px));
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    color: #1f2937;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.16);
    padding: 12px;
    font-size: 13px;
    line-height: 1.45;
    border: 1px solid #bfdbfe;
}

.new-project-tooltip[hidden] {
    display: none !important;
}

.new-project-tooltip-content {
    margin: 0 0 10px 0;
}

.new-project-tooltip-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.new-project-tooltip-btn {
    border: 1px solid transparent;
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    min-height: 20px;
    transition: all 0.2s ease;
}

.new-project-tooltip-btn.ok {
    background: transparent;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.new-project-tooltip-btn.ok:hover {
    background: transparent;
    border-color: #2563eb;
    color: #1e40af;
}

.new-project-tooltip-btn.hide {
    background: transparent;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.new-project-tooltip-btn.hide:hover {
    background: transparent;
    border-color: #60a5fa;
    color: #1e3a8a;
}

.new-project-tooltip-arrow {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffffff;
    transform: rotate(45deg);
}

/* Set Scale Tooltip */
.set-scale-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 12000;
    width: min(360px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    box-sizing: border-box;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    color: #1f2937;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.16);
    padding: 12px;
    font-size: 13px;
    line-height: 1.45;
    border: 1px solid #bfdbfe;
}

.set-scale-tooltip[hidden] {
    display: none !important;
}

.set-scale-tooltip-content {
    margin: 0 0 10px 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.set-scale-tooltip-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.set-scale-tooltip-btn {
    border: 1px solid transparent;
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    min-height: 20px;
    transition: all 0.2s ease;
}

.set-scale-tooltip-btn.ok {
    background: transparent;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.set-scale-tooltip-btn.ok:hover {
    background: transparent;
    border-color: #2563eb;
    color: #1e40af;
}

.set-scale-tooltip-btn.hide {
    background: transparent;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.set-scale-tooltip-btn.hide:hover {
    background: transparent;
    border-color: #60a5fa;
    color: #1e3a8a;
}

.set-scale-tooltip-arrow {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffffff;
    transform: rotate(45deg);
}

@media (max-width: 900px) {
    .billing-overview-head,
    .workspace-plan-banner-head {
        flex-direction: column;
    }

    .billing-price-block {
        text-align: left;
    }

    .billing-metric-grid,
    .pricing-plan-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .workspace-plan-banner,
    .billing-overview-card,
    .pricing-plan-card {
        padding: 20px;
    }

    .workspace-plan-banner-actions,
    .billing-action-row {
        flex-direction: column;
    }

    .workspace-plan-banner-button,
    .billing-primary-button,
    .billing-secondary-button,
    .pricing-plan-button {
        width: 100%;
    }
}
