/*
 * La simulazione dell'interfaccia di EntitleForge (pagina /solutions/entitleforge/demo, dentro un
 * iframe della landing). Colori, misure e componenti sono quelli di
 * src/EntitleForge.Server/wwwroot/css/app.css del repository EntitleForge, con i due temi; qui la
 * struttura sta dentro l'iframe (altezza fissa, scorrimento nell'area di lavoro) invece che nella
 * finestra. Se l'interfaccia vera cambia, va riallineato anche questo file.
 */

:root {
    color-scheme: light;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #eef1f5;
    --text: #1c232c;
    --muted: #5a6574;
    --border: #d6dce4;
    --primary: #1d4ed8;
    --primary-strong: #1e3a8a;
    --primary-soft: #e3ebfd;
    --ok: #157347;
    --ok-soft: #dcf3e6;
    --info: #1d4ed8;
    --info-soft: #e3ebfd;
    --warn: #8a5a00;
    --warn-soft: #fdf0d4;
    --manual: #9a4a00;
    --manual-soft: #ffe7cf;
    --checkpoint: #5b3fa8;
    --checkpoint-soft: #ece6fb;
    --auto: #0b6b78;
    --auto-soft: #d8f1f4;
    --danger: #b42318;
    --danger-soft: #fde3e1;
    --mutedtone: #4b5563;
    --mutedtone-soft: #e8ebef;
    --focus: #2563eb;
    --radius: 6px;
    --page: #eef0f3;
    --masthead: #172131;
    --masthead-text: #eef2f7;
    --masthead-muted: #a8b3c2;
    --rail: #1d2a3d;
    --rail-hover: rgba(255, 255, 255, 0.08);
    --accent: #ee7a2a;
    --line-strong: #8d97a5;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --on-primary: #ffffff;
    --fresh: rgba(238, 122, 42, 0.16);
}

/* Il tema scuro del prodotto: dal pulsante della barra (data-theme) o dal sistema. */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0e1319;
    --surface: #161c24;
    --surface-2: #1d2530;
    --text: #e4e9f0;
    --muted: #9aa6b5;
    --border: #2a3440;
    --primary: #6ea2ff;
    --primary-strong: #a9c5ff;
    --primary-soft: #1b2a45;
    --ok: #5fd39a;
    --ok-soft: #12321f;
    --info: #7fb0ff;
    --info-soft: #172743;
    --warn: #f2c25b;
    --warn-soft: #3a2c0c;
    --manual: #ffae63;
    --manual-soft: #3b2410;
    --checkpoint: #b9a3ff;
    --checkpoint-soft: #2a2145;
    --auto: #5fd0dc;
    --auto-soft: #0f3036;
    --danger: #ff8a80;
    --danger-soft: #3d1715;
    --mutedtone: #aab4c0;
    --mutedtone-soft: #252d38;
    --focus: #8ab4ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --on-primary: #0b1220;
    --page: #0b1016;
    --masthead: #070b10;
    --masthead-text: #e2e8ef;
    --masthead-muted: #8592a2;
    --rail: #0d131a;
    --rail-hover: rgba(255, 255, 255, 0.06);
    --accent: #f19149;
    --line-strong: #5d6877;
    --fresh: rgba(241, 145, 73, 0.18);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0e1319;
        --surface: #161c24;
        --surface-2: #1d2530;
        --text: #e4e9f0;
        --muted: #9aa6b5;
        --border: #2a3440;
        --primary: #6ea2ff;
        --primary-strong: #a9c5ff;
        --primary-soft: #1b2a45;
        --ok: #5fd39a;
        --ok-soft: #12321f;
        --info: #7fb0ff;
        --info-soft: #172743;
        --warn: #f2c25b;
        --warn-soft: #3a2c0c;
        --manual: #ffae63;
        --manual-soft: #3b2410;
        --checkpoint: #b9a3ff;
        --checkpoint-soft: #2a2145;
        --auto: #5fd0dc;
        --auto-soft: #0f3036;
        --danger: #ff8a80;
        --danger-soft: #3d1715;
        --mutedtone: #aab4c0;
        --mutedtone-soft: #252d38;
        --focus: #8ab4ff;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
        --on-primary: #0b1220;
        --page: #0b1016;
        --masthead: #070b10;
        --masthead-text: #e2e8ef;
        --masthead-muted: #8592a2;
        --rail: #0d131a;
        --rail-hover: rgba(255, 255, 255, 0.06);
        --accent: #f19149;
        --line-strong: #5d6877;
        --fresh: rgba(241, 145, 73, 0.18);
    }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow: hidden; }
#ef-app { height: 100%; position: relative; }
a { color: var(--primary); text-decoration: none; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
code { background: var(--surface-2); border-radius: 4px; padding: 0.05em 0.35em; overflow-wrap: break-word; }
h1 { font-size: 1.65rem; margin: 0 0 0.3rem; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1.12rem; margin: 1.2rem 0 0.55rem; font-weight: 600; }
h3 { font-size: 0.98rem; margin: 1rem 0 0.45rem; font-weight: 620; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.icon { display: block; flex-shrink: 0; }

/* ---------------------------------------------------------------- struttura (console Citrix Cloud) */
.shell { height: 100%; display: flex; flex-direction: column; }
.masthead { flex-shrink: 0; height: 52px; display: flex; align-items: center; gap: 0.75rem; padding: 0 0.6rem 0 0.4rem; background: var(--masthead); color: var(--masthead-text); }
.masthead-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--masthead-text); padding: 0; cursor: pointer; }
.masthead-btn:hover { background: var(--rail-hover); }
.brand { display: flex; align-items: center; gap: 0.55rem; border: 0; background: none; color: inherit; padding: 0; cursor: pointer; font: inherit; }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; display: block; }
.brand-name { font-weight: 600; font-size: 1.08rem; letter-spacing: 0.01em; }
.masthead-divider { width: 1px; align-self: stretch; margin: 12px 0.2rem; background: color-mix(in srgb, var(--masthead-text) 28%, transparent); }
.masthead-product { font-size: 0.98rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.masthead-tools { margin-left: auto; display: flex; align-items: center; gap: 0.25rem; }
.masthead-org { font-weight: 600; padding: 0 0.6rem; white-space: nowrap; font-size: 0.92rem; }
.user-text { display: flex; flex-direction: column; line-height: 1.2; text-align: right; padding: 0 0.5rem; }
.user-name { font-weight: 600; font-size: 0.88rem; }
.user-roles { font-size: 0.72rem; color: var(--masthead-muted); }

.frame { flex: 1; display: flex; min-height: 0; }
.rail { width: 60px; flex-shrink: 0; background: var(--rail); color: var(--masthead-text); display: flex; flex-direction: column; justify-content: space-between; padding: 0.4rem; overflow: hidden; transition: width 0.15s ease; z-index: 20; }
.rail-items { display: flex; flex-direction: column; gap: 0.3rem; }
.rail-link { display: flex; align-items: center; gap: 0.9rem; height: 44px; padding: 0 0.7rem; border-radius: 6px; color: var(--masthead-text); border: 0; background: none; font: inherit; font-weight: 500; font-size: 0.92rem; white-space: nowrap; width: 100%; cursor: pointer; }
.rail-link:hover { background: var(--rail-hover); }
.rail-link.active { background: var(--primary); color: var(--on-primary); }
.rail-label { opacity: 0; pointer-events: none; transition: opacity 0.1s ease; }
#ef-app.rail-open .rail { width: 220px; }
#ef-app.rail-open .rail-label { opacity: 1; }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.crumbbar { flex-shrink: 0; display: flex; align-items: center; gap: 0.6rem; min-height: 46px; overflow-x: auto; padding: 0.3rem 1.5rem 0.3rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.crumb-panel { border: 0; background: none; color: var(--primary); padding: 0.25rem; border-radius: 4px; cursor: pointer; }
.crumb-panel:hover { background: var(--primary-soft); }
.crumbs { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; font-size: 0.92rem; }
.crumbs li { display: flex; align-items: center; gap: 0.35rem; }
.crumbs li + li::before { content: ""; width: 7px; height: 7px; border-right: 1.6px solid var(--muted); border-top: 1.6px solid var(--muted); transform: rotate(45deg); margin: 0 0.45rem 0 0.1rem; }
.crumb-link { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--primary); cursor: pointer; }
.crumbs [aria-current] { color: var(--text); }

.workspace-body { flex: 1; display: flex; min-height: 0; }
.subnav { width: 270px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; }
.subnav[hidden] { display: none; }
.subnav-head { display: flex; align-items: center; gap: 0.6rem; padding: 1.2rem 1.3rem 0.9rem; border-bottom: 1px solid var(--border); }
.subnav-icon { color: var(--primary); }
.subnav-title { font-size: 1.3rem; font-weight: 600; }
.subnav-list { display: flex; flex-direction: column; padding: 0.6rem 0; }
.subnav-list button { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; padding: 0.6rem 1.3rem 0.6rem 2.4rem; color: var(--text); font: inherit; font-weight: 500; text-align: left; white-space: normal; border: 0; border-radius: 0; background: none; cursor: pointer; }
.subnav-list button:hover { background: var(--surface-2); }
.subnav-list button.active { background: var(--surface-2); font-weight: 650; }
.subnav-list button.active::before { content: ""; position: absolute; left: 1.3rem; top: 0.65rem; bottom: 0.65rem; width: 4px; border-radius: 2px; background: var(--primary); }
.subnav-desc { font-size: 0.78rem; font-weight: 400; color: var(--muted); }

.workspace-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--page); overflow-y: auto; scroll-behavior: smooth; container-type: inline-size; }
main.page { padding: 1.5rem 1.8rem 1.8rem; width: 100%; padding-bottom: 2.6rem; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-header p { margin: 0.2rem 0 0; max-width: 110ch; }
.page-actions { margin-bottom: 1rem; }
footer.footer { margin-top: auto; padding: 0.8rem 1.8rem 2.4rem; color: var(--muted); font-size: 0.8rem; border-top: 1px solid var(--border); display: flex; gap: 1rem; flex-wrap: wrap; justify-content: space-between; }

/* ---------------------------------------------------------------- componenti */
.commands { display: flex; align-items: center; gap: 0.3rem 1.3rem; flex-wrap: wrap; margin: 0.2rem 0 0.9rem; }
.cmd { border: 0; background: none; padding: 0.3rem 0.1rem; border-radius: 4px; color: var(--primary); font: inherit; font-weight: 600; font-size: 0.95rem; display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.cmd:hover { text-decoration: underline; }
.cmd:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; box-shadow: var(--shadow); padding: 1rem 1.25rem; margin-bottom: 1rem; min-width: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush th:first-child, .card.flush td:first-child { padding-left: 1.1rem; }
.grid { display: grid; gap: 1rem; }
.grid .card { margin-bottom: 0; }
.grid + .grid, .grid + section, .grid + h2 { margin-top: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 1rem; }
.stat { display: flex; flex-direction: column; gap: 0.2rem; }
.stat .value { font-size: 1.5rem; font-weight: 650; }
.stat .label { color: var(--muted); font-size: 0.83rem; }
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { border-color: var(--primary); }
.highlight-manual { border-left: 4px solid var(--manual); }
.muted { color: var(--muted); }
.small { font-size: 0.83rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.stack { display: flex; flex-direction: column; gap: 0.5rem; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.row > h2, .row > h3 { margin: 0; }
.wrap-anywhere { overflow-wrap: anywhere; }

.setup-card { display: flex; align-items: center; gap: 1.2rem; width: 100%; text-align: left; white-space: normal; border-left: 4px solid var(--primary); cursor: pointer; font: inherit; color: var(--text); }
.setup-card > span:first-child { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.setup-card .icon { color: var(--primary); }
.progress { display: inline-block; width: 190px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; vertical-align: middle; }
.progress > span { display: block; height: 100%; background: var(--ok); transition: width 0.4s ease; }
.progress.wide { width: min(420px, 100%); }
.run-progress { display: flex; align-items: center; gap: 0.7rem; margin: -0.4rem 0 1rem; }

.table-scroll { position: relative; width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
th, td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; font-size: 0.83rem; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
table.plain td { padding-left: 0; padding-right: 0; }
tr.fresh td, li.fresh { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { background: var(--fresh); } to { background: transparent; } }
.table-foot { display: flex; justify-content: flex-end; gap: 1rem; padding: 0.5rem 1.1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.83rem; }
dl.props { display: grid; grid-template-columns: minmax(9rem, max-content) 1fr; gap: 0.35rem 1.4rem; margin: 0; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; overflow-wrap: anywhere; }

.badge { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.74rem; font-weight: 600; border-radius: 999px; padding: 0.1rem 0.55rem; white-space: nowrap; border: 1px solid transparent; vertical-align: middle; }
.badge-ok { color: var(--ok); background: var(--ok-soft); }
.badge-info { color: var(--info); background: var(--info-soft); }
.badge-warn { color: var(--warn); background: var(--warn-soft); }
.badge-manual { color: var(--manual); background: var(--manual-soft); }
.badge-checkpoint { color: var(--checkpoint); background: var(--checkpoint-soft); }
.badge-auto { color: var(--auto); background: var(--auto-soft); }
.badge-danger { color: var(--danger); background: var(--danger-soft); }
.badge-muted { color: var(--mutedtone); background: var(--mutedtone-soft); }
.badge-neutral { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.badge-cap { font-family: var(--mono); font-weight: 500; color: var(--muted); background: var(--surface-2); border-color: var(--border); }

.alert { border-radius: var(--radius); padding: 0.65rem 0.9rem; margin: 0 0 1rem; border: 1px solid transparent; }
.alert ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert code { background: transparent; }

label { font-weight: 550; font-size: 0.86rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.75rem; min-width: 0; }
.field .hint { color: var(--muted); font-size: 0.78rem; font-weight: 400; }
input[type="text"], input[type="search"], select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0.45rem 0.6rem; width: 100%; min-width: 0; }
input:hover, select:hover, textarea:hover { border-color: var(--text); }
textarea { font-family: var(--mono); font-size: 0.83rem; line-height: 1.45; resize: vertical; }
select:disabled { opacity: 0.75; }
.check { display: flex; align-items: flex-start; gap: 0.45rem; font-weight: 450; margin: 0.15rem 0; }
.check input { margin-top: 0.25rem; }
input.switch { appearance: none; -webkit-appearance: none; width: 42px; height: 22px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; margin: 0; flex-shrink: 0; transition: background 0.15s ease; }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s ease; }
input.switch:checked { background: var(--primary); }
input.switch:checked::after { transform: translateX(20px); }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; padding: 2.2rem 1rem; color: var(--muted); text-align: center; }
.empty-state .icon { color: var(--line-strong); }

button { font: inherit; font-weight: 600; font-size: 0.88rem; border-radius: 999px; padding: 0.42rem 1.1rem; cursor: pointer; border: 1.5px solid var(--primary); background: var(--surface); color: var(--primary); display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
button:hover { background: var(--primary-soft); }
button.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
button.primary:hover { background: var(--primary-strong); }
button.sm { padding: 0.22rem 0.75rem; font-size: 0.8rem; }
button.link { border: 0; background: none; padding: 0; color: var(--primary); font-weight: 500; text-align: left; white-space: normal; display: inline; }
button.link:hover { text-decoration: underline; background: none; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.icon-btn { border: 0; background: none; color: var(--danger); padding: 0.25rem; border-radius: 4px; opacity: 0.7; }
.icon-btn:hover { background: var(--danger-soft); opacity: 1; }

.tabs { display: flex; gap: 1.4rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 0.4rem 0.1rem; color: var(--text); font-weight: 500; font-size: 0.97rem; }
.tabs button:hover { background: none; color: var(--primary); }
.tabs button.active { font-weight: 650; border-bottom-color: var(--primary); }
.tab-count { display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; padding: 0 0.35rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 0.74rem; font-weight: 600; }
.toolbar { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.6rem; }
.toolbar .field { margin-bottom: 0; min-width: 12rem; }
.toolbar .grow { flex: 1 1 18rem; }
.chips { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-top: 0.2rem; }
.chip { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.76rem; border-radius: 999px; padding: 0.05rem 0.5rem; background: var(--info-soft); color: var(--info); white-space: nowrap; }
select.auto-width { width: auto; min-width: 12rem; }

/* Pannello laterale («blade») e finestra delle informazioni */
.blade-backdrop, .modal-backdrop { position: absolute; inset: 52px 0 0 0; background: rgba(15, 23, 35, 0.42); z-index: 40; }
.modal-backdrop { inset: 0; }
.blade { position: absolute; top: 52px; right: 0; bottom: 0; width: min(500px, 100%); background: var(--surface); z-index: 41; display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(16, 24, 40, 0.2); animation: blade-in 0.16s ease-out; }
@keyframes blade-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.blade-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.1rem 1.4rem 0.9rem; border-bottom: 1px solid var(--border); }
.blade-head h2 { margin: 0; font-size: 1.4rem; }
.blade-sub { margin: 0.3rem 0 0; color: var(--muted); }
.blade-close { width: 40px; height: 40px; flex-shrink: 0; display: inline-grid; place-items: center; margin: -0.4rem -0.5rem 0 0; border: 0; background: none; color: var(--text); padding: 0; border-radius: 6px; }
.blade-close:hover { background: var(--surface-2); }
.blade-body { flex: 1; overflow-y: auto; padding: 1.1rem 1.4rem; }
.blade-foot { display: flex; gap: 0.7rem; flex-wrap: wrap; padding: 0.9rem 1.4rem 2.4rem; border-top: 1px solid var(--border); }
.file-pick { display: flex; align-items: center; gap: 1rem; width: 100%; padding: 1.2rem; border: 1.5px dashed var(--line-strong); border-radius: 6px; background: var(--surface-2); color: var(--text); text-align: left; white-space: normal; }
.file-pick > span { display: flex; flex-direction: column; }
.file-pick .icon { color: var(--primary); }
.checks { list-style: none; margin: 1rem 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.checks li { display: flex; gap: 0.7rem; align-items: flex-start; }
.check-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; border: 2px solid var(--border); font-weight: 700; font-size: 0.8rem; }
.check-ok .check-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-warn .check-dot { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.check-busy .check-dot { border-color: var(--primary); border-right-color: transparent; animation: spin 0.8s linear infinite; }
.check-wait { color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
.modal { position: absolute; z-index: 41; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100% - 2rem)); background: var(--surface); border-radius: 10px; padding: 1.3rem 1.4rem; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); }
.modal-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.6rem; }
.modal-head img { width: 44px; height: 44px; border-radius: 9px; }
.modal-head > div { flex: 1; font-size: 1.15rem; }

/* Inventario */
.app-cell { display: flex; gap: 0.6rem; align-items: flex-start; }
.app-tile { display: inline-grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 6px; background: color-mix(in srgb, var(--tile) 16%, var(--surface)); color: var(--tile); font-weight: 700; font-size: 0.85rem; vertical-align: middle; }
.grid-props { grid-template-columns: minmax(9rem, max-content) 1fr; }

/* Guida introduttiva */
.guide { list-style: none; margin: 0; padding: 0; }
.guide li { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.6rem; }
.guide li > div { flex: 1; }
.guide-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 650; flex-shrink: 0; }

/* Matrice dei Tier */
.tm-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.tm-head .field { margin: 0; min-width: 9rem; }
.tm-head-info { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; flex: 1; }
.tm-filters { align-items: flex-end; }
.tm-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 300px); gap: 1rem; align-items: start; }
.tm-main { margin-bottom: 0; }
.tm-table th, .tm-table td { min-width: 118px; }
.tm-table th { background: var(--surface-2); font-weight: 400; }
.tm-app-col { min-width: 200px !important; }
.tm-tier-title { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; font-weight: 650; font-size: 0.92rem; margin-bottom: 0.25rem; }
.tier-rank { display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 0.74rem; font-weight: 700; }
.tm-conds { margin: 0.15rem 0 0; padding-left: 1rem; font-size: 0.78rem; color: var(--text); }
.tm-section td { background: var(--surface-2); color: var(--muted); font-size: 0.75rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }
.tm-section .count { color: var(--text); margin-left: 0.3rem; }
.tm-sim { background: color-mix(in srgb, var(--primary-soft) 70%, transparent) !important; box-shadow: inset 2px 0 0 var(--primary), inset -2px 0 0 var(--primary); }
th.tm-sim { box-shadow: inset 2px 0 0 var(--primary), inset -2px 0 0 var(--primary), inset 0 3px 0 var(--primary); }
.pill { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.12rem 0.55rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.pill-ok { color: var(--ok); background: var(--ok-soft); }
.pill-no { color: var(--danger); background: var(--danger-soft); }
.tm-side .card { margin-bottom: 0; }
/* Quando l'area di lavoro e' stretta il simulatore sale sopra la matrice, con i campi affiancati:
   si cambia un valore e si vede subito la colonna del Tier che si accende. */
@container (max-width: 1000px) {
    .tm-layout { grid-template-columns: minmax(0, 1fr); }
    .tm-side { order: -1; }
    .sim-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 1rem; }
}
.sim-presets { margin: -0.3rem 0 0.8rem; line-height: 1.7; }
.tm-sim-result { margin-top: 0.8rem; padding: 0.7rem 0.9rem; border: 1px solid var(--primary); border-radius: 6px; background: var(--primary-soft); }
.tm-sim-tier { display: flex; align-items: center; gap: 0.45rem; font-size: 1.12rem; margin-top: 0.2rem; }
.tm-sim-result .alert { margin: 0.5rem 0 0; }
.tm-trace { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.55rem; }
.tm-trace-head { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.tm-trace-conditions { list-style: none; margin: 0.35rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }

/* Menu Start per gruppo */
.segmented { display: inline-flex; border: 1.5px solid var(--primary); border-radius: 999px; overflow: hidden; }
.segmented button { border: 0; border-radius: 0; padding: 0.38rem 0.95rem; background: var(--surface); }
.segmented button + button { border-left: 1.5px solid var(--primary); }
.segmented button.active { background: var(--primary); color: var(--on-primary); }
.group-picker { margin: 0.2rem 0 0.5rem; gap: 0.4rem; }
.chip-toggle { border: 1px solid var(--line-strong); color: var(--text); background: var(--surface); border-radius: 999px; padding: 0.22rem 0.8rem; font-weight: 500; font-size: 0.84rem; gap: 0.3rem; }
.chip-toggle:hover { border-color: var(--primary); background: var(--surface); }
.chip-toggle.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.startmenu-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }
.startmenu-layout .card { margin-bottom: 0; }
.startmenu-head h2 { margin: 0; }
.sm-root { padding: 0.6rem 0.5rem 0.2rem; }
.sm-tree, .sm-tree ul { list-style: none; margin: 0; padding: 0; }
.sm-tree ul { margin-left: 1.4rem; border-left: 1px dashed var(--border); padding-left: 0.4rem; }
.sm-folder-head, .sm-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.32rem 0.5rem; border-radius: 4px; }
.sm-item:hover { background: var(--surface-2); }
.sm-text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.sm-folder-icon { width: 20px; height: 16px; border-radius: 2px 3px 3px 3px; background: var(--accent); position: relative; flex-shrink: 0; }
.avail { list-style: none; margin: 0; padding: 0; }
.avail li { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border); }
.avail li:last-child { border-bottom: 0; }
.avail li > div { flex: 1; }

/* Piani ed esecuzioni */
.phase { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 0.6rem; overflow: hidden; }
.phase-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.8rem; background: var(--surface-2); }
.phase-kinds { margin-left: auto; display: flex; gap: 0.3rem; }
.phase .step { border: 0; border-top: 1px solid var(--border); border-radius: 0; margin: 0; }
.step { background: var(--surface); }
.step.manual { border-left: 4px solid var(--manual) !important; }
.step.checkpoint { border-left: 4px solid var(--checkpoint) !important; }
.step.auto { border-left: 4px solid var(--auto) !important; }
.step-head { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; width: 100%; border: 0; border-radius: 0; background: none; color: var(--text); font-weight: 400; padding: 0.5rem 0.8rem; text-align: left; white-space: normal; }
.step-head:hover { background: var(--surface-2); }
.step-head > .icon:last-child { margin-left: auto; color: var(--muted); }
.step-order { font-family: var(--mono); color: var(--muted); }
.step-target { font-size: 0.86rem; }
.step-body { padding: 0 1rem 0.7rem 2.6rem; }
.step-state { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; }
.step-state.ok { background: var(--ok); color: #fff; }
.step-state.busy { border: 2px solid var(--primary); border-right-color: transparent; animation: spin 0.8s linear infinite; }
table.diff { font-size: 0.8rem; }
.approvals { list-style: none; margin: 0 0 0.8rem; padding: 0; }
.approvals li { padding: 0.4rem 0; }
.run-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.run-steps li { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0; }
.run-steps li > span:nth-child(2) { flex: 1; }
.rs-dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; border: 2px solid var(--border); }
.rs-ok .rs-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.rs-busy .rs-dot { border-color: var(--primary); border-right-color: transparent; animation: spin 0.8s linear infinite; }
.rs-wait { color: var(--muted); }

/* La fascia che dice che cosa si sta guardando */
.sim-banner { position: absolute; left: 0; right: 0; bottom: 0; z-index: 50; padding: 0.4rem 1rem; background: rgba(23, 33, 49, 0.92); color: #eef2f7; font-size: 0.78rem; text-align: center; pointer-events: none; letter-spacing: 0.01em; }

/* ---------------------------------------------------------------- larghezze */
/* Il pannello dell'area si nasconde prima che nel prodotto: dentro l'iframe lo spazio e' quello della landing. */
@media (max-width: 1240px) {
    .subnav, .crumb-panel { display: none; }
}

@media (max-width: 1100px) {
    .startmenu-layout { grid-template-columns: minmax(0, 1fr); }
    main.page { padding: 1.1rem 1.1rem 2.6rem; }
    .masthead-org, .user-text { display: none; }
}

@media (max-width: 700px) {
    body { font-size: 13.5px; }
    .masthead-product, .masthead-divider { display: none; }
    .masthead [data-theme], .masthead [data-about] { display: none; }
    .rail { position: absolute; top: 52px; bottom: 0; left: 0; width: 0; padding: 0; }
    #ef-app.rail-open .rail { width: 220px; padding: 0.4rem; box-shadow: 8px 0 24px rgba(0, 0, 0, 0.3); }
    .crumbbar { padding: 0.3rem 0.8rem; }
    h1 { font-size: 1.35rem; }
    dl.props { grid-template-columns: 1fr; gap: 0.1rem; }
    dl.props dd { margin-bottom: 0.4rem; }
    footer.footer { padding: 0.8rem 1rem 2.4rem; }
    .tabs { gap: 0.9rem; }
    .setup-card .progress { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
