/*
 * create-analysis.css — white-themed module creation page
 * TF-040 Phase 1.  Follows the marketing site's Geist + #C65000 palette.
 */

/* ───── Main + layout ───── */
.ca-main {
    min-height: calc(100vh - 200px);
    background: #ffffff;
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #1a1a2e;
}

.ca-state {
    display: none;
}
.ca-state.active {
    display: block;
}

.ca-wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

/* ───── Loading ───── */
.ca-spinner-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 16px;
    color: #64748b;
}
.ca-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #f1f5f9;
    border-top-color: #C65000;
    border-radius: 50%;
    animation: ca-spin 0.7s linear infinite;
}
@keyframes ca-spin {
    to { transform: rotate(360deg); }
}

/* ───── Hero (pre-auth) ───── */
.ca-hero {
    background: linear-gradient(180deg, #fff7ed 0%, #ffffff 100%);
    padding: 80px 24px 60px;
    border-bottom: 1px solid #f1f5f9;
}
.ca-hero-inner {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}
.ca-kicker {
    font-family: 'Geist Mono', monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #C65000;
    margin-bottom: 16px;
}
.ca-hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: #1a1a2e;
    margin: 0 0 20px;
}
.ca-hero-subtitle {
    font-size: 1.1rem;
    line-height: 1.55;
    color: #475569;
    margin: 0 0 36px;
}
.ca-hero-features {
    list-style: none;
    padding: 0;
    margin: 0 0 40px;
    text-align: left;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}
.ca-hero-features li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 0.92rem;
    line-height: 1.5;
    color: #334155;
}
.ca-feat-icon {
    color: #C65000;
    font-weight: 700;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}
.ca-hero-cta {
    margin-top: 32px;
}
.ca-hero-cta-note {
    font-size: 0.8rem;
    color: #64748b;
    margin: 12px 0 0;
}
.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
}

/* ───── Proof strip ───── */
.ca-proof {
    padding: 60px 24px 80px;
    background: #fafbfc;
}
.ca-proof-inner {
    max-width: 1080px;
    margin: 0 auto;
}
.ca-proof-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 4px;
    text-align: center;
}
.ca-proof-sub {
    font-size: 0.92rem;
    color: #64748b;
    margin: 0 0 32px;
    text-align: center;
}
.ca-proof-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.ca-proof-card {
    display: block;
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.ca-proof-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    border-color: #C65000;
}
.ca-proof-card-label {
    font-family: 'Geist Mono', monospace;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #C65000;
    margin-bottom: 8px;
}
.ca-proof-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 16px;
    line-height: 1.35;
}
.ca-proof-card-foot {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

/* ───── Stepper ───── */
.ca-stepper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 24px 0 36px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 32px;
}
.ca-step {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.15s;
}
.ca-step.active,
.ca-step.done {
    opacity: 1;
}
.ca-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ca-step.active .ca-step-num {
    background: #C65000;
    color: #fff;
}
.ca-step.done .ca-step-num {
    background: #10b981;
    color: #fff;
}
.ca-step-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: #334155;
    white-space: nowrap;
}
.ca-step-sep {
    flex: 1;
    min-width: 20px;
    height: 1px;
    background: #e5e7eb;
}

/* ───── Panels ───── */
.ca-step-panel {
    padding-bottom: 60px;
}
.ca-panel-head {
    margin-bottom: 32px;
}
.ca-panel-head h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
}
.ca-panel-head p {
    font-size: 0.98rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}
.ca-panel-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #f1f5f9;
}
.ca-panel-actions > :only-child {
    margin-left: auto;
}
.btn-ghost {
    background: transparent;
    color: #64748b;
    border: 1px solid transparent;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.btn-ghost:hover {
    background: #f8fafc;
    color: #1a1a2e;
}

/* ───── Step 1 — mode toggle ───── */
.ca-mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 28px;
}
.ca-mode-tab {
    text-align: left;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
}
.ca-mode-tab:hover {
    border-color: #C65000;
}
.ca-mode-tab.active {
    border-color: #C65000;
    background: #fff7ed;
    box-shadow: 0 0 0 3px rgba(198, 80, 0, 0.08);
}
.ca-mode-tab strong {
    display: block;
    font-size: 0.95rem;
    color: #1a1a2e;
    margin-bottom: 2px;
}
.ca-mode-tab span {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
}

/* ───── Patterns gallery ───── */
.ca-patterns {
    padding: 20px;
    background: #fafbfc;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    margin-bottom: 20px;
}
.ca-patterns-head {
    margin-bottom: 14px;
}
.ca-patterns-head strong {
    display: block;
    font-size: 0.95rem;
    color: #1a1a2e;
    margin-bottom: 2px;
}
.ca-patterns-head span {
    display: block;
    font-size: 0.82rem;
    color: #64748b;
}
.ca-patterns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}
.ca-pattern-card {
    text-align: left;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, transform 0.15s;
}
.ca-pattern-card:hover {
    border-color: #C65000;
    transform: translateY(-1px);
}
.ca-pattern-card.selected {
    border-color: #C65000;
    background: #fff7ed;
}
.ca-pattern-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 2px;
}
.ca-pattern-slots {
    font-family: 'Geist Mono', monospace;
    font-size: 0.72rem;
    color: #C65000;
    margin-bottom: 4px;
}
.ca-pattern-desc {
    font-size: 0.76rem;
    color: #64748b;
    line-height: 1.4;
}

/* ───── Slots ───── */
.ca-slots {
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}
.ca-slots-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}
.ca-slots-head strong {
    font-size: 0.95rem;
    color: #1a1a2e;
}
.ca-slot {
    display: grid;
    grid-template-columns: 140px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f8fafc;
}
.ca-slot:last-child {
    border-bottom: 0;
}
.ca-slot-name {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ca-slot-name-label {
    font-family: 'Geist Mono', monospace;
    font-size: 0.82rem;
    color: #C65000;
    font-weight: 600;
}
.ca-slot-name-edit {
    padding: 4px 6px;
    font-size: 0.78rem;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-family: 'Geist Mono', monospace;
    color: #C65000;
    width: 100%;
}
.ca-slot-ds-select {
    padding: 8px 10px;
    font-size: 0.88rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    font-family: inherit;
    width: 100%;
}
.ca-slot-ds-select:focus,
.ca-slot-name-edit:focus {
    outline: none;
    border-color: #C65000;
}
.ca-slot-upload {
    padding: 8px 12px;
    font-size: 0.8rem;
    border: 1px dashed #e5e7eb;
    border-radius: 6px;
    background: #fafbfc;
    cursor: pointer;
    color: #64748b;
    white-space: nowrap;
}
.ca-slot-upload:hover {
    border-color: #C65000;
    color: #C65000;
}
.ca-slot-remove {
    background: transparent;
    border: 0;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
}
.ca-slot-remove:hover {
    color: #ef4444;
}
.ca-slot-add {
    margin-top: 12px;
    padding: 8px 16px;
    background: transparent;
    border: 1px dashed #e5e7eb;
    border-radius: 6px;
    color: #64748b;
    font-size: 0.82rem;
    cursor: pointer;
    font-family: inherit;
}
.ca-slot-add:hover {
    border-color: #C65000;
    color: #C65000;
}
.ca-slots-hint {
    margin-top: 16px;
    padding: 10px 14px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #9a3412;
    line-height: 1.4;
}

/* Responsive slot layout */
@media (max-width: 640px) {
    .ca-slot { grid-template-columns: 1fr; }
    .ca-mode-toggle { grid-template-columns: 1fr; }
}

/* ───── Step 1 — dataset ───── */
.ca-ds-picker {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 24px;
    align-items: stretch;
    margin-bottom: 24px;
}
.ca-ds-upload {
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: #fafbfc;
}
.ca-ds-upload:hover,
.ca-ds-upload.dragover {
    border-color: #C65000;
    background: #fff7ed;
}
.ca-ds-upload-icon {
    font-size: 2rem;
    color: #C65000;
    margin-bottom: 12px;
}
.ca-ds-upload-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ca-ds-upload-text strong {
    font-size: 1rem;
    color: #1a1a2e;
}
.ca-ds-upload-text span {
    font-size: 0.85rem;
    color: #64748b;
}
.ca-ds-or {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.ca-ds-existing {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    padding: 24px;
    background: #fafbfc;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
}
.ca-ds-existing label {
    font-size: 0.85rem;
    color: #334155;
    font-weight: 500;
}
.ca-ds-existing select {
    padding: 10px 12px;
    font-size: 0.9rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    color: #1a1a2e;
    font-family: inherit;
}
.ca-ds-existing select:focus {
    outline: none;
    border-color: #C65000;
}

.ca-ds-selected {
    padding: 20px 24px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 10px;
}
.ca-ds-selected-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.ca-ds-selected-head strong {
    color: #065f46;
    font-size: 1rem;
}
.ca-ds-selected-meta {
    font-size: 0.82rem;
    color: #047857;
}
.ca-link {
    background: transparent;
    border: 0;
    color: #C65000;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

/* ───── Step 2 — chat draft ───── */
.ca-chat-wrap {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 20px;
    height: 580px;
    min-height: 480px;
}
.ca-chat {
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}
.ca-chat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(180deg, #fff7ed 0%, #fff 100%);
}
.ca-chat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #C65000;
    box-shadow: 0 0 8px rgba(198, 80, 0, 0.5);
}
.ca-chat-head span:nth-of-type(1) {
    font-weight: 600;
    color: #C65000;
    font-size: 0.9rem;
}
.ca-chat-hint {
    margin-left: auto;
    font-size: 0.72rem;
    color: #94a3b8;
}
.ca-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ca-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.92rem;
    line-height: 1.5;
    white-space: pre-wrap;
}
.ca-msg-assistant {
    background: #f8fafc;
    color: #1a1a2e;
    align-self: flex-start;
    border: 1px solid #f1f5f9;
}
.ca-msg-user {
    background: #C65000;
    color: #fff;
    align-self: flex-end;
}
.ca-chat-input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
}
.ca-chat-input-row input {
    flex: 1;
    padding: 10px 14px;
    font-size: 0.92rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    font-family: inherit;
}
.ca-chat-input-row input:focus {
    outline: none;
    border-color: #C65000;
}

/* ───── Step 2 — progress sidebar ───── */
.ca-progress {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    background: #fafbfc;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
}
.ca-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    font-weight: 600;
}
.ca-progress-pct {
    color: #C65000;
    font-size: 0.82rem;
}
.ca-progress-ring-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}
.ca-progress-ring {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
}
.ca-ring-bg {
    fill: none;
    stroke: #f1f5f9;
    stroke-width: 6;
}
.ca-ring-fg {
    fill: none;
    stroke: #C65000;
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.4s ease;
}
.ca-progress-center {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ca-progress-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1a1a2e;
}
.ca-progress-fields {
    font-size: 0.78rem;
    color: #64748b;
}
.ca-next-hint {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    padding: 10px 12px;
}
.ca-next-hint-label {
    font-size: 0.62rem;
    color: #C65000;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 2px;
}
.ca-next-hint-text {
    font-size: 0.82rem;
    color: #1a1a2e;
    line-height: 1.4;
}
.ca-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ca-checklist li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #64748b;
}
.ca-checklist li.done {
    color: #065f46;
}
.ca-checklist-mark {
    width: 14px;
    text-align: center;
    color: #cbd5e1;
}
.ca-checklist li.done .ca-checklist-mark {
    color: #10b981;
}

/* ───── Step 3 — column mapping ───── */
.ca-mapping {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}
.ca-mapping-loading {
    padding: 40px;
    text-align: center;
    color: #64748b;
}
.ca-map-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}
.ca-map-row:last-child {
    border-bottom: 0;
}
.ca-map-row:nth-child(odd) {
    background: #fafbfc;
}
.ca-map-semantic {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ca-map-semantic strong {
    font-family: 'Geist Mono', monospace;
    font-size: 0.88rem;
    color: #C65000;
}
.ca-map-semantic span {
    font-size: 0.78rem;
    color: #64748b;
}
.ca-map-arrow {
    color: #cbd5e1;
    font-size: 1.2rem;
}
.ca-map-real select {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.88rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    font-family: inherit;
}
.ca-map-real select:focus {
    outline: none;
    border-color: #C65000;
}

/* ───── Step 4 — review ───── */
.ca-review {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.ca-review-block {
    background: #fafbfc;
    border: 1px solid #f1f5f9;
    border-radius: 10px;
    padding: 20px 24px;
}
.ca-review-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 6px;
}
.ca-review-value {
    font-size: 0.98rem;
    color: #1a1a2e;
    line-height: 1.5;
}
.ca-review-value code {
    font-family: 'Geist Mono', monospace;
    font-size: 0.88rem;
    background: #fff;
    padding: 1px 6px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}

/* ───── Submitting ───── */
.ca-submitting {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    gap: 20px;
    color: #64748b;
}

/* ───── Success ───── */
.ca-success {
    text-align: center;
    padding: 60px 24px;
    max-width: 600px;
    margin: 0 auto;
}
.ca-success-check {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    border-radius: 50%;
    background: #10b981;
    color: #fff;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ca-success h2 {
    font-size: 1.75rem;
    color: #1a1a2e;
    margin: 0 0 12px;
}
.ca-success p {
    font-size: 1rem;
    color: #475569;
    line-height: 1.5;
    margin: 0 0 20px;
}
.ca-success code {
    font-family: 'Geist Mono', monospace;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.88rem;
    color: #C65000;
}
.ca-success-meta {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin: 20px 0 32px;
    font-size: 0.88rem;
    color: #64748b;
}
.ca-success-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ───── Error banner ───── */
.ca-error {
    position: fixed;
    bottom: 20px;
    right: 20px;
    max-width: 360px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 16px 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    z-index: 100;
}
.ca-error-head {
    font-weight: 600;
    color: #991b1b;
    margin-bottom: 4px;
    font-size: 0.9rem;
}
.ca-error-body {
    font-size: 0.85rem;
    color: #7f1d1d;
    line-height: 1.45;
    margin-bottom: 8px;
}
#ca-error-dismiss {
    color: #991b1b;
}

/* ───── Fatal error state ───── */
.ca-fatal {
    max-width: 480px;
    margin: 80px auto;
    text-align: center;
    padding: 40px 24px;
}
.ca-fatal h2 {
    font-size: 1.5rem;
    color: #1a1a2e;
    margin: 0 0 12px;
}
.ca-fatal p {
    color: #64748b;
    margin: 0 0 24px;
    line-height: 1.5;
}

/* ───── Responsive ───── */
@media (max-width: 768px) {
    .ca-hero-title { font-size: 1.75rem; }
    .ca-hero-features { grid-template-columns: 1fr; }
    .ca-ds-picker { grid-template-columns: 1fr; }
    .ca-ds-or { padding: 8px 0; }
    .ca-chat-wrap { grid-template-columns: 1fr; height: auto; }
    .ca-chat { min-height: 400px; }
    .ca-stepper { flex-wrap: wrap; gap: 6px; padding: 16px 0 24px; }
    .ca-step-sep { display: none; }
    .ca-step { flex: 1; min-width: 140px; }
    .ca-map-row { grid-template-columns: 1fr; gap: 8px; }
    .ca-map-arrow { display: none; }
}
