/* =====================================================================
   CIAD — Tri de pièces par forme · interface claire pour démonstration
   ===================================================================== */

@font-face { font-family: 'Atkinson Hyperlegible'; font-weight: 400; font-display: swap;
    src: url('/vendor/fonts/atkinson/files/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-weight: 700; font-display: swap;
    src: url('/vendor/fonts/atkinson/files/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap;
    src: url('/vendor/fonts/jetbrains/files/jetbrains-mono-latin-400-normal.woff2') format('woff2'); }

:root {
    /* base */
    --paper: #EDF1F5;          /* fond de scène */
    --surface: #FFFFFF;
    --surface-2: #F5F7FA;
    --line: #DCE3EA;
    --line-strong: #C3CDD7;
    --ink: #1F2B37;            /* texte principal, état actif */
    --ink-2: #536273;
    --ink-3: #8593A2;
    /* formes (identiques à static/js/pieces.js) */
    --ecrou: #E2A11B;
    --vis: #3B79D4;
    --cale: #1F9C79;
    --equerre: #8B5FD1;
    /* états */
    --recover: #DD7424;
    --abort: #CF4338;
    --ok: #1F8F5F;
    --focus: #3B79D4;

    --radius-lg: 14px;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow-panel: 0 1px 2px rgba(31, 43, 55, .06), 0 8px 28px rgba(31, 43, 55, .08);
    --sans: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
    --topbar-h: 68px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0; overflow: hidden;
    background: var(--paper); color: var(--ink);
    font: 15px/1.45 var(--sans);
    -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
code { font-family: var(--mono); }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }

#canvas-container { position: absolute; inset: 0; z-index: 0; }
#canvas-container canvas { display: block; }

.nssn-journal-card.collapsed .journal-body-wrap {
    display: none;
}

.nssn-journal-card.collapsed #journalHeader svg {
    transform: rotate(180deg);
}

.nssn-journal-card.collapsed {
    display: flex;
    flex-direction: column;
    height: auto !important;
    min-height: 0 !important;
    padding-bottom: 0 !important;
    gap: 0 !important;
}

.nssn-journal-card.collapsed .journal-body-wrap {
    display: none !important;
}

.nssn-journal-card.collapsed #journalHeader {
    margin-bottom: 0 !important;
}
/* ---------------------------------------------------------- barre du haut */
#topbar {
    position: absolute; top: 0; left: 0; right: 0; z-index: 20;
    height: var(--topbar-h);
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
    padding: 0 18px;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 40px; height: 40px; flex-shrink: 0; }
.brand h1 { margin: 0; font-size: 1.12rem; line-height: 1.2; font-weight: 700; letter-spacing: -.005em; }
.brand p { margin: 1px 0 0; font-size: .8rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.run-state {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 8px 16px 8px 14px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--line);
    font-weight: 700; font-size: .95rem; white-space: nowrap;
    transition: background .25s, color .25s, border-color .25s;
}
.run-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); flex-shrink: 0; }
.run-state.waiting .run-dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(31, 143, 95, .15); }
.run-state.busy { background: var(--ink); color: #fff; border-color: var(--ink); }
.run-state.busy .run-dot { background: #fff; animation: blink 1.2s ease-in-out infinite; }
.run-state.recover { background: #FDF0E5; border-color: #F2C49E; color: #8A4310; }
.run-state.recover .run-dot { background: var(--recover); }
.run-state.done { background: #E6F4EC; border-color: #A9D8BE; color: #135C3B; }
.run-state.paused { background: var(--surface); border-color: var(--ink); color: var(--ink); }
.run-state.paused .run-dot { background: transparent; border-radius: 0; width: 10px; height: 11px; border-left: 3.5px solid var(--ink); border-right: 3.5px solid var(--ink); }
.run-state.done .run-dot { background: var(--ok); }
@keyframes blink { 50% { opacity: .35; } }

.top-right { display: flex; align-items: center; justify-content: flex-end; gap: 18px; min-width: 0; }
.counters { display: flex; gap: 18px; }
.counter { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.counter b { font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.counter span { font-size: .74rem; color: var(--ink-2); }

.phone-card {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 12px 5px 5px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line);
    cursor: pointer; text-align: left;
    transition: border-color .15s;
}
.phone-card:hover { border-color: var(--line-strong); }
.qr-small { width: 52px; height: 52px; display: grid; place-items: center; background: #fff; border-radius: 6px; }
.qr-small svg, .qr-large svg { width: 100%; height: 100%; display: block; }
.qr-small:empty { display: none; }
.phone-text { display: flex; flex-direction: column; line-height: 1.2; font-size: .78rem; color: var(--ink-2); }
.phone-text b { font-size: .9rem; color: var(--ink); }
.phone-url { font-family: var(--mono); font-size: .7rem; color: var(--ink-2); }

/* ---------------------------------------------------------- panneaux */
.panel {
    position: absolute; z-index: 10;
    top: calc(var(--topbar-h) + 14px);
    max-height: calc(100vh - var(--topbar-h) - 28px);
    display: flex; flex-direction: column;
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(8px);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-panel);
    overflow: hidden;
}
#ui-panel { left: 14px; width: 308px; }
#markov-stack { right: 14px; width: 404px; }

.panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 12px 12px 18px; cursor: pointer; user-select: none; flex-shrink: 0;
}
.panel:not(.collapsed) .panel-head { border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }

.icon-btn {
    width: 30px; height: 30px; display: grid; place-items: center; flex-shrink: 0;
    border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
    color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 15px; height: 15px; transition: transform .25s ease; }
.panel.collapsed .icon-btn svg { transform: rotate(180deg); }

#ui-body-wrap, #markovBodyWrap { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.panel.collapsed #ui-body-wrap, .panel.collapsed #markovBodyWrap { display: none; }
#ui-body, #markovBody { min-height: 0; flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; }
#ui-body { padding: 14px 18px 18px; }
#markovBody { padding: 14px 16px 16px; }
#ui-body::-webkit-scrollbar, #markovBody::-webkit-scrollbar { width: 6px; }
#ui-body::-webkit-scrollbar-thumb, #markovBody::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.block { margin-bottom: 18px; }
.block h3, .trace-title { margin: 0 0 8px; font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.hint { margin: 8px 0 0; font-size: .8rem; color: var(--ink-2); }
.hint.warn { color: #8A4310; margin: 0 0 6px; }
.hint.warn:empty { display: none; }
.empty { margin: 0; font-size: .8rem; color: var(--ink-3); }

/* ---------------------------------------------------------- boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: 8px 14px; font-size: .88rem; font-weight: 700;
    cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.btn svg { width: 18px; height: 18px; }
.btn-lg { width: 100%; padding: 13px 16px; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { padding: 6px 10px; font-size: .78rem; }
.btn.wide { width: 100%; margin-top: 6px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #2D3C4B; }
.btn-primary.running { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-primary.running:hover { border-color: var(--ink-2); }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--line-strong); background: var(--surface-2); }
#resetBtn { width: 100%; }
.btn-danger { background: #FCEDEC; color: #A3271E; border-color: #F1C2BE; }
.btn-danger:hover { background: var(--abort); color: #fff; border-color: var(--abort); }
.btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible, .mode-tab:focus-visible,
.spawn-btn:focus-visible, .phone-card:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible {
    outline: 2px solid var(--focus); outline-offset: 2px;
}
button:disabled { opacity: .45; cursor: not-allowed; }

/* ajouter une pièce */
.spawn-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.spawn-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 8px 2px 6px; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface);
    font-size: .72rem; font-weight: 700; color: var(--ink-2); cursor: pointer;
}
.spawn-btn:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface-2); }
.spawn-btn .shape-icon { width: 26px; height: 26px; }
.spawn-btn .dice { width: 26px; height: 26px; display: grid; place-items: center; font-size: 1.15rem; line-height: 1; }

/* fentes */
.slot-list { display: flex; flex-direction: column; gap: 6px; }
.slot-row {
    display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px;
    padding: 7px 10px; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface);
    border-left: 4px solid var(--slot-color, var(--line));
}
.slot-row .shape-icon { width: 26px; height: 26px; }
.slot-main { min-width: 0; }
.slot-row select {
    width: 100%; border: 0; padding: 0; background: transparent;
    font: 700 .92rem var(--sans); color: var(--ink); cursor: pointer;
}
.slot-meta { text-align: right; font-size: .72rem; color: var(--ink-2); line-height: 1.25; }
.slot-meta b { display: block; font-size: 1rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.slot-rel { height: 3px; border-radius: 2px; background: var(--line); margin-top: 5px; overflow: hidden; }
.slot-rel i { display: block; height: 100%; width: 100%; background: var(--slot-color); transition: width .4s ease; }
.slot-row.flash { animation: slotFlash 1.1s ease-out; }
@keyframes slotFlash { 0%, 40% { box-shadow: 0 0 0 3px rgba(207, 67, 56, .35); } 100% { box-shadow: none; } }
.slot-row.hit { animation: slotHit .9s ease-out; }
@keyframes slotHit { 0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--slot-color) 45%, transparent); } 100% { box-shadow: none; } }

/* activité téléphones */
.activity { display: flex; flex-direction: column; gap: 4px; max-height: 118px; overflow: auto; }
.act-item { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--ink); }
.act-item .shape-icon { width: 16px; height: 16px; flex-shrink: 0; }
.act-item time { margin-left: auto; font-size: .7rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* réglages avancés */
details.advanced { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
details > summary { cursor: pointer; list-style: none; font-size: .85rem; font-weight: 700; color: var(--ink-2); }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ''; display: inline-block; width: 0; height: 0; margin-right: 8px; vertical-align: 2px;
    border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .2s; }
details[open] > summary::before { transform: rotate(90deg); }
details.advanced[open] > summary { margin-bottom: 12px; }

.mode-tabs { display: flex; gap: 3px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; }
.mode-tab { flex: 1; padding: 6px 4px; border: 0; border-radius: 5px; background: transparent; font-size: .76rem; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.mode-tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(31, 43, 55, .12); }
.panel-section { display: none; margin-bottom: 10px; }
.panel-section.active { display: block; }

.gripper-row { display: flex; align-items: center; justify-content: space-between; font-size: .82rem; margin-bottom: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; }
.dot.open { background: var(--ink-3); }
.dot.closed { background: var(--ok); }

label { display: flex; justify-content: space-between; font-size: .78rem; color: var(--ink-2); margin: 6px 0 2px; }
.val { font-family: var(--mono); color: var(--ink); }
input[type="range"] { width: 100%; accent-color: var(--ink); cursor: pointer; margin: 0 0 4px; }

.joint-row { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 6px; background: var(--surface); }
.joint-row.selected { border-color: var(--ink); }
.joint-name { display: flex; justify-content: space-between; font-size: .78rem; font-weight: 700; margin-bottom: 4px; }
.axis-label { display: flex; justify-content: space-between; font-size: .7rem; color: var(--ink-2); }
.axis-label .val { font-size: .7rem; }

.state-line { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; color: var(--ink-2); }
.state-line code { font-size: .74rem; color: var(--ink); background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }

.zone-move h4 { margin: 10px 0 4px; font-size: .78rem; color: var(--ink-2); }
.zone-row { font-size: .72rem; color: var(--ink-2); margin-bottom: 4px; }
.zone-row div { display: flex; justify-content: space-between; }

details.calib { margin-top: 10px; }
details.calib > summary { font-size: .78rem; }
.calib-row { display: flex; justify-content: space-between; font: .7rem var(--mono); padding: 2px 0; border-bottom: 1px dashed var(--line); }

.shortcuts { margin: 12px 0 0; display: grid; gap: 5px; font-size: .74rem; color: var(--ink-2); }
.shortcuts div { display: grid; grid-template-columns: 92px 1fr; gap: 8px; align-items: center; }
.shortcuts dt { white-space: nowrap; }
.shortcuts dd { margin: 0; }
kbd { font: .68rem var(--mono); padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); color: var(--ink); }

/* ---------------------------------------------------------- bannière */
.status-banner {
    position: absolute; z-index: 30; top: calc(var(--topbar-h) + 14px); left: 50%; transform: translateX(calc(-50% + var(--scene-shift, 0px)));
    padding: 9px 16px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-panel);
    font-size: .85rem; max-width: min(560px, calc(100vw - 32px)); text-align: center;
}
.status-banner.warn { background: #FFF6E8; border-color: #F0CF9A; color: #6E4307; }

/* ---------------------------------------------------------- raisonnement */
.mk-live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); flex-shrink: 0; }
#markov-stack.live .mk-live-dot { background: var(--ok); animation: blink 1.6s ease-in-out infinite; }

.decision {
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px 14px; margin-bottom: 14px; background: var(--surface);
}
.decision-piece { display: flex; align-items: center; gap: 8px; font-size: .84rem; min-height: 26px; }
.decision-piece .shape-icon { width: 22px; height: 22px; }
.decision-piece .arrow { color: var(--ink-3); }
.piece-tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.slot-tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; }
.slot-tag .shape-icon { width: 16px; height: 16px; }
.decision-action { margin: 8px 0 10px; }
.decision-kicker { display: block; font-size: .74rem; color: var(--ink-3); }
.decision-action strong { display: block; font-size: 1.55rem; line-height: 1.15; letter-spacing: -.01em; }
.decision-action.changed strong { animation: actionIn .45s ease-out; }
@keyframes actionIn { from { opacity: .2; transform: translateY(4px); } }
.decision-facts { margin: 0; display: grid; gap: 5px; font-size: .82rem; }
.decision-facts div { display: grid; grid-template-columns: 92px 1fr; gap: 8px; align-items: baseline; }
.decision-facts dt { color: var(--ink-3); }
.decision-facts dd { margin: 0; min-width: 0; }
.decision-facts code { font-size: .72rem; color: var(--ink-2); overflow-wrap: break-word; }
.decision-options { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.decision-options:empty { display: none; }
.opt { display: grid; grid-template-columns: 1fr 54px 38px; align-items: center; gap: 8px; font-size: .78rem; color: var(--ink-2); }
.opt.chosen { color: var(--ink); font-weight: 700; }
.opt-bar { height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.opt-bar i { display: block; height: 100%; background: var(--ink-3); }
.opt.chosen .opt-bar i { background: var(--ink); }
.opt-p { font: .7rem var(--mono); text-align: right; }
.mk-status { margin-top: 10px; font-size: .76rem; color: var(--ink-3); }
.mk-status .warn { color: var(--abort); font-weight: 700; }
.hist-title { font-size: .72rem; color: var(--ink-3); margin-bottom: 4px; }
.hist { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; padding: 3px 0; font-size: .76rem; color: var(--ink-3); border-top: 1px solid var(--surface-2); }
.hist span:last-child { text-align: right; }
.hist-sensor { font-size: .68rem; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.hist.latest { color: var(--ink); font-weight: 700; }
.hist.latest .hist-sensor { background: var(--ink); color: #fff; font-weight: 400; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tab { flex: 1; border: 0; background: none; padding: 8px 4px 9px; font-size: .84rem; font-weight: 700; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- graphe 1 : actions --- */
#markovSvg { display: block; width: 100%; height: auto; overflow: visible; }
.mk-node .mk-box { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.4; transition: fill .25s, stroke .25s; }
.mk-node .mk-label { fill: var(--ink); font: 700 12.5px var(--sans); pointer-events: none; transition: fill .25s; }
.mk-node .mk-token { fill: var(--ink-3); font: 8.3px var(--mono); pointer-events: none; transition: fill .25s; }
.mk-node.done .mk-box { fill: var(--surface-2); stroke: var(--ink-3); }
.mk-node .mk-check { opacity: 0; fill: var(--ok); transition: opacity .25s; }
.mk-node.done .mk-check { opacity: 1; }
.mk-node.active .mk-box { fill: var(--ink); stroke: var(--ink); }
.mk-node.active .mk-label { fill: #fff; }
.mk-node.active .mk-token { fill: #B9C4CF; }
.mk-node.active .mk-check { opacity: 0; }
.mk-node .mk-ring { fill: none; stroke: var(--ink); stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.mk-node.active .mk-ring { animation: ring 1.8s ease-out infinite; }
@keyframes ring { 0% { opacity: .35; transform: scale(1); } 100% { opacity: 0; transform: scale(1.12, 1.4); } }
.mk-node.pulse .mk-box { animation: wait .5s ease-out; }
@keyframes wait { 0% { stroke-width: 3.5; } }

.mk-node.mk-recover .mk-box { stroke: var(--recover); stroke-dasharray: 4 3; }
.mk-node.mk-recover.active .mk-box { fill: var(--recover); stroke: var(--recover); stroke-dasharray: none; }

.mk-node.mk-lane .mk-box { stroke: var(--lane-color); stroke-width: 1.8; fill: color-mix(in srgb, var(--lane-color) 9%, #fff); }
.mk-node.mk-lane .mk-label { font-size: 11.5px; }
.mk-node.mk-lane.active .mk-box { fill: var(--lane-color); stroke: var(--ink); stroke-width: 2.2; }
.mk-node.mk-lane.active .mk-label { fill: var(--ink); }
.mk-node.mk-lane.active .mk-token { fill: var(--ink); opacity: .7; }
.mk-node.mk-lane.active .lane-icon path, .mk-node.mk-lane.active .lane-icon circle { stroke: var(--ink); }
.mk-lane.dim { opacity: .28; }
.mk-lane { transition: opacity .3s; }
.mk-node.mk-lane .mk-rel { fill: var(--lane-color); }
.mk-node.reroute-flash .mk-box { animation: reroute 1.1s ease-out; }
@keyframes reroute { 0%, 40% { stroke: var(--abort); stroke-width: 4; } }

.mk-edge path { fill: none; stroke: var(--line-strong); stroke-width: 1.5; transition: stroke .25s, stroke-width .25s, opacity .25s; }
.mk-edge polygon { fill: var(--line-strong); transition: fill .25s; }
.mk-edge.mk-lane path { stroke: color-mix(in srgb, var(--lane-color) 55%, #fff); }
.mk-edge.mk-lane polygon { fill: color-mix(in srgb, var(--lane-color) 55%, #fff); }
.mk-edge.mk-recover path { stroke: var(--recover); stroke-dasharray: 4 4; opacity: .28; }
.mk-edge.mk-recover polygon { fill: var(--recover); opacity: .4; }
.mk-edge.mk-abort path { stroke: var(--abort); stroke-dasharray: 5 4; opacity: .25; }
.mk-edge.mk-abort polygon { fill: var(--abort); opacity: .35; }
.mk-edge.mk-loopback path { stroke: var(--ink-3); stroke-dasharray: 2 3; }
.mk-edge.mk-loopback polygon { fill: var(--ink-3); }
.mk-edge.trail path { stroke: var(--ink-2); stroke-width: 2; }
.mk-edge.trail polygon { fill: var(--ink-2); }
.mk-edge.flash path { stroke: var(--ink); stroke-width: 3; opacity: 1; }
.mk-edge.flash polygon { fill: var(--ink); opacity: 1; }
.mk-edge.mk-lane.flash path, .mk-edge.mk-lane.trail path { stroke: var(--lane-color); }
.mk-edge.mk-lane.flash polygon, .mk-edge.mk-lane.trail polygon { fill: var(--lane-color); }
.mk-edge.mk-recover.flash path { stroke: var(--recover); opacity: 1; }
.mk-edge.mk-recover.flash polygon { fill: var(--recover); opacity: 1; }
.mk-edge.mk-abort.flash path { stroke: var(--abort); opacity: 1; }
.mk-edge.mk-abort.flash polygon { fill: var(--abort); opacity: 1; }
.mk-edge-label { fill: var(--ink-3); font: 10px var(--sans); pointer-events: none; transition: fill .25s; paint-order: stroke; stroke: #fff; stroke-width: 3.5px; stroke-linejoin: round; }
.mk-edge-label.on { fill: var(--ink); font-weight: 700; }
.mk-flow-dot { pointer-events: none; opacity: 0; }
.mk-flow-dot.playing { animation: flowDot .75s cubic-bezier(.3, .6, .4, 1) forwards; }
@keyframes flowDot { from { offset-distance: 0%; opacity: 1; } 85% { opacity: 1; } to { offset-distance: 100%; opacity: 0; } }

.mk-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: .74rem; color: var(--ink-2); }
.mk-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 16px; height: 10px; border-radius: 3px; }
.lg-active { background: var(--ink); }
.lg-done { background: var(--surface-2); border: 1.4px solid var(--ink-3); }
.lg-recover { height: 0; border-top: 2px dashed var(--recover); border-radius: 0; }
.lg-abort { height: 0; border-top: 2px dashed var(--abort); border-radius: 0; }

/* --- graphe 2 : CSV brut --- */
#markovSvg2 { display: block; width: 100%; height: auto; margin: 4px 0 14px; }
.mk2-row-label { fill: var(--ink-2); font: 700 10.5px var(--sans); }
.mk2-row-count { fill: var(--ink-3); font: 9px var(--mono); }
.mk2-row-line { stroke: var(--line); stroke-width: 1; }
.mk2-node { fill: var(--ink-3); opacity: .55; transition: opacity .3s, fill .25s, r .25s; }
.mk2-node.r3 { fill: var(--ink-2); }
.mk2-edge { fill: none; stroke: var(--ink-3); stroke-width: .5; opacity: .14; transition: opacity .3s, stroke .25s, stroke-width .25s; }
#markov-panel-2.reasoning .mk2-node:not(.on-path) { opacity: .18; }
#markov-panel-2.reasoning .mk2-edge:not(.on-path) { opacity: .04; }
.mk2-node.on-path { opacity: 1; fill: var(--ink); r: 4; }
.mk2-node.on-path.r3 { fill: var(--ok); r: 5.5; }
.mk2-node.on-path.kind-pos { fill: var(--lane-color, var(--ink)); }
.mk2-edge.on-path { stroke: var(--ink); stroke-width: 1.6; opacity: .85; }

.trace { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.trace-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.trace-step { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; font-size: .72rem; color: var(--ink-3); }
.trace-step::before, .trace-step::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.tchip {
    display: flex; flex-direction: column; gap: 1px; min-width: 0; max-width: 100%;
    padding: 6px 10px; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface);
    font-size: .8rem; font-weight: 700; line-height: 1.25;
}
.tchip small { font: 400 .64rem var(--mono); color: var(--ink-3); word-break: break-all; }
.tchip.k-pos { border-left: 4px solid var(--lane-color, var(--line-strong)); }
.tchip.k-act { border-left: 4px solid var(--ink); }
.tchip.k-obs { border-left: 4px solid var(--ink-3); }
.tchip.k-rule { border-color: #A9D8BE; background: #F1F9F4; }
.tchip.k-rule small { color: #3E7458; }

/* ---------------------------------------------------------- QR en grand */
.qr-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(31, 43, 55, .45); backdrop-filter: blur(3px); }
.qr-card { background: var(--surface); border-radius: 18px; padding: 28px 32px 24px; text-align: center; box-shadow: 0 20px 60px rgba(31, 43, 55, .25); max-width: calc(100vw - 32px); }
.qr-card h2 { margin: 0 0 4px; font-size: 1.5rem; }
.qr-card p { margin: 0 0 16px; color: var(--ink-2); }
.qr-large { width: min(340px, 70vw); height: min(340px, 70vw); margin: 0 auto 12px; }
.qr-large:empty { display: none; }
.qr-card .phone-url { font-size: .95rem; margin-bottom: 18px; color: var(--ink); }

/* ---------------------------------------------------------- petits écrans */
@media (max-width: 1500px) {
    #markov-stack { width: 372px; }
    #ui-panel { width: 280px; }
    #ui-body { padding: 12px 14px 16px; }
    #markovBody { padding: 12px 12px 14px; }
}
@media (max-width: 1280px) {
    .brand p, .counters .counter:nth-child(2) { display: none; }
    #markov-stack { width: 344px; }
    #ui-panel { width: 264px; }
}
@media (max-width: 900px) {
    :root { --topbar-h: 58px; }
    #topbar { grid-template-columns: 1fr auto; }
    .top-right .counters, .phone-text { display: none; }
    .run-state { display: none; }
    .brand h1 { font-size: 1rem; }
    #ui-panel, #markov-stack { width: calc(100vw - 28px); }
    #markov-stack { top: auto; bottom: 14px; max-height: 45vh; }
    #ui-panel { max-height: 40vh; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* ---------------------------------------------------------- pas à pas : réglage */
.step-settings { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
label.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; cursor: pointer; color: var(--ink); font-size: .88rem; }
.switch-text { display: flex; flex-direction: column; line-height: 1.25; }
.switch-text small { font-size: .74rem; color: var(--ink-2); }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { flex-shrink: 0; position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--line-strong); transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(31, 43, 55, .25); transition: transform .2s; }
.switch-row input:checked + .switch { background: var(--ink); }
.switch-row input:checked + .switch::after { transform: translateX(18px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--focus); outline-offset: 2px; }
.step-delay { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: .76rem; color: var(--ink-2); }
.step-delay.off { opacity: .45; }
.seg { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.seg button { border: 0; background: none; padding: 4px 8px; border-radius: 5px; font-size: .74rem; font-weight: 700; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button[aria-checked="true"] { background: var(--ink); color: #fff; }
.seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* ---------------------------------------------------------- pas à pas : carte sur la scène */
.step-card {
    position: absolute; z-index: 25; bottom: 18px; left: 50%;
    transform: translateX(calc(-50% + var(--scene-shift, 0px)));
    width: min(720px, calc(var(--free-w, 100vw) - 32px));
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 2px 4px rgba(31, 43, 55, .06), 0 18px 48px rgba(31, 43, 55, .16);
    padding: 16px 20px 14px; overflow: hidden;
}
.step-card.enter { animation: stepIn .35s cubic-bezier(.2, .7, .3, 1); }
@keyframes stepIn { from { transform: translate(calc(-50% + var(--scene-shift, 0px)), 12px); box-shadow: 0 0 0 3px rgba(31, 43, 55, .25), 0 18px 48px rgba(31, 43, 55, .16); } }
.step-top { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.step-num { font-weight: 700; font-size: .9rem; white-space: nowrap; }
.step-phases { flex: 1; display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; min-width: 0; }
.step-phases li { flex: 1; padding-top: 7px; border-top: 4px solid var(--line); font-size: .72rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-phases li.past { border-top-color: var(--ink-3); color: var(--ink-2); }
.step-phases li.now { border-top-color: var(--ink); color: var(--ink); font-weight: 700; }
.step-pause { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; color: var(--ink-2); padding: 3px 9px 3px 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.step-pause svg { width: 14px; height: 14px; }

.step-flow { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.step-from { font-size: 1rem; color: var(--ink-2); white-space: nowrap; }
.step-edge { position: relative; display: flex; justify-content: center; min-width: 110px; }
.step-edge::before { content: ''; position: absolute; left: 0; right: 10px; top: 50%; border-top: 2px solid var(--ink); }
.step-edge::after { content: ''; position: absolute; right: 0; top: 50%; transform: translateY(-50%); border-left: 11px solid var(--ink); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.step-sensor { position: relative; padding: 3px 11px; border-radius: 999px; background: var(--ink); color: #fff; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.step-to { font-size: 1.6rem; line-height: 1.15; letter-spacing: -.01em; white-space: nowrap; }
.step-text { margin: 12px 0 10px; font-size: 1.08rem; line-height: 1.5; max-width: 64ch; }
.step-rule { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .76rem; }
.step-rule-label { color: var(--ink-3); }
.step-rule code { font-size: .74rem; color: var(--ink); }
.step-prob { margin-left: auto; font: .72rem var(--mono); color: var(--ink-2); }
.step-bottom { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.step-piece { display: inline-flex; align-items: center; gap: 7px; font-size: .86rem; font-weight: 700; margin-right: auto; }
.step-piece .shape-icon { width: 20px; height: 20px; }
.step-piece .muted { font-weight: 400; }
#stepNext { padding: 9px 14px 9px 18px; }
#stepNext kbd { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .3); color: #fff; }
.step-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--surface-2); }
.step-timer i { display: block; height: 100%; width: 100%; background: var(--ink-3); }
.step-card.is-recover { border-color: #F2C49E; }
.step-card.is-recover .step-sensor, .step-card.is-recover .step-edge::before { background: var(--recover); border-top-color: var(--recover); }
.step-card.is-recover .step-edge::after { border-left-color: var(--recover); }
.step-card.is-done { border-color: #A9D8BE; }
.step-card.is-done .step-sensor { background: var(--ok); }
.step-card.is-done .step-edge::before { border-top-color: var(--ok); }
.step-card.is-done .step-edge::after { border-left-color: var(--ok); }

/* dernière transition empruntée, gardée en évidence dans le graphe */
.mk-edge.current path { stroke: var(--ink); stroke-width: 2.6; opacity: 1; stroke-dasharray: none; }
.mk-edge.current polygon { fill: var(--ink); opacity: 1; }
.mk-edge.mk-lane.current path { stroke: var(--lane-color); }
.mk-edge.mk-lane.current polygon { fill: var(--lane-color); }
.mk-edge.mk-recover.current path { stroke: var(--recover); }
.mk-edge.mk-recover.current polygon { fill: var(--recover); }
.mk-edge.mk-abort.current path { stroke: var(--abort); }
.mk-edge.mk-abort.current polygon { fill: var(--abort); }

@media (max-width: 900px) {
    .step-card { bottom: auto; top: calc(var(--topbar-h) + 10px); padding: 12px 14px; }
    .step-phases, .step-rule, #stepOff { display: none; }
    .step-flow { grid-template-columns: 1fr; gap: 4px; }
    .step-edge { justify-content: flex-start; min-width: 0; }
    .step-edge::before, .step-edge::after { display: none; }
    .step-to { font-size: 1.25rem; white-space: normal; }
    .step-text { font-size: .95rem; }
}

/* ---------------------------------------------------------- onglets */
.top-center { display: flex; align-items: center; gap: 14px; min-width: 0; }
.view-tabs { display: flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.view-tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font-size: .86rem; font-weight: 700; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.view-tabs button:hover { color: var(--ink); }
.view-tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
.view-tabs button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
body[data-view="nssn"] #ui-panel, body[data-view="nssn"] #markov-stack, body[data-view="nssn"] #stepCard,
body[data-view="nssn"] #runState, body[data-view="nssn"] #canvas-container { display: none !important; }

.block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.block-head h3 { margin: 0; }
.block-head .btn svg { width: 16px; height: 16px; }

.qr-choices { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: -8px 0 16px; font-size: .8rem; color: var(--ink-2); }
.qr-choices button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px; font: .76rem var(--mono); cursor: pointer; color: var(--ink-2); }
.qr-choices button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------------------------------------------------------- vue NSSN */
.nssn-view {
    position: absolute; z-index: 15; top: var(--topbar-h); left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) minmax(300px, 360px); gap: 14px;
    padding: 14px; background: var(--paper);
}
.nssn-col { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.nssn-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; }
.nssn-card h3 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; font-size: .86rem; color: var(--ink-2); }
.mini-scene { position: relative; flex-shrink: 0; height: clamp(200px, 30vh, 300px); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); background: var(--paper); }
.mini-scene canvas { display: block; }

.nssn-piece { display: flex; align-items: center; gap: 10px; }
.nssn-piece .shape-icon { width: 30px; height: 30px; flex-shrink: 0; }
.nssn-piece b { display: block; font-size: 1rem; }
.nssn-piece span { display: block; font-size: .78rem; color: var(--ink-2); }
.nssn-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-content: flex-start;
  height: 128px;      /* Ajustez cette hauteur fixe selon le nombre de lignes souhaité */
  overflow: hidden;  /* Masque les lignes en trop si le contenu est trop long */
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.nssn-steps li { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; font-size: .9rem; font-weight: 700; transition: opacity .2s; }
.nssn-steps li.memoire { background: var(--ink); color: #fff; }
.nssn-steps li.exploration { background: var(--surface-2); color: var(--ink-2); border: 1.5px dashed var(--ink-3); }
.nssn-steps li:not(.done):not(.now) { opacity: .28; }
.nssn-steps li.now { box-shadow: 0 0 0 3px rgba(59, 121, 212, .45); }
.nssn-decision {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 120px;     /* Hauteur fixe (remplace min-height) */
  overflow: hidden;  /* Cache tout ce qui dépasse des 120px, sans scroll */
}
.nssn-how { margin: 0 0 6px; font-size: .8rem; color: var(--ink-2); line-height: 1.4; }
.nssn-how b { color: var(--ink); }
.nssn-cand { display: grid; grid-template-columns: 96px 1fr 70px; gap: 8px; align-items: center; font-size: .78rem; color: var(--ink-2); }
.nssn-cand .bar { height: 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.nssn-cand .bar i { display: block; height: 100%; background: var(--ink-3); }
.nssn-cand.chosen { color: var(--ink); font-weight: 700; }
.nssn-cand.chosen .bar i { background: var(--ink); }
.nssn-cand.avoid { text-decoration: line-through; color: var(--ink-3); }
.nssn-cand.avoid .val { text-decoration: none; color: var(--abort); font-size: .72rem; }
.nssn-cand .val { text-align: right; font: .72rem var(--mono); }
.nssn-outcome { margin: 10px 0 0; font-size: .86rem; font-weight: 700; min-height: 1.3em; }
.nssn-outcome.ok { color: var(--ok); }
.nssn-outcome.ko { color: var(--abort); }

.nssn-controls { display: flex; flex-direction: column; gap: 12px; }
.nssn-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--ink-2); }
.nssn-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
#nssnRun.running { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
#nssnStatus { margin: 0; min-height: 1.2em; }
#nssnStatus[data-kind="erreur"] { color: var(--abort); }

.nssn-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-radius: 18px; padding: 16px 18px 12px; background: #121a23; color: #EEEAE0; }
.nssn-cycle { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; padding: 0; list-style: none; }
.nssn-cycle li { padding: 8px 0 0; border-top: 3px solid rgba(238, 234, 224, .15); transition: border-color .3s; }
.nssn-cycle li b { display: block; font-size: .95rem; color: rgba(238, 234, 224, .6); }
.nssn-cycle li span { font-size: .76rem; color: rgba(238, 234, 224, .45); }
.nssn-cycle li.active { border-top-color: #E2BA62; }
.nssn-cycle li.active b { color: #F5E6C4; }
.nssn-cycle li.active span { color: rgba(238, 234, 224, .75); }
.nssn-phase-text { margin: 12px 0 6px; min-height: 2.8em; font-size: .98rem; line-height: 1.45; color: #EEEAE0; max-width: 80ch; }
.nssn-phase-text code { font-size: .8rem; color: #F5C9C0; }
#nssnCanvas { flex: 1; min-height: 0; width: 100%; display: block; }
.nssn-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0; font-size: .74rem; color: rgba(238, 234, 224, .65); }
.nssn-legend span { display: inline-flex; align-items: center; gap: 6px; }
.nssn-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.lg-gold { background: #E2BA62; } .lg-garnet { background: #EC7062; } .lg-mint { background: #78D6AA; border-radius: 50% !important; }
.lg-ivory { background: #EEEAE0; } .lg-slate { background: #788AA0; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; }
.kpis b { display: block; font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpis span { font-size: .74rem; color: var(--ink-2); }
.library-badge { margin: 12px 0 0; padding: 6px 10px; border-radius: var(--radius-sm); background: #FFF6E8; color: #6E4307; font-size: .74rem; }
.library-badge.real { background: #E6F4EC; color: #135C3B; }
.library-badge:empty { display: none; }
.curve-key { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; font-size: .74rem; }
.curve-key i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.curve-key i.succ { background: var(--ok); } .curve-key i.eff { background: #C9962E; margin-left: 6px; }
.nssn-curve { width: 100%; height: 150px; display: block; }
.nssn-curve .grid { stroke: var(--line); stroke-width: 1; }
.nssn-curve .tick, .nssn-curve .empty-text { fill: var(--ink-3); font: 10px var(--sans); }
.nssn-curve .succ { fill: none; stroke: var(--ok); stroke-width: 2.2; }
.nssn-curve .eff { fill: none; stroke: #C9962E; stroke-width: 2; stroke-dasharray: 5 3; }
.nssn-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.nssn-table th { text-align: left; font-weight: 400; color: var(--ink-3); padding: 0 4px 6px 0; }
.nssn-table td { padding: 5px 4px 5px 0; border-top: 1px solid var(--surface-2); white-space: nowrap; }
.nssn-table td:first-child { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.nssn-table .shape-icon { width: 16px; height: 16px; }
.mini-bar { display: inline-block; width: 34px; height: 5px; margin-right: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; vertical-align: middle; }
.mini-bar i { display: block; height: 100%; }
.nssn-journal-card { flex: 1; min-height: 160px; display: flex; flex-direction: column; }
.nssn-journal { margin: 0; padding: 0; list-style: none; overflow-y: auto; flex: 1; font-size: .78rem; }
.nssn-journal li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 5px 0; border-top: 1px solid var(--surface-2); }
.nssn-journal time { font: .68rem var(--mono); color: var(--ink-3); }
.nssn-journal li.ok span { color: var(--ink); }
.nssn-journal li.ko span { color: var(--ink-2); }
.nssn-journal em { font-style: normal; font: .66rem var(--mono); padding: 1px 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }

@media (max-width: 1500px) {
    .nssn-view { grid-template-columns: 300px minmax(0, 1fr) 300px; gap: 10px; padding: 10px; }
}
@media (max-width: 1100px) {
    .view-tabs button { padding: 6px 10px; font-size: .8rem; }
    .nssn-view { grid-template-columns: 1fr; overflow-y: auto; }
    .nssn-col { overflow: visible; }
    .nssn-center { min-height: 480px; }
}
.run-state { max-width: min(30vw, 420px); }
.run-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
