:root {
  --bg: #FAFAF7;
  --bg-2: #F3F2ED;
  --ink: #111111;
  --ink-2: #2B2B2B;
  --muted: #6B6B66;
  --muted-2: #9A9A94;
  --line: #E4E2DB;
  --line-2: #D8D5CC;
  --accent: oklch(0.68 0.14 65);
  --accent-soft: oklch(0.94 0.04 80);
  --accent-ink: oklch(0.38 0.1 60);
  --danger: oklch(0.58 0.13 25);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --row-h: 44px;
  --slot-h: 34px;
  --pad-x: 28px;
  --pad-y: 22px;
  --gap: 18px;
  --fs-base: 13px;
  --fs-meta: 11px;
  --fs-slot: 12px;
}

body.compact {
  --row-h: 34px;
  --slot-h: 26px;
  --pad-x: 20px;
  --pad-y: 14px;
  --gap: 12px;
  --fs-base: 12px;
  --fs-meta: 10px;
  --fs-slot: 11px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
}

.mono { font-family: var(--font-mono); font-feature-settings: 'zero', 'ss01'; }
.upper { text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- App shell ---------- */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--pad-x);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar .logo {
  width: 22px; height: 22px;
  border: 1px solid var(--ink);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
}
.topbar .brand-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.topbar .brand-sep {
  color: var(--muted-2);
  font-size: 14px;
}
.topbar .crumb {
  color: var(--muted);
  font-size: 13px;
}
.topbar .crumb a {
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}
.topbar .crumb a:hover { color: var(--ink); }
.topbar .crumb .sep { margin: 0 8px; color: var(--muted-2); }
.topbar .crumb strong { color: var(--ink); font-weight: 500; }

.topbar .right {
  display: flex; align-items: center; gap: 18px;
}
.topbar .search {
  width: 260px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  outline: none;
}
.topbar .search::placeholder { color: var(--muted-2); }
.topbar .search:focus { border-color: var(--ink); }
.topbar .kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  border: 1px solid var(--line);
  padding: 2px 5px;
}
.topbar .avatar {
  width: 28px; height: 28px;
  border: 1px solid var(--line-2);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-2);
}

/* ---------- Page shell ---------- */
.page {
  padding: var(--pad-y) var(--pad-x) 80px;
  max-width: 1480px;
  margin: 0 auto;
  width: 100%;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 24px;
}
.page-head h1 {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.page-head .eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.page-head .sub {
  color: var(--muted);
  font-size: 13px;
}
.page-head .actions {
  display: flex; gap: 10px; align-items: center;
}

/* ---------- Buttons / chips ---------- */
.btn {
  font-family: var(--font-sans);
  font-size: 12px;
  border: 1px solid var(--line-2);
  background: transparent;
  padding: 7px 12px;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.12s ease;
}
.btn:hover { border-color: var(--ink); }
.btn.primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn.primary:hover { background: var(--ink-2); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); }
.btn .k { font-family: var(--font-mono); color: var(--muted-2); margin-left: 6px; font-size: 10px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 4px 8px;
  border: 1px solid var(--line);
}
.chip .dot { width: 6px; height: 6px; background: var(--muted-2); border-radius: 50%; }
.chip.accent { color: var(--accent-ink); border-color: var(--accent); }
.chip.accent .dot { background: var(--accent); }

/* ---------- Dashboard ---------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  border: 1px solid var(--line);
  margin-bottom: 32px;
}
.kpi {
  padding: 18px 20px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi:last-child { border-right: 0; }
.kpi .label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.kpi .value {
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-family: var(--font-sans);
  font-feature-settings: 'tnum';
}
.kpi .delta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}
.kpi .delta.pos { color: var(--accent-ink); }
.kpi .delta.neg { color: var(--danger); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.section-head h2 {
  font-size: 13px;
  font-weight: 500;
  margin: 0;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.section-head .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

/* company rows */
.company-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  margin-bottom: 40px;
}
.company-row {
  display: grid;
  grid-template-columns: 220px 1fr 180px;
  border-bottom: 1px solid var(--line);
}
.company-row:last-child { border-bottom: 0; }
.company-row .c-head {
  padding: 20px 22px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}
.company-row .c-name {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
}
.company-row .c-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 3px;
}
.company-row .c-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  display: flex;
  gap: 14px;
}
.company-row .c-teams {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  border-right: 1px solid var(--line);
}
.team-cell {
  padding: 14px 16px;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  background: transparent;
  transition: background 0.12s;
  position: relative;
  text-align: left;
  font-family: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 110px;
}
.team-cell:hover { background: var(--bg-2); }
.team-cell:hover .team-cta { opacity: 1; transform: translateX(0); }
.team-cell .t-name {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.team-cell .t-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}
.team-cell .t-bar {
  height: 3px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.team-cell .t-bar .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--ink);
}
.team-cell .t-bar .fill.warn { background: var(--accent); }
.team-cell .t-bar .fill.over { background: var(--danger); }
.team-cta {
  position: absolute;
  top: 14px; right: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.15s;
}
.company-row .c-side {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.company-row .c-side .big {
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-feature-settings: 'tnum';
  line-height: 1;
}
.company-row .c-side .big-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
}
.c-side .mini-heat {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  margin-top: auto;
}
.c-side .mini-heat .cell {
  height: 8px;
  background: var(--line);
}
.c-side .mini-heat .cell.l1 { background: oklch(0.92 0.02 70); }
.c-side .mini-heat .cell.l2 { background: oklch(0.85 0.06 70); }
.c-side .mini-heat .cell.l3 { background: oklch(0.75 0.1 65); }
.c-side .mini-heat .cell.l4 { background: oklch(0.65 0.14 60); }

/* Dashboard secondary grid: activity + deadlines */
.two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--gap);
}
.panel {
  border: 1px solid var(--line);
}
.panel .panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.panel .panel-head h3 {
  margin: 0;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.panel .panel-head .meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}

.activity-item {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.activity-item:last-child { border-bottom: 0; }
.activity-item .time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}
.activity-item .text { font-size: 12px; }
.activity-item .text .who { font-weight: 500; }
.activity-item .text .what { color: var(--muted); }
.activity-item .tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 2px 6px;
}

.deadline-item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  align-items: center;
}
.deadline-item:last-child { border-bottom: 0; }
.deadline-item .day {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
}
.deadline-item .mo {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.deadline-item .proj { font-size: 12px; font-weight: 500; }
.deadline-item .sub { font-size: 11px; color: var(--muted); }
.deadline-item .owner {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}

/* ---------- Week view ---------- */
.week-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
}
.week-toolbar .left, .week-toolbar .right {
  display: flex; align-items: center; gap: 12px;
}
.week-nav {
  display: flex; align-items: center; gap: 6px;
}
.week-nav button {
  width: 28px; height: 28px;
  border: 1px solid var(--line-2);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
}
.week-nav button:hover { border-color: var(--ink); }
.week-nav .range {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0 10px;
  min-width: 200px;
  text-align: center;
}

/* Layout: [member panel | days grid] per team member block */
.week-planner {
  border: 1px solid var(--line);
  background: var(--bg);
}

/* Days header: sits on top, aligns with days grid on the right of each block */
.days-header {
  display: grid;
  grid-template-columns: 220px repeat(5, 1fr);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 57px;
  background: var(--bg);
  z-index: 2;
}
.days-header .dh-corner {
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.days-header .dh-day {
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  cursor: pointer;
  transition: background 0.1s;
}
.days-header .dh-day:last-child { border-right: 0; }
.days-header .dh-day:hover { background: var(--bg-2); }
.days-header .dh-day .dh-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.days-header .dh-day .dname {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.days-header .dh-day .ddate {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}
.days-header .dh-day.today .dname { color: var(--accent-ink); }
.days-header .dh-day.today::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
}

/* Deadline badge nel giorno */
.dh-deadline {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent-ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dh-deadline::before {
  content: '▲';
  font-size: 8px;
  flex-shrink: 0;
}
.dh-day:hover .dh-add-deadline {
  opacity: 1;
}
.dh-add-deadline {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  opacity: 0;
  transition: opacity 0.15s;
}

/* Member block: left panel + days grid. One block per person. */
.member-block {
  display: grid;
  grid-template-columns: 220px 1fr;
  border-bottom: 1px solid var(--line-2);
}
.member-block:last-child { border-bottom: 0; }

.m-panel {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
}
.m-panel .m-deadline {
  background: var(--ink);
  color: var(--bg);
  font-size: 10px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 32px;
  justify-content: center;
}
.m-deadline-empty {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 9px;
  opacity: 0.35;
  text-align: center;
}
.m-deadline-item {
  display: flex;
  align-items: baseline;
  gap: 5px;
  line-height: 1.3;
}
.m-deadline-day {
  font-family: var(--font-mono);
  font-size: 9px;
  opacity: 0.6;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.m-deadline-label {
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m-panel .m-identity {
  flex: 1;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  align-items: flex-start;
}
.m-panel .m-name {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-transform: uppercase;
}
.m-panel .m-role {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.m-panel .m-load-chip {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.m-panel .m-load-chip .bar {
  width: 60px;
  height: 3px;
  background: var(--line-2);
  position: relative;
}
.m-panel .m-load-chip .bar .f {
  position: absolute; inset: 0 auto 0 0;
  background: var(--ink);
}
.m-panel .m-load-chip .bar .f.warn { background: var(--accent); }
.m-panel .m-load-chip .bar .f.over { background: var(--danger); }
.m-panel .m-tot {
  border-top: 1px solid var(--line);
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  justify-content: space-between;
}
.m-panel .m-tot .v { color: var(--ink); }

/* days grid: 5 day columns each with stacked hour rows + tot row */
.days-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.day-col {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.day-col:last-child { border-right: 0; }
.day-col.today { background: oklch(0.98 0.012 80); }

.slot {
  min-height: var(--slot-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 6px 10px;
  font-family: var(--font-sans);
  font-size: var(--fs-slot);
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.1s;
  overflow: hidden;
  text-align: left;
  position: relative;
  user-select: none;
  line-height: 1.3;
}
.slot.empty {
  background: var(--bg);
  color: transparent;
}
.slot.empty:hover { background: var(--bg-2); }
.slot.empty:hover::before { content: '+ assegna'; color: var(--muted-2); font-family: var(--font-mono); font-size: 10px; }
.slot.filled {
  background: var(--bg);
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.slot.filled:hover {
  background: var(--bg-2);
}
.slot.filled.run-start {
  border-top: 2px solid var(--line-2);
}
.slot.filled.off {
  background: #EBEBEB;
  color: #AEAEAA;
  font-family: var(--font-mono);
  font-size: calc(var(--fs-slot) - 1px);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  justify-content: center;
}
.slot.filled.off:hover {
  background: #DEDEDD;
  color: #6B6B66;
}

/* ── Slot tooltip balloon ─────────────────────────────────────────────── */
.slot-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 170px;
  max-width: 240px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.st-task {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: #fff;
}
.st-client {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.01em;
}
.st-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.st-worktypes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.st-wt-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.03em;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}

/* Drag-selezione di un blocco di ore */
.slot.dragging,
.slot.empty.dragging,
.slot.filled.dragging {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}
.slot.empty.dragging::before {
  content: '';
}

/* Chips durata nel modal slot */
.modal-hours {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.hour-opt {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}
.hour-opt:hover { border-color: var(--line-2); }
.hour-opt.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* Slot in giorno con deadline → nero/bianco */
.slot.filled.deadline-day {
  background: var(--ink);
  color: var(--bg);
}
.slot.filled.deadline-day:hover {
  background: var(--ink-2);
}
.slot.filled.deadline-day.run-start {
  border-top: 2px solid #555;
}

.day-col .day-tot {
  margin-top: auto;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  display: flex;
  justify-content: space-between;
}
.day-col .day-tot .v { color: var(--ink); }

/* ---------- Tweaks panel ---------- */
.tweaks {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg);
  border: 1px solid var(--ink);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  display: none;
  z-index: 50;
  box-shadow: 4px 4px 0 rgba(17,17,17,0.08);
  min-width: 220px;
}
.tweaks.visible { display: block; }
.tweaks h4 {
  margin: 0 0 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 500;
  display: flex; justify-content: space-between;
}
.tweaks .row {
  display: flex;
  gap: 0;
  border: 1px solid var(--line-2);
}
.tweaks .opt {
  flex: 1;
  padding: 7px 10px;
  text-align: center;
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 11px;
  color: var(--muted);
  border-right: 1px solid var(--line-2);
}
.tweaks .opt:last-child { border-right: 0; }
.tweaks .opt.active {
  background: var(--ink);
  color: var(--bg);
}

/* ---------- Slot modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,17,17,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--bg);
  border: 1px solid var(--ink);
  width: 420px;
  max-width: calc(100vw - 40px);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 3px 12px;
  align-items: start;
}
.modal-title {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.modal-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.modal-close {
  grid-row: 1;
  grid-column: 2;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  padding: 0;
  line-height: 1;
}
.modal-close:hover { color: var(--ink); }

/* ── ConfirmDeleteModal ───────────────────────────────────────────────── */
/* Sopra ogni altro overlay (ap-overlay z200, dropdown z400): le conferme
   sono spesso aperte DA un altro modal e devono restare in cima. */
.confirm-overlay { z-index: 600; }
.modal.cdm { width: 400px; }
.cdm-warning {
  color: var(--danger) !important;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.cdm-entity {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  border-radius: 2px;
  line-height: 1.4;
}
.cdm-instruction {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.cdm-instruction strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-2);
  padding: 1px 5px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
}
.cdm-input {
  font-family: var(--font-mono) !important;
  font-size: 12px !important;
  letter-spacing: 0.02em;
}
.cdm-message {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
}
.cdm-hint {
  font-size: 11px;
  color: var(--muted-2);
  line-height: 1.5;
  padding: 8px 12px;
  background: oklch(0.98 0.01 25);
  border-left: 3px solid var(--danger);
}

.modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.modal-input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-2);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  outline: none;
}
.modal-input:focus { border-color: var(--ink); }
.modal-input::placeholder { color: var(--muted-2); }
.modal-tasks-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.modal-tasks {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  max-height: 220px;
  overflow-y: auto;
}
.task-opt {
  padding: 9px 12px;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink);
  transition: background 0.1s;
}
.task-opt:last-child { border-bottom: 0; }
.task-opt:hover { background: var(--bg-2); }
.task-opt.active {
  background: var(--ink);
  color: var(--bg);
}
.modal-off {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-off-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.modal-off .btn.off {
  border-color: #CBCBC6;
  color: #6B6B66;
  font-size: 11px;
  padding: 5px 10px;
}
.modal-off .btn.off:hover {
  background: #EBEBEB;
  border-color: #AEAEAA;
  color: var(--ink);
}

.modal-actions {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal-actions .btn.danger {
  border-color: var(--danger);
  color: var(--danger);
  margin-right: auto;
}
.modal-actions .btn.danger:hover {
  background: var(--danger);
  color: var(--bg);
}
.btn:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* utility */
.hstack { display: flex; align-items: center; gap: 10px; }
.vstack { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}
.login-card {
  width: 380px;
  max-width: 100%;
  padding: 40px 36px 32px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.login-logo {
  width: 44px; height: 44px;
  border: 1px solid var(--ink);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 18px;
  margin: 0 auto 16px;
}
.login-title {
  text-align: center;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 28px;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.login-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.login-input {
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  background: transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  outline: none;
}
.login-input:focus { border-color: var(--ink); }
.login-error {
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 11px;
  margin-bottom: 10px;
}
/* Banner errore non bloccante (vista membro / planner) */
.md-error-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 10px 14px;
  border: 1px solid var(--danger);
  border-radius: 8px;
  background: color-mix(in oklch, var(--danger) 12%, transparent);
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
}
.md-error-banner .md-error-dismiss { margin-left: auto; opacity: 0.7; }
.login-submit {
  width: 100%;
  margin-top: 8px;
  padding: 11px 12px;
  font-size: 13px;
}
.login-hint {
  margin-top: 16px;
  text-align: center;
  font-size: 10px;
  color: var(--muted-2);
}

/* ---------- Topbar user + logout ---------- */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-uname {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 500;
}
.topbar-logout {
  font-size: 11px;
}

/* ---------- Member dashboard ---------- */

/* Page head: gerarchia alta, tipografia respirata */
.member-page-head {
  margin-bottom: 40px;
}
.member-page-head .eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
}
.member-page-head h1 {
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  line-height: 1.1;
}
.member-page-head .sub {
  color: var(--muted);
  font-size: 13px;
}

/* Week card — base */
.week-card {
  background: var(--bg);
  margin-bottom: 28px;
}

/* Variante HERO: "Questa settimana" */
.week-card.hero {
  border: 1px solid var(--line);
  padding: 32px 28px 28px;
}
.week-card.hero .wc-head {
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.week-card.hero .wc-head h2 {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}
.week-card.hero .wc-head .wc-range {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  font-feature-settings: 'tnum';
}

/* Variante COMPACT: "Prossima settimana" */
.week-card.compact {
  border: 1px solid var(--line-2);
  padding: 20px 22px 22px;
  margin-bottom: 24px;
}
.week-card.compact .wc-head {
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.week-card.compact .wc-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.week-card.compact .wc-head .wc-range {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  font-feature-settings: 'tnum';
}

/* Head comune: flex space-between baseline */
.wc-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

/* Grid 5 colonne, no gap (il wash della colonna oggi si legge) */
.wc-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}

/* Colonna giorno */
.wc-day {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 14px;
  min-width: 0;
}
.wc-day:first-child { padding-left: 0; }
.wc-day:last-child  { padding-right: 0; }

/* Colonna OGGI — wash caldo, delimitata da bordi neutri */
.wc-day.today {
  background: var(--bg-2);
  padding: 0 14px 18px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  margin: 0 -1px;  /* compensa lo spessore dei bordi per mantenere allineamento */
}

/* Compact riduce spacing verticale */
.week-card.compact .wc-day { gap: 6px; padding: 0 10px; }
.week-card.compact .wc-day.today { padding: 0 10px 14px; }

/* Day head */
.wc-day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 0 10px;
}
.wc-day-head .dname {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.wc-day-head .ddate {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  font-feature-settings: 'tnum';
}

/* Day head OGGI — tipografia prominente, no uppercase */
.wc-day-head.today .dname {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.wc-day-head.today .ddate {
  font-size: 11px;
  color: var(--muted);
}

/* Compact: day head leggermente contratto */
.week-card.compact .wc-day-head { padding: 10px 0 8px; }
.week-card.compact .wc-day-head .dname { font-size: 10px; }
.week-card.compact .wc-day-head.today .dname { font-size: 13px; }

/* Deadline chip — unica nota di colore (semantica: urgenza) */
.wc-deadline {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.wc-deadline-mark { font-size: 8px; flex-shrink: 0; }
.wc-deadline-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Task card — filled soft */
.task-row {
  background: var(--bg-2);
  border: 0;
  padding: 10px 12px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: background 0.12s ease;
}
.task-row:hover { background: oklch(0.93 0.01 80); }
.task-row .tr-name {
  font-weight: 500;
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  color: var(--ink);
}
.task-row .tr-hours {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  font-feature-settings: 'tnum';
  flex-shrink: 0;
}

/* Task dentro OGGI: inversione (bg chiaro su wash bg-2) per spiccare */
.wc-day.today .task-row {
  background: var(--bg);
}
.wc-day.today .task-row:hover { background: oklch(0.98 0.005 80); }

/* OFF: chip piccola a sinistra, niente box a tutta larghezza */
.task-row.off {
  align-self: flex-start;
  background: transparent;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  justify-content: flex-start;
}
.task-row.off:hover { background: transparent; color: var(--muted); }
.wc-day.today .task-row.off { background: transparent; }

/* Compact: task più piccole */
.week-card.compact .task-row { padding: 8px 10px; font-size: 12px; }
.week-card.compact .task-row .tr-hours { font-size: 9px; }

/* ── Vista membro a blocchi (8 ore/giorno, come la vista admin) ───────────── */
.mwk { width: 100%; }

/* Riga intestazione + corpo: 5 giorni */
.mwk-head-row,
.mwk-body {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.mwk-head-row { border-bottom: 1px solid var(--line); }
.mwk-dhead:first-child,
.mwk-col:first-child { border-left: 0; }

/* Intestazione giorno */
.mwk-dhead {
  padding: 10px 10px 8px;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.mwk-dhead-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}
.mwk-dhead .dname {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.mwk-dhead .ddate {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  font-feature-settings: 'tnum';
}
.mwk-dhead.today { background: var(--bg-2); }
.mwk-dhead .dname {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mwk-dhead.today .dname {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.mwk-dhead.today .ddate { font-size: 11px; color: var(--muted); }

/* Banner deadline — nota di colore chiara e leggibile */
.mwk-dl {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11px;
  line-height: 1.25;
}
.mwk-dl-mark { font-size: 9px; flex-shrink: 0; margin-top: 2px; }
.mwk-dl-text {
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mwk-dl-text strong { font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

/* Colonna giorno */
.mwk-col {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mwk-col.today { background: oklch(0.98 0.012 80); }
.mwk-col.has-dl { box-shadow: inset 0 0 0 1px var(--accent); }

/* Blocco ora */
.mwk-slot {
  position: relative;
  min-height: var(--slot-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 4px 10px;
  font-size: var(--fs-slot);
  color: var(--ink-2);
  overflow: hidden;
  line-height: 1.25;
}
.mwk-slot.empty { background: var(--bg); }
.mwk-slot.filled {
  background: var(--bg);
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.mwk-slot-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
/* Inizio di un nuovo blocco-task: separatore marcato. Le ore consecutive dello
   stesso task mantengono tutte lo stesso colore pieno (nessuna attenuazione). */
.mwk-slot.filled.run-start { border-top: 2px solid var(--line-2); }

/* OFF */
.mwk-slot.off {
  background: #EBEBEB;
  color: #AEAEAA;
  font-family: var(--font-mono);
  font-size: calc(var(--fs-slot) - 1px);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  justify-content: center;
}

/* Task nel giorno con deadline → nero/bianco, massima evidenza */
.mwk-slot.filled.deadline { background: var(--ink); color: var(--bg); }
.mwk-slot.filled.deadline.run-start { border-top: 2px solid #555; }

/* Slot cliccabile per confermare */
.mwk-slot.clickable { cursor: pointer; }
.mwk-slot.filled.clickable:hover { box-shadow: inset 0 0 0 1.5px var(--line-2); }

/* Ore confermate → neutro (no colore): spunta + barrato, niente fill */
.mwk-slot.filled.confirmed { background: var(--bg-2); }
.mwk-slot.filled.confirmed .mwk-slot-name {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--line-2);
}
.mwk-slot-check {
  font-size: 10px;
  margin-right: 5px;
  flex-shrink: 0;
  color: var(--muted);
}
.mwk-slot.filled.deadline.confirmed .mwk-slot-name { opacity: .6; text-decoration-color: var(--muted-2); }
.mwk-slot.filled.deadline.confirmed .mwk-slot-check { color: var(--bg); }

/* Totale giorno */
.mwk-tot {
  margin-top: auto;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  display: flex;
  justify-content: space-between;
}
.mwk-tot .v { color: var(--ink); }

/* Compact (prossima settimana): blocchi più bassi */
.week-card.compact .mwk-slot { min-height: 22px; }

/* ── Admin button ────────────────────────────────────────────────── */
.admin-assign-btn {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  gap: 6px;
}
.admin-assign-btn:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
}

/* ── Assegnazione Progetti modal ─────────────────────────────────── */
.ap-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,17,17,0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad-x);
}

.ap-panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
}

.ap-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
  border-radius: 12px 12px 0 0;
}
.ap-eyebrow {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 4px;
}
.ap-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}
.ap-close {
  padding: 4px 8px;
  margin-top: -2px;
  color: var(--muted);
}

/* Form */
.ap-form, .ap-result {
  padding: 24px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ap-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ap-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ap-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: -2px;
}
.ap-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg-2);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  resize: vertical;
  min-height: 140px;
  outline: none;
  transition: border-color 0.15s;
  line-height: 1.55;
}
.ap-textarea:focus { border-color: var(--accent); background: var(--bg); }

.ap-label-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ap-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}
.ap-badge.ok { background: oklch(0.92 0.06 145); color: oklch(0.35 0.1 145); }
.ap-badge.off { background: var(--bg-2); color: var(--muted); }

.ap-key-row {
  display: flex;
  gap: 8px;
}
.ap-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.ap-input:focus { border-color: var(--accent); background: var(--bg); }

.ap-error {
  padding: 10px 14px;
  background: oklch(0.95 0.04 25);
  border: 1px solid oklch(0.85 0.08 25);
  border-radius: 8px;
  font-size: 12px;
  color: var(--danger);
}

.ap-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}
.ap-actions-spacer { flex: 1; }

/* Bottone danger generico (fuori dai modal-actions) */
.btn.danger {
  border-color: var(--danger);
  color: var(--danger);
}
.btn.danger:hover {
  background: var(--danger);
  color: var(--bg);
}

.ap-loading { display: flex; align-items: center; gap: 4px; }
.ap-dots { opacity: 0.6; animation: dotpulse 1.2s infinite; }
@keyframes dotpulse { 0%,100% { opacity: 0.3 } 50% { opacity: 1 } }

/* Result */
.ap-result-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ap-mode-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: var(--font-mono);
}
.ap-mode-badge.ai { background: var(--ink); color: var(--bg); }
.ap-mode-badge.mock { background: var(--bg-2); color: var(--muted); border: 1px solid var(--line-2); }

.ap-deadline-badge {
  font-size: 12px;
  color: var(--ink-2);
  padding: 3px 10px;
  background: var(--accent-soft);
  border-radius: 20px;
}

.ap-summary {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  padding: 12px 14px;
  background: var(--bg-2);
  border-radius: 8px;
  border-left: 3px solid var(--line-2);
}

.ap-matches {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ap-empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 32px 0;
}

.ap-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
  transition: border-color 0.15s;
}
.ap-card:hover { border-color: var(--line-2); }
.ap-card-warn { border-color: var(--line-2); }

.ap-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
}
.ap-rank {
  font-size: 11px;
  color: var(--muted-2);
  width: 28px;
  flex-shrink: 0;
}
.ap-card-info { flex: 1; min-width: 0; }
.ap-card-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.ap-card-role { font-size: 11px; color: var(--muted); margin-top: 2px; }

.ap-score-block {
  text-align: right;
  flex-shrink: 0;
  width: 72px;
}
.ap-score-num {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1;
}
.ap-score-pct { font-size: 12px; font-weight: 400; }
.ap-score-bar {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  margin-top: 5px;
  overflow: hidden;
}
.ap-score-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

.ap-card-reasoning {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
}
.ap-card-constraint {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg-2);
  border-radius: 6px;
  padding: 6px 10px;
}
.ap-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ap-tag {
  font-size: 10px;
  padding: 2px 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  white-space: nowrap;
}
.ap-tag-cap { color: var(--accent-ink); border-color: var(--accent-soft); background: var(--accent-soft); }

/* Company selector */
.ap-company-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ap-company-btn {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border: 1.5px solid var(--line-2);
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
}
.ap-company-btn:hover { border-color: var(--ink); color: var(--ink); }
.ap-company-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.ap-company-btn:disabled { opacity: 0.5; cursor: default; }

/* Tag picker (skill, passioni, ecc.) */
.mb-tag-section {
  margin-bottom: 20px;
}
.mb-tag-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.mb-tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mb-tag-option {
  font-family: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--line-2);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  line-height: 1.4;
}
.mb-tag-option:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.mb-tag-option.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.mb-tag-orphan {
  opacity: 0.55;
  border-style: dashed;
  font-size: 11px;
}
.mb-tag-custom-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-top: 4px;
  flex-basis: 100%;
}
.mb-tag-custom-input {
  max-width: 220px;
  padding: 4px 10px !important;
  height: auto !important;
  font-size: 12px !important;
}
.mb-tag-custom-add {
  padding: 3px 10px;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

/* Autocomplete clienti */
.mb-client-ac {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mb-client-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mb-client-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mb-client-tag-x {
  font-family: inherit;
  font-size: 11px;
  line-height: 1;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.6;
  padding: 0;
}
.mb-client-tag-x:hover { opacity: 1; }
.mb-client-input-wrap {
  position: relative;
  max-width: 360px;
}
.mb-client-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
}
.mb-client-suggestion {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.mb-client-suggestion:hover {
  background: var(--bg-2);
}

/* Stepper */
.ap-stepper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  background: var(--bg-2);
  border-radius: 10px;
  border: 1px solid var(--line);
}
.ap-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  opacity: 0.35;
  transition: opacity 0.2s;
}
.ap-step.active { opacity: 1; }
.ap-step-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  display: grid; place-items: center;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 1px;
}
.ap-step.active .ap-step-dot { border-color: var(--accent); color: var(--accent-ink); }
.ap-step.done .ap-step-dot { background: var(--accent); border-color: var(--accent); color: white; font-size: 10px; }
.ap-step-label { display: flex; flex-direction: column; gap: 1px; }
.ap-step-label strong { font-size: 12px; font-weight: 600; color: var(--ink); }
.ap-step-label span { font-size: 11px; color: var(--muted); }

@keyframes spin { to { transform: rotate(360deg); } }
.ap-spin { display: inline-block; animation: spin 1s linear infinite; }

/* Result brief summary */
.ap-result-brief {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ap-rb-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  font-size: 12px;
}
.ap-rb-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  width: 90px;
  flex-shrink: 0;
}
.ap-rb-value { color: var(--ink-2); flex: 1; }
.ap-cat-badge {
  font-size: 11px;
  padding: 1px 8px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: 20px;
}

.ap-result-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

/* Availability row */
.ap-avail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.ap-avail-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ap-avail-status { font-weight: 600; }
.ap-avail-hours { color: var(--muted); font-size: 11px; }

/* Proposed window */
.ap-window {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 8px 12px;
  background: var(--bg-2);
  border-radius: 6px;
  font-size: 12px;
}
.ap-window-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
  flex-shrink: 0;
}
.ap-window-value { color: var(--ink-2); font-weight: 500; }

.ap-card-actions { display: flex; justify-content: flex-end; margin-top: 2px; }
.ap-assign-done { opacity: 0.55; cursor: default; }

/* Agente Nuovo Progetto: navigazione figure + step ruolo */
.ap-roles-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ap-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
}
.ap-role-chip.active { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.ap-role-chip.done { color: var(--ink-2); }
.ap-role-chip-n {
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg-2);
  font-size: 10px;
}
.ap-role-chip.done .ap-role-chip-n { background: var(--accent); color: white; }
.ap-role-chip-who { font-size: 11px; color: var(--accent-ink); font-weight: 600; }

.ap-role-step { display: flex; flex-direction: column; gap: 14px; }

/* Breakdown del punteggio (disponibilità / skill) */
.ap-bd { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11px; }
.ap-bd-item { display: inline-flex; align-items: baseline; gap: 6px; }
.ap-bd-k {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
}
.ap-bd-v { color: var(--ink-2); font-weight: 500; }

/* Hint storico task analoghe */
.ap-hist {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: baseline;
  padding: 7px 12px;
  background: var(--bg-2);
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink-2);
}
.ap-hist-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
}

/* ═══ Team member & Progetti screens ═══════════════════════════════════════ */

.mb-section-label {
  font-size: var(--fs-meta);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 18px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.mb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 16px;
}
.mb-span2 { grid-column: span 2; }

.mb-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
}
.mb-filter-controls { display: flex; gap: 8px; }
.mb-filter-count { margin-left: auto; color: var(--muted-2); white-space: nowrap; }

/* Dropdown filtro custom */
.mb-dd { position: relative; }
.mb-dd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.mb-dd-trigger:hover { border-color: var(--muted-2); }
.mb-dd-trigger.has-sel { border-color: var(--ink); background: var(--bg); }
.mb-dd.open .mb-dd-trigger { border-color: var(--ink); background: var(--bg); }
.mb-dd-summary { font-weight: 500; }
.mb-dd-caret {
  font-size: 9px;
  color: var(--muted-2);
  transition: transform 0.15s;
}
.mb-dd.open .mb-dd-caret { transform: rotate(180deg); }

.mb-dd-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 200px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mb-dd-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: none;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}
.mb-dd-opt:hover { background: var(--bg-2); }
.mb-dd-opt.active { color: var(--accent-ink); font-weight: 500; }
.mb-dd-check {
  width: 14px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--accent-ink);
}
.mb-dd-opt-label { flex: 1; }
.mb-dd-clear {
  margin-top: 3px;
  padding: 7px 10px;
  border: none;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}
.mb-dd-clear:hover { color: var(--danger); }

/* Pill filtri attivi */
.mb-active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: -4px 0 16px;
}
.mb-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px 4px 7px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--bg-2);
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}
.mb-active-pill:hover { border-color: var(--ink); }
.mb-active-pill-kind {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
}
.mb-active-pill-x { font-size: 10px; color: var(--muted-2); }
.mb-active-pill:hover .mb-active-pill-x { color: var(--danger); }
.mb-active-clear {
  border: none;
  background: none;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
}
.mb-active-clear:hover { color: var(--ink); }

/* Sezione capacity */
.mb-capacity {
  border: 1px solid var(--line);
  margin-bottom: 24px;
}
.mb-capacity-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
}
.mb-capacity-title {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.mb-capacity-scope {
  font-size: 10px;
  color: var(--muted-2);
}
.mb-capacity-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.mb-capacity-stat {
  padding: 16px 20px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mb-capacity-stat:last-child { border-right: 0; }
.mb-capacity-stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.mb-capacity-stat-value {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-feature-settings: 'tnum';
}
.mb-capacity-stat-value.mb-capacity-free { color: var(--accent-ink); }
.mb-capacity-stat-delta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
}
.mb-capacity-bar-wrap {
  height: 3px;
  background: var(--bg-2);
}
.mb-capacity-bar-fill {
  height: 100%;
  background: var(--accent-ink);
  transition: width 0.4s ease;
}

/* ═══ Task Database ════════════════════════════════════════════════════════ */
.tdb-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  margin: 4px 0 4px;
}
.tdb-legend-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.tdb-legend-item { display: inline-flex; align-items: center; gap: 7px; }
.tdb-legend-hint { font-size: 12px; color: var(--ink-2); }
.tdb-legend-note { font-size: 11px; color: var(--muted-2); margin-left: auto; }

.tdb-search { flex: 1 1 280px; max-width: none; }

/* ── WorkTypePicker: dropdown a tema sito (sostituisce il select nativo) ─────── */
.wtp { position: relative; width: 100%; }
.wtp.is-disabled { opacity: 0.55; pointer-events: none; }
.wtp-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg-2);
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.wtp-trigger:hover { border-color: var(--line); }
.wtp.is-open .wtp-trigger { border-color: var(--accent); background: var(--bg); }
.wtp-placeholder { flex: 1; color: var(--muted-2); }
.wtp-val { flex: 1; }
.wtp-caret {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1;
  transition: transform 0.15s;
}
.wtp.is-open .wtp-caret { transform: rotate(180deg); }

.wtp-chips { flex: 1; display: flex; flex-wrap: wrap; gap: 5px; }
.wtp-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 4px 2px 8px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 11px;
}
.wtp-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  font-size: 9px;
  color: var(--accent-ink);
  cursor: pointer;
}
.wtp-chip-x:hover { background: var(--accent); color: var(--bg); }

.wtp-panel {
  margin-top: 6px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 6px 20px rgba(17,17,17,0.10);
  overflow: hidden;
}
.wtp-list { max-height: 280px; overflow-y: auto; }
.wtp-search { padding: 8px 8px 4px; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.wtp-search-input {
  width: 100%; box-sizing: border-box;
  padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 6px;
  font-family: var(--font-sans); font-size: 13px; background: var(--bg-2);
  color: var(--ink); outline: none;
}
.wtp-search-input:focus { border-color: var(--accent); background: var(--bg); }
.wtp-empty { padding: 10px 12px; font-size: 13px; color: var(--muted-2); }
.wtp-opt-dim { color: var(--muted-2); font-size: 12px; }
.wtp-group {
  padding: 8px 12px 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-2);
}
.wtp-opt {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.1s;
}
.wtp-opt:hover { background: var(--bg-2); }
.wtp-opt.is-sel { color: var(--accent-ink); font-weight: 500; }
.wtp-opt-label { flex: 1; }
.wtp-check {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--bg);
}
.wtp-check.on { background: var(--accent); border-color: var(--accent); }
.wtp-opt-new {
  border-top: 1px solid var(--line);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 11px;
}
.wtp-new { padding: 10px; }
.wtp-new .ap-input { width: 100%; }
.wtp-new-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.wtp-link {
  border: none;
  background: none;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 2px;
}
.wtp-link:hover { color: var(--ink); }
.wtp-add {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.wtp-add:disabled { opacity: 0.4; cursor: default; }

.tdb-cat-new { display: flex; align-items: center; gap: 8px; }
.tdb-cat-new .ap-input { flex: 1; }
.tdb-cat-back {
  flex-shrink: 0;
  border: none;
  background: none;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 2px;
}
.tdb-cat-back:hover { color: var(--ink); }

.tdb-hours-range { display: flex; align-items: center; gap: 8px; }
.tdb-hours-range .ap-input { width: 72px; flex: 0 0 auto; text-align: center; }
.tdb-hours-sep { color: var(--muted-2); }
.tdb-hours-unit { color: var(--muted-2); font-size: 12px; }

/* Badge tier */
.tdb-tier {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tdb-tier-easy { background: color-mix(in oklch, var(--accent) 16%, transparent); color: var(--accent-ink); border-color: color-mix(in oklch, var(--accent) 35%, transparent); }
.tdb-tier-mid  { background: color-mix(in oklch, var(--accent) 32%, transparent); color: var(--accent-ink); border-color: color-mix(in oklch, var(--accent) 50%, transparent); }
.tdb-tier-hard { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tdb-tier-none { background: none; color: var(--muted-2); border-color: var(--line-2); border-style: dashed; }

.tdb-groups { display: flex; flex-direction: column; gap: 26px; margin-top: 18px; }
.tdb-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.tdb-group-name {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tdb-group-count { color: var(--muted-2); font-size: 11px; }

.tdb-list { display: flex; flex-direction: column; gap: 6px; }
.tdb-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.tdb-row:hover { border-color: var(--line-2); background: var(--bg-2); }
.tdb-row-main { flex: 1; min-width: 0; }
.tdb-row-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tdb-row-label { font-weight: 600; font-size: var(--fs-base); }
.tdb-row-desc {
  font-size: var(--fs-meta);
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.4;
}
.tdb-row-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}
.tdb-row-unit { font-size: 10px; color: var(--muted-2); }
.tdb-row-del {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  color: var(--muted-2);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  border-radius: 4px;
  transition: opacity 0.12s, background 0.12s, color 0.12s;
}
.tdb-row:hover .tdb-row-del { opacity: 1; }
.tdb-row-del:hover { background: var(--danger); color: #fff; }

/* Ricerca a tag multipli */
.mb-search-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 320px;
  min-width: 260px;
}
.mb-search-tag { display: inline-flex; align-items: center; gap: 6px; }
.mb-search-input-wrap { flex: 1 1 160px; min-width: 160px; max-width: none; }
.mb-search-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mb-search-kind {
  font-size: 10px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mb-list { display: flex; flex-direction: column; gap: 8px; }
.mb-row {
  display: grid;
  grid-template-columns: 220px 170px 1fr 110px 100px auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.12s;
}
.mb-row:hover { border-color: var(--line-2); }
.mb-row-inactive { opacity: 0.55; }
.mb-name { font-weight: 600; font-size: var(--fs-base); }
.mb-role { font-size: var(--fs-meta); color: var(--muted); margin-top: 2px; }
.mb-companies { display: flex; flex-wrap: wrap; gap: 4px; }
.mb-skills { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.mb-hours, .mb-cost { font-size: var(--fs-meta); color: var(--ink-2); text-align: right; }
.mb-actions { display: flex; justify-content: flex-end; }

/* ── Card grid ───────────────────────────────────────────────────────────── */
.mb-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 4px;
}

.mb-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 16px 14px;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mb-card:hover {
  border-color: var(--line-2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.mb-card-inactive { opacity: 0.5; }

/* Icona elimina membro (appare in hover sulla card) */
.mb-card-del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-2);
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s, color 0.12s;
}
.mb-card:hover .mb-card-del { opacity: 1; }
.mb-card-del:hover { background: var(--danger); color: #fff; }

.mb-card-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.mb-card-name { font-weight: 600; font-size: var(--fs-base); line-height: 1.3; }
.mb-card-role { font-size: var(--fs-meta); color: var(--muted); }
.mb-card-companies { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }

.mb-card-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.mb-card-stat { display: flex; align-items: baseline; gap: 3px; }
.mb-card-stat-value { font-size: 13px; font-weight: 600; }
.mb-card-stat-label { font-size: var(--fs-meta); color: var(--muted-2); }
.mb-card-stat-sep { color: var(--muted-2); font-size: var(--fs-meta); }

/* ── Skeleton ─────────────────────────────────────────────────────────────── */
@keyframes mb-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.mb-sk {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--line) 25%, var(--bg-2) 50%, var(--line) 75%);
  background-size: 800px 100%;
  animation: mb-shimmer 1.4s ease-in-out infinite;
}
.mb-card-skeleton { pointer-events: none; }
.mb-sk-avatar  { width: 44px; height: 44px; border-radius: 50%; margin-bottom: 4px; }
.mb-sk-name    { height: 14px; width: 70%; }
.mb-sk-role    { height: 11px; width: 50%; }
.mb-sk-chips   { height: 20px; width: 40%; border-radius: 10px; }
.mb-sk-stats   { height: 11px; width: 60%; margin-top: 8px; }

/* ── Profile modal ────────────────────────────────────────────────────────── */
.mbp-panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px 28px 24px;
  position: relative;
}

.mbp-hero {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}
.mbp-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 22px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.mbp-identity { flex: 1; min-width: 0; }
.mbp-name { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; margin: 0 0 3px; }
.mbp-role-line { font-size: var(--fs-base); color: var(--muted); margin-bottom: 8px; }
.mbp-chips { display: flex; flex-wrap: wrap; gap: 5px; }

.mbp-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}
.mbp-stat {
  background: #fff;
  padding: 14px 10px;
  text-align: center;
}
.mbp-stat-value { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.mbp-stat-label { font-size: var(--fs-meta); color: var(--muted-2); margin-top: 3px; }

.mbp-section { margin-bottom: 16px; }
.mbp-section-label {
  font-size: var(--fs-meta);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  font-weight: 600;
  margin-bottom: 8px;
}
.mbp-tags { display: flex; flex-wrap: wrap; gap: 5px; }

.mbp-expand-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 10px 0;
  background: none;
  border: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-size: var(--fs-meta);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  margin: 8px 0 4px;
  transition: opacity .15s;
}
.mbp-expand-btn:hover { opacity: .75; }

.mbp-full { padding-top: 8px; }

.mbp-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}
.mbp-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mbp-detail-label {
  font-size: var(--fs-meta);
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.mbp-detail-value {
  font-size: var(--fs-base);
  color: var(--ink);
}

/* ─────────────────────────────────────────────────────────────────────────── */
.mb-legacy { margin-top: 14px; }
.mb-legacy-json {
  margin-top: 8px;
  padding: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
}

/* Intake — line items */
.pj-line {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--bg-2);
}
.pj-line-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.pj-line-dl { display: flex; align-items: center; gap: 6px; }
.pj-line-dl-lbl { font-size: 11px; color: var(--muted); white-space: nowrap; }
.pj-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 10px; }
.ap-company-btn.pj-chip-offteam { opacity: 0.45; font-style: italic; }
.ap-company-btn.pj-chip-offteam.active { opacity: 0.7; }

/* ── Insight panels (analytics progetti) ─────────────────────────────────── */
.pj-insights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
@media (max-width: 1100px) {
  .pj-insights { grid-template-columns: 1fr; }
}
.ins-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.ins-title {
  font-weight: 600;
  font-size: var(--fs-base);
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.ins-sub { font-size: var(--fs-meta); color: var(--muted-2); font-weight: 400; }
.ins-row { margin-bottom: 10px; }
.ins-row:last-child { margin-bottom: 0; }
.ins-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.ins-name { font-size: var(--fs-base); font-weight: 500; }
.ins-val { font-size: var(--fs-meta); color: var(--muted); }
.ins-bar {
  height: 5px;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
}
.ins-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
}
.ins-empty { font-size: var(--fs-meta); color: var(--muted-2); }

.ins-alert {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.ins-alert:last-child { border-bottom: 0; padding-bottom: 0; }
.ins-alert:hover .ins-alert-name { color: var(--accent-ink); }
.ins-alert-name { font-size: var(--fs-base); font-weight: 500; margin-bottom: 4px; }
.ins-alert-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.ins-risk {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--bg-2);
}
.ins-risk.high {
  color: var(--danger);
  border-color: oklch(0.85 0.07 25);
  background: oklch(0.97 0.02 25);
}
.ins-risk.mid {
  color: var(--accent-ink);
  border-color: oklch(0.88 0.05 80);
  background: var(--accent-soft);
}

.pjd-risks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -12px 0 24px;
}

/* Lista progetti */
.pj-list { display: flex; flex-direction: column; gap: 10px; }
.pj-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.12s;
}
.pj-row:hover { border-color: var(--line-2); }
.pj-main { min-width: 0; }
.pj-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pj-name { font-weight: 600; font-size: 15px; }
.pj-client { color: var(--muted); }
.pj-meta { font-size: var(--fs-meta); color: var(--muted-2); margin-top: 4px; }
.pj-teams { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
/* Colonne numeriche: label e valore allineati su righe comuni; le eventuali
   sottoetichette (es. "46h piano") pendono sotto senza spostare le altre. */
.pj-nums { display: flex; align-items: flex-start; gap: 18px; flex-shrink: 0; }
.pj-num {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  min-width: 58px;
}
.pj-num .label {
  font-size: 10px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
}
.pj-num .v { font-size: var(--fs-base); font-weight: 600; line-height: 1.2; }
.pj-warn { font-size: 10px; color: var(--danger); }
/* Barra avanzamento e bottone elimina centrati rispetto alle colonne numeriche */
.pj-nums > .pj-progress { align-self: center; }
.pj-nums > .btn { align-self: center; }
.pj-progress { display: flex; align-items: center; gap: 8px; width: 120px; }
.pj-progress .bar {
  flex: 1;
  height: 5px;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
}
.pj-progress .f { height: 100%; background: var(--accent); border-radius: 3px; }
.pj-progress .f.warn { background: oklch(0.7 0.13 80); }
.pj-progress .f.over { background: var(--danger); }
.pj-status { max-width: 130px; }

/* Topbar nav */
.topnav { display: flex; gap: 4px; margin-left: 18px; }
.topnav button {
  border: none;
  background: none;
  font: inherit;
  font-size: var(--fs-base);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.topnav button:hover { color: var(--ink); background: var(--bg-2); }
.topnav button.active { color: var(--ink); font-weight: 600; background: var(--bg-2); }

@media (max-width: 900px) {
  .mb-row { grid-template-columns: 1fr auto; }
  .mb-companies, .mb-skills, .mb-hours { display: none; }
  .pj-row { flex-direction: column; }
}

/* ── PjSelect — dropdown custom (no estetica OS) ─────────────────────────── */
.pj-sel { position: relative; flex: 1; }
.pj-sel-btn {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg-2);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.pj-sel-btn:hover { background: oklch(0.93 0.01 80); border-color: var(--muted-2); }
.pj-sel-btn:focus { border-color: var(--accent); background: var(--bg); }
.pj-sel-btn.ph span:first-child { color: var(--muted-2); }
.pj-sel-arrow { color: var(--muted-2); font-size: 9px; flex-shrink: 0; }
.pj-sel-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 140px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  z-index: 400;
  box-shadow: 0 8px 32px rgba(0,0,0,0.13);
  max-height: 240px;
  overflow-y: auto;
}
.pj-sel-opt {
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  display: block;
}
.pj-sel-opt:hover { background: var(--bg-2); }
.pj-sel-opt.sel { font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); }

/* ── Project ID display (read-only) ──────────────────────────────────────── */
.pj-id-display {
  padding: 9px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted);
  user-select: all;
}

/* ── Output multi-hint label ─────────────────────────────────────────────── */
.pj-multi-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted-2);
  font-size: 11px;
  margin-left: 8px;
}

/* ── Budget range ────────────────────────────────────────────────────────── */
.pj-budget { display: flex; flex-direction: column; gap: 10px; }
.pj-budget-modes { display: flex; gap: 6px; flex-wrap: wrap; }
.pj-budget-mode-btn {
  padding: 6px 14px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--bg-2);
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
}
.pj-budget-mode-btn:hover { border-color: var(--muted-2); color: var(--ink); }
.pj-budget-mode-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.pj-budget-inputs { display: flex; align-items: center; gap: 10px; }
.pj-budget-sep { color: var(--muted-2); font-size: 13px; flex-shrink: 0; }

/* ── Project Detail View ─────────────────────────────────────────────────── */
.pjd-back { cursor: pointer; color: var(--muted); transition: color 0.12s; }
.pjd-back:hover { color: var(--ink); }
.pjd-id-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.pjd-kpi-bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.pjd-kpi-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.pjd-kpi-fill.warn { background: oklch(0.7 0.13 80); }
.pjd-kpi-fill.over { background: var(--danger); }

.pjd-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 32px;
  overflow: hidden;
}
.pjd-info-item {
  padding: 16px 20px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.pjd-info-item:nth-child(3n) { border-right: 0; }
.pjd-info-item:nth-last-child(-n+3) { border-bottom: 0; }
.pjd-info-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  margin-bottom: 6px;
}
.pjd-info-value { font-size: 14px; font-weight: 500; color: var(--ink); }

.pjd-section { margin-bottom: 32px; }
.pjd-section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-2);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.pjd-text { font-size: 14px; line-height: 1.7; color: var(--ink-2); max-width: 700px; white-space: pre-wrap; }

.pjd-lines { display: flex; flex-direction: column; gap: 16px; }
.pjd-line { border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; background: var(--bg); }
.pjd-line-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.pjd-team { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.pjd-pill {
  font-size: 11px; color: var(--muted); background: var(--bg-2);
  border: 1px solid var(--line); padding: 3px 10px; border-radius: 20px;
}
.pjd-pill-dl { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent); }
.pjd-line-head { flex-wrap: wrap; }
.pjd-task-types { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 16px; }

/* Resoconto lavorazioni svolte — tag con ore confermate */
.pjd-worktypes { display: flex; flex-wrap: wrap; gap: 8px; }
.pjd-wt-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-2);
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 6px 6px 6px 12px; border-radius: 20px;
}
.pjd-wt-tag .pjd-wt-h {
  font-size: 11px; color: var(--accent-ink);
  background: var(--accent-soft); border-radius: 14px; padding: 2px 9px;
}
.pjd-wt-tag-muted { color: var(--muted); }
.pjd-wt-tag-muted .pjd-wt-h { color: var(--muted); background: var(--bg); }

.pjd-members { display: flex; flex-direction: column; gap: 8px; }
.pjd-member { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg-2); border-radius: 8px; }
.pjd-member-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--bg);
  display: grid; place-items: center; font-size: 11px; font-weight: 600; flex-shrink: 0; font-family: var(--font-mono);
}
.pjd-member-info { flex: 1; min-width: 0; }
.pjd-member-name { font-weight: 500; font-size: 13px; }
.pjd-member-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.pjd-member-rate { font-size: 11px; color: var(--muted-2); }
.pjd-member-hours {
  font-size: 11px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft);
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}
.pjd-empty-members { font-size: 12px; color: var(--muted-2); font-style: italic; padding: 8px 0; }
.pjd-line-notes { margin-top: 12px; font-size: 12px; color: var(--muted); font-style: italic; padding-top: 10px; border-top: 1px solid var(--line); }

/* ── Match progetto esistente ────────────────────────────────────────────── */
.pj-match-banner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px;
  background: oklch(0.96 0.04 80);
  border: 1px solid oklch(0.88 0.08 70);
  border-radius: 8px;
}
.pj-match-text {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-2);
}
.pj-match-text strong { color: var(--ink); }
.pj-match-sub { color: var(--muted); font-size: 12px; }
.pj-match-cand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.pj-match-cand-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 13px;
}
.pj-match-cand-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Chip "fase di" nel modal ────────────────────────────────────────────── */
.pj-link-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding: 6px 10px;
  background: var(--accent-soft);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  font-size: 12px;
  color: var(--ink-2);
}
.pj-link-chip strong { color: var(--ink); }
.pj-link-id { color: var(--muted); font-size: 11px; letter-spacing: 0.04em; }
.pj-link-unlink {
  margin-left: auto;
  border: none;
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}
.pj-link-unlink:hover { color: var(--danger); }

/* ── Gruppo di fasi nella lista progetti ─────────────────────────────────── */
.pj-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--bg-2);
}
.pj-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 2px 8px 0;
}
.pj-group-name { font-weight: 600; font-size: 14px; }
.pj-group-totals { margin-left: auto; font-size: 11px; color: var(--muted); }

/* ── Admin panel ─────────────────────────────────────────────────────────── */
.c-teams-empty {
  font-size: 12px;
  color: var(--muted-2);
  padding: 14px 4px;
  font-style: italic;
}

.adm-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  align-items: start;
  margin-top: 12px;
}

/* Sidebar lista company */
.adm-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 16px;
}
.adm-company-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.adm-company-item:hover { border-color: var(--line-2); }
.adm-company-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  background: var(--accent-soft);
}
.adm-company-item.inactive { opacity: .55; }
.adm-ci-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.adm-ci-tag { font-size: 11px; color: var(--muted); margin-top: 2px; }
.adm-ci-meta { font-size: 11px; color: var(--muted-2); white-space: nowrap; }

.adm-new-company {
  background: #fff;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

/* Dettaglio company */
.adm-main { min-width: 0; }
.adm-detail {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}
.adm-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.adm-detail-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 240px;
}
.adm-name-input { font-size: 18px; font-weight: 600; }
.adm-status-sel { max-width: 160px; }
.adm-detail-actions { display: flex; gap: 8px; align-items: flex-start; }
.adm-detail-meta {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.adm-id { color: var(--muted); }

.adm-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 12px;
}
.adm-section-head h3 { font-size: 14px; font-weight: 600; }

.adm-teams { display: flex; flex-direction: column; gap: 14px; }

.adm-team-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--bg);
}
.adm-team-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.adm-team-name {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding: 2px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.adm-edit-pencil { font-size: 11px; color: var(--muted-2); opacity: 0; transition: opacity .12s; }
.adm-team-name:hover .adm-edit-pencil { opacity: 1; }
.adm-team-name-input { font-size: 14px; font-weight: 600; max-width: 280px; }
.adm-team-actions { display: flex; align-items: center; gap: 10px; }
.adm-count { font-size: 11px; color: var(--muted); }
.adm-icon-btn {
  padding: 4px 7px;
  font-size: 12px;
  line-height: 1;
  border-radius: 7px;
}
.adm-icon-btn:hover { background: var(--bg-2); }

.adm-member-list { display: flex; flex-direction: column; gap: 6px; }
.adm-member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 10px;
}
.adm-member-av {
  width: 30px; height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
.adm-member-info { flex: 1; min-width: 0; }
.adm-member-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.adm-member-role { font-size: 11px; color: var(--muted); }
.adm-member-row-actions { display: flex; gap: 4px; }

.adm-empty-inline {
  font-size: 12px;
  color: var(--muted-2);
  padding: 8px 2px;
  font-style: italic;
}

.adm-add-member { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.adm-add-member .ap-input { flex: 1; min-width: 180px; }

.adm-add-trigger, .adm-new-team-trigger {
  margin-top: 10px;
  background: none;
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  color: var(--muted);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  width: 100%;
  transition: border-color .12s, color .12s;
}
.adm-add-trigger:hover, .adm-new-team-trigger:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}
.adm-new-team { border-style: dashed; }

@media (max-width: 820px) {
  .adm-layout { grid-template-columns: 1fr; }
  .adm-sidebar { position: static; }
}

/* ── Member: conferma ore ─────────────────────────────────────────────────── */
.pj-subnum { display: block; font-size: 10px; color: var(--muted-2); margin-top: 2px; }

/* Popup conferma: pulsanti in colonna, larghi */
.modal-actions.cs-actions { flex-direction: column; align-items: stretch; gap: 8px; }
.modal-actions.cs-actions .btn { width: 100%; justify-content: center; }

/* ── Sezione Ferie ──────────────────────────────────────────────────────────── */
.ferie-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 18px 0 14px;
}
.ferie-monthnav { display: flex; align-items: center; gap: 8px; }
.ferie-monthnav > button {
  width: 30px; height: 30px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
}
.ferie-monthnav > button:hover { border-color: var(--line-2); }
.ferie-month {
  min-width: 130px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.ferie-today { margin-left: 4px; }
.ferie-filters { display: flex; gap: 10px; flex-wrap: wrap; }

/* Pallino profilo (foto o iniziali) */
.ferie-av {
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}
.ferie-av img { width: 100%; height: 100%; object-fit: cover; }

/* Nota quando il mese non ha ferie (il calendario resta comunque visibile) */
.ferie-empty-note {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
}

/* ── Vista calendario ───────────────────────────────────────────────────────── */
.ferie-cal { margin-top: 4px; }
.ferie-cal-wd {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.ferie-cal-wd-cell {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0 4px;
}
.ferie-cal-wd-cell.weekend { color: var(--muted-2); }

.ferie-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.ferie-cal-day {
  position: relative;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ferie-cal-day.blank { background: transparent; border: 0; min-height: 0; }
.ferie-cal-day.weekend { background: var(--bg-2); }
.ferie-cal-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ferie-cal-day.has-ferie { cursor: default; }
.ferie-cal-daynum {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-feature-settings: 'tnum';
}
.ferie-cal-day.today .ferie-cal-daynum { color: var(--accent-ink); }

/* Cluster di pallini */
.ferie-cal-avs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
}
.ferie-cal-avs .ferie-av { margin-left: -8px; }
.ferie-cal-avs .ferie-av:first-child { margin-left: 0; }
.ferie-cal-more {
  margin-left: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

/* Popover in hover */
.ferie-cal-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: 230px;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.14);
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s;
}
.ferie-cal-day:hover .ferie-cal-pop { opacity: 1; visibility: visible; }
.ferie-cal-pop-head {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.ferie-cal-pop-list { display: flex; flex-direction: column; gap: 7px; }
.ferie-cal-pop-row { display: flex; align-items: center; gap: 8px; }
.ferie-cal-pop-info { min-width: 0; display: flex; flex-direction: column; }
.ferie-cal-pop-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ferie-cal-pop-sub {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ferie-pop-badge-permesso { color: var(--accent); font-weight: 500; }

/* ── Export CSV modal ────────────────────────────────────────────────────── */
.ecm-modal { width: 460px; }
.ecm-desc { font-size: 13px; color: var(--ink-2); margin: 0; }

.ecm-range {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.ecm-range-col { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.ecm-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.ecm-pickers { display: flex; gap: 5px; }
.ecm-year-sel { width: 74px; flex-shrink: 0; }
.ecm-arrow { font-size: 14px; color: var(--muted-2); padding-bottom: 6px; }

.ecm-warn { font-size: 12px; color: var(--danger); margin: 0; }

.ecm-preview {
  font-size: 13px;
  color: var(--ink-2);
  padding: 9px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.ecm-preview-num { font-weight: 600; color: var(--ink); }
.ecm-preview-empty { color: var(--muted); }

.ecm-template {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.ecm-template-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.ecm-template-cols { display: flex; flex-wrap: wrap; gap: 4px; }
.ecm-col-chip {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 3px 7px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
}

/* ── Anteprima assegnazione slot ─────────────────────────────────────────── */
.ap-preview { display: flex; flex-direction: column; gap: 14px; }
.ap-pv-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.ap-pv-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.ap-pv-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ap-pv-summary { font-size: 12px; color: var(--ink-2); text-align: right; }
.ap-pv-warn { color: var(--danger); }

.ap-pv-controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.ap-pv-ctl { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ap-pv-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.ap-pv-toggle button {
  border: none; background: var(--bg); color: var(--muted);
  font-size: 12px; padding: 6px 12px; cursor: pointer;
}
.ap-pv-toggle button + button { border-left: 1px solid var(--line-2); }
.ap-pv-toggle button.active { background: var(--ink); color: var(--bg); }

.ap-pv-weeks { display: flex; flex-wrap: wrap; gap: 18px; }
.ap-pv-week { flex: 0 0 auto; }
.ap-pv-wlabel { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.ap-pv-grid {
  display: grid;
  grid-template-columns: 28px repeat(5, 26px);
  grid-auto-rows: 18px;
  gap: 2px;
}
.ap-pv-corner { }
.ap-pv-dh { font-size: 10px; color: var(--muted-2); text-align: center; line-height: 18px; }
.ap-pv-hr { font-size: 9px; color: var(--muted-2); line-height: 18px; }
.ap-pv-cell { border-radius: 3px; border: 1px solid var(--line); background: var(--bg); }
.ap-pv-cell.free { background: var(--bg); }
.ap-pv-cell.busy { background: var(--line-2); border-color: var(--line-2); }
.ap-pv-cell.off {
  background: repeating-linear-gradient(45deg, var(--bg-2), var(--bg-2) 3px, var(--line-2) 3px, var(--line-2) 4px);
  border-color: var(--line-2);
}
.ap-pv-cell.planned { background: var(--accent); border-color: var(--accent-ink); }
.ap-pv-cell.past {
  background: repeating-linear-gradient(45deg, var(--bg), var(--bg) 3px, var(--bg-2) 3px, var(--bg-2) 4px);
  opacity: 0.6;
}
.ap-pv-cell.clickable { cursor: pointer; }
.ap-pv-cell.clickable.free:hover { background: var(--accent-soft); border-color: var(--accent); }
.ap-pv-cell.clickable.planned:hover { background: var(--accent-ink); }

/* Hint editing manuale */
.ap-pv-edit-hint {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 12px; color: var(--muted); margin-top: 4px;
}
.ap-pv-reset {
  border: 1px solid var(--line-2); background: var(--bg); color: var(--ink-2);
  font-size: 11px; padding: 3px 10px; border-radius: 16px; cursor: pointer;
}
.ap-pv-reset:hover { border-color: var(--ink); color: var(--ink); }
.ap-pv-manual { color: var(--accent-ink); }

.ap-pv-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11px; color: var(--muted); align-items: center; }
.ap-pv-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ap-pv-legend i.ap-pv-cell { width: 12px; height: 12px; display: inline-block; }
