/* =========================================
   demand.css - 需求规划页面专用样式
   ========================================= */

/* ===== 三列联动（步骤01 新版）===== */

/* 搜索栏 - 画框内的自然元素 */
.search-bar-wrap {
    flex-shrink: 0;
    padding: 8px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--bg-card);
    z-index: 50;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    background: var(--bg-card);
    border-radius: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.search-bar:active {
    background: #E8E8ED;
}

.search-bar .search-icon {
    flex-shrink: 0;
}

.search-bar .search-placeholder {
    font-size: 13px;
    color: var(--text-tertiary);
    flex: 1;
}

/* 搜索弹层 - 绝对定位,只在 .page 画框内显示,不跳出画框 */
.search-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top, 0);
}

.search-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--bg-card);
}

.search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    background: var(--bg-card);
    border-radius: 10px;
}

.search-input-wrap input {
    flex: 1;
    height: 100%;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--text-primary);
    font-family: inherit;
}

.search-clear {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-tertiary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
}

.search-cancel {
    font-size: 14px;
    color: var(--accent);
    cursor: pointer;
    padding: 4px 4px;
}

.search-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.search-tip {
    text-align: center;
    color: var(--text-tertiary);
    padding: 40px 16px;
    font-size: 14px;
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--bg-card);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.search-result-item:active {
    background: var(--bg-card);
}

.search-result-tag {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 2px;
}

.search-result-name {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.4;
}

.search-result-name .highlight {
    color: var(--accent);
    font-weight: 600;
}

/* 三列容器 - 在画框内自动填满剩余空间 */
.triple-col {
    flex: 1;
    min-height: 0;
    display: flex;
    background: var(--bg);
    overflow: hidden;
}

.triple-col-col {
    display: flex;
    flex-direction: column;
    overflow: hidden;       /* 列容器不滚动，让内部 .triple-col-list 滚动 */
    height: 100%;
    background: var(--bg-soft);
    min-width: 0;            /* 防止 flex 子项溢出 */
}

/* 宽度比 17% : 48% : 35%（按最长文字字符数 4:11:8 算） */
.triple-col-1 {
    flex: 0 0 17%;
    max-width: 17%;
}

.triple-col-2 {
    flex: 0 0 48%;
    max-width: 48%;
    border-left: 1px solid var(--bg-card);
}

.triple-col-3 {
    flex: 0 0 35%;
    max-width: 35%;
    background: var(--bg);
    border-left: 1px solid var(--bg-card);
    min-width: 0;
}

/* 每列顶部的全选按钮（高度统一，三列对齐） */
.triple-col-header-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    margin: 8px;
    padding: 0 12px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.triple-col-header-btn:active {
    background: #E8E8ED;
}

.triple-col-header-btn.all-selected {
    background: var(--accent);
    color: white;
}

/* 列内部滚动列表 */
.triple-col-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-height: 0;          /* 关键：允许 flex 子项收缩 */
}

/* 列项 - 空间 */
.triple-col-item {
    height: 40px;                       /* 统一固定高度 */
    padding: 0 8px;
    font-size: var(--triple-col-font-size, 13px);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;                /* 禁止换行 */
    overflow: hidden;
    text-overflow: ellipsis;            /* 兜底省略号 */
    line-height: 40px;                  /* 垂直居中（=高度） */
    box-sizing: border-box;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    -webkit-tap-highlight-color: transparent;
}

.triple-col-1 .triple-col-item {
    padding: 0 4px;
    text-align: center;
}

.triple-col-2 .triple-col-item {
    padding: 0 8px;
}

/* 选中态 */
.triple-col-item.active {
    background: var(--accent) !important;
    color: white !important;
    font-weight: 600;
}

/* 三列内的功能项 */
.triple-func-item {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;                       /* 统一固定高度 */
    padding: 0 8px;
    border-bottom: 1px solid var(--bg-card);
    cursor: pointer;
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;                /* 禁止换行 */
    overflow: hidden;
    box-sizing: border-box;
}

.triple-func-item:active {
    background: var(--bg-card);
}

.triple-func-item .name {
    flex: 1;
    font-size: var(--triple-col-font-size, 13px);
    color: var(--text-primary);
    letter-spacing: -0.005em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;            /* 兜底省略号 */
    line-height: 40px;                  /* 垂直居中 */
    min-width: 0;
}

.triple-func-item.selected .name {
    color: var(--accent);
    font-weight: 500;
}

.triple-func-item .check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.triple-func-item.selected .check {
    background: var(--accent);
    border-color: var(--accent);
}

.triple-func-item.selected .check::after {
    content: '✓';
    color: white;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

/* 空状态 */
.triple-col-empty {
    padding: 32px 12px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
}

/* ===== 需求规划主页 ===== */
/* 空间预算(按画框高 780-880px 算):
   顶栏 44 + intro 80 + 4张卡 + 间距 + 按钮 100 + 安全 24 ≈ 600px,留 180-280 富余 */
.demand-home {
    padding: 16px 20px 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0));
    display: flex;
    flex-direction: column;
}

.demand-intro {
    text-align: center;
    padding: 8px 0 16px;
    flex-shrink: 0;
}

.intro-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.3;
}

.intro-desc {
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

/* ===== 步骤卡片列表 ===== */
.steps-list {
    display: flex;
    flex-direction: column;
    gap: 12px;              /* 4 张卡之间留点呼吸感 */
    margin-bottom: 20px;
    flex: 1;                /* 占满剩余高度,4 张卡均分 */
    min-height: 0;
}

.step-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;     /* 恢复舒适的内边距 */
    background: var(--bg-card);
    border-radius: 16px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    flex: 1;                /* 4 张卡平分 .steps-list 高度 */
    min-height: 0;
}

.step-card:active {
    transform: scale(0.99);
}

.step-card.unlocked {
    background: var(--bg);
    border-color: var(--border);
}

.step-num {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.step-card.unlocked .step-num {
    background: var(--accent);
    color: white;
}

.step-card.done .step-num {
    background: var(--accent);
    color: white;
}

.step-info {
    flex: 1;
    min-width: 0;
    width: 0;                 /* 让标题/描述超出时省略号生效,而不是撑开整张卡 */
    display: flex;
    flex-direction: column;
    justify-content: center;  /* 标题+描述整体中线和右边状态文字严格对齐 */
}

.step-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    letter-spacing: -0.01em;
}

.step-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-status {
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: right;             /* 状态文字右对齐,4 张卡右边沿一致 */
    flex-shrink: 0;
    white-space: nowrap;
    line-height: 1;
}

.step-status.done {
    color: var(--accent);
}

.step-arrow {
    color: var(--text-tertiary);
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    /* ›字形视觉重心偏下,用 transform 微调上移跟状态文字视觉中心对齐 */
    transform: translateY(-2px);
}

.step-card.unlocked .step-arrow {
    color: var(--accent);
}

/* ===== 操作区 ===== */
.actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.actions .btn-large {
    height: 48px;
    font-size: 16px;
}

/* ===== 操作区 ===== */
.actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== 步骤页面通用 ===== */
.step-page {
    /* 画框内已经有底部 bottom-bar,不再需要额外 padding-bottom */
    padding: 16px;
}

/* ===== Tab 横向滚动 ===== */
.tab-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    background: var(--bg);
    border-bottom: 1px solid var(--bg-card);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tab-scroll::-webkit-scrollbar {
    display: none;
}

.tab-scroll-inner {
    display: inline-flex;
    padding: 0 16px;
    gap: 4px;
}

.tab-item {
    display: inline-flex;
    align-items: center;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.tab-item.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* ===== 二级 Tab ===== */
.sub-tab-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--bg-card);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sub-tab-scroll::-webkit-scrollbar {
    display: none;
}

.sub-tab-scroll .tab-item {
    font-size: 13px;
    padding: 10px 12px;
}

/* ===== 功能列表（步骤01） ===== */
.func-list {
    padding: 8px 16px;
}

.func-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--bg-card);
    cursor: pointer;
    transition: background 0.15s ease;
}

.func-item:active {
    background: var(--bg-card);
}

.func-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.func-item.selected .func-checkbox {
    background: var(--accent);
    border-color: var(--accent);
}

.func-item.selected .func-checkbox::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.func-name {
    flex: 1;
    font-size: 15px;
    color: var(--text-primary);
    letter-spacing: -0.005em;
}

.func-item.selected .func-name {
    color: var(--accent);
    font-weight: 500;
}

/* ===== 全选按钮 ===== */
.select-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 14px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    margin: 8px 16px;
    border: none;
    font-family: inherit;
}

.select-all-btn.all-selected {
    background: var(--accent);
    color: white;
}

/* ===== 空间选择网格（步骤02） ===== */
.space-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 16px;
}

.space-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    background: var(--bg-card);
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    text-align: center;
    padding: 8px;
}

.space-card.selected {
    background: var(--bg);
    border-color: var(--accent);
    color: var(--accent);
}

.space-card.add-btn {
    background: transparent;
    border: 2px dashed var(--border);
    color: var(--text-tertiary);
}

.space-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
}

/* 自定义空间输入 */
.custom-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
}

.custom-input:focus {
    border-color: var(--accent);
}

.custom-actions {
    display: flex;
    gap: 8px;
}

.custom-actions button {
    flex: 1;
    height: 38px;
    border-radius: 10px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
}

.custom-confirm {
    background: var(--accent);
    color: white;
}

.custom-cancel {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ===== 分配需求 四栏布局（步骤03）===== */
.distribute-quad-col {
    /* 画框内自动填满中间空间 */
    flex: 1;
    min-height: 0;
    display: flex;
    background: var(--bg);
    overflow: hidden;
}

.dist-col {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    min-width: 0;
}

/* 四栏宽度：40% : 8% : 12% : 40% */
.dist-col-1 {
    flex: 0 0 40%;
    max-width: 40%;
    background: var(--bg-soft);
    border-right: 1px solid var(--bg-card);
}

.dist-col-arrow {
    flex: 0 0 8%;
    max-width: 8%;
    background: var(--bg);
    align-items: center;
    justify-content: center;
}

.dist-col-tabs-col {
    flex: 0 0 12%;
    max-width: 12%;
    background: var(--bg-soft);
    border-left: 1px solid var(--bg-card);
    border-right: 1px solid var(--bg-card);
}

.dist-col-3 {
    flex: 0 0 40%;
    max-width: 40%;
    background: var(--bg);
}

/* 列头部 */
.dist-col-header {
    flex-shrink: 0;
    height: 36px;
    padding: 0 8px;
    background: var(--bg);
    border-bottom: 1px solid var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 第1列头部内容居左 */
.dist-col-1 .dist-col-header {
    justify-content: flex-start;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 第3列头部显示当前空间 */
.dist-col-3 .dist-col-header {
    color: var(--accent);
    font-weight: 600;
}

/* 列内滚动列表 */
.dist-col-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

/* ===== 待分配列表（折叠层级）===== */
.dist-pending-group {
    border-bottom: 1px solid var(--bg-card);
}

.dist-level-1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    background: var(--bg);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
}

.dist-level-1:active {
    background: var(--bg-card);
}

.dist-level-1 .arrow {
    font-size: 10px;
    color: var(--text-tertiary);
    transition: transform 0.2s ease;
    margin-right: 4px;
}

.dist-level-1.collapsed .arrow {
    transform: rotate(-90deg);
}

.dist-level-1 .name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dist-level-1 .select-all-btn-mini {
    flex-shrink: 0;
    font-size: 10px;
    padding: 2px 6px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    margin-left: 4px;
}

.dist-level-1 .select-all-btn-mini.all-selected {
    background: var(--accent);
    color: white;
}

.dist-level-2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px 6px 16px;
    background: var(--bg-soft);
    cursor: pointer;
    font-size: 11px;
    color: var(--text-secondary);
    -webkit-tap-highlight-color: transparent;
}

.dist-level-2:active {
    background: var(--bg-card);
}

.dist-level-2 .arrow {
    font-size: 9px;
    color: var(--text-tertiary);
    transition: transform 0.2s ease;
    margin-right: 4px;
}

.dist-level-2.collapsed .arrow {
    transform: rotate(-90deg);
}

.dist-level-2 .name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dist-level-2 .select-all-btn-mini {
    flex-shrink: 0;
    font-size: 10px;
    padding: 2px 5px;
    background: var(--bg);
    color: var(--text-secondary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}

.dist-level-2 .select-all-btn-mini.all-selected {
    background: var(--accent);
    color: white;
}

.dist-pending-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 8px 8px 28px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    height: 36px;
    line-height: 36px;
    box-sizing: border-box;
}

.dist-pending-item:active {
    background: var(--bg-card);
}

.dist-pending-item .check {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    flex-shrink: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dist-pending-item.selected .check {
    background: var(--accent);
    border-color: var(--accent);
}

.dist-pending-item.selected .check::after {
    content: '✓';
    color: white;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
}

.dist-pending-item.selected .name {
    color: var(--accent);
    font-weight: 500;
}

.dist-pending-item .name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dist-empty {
    text-align: center;
    padding: 32px 12px;
    color: var(--text-tertiary);
    font-size: 12px;
}

/* ===== 分配箭头按钮 ===== */
.dist-arrow-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.3);
    transition: all 0.2s ease;
}

.dist-arrow-btn:active:not(:disabled) {
    transform: scale(0.92);
}

.dist-arrow-btn:disabled {
    background: var(--bg-card);
    color: var(--text-tertiary);
    box-shadow: none;
    cursor: not-allowed;
}

.dist-arrow {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.dist-arrow-count {
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    margin-top: 1px;
}

/* ===== 空间Tab（第3列竖向）===== */
.dist-tab {
    padding: 10px 4px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: center;
    border-left: 2px solid transparent;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s ease;
    height: 44px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    word-break: break-all;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--bg-card);
}

.dist-tab.active {
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 600;
    background: var(--bg);
}

.dist-tab:active {
    background: var(--bg);
}

/* ===== 已分配列表 ===== */
.dist-assigned-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    font-size: 12px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--bg-card);
    height: 36px;
    box-sizing: border-box;
    line-height: 36px;
}

.dist-assigned-item .name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dist-assigned-item .remove {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-tertiary);
    border: none;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    line-height: 1;
}

/* ===== 步骤04 需求清单 两栏布局 ===== */
.list-two-col {
    /* 画框内自动填满中间空间 */
    flex: 1;
    min-height: 0;
    display: flex;
    background: var(--bg);
    overflow: hidden;
}

/* 左：空间Tab竖列 - 跟 step1 的"空间列"(17%)风格一致 */
.list-col-tabs {
    flex: 0 0 22%;
    max-width: 22%;
    height: 100%;              /* 关键:继承父容器高度,不撑开画框 */
    background: var(--bg-soft);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
}

.list-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    height: 50px;
    cursor: pointer;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--bg-card);
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
    margin: 0;
}

.list-tab.active {
    color: var(--accent);
    background: var(--bg);
    font-weight: 600;
}

.list-tab:active {
    background: var(--bg);
}

.list-tab .tab-name {
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
}

.list-tab .tab-count {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.list-tab.active .tab-count {
    color: var(--accent);
}

/* 右：内容区(已废弃,现在直接用 .list-col-body) */
.list-col-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* 小标题栏 - 跟顶栏风格一致,作为画框内的"第二段" */
.list-col-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--bg-card);
    min-height: 40px;     /* 比顶栏略矮,跟 step1 搜索栏接近 */
}

.list-current-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.list-current-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.list-col-body {
    flex: 1;
    min-height: 0;            /* 关键:允许收缩,不撑开父容器 */
    height: 100%;              /* 继承父容器高度 */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px;
}

/* 类型分组 */
.list-type-group {
    margin-bottom: 14px;
}

.list-type-title {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    padding-left: 2px;
}

.list-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.list-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: 14px;
    font-size: 12px;
    letter-spacing: -0.005em;
    height: 26px;
    box-sizing: border-box;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s ease;
}

.list-tag:active {
    transform: scale(0.95);
}

/* 重要度等级：0=默认 1=必备(绿) 2=重要(黄) 3=非常重要(红) */
.list-tag.level-1 {
    background: rgba(52, 199, 89, 0.15);
    color: #34C759;
    font-weight: 600;
}

.list-tag.level-2 {
    background: rgba(255, 184, 0, 0.18);
    color: #FF9500;
    font-weight: 600;
}

.list-tag.level-3 {
    background: rgba(255, 59, 48, 0.15);
    color: #FF3B30;
    font-weight: 600;
}

.list-tag.must {
    background: rgba(255, 149, 0, 0.12);
    color: #FF9500;
}

.list-tag.optional {
    background: rgba(0, 113, 227, 0.1);
    color: var(--accent);
}

/* 空状态 */
.list-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-tertiary);
    font-size: 13px;
}

/* ===== 保留旧的（图片导出用）===== */
.export-canvas {
    width: 600px;
    padding: 30px;
    background: white;
    font-family: var(--font);
}

.export-canvas-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1D1D1F;
}

.export-canvas-subtitle {
    font-size: 14px;
    color: #6E6E73;
    margin-bottom: 24px;
}

.export-canvas-space {
    margin-bottom: 20px;
}

.export-canvas-space-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1D1D1F;
    padding-bottom: 6px;
    border-bottom: 1px solid #E5E5E7;
}

.export-canvas-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.export-canvas-tag {
    padding: 6px 12px;
    background: #F5F5F7;
    color: #1D1D1F;
    border-radius: 14px;
    font-size: 14px;
}

.export-canvas-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #E5E5E7;
    text-align: center;
    font-size: 12px;
    color: #86868B;
}

/* ===== 步骤04 图片预览/导出 ===== */
/* 全屏遮罩 - 跳出画框,占满整个 viewport(跟画框分离) */
.export-preview {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-soft);     /* 灰底,跟首页卡片背景一致 */
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
    overflow: hidden;
}

/* 顶栏:只留关闭按钮 ×,不要"长按图片保存到相册"标题 */
.export-preview-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;     /* × 靠右 */
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top, 0));
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--bg-card);
}

.export-preview-title {
    display: none;             /* 隐藏标题 */
}

.export-preview-close {
    color: var(--accent);      /* 蓝色 ×,跟首页风格一致 */
    font-size: 22px;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.export-preview-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;           /* 不滚动,图片强制一屏装下 */
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;   /* 顶端对齐 */
    gap: 12px;
}

/* 图片+提示作为一个整体,贴在一起 */
.export-preview-body > * {
    margin: 0;
}

.export-preview-img {
    /* 关键:不管原图多长,强制等比缩到一屏内(同时限制宽和高) */
    max-width: 100%;
    max-height: 100%;               /* 底部提示已写入图片内,弹层不再占空间 */
    width: auto;
    height: auto;
    object-fit: contain;            /* 等比缩放,完整显示不裁切 */
    border-radius: 12px;
    background: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* 导出用的清单卡片（生成图片时用）*/
.export-canvas {
    width: 600px;
    padding: 30px;
    background: white;
    font-family: var(--font);
}

.export-canvas-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1D1D1F;
}

.export-canvas-subtitle {
    font-size: 14px;
    color: #6E6E73;
    margin-bottom: 24px;
}

.export-canvas-space {
    margin-bottom: 20px;
}

.export-canvas-space-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1D1D1F;
    padding-bottom: 6px;
    border-bottom: 1px solid #E5E5E7;
}

.export-canvas-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.export-canvas-tag {
    padding: 6px 12px;
    background: #F5F5F7;
    color: #1D1D1F;
    border-radius: 14px;
    font-size: 14px;
}

.export-canvas-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #E5E5E7;
    text-align: center;
    font-size: 12px;
    color: #86868B;
}