/* ===== MePro – app: tema, componenti e impaginazione ===== */
/* Carattere Inter, incluso nell'app (funziona offline). Licenza in fonts/Inter-OFL.txt */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Manrope (licenza in fonts/Manrope-OFL.txt): il più largo dei caratteri a scelta */
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(fonts/manrope-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(fonts/manrope-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Tappa 6: gli altri caratteri a scelta (licenze OFL in fonts/), inclusi nell'app */
@font-face {
  font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap;
  src: url(fonts/dmsans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap;
  src: url(fonts/dmsans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans"; font-style: normal; font-weight: 100 700; font-display: swap;
  src: url(fonts/plex-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Sans"; font-style: normal; font-weight: 100 700; font-display: swap;
  src: url(fonts/plex-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(fonts/figtree-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(fonts/figtree-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(fonts/atkinson-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(fonts/atkinson-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Colori e misure MePro: valori da docs/identita/tokens.css (fonte di verità).
   Il tema scuro è quello principale; il chiaro si attiva con data-theme="light" (impostato in index.html). */
:root {
  --mp-fs: 1;                 /* dimensione del testo (Impostazioni, per dispositivo): 14 px = 1 */
  --mp-font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font: var(--mp-font-ui);
  --font-monospace: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --mp-radius-control: 8px;
  --mp-radius: 10px;
  --radius: var(--mp-radius);

  --background-page: #141716;
  --background-secondary: #181C1B;
  --background-primary: #1C201F;
  --mp-background-raised: #232827;
  --background-modifier-border: #2E3533;
  --mp-border-strong: #3A4240;
  --background-modifier-hover: rgba(228, 233, 231, 0.06);
  --text-normal: #E4E9E7;
  --text-muted: #9FA9A5;
  --text-faint: #6E7874;
  --text-on-accent: #121514;
  --text-error: #E5534B;
  --interactive-accent: #34D399;
  --interactive-accent-hover: #5DDCAD;
  --mp-accent-soft: rgba(52, 211, 153, 0.16);
  --mp-accent-rgb: 52, 211, 153;
  --mp-wait: #D6A85A;
  --mp-wait-fill: rgba(214, 168, 90, 0.13);
  --mp-urgent: #E5534B;
  --mp-sidebar-w: 240px;

  /* Colori tenui dei tag e dei workflow (16) */
  --wf-mattone: #D08C84;  --wf-corallo: #D89A7C;  --wf-arancio: #D7A26E;  --wf-ocra: #CDB46E;
  --wf-oliva: #A9B47A;    --wf-verde: #86B58C;    --wf-salvia: #9BB5A4;   --wf-petrolio: #6FA7A3;
  --wf-acqua: #7FB3C0;    --wf-azzurro: #86A9D1;  --wf-blu: #8C98D6;      --wf-indaco: #9C8FCF;
  --wf-viola: #B391C9;    --wf-malva: #C690B3;    --wf-rosa: #D490A0;     --wf-grigio: #A4ABA8;

  /* Colori usati dal disegno dei diagrammi (della 0.1): resi più tenui; si ridisegnano nelle tappe successive */
  --color-red: #E5534B; --color-red-rgb: 229, 83, 75;
  --color-orange: #D6A85A; --color-orange-rgb: 214, 168, 90;
  --color-yellow: #CDB46E; --color-yellow-rgb: 205, 180, 110;
  --color-green: #78ABA6; --color-green-rgb: 120, 171, 166;
  --color-cyan: #7FB3C0; --color-cyan-rgb: 127, 179, 192;
  --color-blue: #86A9D1; --color-blue-rgb: 134, 169, 209;
  --color-purple: #B391C9; --color-purple-rgb: 179, 145, 201;
  --color-pink: #D490A0; --color-pink-rgb: 212, 144, 160;

  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3);
  --top-h: 56px;
  --tabbar-h: 0px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --background-page: #F4F6F5;
  --background-secondary: #EDF1EF;
  --background-primary: #FFFFFF;
  --mp-background-raised: #FFFFFF;
  --background-modifier-border: #DDE3E0;
  --mp-border-strong: #C8D0CC;
  --background-modifier-hover: rgba(28, 33, 31, 0.05);
  --text-normal: #1C211F;
  --text-muted: #5E6A65;
  --text-faint: #98A29E;
  --text-on-accent: #FFFFFF;
  --text-error: #C93A32;
  --interactive-accent: #059669;
  --interactive-accent-hover: #047857;
  --mp-accent-soft: rgba(5, 150, 105, 0.12);
  --mp-accent-rgb: 5, 150, 105;
  --mp-wait: #B07D22;
  --mp-wait-fill: rgba(196, 140, 40, 0.12);
  --mp-urgent: #C93A32;

  --wf-mattone: #944238;  --wf-corallo: #9D532F;  --wf-arancio: #A0652C;  --wf-ocra: #987E34;
  --wf-oliva: #78824A;    --wf-verde: #4D7F54;    --wf-salvia: #577561;   --wf-petrolio: #4D7F7B;
  --wf-acqua: #437B89;    --wf-azzurro: #386394;  --wf-blu: #364596;      --wf-indaco: #4E3D8F;
  --wf-viola: #6D4389;    --wf-malva: #874570;    --wf-rosa: #93394E;     --wf-grigio: #626A67;

  --color-red: #C93A32; --color-red-rgb: 201, 58, 50;
  --color-orange: #B07D22; --color-orange-rgb: 176, 125, 34;
  --color-yellow: #987E34; --color-yellow-rgb: 152, 126, 52;
  --color-green: #3A6F6B; --color-green-rgb: 58, 111, 107;
  --color-cyan: #437B89; --color-cyan-rgb: 67, 123, 137;
  --color-blue: #386394; --color-blue-rgb: 56, 99, 148;
  --color-purple: #6D4389; --color-purple-rgb: 109, 67, 137;
  --color-pink: #93394E; --color-pink-rgb: 147, 57, 78;

  --shadow: 0 8px 24px rgba(28, 33, 31, 0.12), 0 1px 2px rgba(28, 33, 31, 0.06);
  color-scheme: light;
}

/* Numeri allineati in date, ore, contatori */
.mp-num { font-variant-numeric: tabular-nums; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: calc(15px * var(--mp-fs));
  line-height: 1.45;
  color: var(--text-normal);
  background: var(--background-page);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--interactive-accent); }
.svg-icon { width: 18px; height: 18px; display: block; }

/* ---------- Pulsanti e campi (stile "Obsidian") ---------- */
button {
  font: inherit;
  font-size: 0.92em;
  color: var(--text-normal);
  background: var(--background-primary);
  border: 1px solid var(--background-modifier-border);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s;
}
button:hover { background: var(--background-secondary); }
.setting-item-control button, .app-list-head button, .app-empty-actions button, .app-detail-empty button, .modal-content > button { min-height: 36px; }
button:disabled { opacity: 0.5; cursor: default; }
button.mod-cta { background: var(--interactive-accent); border-color: var(--interactive-accent); color: var(--text-on-accent); }
button.mod-cta .svg-icon { color: var(--text-on-accent); }
button.mod-cta:hover { background: var(--interactive-accent-hover); }
button.mod-warning { background: var(--color-red); border-color: var(--color-red); color: #fff; }
button.clickable-icon, .clickable-icon {
  background: transparent;
  border: none;
  padding: 6px;
  min-height: 0;
  border-radius: 8px;
  color: var(--text-muted);
}
button.clickable-icon:hover, .clickable-icon:hover { background: var(--background-modifier-hover); color: var(--text-normal); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=search], textarea, select {
  font: inherit;
  font-size: calc(16px * var(--mp-fs));
  color: var(--text-normal);
  background: var(--background-primary);
  border: 1px solid var(--background-modifier-border);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 38px;
  width: 100%;
  max-width: 100%;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--interactive-accent) 45%, transparent); outline-offset: 0; border-color: var(--interactive-accent); }

/* Interruttore */
.checkbox-container {
  position: relative;
  width: 42px; height: 24px;
  border-radius: 12px;
  background: var(--background-modifier-border);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.checkbox-container input { display: none; }
.checkbox-container::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
.checkbox-container.is-enabled { background: var(--interactive-accent); }
.checkbox-container.is-enabled::after { transform: translateX(18px); }

/* Righe di impostazione dentro le schede */
.setting-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--background-modifier-border);
}
.setting-item:first-child { border-top: none; }
.setting-item-info { flex: 1 1 auto; min-width: 0; }
.setting-item-info:empty { display: none; }
.setting-item-name { font-weight: 500; }
.setting-item-name:empty, .setting-item-description:empty { display: none; }
.setting-item-description { font-size: 0.85em; color: var(--text-muted); margin-top: 2px; }
.setting-item-control { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 1 auto; flex-wrap: wrap; min-width: 0; }
.setting-item-control input[type=text], .setting-item-control input[type=date], .setting-item-control input[type=time], .setting-item-control select { width: 220px; }
.setting-item.wfd-wide, .setting-item:has(textarea) { flex-direction: column; align-items: stretch; }
.setting-item.wfd-wide .setting-item-control, .setting-item:has(textarea) .setting-item-control { justify-content: stretch; }
.setting-item.wfd-wide .setting-item-control input, .setting-item:has(textarea) textarea { width: 100%; }
.setting-item:last-child:not(:has(.setting-item-name:not(:empty))) { border-top: none; padding-top: 16px; }

/* ---------- Schede ---------- */
body.has-modal { overflow: hidden; }
.modal-container { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.4); animation: fade 0.15s; }
.modal {
  position: relative;
  width: 560px;
  max-width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  background: var(--mp-background-raised);
  border: 1px solid var(--background-modifier-border);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  padding: 20px 22px 18px;
  animation: pop 0.16s ease-out;
}
.modal-title { font-size: 1.2em; font-weight: 650; padding-right: 36px; margin-bottom: 12px; overflow-wrap: anywhere; }
.modal-close-button { position: absolute; top: 14px; right: 14px; padding: 6px; border-radius: 8px; color: var(--text-muted); cursor: pointer; }
.modal-close-button:hover { background: var(--background-modifier-hover); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.99); } }
@media (max-width: 640px) {
  .modal-container { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
    animation: sheet 0.2s ease-out;
  }
  .setting-item { flex-direction: column; align-items: stretch; gap: 6px; }
  .setting-item-control { justify-content: flex-start; }
  .setting-item-control input[type=text], .setting-item-control input[type=date], .setting-item-control input[type=time], .setting-item-control select { width: 100%; }
  .setting-item:last-child .setting-item-control { justify-content: flex-end; }
  .setting-item:last-child .setting-item-control button { flex: 1; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0.4; } }

/* ---------- Menu e avvisi ---------- */
.menu {
  position: fixed; z-index: 60;
  min-width: 220px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow-y: auto;
  background: var(--mp-background-raised);
  border: 1px solid var(--background-modifier-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
}
.menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.menu-item:hover { background: var(--background-modifier-hover); }
.menu-item.is-disabled { cursor: default; color: var(--text-muted); font-size: 0.9em; }
.menu-item.is-disabled:hover { background: none; }
.menu-item-icon { color: var(--text-muted); }
.menu-separator { height: 1px; background: var(--background-modifier-border); margin: 4px 6px; }
.notice-container { position: fixed; z-index: 70; left: 50%; bottom: calc(20px + var(--tabbar-h) + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.notice { pointer-events: auto; background: var(--mp-background-raised); color: var(--text-normal); border: 1px solid var(--background-modifier-border); padding: 11px 14px; border-radius: 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); font-size: 0.92em; animation: pop 0.18s ease-out; cursor: pointer; }
.notice.is-hiding { opacity: 0; transition: opacity 0.2s; }

/* ---------- Impaginazione dell'app ---------- */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.app-top {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 16px;
  background: color-mix(in srgb, var(--background-page) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--background-modifier-border);
}
.app-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 1.05em; letter-spacing: -0.01em; }
.app-logo { width: 22px; height: 22px; color: var(--interactive-accent); display: inline-flex; }
.app-logo svg { width: 100%; height: 100%; }
.app-tabs { display: flex; gap: 4px; background: var(--background-secondary); padding: 3px; border-radius: 10px; }
.app-tab { border: none; background: transparent; min-height: 32px; padding: 5px 12px; color: var(--text-muted); border-radius: 8px; }
.app-tab:hover { background: var(--background-modifier-hover); }
.app-tab.is-active { background: var(--background-primary); color: var(--text-normal); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); font-weight: 600; }
.app-tab-icon { display: inline-flex; }
.app-top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.app-sync { display: flex; align-items: center; gap: 5px; font-size: 0.8em; color: var(--text-muted); padding: 4px 8px; border-radius: 20px; background: var(--background-secondary); }
.app-sync .svg-icon { width: 14px; height: 14px; }
.app-sync.is-ok .app-sync-icon { color: var(--color-green); }
.app-sync.is-offline { color: var(--color-orange); }
.app-sync.is-pending .app-sync-icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.app-avatar { width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 50%; overflow: hidden; font-weight: 700; background: var(--interactive-accent); color: var(--text-on-accent); border: none; }
.app-avatar img { width: 100%; height: 100%; object-fit: cover; }

.app-body { flex: 1; display: flex; min-height: 0; }
.app-side {
  width: 320px; flex-shrink: 0;
  border-right: 1px solid var(--background-modifier-border);
  height: calc(100vh - var(--top-h));
  position: sticky; top: var(--top-h);
  overflow: auto;
  padding: 16px 14px 40px;
}
.app-main { flex: 1; min-width: 0; padding: 20px max(16px, env(safe-area-inset-right)) calc(32px + var(--tabbar-h) + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.app-panel, .app-diagram, .app-list:not(.is-compact) { max-width: 1000px; margin: 0 auto; }
.app-loading, .app-detail-empty { color: var(--text-muted); text-align: center; padding: 80px 16px; display: flex; flex-direction: column; gap: 14px; align-items: center; }

/* Elenco */
.app-list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.app-list-title { font-size: 1.25em; font-weight: 700; letter-spacing: -0.01em; }
.app-list.is-compact .app-list-title { font-size: 1em; }
.app-list-empty { color: var(--text-muted); margin: 20px 0; }
.app-card {
  width: 100%;
  display: flex; align-items: flex-start; gap: 12px;
  text-align: left;
  padding: 14px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  background: var(--background-primary);
  border: 1px solid var(--background-modifier-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  min-height: 0;
  justify-content: flex-start;
}
.app-card:hover { border-color: color-mix(in srgb, var(--interactive-accent) 40%, var(--background-modifier-border)); background: var(--background-primary); }
.app-card.is-active { border-color: var(--interactive-accent); box-shadow: 0 0 0 1px var(--interactive-accent); }
.app-card-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; background: var(--text-faint); }
.app-card-text { flex: 1; min-width: 0; }
.app-card-title { font-weight: 600; overflow-wrap: anywhere; }
.app-card-sub { font-size: 0.82em; color: var(--text-muted); margin-top: 2px; }
.app-card-late { color: var(--color-red); font-weight: 600; }
.app-card-bar { height: 4px; border-radius: 2px; background: var(--background-secondary); margin-top: 8px; overflow: hidden; }
.app-card-fill { height: 100%; background: var(--interactive-accent); border-radius: 2px; }
.app-archived { margin-top: 18px; }
.app-archived summary { cursor: pointer; color: var(--text-muted); font-size: 0.9em; margin-bottom: 8px; }
.app-archived .app-card { opacity: 0.75; }

/* Dettaglio */
.app-detail-bar { display: flex; align-items: center; gap: 8px; max-width: 1000px; margin: -6px auto 10px; }
.app-detail-spacer { flex: 1; }
.app-back { gap: 4px; font-weight: 600; color: var(--interactive-accent); padding-left: 2px; }
.app-back .svg-icon { width: 20px; height: 20px; }
.app-empty-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 24px 0; }

/* Impostazioni */
.app-settings { max-width: 720px; margin: 0 auto; }
.app-settings-head { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; }
.app-settings-head h1 { font-size: calc(20px * var(--mp-fs)); font-weight: 600; margin: 0; }
.app-settings-group { background: var(--background-primary); border: 1px solid var(--background-modifier-border); border-radius: var(--mp-radius); padding: 16px 18px 8px; margin-bottom: 16px; }
.app-settings-title { display: flex; align-items: center; gap: 8px; font-size: calc(15px * var(--mp-fs)); font-weight: 600; }
.app-settings-icon { display: inline-flex; color: var(--interactive-accent); }
.app-settings-icon .svg-icon { width: 18px; height: 18px; }
.app-settings-desc { color: var(--text-muted); font-size: calc(13px * var(--mp-fs)); line-height: 1.45; margin: 6px 0 12px; }
.app-cal-status, .app-backup-status { font-size: calc(13px * var(--mp-fs)); padding: 8px 10px; border-radius: 8px; background: var(--background-modifier-hover); color: var(--text-muted); margin-bottom: 4px; }
.app-cal-status::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--text-faint); vertical-align: 1px; }
.app-cal-status.is-ok::before { background: var(--interactive-accent); }
.app-cal-status.is-busy::before { background: var(--mp-wait); }
.app-cal-status.is-error { color: var(--text-normal); }
.app-cal-status.is-error::before { background: var(--mp-urgent); }
.app-settings-actions .setting-item-info { display: none; }
.app-settings-actions .setting-item-control { justify-content: flex-end; flex: 1 1 auto; }
.app-settings-foot { text-align: center; margin: 8px 0 24px; }
@media (max-width: 640px) {
  .app-settings-group { padding: 14px 14px 6px; }
  .app-settings .setting-item:not(.wfd-wide):not(.app-settings-actions) { flex-wrap: wrap; }
  .app-settings-actions .setting-item-control button { flex: 1 1 auto; }
}

/* Il blocco del workflow e il pannello prendono lo stile da "plugin.css";
   qui solo qualche ritocco per lo sfondo dell'app */
.app-diagram .wfd, .app-panel .wfd-dash-card, .app-panel .wfd-ov-item { background-color: var(--background-primary); }
.app-diagram .wfd { border-radius: 16px; box-shadow: var(--shadow); }
.app-panel .wfd-dash-title { font-size: 1.4em; letter-spacing: -0.01em; }

/* Importa */
.app-import-pick input[type=file] { width: 100%; padding: 12px; border: 1px dashed var(--background-modifier-border); border-radius: 10px; background: var(--background-secondary); }
.app-import-text { margin-top: 10px; font-family: var(--font-monospace); font-size: calc(13px * var(--mp-fs)); }
.app-import-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.app-import-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 10px; background: var(--background-secondary); cursor: pointer; }
.app-import-row input { margin-top: 4px; width: 18px; height: 18px; flex-shrink: 0; }
.app-import-name { font-weight: 600; }

/* Accesso */
.app.is-login { align-items: center; justify-content: center; padding: 24px; }
.app-login { width: 100%; max-width: 380px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.app-login-logo { width: 64px; height: 64px; margin: 0 auto; color: var(--interactive-accent); }
.app-login h1 { margin: 4px 0 0; font-size: 1.8em; letter-spacing: -0.02em; }
.app-login-sub { color: var(--text-muted); margin-bottom: 10px; }
.app-login-google { min-height: 46px; font-size: 1em; }
.app-login-sep { color: var(--text-faint); font-size: 0.85em; margin: 6px 0; }
.app-login-form { display: flex; flex-direction: column; gap: 8px; }
.app-login-row { display: flex; gap: 8px; }
.app-login-row button { flex: 1; min-height: 42px; }
.app-login-foot { color: var(--text-faint); font-size: 0.8em; margin-top: 10px; }

/* Barra in basso (solo telefono) */
.app-tabbar { display: none; }
@media (max-width: 899px) {
  :root { --tabbar-h: 64px; }
  .app-tabs { display: none; }
  .app-sync-label { display: none; }
  .app-tabbar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 6px 8px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--background-primary) 90%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-top: 1px solid var(--background-modifier-border);
  }
  .app-tabbar-btn { flex: 1; flex-direction: column; gap: 2px; border: none; background: transparent; font-size: 0.72em; color: var(--text-muted); min-height: 0; padding: 4px; }
  .app-tabbar-btn .svg-icon { width: 22px; height: 22px; }
  .app-tabbar-btn.is-active { color: var(--interactive-accent); font-weight: 600; }
  .app-tabbar-add .app-tab-icon { background: var(--interactive-accent); color: var(--text-on-accent); border-radius: 12px; padding: 4px 14px; }
  .app-main { padding-top: 14px; }
  .app-panel .wfd-dash-tools button.mod-cta { display: none; }
}


/* ===================== Tappa 2: barra laterale, pagine, Pannello ===================== */
.wfd-hidden { display: none !important; }
.mp-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--text-faint); }
.mp-dot.big { width: 10px; height: 10px; }
.mp-count { font-size: calc(12px * var(--mp-fs)); color: var(--text-faint); }
.mp-grow { flex: 1; min-height: 12px; }
.mp-btn-ic { display: inline-flex; }
.mp-btn-ic .svg-icon { width: 16px; height: 16px; }
.clickable-icon .svg-icon { width: 18px; height: 18px; }

/* --- Mac: barra laterale e contenuto che scorre a destra --- */
@media (min-width: 900px) {
  .app-top { display: none; }
  .app.is-wide { height: 100vh; height: 100dvh; min-height: 0; }
  .app.is-wide .app-body { height: 100%; }
  .app.is-wide .app-main { height: 100%; overflow: auto; padding: 0; }
}
.mp-side {
  width: var(--mp-sidebar-w); flex: none;
  height: 100%; overflow-y: auto;
  background: var(--background-secondary);
  border-right: 1px solid var(--background-modifier-border);
  padding: 14px 10px 10px;
  display: flex; flex-direction: column; gap: 1px;
}
.mp-brand { display: flex; align-items: center; gap: 9px; padding: 2px 9px 14px; font-size: calc(14px * var(--mp-fs)); font-weight: 600; }
.mp-brand .app-logo { width: 20px; height: 20px; }
.mp-nav {
  display: flex; align-items: center; gap: 9px; width: 100%;
  min-height: 0; padding: 6px 9px; border: none; border-radius: 7px;
  background: transparent; color: var(--text-muted); font-size: calc(13.5px * var(--mp-fs)); text-align: left; justify-content: flex-start;
}
.mp-nav:hover { background: var(--background-modifier-hover); color: var(--text-normal); }
.mp-nav.is-active { background: var(--mp-accent-soft); color: var(--text-normal); }
.mp-nav.is-active .mp-nav-ic { color: var(--interactive-accent); }
.mp-nav-ic { display: inline-flex; }
.mp-nav-ic .svg-icon { width: 16px; height: 16px; }
.mp-nav .mp-dot { margin: 0 4px; }
.mp-nav.is-tag .mp-dot { margin: 0 4px; }
.mp-nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-nav-count { font-size: calc(12px * var(--mp-fs)); color: var(--text-faint); flex: none; }
.mp-sect { display: flex; align-items: center; justify-content: space-between; font-size: calc(11.5px * var(--mp-fs)); color: var(--text-faint); padding: 12px 4px 4px 9px; font-weight: 500; }
.mp-sect-add { padding: 2px; opacity: 0; transition: opacity 0.15s; }
.mp-sect-add .svg-icon { width: 14px; height: 14px; }
.mp-side:hover .mp-sect-add, .mp-sect-add:focus-visible { opacity: 1; }
.mp-side-hint { font-size: calc(12px * var(--mp-fs)); color: var(--text-faint); padding: 2px 9px 4px; line-height: 1.4; }
.mp-me {
  display: flex; align-items: center; gap: 9px; width: 100%;
  margin-top: 6px; padding: 10px 9px 4px; min-height: 0;
  border: none; border-top: 1px solid var(--background-modifier-border); border-radius: 0;
  background: transparent; font-size: calc(13px * var(--mp-fs)); justify-content: flex-start;
}
.mp-me:hover { background: transparent; }
.mp-me-name { flex: 1; text-align: left; }
.mp-av { width: 22px; height: 22px; border-radius: 50%; overflow: hidden; background: var(--mp-accent-soft); color: var(--interactive-accent); display: inline-flex; align-items: center; justify-content: center; font-size: calc(11.5px * var(--mp-fs)); font-weight: 600; flex: none; }
.mp-av img { width: 100%; height: 100%; object-fit: cover; }
.mp-me .app-sync { background: transparent; padding: 0; }
.mp-me .app-sync-label { display: none; }

/* --- Intestazione delle pagine --- */
.mp-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  min-height: 48px; padding: 8px 24px;
  border-bottom: 1px solid var(--background-modifier-border);
}
.mp-head-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mp-head h1 { font-size: calc(17px * var(--mp-fs)); font-weight: 600; margin: 0; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.mp-panel-head .mp-seg { margin-left: auto; }
.mp-panel-head .mp-head-actions { margin-left: 0; }
.mp-head-actions button:not(.clickable-icon) { min-height: 32px; padding: 5px 12px; font-size: calc(13px * var(--mp-fs)); }
.mp-back { margin-left: -6px; padding: 4px; }
.mp-page { padding: 20px 24px 40px; }
.mp-page.is-diagram { padding-top: 14px; }
.mp-desc { color: var(--text-muted); font-size: calc(13px * var(--mp-fs)); margin: 0 0 14px; max-width: 640px; }
.mp-empty { color: var(--text-muted); padding: 28px 0; }
.mp-link-btn { margin-top: 8px; background: transparent; border: none; color: var(--text-muted); padding: 6px 4px; }
.mp-link-btn:hover { background: transparent; color: var(--text-normal); }
.app-list { max-width: 760px; }

/* --- Pillole di filtro e periodo --- */
.mp-pills { display: flex; gap: 6px; align-items: center; margin-left: 10px; }
.mp-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; min-height: 0; padding: 0 11px; border: none; border-radius: 999px;
  background: var(--background-modifier-hover); color: var(--text-muted); font-size: calc(12.5px * var(--mp-fs)); white-space: nowrap;
}
.mp-pill:hover { background: color-mix(in srgb, var(--text-normal) 10%, transparent); color: var(--text-normal); }
.mp-pill.is-on { background: var(--mp-accent-soft); color: var(--interactive-accent); }
.mp-pill.is-urgent.is-on { background: rgba(var(--mp-urgent-rgb, 229, 83, 75), 0.14); color: var(--mp-urgent); }
.mp-pill-ic { display: inline-flex; }
.mp-pill-ic .svg-icon { width: 14px; height: 14px; }
/* Gli interruttori del Sommario stanno in una riga a parte (sul telefono non escono dallo schermo) */
.mp-sum-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.mp-seg { display: inline-flex; background: var(--background-secondary); border: 1px solid var(--background-modifier-border); border-radius: var(--mp-radius-control); padding: 2px; }
.mp-seg button { border: none; background: transparent; min-height: 0 !important; padding: 4px 10px !important; border-radius: 6px; color: var(--text-muted); font-size: calc(12.5px * var(--mp-fs)) !important; white-space: nowrap; }
.mp-seg button:hover { color: var(--text-normal); background: transparent; }
.mp-seg button.is-on { background: var(--background-primary); color: var(--text-normal); box-shadow: 0 0 0 1px var(--mp-border-strong); }
.mp-head-icon { padding: 6px; }
.mp-pop { min-width: 220px; max-height: min(420px, calc(100vh - 80px)); overflow: auto; }
.mp-pop-item .mp-pop-check { display: inline-flex; width: 16px; color: var(--interactive-accent); visibility: hidden; }
.mp-pop-item .mp-pop-check .svg-icon { width: 16px; height: 16px; }
.mp-pop-item.is-on .mp-pop-check { visibility: visible; }
.mp-pop-item .menu-item-title { flex: 1; }
.mp-pop-count { font-size: calc(12px * var(--mp-fs)); color: var(--text-faint); }

/* --- Riquadri del Pannello --- */
.mp-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; max-width: 1180px; }
.mp-card { background: var(--background-primary); border: 1px solid var(--background-modifier-border); border-radius: var(--mp-radius); padding: 12px 14px 8px; min-width: 0; }
.mp-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mp-card-head h2 { font-size: calc(13.5px * var(--mp-fs)); font-weight: 600; margin: 0; }
.mp-card-empty { color: var(--text-faint); font-size: calc(13px * var(--mp-fs)); padding: 4px 0 8px; }
.mp-group { display: flex; align-items: center; gap: 6px; font-size: calc(11.5px * var(--mp-fs)); color: var(--text-faint); font-weight: 500; padding: 8px 0 2px; }
.mp-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px 7px 12px; margin: 0 -6px;
  border-radius: 7px; position: relative; cursor: pointer;
}
.mp-row::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--wf); }
.mp-row:hover { background: var(--background-modifier-hover); }
.mp-row:focus-visible { outline: 2px solid var(--interactive-accent); outline-offset: -2px; }
.mp-chk {
  width: 16px; height: 16px; min-height: 0; padding: 0; flex: none;
  border-radius: 5px; border: 1.5px solid var(--mp-border-strong); background: transparent;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted);
}
.mp-chk:hover { border-color: var(--interactive-accent); background: var(--mp-accent-soft); }
.mp-chk .svg-icon { width: 16px; height: 16px; }
.mp-chk.is-wait, .mp-chk.is-call, .mp-chk.is-lock, .mp-chk.is-decision { border: 0; width: 18px; }
.mp-chk.is-wait { color: var(--mp-wait); }
.mp-chk.is-call { color: var(--interactive-accent); }
.mp-chk.is-lock { color: var(--text-faint); }
.mp-chk.is-lock .svg-icon { width: 14px; height: 14px; }
.mp-chk.is-decision { color: var(--text-muted); }
.mp-chk.is-checking { background: var(--interactive-accent); border-color: var(--interactive-accent); }
.mp-rt { flex: 1; min-width: 0; }
.mp-rtt { font-size: calc(13.5px * var(--mp-fs)); font-weight: 500; display: flex; align-items: center; gap: 6px; min-width: 0; }
.mp-rtt-text { overflow-wrap: anywhere; }
.mp-row.is-blocked .mp-rtt-text { color: var(--text-muted); }
.mp-rm { font-size: calc(12px * var(--mp-fs)); color: var(--text-muted); display: flex; align-items: center; gap: 6px; margin-top: 1px; min-width: 0; }
.mp-rm-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-urg { background: var(--mp-urgent); color: #fff; font-size: calc(11px * var(--mp-fs)); font-weight: 600; padding: 1px 7px; border-radius: 6px; line-height: 16px; flex: none; }
.mp-badge { font-size: calc(11.5px * var(--mp-fs)); padding: 2px 8px; border-radius: 999px; font-weight: 500; flex: none; white-space: nowrap; }
.mp-badge.is-wait { background: var(--mp-wait); color: #1b1407; }
.mp-badge.is-waitsoft { background: var(--mp-wait-fill); color: var(--mp-wait); }
.mp-badge.is-acc { background: var(--mp-accent-soft); color: var(--interactive-accent); }
.mp-badge.is-late { background: rgba(229, 83, 75, 0.14); color: var(--mp-urgent); }
.mp-solleva { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 28px; min-height: 0; padding: 0 10px; border-radius: 999px; border: 1px solid var(--mp-border-strong); background: transparent; color: var(--interactive-accent); font-size: calc(12.5px * var(--mp-fs)); font-weight: 600; }
.mp-solleva:hover { background: var(--mp-accent-soft); }
.mp-solleva .svg-icon { width: 13px; height: 13px; }
@media (max-width: 899px) { .mp-solleva { height: 34px; padding: 0 12px; } }
.mp-row-more { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 5px; opacity: 0; transition: opacity 0.15s; background: var(--background-primary) !important; box-shadow: 0 0 0 1px var(--background-modifier-border); }
.mp-row-more:hover { color: var(--interactive-accent); }
.mp-row-more .svg-icon { width: 15px; height: 15px; }
.mp-row:hover .mp-row-more, .mp-row-more:focus-visible { opacity: 1; }

/* Sezioni del Pannello (scheda) */
.mp-setup-list { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 8px; }
.mp-setup-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.mp-setup-name { flex: 1; font-weight: 500; }
.mp-num-input { width: 90px !important; }

/* --- Tag --- */
.mp-tagline { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mp-tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; min-height: 0; padding: 0 9px; border: none; border-radius: 999px; background: var(--background-modifier-hover); color: var(--text-muted); font-size: calc(12px * var(--mp-fs)); }
button.mp-tag:hover { background: color-mix(in srgb, var(--text-normal) 10%, transparent); color: var(--text-normal); }
.mp-tag.is-add { background: transparent; border: 1px dashed var(--mp-border-strong); color: var(--text-faint); }
.mp-tag.is-add:hover { color: var(--interactive-accent); border-color: var(--interactive-accent); background: transparent; }
.mp-tag-ic { display: inline-flex; }
.mp-tag-ic .svg-icon { width: 12px; height: 12px; }
.app-detail-bar .mp-tagline { margin: 0; flex: 1; min-width: 0; }
.app-detail-bar { max-width: none; margin: 0 0 12px; align-items: flex-start; }
.app-detail-bar .app-detail-spacer { display: none; }
.app-detail-bar .app-back { flex: none; }
.mp-palette { display: grid; grid-template-columns: repeat(8, 32px); gap: 8px; margin: 6px 0 14px; }
.mp-swatch { width: 32px; height: 32px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.mp-swatch:hover { filter: brightness(1.08); }
.mp-swatch.is-on { box-shadow: 0 0 0 2px var(--background-primary), 0 0 0 4px var(--interactive-accent); }

/* --- Righe di elenco (tag, cestino, persone, altro) --- */
.mp-rows { display: flex; flex-direction: column; background: var(--background-primary); border: 1px solid var(--background-modifier-border); border-radius: var(--mp-radius); max-width: 760px; margin-bottom: 16px; overflow: hidden; }
.mp-line {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 14px; min-height: 48px; border: none; border-radius: 0;
  border-top: 1px solid var(--background-modifier-border);
  background: transparent; text-align: left; justify-content: flex-start; font-size: calc(14px * var(--mp-fs));
}
.mp-line:first-child { border-top: none; }
button.mp-line:hover { background: var(--background-modifier-hover); }
.mp-line-ic { display: inline-flex; color: var(--text-muted); }
.mp-line-ic .svg-icon { width: 18px; height: 18px; }
.mp-line-text { flex: 1; min-width: 0; }
.mp-line-name { flex: 1; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.mp-line-sub { font-size: calc(12.5px * var(--mp-fs)); color: var(--text-muted); margin-top: 1px; }
.mp-line-count { font-size: calc(12.5px * var(--mp-fs)); color: var(--text-faint); }
.mp-line-go { display: inline-flex; color: var(--text-faint); }
.mp-line-go .svg-icon { width: 16px; height: 16px; }
.mp-line-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.mp-line-actions button:not(.clickable-icon) { min-height: 30px; padding: 4px 10px; font-size: calc(13px * var(--mp-fs)); }
.mp-line-actions .clickable-icon:disabled { opacity: 0.3; }
.mp-line-actions .clickable-icon.is-armed { color: var(--mp-urgent); background: rgba(229, 83, 75, 0.12); }
.mp-line.is-person .mp-av { width: 30px; height: 30px; font-size: calc(13px * var(--mp-fs)); }
.mp-av.is-me { background: var(--interactive-accent); color: var(--text-on-accent); }
.mp-with-action { position: relative; }
.mp-with-action .app-card { padding-right: 130px; }
.mp-with-action .mp-restore { position: absolute; right: 14px; top: 14px; min-height: 30px; padding: 4px 10px; font-size: calc(13px * var(--mp-fs)); }
.mp-when { font-size: calc(12px * var(--mp-fs)); color: var(--text-faint); margin: -4px 0 10px 4px; }

/* --- Persone nella scheda del passaggio --- */
.mp-people { width: 100%; }
.mp-people-chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: 38px; padding: 4px 6px; cursor: text;
  background: var(--background-primary); border: 1px solid var(--background-modifier-border); border-radius: 8px;
}
.mp-people-chips:focus-within { border-color: var(--interactive-accent); outline: 2px solid color-mix(in srgb, var(--interactive-accent) 45%, transparent); }
.mp-chip { display: inline-flex; align-items: center; gap: 2px; height: 26px; padding: 0 2px 0 10px; border-radius: 999px; background: var(--background-modifier-hover); font-size: calc(13.5px * var(--mp-fs)); }
.mp-chip.is-me { background: var(--mp-accent-soft); color: var(--interactive-accent); font-weight: 600; }
.mp-chip-x { border: none; background: transparent; padding: 3px; min-height: 0; border-radius: 50%; color: var(--text-muted); }
.mp-chip-x .svg-icon { width: 13px; height: 13px; }
.mp-chip-x:hover { background: var(--background-modifier-hover); }
input.mp-people-input { flex: 1; min-width: 140px; border: none !important; outline: none !important; background: transparent; padding: 4px; min-height: 28px; }
.mp-people-menu { margin-top: 4px; border: 1px solid var(--background-modifier-border); border-radius: 10px; background: var(--background-primary); padding: 4px; max-height: 220px; overflow: auto; }
.mp-people-group { font-size: calc(11.5px * var(--mp-fs)); color: var(--text-faint); padding: 6px 8px 2px; }
.mp-people-opt { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; cursor: pointer; font-size: calc(14px * var(--mp-fs)); }
.mp-people-opt:hover, .mp-people-opt.is-active { background: var(--mp-accent-soft); }
.mp-people-ic { display: inline-flex; color: var(--text-muted); }
.mp-people-ic .svg-icon { width: 15px; height: 15px; }
.mp-urgent-setting .setting-item-name { color: var(--mp-urgent); }

/* --- Avviso con "Annulla" --- */
.notice.mp-notice-undo { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.mp-undo { border: none; background: transparent; color: var(--interactive-accent); font-weight: 600; padding: 2px 4px; min-height: 0; }
.mp-undo:hover { background: var(--mp-accent-soft); }

/* --- Telefono --- */
@media (max-width: 899px) {
  .app-main { padding: 0 0 calc(24px + var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .mp-head { padding: 12px 16px 10px; border-bottom: none; gap: 10px; }
  .mp-head h1 { font-size: calc(20px * var(--mp-fs)); }
  .mp-page { padding: 4px 16px 24px; }
  .mp-panel-head .mp-pills { order: 3; width: calc(100% + 32px); margin: 0 -16px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
  .mp-panel-head .mp-pills::-webkit-scrollbar { display: none; }
  .mp-panel-head .mp-head-actions { margin-left: auto; order: 2; }
  .mp-panel-head .mp-seg { order: 4; width: 100%; margin-left: 0; }
  .mp-panel-head .mp-seg button { flex: 1; }
  .app-tabbar-btn:hover { background: transparent; }
  .mp-panel-head .mp-add { display: none; }
  .mp-pill { height: 32px; font-size: calc(13.5px * var(--mp-fs)); padding: 0 13px; }
  .mp-seg button { padding: 6px 10px !important; font-size: calc(13px * var(--mp-fs)) !important; }
  .mp-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .mp-row { padding: 9px 8px 9px 12px; }
  .mp-chk { width: 20px; height: 20px; }
  .mp-chk.is-wait, .mp-chk.is-call, .mp-chk.is-lock, .mp-chk.is-decision { width: 20px; }
  .mp-rtt { font-size: calc(15px * var(--mp-fs)); }
  .mp-rm { font-size: calc(13px * var(--mp-fs)); }
  .mp-row-more { display: none; }
  .mp-line { min-height: 52px; font-size: calc(15px * var(--mp-fs)); }
  .mp-with-action .app-card { padding-right: 14px; padding-bottom: 52px; }
  .mp-with-action .mp-restore { top: auto; bottom: 22px; right: 14px; }
  .app-detail-bar { margin-bottom: 8px; }
  .mp-palette { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .mp-swatch { width: 100%; height: auto; aspect-ratio: 1; }
  .app-tabbar-btn { font-size: calc(11px * var(--mp-fs)); }
  .app-tabbar-add .app-tab-icon { width: 48px; height: 48px; border-radius: 50%; padding: 0; display: inline-flex; align-items: center; justify-content: center; margin-top: -6px; }
  .app-tabbar-add .svg-icon { width: 24px; height: 24px; }
}
@media (max-width: 420px) {
  .mp-panel-head .mp-seg button { padding: 6px 8px !important; }
}


/* ===================== Tappa 3: diagrammi disegnati dall'app ===================== */
:root {
  --mp-blocked-fill: var(--background-secondary);
  --mp-blocked-stripe: rgba(228, 233, 231, 0.05);
  --mp-done-fill: rgba(52, 211, 153, 0.09);
  --mp-arrow: #5C6763;
  --mp-arrow-done: #3A4240;
  --mp-grid-dot: #1F2423;
}
:root[data-theme="light"] {
  --mp-blocked-stripe: rgba(28, 33, 31, 0.05);
  --mp-done-fill: rgba(5, 150, 105, 0.07);
  --mp-arrow: #A9B3AF;
  --mp-arrow-done: #D3DAD7;
  --mp-grid-dot: #E3E8E6;
}
:root[data-font="manrope"] { --mp-font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
:root[data-font="dmsans"] { --mp-font-ui: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
:root[data-font="plex"] { --mp-font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
:root[data-font="figtree"] { --mp-font-ui: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
:root[data-font="atkinson"] { --mp-font-ui: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { font-family: var(--mp-font-ui); }
.mp-ic { display: inline-flex; flex: none; }
.mp-ic .svg-icon { width: 14px; height: 14px; stroke-width: 1.75; }

/* --- Pagina del workflow --- */
.app.is-wide.is-wf .app-main { display: flex; flex-direction: column; overflow: hidden; }
.app.is-wide .mp-page.is-diagram { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0; }
.mp-wf-head h1 { cursor: pointer; }
.mp-btn-ghost { background: transparent !important; border: none !important; box-shadow: none !important; color: var(--text-muted); }
.mp-btn-ghost:hover { color: var(--text-normal); background: var(--background-modifier-hover) !important; }
.mp-btn-ghost[aria-pressed="true"] { color: var(--interactive-accent); }
.mp-btn-sec { background: transparent !important; border: 1px solid var(--mp-border-strong) !important; box-shadow: none !important; }
.mp-btn-sec.is-on { background: var(--interactive-accent) !important; border-color: var(--interactive-accent) !important; color: var(--text-on-accent); }
.mp-head-actions button { display: inline-flex; align-items: center; gap: 6px; }
.mp-wf-title {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 12px 24px 0; padding-bottom: 10px; border-bottom: 2px solid var(--wf);
}
.mp-wf-name { font-size: calc(15px * var(--mp-fs)); font-weight: 600; }
.mp-wf-title .mp-tagline { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex: 1; min-width: 0; margin: 0; }
.mp-wf-prog { display: flex; align-items: center; gap: 8px; font-size: calc(12.5px * var(--mp-fs)); color: var(--text-muted); margin-left: auto; }
.mp-wf-bar { width: 90px; height: 4px; border-radius: 2px; background: var(--background-modifier-border); overflow: hidden; }
.mp-wf-fill { height: 100%; background: var(--interactive-accent); border-radius: 2px; }
.mp-wf-note { display: flex; align-items: center; gap: 8px; margin: 10px 24px 0; font-size: calc(13px * var(--mp-fs)); color: var(--text-muted); }
.mp-wf-note .mp-link-btn { margin: 0; color: var(--interactive-accent); }
.mp-page.is-diagram .wfd-errors { margin: 10px 24px 0; }
.mp-page.is-diagram .app-diagram { flex: 1; min-height: 0; max-width: none; margin: 0; position: relative; display: flex; flex-direction: column; }

/* --- Diagramma --- */
.mp-dia { flex: 1; min-height: 0; overflow: auto; position: relative; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.mp-dia-size { position: relative; margin: 0 auto; }
.mp-dia-size.is-empty { width: auto !important; height: auto !important; }
.mp-dia-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.mp-dia-size.is-empty .mp-dia-canvas { position: static; }
.mp-dia.is-edit { background-image: radial-gradient(var(--mp-grid-dot) 1.2px, transparent 1.3px); background-size: 24px 24px; }
.mp-dia-empty { padding: 60px 24px; color: var(--text-muted); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.mp-dia-edges { position: absolute; left: 0; top: 0; overflow: visible; }
.mp-dia-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px;
  background: var(--mp-background-raised); border: 1px solid var(--background-modifier-border); box-shadow: var(--shadow);
  font-size: calc(13px * var(--mp-fs)); color: var(--text-muted); white-space: nowrap; z-index: 3; cursor: pointer;
}

/* Frecce */
.mp-e-line { fill: none; stroke: var(--mp-arrow); stroke-width: 1.5; transition: stroke 0.15s; }
.mp-e.is-done .mp-e-line { stroke: var(--mp-arrow-done); }
.mp-e.is-skip .mp-e-line { stroke: var(--mp-arrow-done); stroke-dasharray: 4 4; }
.mp-e.is-stub .mp-e-line { stroke-dasharray: 3 3; }
.mp-e.is-hl .mp-e-line { stroke: var(--interactive-accent); stroke-width: 2; }
.mp-e-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; }
.mp-head { fill: var(--mp-arrow); }
.mp-head.is-done, .mp-head.is-skip { fill: var(--mp-arrow-done); }
.mp-head.is-hl { fill: var(--interactive-accent); }
.mp-stripe-bg { fill: var(--mp-blocked-fill); }
.mp-stripe-fg { fill: var(--mp-blocked-stripe); }
.mp-elab {
  position: absolute; transform: translate(-50%, -50%); z-index: 2;
  height: 20px; min-height: 0; padding: 0 9px; border-radius: 999px; border: 1px solid var(--background-modifier-border);
  background: var(--background-secondary); color: var(--text-muted); font-size: calc(11.5px * var(--mp-fs)); font-weight: 500; line-height: 18px; white-space: nowrap;
  box-shadow: none; cursor: pointer;
}
.mp-elab:hover { border-color: var(--interactive-accent); color: var(--text-normal); background: var(--background-secondary); }
.mp-elab.is-chosen { background: var(--mp-accent-soft); border-color: transparent; color: var(--interactive-accent); font-weight: 600; }
.mp-elab.is-other { color: var(--text-faint); opacity: 0.7; }
.mp-elab.is-stub { border-style: dashed; }

/* Blocchi: la forma è disegnata dietro al contenuto */
.mp-n {
  position: absolute; box-sizing: border-box; padding: 10px 12px; cursor: pointer; outline: none;
  color: var(--text-normal); font-size: calc(12.5px * var(--mp-fs)); line-height: 1.4; transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mp-n-shape { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; z-index: 0; }
.mp-n-shape path { fill: var(--background-primary); stroke: var(--mp-border-strong); stroke-width: 1.5; transition: stroke 0.15s; }
.mp-n-body { position: relative; z-index: 1; }
/* Stati (Tappa 6): colore, fantasia, bordo e testo vengono dalle Impostazioni (aspetto.js → variabili --mp-st-*).
   I valori dopo la virgola sono quelli di partenza, se le variabili mancano. */
.mp-n.is-dafare .mp-n-shape path { fill: var(--mp-st-dafare-paint, var(--background-primary)); stroke: var(--mp-st-dafare-line, var(--mp-border-strong)); stroke-width: var(--mp-st-dafare-bw, 1.5); stroke-dasharray: var(--mp-st-dafare-dash, none); }
.mp-n.is-bloccato .mp-n-shape path { fill: var(--mp-st-bloccato-paint, url(#mp-stripes)); stroke: var(--mp-st-bloccato-line, var(--background-modifier-border)); stroke-width: var(--mp-st-bloccato-bw, 1); stroke-dasharray: var(--mp-st-bloccato-dash, 4 3); }
.mp-n.is-attesa .mp-n-shape path { fill: var(--mp-st-attesa-paint, var(--mp-wait-fill)); stroke: var(--mp-st-attesa-line, var(--mp-wait)); stroke-width: var(--mp-st-attesa-bw, 1.5); stroke-dasharray: var(--mp-st-attesa-dash, none); }
.mp-n.is-fatto .mp-n-shape path { fill: var(--mp-st-fatto-paint, var(--mp-done-fill)); stroke: var(--mp-st-fatto-line, var(--background-modifier-border)); stroke-width: var(--mp-st-fatto-bw, 1); stroke-dasharray: var(--mp-st-fatto-dash, none); }
.mp-n.is-saltato .mp-n-shape path { fill: var(--mp-st-saltato-paint, none); stroke: var(--mp-st-saltato-line, var(--background-modifier-border)); stroke-width: var(--mp-st-saltato-bw, 1); stroke-dasharray: var(--mp-st-saltato-dash, 4 3); }
.mp-n.is-dafare .mp-n-title { font-weight: var(--mp-st-dafare-fw, 500); font-style: var(--mp-st-dafare-fs, normal); text-decoration: var(--mp-st-dafare-td, none); }
.mp-n.is-bloccato .mp-n-title { font-weight: var(--mp-st-bloccato-fw, 500); font-style: var(--mp-st-bloccato-fs, normal); text-decoration: var(--mp-st-bloccato-td, none); }
.mp-n.is-attesa .mp-n-title { font-weight: var(--mp-st-attesa-fw, 500); font-style: var(--mp-st-attesa-fs, normal); text-decoration: var(--mp-st-attesa-td, none); }
.mp-n.is-fatto .mp-n-title { font-weight: var(--mp-st-fatto-fw, 500); font-style: var(--mp-st-fatto-fs, normal); text-decoration: var(--mp-st-fatto-td, none); }
.mp-n.is-saltato .mp-n-title { font-weight: var(--mp-st-saltato-fw, 500); font-style: var(--mp-st-saltato-fs, normal); text-decoration: var(--mp-st-saltato-td, line-through); }
.mp-dia.is-dim-done .mp-n.is-fatto { opacity: 0.45; }
.mp-dia.is-dim-done .mp-n.is-fatto:hover, .mp-dia.is-dim-done .mp-n.is-fatto.is-sel { opacity: 1; }
.mp-n.is-urgent.is-dafare .mp-n-shape path { stroke: var(--mp-urgent); }
.mp-n:hover .mp-n-shape path, .mp-n.is-hl .mp-n-shape path { stroke: var(--interactive-accent); }
.mp-n.is-sel .mp-n-shape path { stroke: var(--interactive-accent); stroke-width: 2; }
.mp-n:focus-visible .mp-n-shape path { stroke: var(--interactive-accent); stroke-width: 2; }
.mp-n.is-dafare .mp-n-title { color: var(--mp-st-dafare-text, var(--text-normal)); }
.mp-n.is-dafare .mp-n-meta, .mp-n.is-dafare .mp-n-prog, .mp-n.is-dafare .mp-n-sub, .mp-n.is-dafare .mp-n-dmeta, .mp-n.is-dafare .mp-n-kind, .mp-n.is-dafare a.mp-n-link, .mp-n.is-dafare .mp-n-bit.is-sub { color: var(--mp-st-dafare-meta, var(--text-muted)); }
.mp-n.is-dafare .mp-n-chk { color: var(--mp-st-dafare-meta, var(--text-faint)); }
.mp-n.is-dafare .mp-n-track { background: color-mix(in srgb, var(--mp-st-dafare-meta, var(--text-muted)) 30%, transparent); }
.mp-n.is-attesa .mp-n-title { color: var(--mp-st-attesa-text, var(--text-normal)); }
.mp-n.is-attesa .mp-n-meta, .mp-n.is-attesa .mp-n-prog, .mp-n.is-attesa .mp-n-sub, .mp-n.is-attesa .mp-n-dmeta, .mp-n.is-attesa .mp-n-kind, .mp-n.is-attesa a.mp-n-link, .mp-n.is-attesa .mp-n-bit.is-sub { color: var(--mp-st-attesa-meta, var(--text-muted)); }
.mp-n.is-attesa .mp-n-chk { color: var(--mp-st-attesa-meta, var(--text-faint)); }
.mp-n.is-attesa .mp-n-track { background: color-mix(in srgb, var(--mp-st-attesa-meta, var(--text-muted)) 30%, transparent); }
.mp-n.is-bloccato .mp-n-title { color: var(--mp-st-bloccato-text, var(--text-normal)); }
.mp-n.is-bloccato .mp-n-meta, .mp-n.is-bloccato .mp-n-prog, .mp-n.is-bloccato .mp-n-sub, .mp-n.is-bloccato .mp-n-dmeta, .mp-n.is-bloccato .mp-n-kind, .mp-n.is-bloccato a.mp-n-link, .mp-n.is-bloccato .mp-n-bit.is-sub { color: var(--mp-st-bloccato-meta, var(--text-muted)); }
.mp-n.is-bloccato .mp-n-chk { color: var(--mp-st-bloccato-meta, var(--text-faint)); }
.mp-n.is-bloccato .mp-n-track { background: color-mix(in srgb, var(--mp-st-bloccato-meta, var(--text-muted)) 30%, transparent); }
.mp-n.is-fatto .mp-n-title { color: var(--mp-st-fatto-text, var(--text-normal)); }
.mp-n.is-fatto .mp-n-meta, .mp-n.is-fatto .mp-n-prog, .mp-n.is-fatto .mp-n-sub, .mp-n.is-fatto .mp-n-dmeta, .mp-n.is-fatto .mp-n-kind, .mp-n.is-fatto a.mp-n-link, .mp-n.is-fatto .mp-n-bit.is-sub { color: var(--mp-st-fatto-meta, var(--text-muted)); }
.mp-n.is-fatto .mp-n-chk { color: var(--mp-st-fatto-meta, var(--text-faint)); }
.mp-n.is-fatto .mp-n-track { background: color-mix(in srgb, var(--mp-st-fatto-meta, var(--text-muted)) 30%, transparent); }
.mp-n.is-saltato .mp-n-title { color: var(--mp-st-saltato-text, var(--text-normal)); }
.mp-n.is-saltato .mp-n-meta, .mp-n.is-saltato .mp-n-prog, .mp-n.is-saltato .mp-n-sub, .mp-n.is-saltato .mp-n-dmeta, .mp-n.is-saltato .mp-n-kind, .mp-n.is-saltato a.mp-n-link, .mp-n.is-saltato .mp-n-bit.is-sub { color: var(--mp-st-saltato-meta, var(--text-muted)); }
.mp-n.is-saltato .mp-n-chk { color: var(--mp-st-saltato-meta, var(--text-faint)); }
.mp-n.is-saltato .mp-n-track { background: color-mix(in srgb, var(--mp-st-saltato-meta, var(--text-muted)) 30%, transparent); }
/* Nei blocchi spenti anche le informazioni colorate (persona, scadenza) usano il testo scelto sul fondo vero */
.mp-n.is-bloccato .mp-n-bit.is-me, .mp-n.is-bloccato .mp-n-bit .is-me, .mp-n.is-bloccato .mp-n-bit.is-today, .mp-n.is-bloccato .mp-n-bit.is-wait { color: var(--mp-st-bloccato-meta); }
.mp-n.is-saltato .mp-n-bit.is-me, .mp-n.is-saltato .mp-n-bit .is-me, .mp-n.is-saltato .mp-n-bit.is-today, .mp-n.is-saltato .mp-n-bit.is-wait { color: var(--mp-st-saltato-meta); }
.mp-n.is-bloccato .mp-n-fill { background: var(--mp-st-bloccato-meta); }
.mp-n.is-saltato .mp-n-fill { background: var(--mp-st-saltato-meta); }
.mp-n.s-pill { padding-left: 18px; padding-right: 16px; }
.mp-n.s-hourglass { padding-left: 17px; padding-right: 17px; }
.mp-n.s-flag { padding-right: 26px; }
.mp-n.s-diamond { padding: 0; display: flex; align-items: center; justify-content: center; }
.mp-n.s-diamond .mp-n-body { text-align: center; }

.mp-n-head { display: flex; align-items: flex-start; gap: 6px; }
.mp-n-title { font-size: calc(14px * var(--mp-fs)); font-weight: 500; line-height: 1.35; min-width: 0; flex: 1; overflow-wrap: break-word; }
.mp-n-line { display: block; white-space: nowrap; }
.mp-n-dtext { flex: none; }
.mp-n-dmeta { font-size: calc(12px * var(--mp-fs)); color: var(--text-muted); margin-top: 2px; }
.mp-n-chk {
  flex: none; width: 16px; height: 16px; min-height: 0; padding: 0; margin-top: 2px;
  border: 1.5px solid var(--mp-border-strong); border-radius: 4px; background: transparent; box-shadow: none;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-faint); cursor: pointer;
}
.mp-n-chk .svg-icon { width: 11px; height: 11px; stroke-width: 3; }
.mp-n-chk:hover { border-color: var(--interactive-accent); background: var(--mp-accent-soft); }
.mp-n-chk.is-on { background: var(--interactive-accent); border-color: var(--interactive-accent); color: var(--text-on-accent); }
.mp-n.is-bloccato .mp-n-chk { border-color: transparent; }
.mp-n.is-bloccato .mp-n-chk .svg-icon { width: 13px; height: 13px; stroke-width: 2; }
.mp-n.is-saltato .mp-n-chk { border-style: dashed; }
.mp-n-kind { color: var(--text-muted); margin-top: 2px; }
.mp-n.is-attesa .mp-n-kind { color: var(--mp-wait); }
.k-traguardo .mp-n-kind { color: var(--text-muted); margin-top: 2px; }
.mp-n-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 9px; margin-top: 4px; padding-left: 22px; font-size: calc(12.5px * var(--mp-fs)); color: var(--text-muted); }
.k-traguardo .mp-n-meta { padding-left: 22px; }
.mp-n-bit { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.mp-n-bit > .mp-ic { flex: none; }
.mp-n-bit > span:not(.mp-ic) { min-width: 0; }
.mp-n-bit .is-me, .mp-n-bit.is-me { color: var(--interactive-accent); font-weight: 600; }
.mp-n-bit.is-who { display: block; white-space: normal; overflow-wrap: break-word; }
.mp-n-bit.is-wait { color: var(--mp-wait); font-weight: 500; }
.mp-n-bit.is-sub { color: var(--text-muted); }
.mp-n-bit.is-late { color: var(--mp-urgent); }
.mp-n-bit.is-today { color: var(--interactive-accent); font-weight: 500; }
a.mp-n-link { color: var(--text-muted); }
a.mp-n-link:hover { color: var(--interactive-accent); }
.mp-n-sub { font-size: calc(12px * var(--mp-fs)); color: var(--text-faint); margin-top: 3px; padding-left: 22px; }
.mp-n-calltop { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.mp-n-time { font-size: calc(16px * var(--mp-fs)); font-weight: 600; letter-spacing: -0.01em; }
.mp-n-join {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px;
  border-radius: 999px; background: var(--interactive-accent); color: var(--text-on-accent) !important; font-size: calc(11.5px * var(--mp-fs)); font-weight: 600; text-decoration: none;
}
.mp-n-join .svg-icon { width: 12px; height: 12px; }
.mp-n-pin { margin-left: auto; color: var(--text-muted); }
.mp-n-prog { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: calc(12px * var(--mp-fs)); color: var(--text-muted); }
/* Checklist (0.16.1): le prossime voci da fare dentro il blocco */
.mp-n-ck { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mp-n-ck-it { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: calc(12px * var(--mp-fs)); line-height: 1.3; color: var(--text-normal); opacity: 0.85; }
.mp-n-ck-sq { flex: none; width: 9px; height: 9px; border: 1.2px solid currentColor; border-radius: 2px; opacity: 0.6; }
.mp-n-ck-tx { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-n-ck-more { font-size: calc(11.5px * var(--mp-fs)); color: var(--text-faint); padding-left: 15px; }
.mp-n-track { flex: 1; height: 3px; border-radius: 2px; background: var(--background-modifier-border); overflow: hidden; }
.mp-n-fill { height: 100%; background: var(--interactive-accent); }
.mp-n-urg, .mp-n-due {
  position: absolute; top: -9px; z-index: 2; height: 17px; padding: 0 6px; border-radius: 6px;
  font-size: calc(11.5px * var(--mp-fs)); font-weight: 600; line-height: 17px; white-space: nowrap;
}
.mp-n-urg { left: 10px; background: var(--mp-urgent); color: #fff; }
.mp-n-due { right: 10px; background: var(--mp-wait); color: #1b1407; }
.mp-n.s-diamond .mp-n-urg { left: 50%; transform: translateX(-50%); top: 6px; }

/* Blocchi compatti (telefono) */
.mp-dia.is-compact .mp-n { padding: 8px 10px; font-size: calc(12px * var(--mp-fs)); }
.mp-dia.is-compact .mp-n.s-pill { padding-left: 13px; padding-right: 11px; }
.mp-dia.is-compact .mp-n.s-hourglass { padding-left: 13px; padding-right: 13px; }
.mp-dia.is-compact .mp-n.s-flag { padding-right: 20px; }
.mp-dia.is-compact .mp-n.s-diamond { padding: 0; }
.mp-dia.is-compact .mp-n-title { font-size: calc(13px * var(--mp-fs)); line-height: 1.32; }
.mp-dia.is-compact .mp-n-meta { padding-left: 22px; margin-top: 2px; font-size: calc(12px * var(--mp-fs)); gap: 2px 7px; }
.mp-dia.is-compact .mp-n-time { font-size: calc(15px * var(--mp-fs)); }
.mp-dia.is-compact .mp-n-prog { margin-top: 4px; }
.mp-dia.is-compact .mp-n-urg, .mp-dia.is-compact .mp-n-due { font-size: calc(11px * var(--mp-fs)); height: 16px; line-height: 16px; top: -8px; }

/* --- Scheda: pannello a destra (Mac) o dal basso (telefono) --- */
.mp-sheet { background: var(--mp-background-raised); color: var(--text-normal); z-index: 40; }
.mp-sheet.is-side {
  width: 380px; flex: none; height: 100%; overflow-y: auto;
  border-left: 1px solid var(--background-modifier-border); box-shadow: -10px 0 30px rgba(0, 0, 0, 0.18);
}
.mp-sheet.is-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 86vh; max-height: 86dvh; overflow-y: auto;
  border-radius: 16px 16px 0 0; border-top: 1px solid var(--background-modifier-border); box-shadow: var(--shadow);
  padding-bottom: env(safe-area-inset-bottom); animation: mp-up 0.22s ease-out; overscroll-behavior: contain;
}
.mp-sheet.is-bottom.is-edit, .mp-sheet.is-bottom.is-new { max-height: 94vh; max-height: 94dvh; }
@keyframes mp-up { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.mp-sheet-bg { position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, 0.35); }
:root[data-theme="light"] .mp-sheet-bg { background: rgba(20, 30, 28, 0.18); }
.mp-sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--mp-border-strong); margin: 8px auto 0; }
.mp-sheet-in { padding: 16px 20px 22px; }
.mp-sheet.is-bottom .mp-sheet-in { padding: 10px 18px 22px; }
.mp-sh-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mp-sh-sp { flex: 1; }
.mp-sh-x { padding: 4px; }
.mp-sh-badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--background-modifier-hover); color: var(--text-muted); font-size: calc(12.5px * var(--mp-fs)); font-weight: 500; }
.mp-sh-badge.is-attesa { background: var(--mp-wait-fill); color: var(--mp-wait); }
.mp-sh-badge.is-fatto { background: var(--mp-accent-soft); color: var(--interactive-accent); }
.mp-sh-badge.is-dafare { background: var(--mp-accent-soft); color: var(--interactive-accent); }
.mp-sh-title { font-size: calc(20px * var(--mp-fs)); font-weight: 600; margin: 0 0 6px; line-height: 1.3; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.mp-sh-short { font-size: calc(12.5px * var(--mp-fs)); color: var(--text-faint); margin-bottom: 6px; }
.mp-sh-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: calc(13.5px * var(--mp-fs)); color: var(--text-muted); margin-bottom: 10px; }
.mp-sh-bit { display: inline-flex; align-items: center; gap: 6px; }
.mp-sh-bit .is-me { color: var(--interactive-accent); font-weight: 600; }
.mp-sh-time { font-size: calc(18px * var(--mp-fs)); font-weight: 600; color: var(--text-normal); }
.mp-sh-wf { display: inline-flex; align-items: center; gap: 7px; min-height: 0; height: 26px; padding: 0 10px; margin-bottom: 12px; border: none; border-radius: 999px; background: var(--background-modifier-hover); color: var(--text-muted); font-size: calc(12.5px * var(--mp-fs)); box-shadow: none; }
.mp-sh-box { border-radius: 10px; padding: 10px 14px; margin: 6px 0 14px; font-size: calc(13.5px * var(--mp-fs)); }
.mp-sh-box.is-wait { background: var(--mp-wait-fill); border: 1px solid color-mix(in srgb, var(--mp-wait) 55%, transparent); }
.mp-sh-box.is-wait .mp-sh-box-t { color: var(--mp-wait); font-weight: 600; font-size: calc(15px * var(--mp-fs)); }
.mp-sh-box.is-due { border-color: var(--mp-wait); }
.mp-sh-box-s { color: var(--text-muted); margin-top: 2px; }
.mp-sh-box.is-muted { background: var(--background-modifier-hover); color: var(--text-muted); }
.mp-sh-box.is-done { background: var(--mp-done-fill); color: var(--text-muted); }
.mp-sh-label { display: flex; align-items: center; gap: 8px; font-size: calc(12.5px * var(--mp-fs)); font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.mp-sh-count { margin-left: auto; font-weight: 500; }
.mp-sh-hint { font-size: calc(12.5px * var(--mp-fs)); color: var(--text-faint); margin-top: 6px; }
.mp-sh-answers, .mp-sh-check, .mp-sh-note { margin: 4px 0 16px; }
.mp-sh-answer-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mp-sh-answer { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 16px; border-radius: 999px; }
.mp-sh-answer.is-on { background: var(--mp-accent-soft); border-color: transparent; color: var(--interactive-accent); font-weight: 600; }
.mp-sh-item { display: flex; align-items: center; gap: 10px; padding: 7px 2px; border-top: 1px solid var(--background-modifier-border); font-size: calc(14px * var(--mp-fs)); cursor: pointer; }
.mp-sh-item:first-of-type { border-top: none; }
.mp-sh-item input { width: 17px; height: 17px; accent-color: var(--interactive-accent); flex: none; }
.mp-sh-item.is-done span { color: var(--text-muted); text-decoration: line-through; }
.mp-sh-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--background-modifier-border); font-size: calc(14px * var(--mp-fs)); color: var(--text-muted); }
.mp-sh-row.is-top { align-items: flex-start; }
.mp-sh-row .mp-ic { margin-top: 1px; }
.mp-sh-row .mp-ic .svg-icon { width: 16px; height: 16px; }
.mp-sh-row a { color: var(--interactive-accent); overflow-wrap: anywhere; }
.mp-sh-details { flex: 1; min-width: 0; color: var(--text-normal); overflow-wrap: anywhere; line-height: 1.45; }
.mp-sh-dline.is-gap { height: 8px; }
.mp-sh-ta, .mp-f-ta { width: 100%; box-sizing: border-box; resize: vertical; min-height: 56px; font: inherit; font-size: calc(14px * var(--mp-fs)); }
.mp-sh-note-acts { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.mp-sh-note-acts button, .mp-sh-actions button { display: inline-flex; align-items: center; gap: 6px; }
.mp-sh-note.is-later { opacity: 0.85; }
.mp-sh-actions { display: flex; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--background-modifier-border); }
.mp-sh-actions button { flex: 1; justify-content: center; min-height: 40px; }
.mp-sh-actions .mp-sh-main { flex: 1.3; }
.mp-sh-more { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 8px; }
.mp-sh-more .mp-link-btn { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: calc(13px * var(--mp-fs)); }
.mp-link-btn.is-danger:hover, .mp-link-btn.is-armed { color: var(--mp-urgent); }
.mp-sh-cal { display: flex; align-items: center; gap: 6px; font-size: calc(12px * var(--mp-fs)); color: var(--text-faint); margin-top: 10px; }

/* Modulo */
.mp-sh-ftitle { font-size: calc(17px * var(--mp-fs)); font-weight: 600; margin: 0; }
.mp-f { margin: 0 0 14px; }
.mp-f-label { font-size: calc(13px * var(--mp-fs)); font-weight: 600; margin-bottom: 5px; }
.mp-f-desc { font-size: calc(12.5px * var(--mp-fs)); color: var(--text-muted); margin: -2px 0 6px; line-height: 1.4; }
.mp-f-input { width: 100%; box-sizing: border-box; height: 34px; font-size: calc(14px * var(--mp-fs)); }
.mp-f-row { display: flex; gap: 12px; }
.mp-f-row > .mp-f { flex: 1; min-width: 0; }
.mp-f-toggle { display: flex; align-items: center; gap: 12px; }
.mp-f-tt { flex: 1; }
.mp-f-tt .mp-f-desc { margin: 0; }
.mp-urgent-setting .mp-f-label { color: var(--mp-urgent); }
.mp-f-list { display: flex; flex-direction: column; gap: 6px; }
.mp-f-li { display: flex; align-items: center; gap: 6px; }
.mp-f-li input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--interactive-accent); flex: none; }
.mp-f-li .mp-f-input { flex: 1; }
.mp-f-list .mp-link-btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 4px 2px; }
.mp-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; }
.mp-kind {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 0; height: auto; padding: 8px 4px 6px;
  border: 1px solid var(--background-modifier-border); border-radius: 10px; background: transparent; box-shadow: none; color: var(--text-muted); font-size: calc(12px * var(--mp-fs));
}
.mp-kind svg path { fill: var(--background-primary); stroke: var(--mp-border-strong); stroke-width: 1.5; }
.mp-kind.is-active { border-color: var(--interactive-accent); background: var(--mp-accent-soft); color: var(--text-normal); }
.mp-kind.is-active svg path { stroke: var(--interactive-accent); }
.mp-kind-l { white-space: nowrap; }
.mp-seg button { display: inline-flex; align-items: center; gap: 6px; }
.mp-seg button.is-active { background: var(--background-primary); color: var(--text-normal); }
.mp-sh-foot { position: sticky; bottom: -22px; display: flex; justify-content: flex-end; gap: 8px; margin: 18px -20px -22px; padding: 12px 20px; background: var(--mp-background-raised); border-top: 1px solid var(--background-modifier-border); }
.mp-sheet.is-bottom .mp-sh-foot { margin: 18px -18px -22px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
.mp-sh-foot button { min-width: 96px; min-height: 36px; }

@media (max-width: 899px) {
  .app.is-narrow.is-wf .app-main { padding-bottom: 0; }
  .app.is-narrow .mp-page.is-diagram {
    padding: 0; display: flex; flex-direction: column;
    height: calc(100vh - var(--top-h) - var(--tabbar-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    height: calc(100dvh - var(--top-h) - var(--tabbar-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .mp-wf-head { padding: 10px 12px 4px 16px; flex-wrap: nowrap; }
  .mp-wf-head .mp-head-title { flex: 1; min-width: 0; }
  .mp-wf-head h1 { font-size: calc(18px * var(--mp-fs)); }
  .mp-wf-head .mp-head-actions { margin-left: 0; }
  .mp-wf-title { margin: 0 16px; padding-bottom: 8px; gap: 8px; flex-wrap: nowrap; }
  .mp-wf-title .mp-tagline { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .mp-wf-prog { order: -1; margin-left: 0; }
  .mp-wf-bar { width: 70px; }
  .mp-wf-note, .mp-page.is-diagram .wfd-errors { margin: 8px 16px 0; }
  .mp-sh-actions button { min-height: 44px; }
  .mp-kinds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mp-f-input { height: 40px; font-size: calc(16px * var(--mp-fs)); }
  .mp-sh-ta, .mp-f-ta { font-size: calc(16px * var(--mp-fs)); }
  .mp-elab { height: 24px; line-height: 22px; padding: 0 10px; }
}
.app.has-sheet .mp-show-done span:last-child { display: none; }

/* ---------- Modalità Modifica (Tappa 4) ---------- */
.mp-edit-bar { display: flex; align-items: center; gap: 10px; margin: 10px 24px 0; font-size: calc(13px * var(--mp-fs)); color: var(--text-muted); }
.mp-edit-bar .mp-edit-hint { flex: 1; min-width: 0; }
.mp-edit-bar button { min-height: 30px; }
.mp-dia.is-edit { user-select: none; -webkit-user-select: none; }
.mp-dia.is-edit .mp-elab { pointer-events: none; }
.mp-dia.is-edit .mp-e.is-cut { cursor: pointer; }
.mp-dia.is-edit .mp-e.is-cut:hover .mp-e-line { stroke: var(--mp-urgent); stroke-dasharray: 5 4; }
.mp-dia.is-edit:not(.is-compact) .mp-n { cursor: grab; }
.mp-plus {
  position: absolute; transform: translate(-50%, -50%); z-index: 4;
  width: 20px; height: 20px; min-height: 0; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--background-primary); border: 1px solid var(--interactive-accent) !important; color: var(--interactive-accent);
  box-shadow: none; cursor: pointer;
}
.mp-plus .svg-icon { width: 13px; height: 13px; stroke-width: 2.25; }
.mp-plus:hover, .mp-plus.is-chosen { background: var(--interactive-accent); color: var(--text-on-accent); }
.mp-dia.is-compact .mp-plus { width: 32px; height: 32px; }
.mp-dia.is-compact .mp-plus .svg-icon { width: 16px; height: 16px; }
.mp-dia.is-moving .mp-plus, .mp-dia.is-linking .mp-plus { opacity: 0.25; pointer-events: none; }
.mp-hdot {
  position: absolute; transform: translate(-50%, -50%); z-index: 5; width: 10px; height: 10px; box-sizing: border-box;
  border-radius: 50%; background: var(--background-primary); border: 1.5px solid var(--interactive-accent); cursor: crosshair; touch-action: none;
}
.mp-hdot::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; }
.mp-hdot:hover, .mp-dia.is-linking .mp-hdot.is-in { background: var(--interactive-accent); }
.mp-dia.is-moving .mp-hdot { opacity: 0; }
.mp-n.is-picked::after { content: ""; position: absolute; inset: -5px; border: 2px solid var(--interactive-accent); border-radius: 14px; pointer-events: none; }
.mp-n.s-diamond.is-picked::after { border-radius: 8px; }
.mp-n.is-picked .mp-n-shape path { stroke: var(--interactive-accent); }
.mp-n.is-dragging { opacity: 0.9; z-index: 6; cursor: grabbing; transition: none; box-shadow: none; }
.mp-n.is-link-bad { opacity: 0.45; }
.mp-n.is-link-bad .mp-n-shape path { stroke: var(--mp-urgent); stroke-dasharray: 4 3; }
.mp-n.is-link-ok .mp-n-shape path { stroke: var(--interactive-accent); stroke-dasharray: 4 3; }
.mp-n.is-link-src .mp-n-shape path { stroke: var(--interactive-accent); stroke-width: 2; }
.mp-n.is-drop-ok .mp-n-shape path { stroke: var(--interactive-accent); stroke-width: 2; }
.mp-n.is-drop-bad .mp-n-shape path { stroke: var(--mp-urgent); stroke-width: 2; stroke-dasharray: 4 3; }
.mp-e-drag { fill: none; stroke: var(--text-muted); stroke-width: 1.75; stroke-dasharray: 5 4; pointer-events: none; }
.mp-e-drag.is-ok { stroke: var(--interactive-accent); stroke-dasharray: none; }
.mp-e-drag.is-bad { stroke: var(--mp-urgent); }
.mp-drag-tag { position: absolute; transform: translate(-50%, -50%); z-index: 7; display: none; padding: 2px 10px; border-radius: 999px; font-size: calc(11.5px * var(--mp-fs)); font-weight: 500; white-space: nowrap; pointer-events: none; background: var(--background-secondary); color: var(--text-muted); border: 1px solid var(--background-modifier-border); }
.mp-drag-tag.is-on { display: block; }
.mp-drag-tag.is-bad { background: rgba(var(--color-red-rgb), 0.16); color: var(--mp-urgent); border-color: transparent; }
/* Casella dove andrà il blocco trascinato (Blocco C) */
.mp-drop-cell { position: absolute; border: 2px dashed var(--interactive-accent); border-radius: 12px; background: color-mix(in srgb, var(--interactive-accent) 8%, transparent); z-index: 0; pointer-events: none; }
.mp-drop-cell.is-bad { border-color: var(--mp-urgent); background: transparent; opacity: 0.6; }
.mp-link-tip {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 8;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 24px); padding: 6px 6px 6px 14px; border-radius: 999px;
  background: var(--mp-background-raised); border: 1px solid var(--interactive-accent); box-shadow: var(--shadow); font-size: calc(13px * var(--mp-fs));
}
.mp-link-tip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-link-tip button { min-height: 26px; height: 26px; padding: 0 10px; flex: none; }

/* Barra del blocco */
.mp-bbar {
  z-index: 9; display: flex; flex-direction: column; padding: 5px; box-sizing: border-box;
  background: var(--mp-background-raised); border: 1px solid var(--background-modifier-border); border-radius: 10px; box-shadow: var(--shadow);
  cursor: default;
}
.mp-bbar.is-float { position: absolute; width: 236px; }
.mp-bbar.is-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; border-radius: 16px 16px 0 0; padding: 6px 10px calc(10px + env(safe-area-inset-bottom));
  border-bottom: none; z-index: 60;
}
.mp-dia-spacer { height: 60vh; }
.mp-bbar-head { display: flex; align-items: center; gap: 8px; padding: 6px 6px 8px; border-bottom: 1px solid var(--background-modifier-border); margin-bottom: 4px; }
.mp-bbar-title { flex: 1; min-width: 0; font-weight: 600; font-size: calc(14px * var(--mp-fs)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-bbar-it {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 32px; height: auto; padding: 5px 8px; border: none; border-radius: 7px;
  background: transparent; box-shadow: none; color: var(--text-normal); font-size: calc(13.5px * var(--mp-fs)); text-align: left; justify-content: flex-start;
}
.mp-bbar.is-bottom .mp-bbar-it { min-height: 44px; font-size: calc(15px * var(--mp-fs)); }
.mp-bbar-it:hover:not(:disabled) { background: var(--background-modifier-hover); }
.mp-bbar-it .mp-ic { display: inline-flex; color: var(--text-muted); }
.mp-bbar-it .mp-ic .svg-icon { width: 16px; height: 16px; }
.mp-bbar-l { flex: 1; }
.mp-bbar-sub { font-size: calc(11.5px * var(--mp-fs)); color: var(--text-faint); }
.mp-bbar-arrows { display: inline-flex; gap: 2px; }
.mp-bbar-arrow { width: 26px; height: 24px; min-height: 0; padding: 0; border: none; background: transparent; box-shadow: none; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; }
.mp-bbar.is-bottom .mp-bbar-arrow { width: 40px; height: 36px; }
.mp-bbar-arrow:hover:not(:disabled) { background: var(--mp-accent-soft); color: var(--interactive-accent); }
.mp-bbar-arrow:disabled { opacity: 0.3; }
.mp-bbar-it.has-chips { flex-wrap: wrap; }
.mp-bbar-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.mp-bbar-chip { height: 22px; min-height: 0; padding: 0 9px; border-radius: 999px; font-size: calc(11.5px * var(--mp-fs)); border: 1px solid var(--background-modifier-border); background: var(--background-secondary); box-shadow: none; }
.mp-bbar.is-bottom .mp-bbar-chip { height: 32px; font-size: calc(13px * var(--mp-fs)); padding: 0 12px; }
.mp-bbar-chip:hover { border-color: var(--interactive-accent); color: var(--interactive-accent); }
.mp-bbar-sep { height: 1px; background: var(--background-modifier-border); margin: 4px 2px; }
.mp-bbar-it.is-danger, .mp-bbar-it.is-danger .mp-ic { color: var(--mp-urgent); }

/* Modulo: dove va il passaggio; aggiunta rapida con il diagramma compatto */
.mp-f-where { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 6px; padding: 10px 12px; border-radius: 8px; background: var(--background-secondary); font-size: calc(13px * var(--mp-fs)); color: var(--text-muted); line-height: 1.45; }
.mp-f-where-ic { display: inline-flex; color: var(--interactive-accent); margin-top: 1px; }
.mp-f-where-ic .svg-icon { width: 15px; height: 15px; }
.mp-quick .mp-f-input { width: 100%; }
.mp-quick-place { display: flex; align-items: center; gap: 8px; font-size: calc(13px * var(--mp-fs)); color: var(--text-normal); margin-bottom: 6px; min-height: 24px; }
.mp-quick-place .mp-link-btn { margin: 0; }
.mp-quick-where { position: relative; height: 260px; display: flex; border: 1px solid var(--background-modifier-border); border-radius: 10px; overflow: hidden; background: var(--background-primary); }
.mp-quick-where .mp-dia { height: 100%; }
.mp-quick-where .mp-dia-empty { padding: 30px 16px; }
.mp-dia.is-pick .mp-n { cursor: default; }
@media (max-width: 899px) {
  .mp-edit-bar { margin: 8px 16px 0; font-size: calc(12.5px * var(--mp-fs)); gap: 8px; }
}


/* ===================== Tappa 5: Settimana, Sommario, Ricerca, Riepilogo ===================== */
/* --- Ricerca: campo nella barra laterale (Mac) e in cima alla pagina (telefono) --- */
.mp-search { position: relative; display: flex; align-items: center; margin: 0 0 10px; }
.mp-search-ic { position: absolute; left: 9px; display: inline-flex; color: var(--text-faint); pointer-events: none; }
.mp-search-ic .svg-icon { width: 15px; height: 15px; }
input.mp-search-input {
  width: 100%; height: 32px; padding: 0 10px 0 30px; font-size: calc(13.5px * var(--mp-fs));
  background: var(--background-primary); border: 1px solid var(--background-modifier-border); border-radius: var(--mp-radius-control);
}
input.mp-search-input:focus { border-color: var(--interactive-accent); box-shadow: 0 0 0 3px var(--mp-accent-soft); outline: none; }
input.mp-search-input::-webkit-search-cancel-button { cursor: pointer; }
.mp-page-search { margin: 0 0 14px; max-width: 760px; }
.mp-page-search input.mp-search-input { height: 44px; font-size: calc(16px * var(--mp-fs)); padding-left: 36px; }
.mp-page-search .mp-search-ic { left: 12px; }
.mp-page-search .mp-search-ic .svg-icon { width: 18px; height: 18px; }
.app-top-search { padding: 6px; }
.app-top-search.is-active { color: var(--interactive-accent); }
.app-top-search .svg-icon { width: 20px; height: 20px; }
.mp-results { max-width: 760px; display: flex; flex-direction: column; gap: 12px; }
.mp-results-count { font-size: calc(12.5px * var(--mp-fs)); color: var(--text-muted); }
.mp-res { padding: 8px 14px 6px; }
.mp-res.is-archived { opacity: 0.85; }
.mp-res-wf {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 0; padding: 4px 0 6px;
  border: none; background: transparent; justify-content: flex-start; text-align: left; font-size: calc(13.5px * var(--mp-fs)); font-weight: 600; flex-wrap: wrap;
}
.mp-res-wf:hover { background: transparent; color: var(--interactive-accent); }
.mp-res-wf-name { min-width: 0; overflow-wrap: anywhere; }
.mp-res-arch { font-size: calc(11px * var(--mp-fs)); font-weight: 500; color: var(--text-muted); border: 1px solid var(--mp-border-strong); border-radius: 999px; padding: 0 7px; line-height: 17px; }
.mp-res-ic { display: inline-flex; color: var(--text-muted); flex: none; }
.mp-res-ic .svg-icon { width: 16px; height: 16px; }
.mp-res-ic.is-call { color: var(--interactive-accent); }
.mp-res-ic.is-attesa { color: var(--mp-wait); }
.mp-res-row.is-done .mp-rtt { color: var(--text-muted); }
.mp-res-field { flex: none; color: var(--text-faint); }
.mp-res-field::after { content: ":"; }
.mp-results mark, .mp-res mark {
  background: color-mix(in srgb, var(--interactive-accent) 26%, transparent); color: inherit;
  border-radius: 3px; padding: 0 1px; margin: 0 -1px;
}

/* --- Settimana --- */
.mp-week-nav { display: inline-flex; align-items: center; gap: 2px; background: var(--background-secondary); border: 1px solid var(--background-modifier-border); border-radius: var(--mp-radius-control); padding: 2px; }
.mp-week-nav .clickable-icon { padding: 4px; }
.mp-week-nav .mp-week-today { min-height: 0 !important; padding: 3px 10px !important; border: none; background: transparent; font-size: calc(12.5px * var(--mp-fs)) !important; color: var(--text-muted); }
.mp-week-nav .mp-week-today:not(:disabled):hover { color: var(--text-normal); background: var(--background-modifier-hover); }
.mp-week-nav .mp-week-today:disabled { opacity: 0.45; }
.mp-week-head .mp-pills { margin-right: auto; }
.mp-week-label { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: calc(15px * var(--mp-fs)); font-weight: 600; margin: 0 0 12px; letter-spacing: -0.01em; }
.mp-week-rel { font-size: calc(12.5px * var(--mp-fs)); font-weight: 400; color: var(--text-muted); }
.mp-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: stretch; }
.mp-day {
  min-width: 0; min-height: 180px; display: flex; flex-direction: column; gap: 6px;
  background: var(--background-primary); border: 1px solid var(--background-modifier-border); border-radius: var(--mp-radius); padding: 8px 6px 10px;
}
.mp-day.is-past { background: transparent; }
.mp-day.is-today { border-color: color-mix(in srgb, var(--interactive-accent) 60%, transparent); box-shadow: inset 0 2px 0 var(--interactive-accent); }
.mp-day-head { display: flex; align-items: baseline; gap: 6px; padding: 0 4px 4px; color: var(--text-muted); font-size: calc(12px * var(--mp-fs)); }
.mp-day-name { text-transform: capitalize; }
.mp-day-num { font-size: calc(15px * var(--mp-fs)); font-weight: 600; color: var(--text-normal); }
.mp-day.is-past .mp-day-num { color: var(--text-muted); }
.mp-day-today { margin-left: auto; font-size: calc(11px * var(--mp-fs)); font-weight: 600; color: var(--interactive-accent); }
.mp-day.is-today .mp-day-num { color: var(--interactive-accent); }
.mp-day-none { margin-left: auto; color: var(--text-faint); font-size: calc(12px * var(--mp-fs)); }
.mp-wk {
  position: relative; padding: 6px 7px 6px 10px; border-radius: 7px; cursor: pointer;
  background: var(--background-secondary); border: 1px solid transparent; min-width: 0;
}
.mp-wk::before { content: ""; position: absolute; left: 3px; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--wf); }
.mp-wk:hover { border-color: var(--mp-border-strong); }
.mp-wk:focus-visible { outline: 2px solid var(--interactive-accent); outline-offset: 1px; }
.mp-wk-top { display: flex; align-items: center; gap: 5px; margin-bottom: 2px; flex-wrap: wrap; }
.mp-wk-ic { display: inline-flex; color: var(--text-muted); }
.mp-wk-ic .svg-icon { width: 14px; height: 14px; }
.mp-wk-ic.is-call { color: var(--interactive-accent); }
.mp-wk-ic.is-attesa { color: var(--mp-wait); }
.mp-wk-time { font-size: calc(12px * var(--mp-fs)); font-weight: 600; color: var(--interactive-accent); }
.mp-wk .mp-urg { font-size: calc(10.5px * var(--mp-fs)); padding: 0 5px; line-height: 15px; }
.mp-wk-text { font-size: calc(13px * var(--mp-fs)); font-weight: 500; line-height: 1.3; overflow-wrap: break-word; hyphens: none; }
.mp-wk-meta { display: flex; align-items: center; gap: 5px; margin-top: 3px; font-size: calc(11.5px * var(--mp-fs)); color: var(--text-muted); min-width: 0; }
.mp-wk-meta .mp-dot { width: 6px; height: 6px; }
.mp-wk-meta-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mp-wk[draggable="true"] { cursor: grab; }
.mp-wk.is-dragging { opacity: 0.45; }
.mp-day.is-drop { border-color: var(--interactive-accent); background: var(--mp-accent-soft); }
.mp-week-nav .is-drop { background: var(--mp-accent-soft); color: var(--interactive-accent); }
.mp-wk { -webkit-touch-callout: none; }
.mp-wk.is-done { background: transparent; border-color: var(--background-modifier-border); }
.mp-wk.is-done .mp-wk-text { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--text-faint); }
.mp-wk.is-done .mp-wk-ic { color: var(--interactive-accent); }
.mp-wk.is-blocked .mp-wk-text { color: var(--text-muted); }
.mp-week.is-empty + .mp-week-empty { padding: 14px 0 0; }

/* --- Sommario --- */
.mp-sum-head .mp-pills { margin-right: auto; }
.mp-sum-note { font-size: calc(12.5px * var(--mp-fs)); color: var(--text-muted); margin: 0 0 12px; }
.mp-sum-wf { margin: 0 0 22px; }
.mp-sum-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 0 8px; margin-bottom: 8px; border-bottom: 2px solid var(--wf); max-width: 1180px; }
.mp-sum-name { display: inline-flex; align-items: center; gap: 8px; border: none; background: transparent; padding: 2px 0; min-height: 0; font-size: calc(15px * var(--mp-fs)); font-weight: 600; text-align: left; }
.mp-sum-name:hover { background: transparent; color: var(--interactive-accent); }
.mp-sum-title .mp-tagline { margin-top: 0; }
.app-diagram.mp-sum-dia { max-width: none; margin: 0; }
/* Sommario: un solo scorrimento. Il diagramma è alto quanto serve; lo scorrimento verticale passa sempre alla pagina */
.mp-sum-dia .mp-dia { flex: none; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; overscroll-behavior-y: auto; touch-action: pan-x pan-y; }
.mp-sum-dia .mp-dia.is-flow { max-height: none; }
.mp-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; background: var(--background-secondary); }
.mp-seg .mp-pill { border-color: transparent; }
.mp-sum-btns { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; }
.mp-sum-title .mp-wf-prog { margin-left: auto; }
.mp-sum-title .mp-wf-prog + .mp-sum-btns { margin-left: 0; }
.mp-sum-icons { display: grid; gap: 12px; max-width: 1000px; }
.mp-sum-icon { position: relative; max-width: 1000px; margin: 0 0 14px; }
.mp-sum-icons .mp-sum-icon { margin: 0; }
.mp-sum-bar { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.mp-sum-bar .mp-resume { flex: 1; min-width: 0; }
.mp-resume { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 10px; margin: 0 0 8px; border-radius: 10px; background: var(--background-secondary); max-width: 1180px; }
.mp-sum-bar .mp-resume { margin: 0; }
.mp-resume-label { font-size: calc(11px * var(--mp-fs)); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); white-space: nowrap; }
.mp-resume-none { font-size: calc(13px * var(--mp-fs)); color: var(--text-muted); }
.mp-resume-chk { flex: none; width: 24px; height: 24px; min-height: 0; padding: 0; border-radius: 7px; border: 1.5px solid var(--text-faint); background: transparent; display: inline-flex; align-items: center; justify-content: center; }
.mp-resume-chk.is-ask { border-radius: 50%; color: var(--interactive-accent); border-color: var(--interactive-accent); }
.mp-resume-chk svg { width: 14px; height: 14px; }
.mp-resume-text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 0; text-align: left; border: none; background: transparent; padding: 2px 0; min-height: 0; box-shadow: none; }
.mp-resume-text:hover { background: transparent; }
.mp-resume-title { font-size: calc(14px * var(--mp-fs)); font-weight: 500; color: var(--text-normal); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-resume-meta { font-size: calc(12px * var(--mp-fs)); color: var(--text-muted); }

/* --- Riepilogo --- */
.modal.mp-recap-modal { width: min(640px, calc(100vw - 24px)); }
.mp-recap-opts { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 12px; }
.mp-recap-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mp-recap-row.mp-pills { margin-left: 0; }
.mp-recap-lab { font-size: calc(13px * var(--mp-fs)); color: var(--text-muted); min-width: 108px; }
select.mp-recap-person { width: auto; min-width: 200px; max-width: 100%; }
textarea.mp-recap-text {
  width: 100%; font-size: calc(13px * var(--mp-fs)); line-height: 1.5; font-family: var(--font-text, inherit);
  background: var(--background-secondary); border: 1px solid var(--background-modifier-border); border-radius: 8px; padding: 10px 12px; resize: vertical;
}
.mp-recap-btn .svg-icon { width: 16px; height: 16px; }

/* --- Telefono --- */
@media (max-width: 899px) {
  .mp-week-head .mp-head-actions { margin-left: auto; order: 2; }
  .mp-week-nav .clickable-icon { padding: 8px; }
  .mp-week-nav .mp-week-today { padding: 6px 12px !important; font-size: calc(13.5px * var(--mp-fs)) !important; }
  .mp-week { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .mp-day { min-height: 0; padding: 8px 8px 8px; gap: 6px; }
  .mp-day.is-free { padding: 6px 8px; background: transparent; }
  .mp-day-head { font-size: calc(14px * var(--mp-fs)); font-weight: 500; color: var(--text-normal); padding: 2px 4px; }
  .mp-day-num { font-size: calc(13px * var(--mp-fs)); font-weight: 400; color: var(--text-muted); }
  .mp-day.is-today .mp-day-num { color: var(--interactive-accent); }
  .mp-day-today { margin-left: 0; }
  .mp-wk { padding: 9px 10px 9px 14px; }
  .mp-wk::before { left: 5px; top: 9px; bottom: 9px; }
  .mp-wk-text { font-size: calc(15px * var(--mp-fs)); }
  .mp-wk-meta { font-size: calc(13px * var(--mp-fs)); }
  .mp-sum-head .mp-head-actions { margin-left: auto; order: 2; }
  .mp-resume-label { display: none; }
  .mp-sum-title .mp-wf-prog { order: 0; margin-left: auto; }
  .mp-sum-name { font-size: calc(16px * var(--mp-fs)); }
  textarea.mp-recap-text { max-height: 38vh; }
  .mp-recap-lab { min-width: 0; width: 100%; }
  .mp-recap-row .mp-seg { width: 100%; }
  .mp-recap-row .mp-seg button { flex: 1; }
  select.mp-recap-person { width: 100%; }
  .mp-res { padding: 8px 12px 6px; }
}

/* ===================== Tappa 6: impostazioni grafiche ===================== */
/* Pagina Impostazioni: gruppi a sinistra, voci al centro, anteprima a destra (Mac);
   sul telefono gruppi in una fila che scorre, anteprima in alto, voci sotto */
.app-settings.mp-set-page { max-width: 1180px; padding: 20px 24px 0; }
.mp-set-wrap { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; align-items: start; }
.mp-set-page.has-preview .mp-set-wrap { grid-template-columns: 180px minmax(0, 1fr) minmax(300px, 400px); }
.mp-set-nav { display: flex; flex-direction: column; gap: 1px; position: sticky; top: 0; }
.mp-set-tab {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 0; padding: 7px 10px; border: none; border-radius: 7px;
  background: transparent; box-shadow: none; color: var(--text-muted); font-size: calc(13.5px * var(--mp-fs)); text-align: left; justify-content: flex-start;
}
.mp-set-tab:hover { background: var(--background-modifier-hover); color: var(--text-normal); }
.mp-set-tab.is-active { background: var(--mp-accent-soft); color: var(--text-normal); }
.mp-set-tab.is-active .mp-set-tab-ic { color: var(--interactive-accent); }
.mp-set-tab-ic { display: inline-flex; }
.mp-set-tab-ic .svg-icon { width: 16px; height: 16px; }
.mp-set-panel { grid-column: 2; grid-row: 1; min-width: 0; padding-bottom: 24px; }
.mp-set-preview { grid-column: 3; grid-row: 1; position: sticky; top: 0; background: var(--background-primary); border: 1px solid var(--background-modifier-border); border-radius: var(--mp-radius); padding: 12px 12px 10px; }
.mp-set-panel .app-settings-group { margin-bottom: 0; }
.mp-set-h { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; }
.mp-set-h h2 { font-size: calc(17px * var(--mp-fs)); font-weight: 600; margin: 0; flex: 1; }
.mp-set-reset { font-size: calc(13px * var(--mp-fs)); }
.mp-set-desc { color: var(--text-muted); font-size: calc(13px * var(--mp-fs)); line-height: 1.45; margin: 0 0 8px; }
.mp-set-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--background-modifier-border); }
.mp-set-row.is-col { flex-direction: column; align-items: stretch; gap: 10px; }
.mp-set-row.is-col .mp-set-info { flex: none; }
.mp-set-h + .mp-set-row, .mp-set-desc + .mp-set-row { border-top: none; }
.mp-set-info { flex: 1 1 150px; min-width: 0; }
.mp-set-name { font-weight: 500; }
.mp-set-sub { font-size: calc(12.5px * var(--mp-fs)); color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.mp-set-ctl { flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: 100%; }
.mp-set-row.is-col .mp-set-ctl { justify-content: flex-start; }
.mp-set-row.is-col .mp-set-ctl > * { flex: 1 1 100%; min-width: 0; }
.mp-seg button:disabled { opacity: 0.4; cursor: default; }
.mp-size button.is-on:disabled { opacity: 1; min-width: 34px; }
.mp-textstyle button { padding: 4px 8px !important; }
.mp-textstyle .svg-icon { width: 15px; height: 15px; }
/* Colori a scelta */
.mp-accents { display: flex; flex-wrap: wrap; gap: 8px; }
.mp-accents .mp-swatch { width: 28px; height: 28px; position: relative; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.mp-accents.is-small { gap: 6px; }
.mp-accents.is-small .mp-swatch { width: 22px; height: 22px; }
.mp-swatch.is-free { background: var(--background-secondary); border: 1px dashed var(--mp-border-strong); color: var(--text-muted); overflow: hidden; }
.mp-swatch.is-free .svg-icon { width: 14px; height: 14px; }
.mp-swatch.is-free input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: none; padding: 0; }
.mp-swatch.is-auto { background: var(--background-secondary); border: 1px solid var(--mp-border-strong); color: var(--text-muted); font-size: calc(11.5px * var(--mp-fs)); font-weight: 600; }
/* Caratteri: ognuno scritto nel suo */
.mp-fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.mp-font {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 0; height: auto; padding: 9px 12px; text-align: left;
  border: 1px solid var(--background-modifier-border); border-radius: var(--mp-radius-control); background: var(--background-primary); box-shadow: none; color: var(--text-normal);
}
.mp-font:hover { border-color: var(--mp-border-strong); }
.mp-font.is-on { border-color: var(--interactive-accent); background: var(--mp-accent-soft); }
.mp-font-name { font-size: calc(13.5px * var(--mp-fs)); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mp-font-aa { font-size: calc(18px * var(--mp-fs)); font-weight: 500; color: var(--text-muted); }
.mp-slider { display: flex; align-items: center; gap: 10px; font-size: calc(12.5px * var(--mp-fs)); }
.mp-slider input[type=range] { width: 140px; accent-color: var(--interactive-accent); }
/* Interruttore */
.mp-switch {
  width: 32px; height: 18px; min-height: 0; padding: 0; border: none; border-radius: 9px; position: relative; flex: none;
  background: var(--mp-border-strong); box-shadow: none; cursor: pointer; transition: background var(--mp-dur);
}
.mp-switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform var(--mp-dur); }
.mp-switch.is-on { background: var(--interactive-accent); }
.mp-switch.is-on::after { transform: translateX(14px); }
.mp-set-ess { margin: 4px 0 8px; }
/* Stati */
.mp-set-state { border: 1px solid var(--background-modifier-border); border-radius: var(--mp-radius); padding: 10px 14px 2px; margin: 10px 0; background: var(--background-primary); }
.mp-set-state-h { display: flex; align-items: center; gap: 9px; font-weight: 600; padding-bottom: 4px; }
.mp-set-state .mp-set-row { padding: 9px 0; }
.mp-set-state .mp-set-info { flex: 0 0 76px; }
.mp-set-state .mp-set-ctl { flex: 1 1 auto; justify-content: flex-start; min-width: 0; }
.mp-set-state .mp-seg { flex-wrap: wrap; max-width: 100%; }
.mp-set-state .mp-seg button { padding: 4px 8px !important; }
.mp-set-state .mp-set-row:first-of-type { border-top: none; }
/* Campioni degli stati (legenda) */
.mp-lg { display: inline-flex; flex: none; }
.mp-lg svg { overflow: visible; }
.mp-lg.is-dafare rect { fill: var(--mp-st-dafare-paint); stroke: var(--mp-st-dafare-line); stroke-width: var(--mp-st-dafare-bw); stroke-dasharray: var(--mp-st-dafare-dash); }
.mp-lg.is-attesa rect { fill: var(--mp-st-attesa-paint); stroke: var(--mp-st-attesa-line); stroke-width: var(--mp-st-attesa-bw); stroke-dasharray: var(--mp-st-attesa-dash); }
.mp-lg.is-bloccato rect { fill: var(--mp-st-bloccato-paint); stroke: var(--mp-st-bloccato-line); stroke-width: var(--mp-st-bloccato-bw); stroke-dasharray: 3 2; }
.mp-lg.is-fatto rect { fill: var(--mp-st-fatto-paint); stroke: var(--mp-st-fatto-line); stroke-width: var(--mp-st-fatto-bw); stroke-dasharray: var(--mp-st-fatto-dash); }
.mp-lg.is-saltato rect { fill: var(--mp-st-saltato-paint); stroke: var(--mp-st-saltato-line); stroke-width: var(--mp-st-saltato-bw); stroke-dasharray: 3 2; }
.mp-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; padding-top: 10px; border-top: 1px solid var(--background-modifier-border); font-size: calc(12.5px * var(--mp-fs)); color: var(--text-muted); }
.mp-legend-it { display: inline-flex; align-items: center; gap: 6px; }
.mp-set-cap { font-size: calc(12px * var(--mp-fs)); color: var(--text-faint); font-weight: 500; margin-bottom: 6px; }
.mp-set-pv { height: 400px; display: flex; flex-direction: column; margin-bottom: 8px; }
.mp-set-pv .mp-dia { overflow: hidden; }
.mp-set-pv .mp-n, .mp-set-pv .mp-elab { cursor: default; }

/* Modalità essenziale: barra laterale con le sole icone (Mac) */
.app.is-rail .mp-side { width: 56px; padding: 14px 8px 10px; align-items: center; }
.app.is-rail .mp-brand span:not(.app-logo) { display: none; }
.app.is-rail .mp-brand { padding: 2px 0 14px; }
.app.is-rail .mp-nav { justify-content: center; padding: 8px 0; width: 40px; }
.app.is-rail .mp-nav-label, .app.is-rail .mp-nav-count { display: none; }
.app.is-rail .mp-me { justify-content: center; padding: 10px 0 4px; }
.app.is-rail .mp-me .app-sync { display: none; }

@media (max-width: 1180px) {
  .mp-set-page.has-preview .mp-set-wrap { grid-template-columns: 180px minmax(0, 1fr); }
  .mp-set-page.has-preview .mp-set-preview { grid-column: 2; grid-row: 1; position: static; }
  .mp-set-page.has-preview .mp-set-panel { grid-row: 2; }
  .mp-set-nav { grid-row: 1 / span 2; }
}
@media (max-width: 899px) {
  .app-settings.mp-set-page { padding: 12px 16px 0; }
  .mp-set-wrap, .mp-set-page.has-preview .mp-set-wrap { display: flex; flex-direction: column; gap: 12px; }
  .app-settings.mp-set-page { min-width: 0; max-width: 100%; overflow-x: clip; }
  .mp-set-wrap > * { min-width: 0; max-width: 100%; }
  .mp-set-nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; position: static; gap: 6px; margin: 0 -16px; padding: 0 16px 2px; width: calc(100% + 32px); max-width: none; box-sizing: border-box; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .mp-set-nav::-webkit-scrollbar { display: none; }
  .mp-set-tab { width: auto; flex: none; white-space: nowrap; border: 1px solid var(--background-modifier-border); border-radius: 999px; padding: 6px 12px; min-height: 36px; }
  .mp-set-tab.is-active { border-color: transparent; }
  .mp-set-preview { position: sticky; top: calc(var(--top-h, 56px) + env(safe-area-inset-top)); z-index: 5; box-shadow: var(--shadow); padding: 8px 8px 6px; }
  .mp-set-pv { height: 280px; margin-bottom: 4px; }
  .mp-legend { padding-top: 6px; gap: 4px 10px; font-size: calc(12px * var(--mp-fs)); }
  .mp-set-cap { display: none; }
  .mp-set-row { flex-wrap: wrap; gap: 8px 16px; }
  .mp-set-row:has(.mp-seg) .mp-set-info, .mp-set-row:has(.mp-slider) .mp-set-info { flex: none; }
  .mp-set-row:has(.mp-seg) { flex-direction: column; align-items: stretch; }
  .mp-set-row:has(.mp-seg) .mp-set-ctl { justify-content: flex-start; }
  .mp-set-ctl .mp-seg { flex-wrap: wrap; }
  .mp-fonts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mp-accents .mp-swatch { width: 32px; height: 32px; }
  .mp-accents.is-small .mp-swatch { width: 28px; height: 28px; }
  .mp-seg button { min-height: 36px !important; }
  .mp-slider input[type=range] { width: 100%; flex: 1; }
  .mp-set-row:has(.mp-slider) { flex-direction: column; align-items: stretch; }
  .mp-set-row:has(.mp-slider) .mp-set-ctl { justify-content: stretch; }
  .mp-slider { width: 100%; }
}

/* ---------- Tappa 7: secondo account ---------- */
.app-login-forgot { align-self: center; background: transparent !important; border: none !important; box-shadow: none !important; color: var(--text-muted); font-size: 0.85em; padding: 4px 8px; text-decoration: underline; text-underline-offset: 3px; }
.app-login-forgot:hover { color: var(--interactive-accent); }
.app-login-tip { font-size: 0.85em; color: var(--text-muted); background: var(--mp-accent-soft); border-radius: 10px; padding: 9px 12px; text-align: left; line-height: 1.4; }
.app-login-foot { line-height: 1.4; }

.mp-welcome { max-width: 760px; margin: 12px auto 0; text-align: center; }
.mp-welcome-logo { width: 52px; height: 52px; }
.mp-welcome h2 { margin: 10px 0 4px; font-size: calc(22px * var(--mp-fs)); letter-spacing: -0.01em; }
.mp-welcome-sub { color: var(--text-muted); margin: 0 auto 20px; max-width: 520px; line-height: 1.45; }
.mp-welcome-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; text-align: left; }
.mp-welcome-step { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--background-modifier-border); border-radius: 10px; background: var(--background-secondary); }
.mp-welcome-h { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.mp-welcome-n { width: 22px; height: 22px; border-radius: 50%; background: var(--mp-accent-soft); color: var(--interactive-accent); display: inline-flex; align-items: center; justify-content: center; font-size: calc(12px * var(--mp-fs)); flex: none; }
.mp-welcome-ic { display: inline-flex; color: var(--text-muted); }
.mp-welcome-ic svg { width: 16px; height: 16px; }
.mp-welcome-text { color: var(--text-muted); font-size: calc(13.5px * var(--mp-fs)); line-height: 1.45; flex: 1; }
.mp-welcome-actions { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 899px) {
  .mp-welcome-steps { grid-template-columns: 1fr; }
}

.mp-script-guide { margin: 4px 0 12px; border: 1px solid var(--background-modifier-border); border-radius: 10px; padding: 10px 14px; background: var(--background-secondary); }
.mp-script-guide summary { cursor: pointer; font-weight: 600; }
.mp-script-guide ol { margin: 10px 0 8px; padding-left: 20px; color: var(--text-muted); font-size: calc(13.5px * var(--mp-fs)); line-height: 1.5; }
.mp-script-guide li { margin-bottom: 6px; }
.mp-script-actions { display: flex; flex-wrap: wrap; gap: 8px; }
input.mp-name-input { width: 220px; max-width: 100%; }
.mp-set-badge { font-size: calc(12px * var(--mp-fs)); padding: 3px 9px; border-radius: 20px; background: var(--mp-accent-soft); color: var(--interactive-accent); }
.mp-install-way { line-height: 1.45; }

/* Il badge "Powered by Netlify": Netlify permette di spegnerlo (Project configuration → General); qui è nascosto anche da codice */
#nl-badge-frame { display: none !important; pointer-events: none !important; }

/* iPhone: Safari ingrandisce la pagina se un campo ha il testo sotto i 16 px */
@media (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), textarea, select { font-size: max(16px, calc(16px * var(--mp-fs))) !important; }
}

/* --- Colore di ogni workflow (Blocco D, 0.12) ---
   Il colore del workflow arriva dalle variabili ridefinite sul suo contenitore ([data-wfc], vedi paintScope in app.js):
   qui ci sono solo le regole che mostrano il colore di ogni passaggio (striscia e fondo), non quelle del colore stesso. */
.mp-row .mp-dot, .mp-wk-meta .mp-dot { box-shadow: 0 0 0 2px color-mix(in srgb, var(--wf) 30%, transparent); }
.mp-row .mp-dot { width: 10px; height: 10px; }
.mp-wk-meta .mp-dot { width: 9px; height: 9px; }
/* Passaggi con data di oggi nel Pannello: contorno marcato come il giorno di oggi nella Settimana */
.mp-row.is-today {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--interactive-accent) 60%, transparent), inset 0 2px 0 var(--interactive-accent);
}
html.mp-wfc-on .mp-row[data-wfc], html.mp-wfc-on .mp-wk[data-wfc]:not(.is-done) { background: var(--mp-wft); }
html.mp-wfc-on .mp-row[data-wfc]:hover { background: color-mix(in srgb, var(--mp-wft) 70%, var(--background-modifier-hover)); }
html.mp-wfc-on .mp-row[data-wfc]::before { width: 4px; background: var(--mp-wfs); }
html.mp-wfc-on .mp-wk[data-wfc]::before { width: 4px; background: var(--mp-wfs); }
html.mp-wfc-on .mp-wf-head h1, html.mp-wfc-on .mp-sum-wf[data-wfc] .mp-sum-name { color: var(--interactive-accent); }
html.mp-wfc-on .mp-wf-head[data-wfc], html.mp-wfc-on .mp-page.is-diagram[data-wfc] .mp-wf-head { box-shadow: inset 0 3px 0 var(--interactive-accent); }
html.mp-wfc-on .mp-sum-wf[data-wfc] .mp-sum-title { border-top: 3px solid var(--interactive-accent); padding-top: 6px; }
/* Casella della Settimana */
.mp-wk-chk { position: relative; }
.mp-wk-chk::after { content: ""; position: absolute; inset: -6px; }
.mp-chk.is-on { background: var(--interactive-accent); border-color: var(--interactive-accent); color: var(--text-on-accent); }
.mp-chk.is-flag { border: 0; width: 18px; color: var(--text-muted); }
@media (max-width: 899px) {
  .mp-wk-chk { width: 22px; height: 22px; }
  .mp-wk-chk::after { inset: -10px; }
  .mp-wk-chk.is-call, .mp-wk-chk.is-decision, .mp-wk-chk.is-lock, .mp-wk-chk.is-flag, .mp-wk-chk.is-wait { width: 24px; }
}

/* --- Scarica PDF (0.15) ---
   #mp-print sta fuori dallo schermo (serve per misurare il diagramma) e in stampa è l'unica cosa che si vede.
   Sempre in tema chiaro: le variabili del tema chiaro sono copiate su #mp-print da app.js (lightThemeCss). */
#mp-print { position: absolute; left: -10000px; top: 0; width: 186mm; box-sizing: border-box; background: #fff; color: var(--text-normal); font-family: var(--mp-font-ui); font-size: 11px; line-height: 1.4; }
#mp-print.is-land { width: 273mm; }
#mp-print * { box-shadow: none !important; text-shadow: none !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
#mp-print .mp-n { cursor: default; }
#mp-print .mp-dia { overflow: visible; touch-action: auto; }
.mp-pr-head { margin-bottom: 10px; }
.mp-pr-title { display: flex; align-items: center; gap: 8px; }
.mp-pr-title h1 { margin: 0; font-size: 22px; line-height: 1.2; color: var(--interactive-accent); }
.mp-pr-sub { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; color: var(--text-muted); font-size: 11.5px; }
.mp-pr-tag { display: inline-flex; align-items: center; gap: 5px; }
.mp-pr-dia { margin: 6px 0 10px; }
.mp-pr-legend { display: grid; gap: 4px; break-inside: avoid; }
.mp-pr-list { break-before: page; page-break-before: always; }
.mp-pr-list h2 { margin: 0 0 8px; font-size: 17px; color: var(--interactive-accent); }
.mp-pr-step { break-inside: avoid; page-break-inside: avoid; border-top: 1px solid var(--background-modifier-border); padding: 7px 0; }
.mp-pr-top { display: flex; align-items: baseline; gap: 8px; color: var(--text-muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; }
.mp-pr-box { font-size: 14px; color: var(--text-normal); }
.mp-pr-urg { color: #b3261e; font-weight: 700; }
.mp-pr-text { font-size: 13px; font-weight: 600; margin: 1px 0 2px; }
.mp-pr-line { color: var(--text-normal); overflow-wrap: anywhere; }
.mp-pr-link { word-break: break-all; }
.mp-pr-details { margin-top: 3px; white-space: pre-wrap; color: var(--text-muted); overflow-wrap: anywhere; }
@media print {
  body > *:not(#mp-print) { display: none !important; }
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
  #mp-print { position: static; left: auto; width: auto; }
}

/* --- Gruppi dentro un workflow (Blocco F) --- */
.mp-grp {
  position: absolute; z-index: 0; box-sizing: border-box; pointer-events: none;
  border: 1.5px dashed var(--mp-border-strong); border-radius: 16px;
}
html.mp-wfc-on [data-wfc] .mp-grp, [data-wfc-force] .mp-grp {
  border-color: var(--mp-wfs);
  background: color-mix(in srgb, var(--mp-wfs) calc(2.5% * var(--mp-gk, 1)), transparent);
}
.mp-grp-name, .mp-grp-tg {
  position: absolute; z-index: 3; transform: translateY(-50%); margin: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  height: 22px; padding: 0 9px; border-radius: 11px; border: 1px solid var(--mp-border-strong);
  background: var(--background-page); color: var(--text-muted);
  font: 600 calc(12px * var(--mp-fs)) / 1 var(--font); box-shadow: none;
}
.mp-grp-name:hover, .mp-grp-tg:hover { color: var(--text-normal); border-color: var(--text-faint); }
.mp-grp-tg { width: 26px; padding: 0; justify-content: center; transform: translate(-100%, -50%); }
.mp-grp-tg .svg-icon, .mp-grp-more .svg-icon { width: 14px; height: 14px; }
.mp-grp-more { display: inline-flex; opacity: 0.8; }
html.mp-wfc-on [data-wfc] .mp-grp-name, [data-wfc-force] .mp-grp-name { color: var(--mp-wfs); border-color: var(--mp-wfs); }
html.mp-wfc-on [data-wfc] .mp-grp-tg, [data-wfc-force] .mp-grp-tg { color: var(--mp-wfs); border-color: var(--mp-wfs); }
.mp-plus.is-group { z-index: 4; }

/* Gruppi uno sotto l'altro (telefono, "Dove va?") */
.mp-stack { display: flex; flex-direction: column; gap: 22px; padding-bottom: 8px; }
.mp-stack > .mp-stack-common, .mp-stack > .mp-grp { position: relative; }
.mp-stack .mp-dia { overflow-x: auto; overflow-y: hidden; }
.mp-grp.is-stack { pointer-events: auto; padding: 18px 8px 8px; }
.mp-grp.is-stack .mp-grp-head { position: absolute; left: 0; right: 0; top: 0; height: 0; }
.mp-grp.is-stack .mp-grp-name { left: 12px; }
.mp-grp.is-stack .mp-grp-tg { left: auto; right: 12px; transform: translateY(-50%); }
.mp-grp-body { position: relative; }
.mp-grp-add {
  display: inline-flex; align-items: center; gap: 6px; margin: 8px 4px 0; padding: 6px 10px; cursor: pointer;
  border: 1px dashed var(--mp-border-strong); border-radius: 8px; background: transparent; color: var(--text-muted);
  font: 500 calc(12px * var(--mp-fs)) / 1.2 var(--font);
}
.mp-xchip {
  position: absolute; z-index: 2; height: 18px; padding: 0 6px; margin: 0; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--background-modifier-hover); color: var(--text-muted); text-align: left; box-shadow: none;
  font: 500 calc(11px * var(--mp-fs)) / 18px var(--font); overflow: hidden;
}
.mp-xchip-t { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Il mazzo (gruppo chiuso): una scheda tutta colorata con due schede dietro */
.mp-deck { position: absolute; z-index: 2; box-sizing: border-box; padding: 0 10px 10px 0; cursor: pointer; outline: none; text-align: left; }
.mp-deck.is-flow { position: relative; width: calc(220px * var(--mp-fs) + 10px); max-width: 100%; }
.mp-deck-b { position: absolute; border-radius: 14px; border: 1.5px solid var(--mp-border-strong); background: var(--background-primary); }
.mp-deck-b1 { left: 5px; top: 5px; right: 5px; bottom: 5px; }
.mp-deck-b2 { left: 10px; top: 10px; right: 0; bottom: 0; opacity: 0.8; }
html.mp-wfc-on [data-wfc] .mp-deck-b, [data-wfc-force] .mp-deck-b { border-color: var(--mp-wfs); }
.mp-deck-front {
  position: relative; z-index: 1; border-radius: 14px; padding: 11px 13px 12px;
  background: var(--interactive-accent); color: var(--text-on-accent); border: 1.5px solid var(--interactive-accent);
  display: flex; flex-direction: column; gap: 4px;
}
.mp-deck:hover .mp-deck-front, .mp-deck:focus-visible .mp-deck-front { background: var(--interactive-accent-hover); }
.mp-deck-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.mp-deck-name { font-weight: 700; font-size: calc(15px * var(--mp-fs)); line-height: 1.25; overflow-wrap: anywhere; min-width: 0; }
.mp-deck-ic .svg-icon { width: 16px; height: 16px; }
.mp-deck-sub, .mp-deck-next { font-size: calc(12.5px * var(--mp-fs)); line-height: 1.3; }
.mp-deck-next { opacity: 0.85; }
.mp-deck-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.mp-deck-urg, .mp-deck-late { padding: 1px 6px; border-radius: 6px; font-size: calc(11.5px * var(--mp-fs)); font-weight: 600; line-height: 1.4; }
.mp-deck-urg { background: var(--mp-urgent); color: #fff; }
.mp-deck-late { background: rgba(0, 0, 0, 0.22); color: inherit; }
.mp-deck-more {
  position: absolute; z-index: 3; right: 16px; bottom: 16px; width: 24px; height: 24px; padding: 0; margin: 0;
  display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; cursor: pointer;
  background: rgba(0, 0, 0, 0.18); color: inherit; box-shadow: none;
}
.mp-dia.is-compact .mp-deck-name { font-size: calc(13.5px * var(--mp-fs)); }
.mp-dia.is-compact .mp-deck-front { padding: 8px 10px 9px; }
.mp-dia.is-edit .mp-n.is-dragging { z-index: 6; }
.mp-pr-group { break-after: avoid; page-break-after: avoid; margin: 14px 0 2px; font-size: 13px; font-weight: 700; border-bottom: 2px solid currentColor; padding-bottom: 3px; }
.mp-grp-pick { display: flex; flex-direction: column; gap: 6px; }
.mp-grp-pick-it { text-align: left; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--background-modifier-border); background: var(--background-primary); color: var(--text-normal); cursor: pointer; font: 500 14px/1.2 var(--font); }
.mp-grp-pick-it.is-on { border-color: var(--interactive-accent); box-shadow: inset 0 0 0 1px var(--interactive-accent); }

/* --- Oggi (0.17): la giornata come una coda --- */
.mp-today-date { color: var(--text-muted); font-size: calc(13px * var(--mp-fs)); }
.mp-today { max-width: 760px; }
.mp-td-add {
  display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; padding: 0 12px;
  border: 1px dashed var(--mp-border-strong); border-radius: var(--mp-radius); background: transparent;
}
.mp-td-add:focus-within { border-style: solid; border-color: var(--interactive-accent); }
.mp-td-add-ic { color: var(--text-faint); display: inline-flex; }
.mp-td-add-ic .svg-icon { width: 16px; height: 16px; }
.mp-td-add input {
  flex: 1; min-width: 0; height: 42px; border: 0; background: transparent; color: var(--text-normal);
  font: 400 calc(14px * var(--mp-fs)) / 1.3 var(--font); outline: none; padding: 0;
}
.mp-td-add input::placeholder { color: var(--text-faint); }
.mp-td-info { display: flex; align-items: center; gap: 6px; margin: -4px 0 10px; color: var(--text-muted); font-size: calc(12.5px * var(--mp-fs)); }
.mp-td-info-ic { display: inline-flex; color: var(--interactive-accent); }
.mp-td-info-ic .svg-icon { width: 14px; height: 14px; }
.mp-td-list { display: flex; flex-direction: column; gap: 6px; }
.mp-td {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 8px 6px 8px 12px; border-radius: var(--mp-radius); background: var(--background-primary);
  border: 1px solid var(--background-modifier-border); -webkit-touch-callout: none;
}
.mp-td.is-step::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--wf); }
.mp-td.is-urgent { border-color: color-mix(in srgb, var(--text-error) 55%, transparent); }
.mp-td.is-drag { cursor: grab; }
.mp-td.is-dragging { opacity: 0.45; }
.mp-td.is-drop-before { box-shadow: 0 -2px 0 0 var(--interactive-accent); }
.mp-td.is-drop-after { box-shadow: 0 2px 0 0 var(--interactive-accent); }
.mp-td-time { display: none; flex: none; width: 40px; flex-direction: column; align-items: flex-end; font-size: calc(12.5px * var(--mp-fs)); line-height: 1.25; color: var(--text-normal); }
.mp-td-list.has-times .mp-td-time { display: flex; }
.mp-td-to { color: var(--text-faint); font-size: calc(11.5px * var(--mp-fs)); }
.mp-td.is-fixed .mp-td-from { color: var(--interactive-accent); font-weight: 600; }
.mp-td.is-past .mp-td-from { color: var(--text-faint); font-weight: 400; }
.mp-td.is-past .mp-td-text { color: var(--text-muted); }
.mp-td-ck { display: inline-flex; flex: none; }
.mp-td-dur, .mp-td-more { flex: none; }
.mp-td-body { flex: 1; min-width: 0; }
.mp-td-body.is-link { cursor: pointer; }
.mp-td-body.is-link:hover .mp-td-text { text-decoration: underline; text-decoration-color: var(--text-faint); }
.mp-td-text { color: var(--text-normal); font-size: calc(14px * var(--mp-fs)); line-height: 1.35; overflow-wrap: anywhere; }
.mp-td-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 2px; color: var(--text-muted); font-size: calc(12px * var(--mp-fs)); }
.mp-td-wf { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.mp-td-late { color: var(--text-error); }
.mp-td-carried { color: var(--mp-wait); }
.mp-td-dur {
  min-height: 0; height: 28px; padding: 0 8px; border-radius: 14px; border: 1px solid transparent; background: transparent;
  color: var(--text-faint); font-size: calc(12px * var(--mp-fs)); display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap;
}
.mp-td-dur .svg-icon { width: 14px; height: 14px; }
.mp-td-dur.is-set { color: var(--text-muted); border-color: var(--background-modifier-border); }
.mp-td-dur:hover { color: var(--text-normal); border-color: var(--mp-border-strong); }
.mp-td-more { width: 28px; height: 28px; }
.mp-td.is-done { background: transparent; }
.mp-td.is-done .mp-td-text { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--text-faint); }
.mp-td-done { margin-top: 22px; }
.mp-td-done .mp-sec-title { margin: 0 0 8px; color: var(--text-muted); font-size: calc(12.5px * var(--mp-fs)); font-weight: 600; }
.mp-td-empty { padding: 18px 0; }
@media (max-width: 899px) {
  .mp-td { gap: 8px; padding: 10px 4px 10px 12px; }
  .mp-td-dur { height: 32px; }
  .mp-td-more { width: 36px; height: 36px; }
  .mp-today-date { width: 100%; order: 3; }
}
