/* Mindly Way Studio — control room. Left rail with the MW monogram, content column; completed job phases reveal
   the channel banner gradient (#0DC0E0 → #4AC8BD → #86CE9C → #C3D67A → #FEDD58). Dark first, light variant.
   Fonts are served locally (no Google Fonts on the public server). */
@font-face { font-family: "Bebas Neue"; src: url("/static/fonts/BebasNeue-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Barlow"; font-weight: 400; src: url("/static/fonts/Barlow-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Barlow"; font-weight: 500; src: url("/static/fonts/Barlow-Medium.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Barlow"; font-weight: 600; src: url("/static/fonts/Barlow-SemiBold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Barlow"; font-weight: 700; src: url("/static/fonts/Barlow-Bold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "JetBrains Mono"; font-weight: 100 800; src: url("/static/fonts/JetBrainsMono-VF.ttf") format("truetype"); font-display: swap; }

:root {
  --bg: #091315; --bg-2: #0d1a1d; --panel: #112225; --line: #1c3337; --line-2: #284549;
  --fg: #f1f7f5; --muted: #9ab4b2; --faint: #6f8c90;
  --accent: #27c6d6; --accent-ink: #04211f; --link: #5fd6e6;
  --grad: linear-gradient(90deg, #0DC0E0 0%, #4AC8BD 25%, #86CE9C 50%, #C3D67A 75%, #FEDD58 100%);
  --ok: #74d79c; --ok-bg: rgba(116,215,156,.14); --warn: #f2c64a; --warn-bg: rgba(242,198,74,.14);
  --bad: #f07b73; --bad-bg: rgba(240,123,115,.14); --run: #34c9e6; --run-bg: rgba(52,201,230,.15);
  --skip: #8aa3a6; --skip-bg: rgba(138,163,166,.14);
  --f-display: "Bebas Neue", "Oswald", "Arial Narrow", Impact, sans-serif;
  --f-body: "Barlow", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --r: 10px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f2f8f8; --bg-2: #e6f1f1; --panel: #ffffff; --line: #d3e4e4; --line-2: #b9d3d3;
  --fg: #0d2326; --muted: #4a6a6c; --faint: #6d8889; --accent: #0b8f9c; --accent-ink: #ffffff; --link: #0b6e85;
  --ok: #1d8650; --ok-bg: rgba(29,134,80,.11); --warn: #8a6400; --warn-bg: rgba(148,108,0,.12);
  --bad: #b73f3a; --bad-bg: rgba(183,63,58,.10); --run: #0a7fa3; --run-bg: rgba(10,127,163,.10);
  --skip: #66807f; --skip-bg: rgba(102,128,127,.10);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 14.5px/1.5 var(--f-body); }
a { color: var(--link); }
code, .mono { font-family: var(--f-mono); font-size: 12px; overflow-wrap: anywhere; }
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }

/* rail */
.rail { background: var(--bg-2); border-right: 1px solid var(--line); padding: 22px 16px; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 12px; padding-left: 4px; text-decoration: none; color: var(--fg); }
.brand svg { width: 52px; height: 52px; flex: none; }
.brand div { display: flex; flex-direction: column; gap: 3px; }
.brand b { font: 400 25px/0.9 var(--f-display); letter-spacing: .04em; }
.brand span { font: 600 10.5px/1 var(--f-body); text-transform: uppercase; letter-spacing: .22em; color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--fg); background: var(--panel); }
.nav a[aria-current="page"] { color: var(--fg); background: var(--panel); box-shadow: inset 2px 0 0 var(--accent); }
.nav a small { font: 500 10px/1 var(--f-mono); color: var(--faint); }
.nav a .live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.rail-foot { margin-top: auto; font-size: 12px; color: var(--faint); padding-left: 8px; display: grid; gap: 8px; }
.rail-foot form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; }

/* main */
main { padding: 22px max(16px, 2.2vw) 120px; min-width: 0; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 22px;
  padding-bottom: 16px; position: relative; }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 2px; background: var(--grad); }
.top h1 { font: 400 clamp(34px, 4.2vw, 46px)/0.95 var(--f-display); letter-spacing: .03em; margin: 0; }
.tagline { font: 400 15px/1 var(--f-display); letter-spacing: .12em; background: var(--grad); -webkit-background-clip: text;
  background-clip: text; color: transparent; margin: 0 0 6px; }
.top p.sub { margin: 4px 0 0; color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); font-size: 12px; color: var(--muted); }
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.status-pill.on i { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); animation: pulse 2s infinite; }
.status-pill.stale i { background: var(--warn); }
.status-pill.down i { background: var(--bad); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }
.iconbtn, .bell { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg); cursor: pointer; padding: 0; text-decoration: none; }
.iconbtn svg, .bell svg { width: 19px; height: 19px; }
.bell .count { position: absolute; top: -6px; right: -7px; background: var(--warn); color: #1b1300; border-radius: 999px;
  font: 700 11px/1 var(--f-body); padding: 3px 6px; }
.bell .count.hi { background: var(--bad); color: #fff; }

.section-title { font: 600 12px/1 var(--f-body); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 30px 0 12px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 6px; min-width: 0; }
.kpi label { font-size: 12px; color: var(--muted); }
.kpi strong { font: 400 38px/0.95 var(--f-display); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.kpi strong.bad { color: var(--bad); }
.kpi em { font-style: normal; font-size: 12px; color: var(--faint); }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar.thick { height: 10px; }
.bar > span { display: block; height: 100%; width: calc(var(--w, 0) * 1%); background: var(--grad);
  background-size: calc(10000% / max(var(--w, 1), 1)) 100%; border-radius: 3px; min-width: 2px; }

/* jobs */
.jobs { display: grid; gap: 14px; }
.job { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 12px; min-width: 0; }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: flex-start; }
.job-main { display: flex; gap: 14px; min-width: 0; align-items: flex-start; }
.job-thumb { width: 112px; aspect-ratio: 16/9; border-radius: 6px; object-fit: cover; background: var(--bg-2); border: 1px solid var(--line); flex: none; }
.job-title { display: grid; gap: 3px; min-width: 0; }
.job-title b { font-size: 16px; font-weight: 600; }
.job-title b a { color: inherit; text-decoration: none; } .job-title b a:hover { text-decoration: underline; }
.job-title code { color: var(--faint); font-size: 11.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; font: 600 11px/1 var(--f-body); letter-spacing: .04em; padding: 5px 9px;
  border-radius: 999px; background: var(--skip-bg); color: var(--skip); white-space: nowrap; }
.chip.fmt { background: transparent; border: 1px solid var(--line-2); color: var(--fg); }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.run { background: var(--run-bg); color: var(--run); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.pipeline { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 3px; }
.seg { height: 10px; border-radius: 2px; background: var(--line); }
/* each completed phase shows its own slice of the gradient: a finished video reads as the channel banner */
.seg.done { background: var(--grad); background-size: 1300% 100%; background-position: calc(var(--i) / 12 * 100%) 0; }
.seg.fail { background: var(--bad); } .seg.back { background: var(--warn); }
.seg.run { background: var(--run); animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }
.pipe-labels { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 3px; font: 500 9.5px/1.2 var(--f-mono); color: var(--faint); }
.pipe-labels span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipe-labels span.cur { color: var(--run); }
.job-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13px; color: var(--muted); }
.job-meta b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.note { color: var(--muted); font-size: 13px; margin: 0; }
.note.bad { color: var(--bad); }
details.more { border-top: 1px solid var(--line); padding-top: 10px; }
details.more summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 18px; margin-top: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--f-mono); font-size: 12px; }
td.val { color: var(--muted); font-family: var(--f-mono); font-size: 11.5px; overflow-wrap: anywhere; }
.tbl-wrap { overflow-x: auto; }
.empty { border: 1px dashed var(--line-2); border-radius: var(--r); padding: 22px; color: var(--muted); display: grid; gap: 6px; }
.empty b { color: var(--fg); }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.span-all { grid-column: 1 / -1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 10px; min-width: 0; align-content: start; }
.card h3 { margin: 0; font: 400 22px/1 var(--f-display); letter-spacing: .04em; }
.card h4 { margin: 4px 0 0; font: 600 13px/1.3 var(--f-body); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.card p { margin: 0; color: var(--muted); }
.soon { font: 500 11px/1 var(--f-mono); color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.ok { color: var(--ok); } .ko, .bad { color: var(--bad); } .warn { color: var(--warn); } .muted { color: var(--muted); }
.mix { display: grid; gap: 8px; }
.mix-row { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 70px; gap: 10px; align-items: center; font-size: 13px; }
.mix-row .pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-family: var(--f-mono); font-size: 12px; }
.example-tag { font: 600 10px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--warn); background: var(--warn-bg);
  padding: 4px 7px; border-radius: 4px; justify-self: start; }

/* forms */
input[type=text], input[type=password], input[type=url], input[type=search], select, textarea {
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--fg); font: inherit; min-width: 0; }
.field-full { width: 100%; }
button, .btn { font: 600 13px var(--f-body); border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); color: var(--fg);
  padding: 9px 14px; cursor: pointer; text-decoration: none; display: inline-block; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.ghost { background: transparent; } button.danger { background: transparent; color: var(--bad); }
button[disabled] { opacity: .55; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
label.lbl { display: block; margin: 12px 0 4px; font-weight: 600; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid var(--line-2); background: var(--panel); }
.flash.ok { border-color: var(--ok); } .flash.ko { border-color: var(--bad); }

/* market */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.thumb { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.thumb img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2); }
.thumb b { color: var(--fg); font-weight: 600; }
.swatches { display: flex; gap: 4px; } .swatches i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line-2); }
.prose { color: var(--fg); max-width: 860px; } .prose h1, .prose h2, .prose h3 { font-family: var(--f-display); letter-spacing: .04em; font-weight: 400; }
.prose pre, pre.pre { white-space: pre-wrap; font: 12px/1.55 var(--f-mono); background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; }
.diff-add { color: var(--ok); } .diff-del { color: var(--bad); } .diff-hd { color: var(--faint); }
audio, video { width: 100%; max-width: 640px; }

/* login */
.narrow { max-width: 420px; margin: 8vh auto; padding: 0 16px; }
.narrow .brand { justify-content: center; margin-bottom: 18px; }

/* Jolly: floating assistant on every page */
.jolly-fab { position: fixed; right: 22px; bottom: 22px; width: 60px; height: 60px; border-radius: 50%; border: 0; padding: 0;
  background: var(--grad); color: #06302f; cursor: pointer; z-index: 30; box-shadow: 0 10px 30px rgba(0,0,0,.35), 0 0 0 4px rgba(39,198,214,.18);
  display: grid; place-items: center; transition: transform .15s; }
.jolly-fab:hover { transform: translateY(-2px); }
.jolly-fab svg { width: 28px; height: 28px; }
.jolly-fab .badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad);
  color: #fff; font: 700 11px/18px var(--f-body); border: 2px solid var(--bg); }
.jolly-panel { position: fixed; right: 22px; bottom: 96px; width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100vh - 130px));
  z-index: 29; background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.45);
  display: flex; flex-direction: column; overflow: hidden; }
.jolly-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.jolly-head b { font: 400 22px/1 var(--f-display); letter-spacing: .05em; }
.jolly-head .ctx { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 9px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.jolly-head button { margin-left: auto; padding: 6px 10px; }
.jolly-body { flex: 1; overflow-y: auto; padding: 14px; display: grid; gap: 10px; align-content: start; }
.msg { padding: 10px 14px; border-radius: 12px; max-width: 92%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { background: var(--bg-2); border: 1px solid var(--line); justify-self: end; }
.msg.jolly { background: var(--panel); border: 1px solid var(--line-2); }
.msg.err { border-color: var(--bad); color: var(--bad); }
.msg small { display: block; font-size: 11px; color: var(--faint); margin-bottom: 3px; white-space: normal; }
.msg.typing { color: var(--muted); font-style: italic; }
.jolly-foot { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.jolly-foot textarea { flex: 1; min-width: 0; resize: none; height: 42px; max-height: 120px; }
.jolly-foot button { padding: 9px 12px; }
.jolly-hint { font-size: 11.5px; color: var(--faint); padding: 0 12px 10px; }

@media (max-width: 1080px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) { .cols, .grid2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center; gap: 14px; padding: 10px 16px;
    border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .brand svg { width: 36px; height: 36px; } .brand div, .rail-foot { display: none; }
  .nav { flex-direction: row; } .nav a { white-space: nowrap; } .nav a small { display: none; }
  main { padding: 16px 16px 110px; }
  .pipe-labels { display: none; }
  .grid3 { grid-template-columns: minmax(0, 1fr); }
  .job-thumb { width: 84px; }
  .mix-row { grid-template-columns: 96px minmax(0, 1fr) 56px; }
  .jolly-panel { right: 0; left: 0; bottom: 0; width: auto; height: min(80vh, 640px); border-radius: 16px 16px 0 0; }
  .jolly-fab { right: 16px; bottom: 16px; width: 54px; height: 54px; }
}
@media (prefers-reduced-motion: reduce) { .seg.run, .status-pill.on i { animation: none; } }
.narrow .card.narrow { margin: 0; padding: 18px; max-width: none; }
.narrow .card h1 { font: 400 30px/1 var(--f-display); letter-spacing: .04em; margin: 0 0 6px; }
.narrow input[type=text], .narrow input[type=password] { width: 100%; }
.narrow label { display: block; margin: 12px 0 4px; font-weight: 600; }
.narrow button { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.lvl { font: 700 11px/1 var(--f-body); text-transform: uppercase; letter-spacing: .06em; }
.jolly-panel[hidden] { display: none; }
@media (max-width: 760px) {
  .jolly-panel:not([hidden]) ~ .jolly-fab { display: none; }
  .jolly-hint { display: none; }
  .top h1 { font-size: 30px; overflow-wrap: anywhere; }
  .topbar { justify-content: space-between; }
}
/* rail colour continues below the sticky rail on long pages */
.app { background: linear-gradient(90deg, var(--bg-2) 235px, var(--line) 235px 236px, transparent 236px); }
@media (max-width: 760px) { .app { background: none; } }

/* microphone while listening */
#jolly-mic.rec { background: var(--bad, #f07b73); border-color: var(--bad, #f07b73); color: #fff; animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 50% { box-shadow: 0 0 0 6px rgba(240,123,115,.25); } }
@media (prefers-reduced-motion: reduce) { #jolly-mic.rec { animation: none; } }

/* organisation map (/mappa): click a node to light up only its lines */
.org-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 14px; }
.org-switch { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; gap: 2px; }
.org-switch a { padding: 6px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 13px; }
.org-switch a[aria-current] { background: var(--accent); color: var(--accent-ink); }
.org-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 0; padding: 0; font-size: 12.5px; color: var(--muted); }
.org-legend li { display: inline-flex; align-items: center; gap: 7px; }
.org-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.org-canvas { padding: 8px; }
#org-svg { width: 100%; height: auto; display: block; }
.org-edge { fill: none; stroke-width: 1.8; opacity: .55; transition: opacity .2s; }
.org-elabel { font: 500 11.5px var(--f-body); fill: var(--fg); paint-order: stroke; stroke: var(--panel); stroke-width: 4px;
  stroke-linejoin: round; opacity: 0; pointer-events: none; transition: opacity .2s; }
.org-node { cursor: pointer; outline: none; transition: opacity .2s; }
.org-node circle { fill-opacity: .16; stroke-width: 2.5; transition: fill-opacity .2s; }
.org-node.st-costruzione circle { stroke-dasharray: 7 5; }
.org-node.st-proposto circle { stroke-dasharray: 2 5; stroke-linecap: round; }
.org-node.st-spento { opacity: .45; }
.org-node:hover circle, .org-node:focus-visible circle { fill-opacity: .32; }
.org-node:focus-visible circle { stroke-width: 4; }
.org-in { font: 400 21px var(--f-display); letter-spacing: .04em; fill: var(--fg); pointer-events: none; }
.org-name { font: 600 13px var(--f-body); fill: var(--fg); paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
#org-svg.focused .org-edge { opacity: .07; }
#org-svg.focused .org-edge.on { opacity: 1; stroke-width: 2.6; }
#org-svg.focused .org-elabel.on { opacity: 1; }
#org-svg.focused .org-node { opacity: .28; }
#org-svg.focused .org-node.near, #org-svg.focused .org-node.sel { opacity: 1; }
#org-svg.focused .org-node.sel circle { fill-opacity: .4; stroke-width: 4; }
.org-side { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.org-side h3 { margin: 0 0 8px; } .org-side h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.org-side p { margin: 0 0 8px; }
.org-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.org-list li { padding-left: 10px; border-left: 3px solid var(--line-2); }
.org-list li.k-guida { border-color: #27C6D6; } .org-list li.k-dati { border-color: #FEDD58; } .org-list li.k-lavoro { border-color: #9AB4B2; }
.org-temper { list-style: none; padding: 0; margin: 10px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: 12.5px; }
.org-temper li { display: flex; align-items: center; gap: 7px; } .org-temper i { width: 11px; height: 11px; border-radius: 50%; flex: none; }
:root[data-theme="light"] .org-in { fill: #0d2326; }
@media (max-width: 1080px) { .org-wrap { grid-template-columns: minmax(0, 1fr); } .org-side { position: static; max-height: none; } }
@media (max-width: 760px) { .org-canvas { overflow-x: auto; } #org-svg { min-width: 640px; } }

/* Jolly proposals: what changes, then yes / no */
.msg.action { border-color: var(--accent); white-space: normal; display: grid; gap: 6px; max-width: 100%; }
.msg.action b { font-weight: 700; }
.msg.action p { margin: 0; }
.msg.action .changes { list-style: none; margin: 2px 0; padding: 8px 10px; background: var(--bg-2); border-radius: 8px;
  font: 12px/1.5 var(--f-mono); max-height: 220px; overflow-y: auto; display: grid; gap: 2px; }
.msg.action .changes li { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.action .changes li.add { color: var(--ok); } .msg.action .changes li.del { color: var(--bad); }
.action-btns { display: flex; gap: 8px; }
.action-btns button { padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg-2);
  color: var(--fg); font: 600 13px var(--f-body); cursor: pointer; }
.action-btns button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.action-btns button:disabled { opacity: .6; cursor: progress; }
.action-hint { font-size: 11.5px; color: var(--faint); }
.msg.action .outcome { font-weight: 600; } .msg.action .outcome.confirmed { color: var(--ok); }
.msg.action .outcome.failed, .msg.action .outcome.errore, .msg.action .outcome.expired { color: var(--bad); }
.msg.action .outcome.discarded { color: var(--muted); }
#jolly-mic.wait { animation: breathe 1.2s ease-in-out infinite; cursor: progress; }
.jolly-dictation { padding: 0 14px 4px; font-size: 12px; color: var(--accent); }

/* production plan (/palinsesto): levers */
.plan-form h3 { margin: 14px 0 8px; } .plan-form h3:first-child { margin-top: 0; }
.lever { display: grid; grid-template-columns: minmax(120px, 210px) minmax(0, 1fr) 52px; gap: 12px; align-items: center;
  padding: 6px 0; font-size: 13.5px; }
.lever > span { display: grid; gap: 2px; } .lever > span small { font-size: 11.5px; }
.lever output { text-align: right; font: 600 13px var(--f-mono); color: var(--fg); }
.lever input[type=range] { width: 100%; accent-color: var(--accent); }
.lever input[type=number], .lever input[type=text] { width: 100%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--fg); font: inherit; }
.lever.wide { grid-template-columns: minmax(120px, 210px) minmax(0, 1fr); }
.plan-actions { display: grid; gap: 6px; }
.est-grid { display: flex; flex-wrap: wrap; gap: 8px 32px; margin-bottom: 8px; }
.est-grid div { display: grid; gap: 2px; } .est-grid strong { font-size: 20px; font-weight: 600; } .est-grid strong.bad { color: var(--bad); }
.est-grid small { font-size: 13px; color: var(--muted); font-weight: 400; }
table.est td small { line-height: 1.6; }
.env { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; margin-top: 10px; }
.bar > span.over { background: var(--bad); }
@media (max-width: 760px) { .lever { grid-template-columns: minmax(0, 1fr) 52px; } .lever > span { grid-column: 1 / -1; } }
.org-node.st-parziale circle { stroke-dasharray: 14 4; }

/* Brain (/cervello) */
.brain-run form { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.brain-run { margin: 16px 0; }
.proposal h3 { margin-bottom: 6px; } .proposal form { margin-top: 10px; }
.brain-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0; }
.brain-thumbs a { display: grid; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11.5px; }
.brain-thumbs img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.brain-forms { margin-top: 16px; }
.brain-forms form { display: grid; gap: 10px; align-content: start; }
.brain-forms textarea, .brain-forms input[type=url], .brain-forms input[type=text] { width: 100%; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--fg); font: inherit; }
.brain-forms button { justify-self: start; }
.scout-settings > .grid2 { margin-bottom: 12px; }
.lever .chips { gap: 6px; } .lever input[type=checkbox] { justify-self: start; width: 18px; height: 18px; accent-color: var(--accent); }
.lever input[type=time] { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--fg); font: inherit; justify-self: start; }
.scout-settings > button { justify-self: start; } .scout-settings { display: grid; }
form.card { display: grid; gap: 8px; } form.card > button { justify-self: start; }
.voice-card audio, .grid2 audio { width: 100%; margin: 6px 0; }
.approve-card .action-btns { flex-wrap: wrap; align-items: center; } .approve-card form.reject { display: flex; gap: 8px; flex: 1; min-width: 280px; } .approve-card input[type=text] { flex: 1; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--fg); font: inherit; }

.prod-status { margin-bottom: 16px; }
.prod-steps { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 6px; font-size: 13.5px; }
.prod-steps li span { display: inline-block; width: 20px; font-weight: 700; }
.prod-steps li.ok span { color: var(--ok); } .prod-steps li.ko span { color: var(--bad); }
.prod-status form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
form.stack { display: grid; gap: 10px; margin-top: 8px; } form.stack > button { justify-self: start; }
form.stack label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
form.stack input[type=text], form.stack textarea { width: 100%; padding: 9px 11px; border-radius: 8px; font: inherit; }
form.stack textarea { font-family: var(--mono, ui-monospace, monospace); font-size: .85rem; line-height: 1.5; }
form.produce-now { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
form.produce-now label { display: flex; gap: 6px; align-items: center; }
form.produce-now input[type=number] { width: 64px; padding: 6px 8px; border-radius: 8px; }
form.produce-now small { flex-basis: 100%; }

/* ---- simple Studio (docs/08): dashboard, calendar, campaigns, costs */
:root { --s1: #0899b4; --s2: #b38f12; --s3: #9a5fd6; --s4: #409a66; }  /* validated on the dark surface */
:root[data-theme="light"] { --s1: #0a8ea6; --s2: #a8860f; --s3: #8a4fc7; --s4: #3e8f5e; }  /* validated on white */
.dash-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.switch-card .switch-state { font: 400 34px/1 var(--f-display); letter-spacing: .04em; margin: 4px 0 8px; display: flex; align-items: center; gap: 10px; }
.switch-card .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 4px var(--bad-bg); }
.switch-card.on .dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.switch-card.on .switch-state { color: var(--ok); } .switch-card.off .switch-state { color: var(--bad); }
.big-eur { font: 400 30px/1.1 var(--f-display); margin: 2px 0 8px; } .big-eur small { font: 400 15px var(--f-body); color: var(--muted); }
.meter { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 6px 0; }
.meter.thin { height: 6px; }
.meter > span { display: block; height: 100%; width: calc(var(--w) * 1%); border-radius: 999px; background: var(--grad); }
.meter > span.warn { background: var(--warn); } .meter > span.over { background: var(--bad); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.inline-form input[type=number] { width: 90px; padding: 6px 8px; border-radius: 8px; }
.inline-form input[type=text] { flex: 1; min-width: 160px; padding: 6px 8px; border-radius: 8px; }
.cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cal-day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.cal-day.past { opacity: .6; }
.cal-day h4 { margin: 0 0 8px; font: 600 13px var(--f-body); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: flex; justify-content: space-between; }
.cal-slot { display: grid; grid-template-columns: 44px 1fr; gap: 0 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.cal-slot:first-of-type { border-top: 0; }
.cal-slot .t { font-family: var(--f-mono); color: var(--fg); grid-row: span 2; }
.cal-slot .k { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.cal-slot.free em { color: var(--warn); font-style: normal; }
.cal-slot a.yt { font-size: 11px; }
.cal-compact { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.camp-row { padding: 8px 0; border-top: 1px solid var(--line); } .camp-row:first-of-type { border-top: 0; }
.camp-card { margin-bottom: 12px; } .camp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.segbar { display: flex; gap: 2px; height: 28px; margin: 10px 0; }
.segbar .cseg { width: calc(var(--w) * 1%); min-width: 2px; border-radius: 4px; color: #fff; font: 600 12px var(--f-body); display: flex; align-items: center; padding-left: 6px; overflow: hidden; }
.cseg.s1, .sw.s1 { background: var(--s1); } .cseg.s2, .sw.s2 { background: var(--s2); }
.cseg.s3, .sw.s3 { background: var(--s3); } .cseg.s4, .sw.s4 { background: var(--s4); }
.legend { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbars { display: grid; gap: 6px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.hbar-row .b { height: 10px; } .hbar-row .b i { display: block; height: 10px; width: calc(var(--w) * 1%); min-width: 2px; background: var(--s1); border-radius: 0 4px 4px 0; }
.hbar-row .v { font-family: var(--f-mono); font-size: 12px; }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: 4px 0; }
@media (max-width: 640px) { .cal { grid-template-columns: 1fr; } }
.quick-approve { display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); align-items: start; }
.quick-approve video { width: 100%; border-radius: 8px; background: #000; }
.quick-approve video.vertical { width: auto; max-width: 100%; max-height: 360px; aspect-ratio: 9 / 16; }
.quick-approve audio { width: 100%; }
.qa-actions { display: grid; gap: 10px; align-content: start; }
.qa-actions form.reject { display: flex; gap: 8px; } .qa-actions form.reject input { flex: 1; min-width: 0; padding: 7px 9px; border-radius: 8px; }
@media (max-width: 700px) { .quick-approve { grid-template-columns: 1fr; } }
.donut-wrap { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin: 8px 0 10px; }
.donut .sl { stroke: var(--panel); stroke-width: 2px; }
.donut .sl.s1 { fill: var(--s1); } .donut .sl.s2 { fill: var(--s2); } .donut .sl.s3 { fill: var(--s3); } .donut .sl.s4 { fill: var(--s4); }
.donut .sl:hover { opacity: .85; }
.donut .dv { fill: var(--fg); font: 600 17px var(--f-body); } .donut .dl { fill: var(--muted); font: 400 11px var(--f-body); }
.legend.vertical { flex-direction: column; gap: 8px; }
.colchart { width: 100%; height: auto; max-height: 300px; display: block; margin: 6px 0 4px; }
.colchart .col { fill: var(--s1); } .colchart .col:hover { fill: var(--link); }
.colchart .hit { fill: transparent; }
.colchart .grid { stroke: var(--line); stroke-width: 1; } .colchart .axis { stroke: var(--line-2); stroke-width: 1; }
.colchart .tick { fill: var(--faint); font: 400 10px var(--f-body); }
.traffic { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); margin: 0 0 14px; font-size: 14px; }
.traffic .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg); }
.traffic.lavora .dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.traffic.ferma .dot { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-bg); }
.traffic ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.inline-msg.ok { color: var(--ok); } .inline-msg.ko { color: var(--bad); }

/* weekly calendar: 7 days, one pair (video + its Short) per time */
.wk-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.wk-title { display: flex; flex-direction: column; min-width: 180px; text-align: center; }
.wk-title b { font: 600 18px var(--f-head, var(--f-body)); }
.wk-nav { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 36px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r); color: var(--fg); text-decoration: none; background: var(--panel); }
.wk-nav:hover { border-color: var(--accent); }
.wk-plan { margin-bottom: 14px; }
.wk-plan .t { font-family: var(--f-mono); }
.wk { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.wk-day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; min-width: 0; }
.wk-day.past { opacity: .6; }
.wk-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.wk-day h4 { margin: 0; font: 600 12px var(--f-body); text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  display: flex; justify-content: space-between; gap: 6px; }
.wk-day.today h4 { color: var(--accent); }
.wk-pair { border-top: 1px solid var(--line); padding: 7px 0 4px; }
.wk-pair.extra { opacity: .85; }
.wk-when { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.wk-when .t { font-family: var(--f-mono); font-size: 13px; color: var(--fg); }
.wk-vid { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; padding: 4px 6px; margin: 3px 0;
  border-left: 3px solid var(--accent); border-radius: 4px; background: var(--bg, transparent); overflow-wrap: anywhere; }
.wk-vid.short { border-left-color: var(--warn); }
.wk-vid.free { border-left-style: dashed; }
.wk-vid.free em { color: var(--warn); font-style: normal; }
.wk-k { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.wk-vid small { font-size: 11px; }
@media (max-width: 1100px) { .wk { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 760px) { .wk { grid-template-columns: 1fr; } }
