:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-3: #f1f2f4;
  --border: #e8e8eb;
  --border-mid: #dedee2;
  --border-strong: #c8c8cf;
  --text: #15151a;
  --text-muted: #5e6068;
  --text-faint: #8a8c93;
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --accent-soft: #dce8ff;
  --danger: #c92a2a;
  --danger-soft: #fde8e8;
  --weekend-bg: #f7f1f1;
  --weekend-text: #a01919;
  --today: #c2410c;
  --today-soft: #fff4ec;
  --today-line: #ea580c;
  --shadow-xs: 0 1px 1px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 6px 14px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 56px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
  --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.22);

  --sidebar-w: 142px;
  --head-h: 40px;
  --day-num-h: 24px;
  --lane-h: 24px;
  --lane-gap: 3px;
  --row-pad: 3px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
  /* Blocca il rubber-band scroll su iOS PWA (dito che "tira" lascia spazio bianco). */
  overscroll-behavior: none;
  /* Blocca il double-tap-to-zoom su iOS. Per il pinch-zoom serve l'event listener JS sotto. */
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  /* 100dvh = dynamic viewport height: rispetta safe-area iOS senza overflow */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  /* Impedisce il body di scrollare quando si raggiunge limite del gantt */
  position: fixed;
  inset: 0;
  width: 100%;
}

/* Il gantt è l'unica area scrollabile; il contain blocca la propagazione dello scroll al body */
.gantt {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ===================== APP MODE / LANDING TOGGLE ===================== */

.landing { display: none; }
.mode-landing .landing { display: flex; }
.mode-landing .app-header,
.mode-landing main.gantt,
.mode-landing footer.status-bar { display: none !important; }
.mode-app .landing { display: none !important; }

/* ===================== LANDING ===================== */

.landing {
  position: fixed;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  padding-top: max(32px, env(safe-area-inset-top));
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 25% 15%, rgba(59, 130, 246, 0.10), transparent 55%),
    radial-gradient(circle at 80% 85%, rgba(6, 182, 212, 0.10), transparent 50%),
    #ffffff;
  z-index: 40;
  overflow-y: auto;
}

.landing-inner {
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.landing-icon {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 16px 40px rgba(59, 130, 246, 0.30),
    0 2px 6px rgba(59, 130, 246, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.landing-icon svg { width: 56px; height: 56px; display: block; }

.landing-title {
  font-size: 42px;
  font-weight: 800;
  margin: 0 0 16px;
  letter-spacing: -0.035em;
  color: var(--text);
  line-height: 1.04;
}

.landing-subtitle {
  font-size: 17px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 auto 36px;
  letter-spacing: -0.005em;
  max-width: 30ch;
}

.landing-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  padding: 17px 28px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, #4f8df9 0%, #2563eb 100%);
  color: white;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.012em;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 0 0 1px rgba(37, 99, 235, 0.85),
    0 10px 24px -6px rgba(37, 99, 235, 0.45),
    0 4px 8px -2px rgba(37, 99, 235, 0.25);
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
  min-height: 56px;
}

.landing-cta:hover {
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.24) inset,
    0 0 0 1px rgba(37, 99, 235, 0.9),
    0 16px 32px -8px rgba(37, 99, 235, 0.55),
    0 6px 12px -3px rgba(37, 99, 235, 0.30);
}

.landing-cta:active {
  transform: translateY(0);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 0 0 1px rgba(37, 99, 235, 0.85),
    0 6px 14px -4px rgba(37, 99, 235, 0.40);
}

.landing-cta:focus-visible {
  outline: none;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 0 0 1px rgba(37, 99, 235, 0.85),
    0 0 0 4px rgba(59, 130, 246, 0.30),
    0 10px 24px -6px rgba(37, 99, 235, 0.45);
}

.landing-cta svg { width: 20px; height: 20px; flex-shrink: 0; }

/* App-lock overlay: bloccante quando la PWA è installata ma non sbloccata */
.app-lock {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  padding-top: max(32px, env(safe-area-inset-top));
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  background: var(--surface);
  z-index: 500;
}

/* Visibile SOLO in mode-app E quando .is-locked è sul <html>. */
html.mode-app.is-locked .app-lock { display: flex; }
html.mode-app.is-locked .app-header,
html.mode-app.is-locked main.gantt,
html.mode-app.is-locked footer.status-bar,
html.mode-app.is-locked .clipboard-banner {
  display: none !important;
}

.app-lock-inner {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.app-lock-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 22px;
  border-radius: 14px;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.app-lock-icon svg { width: 26px; height: 26px; display: block; }

.app-lock-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.025em;
  color: var(--text);
}

.app-lock-subtitle {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 24px;
}

/* Gate password sulla landing */
.landing-gate {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  text-align: left;
}

.landing-gate[hidden] { display: none; }

.landing-gate-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}

.landing-gate-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.landing-gate-input {
  flex: 1;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  font: inherit;
  /* 16px = soglia iOS sotto la quale Safari fa auto-zoom al focus. Tenuto >= 16. */
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.14s ease-out, box-shadow 0.14s ease-out, background-color 0.14s ease-out;
}

.landing-gate-input::placeholder { color: var(--text-faint); }

.landing-gate-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.landing-gate-btn {
  padding: 13px 18px;
  border-radius: 10px;
  border: 1px solid var(--accent-strong);
  background: linear-gradient(180deg, #4f8df9 0%, var(--accent) 100%);
  color: white;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.20) inset,
    0 1px 2px rgba(37, 99, 235, 0.30);
  transition: background 0.14s ease-out;
}

.landing-gate-btn:hover {
  background: linear-gradient(180deg, #4280f7 0%, var(--accent-strong) 100%);
}

.landing-gate-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.landing-gate-error {
  margin: 10px 0 0;
  padding: 8px 12px;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

.landing-platforms {
  font-size: 13px;
  color: var(--text-faint);
  margin: 28px 0 0;
  letter-spacing: 0.02em;
}

/* Link secondario "Continua nel browser" */
.landing-secondary {
  display: inline-block;
  margin: 22px 0 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 6px;
  transition: color 0.14s ease-out, text-decoration-color 0.14s ease-out;
}
.landing-secondary:hover {
  color: var(--text);
  text-decoration-color: var(--text);
}
.landing-secondary:focus-visible {
  outline: none;
  color: var(--text);
  box-shadow: var(--focus-ring);
}

.landing-status {
  margin: 18px 0 0;
  padding: 10px 14px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
}

/* ===================== INSTALL MODAL ===================== */

.install-modal { max-width: 440px; }
.install-modal-body { padding: 16px 20px 4px; }

.install-modal-intro {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}
.install-modal-intro:empty { display: none; }

.install-modal-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.install-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.install-step-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.install-step-icon svg { width: 20px; height: 20px; display: block; }

.install-step-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  padding-top: 7px;
}

.install-step-num {
  display: inline-block;
  min-width: 18px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 1px 6px;
  margin-right: 8px;
  vertical-align: 1px;
  font-variant-numeric: tabular-nums;
}

.install-step-text strong { font-weight: 600; }

/* ===================== HEADER ===================== */

.app-header {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 12px 22px;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-left: max(22px, env(safe-area-inset-left));
  padding-right: max(22px, env(safe-area-inset-right));
  background: var(--surface);
  border-bottom: 1px solid var(--border-mid);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 18px; height: 18px; display: block; }

.app-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.018em;
}

.year-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-3);
  border-radius: 11px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.year-display {
  font-size: 19px;
  font-weight: 700;
  min-width: 66px;
  text-align: center;
  letter-spacing: -0.028em;
  font-variant-numeric: tabular-nums lining-nums;
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.14s ease-out, border-color 0.14s ease-out;
}

.year-display:hover { background: var(--surface); border-color: var(--border-mid); box-shadow: var(--shadow-xs); }
.year-display:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.year-display-input {
  width: 80px;
  padding: 4px 8px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  -moz-appearance: textfield;
  appearance: textfield;
}
.year-display-input::-webkit-outer-spin-button,
.year-display-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.year-nav .btn { padding: 6px 12px; font-size: 13px; }

.actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search {
  width: 220px;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border-mid);
  border-radius: 9px;
  background: var(--surface-2) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235e6068' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.3-4.3'/></svg>") 11px center no-repeat;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.14s ease-out, box-shadow 0.14s ease-out, background-color 0.14s ease-out;
}
.search::placeholder { color: var(--text-faint); }
.search:hover { border-color: var(--border-strong); }
.search:focus {
  background-color: var(--surface);
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* ===================== BUTTONS ===================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-mid);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background 0.14s ease-out, border-color 0.14s ease-out,
              transform 0.06s ease-out, box-shadow 0.14s ease-out;
}

.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(0.5px); }
.btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }

.btn-primary {
  background: linear-gradient(180deg, #4f8df9 0%, var(--accent) 100%);
  color: white;
  border-color: var(--accent-strong);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 1px 2px rgba(37, 99, 235, 0.30),
    0 1px 3px rgba(37, 99, 235, 0.18);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #4280f7 0%, var(--accent-strong) 100%);
  border-color: var(--accent-strong);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 2px 6px rgba(37, 99, 235, 0.32),
    0 1px 3px rgba(37, 99, 235, 0.20);
}

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }

.btn-danger { color: var(--danger); background: transparent; border-color: transparent; }
.btn-danger:hover { background: var(--danger-soft); }

.btn-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  transition: background 0.14s ease-out, color 0.14s ease-out;
}
.btn-icon:hover { background: var(--surface); color: var(--text); }
.btn-icon:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }

/* ===================== GRID ===================== */

.gantt {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--surface);
  position: relative;
}

.grid-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
}

.head-corner {
  flex: 0 0 var(--sidebar-w);
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  border-right: 1px solid var(--border-mid);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 16px;
  height: var(--head-h);
}

.head-corner .corner-year {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.028em;
  color: var(--text);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1;
}

.head-corner .corner-sub {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-top: 2px;
}

.head-days {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  height: var(--head-h);
}

.head-days > div {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  min-width: 0;
}
.head-days > div:last-child { border-right: none; }
.head-days .weekend { color: var(--weekend-text); background: var(--weekend-bg); }

.grid-body { position: relative; }

.week-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.week-row:hover .week-label { background: var(--surface-2); }

.week-label {
  flex: 0 0 var(--sidebar-w);
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  border-right: 1px solid var(--border-mid);
  padding: 6px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  transition: background 0.12s;
  cursor: default;
}

.week-label .week-range {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.013em;
  font-variant-numeric: tabular-nums lining-nums;
}

.week-label .week-num {
  font-size: 10px;
  color: var(--text-faint);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.week-days {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  position: relative;
  min-height: calc(var(--day-num-h) + var(--lane-h) * var(--lanes, 1) + var(--row-pad) * 2);
}

.day-cell {
  position: relative;
  border-right: 1px solid var(--border);
  min-width: 0;
  cursor: pointer;
  transition: background 0.14s ease-out;
}
.day-cell:last-child { border-right: none; }
.day-cell.weekend { background: var(--weekend-bg); }
.day-cell.off-year {
  background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(0,0,0,0.025) 5px 6px);
  cursor: default;
}
.day-cell:hover:not(.off-year) { background: var(--surface-3); }
.day-cell.weekend:hover:not(.off-year) { background: #f0e6e6; }

.day-cell:hover:not(.off-year):not([data-covered])::after {
  content: "+";
  position: absolute;
  top: 3px;
  right: 5px;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  font-weight: 300;
  color: var(--text-faint);
  pointer-events: none;
  opacity: 0;
  animation: dayCellPlusFade 0.18s ease-out forwards;
}

@keyframes dayCellPlusFade {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 0.65; transform: translateY(0); }
}

.day-cell.today { background: var(--today-soft); }
.day-cell.today::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1.5px var(--today-line);
  z-index: 6;
}

.day-cell .day-num {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--day-num-h);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.015em;
  pointer-events: none;
}
.day-cell.today .day-num { color: var(--today); font-weight: 800; }
.day-cell.off-year .day-num { color: var(--text-faint); opacity: 0.5; }

.day-cell .month-tag {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  text-transform: uppercase;
  pointer-events: none;
}

/* Bars: absolutely positioned over the day-cells grid */
.bar {
  position: absolute;
  height: calc(var(--lane-h) - 4px);
  border-radius: 5px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y;
  z-index: 3;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.14) inset,
    0 1px 2px rgba(0, 0, 0, 0.14),
    0 0 0 0.5px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
              filter 0.18s ease-out;
  letter-spacing: -0.012em;
}

.bar:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.20) inset,
    0 4px 10px rgba(0, 0, 0, 0.18),
    0 1px 3px rgba(0, 0, 0, 0.10);
  z-index: 7;
}
.bar:active { transform: translateY(0); filter: brightness(0.96); cursor: grabbing; }
.bar:focus-visible {
  outline: none;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.20) inset,
    0 0 0 2px rgba(255, 255, 255, 0.9),
    0 0 0 4px var(--accent);
  z-index: 8;
}

.bar.is-dragging {
  opacity: 0.28;
  transition: opacity 0.14s ease-out;
}

.bar.is-flashing {
  animation: barFlash 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes barFlash {
  0% { box-shadow: 0 0 0 0 rgba(15, 23, 42, 0), 0 1px 2px rgba(0, 0, 0, 0.14); }
  20% { box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.8), 0 6px 14px rgba(0, 0, 0, 0.22); transform: translateY(-1px); }
  100% { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.14) inset, 0 1px 2px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.04); transform: translateY(0); }
}

body.is-dragging {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  touch-action: none;
}
body.is-dragging .tooltip { display: none !important; }
body.is-dragging .bar { transition: none; }

.day-cell.is-drop-target {
  background: rgba(59, 130, 246, 0.12);
  box-shadow: inset 0 0 0 1.5px rgba(59, 130, 246, 0.35);
}
.day-cell.weekend.is-drop-target {
  background: rgba(59, 130, 246, 0.16);
}

.drag-shadow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  will-change: transform;
}

.drag-shadow .bar-clone {
  position: fixed;
  border-radius: 5px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: -0.012em;
  filter: brightness(1.04) saturate(1.05);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 14px 28px rgba(15, 23, 42, 0.30),
    0 4px 10px rgba(15, 23, 42, 0.18),
    0 0 0 0.5px rgba(0, 0, 0, 0.10);
}

.drag-shadow .bar-clone .bar-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.drag-target-label {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  background: var(--text);
  color: var(--surface);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.008em;
  font-variant-numeric: tabular-nums lining-nums;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.30),
    0 4px 10px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
}

.bar.cont-from-prev {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding-left: 4px;
}
.bar.cont-to-next {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-right: 4px;
}
.bar.cont-from-prev::before {
  content: "";
  width: 0; height: 0; flex-shrink: 0;
  border: 5px solid transparent;
  border-right-color: currentColor;
  opacity: 0.45;
  margin-right: 3px;
}
.bar.cont-to-next::after {
  content: "";
  width: 0; height: 0; flex-shrink: 0;
  border: 5px solid transparent;
  border-left-color: currentColor;
  opacity: 0.45;
  margin-left: 3px;
}

.bar-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.bar.is-short .bar-name { display: none; }
.bar.is-short {
  padding: 0;
  justify-content: center;
}
.bar.is-short::after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.10);
}

.bar .note-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 1;
  flex-shrink: 0;
  margin-left: 6px;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.55), 0 0 0 2px rgba(0, 0, 0, 0.08);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 120px 20px 80px;
  text-align: center;
}

.empty-state .empty-illus {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
  color: var(--accent-strong);
  font-size: 26px;
  font-weight: 300;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.empty-state .empty-illus::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, transparent calc(33.33% - 0.5px), var(--border) calc(33.33% - 0.5px) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px)),
    linear-gradient(to right, transparent calc(66.66% - 0.5px), var(--border) calc(66.66% - 0.5px) calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px)),
    linear-gradient(to bottom, transparent calc(50% - 0.5px), var(--border) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px));
  opacity: 0.7;
}

.empty-state .empty-illus > span {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 26px;
  background: var(--surface);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px var(--surface);
  line-height: 1;
}

.empty-state h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.022em;
}

.empty-state p {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--text-muted);
  max-width: 42ch;
  line-height: 1.55;
}

/* ===================== CLIPBOARD BANNER ===================== */

.clipboard-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 22px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-bottom: 1px solid rgba(37, 99, 235, 0.18);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  animation: bannerSlide 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes bannerSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.clipboard-banner[hidden] { display: none; }

.clipboard-banner .cb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent-strong);
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.18);
}
.clipboard-banner .cb-icon svg { width: 13px; height: 13px; }

.clipboard-banner .cb-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.10);
}

.clipboard-banner .cb-name {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.clipboard-banner .cb-hint {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--accent-strong);
  opacity: 0.85;
  font-weight: 500;
}

.clipboard-banner .cb-close {
  background: transparent;
  border: none;
  color: var(--accent-strong);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.14s ease-out;
}
.clipboard-banner .cb-close:hover { background: rgba(37, 99, 235, 0.10); }
.clipboard-banner .cb-close:focus-visible {
  outline: none;
  background: rgba(37, 99, 235, 0.12);
  box-shadow: var(--focus-ring);
}

body.has-clipboard .day-cell:hover:not(.off-year):not([data-covered])::after {
  content: "Incolla";
  width: auto;
  height: 14px;
  padding: 0 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 4px;
  top: 4px;
}

/* Banner "Sposta" — variante ambra per distinguere a colpo d'occhio dalla copia */
.clipboard-banner.is-moving {
  background: #fef3c7;
  color: #92400e;
  border-bottom-color: rgba(180, 83, 9, 0.22);
}
.clipboard-banner.is-moving .cb-icon {
  background: #ffffff;
  color: #b45309;
  box-shadow: 0 0 0 1px rgba(180, 83, 9, 0.22);
}
.clipboard-banner.is-moving .cb-hint { color: #92400e; opacity: 0.85; }
.clipboard-banner.is-moving .cb-close { color: #92400e; }
.clipboard-banner.is-moving .cb-close:hover { background: rgba(180, 83, 9, 0.10); }

body.is-moving .day-cell:hover:not(.off-year)::after {
  content: "Sposta qui";
  width: auto;
  height: 14px;
  padding: 0 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #92400e;
  background: #fef3c7;
  border-radius: 4px;
  top: 4px;
}

/* Job in fase di spostamento: tutte le barre sfumate, il calendario passa in primo piano */
body.is-moving .bar { opacity: 0.45; transition: opacity 0.15s ease-out; }

@media (max-width: 767px) {
  .clipboard-banner { padding: 7px 12px; font-size: 12px; }
  .clipboard-banner .cb-hint { display: none; }
}

/* ===================== STATUS BAR ===================== */

.status-bar {
  flex-shrink: 0;
  padding: 9px 22px;
  padding-bottom: max(9px, env(safe-area-inset-bottom));
  padding-left: max(22px, env(safe-area-inset-left));
  padding-right: max(22px, env(safe-area-inset-right));
  background: var(--surface);
  border-top: 1px solid var(--border-mid);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-bar strong { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums lining-nums; }
.status-bar .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: var(--surface-3);
  border-radius: 999px;
  font-size: 11.5px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.status-bar .pill:first-child {
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}
.status-bar .pill:first-child strong { color: var(--accent-strong); }

.status-bar .hint { margin-left: auto; opacity: 0.75; font-size: 11.5px; }

/* ===================== MODALS ===================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  backdrop-filter: blur(4px) saturate(1.1);
  -webkit-backdrop-filter: blur(4px) saturate(1.1);
  animation: fadeIn 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-backdrop[hidden] { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  overflow: hidden;
  animation: modalIn 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-sm { max-width: 420px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  flex: 1;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.022em;
}

.modal form {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.field input[type="text"],
.field input[type="date"],
.field input[type="number"],
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.field textarea {
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
  min-height: 110px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}

.field-inline input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.field-hint {
  margin: -4px 0 0;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 7px;
  border: 1px solid var(--border);
  min-height: 16px;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.005em;
}
.field-hint:empty { display: none; }

.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.18s ease-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.color-swatch:hover { transform: scale(1.12); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18), inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.color-swatch:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.color-swatch.is-selected {
  border-color: var(--text);
  transform: scale(1.06);
}

.color-swatch.is-selected::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  border: 2px solid white;
}

.color-custom-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  padding-left: 4px;
  border-left: 1px solid var(--border-mid);
  margin-left: 4px;
}

.color-custom-wrap input[type="color"] {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  margin: 4px -20px -18px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.modal-footer .spacer { flex: 1; }

.note-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 13px;
}

.note-meta .meta-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.note-meta .meta-text {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
  gap: 1px;
}

.note-meta .meta-text strong { color: var(--text); font-weight: 600; }
.note-meta .meta-text .meta-date { color: var(--text-muted); font-size: 12px; }

.note-edit-job {
  align-self: flex-start;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--accent-strong);
  font-weight: 600;
}

.note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0 0 2px;
}

/* ===================== TOOLTIP ===================== */

.tooltip {
  position: fixed;
  background: #15151a;
  color: #f5f5f7;
  padding: 10px 13px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.45;
  max-width: 300px;
  z-index: 200;
  pointer-events: none;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 12px 32px rgba(0, 0, 0, 0.30),
    0 4px 10px rgba(0, 0, 0, 0.18);
  white-space: pre-wrap;
  letter-spacing: -0.005em;
}

.tooltip[hidden] { display: none; }
.tooltip .tt-title { font-weight: 700; font-size: 12.5px; letter-spacing: -0.012em; }
.tooltip .tt-sub { color: #b3b3bb; font-size: 11px; margin-top: 3px; font-variant-numeric: tabular-nums lining-nums; }
.tooltip .tt-day { color: #f59e0b; font-size: 11px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums lining-nums; letter-spacing: 0.005em; }
.tooltip .tt-note {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  color: #d4d4d8;
  font-size: 11.5px;
}

/* ===================== RESPONSIVE / MOBILE ===================== */

.dow-short { display: none; }
.btn-icon-only { display: none; line-height: 1; }

@media (max-width: 1023px) {
  :root { --sidebar-w: 110px; }
  .app-header { gap: 14px; padding: 10px 16px; }
  .brand { min-width: 0; }
  .search { width: 160px; }
  .week-label { padding: 5px 12px; }
  .week-label .week-range { font-size: 12px; }
}

@media (max-width: 767px) {
  :root {
    --sidebar-w: 66px;
    --head-h: 36px;
    --day-num-h: 22px;
    --lane-h: 28px;
    --lane-gap: 4px;
    --row-pad: 3px;
  }

  .app-header {
    padding: 8px 10px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    gap: 8px;
    flex-wrap: nowrap;
  }
  .brand-mark { width: 24px; height: 24px; }
  .brand-mark::after { inset: 6px; }
  .app-title { display: none; }

  .year-nav { padding: 2px; gap: 2px; flex-shrink: 0; }
  .year-display { font-size: 16px; min-width: 50px; }
  .year-nav .btn-icon { width: 28px; height: 28px; font-size: 15px; }
  .year-nav .btn[data-action="today"] {
    padding: 4px 8px;
    font-size: 12px;
  }

  .actions { gap: 4px; }
  .actions .search { display: none; }

  .btn-print .btn-label,
  [data-action="new-job"] .btn-label { display: none; }
  .btn-print .btn-icon-only,
  [data-action="new-job"] .btn-icon-only { display: inline; font-size: 18px; }
  .btn-print {
    padding: 8px 10px;
    color: var(--text-muted);
    font-size: 17px;
  }
  [data-action="new-job"] {
    padding: 8px 12px;
    font-size: 20px;
    font-weight: 400;
    min-width: 40px;
    min-height: 40px;
  }

  .dow-full { display: none; }
  .dow-short { display: inline; font-size: 12px; }
  .head-days > div { font-size: 12px; letter-spacing: 0; }

  .head-corner { padding: 0 8px; }
  .head-corner .corner-year { font-size: 13px; }
  .head-corner .corner-sub { display: none; }

  .week-label { padding: 4px 8px; }
  .week-label .week-range { font-size: 11px; line-height: 1.25; white-space: normal; letter-spacing: -0.018em; }
  .week-label .week-num { display: none; }

  .day-cell .day-num { font-size: 11px; }
  .day-cell .month-tag { font-size: 7.5px; left: 3px; top: 3px; }

  .bar {
    font-size: 11.5px;
    height: calc(var(--lane-h) - 4px);
    padding: 0 6px;
    border-radius: 4px;
  }
  .bar.cont-from-prev,
  .bar.cont-to-next { padding-left: 3px; padding-right: 3px; }

  .status-bar {
    padding: 6px 10px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    gap: 8px;
    font-size: 11px;
  }
  .status-bar .hint { display: none; }
  .status-bar .pill { padding: 1px 7px; font-size: 11px; }

  .tooltip { display: none !important; }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
    background: rgba(15, 23, 42, 0.55);
  }
  .modal {
    max-width: 100% !important;
    width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
    overflow-y: auto;
    animation: sheetUp 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .modal-header { padding: 14px 18px; }
  .modal form { padding: 16px 18px; }
  .modal-footer {
    position: sticky;
    bottom: 0;
    margin: 4px -18px -16px;
    padding: 12px 18px;
  }
  .modal-footer .btn { min-height: 40px; padding: 9px 14px; }

  .field input[type="text"],
  .field input[type="date"],
  .field input[type="number"],
  .field textarea {
    padding: 11px 12px;
    font-size: 15px;
  }
  .field textarea { min-height: 120px; }

  .color-swatch { width: 32px; height: 32px; }
  .color-custom-wrap input[type="color"] { width: 32px; height: 32px; }
}

@media (max-width: 380px) {
  :root { --sidebar-w: 62px; }
  .day-cell .day-num { font-size: 10.5px; }
  .head-days > div { font-size: 11px; }
  .week-label .week-range { font-size: 10.5px; letter-spacing: -0.018em; }
  .week-label { padding: 4px 6px; }
  .bar { font-size: 11px; padding: 0 5px; }
}

/* ===================== REDUCED MOTION ===================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .bar.is-flashing { animation: none; }
  .day-cell:hover:not(.off-year):not([data-covered])::after { animation: none; opacity: 0.65; }
}

/* ===================== PRINT ===================== */

@media print {
  @page { size: A4 landscape; margin: 6mm; }

  /* Override anti-rubber-band: il body è position:fixed nel runtime, in stampa va sbloccato */
  html, body {
    height: auto !important;
    overflow: visible !important;
    background: white;
    color: #15151a;
    position: static !important;
    inset: auto !important;
    width: auto !important;
  }
  body { display: block; }
  .no-print { display: none !important; }

  /* Mai stampare gli overlay anche se per qualche motivo finissero visibili */
  .landing, .app-lock, .modal-backdrop, .clipboard-banner { display: none !important; }

  .gantt { overflow: visible !important; height: auto !important; background: white; }

  /* sticky non si comporta bene su pagine multiple di stampa: forziamo static */
  .grid-head { position: static !important; }
  .head-corner, .week-label { position: static !important; }

  :root {
    --sidebar-w: 92px;
    --head-h: 22px;
    --day-num-h: 14px;
    --lane-h: 14px;
    --lane-gap: 2px;
    --row-pad: 1px;
    --weekend-bg: #f5efee;
    --today-soft: #fff4ec;
    --today-line: #c2410c;
    --border: #c4c4c8;
    --border-mid: #a8a8ac;
  }

  .week-label .week-range { font-size: 9.5px; font-weight: 700; }
  .week-label .week-num { font-size: 7.5px; color: #6a6a70; }
  .day-cell .day-num { font-size: 9.5px; font-weight: 600; color: #15151a; }
  .day-cell.weekend .day-num { color: #a01919; }
  .day-cell.today .day-num { color: #c2410c; font-weight: 800; }
  .day-cell .month-tag { font-size: 7px; font-weight: 800; color: #15151a; }
  .head-days > div { font-size: 9px; color: #15151a; font-weight: 700; }
  .head-days .weekend { color: #a01919; }
  .head-corner .corner-year { font-size: 11.5px; font-weight: 800; }
  .head-corner .corner-sub { font-size: 7px; }

  .grid-head { border-bottom: 1px solid #15151a; }
  .head-corner { border-right: 1px solid #15151a; background: white; }
  .week-label { padding: 2px 8px; background: white; border-right: 1px solid #15151a; }
  .day-cell { border-right: 0.5px solid var(--border); }
  .week-row { border-bottom: 0.5px solid var(--border); }
  .day-cell.today::before { box-shadow: inset 0 0 0 1px var(--today-line); }
  .day-cell.off-year { background: white; opacity: 0.55; }

  .bar {
    font-size: 8.5px;
    height: calc(var(--lane-h) - 3px);
    box-shadow: none;
    border: 0.5px solid rgba(0, 0, 0, 0.22);
    letter-spacing: -0.005em;
  }
  .bar.is-short::after { background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.25); }

  .grid-head, .head-corner, .head-days > div, .week-label, .day-cell, .bar, .day-cell.today, .day-cell.weekend {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .modal-backdrop, .tooltip, .empty-state, .clipboard-banner { display: none !important; }
}
