:root {
    --ui-ink: #102a2e;
    --ui-ink-soft: #315156;
    --ui-muted: #6f8588;
    --ui-canvas: #eef4f2;
    --ui-surface: #ffffff;
    --ui-surface-soft: #f6faf9;
    --ui-line: #d7e3e1;
    --ui-line-strong: #bdd2ce;
    --ui-teal: #087f75;
    --ui-teal-dark: #075f59;
    --ui-teal-soft: #e2f5f1;
    --ui-navy: #102039;
    --ui-cyan: #38bdb2;
    --ui-amber: #c9770a;
    --ui-red: #c9414a;
    --ui-green: #16835e;
    --ui-shadow-xs: 0 1px 2px rgba(16, 42, 46, .04);
    --ui-shadow-sm: 0 8px 24px rgba(16, 42, 46, .07);
    --ui-shadow-md: 0 18px 48px rgba(16, 42, 46, .1);
    --ui-radius-sm: 8px;
    --ui-radius: 12px;
    --ui-radius-lg: 18px;
}

html { background: var(--ui-canvas); }
body {
    color: var(--ui-ink);
    background:
        radial-gradient(circle at 86% 4%, rgba(56, 189, 178, .1), transparent 26rem),
        var(--ui-canvas);
    font-feature-settings: "ss01" 1, "cv02" 1;
}
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible,
a:focus-visible,
summary:focus-visible,
.workflow-mode-radio:focus-visible + .workflow-mode-btn,
.workflow-step-radio:focus-visible + .workflow-step-tab {
    outline: 3px solid rgba(8,127,117,.28);
    outline-offset: 2px;
}
::selection { color: #fff; background: var(--ui-teal); }

.container { background: transparent; box-shadow: none; }
.header {
    min-height: 122px;
    padding: 1.4rem 2.2rem;
    background:
        linear-gradient(100deg, rgba(8, 127, 117, .11), transparent 42%),
        linear-gradient(135deg, #0b1729 0%, #142a48 54%, #102039 100%);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.header::before {
    background:
        linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
        linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
        radial-gradient(circle at 78% 0%, rgba(56,189,178,.2), transparent 34%);
    background-size: 34px 34px, 34px 34px, auto;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    max-width: none;
    text-align: left;
}
.header-brand-lockup { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.header-mark {
    display: grid;
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    place-items: center;
    border: 1px solid rgba(94,234,212,.45);
    border-radius: 14px;
    color: #d7fffa;
    background: linear-gradient(145deg, rgba(13,148,136,.45), rgba(15,118,110,.14));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 12px 32px rgba(0,0,0,.18);
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .04em;
}
.header-copy { min-width: 0; }
.header .header-badge { margin: 0 0 .22rem; color: #5eead4; font-size: .64rem; letter-spacing: .16em; }
.header h1 { margin: 0; font-size: clamp(1.55rem, 2.5vw, 2.25rem); line-height: 1.08; }
.header-tagline { max-width: 620px; margin: .35rem 0 0; color: #b7c7da; font-size: .78rem; font-weight: 500; }
.header-product-meta { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: .48rem; }
.header-product-meta span {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    padding: .42rem .65rem;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
    color: #c7d4e4;
    background: rgba(255,255,255,.05);
    font-size: .63rem;
    font-weight: 700;
    white-space: nowrap;
}
.header-meta-dot { width: 6px; height: 6px; border-radius: 50%; background: #2dd4bf; box-shadow: 0 0 0 3px rgba(45,212,191,.15); }

.content { grid-template-columns: minmax(430px, 500px) minmax(0, 1fr); min-height: calc(100vh - 122px); }
.sidebar,
.main-content {
    height: calc(100vh - 122px);
    scrollbar-width: thin;
    scrollbar-color: #aabfbc transparent;
}
.sidebar {
    position: relative;
    padding: 1.35rem 1.25rem 2.5rem;
    border-right: 1px solid var(--ui-line);
    background:
        linear-gradient(180deg, rgba(255,255,255,.86), rgba(246,250,249,.96)),
        var(--ui-surface-soft);
}
.main-content {
    padding: 1.7rem clamp(1.3rem, 2.4vw, 2.6rem) 3rem;
    background:
        radial-gradient(circle at 100% 0%, rgba(56,189,178,.055), transparent 30rem),
        #fbfdfc;
}
.sidebar::-webkit-scrollbar, .main-content::-webkit-scrollbar { width: 9px; }
.sidebar::-webkit-scrollbar-thumb, .main-content::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 99px; background: #aabfbc; background-clip: content-box; }

.form-section {
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius);
    background: rgba(255,255,255,.86);
    box-shadow: var(--ui-shadow-xs);
}
.form-section:last-child { border-bottom: 1px solid var(--ui-line); }
.form-section > h3,
.workflow-steps-title { margin: 0 0 .75rem !important; color: var(--ui-ink); font-size: .78rem; letter-spacing: .01em; }
.workflow-mode-section { padding: .85rem; background: #f4f8f7; }
.workflow-mode-section > h3 { color: var(--ui-muted); font-size: .65rem; text-transform: uppercase; letter-spacing: .1em; }
.workflow-mode-toggle { margin: 0; border-color: var(--ui-line-strong); border-radius: 10px; box-shadow: none; background: #fff; }
.workflow-mode-btn { min-height: 42px; color: var(--ui-ink-soft); background: transparent; font-size: .75rem; }
.workflow-mode-btn.active { color: #fff; background: var(--ui-navy); box-shadow: 0 6px 18px rgba(16,32,57,.14); }
#workflowModeHelp { margin: .55rem .15rem 0; font-size: .66rem; }

#workflowStepsSection { padding: .9rem; }
.workflow-step-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .38rem; margin: 0 0 .75rem; }
.workflow-step-tab {
    position: relative;
    min-height: 63px;
    padding: .55rem .35rem .45rem;
    border-color: var(--ui-line);
    border-radius: 10px;
    color: var(--ui-muted);
    background: #fff;
    font-size: .64rem;
    text-align: left;
    overflow: hidden;
}
.workflow-step-tab::before {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 3px;
    background: transparent;
}
.workflow-step-tab .step-label { margin-top: .16rem; color: inherit; font-size: .61rem; font-weight: 700; line-height: 1.22; }
.workflow-step-tab:hover { border-color: #86bdb7; color: var(--ui-teal-dark); background: #f2fbf9; }
.workflow-step-tab.active { border-color: var(--ui-navy); color: #fff; background: var(--ui-navy); box-shadow: 0 8px 20px rgba(16,32,57,.13); }
.workflow-step-tab.active::before { background: #40d8c7; }
.workflow-step-tab.complete:not(.active) { color: var(--ui-teal-dark); border-color: #afd8d2; background: #edfaf7; }
.workflow-step-tab.complete:not(.active)::after { content: '✓'; position: absolute; top: .35rem; right: .42rem; color: var(--ui-green); font-size: .62rem; font-weight: 900; }
.workflow-step-help { min-height: 2.1em; margin: 0 .15rem; color: var(--ui-muted); font-size: .66rem; }

.workflow-data-context {
    padding: 0;
    border-color: #b8d8d3;
    overflow: hidden;
    background: #fff;
}
.workflow-data-context > summary {
    min-height: 52px;
    padding: .85rem 1rem;
    color: var(--ui-ink);
    background: linear-gradient(90deg, #eaf8f5, #f6fbfa);
    font-size: .77rem;
}
.workflow-data-context__help { margin: .8rem 1rem .7rem; color: var(--ui-muted); font-size: .67rem; }
.workflow-step0-purpose {
    display: grid;
    gap: .18rem;
    margin: .85rem 1rem .75rem;
    padding: .72rem .8rem;
    border-left: 3px solid var(--ui-teal);
    border-radius: 8px;
    color: var(--ui-muted);
    background: #effaf7;
    font-size: .65rem;
    line-height: 1.48;
}
.workflow-step0-purpose strong { color: var(--ui-ink-soft); font-size: .69rem; }
.workflow-step0-grid { padding: 0 1rem .75rem; gap: .65rem; }
.workflow-step0-optional { margin: 0 1rem .85rem; }
#workflowDataContextBody {
    display: grid;
    gap: .65rem;
    margin: 0 1rem .9rem;
}
#workflowDataContextBody > .phase3-details,
#workflowDataContextBody > .integrated-input-group { margin: 0; }
#workflowDataContextBody > .phase3-details > .form-group { margin: .7rem .8rem; }
.step0-profile-summary {
    display: grid;
    gap: .48rem;
    margin: .15rem .8rem .8rem;
    padding: .72rem .78rem;
    border: 1px solid #cce2de;
    border-radius: 9px;
    color: var(--ui-muted);
    background: linear-gradient(120deg, #f0faf8, #fff);
    font-size: .64rem;
    line-height: 1.45;
}
.step0-profile-summary > strong { color: var(--ui-ink-soft); font-size: .7rem; }
.step0-profile-summary > span { color: var(--ui-muted); }
.step0-profile-summary__header { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.step0-profile-summary__header > div { display: grid; gap: .12rem; }
.step0-profile-summary__header strong { color: var(--ui-ink); font-size: .72rem; }
.step0-profile-summary__header span { color: var(--ui-muted); font-size: .61rem; }
.step0-profile-summary__badge {
    flex: 0 0 auto;
    padding: .25rem .42rem;
    border-radius: 999px;
    color: var(--ui-teal-dark) !important;
    background: #dff5ef;
    font-size: .55rem !important;
    font-weight: 800;
}
.step0-profile-summary p, .step0-profile-summary small { margin: 0; color: var(--ui-muted); font-size: .61rem; }
.step0-inline-section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    margin: .9rem .8rem .25rem;
    padding-top: .78rem;
    border-top: 1px solid var(--ui-line);
}
.step0-inline-section-heading strong {
    color: var(--ui-ink-soft);
    font-size: .69rem;
}
.step0-inline-section-heading span {
    color: var(--ui-muted);
    font-size: .59rem;
    line-height: 1.4;
    text-align: right;
}
.phase3-status { border-radius: 999px !important; font-size: .58rem !important; }

.step0-context-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1rem;
    padding: 1.15rem 1.25rem;
    border: 1px solid #b8d8d3;
    border-left: 4px solid var(--ui-teal);
    border-radius: 14px;
    background: linear-gradient(110deg, #effaf7, #fff 70%);
}
.step0-context-hero--exploratory { border-left-color: #d69a20; background: linear-gradient(110deg, #fff9e9, #fff 70%); }
.step0-context-hero span { color: var(--ui-muted); font-size: .6rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.step0-context-hero h3 { margin: .22rem 0 .32rem; color: var(--ui-ink); font-size: 1.05rem; }
.step0-context-hero p { max-width: 720px; margin: 0; color: var(--ui-muted); font-size: .7rem; line-height: 1.5; }
.step0-context-actions { display: flex; flex: 0 0 auto; align-items: center; gap: .55rem; }
.step0-context-actions .btn { width: auto; margin: 0; padding: .65rem .85rem; white-space: nowrap; }
.step0-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.step0-result-card,
.step0-lineage {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--ui-line);
    border-radius: 13px;
    color: var(--ui-ink-soft);
    background: #fff;
    box-shadow: var(--ui-shadow-xs);
}
.step0-result-card--wide { grid-column: 1 / -1; }
.step0-card-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.step0-card-heading span { color: var(--ui-ink); font-size: .76rem; font-weight: 800; }
.step0-card-heading strong { color: var(--ui-teal-dark); font-size: .64rem; }
.step0-result-card p { margin: 0 0 .65rem; color: var(--ui-muted); font-size: .7rem; line-height: 1.55; }
.step0-result-card small { color: var(--ui-muted); font-size: .61rem; }
.step0-definition-list { display: grid; gap: .46rem; margin: 0; }
.step0-definition-list > div { display: grid; grid-template-columns: minmax(92px, .8fr) minmax(0, 1.4fr); gap: .65rem; padding-bottom: .42rem; border-bottom: 1px solid #edf2f1; }
.step0-definition-list > div:last-child { padding-bottom: 0; border-bottom: 0; }
.step0-definition-list dt { color: var(--ui-muted); font-size: .63rem; }
.step0-definition-list dd { min-width: 0; margin: 0; color: var(--ui-ink); font-size: .66rem; font-weight: 750; overflow-wrap: anywhere; }
.step0-coverage-list { display: grid; gap: .38rem; }
.step0-coverage-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .48rem .58rem; border-radius: 8px; background: #f5f9f8; font-size: .65rem; }
.step0-coverage-row strong { color: var(--ui-ink); }
.step0-empty-state { display: grid; gap: .3rem; padding: .75rem; border: 1px dashed var(--ui-line-strong); border-radius: 9px; background: #fafcfc; }
.step0-empty-state strong { color: var(--ui-ink-soft); font-size: .68rem; }
.step0-empty-state span, .step0-muted { color: var(--ui-muted); font-size: .64rem; line-height: 1.45; }
.step0-chip-list { display: flex; flex-wrap: wrap; gap: .38rem; }
.step0-chip { padding: .34rem .5rem; border: 1px solid #cce2de; border-radius: 999px; color: var(--ui-teal-dark); background: #f0faf8; font-size: .61rem; font-weight: 750; }
.step0-card-note { margin-top: .65rem !important; font-size: .62rem !important; }
.step0-list-label { margin: .65rem 0 .3rem; color: var(--ui-muted); font-size: .58rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.step0-result-card ul { margin: 0; padding-left: 1.05rem; color: var(--ui-ink-soft); font-size: .64rem; line-height: 1.5; }
.step0-lineage { padding: 0; overflow: hidden; }
.step0-lineage > summary { padding: .8rem 1rem; color: var(--ui-ink-soft); background: #f5f9f8; font-size: .68rem; font-weight: 800; }
.step0-lineage .step0-definition-list { padding: .9rem 1rem 1rem; }

.form-group { margin-bottom: .95rem; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { margin-bottom: .38rem; color: var(--ui-ink-soft); font-size: .72rem; font-weight: 750; }
.form-group input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.form-group select,
.form-group textarea,
.phase3-form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.phase3-form-grid select,
.phase3-form-grid textarea {
    min-height: 43px;
    padding: .65rem .75rem;
    border: 1px solid var(--ui-line-strong);
    border-radius: 9px;
    color: var(--ui-ink);
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(16,42,46,.025);
    font-size: .78rem;
}
.form-group textarea { width: 100%; min-height: 92px; resize: vertical; line-height: 1.5; }
.form-group input::placeholder, .form-group textarea::placeholder { color: #a0b0b2; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
.structured-editor td input:focus, .structured-editor td select:focus {
    outline: none;
    border-color: var(--ui-teal);
    box-shadow: 0 0 0 3px rgba(8,127,117,.12);
}
.form-group input[readonly], .form-group input:disabled, .form-group select:disabled { color: #718486; background: #eef3f2; cursor: not-allowed; }
.form-help, .form-group small { display: block; margin-top: .32rem; color: var(--ui-muted); font-size: .64rem; line-height: 1.45; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ui-teal); }
input[type="range"] { accent-color: var(--ui-teal); }

details { border-color: var(--ui-line); }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: '+'; float: right; color: var(--ui-teal); font-size: .9rem; font-weight: 700; }
details[open] > summary::after { content: '−'; }
.integrated-input-group, .guided-step3-subgroup, .phase3-details, .workflow-step0-optional {
    border-color: var(--ui-line);
    border-radius: 10px;
    background: #fff;
}
.integrated-input-group > summary, .guided-step3-subgroup > summary, .phase3-details > summary, .workflow-step0-optional > summary {
    padding: .72rem .8rem;
    color: var(--ui-ink-soft);
    background: #f5f9f8;
    font-size: .68rem;
    font-weight: 800;
}

.btn, .phase3-action, .workflow-welcome-action, .dt-ai-review-button {
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: -.005em;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.btn { margin-top: .45rem; color: #fff; background: var(--ui-teal); }
.btn:hover { color: #fff; background: var(--ui-teal-dark); box-shadow: 0 8px 22px rgba(8,127,117,.18); }
.btn-secondary { color: var(--ui-ink-soft); border-color: var(--ui-line-strong); background: #fff; }
.btn-secondary:hover { color: var(--ui-ink); border-color: #8eb7b2; background: #f3f8f7; box-shadow: none; }
.btn:disabled, .phase3-action:disabled { color: #8ca09e; border-color: var(--ui-line); background: #e9efee; opacity: 1; }
.sidebar-actions {
    position: static;
    z-index: 12;
    margin: 1.1rem 0 0;
    padding: .85rem 0 0;
    border-top: 1px solid rgba(190,211,207,.9);
    background: transparent;
}
.sidebar-actions .btn { margin-top: .45rem; }
#runBtn { min-height: 48px; background: linear-gradient(135deg, var(--ui-teal), #0a6e68); box-shadow: 0 10px 24px rgba(8,127,117,.18); }
#resetBtn { min-height: 40px; }
.btn-delete, .structured-editor__remove { color: #a92f3a !important; border: 1px solid #f0c8cc !important; border-radius: 7px !important; background: #fff5f5 !important; box-shadow: none !important; }

.workflow-welcome { display: block; max-width: 1080px; margin: 0 auto; color: var(--ui-ink); text-align: left; }
.workflow-welcome-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 2rem;
    min-height: 230px;
    padding: clamp(1.6rem, 3vw, 2.6rem);
    overflow: hidden;
    border: 1px solid rgba(70,206,190,.3);
    border-radius: 22px;
    color: #eafffc;
    background:
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        radial-gradient(circle at 88% 12%, rgba(45,212,191,.28), transparent 32%),
        linear-gradient(135deg, #0d2a31, #0b4b49);
    background-size: 32px 32px, 32px 32px, auto, auto;
    box-shadow: var(--ui-shadow-md);
}
.workflow-welcome-hero::after { content: ''; position: absolute; right: -70px; bottom: -120px; width: 280px; height: 280px; border: 1px solid rgba(94,234,212,.16); border-radius: 50%; box-shadow: 0 0 0 34px rgba(94,234,212,.045), 0 0 0 68px rgba(94,234,212,.025); }
.workflow-welcome-hero > * { position: relative; z-index: 1; }
.workflow-welcome-kicker { display: block; margin-bottom: .65rem; color: #5eead4; font-size: .65rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.workflow-welcome-hero h2 { max-width: 720px; margin: 0; color: #fff; font-size: clamp(1.55rem, 3vw, 2.45rem); line-height: 1.08; letter-spacing: -.035em; }
.workflow-welcome-hero p { max-width: 720px; margin: .85rem 0 0; color: #bddbd7; font-size: .82rem; line-height: 1.65; }
.workflow-welcome-status { min-width: 148px; padding: .8rem .9rem; border: 1px solid rgba(255,255,255,.14); border-radius: 12px; background: rgba(255,255,255,.08); backdrop-filter: blur(8px); }
.workflow-welcome-status span { display: block; color: #8ecac3; font-size: .57rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.workflow-welcome-status strong { display: block; margin-top: .25rem; color: #fff; font-size: .76rem; }
.workflow-welcome-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; margin-top: 1rem; }
.workflow-guide-card { display: grid; grid-template-columns: auto 1fr; gap: .8rem; min-height: 190px; padding: 1.15rem; border: 1px solid var(--ui-line); border-radius: 15px; background: #fff; box-shadow: var(--ui-shadow-sm); }
.workflow-guide-card--accent { border-color: #b9ded8; background: linear-gradient(145deg, #effaf8, #fff); }
.workflow-guide-number { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; color: var(--ui-teal-dark); background: var(--ui-teal-soft); font-size: .62rem; font-weight: 900; }
.workflow-guide-card h3 { margin: .25rem 0 .65rem; color: var(--ui-ink); font-size: .79rem; }
.workflow-guide-card ul { margin: 0; padding: 0; list-style: none; }
.workflow-guide-card li { position: relative; margin: 0 0 .48rem; padding-left: .85rem; color: var(--ui-muted); font-size: .69rem; line-height: 1.45; }
.workflow-guide-card li::before { content: ''; position: absolute; left: 0; top: .48rem; width: 4px; height: 4px; border-radius: 50%; background: var(--ui-teal); }
.workflow-welcome-footer { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; margin-top: 1rem; padding: 1rem 9.5rem 1rem 1.1rem; border: 1px solid var(--ui-line); border-radius: 13px; background: #fff; }
.workflow-welcome-footer > div { display: grid; grid-template-columns: auto 1fr; column-gap: .6rem; align-items: center; }
.workflow-welcome-pulse { grid-row: 1 / 3; width: 9px; height: 9px; border-radius: 50%; background: #20b486; box-shadow: 0 0 0 5px #daf6ec; }
.workflow-welcome-footer strong { color: var(--ui-ink-soft); font-size: .72rem; }
.workflow-welcome-footer small { color: var(--ui-muted); font-size: .62rem; }
.workflow-welcome-action { flex: 0 0 auto; padding: .62rem 1rem; color: #fff; background: var(--ui-teal); cursor: pointer; }
.workflow-welcome-action:hover { background: var(--ui-teal-dark); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(8,127,117,.18); }

.loading {
    max-width: 760px;
    margin: 8vh auto 0;
    padding: 5rem 1.5rem 1.5rem !important;
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius-lg);
    color: var(--ui-ink-soft) !important;
    background: #fff;
    box-shadow: var(--ui-shadow-sm);
    text-align: center;
}
.loading::before { width: 32px !important; height: 32px !important; margin: 0 0 0 -16px !important; border-color: #d8e5e3 !important; border-top-color: var(--ui-teal) !important; }
.error { margin: 0 0 1rem; padding: .9rem 1rem !important; border: 1px solid #efc4c8; border-left: 4px solid var(--ui-red); border-radius: 10px; color: #8e2731 !important; background: #fff5f6 !important; font-size: .76rem; }

.results.active { animation: ui-rise .28s ease both; }
@keyframes ui-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.results-header { margin: 0 0 1rem; padding: 0 0 .9rem; border-color: var(--ui-line); }
.results-header h2 { color: var(--ui-ink); font-size: 1.22rem; letter-spacing: -.02em; }
.results-kicker { display: block; margin-bottom: .22rem; color: var(--ui-teal); font-size: .6rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.results-subtitle { margin: .28rem 0 0; color: var(--ui-muted); font-size: .69rem; }
.status-badge { padding: .4rem .72rem; border: 1px solid transparent; font-size: .63rem; }
.status-badge.success { color: #116844; border-color: #b7e1d0; background: #e8f8f1; }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.stat-card {
    position: relative;
    min-height: 104px;
    padding: 1rem;
    overflow: hidden;
    border: 1px solid var(--ui-line);
    border-left: 0;
    border-radius: 13px;
    background: #fff;
    box-shadow: var(--ui-shadow-xs);
}
.stat-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--metric-color, var(--ui-teal)); }
.stat-card h4 { margin-bottom: .6rem; color: var(--ui-muted); font-size: .61rem; letter-spacing: .08em; }
.stat-card .value { color: var(--ui-ink); font-size: clamp(1.05rem, 1.7vw, 1.35rem); line-height: 1.18; letter-spacing: -.025em; overflow-wrap: anywhere; }
.stat-card small { display: block; margin-top: .45rem; color: var(--ui-muted); font-size: .62rem; line-height: 1.4; }

.tabs { display: flex; gap: .3rem; margin: 1.25rem 0 1rem; padding: .28rem; overflow-x: auto; border: 1px solid var(--ui-line); border-radius: 11px; background: #f0f5f4; }
.tab { min-height: 38px; padding: .55rem .85rem; border: 0 !important; border-radius: 8px !important; color: var(--ui-muted) !important; background: transparent !important; font-size: .69rem !important; font-weight: 800 !important; white-space: nowrap; }
.tab:hover { color: var(--ui-ink-soft) !important; background: rgba(255,255,255,.7) !important; }
.tab.active { color: #fff !important; background: var(--ui-teal) !important; box-shadow: 0 5px 14px rgba(8,127,117,.15); }
.tab-content { animation: ui-rise .2s ease both; }

.diagnostics-panel, .dt-result-panel, .phase3-panel, .chart-container, .report-block, .download-section {
    border-color: var(--ui-line) !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: var(--ui-shadow-xs) !important;
}
.diagnostics-panel { padding: 1rem; }
.diagnostic-card { border-color: var(--ui-line); border-radius: 10px; background: #fbfdfc; }
.dt-result-grid { gap: .8rem; }
.dt-result-panel { padding: 1rem; }
.dt-section-heading span { color: var(--ui-teal); }
.dt-section-heading h3 { color: var(--ui-ink); }
.dt-result-copy, .dt-metric-row { color: var(--ui-ink-soft); }
.dt-metric-row { border-color: #e7efed; }
.dt-metric-row strong { color: var(--ui-ink); }

.phase3-workspace-hero { border-radius: 18px !important; box-shadow: var(--ui-shadow-md) !important; }
.phase3-workspace-nav { border-color: var(--ui-line) !important; border-radius: 12px !important; background: #eef5f3 !important; }
.phase3-workspace-tab { min-height: 42px; border-radius: 9px !important; color: var(--ui-muted) !important; font-size: .7rem !important; }
.phase3-workspace-tab.active { color: #fff !important; background: var(--ui-teal) !important; }
.phase3-action { width: auto; padding: .58rem .78rem; color: var(--ui-ink-soft); border-color: var(--ui-line-strong); background: #fff; cursor: pointer; }
.phase3-action:hover { color: var(--ui-teal-dark); border-color: #91beb8; background: #f2faf8; transform: translateY(-1px); }
.phase3-action.primary { color: #fff; border-color: var(--ui-teal); background: var(--ui-teal); }
.phase3-action.primary:hover { background: var(--ui-teal-dark); }
.phase3-panel h4 { color: var(--ui-ink); }
.phase3-empty { border-color: var(--ui-line) !important; color: var(--ui-muted) !important; background: #fbfdfc !important; }
.phase3-analysis-section { border-color: var(--ui-line) !important; border-radius: 13px !important; background: #fff !important; }
.phase3-analysis-section > summary { color: var(--ui-ink-soft) !important; background: #f5f9f8; }

.chart-container { min-height: 320px; padding: 1rem !important; }
.chart-container h3 { color: var(--ui-ink); font-size: .84rem; }
.data-table, .structured-editor table { border-collapse: separate; border-spacing: 0; }
.data-table { width: 100%; overflow: hidden; border: 1px solid var(--ui-line); border-radius: 10px; background: #fff; }
.data-table th, .structured-editor th { color: var(--ui-muted) !important; background: #f2f7f6 !important; font-size: .58rem !important; letter-spacing: .07em; }
.data-table th, .data-table td { padding: .68rem .72rem !important; border-color: #e6efed !important; }
.data-table td { color: var(--ui-ink-soft); font-size: .7rem; }
.data-table tbody tr:hover td { background: #f6fbfa; }
.structured-editor { border-color: var(--ui-line); border-radius: 12px; }
.structured-editor__header { border-color: var(--ui-line); background: #f3f8f7; }
.structured-editor td { border-color: #e7efed; }
.structured-editor td input, .structured-editor td select { border-color: var(--ui-line-strong); border-radius: 7px; }
.download-section { margin-top: 1rem; padding: 1rem; }
.download-section h3 { color: var(--ui-ink); font-size: .82rem; }
.download-links { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .7rem; }
.download-links a { display: inline-flex; align-items: center; min-height: 38px; padding: .5rem .7rem; border: 1px solid var(--ui-line-strong); border-radius: 8px; color: var(--ui-teal-dark); background: #fff; font-size: .67rem; font-weight: 800; text-decoration: none; }
.download-links a:hover { border-color: var(--ui-teal); background: var(--ui-teal-soft); }

.evidence-applied-panel { margin-top: 1rem; padding: 1rem; border: 1px solid #bdded8; border-radius: 12px; background: linear-gradient(145deg, #effaf8, #fff); }
.evidence-chip { display: inline-flex; margin: .25rem .25rem 0 0; padding: .32rem .5rem; border: 1px solid #c4e1dc; border-radius: 999px; color: var(--ui-teal-dark); background: #fff; font-size: .61rem; }
.simulation-capability-note, .inherited-design-card, .guided-step3-ai, .ai-config-card { border-color: #b9dcd6; border-radius: 12px; background: linear-gradient(145deg, #effaf8, #fff); }
.report-block { padding: 1.1rem !important; }
.report-block h2, .report-block h3 { color: var(--ui-ink); }
.optimizer-section {
    margin: 1rem 0;
    padding: .95rem;
    border: 1px solid var(--ui-line);
    border-radius: 12px;
    background: #fbfdfc;
}
.optimizer-section h4 { margin: 0 0 .35rem; color: var(--ui-ink); font-size: .76rem; }
.optimizer-input-grid { gap: .7rem !important; margin-top: .8rem !important; }
.contextual-ai-panel {
    margin: 1rem 0;
    padding: .95rem;
    border: 1px solid #b8dcd6;
    border-radius: 12px;
    background: linear-gradient(145deg, #eaf8f5, #fff);
}
.contextual-ai-panel > strong { color: var(--ui-ink); font-size: .75rem; }
.contextual-ai-panel .btn { width: auto; padding-left: .85rem; padding-right: .85rem; }
.constraint-table-wrap { margin-top: .75rem; overflow-x: auto; border: 1px solid var(--ui-line); border-radius: 10px; background: #fff; }
.constraint-table { border-collapse: separate !important; border-spacing: 0; }
.constraint-table th { color: var(--ui-muted) !important; background: #f1f7f5 !important; font-size: .56rem !important; letter-spacing: .05em; text-transform: uppercase; }
.constraint-table td { border-color: #e7efed !important; }
.constraint-table input, .constraint-table select { min-height: 34px; border: 1px solid var(--ui-line-strong) !important; border-radius: 6px !important; color: var(--ui-ink-soft); background: #fff !important; }
#priceOptimizationForm > div[style*="#f0f7ff"],
#allocationOptimizationForm > div[style*="#f0f7ff"],
#proReportForm > div[style*="#f0f7ff"] {
    margin-bottom: 1rem !important;
    padding: .9rem !important;
    border: 1px solid #d3e3e7;
    border-left: 4px solid #4f8ca3;
    border-radius: 10px !important;
    color: var(--ui-ink-soft) !important;
    background: #f3f8fa !important;
    line-height: 1.5;
}
#priceOptimizationForm > div[style*="#fff9e6"],
#allocationOptimizationForm > div[style*="#fff9e6"] {
    padding: .85rem !important;
    border: 1px solid #ead8ae;
    border-left: 4px solid #d79a24;
    border-radius: 10px !important;
    color: #6c5626 !important;
    background: #fffbef !important;
    line-height: 1.5;
}

.idz-assistant-toggle { border-radius: 10px; background: var(--ui-teal-dark); box-shadow: var(--ui-shadow-md); }
.idz-assistant { border-color: var(--ui-line-strong); border-radius: 14px; box-shadow: 0 28px 80px rgba(16,32,57,.24); }
.idz-assistant-brand__mark, .idz-assistant-send { background: var(--ui-teal); }

/* Normalize legacy inline controls without changing their handlers. */
button[style*="#9c27b0"], button[style*="#0f172a"], button[style*="#ff4444"] {
    border: 1px solid transparent !important;
    border-radius: 8px !important;
    color: #fff !important;
    background: var(--ui-teal) !important;
    font-weight: 800 !important;
}
button[style*="#ff4444"] { color: #9f2833 !important; border-color: #efc5c9 !important; background: #fff3f4 !important; }

@media (max-width: 1180px) {
    .content { grid-template-columns: 430px minmax(0, 1fr); }
    .header-product-meta span:nth-child(2) { display: none; }
    .workflow-welcome-grid { grid-template-columns: 1fr; }
    .workflow-guide-card { min-height: 0; }
}

@media (max-width: 1024px) {
    .header { min-height: auto; padding: 1.15rem 1.25rem; }
    .header-inner { align-items: flex-start; }
    .header-product-meta { display: none; }
    .header-tagline { display: block; }
    .content { display: block; min-height: 0; }
    .sidebar, .main-content { height: auto; overflow: visible; }
    .sidebar { padding: 1rem; border-right: 0; border-bottom: 1px solid var(--ui-line); }
    .main-content { min-height: 520px; padding: 1.2rem 1rem 3rem; }
    .sidebar-actions { position: static; margin: 1rem 0 0; padding: .8rem 0 0; background: transparent; backdrop-filter: none; }
    .workflow-welcome-hero { min-height: 210px; }
}

@media (max-width: 720px) {
    .header-mark { width: 42px; height: 42px; border-radius: 11px; }
    .header h1 { font-size: 1.35rem; }
    .header-tagline { font-size: .68rem; }
    .workflow-step-tabs { grid-template-columns: repeat(5, 88px); overflow-x: auto; padding-bottom: .25rem; }
    .workflow-step-tab { min-height: 58px; }
    .workflow-welcome-hero { grid-template-columns: 1fr; min-height: 0; padding: 1.35rem; }
    .workflow-welcome-status { width: fit-content; }
    .workflow-welcome-footer { align-items: stretch; flex-direction: column; }
    .workflow-welcome-footer { padding: 1rem; }
    .workflow-welcome-action { width: 100%; }
    .step0-context-hero { align-items: stretch; flex-direction: column; }
    .step0-context-actions { align-items: stretch; flex-direction: column-reverse; }
    .step0-context-actions .btn { width: 100%; }
    .step0-result-grid { grid-template-columns: 1fr; }
    .step0-result-card--wide { grid-column: auto; }
    .stats-grid, .dt-primary-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .dt-result-grid, .phase3-panel-grid { grid-template-columns: 1fr !important; }
    .dt-result-panel, .dt-result-panel--wide, .phase3-panel, .phase3-panel.wide, .phase3-panel.third { grid-column: 1 !important; }
    .phase3-screen-heading, .phase3-workspace-hero__content { align-items: stretch !important; flex-direction: column !important; }
    .phase3-actions { width: 100%; }
    .phase3-action { flex: 1 1 auto; }
    .idz-assistant-toggle { right: 14px; bottom: 14px; }
}

@media (max-width: 460px) {
    .header-copy .header-badge { font-size: .55rem; }
    .header-tagline { display: none; }
    .sidebar, .main-content { padding-left: .75rem; padding-right: .75rem; }
    .form-section { padding: .8rem; }
    .workflow-step0-grid { padding-left: .8rem; padding-right: .8rem; }
    .workflow-step0-purpose { margin-left: .8rem; margin-right: .8rem; }
    #workflowDataContextBody { margin-left: .8rem; margin-right: .8rem; }
    .step0-profile-summary__header { display: grid; }
    .step0-inline-section-heading { display: grid; }
    .step0-inline-section-heading span { text-align: left; }
    .workflow-welcome-grid { gap: .65rem; }
    .workflow-guide-card { padding: .9rem; }
    .stats-grid, .dt-primary-stats { grid-template-columns: 1fr !important; }
    .stat-card { min-height: 90px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
