:root {
    color-scheme: light;
    --ink: #17221d;
    --muted: #68756e;
    --line: #dfe7e1;
    --paper: #fbfcf9;
    --surface: #ffffff;
    --soft: #f0f5f1;
    --green: #176a46;
    --green-2: #239466;
    --green-3: #dff2e8;
    --lime: #b8db65;
    --amber: #c47d21;
    --red: #a74139;
    --blue: #3c6c8f;
    --shadow: 0 20px 55px rgba(29, 55, 41, .09);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 92% 2%, rgba(184, 219, 101, .2), transparent 25rem),
        linear-gradient(180deg, #f7faf6 0, var(--paper) 32rem);
    font-size: 15px;
    line-height: 1.55;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.site-shell { min-height: 100vh; }

.topbar {
    width: min(1440px, calc(100% - 48px));
    height: 84px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(23, 106, 70, .12);
}

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
    color: white; background: linear-gradient(145deg, var(--green), var(--green-2));
    box-shadow: 0 9px 20px rgba(23, 106, 70, .22); font: 800 25px/1 Georgia, serif;
}
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.2; }
.brand strong { font-size: 17px; letter-spacing: -.02em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.live-chip, .source-link {
    display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 13px;
    border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.72);
    font-size: 12px; font-weight: 700; text-decoration: none;
}
.live-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--green-2); box-shadow: 0 0 0 4px var(--green-3); }
.source-link:hover { border-color: var(--green); color: var(--green); }

main { width: min(1440px, calc(100% - 48px)); margin: 0 auto; }

.hero {
    min-height: 380px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(340px, .7fr);
    gap: 70px; align-items: center; padding: 58px 0 48px;
}
.eyebrow { margin: 0 0 10px; color: var(--green); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .16em; }
.hero h1 { margin: 0; max-width: 760px; font-size: clamp(48px, 6vw, 82px); line-height: .98; letter-spacing: -.065em; font-weight: 760; }
.hero h1 span { color: var(--green); }
.hero-copy { max-width: 650px; margin: 25px 0 0; color: var(--muted); font-size: 18px; }
.owner-card {
    position: relative; display: flex; align-items: center; gap: 17px; padding: 26px;
    border: 1px solid rgba(23,106,70,.15); border-radius: 24px; background: rgba(255,255,255,.78);
    box-shadow: var(--shadow); overflow: hidden;
}
.owner-card::after { content: ""; position: absolute; width: 130px; height: 130px; right: -55px; top: -70px; border-radius: 50%; background: var(--lime); opacity: .25; }
.owner-avatar { flex: 0 0 auto; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; color: white; background: var(--ink); font-weight: 800; }
.owner-card div { min-width: 0; display: flex; flex-direction: column; }
.owner-card small { color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-size: 10px; font-weight: 800; }
.owner-card strong { margin: 3px 0; font-size: 14px; overflow-wrap: anywhere; }
.owner-card div span { color: var(--muted); font-size: 12px; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 70px; }
.summary-grid article { display: flex; align-items: center; gap: 16px; min-height: 90px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: 0 8px 28px rgba(29,55,41,.04); }
.summary-grid article div { display: flex; flex-direction: column; }
.summary-grid strong { font-size: 24px; line-height: 1.1; letter-spacing: -.03em; }
.summary-grid small { margin-top: 3px; color: var(--muted); }
.summary-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; font-weight: 800; }
.summary-icon.project { background: #e5f0fa; color: var(--blue); }
.summary-icon.process { background: var(--green-3); color: var(--green); }
.summary-icon.measure { background: #f5eadb; color: var(--amber); }
.summary-icon.experiment { background: #ebe6f8; color: #72559f; }

.notice { margin: 20px 0 60px; padding: 24px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.notice.error { border-color: #eac5c2; color: var(--red); flex-direction: column; align-items: flex-start; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--green-3); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.catalog-section { margin-bottom: 76px; }
.section-heading, .tool-panel > header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.section-heading h2, .tool-panel h3 { margin: 0; font-size: 28px; letter-spacing: -.035em; }
.section-heading > span, .tool-panel > header > span { color: var(--muted); font-size: 12px; }
.process-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.process-card {
    min-height: 260px; padding: 23px; display: flex; flex-direction: column; align-items: flex-start; text-align: left;
    border: 1px solid var(--line); border-radius: 21px; color: var(--ink); background: var(--surface); cursor: pointer;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.process-card:hover { transform: translateY(-4px); border-color: #a8c6b6; box-shadow: var(--shadow); }
.process-card.selected { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green), 0 18px 40px rgba(23,106,70,.1); }
.process-card.degraded { opacity: .6; cursor: not-allowed; }
.project-name { margin-bottom: 24px; padding: 5px 9px; border-radius: 7px; color: var(--green); background: var(--green-3); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.process-card > strong { font-size: 18px; letter-spacing: -.02em; }
.process-card > p { margin: 8px 0 18px; color: var(--muted); font-size: 13px; }
.process-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.process-meta span { padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 10px; }
.open-process { width: 100%; margin-top: auto; padding-top: 20px; display: flex; justify-content: space-between; color: var(--green); font-size: 12px; font-weight: 800; }

.workspace { margin-bottom: 80px; padding: 32px; border: 1px solid var(--line); border-radius: 26px; background: rgba(255,255,255,.9); box-shadow: var(--shadow); }
.workspace[aria-busy="true"] { opacity: .72; }
.workspace-header { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 30px; align-items: center; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.workspace-header h2 { margin: 8px 0 5px; font-size: 34px; line-height: 1.1; letter-spacing: -.045em; }
.workspace-header p { margin: 0; color: var(--muted); }
.source-badge { padding: 5px 9px; border-radius: 7px; color: white; background: var(--green); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.provenance { min-width: 330px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; }
.provenance > span { display: flex; flex-direction: column; }
.provenance small { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.provenance strong { margin-top: 3px; font-size: 11px; overflow-wrap: anywhere; }
.provenance a { grid-column: 1/-1; color: var(--green); font-size: 12px; font-weight: 800; text-decoration: none; }
.success-banner { margin: 24px 0 -6px; padding: 12px 16px; border-radius: 10px; color: var(--green); background: var(--green-3); font-size: 12px; font-weight: 700; }

/* Reusable Razor library composition */
.workspace .ss-dashboard { margin-top: 28px; }
.workspace .ss-stream { padding: 0; border: 0; background: transparent; }
.workspace .ss-stream header { display: none; }
.workspace .ss-stream-track { gap: 10px; padding: 8px 0 18px; overflow-x: auto; }
.workspace .ss-step { min-width: 190px; border-color: var(--line); border-radius: 14px; background: var(--soft); }
.workspace .ss-step.selected { border-color: var(--green); background: var(--green-3); box-shadow: none; }
.workspace .ss-step-order { background: var(--green); }
.workspace .ss-dashboard-grid { gap: 12px; grid-template-columns: repeat(12, 1fr); }
.workspace .ss-dashboard-grid > article { grid-column: span 4; border-color: var(--line); border-radius: 15px; background: #fff; box-shadow: none; }
.workspace .ss-dashboard-grid > article.ss-opportunities { grid-column: span 8; }
.workspace .ss-kpi { border-color: var(--line); background: var(--soft); }
.workspace .ss-kpi.off-target { border-color: #e8c8a2; background: #fff8ed; }
.workspace .ss-pareto { margin: 0; padding: 0; border: 0; box-shadow: none; }
.scope-row { margin: 20px 0 12px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.scope-row button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--green); background: white; cursor: pointer; font-weight: 700; }
.workspace .ss-toolbox { margin-top: 0; padding: 15px; border-color: var(--line); border-radius: 16px; background: var(--ink); color: white; }
.workspace .ss-toolbox-context span { color: #afbbb4; }
.workspace .ss-tool-grid { gap: 5px; }
.workspace .ss-tool-grid button { border-color: rgba(255,255,255,.13); color: #cbd4cf; background: rgba(255,255,255,.05); }
.workspace .ss-tool-grid button.selected { border-color: var(--lime); color: var(--ink); background: var(--lime); }

.tool-panel { min-height: 360px; margin-top: 18px; padding: 25px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 10px 12px; color: var(--muted); background: var(--soft); text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
th:first-child { border-radius: 8px 0 0 8px; } th:last-child { border-radius: 0 8px 8px 0; }
td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
code { max-width: 300px; color: var(--green); overflow-wrap: anywhere; font-size: 10px; }
.severity { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; color: #8c3f38; background: #f8e4e2; font-weight: 800; }
.status { display: inline-flex; width: fit-content; padding: 4px 8px; border-radius: 999px; color: var(--muted); background: var(--soft); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.status.confirmed, .status.completed { color: var(--green); background: var(--green-3); }
.status.running, .status.inprogress { color: var(--amber); background: #faecd8; }
.status.draft { color: var(--blue); background: #e5f0fa; }
.insight-card, .analysis-block { margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--soft); }
.insight-card h4, .analysis-block h4 { margin: 8px 0 4px; font-size: 15px; }
.insight-card p, .analysis-block p { margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.insight-card small { color: var(--muted); }

.measure-grid, .experiment-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.measure-card, .experiment-card { padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.measure-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.measure-title > div { display: flex; flex-direction: column; }
.measure-title span { color: var(--green); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.measure-title h4 { margin: 3px 0 0; font-size: 16px; }
.measure-title > strong { font-size: 25px; line-height: 1; white-space: nowrap; }
.measure-title > strong small { color: var(--muted); font-size: 10px; }
.measure-scale { height: 7px; margin: 20px 0 9px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.measure-scale span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--lime)); }
.measure-targets { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 9px; }
.measure-targets b { color: var(--ink); }
.history { height: 76px; margin: 20px 0 12px; padding: 5px 10px 0; display: flex; align-items: flex-end; gap: 14px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, transparent, var(--soft)); }
.history > span { height: 67px; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; }
.history i { width: min(28px, 70%); min-height: 8px; border-radius: 5px 5px 0 0; background: var(--green-2); }
.history small { color: var(--muted); font-size: 8px; white-space: nowrap; }
.measure-card footer, .experiment-card footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 9px; }
.record-form { margin-top: 16px; padding-top: 14px; display: flex; align-items: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.record-form label { flex: 1; display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.record-form input { width: 100%; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; }
.record-form button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 8px; color: white; background: var(--green); cursor: pointer; font-size: 11px; font-weight: 800; }

.failure-mode { margin-top: 14px; display: flex; justify-content: space-between; gap: 20px; padding: 14px; border-radius: 10px; background: white; }
.failure-mode > div { display: flex; flex-direction: column; }
.failure-mode span { color: var(--muted); font-size: 11px; }
.rpn { text-align: center; } .rpn b { display: block; color: var(--red); font-size: 20px; }
.action-row { margin-top: 7px; padding: 11px 13px; display: grid; grid-template-columns: 1fr minmax(150px, auto) auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 9px; font-size: 11px; }

.why-list { margin: 0; padding: 0; list-style: none; }
.why-list li { position: relative; display: grid; grid-template-columns: 38px 1fr; gap: 14px; padding: 0 0 18px; }
.why-list li:not(:last-child)::after { content: ""; position: absolute; left: 18px; top: 38px; bottom: 0; width: 1px; background: var(--line); }
.why-list li > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: white; background: var(--green); font-weight: 800; }
.why-list li div { padding: 3px 0 0; }
.why-list strong { font-size: 13px; }
.why-list p { margin: 3px 0; color: var(--muted); font-size: 12px; }
.why-list small { color: var(--green); font-size: 9px; }

.workspace .ss-dmaic { border-color: var(--line); border-radius: 14px; box-shadow: none; }
.workspace .ss-dmaic-phases button.selected { background: var(--green); }
.experiment-card > div:first-child { display: flex; justify-content: space-between; }
.experiment-card > div:first-child small { color: var(--green); font-weight: 800; }
.experiment-card h4 { margin: 13px 0 5px; font-size: 17px; }
.experiment-card > p { min-height: 42px; margin: 0 0 15px; color: var(--muted); font-size: 12px; }
.experiment-card dl { display: grid; grid-template-columns: 100px 1fr; gap: 5px 12px; font-size: 11px; }
.experiment-card dt { color: var(--muted); } .experiment-card dd { margin: 0; font-weight: 600; }
.control-card { display: flex; justify-content: space-between; gap: 20px; margin-top: 10px; padding: 18px; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 12px; }
.control-card.breached { border-left-color: var(--red); background: #fff9f8; }
.control-card h4 { margin: 9px 0 3px; }
.control-card p { margin: 0; color: var(--muted); font-size: 11px; }
.control-card dl { min-width: 150px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; }
.control-card dt { color: var(--muted); font-size: 9px; text-transform: uppercase; } .control-card dd { margin: 0; font-weight: 800; }

.site-footer { width: min(1440px, calc(100% - 48px)); min-height: 90px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.site-footer span:first-child { color: var(--ink); font-weight: 700; }.site-footer b { margin-right: 7px; color: var(--green); font-size: 18px; }
.not-found { min-height: 70vh; display: grid; place-content: center; text-align: center; }.not-found h1 { margin: 0 0 20px; }.not-found a { color: var(--green); }

@media (max-width: 1120px) {
    .process-grid { grid-template-columns: repeat(2, 1fr); }
    .workspace .ss-dashboard-grid > article { grid-column: span 6; }
    .workspace .ss-dashboard-grid > article.ss-opportunities { grid-column: span 12; }
}

@media (max-width: 860px) {
    .topbar, main, .site-footer { width: min(100% - 28px, 1440px); }
    .hero { min-height: auto; grid-template-columns: 1fr; gap: 28px; padding: 45px 0; }
    .hero h1 { font-size: clamp(43px, 12vw, 64px); }
    .summary-grid { grid-template-columns: repeat(2, 1fr); margin-bottom: 55px; }
    .workspace { padding: 20px; }
    .workspace-header { grid-template-columns: 1fr; }
    .provenance { min-width: 0; }
    .measure-grid, .experiment-grid { grid-template-columns: 1fr; }
}

@media (max-width: 580px) {
    .topbar { height: 72px; }.brand small, .source-link { display: none; }
    .live-chip { font-size: 10px; }
    .owner-card { padding: 19px; }
    .summary-grid { gap: 9px; }.summary-grid article { min-height: 78px; padding: 13px; gap: 10px; }.summary-icon { width: 36px; height: 36px; }.summary-grid strong { font-size: 20px; }.summary-grid small { font-size: 10px; }
    .section-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
    .process-grid { grid-template-columns: 1fr; }.process-card { min-height: 225px; }
    .workspace { margin-inline: -7px; padding: 15px; border-radius: 18px; }
    .workspace-header h2 { font-size: 27px; }
    .workspace .ss-dashboard-grid > article { grid-column: span 12; }
    .tool-panel { padding: 16px; }.tool-panel > header { align-items: flex-start; flex-direction: column; }
    .action-row { grid-template-columns: 1fr; }
    .control-card { flex-direction: column; }
    .record-form { align-items: stretch; flex-direction: column; }
    .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 4px; }
}
