/* ===== 应用外壳：左侧栏（菜单+历史） + 右侧主区 ===== */
/* ========== 应用主体：左侧栏（菜单+历史） + 右侧主区 ========== */
.app-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ---------- 左侧栏 ---------- */
.app-sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--card-bg);
    border-right: 2px solid var(--border-light);
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 12px;
    flex-shrink: 0;
}

.sidebar-menu-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    text-align: left;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-menu-item svg {
    flex-shrink: 0;
    opacity: 0.85;
}

.sidebar-menu-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* 选中态用浅色卡片 + 左侧指示条，避免与青绿生成按钮撞色 */
.sidebar-menu-item.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(61, 52, 40, 0.10);
}

.sidebar-menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-menu-item.active svg {
    opacity: 1;
}

.sidebar-menu-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-btn);
    font-size: 10px;
    font-weight: 800;
}

.sidebar-menu-item.active .sidebar-menu-badge {
    background: var(--primary);
    color: #fff;
}

/* 侧栏内的历史记录：融入侧栏，不再是独立卡片 */
.app-sidebar .history-sidebar {
    display: flex;
    width: auto;
    height: auto;
    flex: 1;
    min-height: 0;
    border: none;
    border-radius: 0;
    border-top: 1.5px solid var(--border-light);
    box-shadow: none;
    background: transparent;
}

.app-sidebar .history-sidebar-header {
    padding: 12px 16px 10px;
    border-bottom: none;
    color: var(--text-secondary);
    font-size: 12px;
}

.app-sidebar .history-sidebar-body {
    padding: 0 10px 12px;
}

/* ---------- 右侧主区 ---------- */
.app-main {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.app-main .main-container {
    max-width: none;
    margin: 0;
    height: 100%;
    padding: 14px;
}

/* 高度链路：主区 → 视图 → 容器 → 左右两栏，必须逐层 100% 才能撑满视口 */
.app-main .module-view.is-active {
    height: 100%;
}

.app-main .right-panel {
    height: 100%;
}

/* 右栏已有确定高度，去掉固定最小高度，避免矮视口下溢出被裁 */
.app-main .result-card {
    min-height: 0;
}

/* ---------- 顶栏模型标识 ---------- */
.header-model {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--bg);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-btn);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

.header-model .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(111, 186, 44, 0.16);
}

.header-model b {
    color: var(--text-heading);
}

/* ---------- 卡片标题右侧操作按钮 ---------- */
.card-header-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    padding: 4px 11px;
    border: none;
    background: var(--primary-light);
    color: var(--primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.card-header-action:hover:not(:disabled) {
    background: var(--primary);
    color: #fff;
}

.card-header-action:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ---------- 选项按钮组（比例 / 数量） ---------- */
.opt-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.opt-btn {
    min-width: 46px;
    padding: 6px 8px;
    border: 1.5px solid var(--border-light);
    background: var(--bg);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.opt-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.opt-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 0 0 var(--primary-3d);
}

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

/* 数量按钮更紧凑，保证与分辨率并排时一行放得下 */
.opt-grid-compact .opt-btn {
    min-width: 38px;
    padding: 6px 6px;
}

/* 原生下拉退居幕后，仅作为数据源，界面用按钮组呈现 */
.select-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

/* ---------- 结果区头部 ---------- */
.result-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.result-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.result-header-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-heading);
}

.result-header-sub {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.new-creation-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid var(--ds-line-strong);
    border-radius: 10px;
    color: var(--ds-primary);
    background: var(--ds-surface);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition:
        color var(--ds-ease),
        border-color var(--ds-ease),
        background-color var(--ds-ease);
}

.new-creation-btn:hover {
    border-color: #a8d7ce;
    color: var(--ds-primary-hover);
    background: var(--ds-primary-soft);
}

.new-creation-btn:active {
    background: #d4ece7;
}

.new-creation-btn[hidden] {
    display: none;
}

@media (max-width: 768px) {
    .new-creation-btn {
        min-height: 44px;
        padding: 0 11px;
        font-size: 12px;
    }
}

/* ---------- 空状态三步引导 ---------- */
.empty-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 580px;
    margin-top: 20px;
}

.empty-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 16px 12px;
    background: var(--card-bg);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    text-align: center;
}

.empty-step-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 11px;
}

.empty-step-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-heading);
}

.empty-step-desc {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* 视图容器 */
.module-view {
    display: none;
}

.module-view.is-active {
    display: block;
}

