/*
 * Lo stile della simulazione di Citadel: le classi delle sue pagine, sopra la base comune di
 * platform/shell.css. Misure e colori da src/web/Corellix.Citadel (index.css, le pagine).
 */

#cx-app { height: 100%; }

.cx-nav { position: relative; display: flex; flex-shrink: 0; z-index: 30; }
.rail-btn.peek { color: #E2E8F0; background: rgba(255, 255, 255, 0.07); }
.panel.cx-flyout { position: absolute; left: 76px; top: 0; bottom: 0; z-index: 10; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35); }
.panel.cx-flyout.hidden { display: flex !important; }

.cx-menu { display: none; }
.cx-theme { display: flex; align-items: center; gap: 2px; padding: 2px; border-radius: var(--radius-c); background: var(--line-soft); }
.dark .cx-theme { background: #1F2937; }
.cx-theme button { padding: 6px; border-radius: 3px; color: var(--faint); }
.cx-theme button:hover { color: var(--ink-3); }
.cx-theme button.on { background: var(--surface); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12); }
.dark .cx-theme button.on { background: #374151; }
.cx-theme button.sun { color: #EAB308; }
.cx-theme button.moon { color: var(--p300); }
.cx-sep { width: 1px; height: 20px; margin: 0 6px; background: var(--input-line); }
.cx-clock { color: var(--muted); font-size: 14px; }
.cx-logout:hover { color: #EF4444; background: transparent; }

.cx-up-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 4px;
    padding: 6px 10px;
    border-radius: var(--radius-c);
    font-size: 12px;
    font-weight: 600;
}
.cx-up-pill.run { background: var(--p50); color: var(--p-ink); }
.cx-up-pill.ok { background: var(--ok-bg); color: var(--ok-ink); }

.cx-pill-link { cursor: pointer; }
.cx-pill-link:hover { background: var(--p100); }

.cx-mt { margin-top: 16px; }
.cx-mt4 { margin-top: 4px; }
.cx-mb { margin-bottom: 16px; }
.cx-w80 { width: 80px; flex: none; }
.cx-h2 { margin: 0; font-size: 14px; font-weight: 600; }
.cx-h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.cx-h3 svg { color: var(--faint); }
.cx-link { display: inline-flex; align-items: center; gap: 4px; color: var(--p-ink-soft); font-size: 12px; }
.cx-link:hover { text-decoration: underline; }
.cx-amber-ink { color: var(--warn); }
.cx-green-ink { color: var(--ok); }
.cx-blue { color: var(--p500); }
.cx-blue-ink { color: var(--p-ink-soft); }
.cx-red { color: var(--bad-dot); }
.cx-amber { color: var(--warn-dot); }
.cx-sec-head { margin-bottom: 8px; }
.tbl tr.cx-fresh td { background: var(--p50); }

/* ---------------------------------------------------------------- Dashboard */
.cx-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.cx-stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cx-stat { padding: 16px; }
.cx-stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.cx-stat-top svg { color: var(--input-line); }
.cx-stat-value { margin-top: 8px; font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cx-stat-value.good { color: var(--ok); }
.cx-stat-value.warn { color: var(--warn); }
.cx-stat-sub { margin-top: 4px; color: var(--faint); font-size: 12px; }

.cx-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cx-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cx-span-2 { grid-column: span 2; }
.cx-node-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.cx-node-row:first-of-type { border-top: 0; }
.cx-role { padding: 1px 6px; border-radius: 999px; background: var(--p50); color: var(--p-ink); font-size: 10px; font-weight: 500; }
.cx-node-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; color: var(--faint); font-size: 12px; }
.cx-count { padding: 1px 6px; border-radius: 999px; background: #FEF3C7; color: #B45309; font-size: 10px; font-weight: 600; }
.dark .cx-count { background: rgba(120, 53, 15, 0.4); color: #FCD34D; }
.cx-allgood { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 16px; color: var(--ok-dot); text-align: center; }
.cx-allgood p { margin: 0; color: var(--muted); font-size: 13px; }
.cx-attn { display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line-soft); }
.cx-attn:first-of-type { border-top: 0; }
.cx-attn > svg { margin-top: 2px; }

/* ---------------------------------------------------------------- Cluster */
.cx-cluster-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.cx-grid-nodes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cx-comps { margin-top: 10px; }
.cx-comp { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.cx-comp .xs { max-width: 50%; }

/* ---------------------------------------------------------------- Platform Services */
.cx-chev { color: var(--faint); transition: transform 0.15s; }
.cx-chev.open { transform: rotate(90deg); }
tr.cx-sub td { padding: 0 16px 14px 44px; background: var(--surface-2); }
.dark tr.cx-sub td { background: rgba(31, 41, 55, 0.35); }
.cx-pods { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; padding-top: 12px; }
.cx-pod { padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.cx-pod > * + * { margin-top: 6px; }
.cx-usage { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.cx-usage > span:first-child { width: 30px; flex-shrink: 0; }

/* ---------------------------------------------------------------- Storage */
.cx-cap { height: 10px; margin: 14px 0 8px; }
.cx-cap-legend { display: flex; gap: 24px; color: var(--muted); font-size: 13px; }
.cx-cap-legend b { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------------- Lifecycle Management */
.cx-job { border-left: 4px solid var(--p500); margin-bottom: 16px; }
.cx-job.done { border-left-color: var(--ok-dot); }
.cx-job-sub { margin: 2px 0 0; }
.cx-job-count { margin: 12px 0 4px; }
.cx-problem { margin: 8px 0 0; padding: 8px 12px; border: 1px solid var(--warn-line); border-radius: var(--radius-c); background: var(--warn-bg); color: var(--warn-ink); font-size: 12px; }
.cx-phase { margin-top: 16px; }
.cx-phase-title { margin: 0 0 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.cx-steps { margin: 0; padding: 0; list-style: none; }
.cx-step { padding: 6px 0; border-top: 1px solid var(--line-soft); }
.cx-step:first-child { border-top: 0; }
.cx-step .row { gap: 10px; }
.cx-step-mark { display: flex; justify-content: center; width: 16px; flex-shrink: 0; }
.cx-ok-mark { color: var(--ok); font-size: 12px; font-weight: 700; }
.cx-wait-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--input-line); }
.cx-step-bar { height: 4px; margin: 4px 0 0 26px; }
.cx-step-note { margin: 2px 0 0 26px; color: var(--ink-3); font-size: 11px; }
.cx-blockers { gap: 12px; flex-wrap: wrap; }
.cx-blockers .row { gap: 6px; }
.cx-track { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin: 4px 0 0 26px; padding: 0; list-style: none; color: var(--faint); font-size: 11px; }
.cx-track li.sep { color: var(--input-line); }
.cx-track li.passed { color: var(--ok); }
.cx-track li.now { color: var(--p-ink-soft); font-weight: 600; }

.cx-lcm-node { min-width: 0; }
.cx-lcm-node > * + * { margin-top: 10px; }
.cx-node-state { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; }
.cx-node-state.ok { color: var(--ok); }
.cx-node-state.warn { color: var(--warn); }
.cx-node-state.bad { color: var(--bad); }
.cx-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 12px; }
.cx-dl dt { color: var(--muted); }
.cx-dl dd { margin: 0; color: var(--ink-2); }

.cx-upgrade { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.cx-upgrade > * + * { margin-top: 12px; }
.cx-scope { margin: 0; padding: 0; border: 0; font-size: 12px; }
.cx-scope legend { margin-bottom: 4px; padding: 0; color: var(--muted); }
.cx-scope label { display: flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--ink-2); }
.cx-plan { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-c); }
.cx-plan > * + * { margin-top: 12px; }
.cx-plan ul, .cx-plan ol { margin: 0; padding-left: 18px; font-size: 12px; }
.cx-plan ul { padding-left: 0; list-style: none; }
.cx-plan p.xs { margin: 4px 0 0; }

/* ---------------------------------------------------------------- Backup, licenza */
.cx-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; margin-top: 12px; }
.cx-lic-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: 13px; }
.cx-lic-row:first-of-type { border-top: 0; }
.cx-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cx-feat { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.cx-feat li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.cx-feat svg { color: var(--ok); }

/* ---------------------------------------------------------------- larghezze */
@media (max-width: 1180px) {
    .cx-grid-nodes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cx-hide-sm { display: none; }
}

@media (max-width: 1000px) {
    .cx-menu { display: inline-flex; }
    .cx-pin { display: none; }
    .app.drawer .panel { display: flex; position: absolute; left: 76px; top: 0; bottom: 0; z-index: 40; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35); }
    .cx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cx-grid-3, .cx-grid-2, .cx-grid-nodes { grid-template-columns: minmax(0, 1fr); }
    .cx-span-2 { grid-column: auto; }
    .cx-cluster-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .app.drawer .panel { left: 60px; }
    .cx-clock, .cx-sep, .cx-theme { display: none; }
    .cx-stats, .cx-stats-3, .cx-form { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- le altre pagine */
.cx-kv { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: 13px; }
.cx-kv:first-of-type { border-top: 0; }
.cx-kv > .muted { width: 150px; flex-shrink: 0; }
.cx-kv .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-sub-h { margin: 14px 0 4px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.cx-mt8 { margin-top: 10px; }
.cx-nomt { margin-top: 0; }
.cx-big { margin-top: 4px; font-size: 20px; font-weight: 600; }
.cx-red-ink { color: var(--bad); }
.cx-filter { width: 220px; height: 30px; font-size: 12px; }
.cx-filter-wide { max-width: 420px; height: 30px; font-size: 12px; }
.cx-w160 { width: 160px; height: 30px; font-size: 12px; }
.cx-narrow { max-width: 560px; }
.cx-check { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.cx-warn-card { border-color: var(--warn-line); background: var(--warn-bg); }
.cx-bg-active { border-left: 4px solid var(--bad-dot); }
.cx-bg-active > .row { margin-bottom: 8px; }
.cx-issue { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.cx-issue:first-of-type { border-top: 0; }

.cx-switch { position: relative; width: 34px; height: 20px; flex-shrink: 0; border-radius: 999px; background: var(--input-line); transition: background-color 0.15s; }
.cx-switch i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.cx-switch.on { background: var(--p600); }
.cx-switch.on i { transform: translateX(14px); }

.cx-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.cx-opt { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); text-align: left; }
.cx-opt.on { border-color: var(--p500); background: var(--p50); box-shadow: 0 0 0 2px rgba(59, 85, 173, 0.15); }

.cx-map { padding: 12px; }
.cx-map svg { display: block; }
.cx-map-node { fill: var(--surface-2); stroke: var(--line); stroke-width: 1.5; }
.cx-map-node.down { stroke: var(--bad-dot); stroke-dasharray: 5 4; }
.cx-map-comp { fill: var(--p50); stroke: var(--p200); }
.cx-map-comp.down { fill: var(--line-soft); stroke: var(--line); }
.cx-map-actor { fill: var(--surface); stroke: var(--faint); stroke-dasharray: 4 3; }
.cx-map-storage { fill: rgba(147, 51, 234, 0.08); stroke: rgba(147, 51, 234, 0.4); }
.cx-map-title { fill: var(--ink); font-size: 13px; font-weight: 600; font-family: ui-monospace, Menlo, monospace; }
.cx-map-label { fill: var(--ink-2); font-size: 11px; }
.cx-map-link { fill: none; stroke: var(--p500); stroke-width: 1.6; stroke-dasharray: 6 5; animation: cx-map-flow 1.2s linear infinite; }
@keyframes cx-map-flow { to { stroke-dashoffset: -22; } }
.cx-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 10px; }
.cx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cx-l { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.cx-l.comp { background: var(--p50); border: 1px solid var(--p200); }
.cx-l.storage { background: rgba(147, 51, 234, 0.08); border: 1px solid rgba(147, 51, 234, 0.4); }
.cx-l.node { background: var(--surface-2); border: 1px solid var(--line); }
.cx-l.actor { border: 1px dashed var(--faint); }

@media (max-width: 1000px) {
    .cx-choice { grid-template-columns: minmax(0, 1fr); }
    .cx-kv > .muted { width: 120px; }
}
