:root {
    color-scheme: light;
    --bg: #fbfbfb;
    --panel: #ffffff;
    --panel-soft: #fff8f8;
    --ink: #20242b;
    --text: #374151;
    --muted: #8a9099;
    --line: #e8e8ec;
    --line-strong: #dedfe5;
    --red: #ff4d57;
    --red-dark: #ef3d47;
    --red-soft: #fff0f0;
    --green: #27bd74;
    --green-soft: #eaf8f0;
    --orange: #ff9c32;
    --blue: #3478f6;
    --blue-soft: #eef5ff;
    --shadow: 0 18px 45px rgba(31, 35, 41, .05);
    --radius: 8px;
    --side: 250px;
    --rail: 285px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

h1,
h2,
h3,
p {
    margin: 0;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--side) minmax(0, 1fr);
}

.side-nav {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 14px;
    background: #ffffff;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.brand-block {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: block;
    object-fit: cover;
}

.brand-title {
    font-size: 18px;
    line-height: 1;
    font-weight: 900;
}

.nav-list {
    display: grid;
    gap: 10px;
}

.nav-item {
    width: 100%;
    height: 46px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 14px;
    color: #313740;
    font-size: 15px;
    font-weight: 650;
    text-align: left;
}

.nav-item:hover,
.nav-item.active {
    background: var(--red-soft);
    color: var(--red);
}

.team-card {
    margin-top: auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.team-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff7d86, #ffb2b7);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 12px;
}

.team-info {
    display: grid;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.team-info strong {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-info span {
    width: fit-content;
    padding: 2px 6px;
    border-radius: 6px;
    background: #fff1d7;
    color: #ff911a;
    font-size: 11px;
    font-weight: 800;
}

.team-space {
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    text-align: left;
}

.team-space span:nth-child(2) {
    flex: 1;
}

.main-area {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 76px;
    padding: 0 28px 0 38px;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.topbar h1 {
    font-size: 26px;
    line-height: 1.2;
    font-weight: 900;
}

.topbar p {
    margin-top: 7px;
    color: var(--muted);
    font-size: 14px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #5f6670;
}

.save-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #4f5964;
    font-size: 14px;
}

.save-state [data-icon] {
    color: var(--green);
}

.divider {
    width: 1px;
    height: 28px;
    background: var(--line);
}

.project-switch,
.export-button,
.avatar-button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: #2f3540;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 0 14px;
    font-weight: 700;
}

.project-switch {
    border-color: transparent;
}

.avatar-button {
    padding: 0 8px 0 0;
    border-color: transparent;
}

.avatar-button > span:first-child {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: linear-gradient(135deg, #d4a188, #95624d);
    font-weight: 900;
}

.page {
    display: none;
    padding: 20px 22px 32px;
}

.page.active {
    display: block;
}

.page-grid {
    display: grid;
    gap: 18px;
    align-items: start;
}

.create-grid,
.modify-grid,
.model-grid {
    grid-template-columns: minmax(0, 1fr) var(--rail);
}

.history-grid {
    grid-template-columns: 290px minmax(0, 1fr) var(--rail);
}

.primary-stack {
    display: grid;
    gap: 16px;
}

.step-panel,
.rail-card,
.history-list-panel,
.history-detail-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.step-panel {
    padding: 18px 20px;
}

.rail-card {
    padding: 18px;
}

.right-rail {
    display: grid;
    gap: 16px;
}

.step-head,
.section-title {
    margin-bottom: 16px;
}

.step-head,
.step-head > div,
.sub-step {
    display: flex;
    align-items: center;
    gap: 9px;
}

.step-head.between {
    justify-content: space-between;
    align-items: flex-start;
}

.step-head h2,
.section-title h2,
.rail-card h2,
.history-list-panel h2,
.history-detail-panel h2 {
    font-size: 18px;
    line-height: 1.35;
    font-weight: 900;
}

.section-title p,
.panel-note,
.rail-copy,
.sub-step p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.step-index {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border: 2px solid var(--red);
    color: var(--red);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 900;
}

.input-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 430px;
    gap: 28px;
}

.field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.field > span,
.segmented-field legend {
    color: #20242b;
    font-size: 14px;
    font-weight: 850;
}

.field-title-row {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.mini-text-button {
    min-height: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--red);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 850;
}

.field b,
.segmented-field b {
    color: var(--red);
}

.field input,
.field select,
.field textarea,
.model-select-card select {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    outline: none;
}

.field input,
.field select,
.model-select-card select {
    height: 46px;
    padding: 0 14px;
}

.field textarea {
    resize: vertical;
    min-height: 86px;
    padding: 13px 14px;
    line-height: 1.65;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.model-select-card select:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(255, 77, 87, .1);
}

.with-help {
    display: grid;
    grid-template-columns: minmax(0, 220px) 1fr;
    gap: 14px;
    align-items: center;
}

.with-help em {
    color: var(--muted);
    font-style: normal;
    font-size: 14px;
}

.reference-upload-block {
    margin: 4px 0 18px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffefe;
    display: grid;
    gap: 10px;
}

.reference-upload-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.reference-upload-head h3 {
    font-size: 16px;
    line-height: 1.35;
}

.reference-upload-head p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.reference-workbench {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
}

.reference-drop-zone {
    min-height: 78px;
    border: 1px dashed #ffc2c6;
    border-radius: 8px;
    background: #fff8f8;
    color: #5b6470;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 5px;
    text-align: center;
    outline: none;
}

.reference-slot-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.reference-slot-grid.small {
    grid-template-columns: repeat(2, minmax(0, 160px));
    justify-content: start;
}

.reference-slot {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: #ffffff;
    display: grid;
    gap: 7px;
    align-content: start;
}

.reference-slot.active {
    border-color: var(--red);
    box-shadow: 0 0 0 2px rgba(255, 77, 87, .1);
}

.reference-slot-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.reference-slot-title strong,
.reference-slot > strong {
    font-size: 13px;
}

.reference-slot-title .secondary-button {
    min-height: 28px;
    padding: 0 8px;
    font-size: 12px;
}

.reference-slot-body {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border: 1px dashed #ffc2c6;
    border-radius: 8px;
    background: #fff8f8;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    text-align: center;
    color: var(--muted);
    overflow: hidden;
    cursor: pointer;
}

.reference-slot-body em {
    font-style: normal;
    font-size: 12px;
}

.reference-slot-body img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.reference-slot-body .icon-button {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,.92);
}

.reference-analysis-grid {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
    min-height: 0;
}

.reference-analysis-card {
    position: relative;
    min-height: 118px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcff;
    padding: 10px 12px 40px;
    overflow: hidden;
}

.reference-analysis-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
}

.reference-analysis-card p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-line;
}

.reference-analysis-card .mini-text-button {
    position: absolute;
    right: 10px;
    bottom: 8px;
}

.analysis-preview-text {
    white-space: pre-line;
    line-height: 1.8;
    color: #2f3540;
}

.reference-drop-zone:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(255, 77, 87, .1);
}

.reference-drop-zone strong {
    color: #2f3540;
    font-size: 14px;
}

.reference-drop-zone em {
    color: var(--muted);
    font-style: normal;
    font-size: 12px;
}

.user-reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 92px);
    gap: 10px;
}

.user-reference-item {
    position: relative;
    width: 92px;
}

.user-reference-item img {
    width: 92px;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: zoom-in;
    display: block;
}

.user-reference-item .icon-button {
    position: absolute;
    right: 5px;
    top: 5px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, .92);
}

.reference-style-summary {
    padding: 10px 12px;
    border-radius: 8px;
    background: #f7f8fa;
    color: #5b6470;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.inline-check {
    margin: 0;
    white-space: nowrap;
}

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

.action-row.centered {
    justify-content: center;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.danger-lite-button,
.icon-button,
.text-button,
.full-line-button {
    border-radius: 8px;
    border: 1px solid transparent;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 18px;
    font-weight: 850;
    white-space: nowrap;
}

.primary-button {
    background: linear-gradient(135deg, #ff394a, #ff6064);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(255, 77, 87, .18);
}

.secondary-button {
    background: #ffffff;
    color: #2a3038;
    border-color: var(--line-strong);
}

.ghost-button {
    background: #f7f8fa;
    color: #4b5563;
    border-color: var(--line);
}

.danger-button {
    background: #fff7f7;
    color: var(--red);
    border-color: #ffd7d8;
}

.danger-lite-button {
    width: 100%;
    margin-top: 18px;
    background: #fff8f8;
    color: var(--red);
    border-color: #ffdada;
}

.icon-button {
    width: 38px;
    height: 38px;
    padding: 0;
    background: #ffffff;
    color: #2e3640;
    border-color: var(--line);
}

.text-button {
    min-height: auto;
    padding: 0;
    background: transparent;
    color: var(--muted);
}

.full-line-button {
    width: 100%;
    margin-top: 14px;
    background: #ffffff;
    color: #303640;
    border-color: var(--line);
}

.full-width {
    width: 100%;
    margin-bottom: 12px;
}

[data-icon],
.svg-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    flex: 0 0 auto;
}

.svg-icon {
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.empty-state {
    min-height: 150px;
}

.empty-box {
    width: 100%;
    min-height: 150px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    color: var(--muted);
    text-align: center;
    padding: 18px;
}

.empty-box [data-icon] {
    width: 30px;
    height: 30px;
}

.copy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
}

.copy-grid.empty-state,
.flow-board.empty-state,
.history-preview-grid.empty-state {
    grid-template-columns: 1fr;
}

.copy-card {
    position: relative;
    min-height: 210px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 12px;
}

.copy-card.is-working {
    overflow: hidden;
}

.copy-loading {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(3px);
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
}

.copy-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.copy-card-head h3 {
    font-size: 15px;
    line-height: 1.35;
    font-weight: 900;
}

.copy-badge {
    padding: 4px 7px;
    border-radius: 7px;
    background: var(--red-soft);
    color: var(--red);
    font-size: 12px;
    font-weight: 900;
}

.copy-card-body {
    color: #333a45;
    font-size: 14px;
    line-height: 1.72;
    white-space: pre-wrap;
}

.card-mini-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.card-mini-actions button {
    min-height: 36px;
}

.flow-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 38px;
    align-items: start;
    padding: 4px;
}

.flow-item {
    position: relative;
    display: grid;
    gap: 9px;
}

.flow-item:not(:last-child)::after {
    content: "→";
    position: absolute;
    right: -30px;
    top: 116px;
    color: #8f96a0;
    font-size: 28px;
}

.flow-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
    font-weight: 850;
}

.status-pill {
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: #f1f2f4;
    color: #858c96;
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 850;
}

.status-pill.ready {
    background: var(--green-soft);
    color: var(--green);
}

.status-pill.working {
    background: #fff4e5;
    color: var(--orange);
}

.status-pill.error {
    background: var(--red-soft);
    color: var(--red);
}

.image-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fbfbfc;
    display: grid;
    place-items: center;
}

.image-frame img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.image-frame.is-clickable {
    cursor: zoom-in;
}

.image-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 16px;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(4px);
    color: #2f3540;
    text-align: center;
}

.image-loading strong,
.batch-loading strong {
    font-size: 14px;
    font-weight: 900;
}

.image-loading em,
.batch-loading em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.loader {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid #ffdadd;
    border-top-color: var(--red);
    animation: spin .8s linear infinite;
}

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

.preview-modal {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    background: rgba(12, 16, 22, .92);
    box-shadow: none;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.preview-modal .modal-head {
    position: fixed;
    right: 18px;
    top: 18px;
    z-index: 3;
    padding: 0;
    border: 0;
    background: transparent;
}

.preview-modal .modal-head h2 {
    display: none;
}

.preview-modal .modal-head .icon-button {
    width: 42px;
    height: 42px;
    border-color: rgba(255, 255, 255, .3);
    background: rgba(255, 255, 255, .12);
    color: #ffffff;
}

.preview-modal .modal-body {
    padding: 0;
    width: 100vw;
    height: 100vh;
    display: grid;
    place-items: center;
}

.image-viewer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(0, 0, 0, .72);
    display: grid;
    place-items: center;
    padding: 22px;
}

.image-viewer-backdrop img {
    max-width: 94vw;
    max-height: 94vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 18px 70px rgba(0, 0, 0, .38);
    background: #ffffff;
}

.image-viewer-close {
    position: fixed;
    right: 20px;
    top: 20px;
    z-index: 81;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.32);
    background: rgba(255,255,255,.14);
    color: #ffffff;
    display: grid;
    place-items: center;
}

.image-preview {
    width: 100vw;
    height: 100vh;
    display: grid;
    place-items: center;
    background: transparent;
    border-radius: 0;
    padding: 0;
}

.image-preview img {
    max-width: 94vw;
    max-height: 94vh;
    object-fit: contain;
    border-radius: 8px;
    background: #ffffff;
}

.image-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    text-align: center;
    color: #999fa9;
    border: 1px dashed #cfd2d8;
    border-radius: 8px;
    padding: 16px;
    line-height: 1.55;
}

.flow-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.flow-actions .icon-button {
    width: 100%;
}

.continue-alert {
    margin: 16px 0;
    min-height: 40px;
    border-radius: 8px;
    background: var(--red-soft);
    color: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 850;
}

.model-select-card {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.model-select-card label {
    padding: 14px;
    display: grid;
    gap: 8px;
}

.model-select-card label + label {
    border-top: 1px solid var(--line);
}

.model-select-card label > span {
    font-size: 13px;
    font-weight: 850;
}

.progress-card {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 16px;
}

.progress-ring {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle closest-side, #fff 72%, transparent 73%),
        conic-gradient(var(--red) calc(var(--progress) * 1%), #eceef2 0);
    font-weight: 900;
}

.progress-card strong,
.progress-card span {
    display: block;
}

.progress-card strong {
    font-size: 17px;
    margin-bottom: 7px;
}

.progress-card span {
    color: var(--muted);
    font-size: 13px;
}

.rail-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.task-log {
    margin-top: 14px;
    display: grid;
    gap: 0;
}

.log-item {
    position: relative;
    display: grid;
    grid-template-columns: 24px 44px 1fr;
    gap: 9px;
    padding-bottom: 18px;
    color: #4b5563;
}

.log-item:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 21px;
    bottom: 0;
    width: 1px;
    background: #e1e3e8;
}

.log-dot {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .55);
}

.log-dot.orange {
    background: var(--orange);
}

.log-dot.gray {
    background: #c9ced6;
}

.log-time {
    color: #7b838e;
    font-size: 13px;
}

.log-main strong {
    display: block;
    font-size: 14px;
    line-height: 1.35;
}

.log-main span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.sub-step {
    align-items: flex-start;
    margin: 18px 0 14px;
}

.sub-step h3 {
    font-size: 17px;
    line-height: 1.35;
}

.reference-grid,
.target-grid {
    display: grid;
    gap: 16px;
}

.reference-grid {
    grid-template-columns: repeat(auto-fill, 150px);
}

.target-grid {
    grid-template-columns: repeat(auto-fill, 150px);
}

.thumb-choice,
.target-item {
    position: relative;
    display: grid;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #ffffff;
}

.thumb-choice:has(input:checked),
.target-item:has(input:checked) {
    border-color: var(--red);
    box-shadow: 0 0 0 1px var(--red);
}

.thumb-choice input,
.target-item input {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    width: 18px;
    height: 18px;
    accent-color: var(--red);
}

.thumb-choice span,
.target-item span {
    text-align: center;
    color: #2f3540;
    font-size: 14px;
    font-weight: 850;
}

.thumb-choice img,
.target-item img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 8px;
    background: #f4f5f7;
    cursor: zoom-in;
}

.target-item.is-disabled {
    opacity: .42;
}

.target-item.is-disabled::after {
    content: "不可选";
    position: absolute;
    left: 18px;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    min-height: 42px;
    border-radius: 8px;
    background: rgba(70, 74, 80, .58);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-weight: 900;
}

.target-tools {
    margin-bottom: 14px;
}

.preview-strip {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.batch-requirement-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 16px;
    align-items: start;
}

.batch-side-tools {
    display: grid;
    gap: 12px;
    align-self: stretch;
}

.mini-reference-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    display: grid;
    gap: 10px;
    background: #fffefe;
}

.mini-reference-panel > strong {
    font-size: 14px;
}

.mini-reference-preview {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.mini-reference-thumb {
    position: relative;
    display: grid;
    gap: 4px;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px;
    background: #ffffff;
}

.mini-reference-thumb.active {
    border-color: var(--red);
    box-shadow: 0 0 0 2px rgba(255, 77, 87, .1);
}

.mini-reference-thumb strong {
    color: #20242b;
    font-size: 12px;
}

.mini-reference-drop {
    position: relative;
    aspect-ratio: 3 / 4;
    border: 1px dashed #ffc2c6;
    border-radius: 8px;
    background: #fff8f8;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    overflow: hidden;
    cursor: pointer;
}

.mini-reference-drop em {
    font-style: normal;
    font-size: 12px;
}

.mini-reference-thumb img {
    width: 100%;
    height: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 0;
    border: 0;
    cursor: zoom-in;
}

.mini-reference-thumb .icon-button {
    position: absolute;
    top: 30px;
    right: 10px;
    width: 26px;
    height: 26px;
}

.batch-model-inline {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.batch-model-inline select {
    height: 40px;
    min-width: 190px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 0 12px;
    background: #ffffff;
    color: var(--ink);
}

.modal-reference-tools {
    display: grid;
    gap: 10px;
}

.modal-reference-tools h3 {
    font-size: 15px;
}

.modal-reference-tools p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.preview-strip h2 {
    font-size: 17px;
    margin-bottom: 12px;
}

.skeleton-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.skeleton-row div {
    height: 72px;
    border-radius: 8px;
    background: linear-gradient(90deg, #f4f5f7, #eef0f3, #f4f5f7);
}

.batch-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 150px);
    gap: 14px;
    align-items: start;
}

.batch-loading {
    grid-column: 1 / -1;
    min-height: 120px;
    padding: 18px;
    border: 1px dashed #ffc2c6;
    border-radius: 8px;
    background: #fff8f8;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    color: #2f3540;
    text-align: center;
}

.batch-result-item {
    display: grid;
    gap: 8px;
    text-align: center;
}

.batch-result-item img {
    width: 150px;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: zoom-in;
    background: #f4f5f7;
}

.batch-result-item strong {
    font-size: 14px;
}

.batch-result-item span {
    color: var(--muted);
    font-size: 12px;
}

.compact-empty {
    min-height: 120px;
}

.design-timeline {
    display: grid;
    gap: 14px;
    margin-top: 12px;
}

.design-step {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
}

.design-step .num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--red);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-weight: 900;
}

.design-step img {
    width: 72px;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.design-step strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.design-step span {
    color: var(--muted);
    font-size: 12px;
}

.history-list-panel,
.history-detail-panel {
    padding: 18px;
}

.record-list {
    margin-top: 16px;
    display: grid;
    gap: 12px;
}

.record-item {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    display: grid;
    gap: 10px;
}

.record-item.is-active {
    border-color: var(--red);
    background: linear-gradient(135deg, #fff7f7, #ffffff);
}

.record-item h3 {
    font-size: 15px;
    line-height: 1.5;
}

.record-item h3 span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.record-item p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

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

.record-actions button {
    min-height: 34px;
    padding: 0 12px;
}

.history-preview-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 18px;
}

.history-preview-item {
    display: grid;
    gap: 10px;
    text-align: center;
}

.history-preview-item img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.history-preview-item strong {
    font-size: 14px;
}

.history-preview-item span {
    color: var(--red);
    font-size: 13px;
    font-weight: 850;
}

.version-timeline {
    margin-top: 22px;
    display: grid;
    gap: 16px;
}

.version-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #ffffff;
}

.version-card h3 {
    margin-bottom: 12px;
    font-size: 16px;
}

.version-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 10px;
}

.version-thumb {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.version-thumb img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
}

.version-thumb button {
    width: 100%;
    min-height: 34px;
    border: 0;
    border-top: 1px solid var(--line);
    background: #ffffff;
    color: var(--red);
    font-size: 12px;
    font-weight: 850;
}

.export-panel {
    display: grid;
    gap: 14px;
}

.export-all {
    width: fit-content;
}

.export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.export-item {
    position: relative;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    display: grid;
    gap: 8px;
}

.export-item input {
    position: absolute;
    left: 12px;
    top: 12px;
    width: 18px;
    height: 18px;
    accent-color: var(--red);
}

.export-item img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 8px;
    background: #f4f5f7;
}

.export-item span {
    text-align: center;
    font-size: 13px;
    font-weight: 850;
}

.trace-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    color: #4b5563;
}

.trace-grid span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
}

.trace-grid i {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--green);
}

.model-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 24px;
}

.model-form .notes-field,
.model-form .segmented-field,
.model-form .check-row,
.model-form .action-row {
    grid-column: 1 / -1;
}

.segmented-field {
    margin: 0 0 16px;
    padding: 0;
    border: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.segmented-field legend {
    grid-column: 1 / -1;
    margin-bottom: 8px;
}

.segmented-field label {
    height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #3a414c;
}

.segmented-field label:has(input:checked) {
    border-color: var(--red);
    background: var(--red-soft);
    color: var(--red);
}

.segmented-field input {
    display: none;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-bottom: 16px;
}

.check-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #4b5563;
    font-size: 14px;
    font-weight: 700;
}

.check-field input {
    width: 18px;
    height: 18px;
    accent-color: var(--red);
}

.models-table {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.model-row {
    display: grid;
    grid-template-columns: minmax(200px, 1.2fr) 110px minmax(110px, .7fr) 90px minmax(130px, .8fr) 150px;
    gap: 14px;
    align-items: center;
    min-height: 66px;
    padding: 0 14px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.model-row:last-child {
    border-bottom: 0;
}

.model-row.header {
    min-height: 48px;
    background: #fbfbfc;
    color: #5b6470;
    font-size: 13px;
    font-weight: 850;
}

.model-name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.model-logo {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: block;
    overflow: hidden;
    flex: 0 0 auto;
}

.model-logo img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.model-name strong,
.model-name span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-name strong {
    font-size: 14px;
}

.model-name span,
.model-row code {
    color: var(--muted);
    font-size: 12px;
}

.model-badge,
.mini-flag {
    width: fit-content;
    min-height: 24px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    border-radius: 6px;
    background: var(--red-soft);
    color: var(--red);
    font-size: 12px;
    font-weight: 850;
}

.model-badge.image {
    background: var(--blue-soft);
    color: var(--blue);
}

.mini-flag.green {
    background: var(--green-soft);
    color: var(--green);
}

.mini-flag.orange {
    background: #fff4e6;
    color: var(--orange);
}

.model-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.model-actions button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
}

.default-models {
    margin-top: 14px;
    display: grid;
    gap: 12px;
}

.default-model {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
}

.default-model span {
    color: #4b5563;
    font-size: 13px;
    font-weight: 850;
}

.default-model strong {
    font-size: 15px;
}

.status-metrics {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}

.status-metrics span {
    color: #5c6672;
    font-size: 14px;
}

.status-metrics strong {
    color: #2a3038;
    font-size: 16px;
}

.status-metrics .green {
    color: var(--green);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    padding: 20px;
    background: rgba(21, 26, 34, .42);
    display: grid;
    place-items: center;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal {
    width: min(640px, 100%);
    max-height: min(760px, calc(100vh - 40px));
    overflow: auto;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .22);
}

.modal-head,
.modal-actions {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.modal-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--line);
    border-bottom: 0;
}

.modal-body {
    padding: 16px;
    display: grid;
    gap: 14px;
}

.toast-stack {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 40;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 36px));
}

.toast {
    padding: 12px 14px;
    border-radius: 8px;
    color: #ffffff;
    background: #242a33;
    box-shadow: var(--shadow);
    line-height: 1.45;
    font-size: 13px;
}

.toast.good {
    background: var(--green);
}

.toast.warn {
    background: #bd741f;
}

.toast.bad {
    background: var(--red-dark);
}

@media (max-width: 1260px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .side-nav {
        position: static;
        height: auto;
        padding: 14px;
    }

    .nav-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .team-card,
    .team-space {
        display: none;
    }

    .create-grid,
    .modify-grid,
    .model-grid,
    .history-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 800px) {
    .topbar {
        position: static;
        height: auto;
        padding: 16px;
        display: grid;
    }

    .top-actions,
    .input-grid,
    .model-form,
    .segmented-field,
    .model-row,
    .model-row.header,
    .with-help,
    .reference-workbench,
    .reference-slot-grid,
    .batch-requirement-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .page {
        padding: 14px;
    }

    .nav-list {
        grid-template-columns: 1fr 1fr;
    }

    .flow-item:not(:last-child)::after {
        display: none;
    }

    .primary-button,
    .secondary-button,
    .ghost-button,
    .danger-button {
        width: 100%;
    }
}
