/* EDILAW · sistema visivo unico (9 novembre 2026).
   Caricato per ultimo: riallinea colori, testo, comandi e stati dei fogli precedenti
   (product.css, product-design.css e moduli) senza cambiare struttura o comportamento.
   Palette del marchio invariata: blu notte, ottone, avorio. */

:root {
  /* Marchio */
  --ds-navy: #152f40;
  --ds-navy-hover: #1f4458;
  --ds-navy-deep: #0e2230;
  --ds-navy-tint: #e9eef1;
  --ds-brass: #9b7635;
  --ds-brass-ink: #765823;
  --ds-brass-tint: #f4ecdc;

  /* Superfici e linee */
  --ds-bg: #f5f3ee;
  --ds-surface: #fffefb;
  --ds-surface-sunken: #f0eee7;
  --ds-line: #e2ded3;
  --ds-line-strong: #c9c3b4;
  --ds-field: #8d969a;

  /* Testo */
  --ds-text: #1d3341;
  --ds-text-2: #4d5d66;
  --ds-text-3: #66737a;

  /* Stati: un solo colore per significato */
  --ds-success: #2d6a4d;
  --ds-success-tint: #e5f0e9;
  --ds-warning: #8a5a10;
  --ds-warning-tint: #faefd9;
  --ds-danger: #a13a2a;
  --ds-danger-tint: #f8e7e3;
  --ds-focus: #1d5f8c;

  /* Forma, profondità, movimento */
  --ds-r-sm: 6px;
  --ds-r: 10px;
  --ds-r-lg: 14px;
  --ds-shadow-1: 0 1px 2px rgb(14 34 48 / 6%);
  --ds-shadow-2: 0 6px 18px -8px rgb(14 34 48 / 18%), 0 1px 2px rgb(14 34 48 / 5%);
  --ds-shadow-3: 0 18px 40px -12px rgb(14 34 48 / 35%);
  --ds-ease: cubic-bezier(.2, .7, .2, 1);
  --ds-fast: 140ms;

  /* Tipografia: Segoe UI Variable su Windows 11, poi i caratteri di sistema */
  --ds-font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --ds-font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  /* I fogli precedenti leggono questi nomi: puntano ora agli stessi valori */
  --navy: var(--ds-navy);
  --ink: var(--ds-text);
  --ivory: var(--ds-bg);
  --paper: var(--ds-surface);
  --brass: var(--ds-brass);
  --brass-ink: var(--ds-brass-ink);
  --line: var(--ds-line);
  --muted: var(--ds-text-2);
  --field-line: var(--ds-field);
  --focus: var(--ds-focus);
  --danger: var(--ds-danger);
  --radius: var(--ds-r);
  --primary: var(--ds-navy);

  font-family: var(--ds-font);
  color: var(--ds-text);
  background: var(--ds-bg);
  font-feature-settings: "tnum" 0;
}

body { background: var(--ds-bg); color: var(--ds-text); text-rendering: optimizeLegibility; }
h1, h2, .login-intro h2 { font-family: var(--ds-font-display); color: var(--ds-text); }
h1 { font-weight: 650; letter-spacing: -.03em; }
h2 { letter-spacing: -.012em; }
.eyebrow { color: var(--ds-brass-ink); letter-spacing: .07em; }
.muted, small { color: var(--ds-text-2); }
::selection { background: #d9e4ea; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Comandi ---------- */
button, .button {
  border-color: var(--ds-line-strong);
  border-radius: 8px;
  background: var(--ds-surface);
  color: var(--ds-text);
  transition: background-color var(--ds-fast) var(--ds-ease), border-color var(--ds-fast) var(--ds-ease), color var(--ds-fast) var(--ds-ease), box-shadow var(--ds-fast) var(--ds-ease), transform 80ms ease;
}
button:hover, .button:hover { background: #f7f5ef; border-color: #a8a596; }
button:active:not(:disabled) { transform: translateY(1px); }
button.primary, .button.primary, .primary {
  background: var(--ds-navy); border-color: var(--ds-navy); color: #fff;
  box-shadow: 0 1px 2px rgb(14 34 48 / 22%), inset 0 1px 0 rgb(255 255 255 / 7%);
}
button.primary:hover, .button.primary:hover { background: var(--ds-navy-hover); border-color: var(--ds-navy-hover); color: #fff; }
button.primary:disabled:hover { background: var(--ds-navy); border-color: var(--ds-navy); }
button:disabled { opacity: .5; }
button.delete, .delete { color: var(--ds-danger); border-color: #e2c3bb; background: var(--ds-surface); }
button.delete:hover:not(:disabled) { background: var(--ds-danger-tint); border-color: var(--ds-danger); color: var(--ds-danger); }
:focus-visible { outline: 3px solid var(--ds-focus); outline-offset: 2px; border-radius: 4px; }
button:focus-visible { border-radius: 8px; }

/* Interruttori a due stati (Cartelle / Elenco, schede della biblioteca): un solo stile, blu del marchio */
.explorer-toolbar { gap: 0; }
.explorer-toolbar > button[aria-pressed] { border-radius: 0; margin-left: -1px; }
.explorer-toolbar > button[aria-pressed]:first-of-type, .explorer-toolbar > button:not([aria-pressed]) + button[aria-pressed] { border-radius: 8px 0 0 8px; margin-left: 0; }
.explorer-toolbar > button[aria-pressed] + button[aria-pressed] { border-radius: 0 8px 8px 0; }
.explorer-toolbar > button:not([aria-pressed]) { margin-left: .65rem; }
.explorer-toolbar [aria-pressed="true"], .studio-tabs button[aria-pressed="true"] { background: var(--ds-navy); border-color: var(--ds-navy); color: #fff; }
.studio-tabs button[aria-pressed="true"]:hover, .explorer-toolbar [aria-pressed="true"]:hover { background: var(--ds-navy-hover); color: #fff; }

/* ---------- Campi ---------- */
input, textarea, select { border-color: var(--ds-field); border-radius: 8px; background: #fff; color: var(--ds-text); transition: border-color var(--ds-fast) var(--ds-ease), box-shadow var(--ds-fast) var(--ds-ease); }
input:hover:not(:disabled), textarea:hover:not(:disabled), select:hover:not(:disabled) { border-color: #6f7a7f; }
input:focus, textarea:focus, select:focus { border-color: var(--ds-focus); box-shadow: 0 0 0 3px rgb(29 95 140 / 18%); outline: none; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 1px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ds-navy); }
label { color: var(--ds-text); }

/* ---------- Pannelli espandibili: stessa freccia ovunque ---------- */
summary:not(.nav-group) { list-style: none; display: flex; align-items: baseline; gap: .55rem; }
summary:not(.nav-group)::-webkit-details-marker { display: none; }
summary:not(.nav-group)::before {
  content: ""; flex: 0 0 auto; width: .5em; height: .5em; margin: 0 .1rem 0 .1rem; transform: translateY(-.12em) rotate(-45deg);
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; opacity: .7;
  transition: transform var(--ds-fast) var(--ds-ease);
}
details[open] > summary:not(.nav-group)::before { transform: translateY(-.2em) rotate(45deg); }
.activity-catalogue > summary, .work-actions > summary { flex-wrap: wrap; }
body[data-integrated=true] .editor-sections > summary, .context-selection > summary { display: flex; }
.activity-catalogue > summary span, .work-actions > summary span { flex-basis: 100%; margin-left: 1.2rem; }

/* ---------- Superfici ---------- */
.panel, .login-card, .feature-card, .case-route, .export-summary, .fact-card, .documents-card {
  background: var(--ds-surface); border-color: var(--ds-line); border-radius: var(--ds-r-lg); box-shadow: var(--ds-shadow-1);
}
.login-card { box-shadow: var(--ds-shadow-2); border-top: 3px solid var(--ds-brass); }
.chip { background: var(--ds-surface-sunken); color: var(--ds-text-2); border: 1px solid var(--ds-line); }
.status:not(.error) { background: var(--ds-success-tint); color: var(--ds-success); }
.status.error { background: var(--ds-danger-tint); color: var(--ds-danger); }

/* ---------- Intestazione e menu ---------- */
.topbar { min-height: 72px; padding: .6rem 1.75rem; background: rgb(255 254 251 / 92%); backdrop-filter: saturate(1.4) blur(8px); }
.brand-logo { width: 140px; }
.layout { grid-template-columns: 244px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.rail {
  position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--ds-surface-sunken); border-right: 1px solid var(--ds-line); padding: 1.25rem .85rem 2rem;
  scrollbar-width: thin; scrollbar-color: var(--ds-line-strong) transparent;
}
.rail nav { position: static; }
.rail button { border-radius: 8px; }
.rail .nav-items button, .rail .nav-primary button { color: var(--ds-text-2); font-weight: 560; }
.rail .nav-primary button { color: var(--ds-text); }
.rail .nav-group:hover, .rail button:hover { background: #e6e3da; color: var(--ds-navy); }
.rail button[aria-current="page"], .rail .nav-primary button[aria-current="page"] { background: var(--ds-navy); color: #fff; box-shadow: inset 3px 0 0 var(--ds-brass), var(--ds-shadow-1); }
.rail button[aria-current="page"]:hover { background: var(--ds-navy-hover); color: #fff; }
.nav-current-work { background: var(--ds-surface); border: 1px solid var(--ds-line); border-left: 3px solid var(--ds-brass); border-radius: var(--ds-r); box-shadow: var(--ds-shadow-1); }
.workspace { padding: 2rem 2.5rem 4rem; }

/* ---------- Avvio: schede d'ingresso ---------- */
.start-card, .function-card { border-radius: var(--ds-r-lg); box-shadow: var(--ds-shadow-1); transition: transform 180ms var(--ds-ease), box-shadow 180ms var(--ds-ease), border-color 180ms var(--ds-ease), background-color 180ms var(--ds-ease); }
.start-card:hover, .function-card:hover { transform: translateY(-2px); box-shadow: var(--ds-shadow-2); border-color: var(--ds-brass); }
.start-card .start-link span, .function-card .function-arrow { transition: transform 180ms var(--ds-ease); }
.start-card:hover .start-link span { transform: translateX(3px); }
.start-card-primary { background: linear-gradient(160deg, #1b3a4f 0%, var(--ds-navy) 55%, var(--ds-navy-deep) 100%); }
.start-card-primary:hover { background: linear-gradient(160deg, #22465d 0%, #1a3a4f 55%, #11293a 100%); }
.recent-case { border-radius: 8px; transition: background-color var(--ds-fast) var(--ds-ease); }
.recent-case:hover { background: var(--ds-surface); }

/* ---------- Intestazione del fascicolo: sempre visibile mentre si lavora ---------- */
html:has(#work-content:not([hidden])) { scroll-padding-top: 96px; }
#view-work > .page-head { margin-bottom: .75rem; }
#view-work > .page-head h1 { font-size: clamp(1.5rem, 2.2vw, 1.875rem); }
.case-bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin: 0 -1rem 1.25rem; padding: .7rem 1rem;
  background: rgb(245 243 238 / 96%); backdrop-filter: saturate(1.3) blur(10px);
  border: 0; border-bottom: 1px solid var(--ds-line); border-radius: 0;
}
.case-identity { min-width: 0; display: grid; gap: .2rem; }
.case-bar strong { font-size: 1.0625rem; font-weight: 650; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-bar-actions { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.case-bar-actions button { font-size: .9rem; min-height: 40px; }
.case-bar #switch-case { background: transparent; border-color: transparent; color: var(--ds-text-2); }
.case-bar #switch-case:hover { background: #ebe8df; color: var(--ds-navy); }

/* Stato di salvataggio: un punto colorato e una parola, sempre accanto al nome del caso */
.case-bar .save-state { display: inline-flex; align-items: center; gap: .45rem; justify-self: start; margin: 0; padding: .15rem .6rem .15rem .5rem; font-size: .8125rem; font-weight: 560; border-radius: 99px; background: var(--ds-warning-tint); color: var(--ds-warning); transition: background-color 300ms var(--ds-ease), color 300ms var(--ds-ease); }
.case-bar .save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.case-bar[data-save-state="saved"] .save-state { background: var(--ds-success-tint); color: var(--ds-success); }
.case-bar[data-save-state="saving"] .save-state { background: var(--ds-navy-tint); color: var(--ds-navy); }
.case-bar[data-save-state="saving"] .save-state::before { animation: ds-pulse 900ms ease-in-out infinite; }
.case-bar[data-save-state="archived"] .save-state { background: var(--ds-surface-sunken); color: var(--ds-text-2); }
.case-bar.just-saved .save-state { animation: ds-saved 1.2s var(--ds-ease); }

/* Il comando Salva dice cosa succede: in corso, salvato, da salvare */
#save-case { position: relative; min-width: 9.5rem; }
#save-case[data-state="saved"]:not(.just-saved) { background: var(--ds-surface); border-color: var(--ds-line-strong); color: var(--ds-text); box-shadow: none; }
#save-case[data-state="saved"]:not(.just-saved):hover { background: #f7f5ef; }
#save-case[data-state="saving"] { padding-left: 2.4rem; }
#save-case[data-state="saving"]::before { content: ""; position: absolute; left: .95rem; top: 50%; width: 14px; height: 14px; margin-top: -7px; border: 2px solid rgb(255 255 255 / 35%); border-top-color: #fff; border-radius: 50%; animation: ds-spin 700ms linear infinite; }
#save-case.just-saved { background: var(--ds-success); border-color: var(--ds-success); color: #fff; padding-left: 2.4rem; }
#save-case.just-saved::before { content: ""; position: absolute; left: 1rem; top: 50%; width: 6px; height: 11px; margin-top: -8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); animation: ds-pop 260ms var(--ds-ease); }

/* ---------- Le sei fasi come percorso ---------- */
.case-route { padding: 1.25rem 1.5rem 1.15rem; }
.case-route .case-workflow { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; padding: 0 0 1.1rem; margin: 0 0 1.1rem; border-bottom: 1px solid var(--ds-line); }
.case-route .case-workflow button {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: .45rem;
  min-height: 0; padding: .35rem .25rem .4rem; background: transparent; border: 0; border-radius: 10px;
  color: var(--ds-text-2); font-size: .875rem; font-weight: 560; text-align: center; box-shadow: none;
}
.case-route .case-workflow button:hover:not(:disabled) { background: var(--ds-surface-sunken); color: var(--ds-navy); }
.case-route .case-workflow button:disabled { opacity: 1; cursor: default; }
/* Linea che collega le fasi */
.case-route .case-workflow button:not(:last-child)::after {
  content: ""; position: absolute; z-index: 0; top: calc(.35rem + 15px); left: calc(50% + 21px); right: calc(-50% + 21px);
  height: 2px; border-radius: 2px; background: var(--ds-line);
}
.case-route .case-workflow button[data-state="clear"]:not(:last-child)::after { background: #d8c49d; }
.step-marker {
  position: relative; z-index: 1; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  font-size: .8125rem; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--ds-surface); color: var(--ds-text-2); border: 1.5px solid var(--ds-line-strong);
  transition: background-color 200ms var(--ds-ease), border-color 200ms var(--ds-ease), color 200ms var(--ds-ease), box-shadow 200ms var(--ds-ease);
}
.step-label { line-height: 1.25; }
/* Fase senza attività aperte: segno ottone, non verde (non è una verifica di conformità) */
.case-route .case-workflow button[data-state="clear"] .step-marker { background: var(--ds-brass-tint); border-color: #cdb07a; color: transparent; }
.case-route .case-workflow button[data-state="clear"] .step-marker::after { content: ""; position: absolute; left: 50%; top: 45%; width: 5px; height: 10px; margin: -6px 0 0 -3px; border: solid var(--ds-brass-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.case-route .case-workflow button[aria-current="step"] { color: var(--ds-navy); font-weight: 680; background: transparent; }
.case-route .case-workflow button[aria-current="step"] .step-marker { background: var(--ds-navy); border-color: var(--ds-navy); color: #fff; box-shadow: 0 0 0 4px rgb(21 47 64 / 12%); }
.case-route .case-workflow button[aria-current="step"] .step-marker::after { display: none; }
.case-phase-counter { color: var(--ds-brass-ink); font-weight: 600; font-size: .8125rem; letter-spacing: .02em; }
.case-route h2 { font-size: 1.25rem; }
.case-phase-tools button { color: var(--ds-navy); }

/* ---------- Scelta iniziale del modulo (agente o percorso manuale) ---------- */
.work-entry { background: var(--ds-surface); border: 1px solid var(--ds-line); border-left: 3px solid var(--ds-brass); border-radius: var(--ds-r-lg); box-shadow: var(--ds-shadow-1); }

/* ---------- Avvisi temporanei ---------- */
.has-toasts #global-status { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.toast-region { position: fixed; z-index: 1000; right: 1.25rem; bottom: 1.25rem; display: flex; flex-direction: column; align-items: flex-end; gap: .6rem; width: min(420px, calc(100vw - 2rem)); pointer-events: none; }
.toast {
  pointer-events: auto; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: start; gap: .7rem; width: 100%;
  padding: .85rem .6rem .85rem 1rem; border-radius: 12px; background: var(--ds-navy-deep); color: #f3f5f6;
  box-shadow: var(--ds-shadow-3); border-left: 4px solid #8fb3c9;
  animation: ds-toast-in 260ms var(--ds-ease);
}
.toast.is-leaving { animation: ds-toast-out 200ms ease forwards; }
.toast-success { border-left-color: #74c69d; }
.toast-error { border-left-color: #f08a76; }
.toast-progress { border-left-color: #c9a96b; }
.toast-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }
.toast-success .toast-icon { color: #74c69d; }
.toast-error .toast-icon { color: #f08a76; }
.toast-info .toast-icon { color: #9fc1d6; }
.toast-progress .toast-icon { color: #e0c48c; animation: ds-spin 900ms linear infinite; }
.toast-text { margin: 0; font-size: .9375rem; line-height: 1.45; overflow-wrap: anywhere; }
.toast-close { min-height: 28px; width: 28px; padding: 0; border: 0; background: transparent; color: #b9c5cc; font-size: 1.25rem; line-height: 1; border-radius: 6px; }
.toast-close:hover { background: rgb(255 255 255 / 10%); color: #fff; }

/* ---------- Stati vuoti con un comando ---------- */
.empty-state {
  grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .55rem;
  padding: 2.5rem 1.5rem; border: 1.5px dashed var(--ds-line-strong); border-radius: var(--ds-r-lg); background: rgb(255 254 251 / 60%);
}
.empty-state-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--ds-brass-tint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23765823' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7V5h6l2 2h10v12H3zM3 10h18'/%3E%3Cpath d='M12 13v4M10 15h4'/%3E%3C/svg%3E") center / 28px no-repeat; margin-bottom: .35rem; }
.empty-state strong { font-family: var(--ds-font-display); font-size: 1.125rem; }
.empty-state p { margin: 0 0 .5rem; max-width: 52ch; color: var(--ds-text-2); font-size: .9375rem; }
.folder-card { border-radius: var(--ds-r-lg); border-color: var(--ds-line); background: var(--ds-surface); box-shadow: var(--ds-shadow-1); transition: transform 180ms var(--ds-ease), box-shadow 180ms var(--ds-ease), border-color 180ms var(--ds-ease); }
.folder-card:hover { background: var(--ds-surface); border-color: var(--ds-brass); transform: translateY(-2px); box-shadow: var(--ds-shadow-2); }
.folder-symbol, .folder-symbol::before { background: #e4c27a; border-color: #c49a45; }

/* ---------- Riepilogo: stesso carattere del resto dell'app ---------- */
.pilot-review h2 { font-family: var(--ds-font-display); font-weight: 650; letter-spacing: -.02em; }
.pilot-metrics { background: var(--ds-surface-sunken); border-radius: var(--ds-r); }
.pilot-metrics dd { font: 650 2rem/1.3 var(--ds-font-display); font-variant-numeric: tabular-nums; color: var(--ds-text); }

/* ---------- Tabelle ---------- */
th { color: var(--ds-text-2); font-weight: 600; }
.case-table tbody tr { transition: background-color var(--ds-fast) var(--ds-ease); }

/* ---------- Animazioni ---------- */
@keyframes ds-spin { to { transform: rotate(360deg); } }
@keyframes ds-pulse { 50% { opacity: .35; } }
@keyframes ds-pop { from { transform: rotate(45deg) scale(.4); opacity: 0; } to { transform: rotate(45deg) scale(1); opacity: 1; } }
@keyframes ds-saved { 0% { box-shadow: 0 0 0 0 rgb(45 106 77 / 45%); } 100% { box-shadow: 0 0 0 10px rgb(45 106 77 / 0%); } }
@keyframes ds-toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes ds-toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Schermi stretti ---------- */
@media (max-width: 1200px) {
  .case-route .case-workflow { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 1200px) { .workspace { padding: 1.75rem 1.75rem 3.5rem; } }
@media (max-width: 1000px) { .workspace { padding: 1.5rem 1.5rem 3rem; } }
@media (max-width: 850px) {
  .rail { position: static; height: auto; overflow: visible; padding: .35rem 1.25rem; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .case-bar { margin: 0 -1.5rem 1rem; padding: .6rem 1.5rem; }
}
@media (max-width: 700px) {
  .case-route .case-workflow { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: .6rem; }
  .case-route .case-workflow button::after { display: none; }
  .case-bar { flex-wrap: wrap; }
  .case-bar-actions { width: 100%; }
  .case-bar-actions #save-case { flex: 1; }
  .toast-region { right: 1rem; left: 1rem; bottom: 1rem; width: auto; }
}
@media (max-width: 500px) {
  .workspace { padding: 1.1rem 1rem 3rem; }
  .rail { padding: .25rem 1rem; }
  .case-bar { margin: 0 -1rem 1rem; padding: .6rem 1rem; }
  .topbar { min-height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .start-card:hover, .function-card:hover, .folder-card:hover { transform: none; }
}
@media print {
  .toast-region, .case-bar-actions { display: none !important; }
  .case-bar, .rail { position: static; }
}

/* ---------- Fase 2: conferme, scelta iniziale compatta, un solo Salva ---------- */
.ds-dialog, .studio-dialog {
  width: min(520px, calc(100vw - 2rem)); max-height: 85vh; padding: 1.6rem 1.6rem 1.25rem; border: 1px solid var(--ds-line);
  border-radius: 16px; background: var(--ds-surface); color: var(--ds-text); box-shadow: var(--ds-shadow-3);
}
.studio-dialog { width: min(850px, 90vw); }
.ds-dialog[open], .studio-dialog[open] { animation: ds-dialog-in 200ms var(--ds-ease); }
.ds-dialog::backdrop, .studio-dialog::backdrop { background: rgb(14 34 48 / 42%); backdrop-filter: blur(2px); }
.ds-dialog-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: .9rem; border-radius: 12px; background: var(--ds-navy-tint); }
.ds-dialog-icon::before { content: "?"; font: 700 1.1rem/1 var(--ds-font-display); color: var(--ds-navy); }
.ds-dialog-danger .ds-dialog-icon { background: var(--ds-danger-tint); }
.ds-dialog-danger .ds-dialog-icon::before { content: "!"; color: var(--ds-danger); }
.ds-dialog h2 { margin: 0 0 .6rem; font-size: 1.2rem; line-height: 1.35; overflow-wrap: anywhere; }
.ds-dialog-body p { margin: 0 0 .55rem; font-size: .9375rem; line-height: 1.55; color: var(--ds-text-2); }
.ds-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; margin-top: 1.25rem; }
button.ds-danger { background: var(--ds-danger); border-color: var(--ds-danger); color: #fff; box-shadow: 0 1px 2px rgb(14 34 48 / 22%); }
button.ds-danger:hover { background: #8a2f21; border-color: #8a2f21; color: #fff; }
@keyframes ds-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (max-width: 500px) { .ds-dialog-actions button { flex: 1 1 100%; } }

/* La scelta «agente o percorso manuale» occupa spazio solo all'inizio del lavoro */
.work-entry[data-compact="true"] { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; padding: .6rem .9rem; border-left-width: 1px; box-shadow: none; background: transparent; }
.work-entry[data-compact="true"] > div:first-child { flex: 0 0 auto; }
.work-entry[data-compact="true"] h2 { margin: 0; font-size: .875rem; font-weight: 600; color: var(--ds-text-2); }
.work-entry[data-compact="true"] h2::after { content: " · scorciatoie"; font-weight: 400; }
.work-entry[data-compact="true"] #work-entry-description, .work-entry[data-compact="true"] > .muted { display: none; }
.work-entry[data-compact="true"] .row { gap: .4rem; }
.work-entry[data-compact="true"] button { min-height: 34px; padding: .35rem .75rem; font-size: .8125rem; background: var(--ds-surface); color: var(--ds-text); border-color: var(--ds-line-strong); box-shadow: none; }
.work-entry[data-compact="true"] button:hover { border-color: var(--ds-navy); color: var(--ds-navy); }
#view-work[data-module="work"] .work-entry[data-compact="true"] #continue-manual,
#view-work[data-module="intervention"] .work-entry[data-compact="true"] #continue-manual { display: none; }

/* Nell'editor integrato Salva e download sono già nell'intestazione e nel riepilogo:
   il riquadro duplicato resta solo se serve ricollegare il salvataggio. */
body[data-integrated=true] .editor-final-actions:not(:has([data-editor-action="reconnect"]:not([hidden]))) { display: none; }

/* Avvertenze non ripetute: nel Riepilogo dell'app lo stato di salvataggio è già nell'intestazione
   fissa del caso; la riga resta nel file esportato. */
#pilot-review-content .pilot-storage { display: none; }
