:root{
  --bg0:#0b0f17;
  --bg1:#0f1724;

  --panel: rgba(255,255,255,.06);
  --panel2: rgba(255,255,255,.085);
  --stroke: rgba(255,255,255,.14);

  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.62);

  --tile: rgba(255,255,255,.075);
  --tileStroke: rgba(255,255,255,.12);

  --shadow: 0 20px 60px rgba(0,0,0,.55);

  --redDark: #b01f2f;
  --redDark2: rgba(176,31,47,.22);

  /* colori pallini per settimana (riga del mese) */
  --dotW1: #8b5cf6; /* viola */
  --dotW2: #b01f2f; /* rosso scuro */
  --dotW3: #22c55e; /* verde */
  --dotW4: #3b82f6; /* blu */
  --dotW5: #f59e0b; /* arancione */
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(110,140,255,.16), transparent 60%),
    radial-gradient(900px 500px at 80% 20%, rgba(255,120,180,.10), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

/* ---------- TOPBAR ---------- */
.topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 18px 18px 14px;
  background: linear-gradient(180deg, rgba(11,15,23,.92), rgba(11,15,23,.70));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.toprow{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 12px;
}

.title{
  margin:0;
  font-size: 22px;
  letter-spacing: .2px;
  font-weight: 750;
}

.sub{
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  text-transform: capitalize;
}

.sub2{
  margin-top: 10px;
  color: rgba(255,255,255,.72);
  font-size: 13px;
  text-transform: capitalize;
}

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

/* ---------- BUTTONS ---------- */
.btn{
  appearance:none;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover{ background: rgba(255,255,255,.10); }
.btn:active{ transform: translateY(1px); }
.btn:disabled{ opacity:.5; cursor:not-allowed; transform:none; }

.btn.primary{
  border-color: rgba(139,92,246,.40);
  background: rgba(139,92,246,.20);
}
.btn.primary:hover{ background: rgba(139,92,246,.26); }

.btn.ghost{ background: transparent; }

/* ---------- DROPDOWN ---------- */
.dropdown{ position: relative; }

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

.ddCount{
  display:inline-grid;
  place-items:center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.85);
  font-size: 12px;
  font-weight: 800;
}

.ddMenu{
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 260px;
  border-radius: 16px;
  background: rgba(15,23,36,.92);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: var(--shadow);
  padding: 10px;
  display: none;
  z-index: 30;
}
.ddMenu.open{ display:block; }

.ddTitle{
  font-weight: 800;
  margin: 4px 6px 8px;
  color: rgba(255,255,255,.88);
}

.ddItem{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  margin-bottom: 8px;
}
.ddItem:hover{ background: rgba(255,255,255,.06); }
.ddItem input{ width: 16px; height: 16px; }

.ddActions{
  display:flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}

/* ---------- STAGE / NAV ---------- */
.stage{
  min-height: calc(100vh - 140px);
  display:grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items:center;
  gap: 12px;
  padding: 18px;
}

.navArrow{
  height: 56px;
  width: 56px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.88);
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  display:grid;
  place-items:center;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.navArrow:hover{ background: rgba(255,255,255,.09); }
.navArrow:active{ transform: translateY(1px); }

.monthFrame{ display:grid; place-items:center; }

/* ---------- MONTH CARD (più grande) ---------- */
.monthCard{
  width: min(980px, 100%);
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.monthHeader{
  padding: 18px 18px 12px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
}

.monthName{
  margin:0;
  font-size: 18px;
  font-weight: 800;
  text-transform: capitalize;
}

.pill{
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--panel2);
  border: 1px solid var(--stroke);
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}

.monthBody{ padding: 12px 18px 18px; }

/* ---------- DAYS OF WEEK ---------- */
.dow{
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.dow span{
  text-align:center;
  font-size: 12px;
  color: rgba(255,255,255,.72);
  letter-spacing: .2px;
  padding: 10px 0;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
}

.dow span.weekend{
  color: rgba(255,255,255,.90);
  background: var(--redDark2);
  border-color: rgba(176,31,47,.35);
}

/* ---------- DAYS GRID ---------- */
.days{
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}

.day{
  height: 64px;
  border-radius: 18px;
  background: var(--tile);
  border: 1px solid var(--tileStroke);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 16px;
  font-weight: 850;
  color: var(--text);
  position: relative;
  user-select: none;
  cursor: pointer;
}

.day.muted{ opacity: .25; cursor: default; }

.day.today{
  outline: 2px solid rgba(110,140,255,.55);
  outline-offset: 2px;
}

.day.weekend{
  color: rgba(255,255,255,.92);
  border-color: rgba(176,31,47,.30);
  background: rgba(176,31,47,.12);
}

.day.holiday{
  color: rgba(255,255,255,.95);
  border-color: rgba(176,31,47,.45);
  background: rgba(176,31,47,.18);
}

.day.selected{
  outline: 2px solid rgba(139,92,246,.60);
  outline-offset: 2px;
  background: rgba(139,92,246,.14);
  border-color: rgba(139,92,246,.35);
}

/* pallino: solo struttura */
.day.hasTrip::before{
  content:"";
  position:absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

/* colori pallino per settimana */
.day.dot-w1.hasTrip::before{ background: var(--dotW1); box-shadow: 0 0 0 4px rgba(139,92,246,.16); }
.day.dot-w2.hasTrip::before{ background: var(--dotW2); box-shadow: 0 0 0 4px rgba(176,31,47,.16); }
.day.dot-w3.hasTrip::before{ background: var(--dotW3); box-shadow: 0 0 0 4px rgba(34,197,94,.16); }
.day.dot-w4.hasTrip::before{ background: var(--dotW4); box-shadow: 0 0 0 4px rgba(59,130,246,.16); }
.day.dot-w5.hasTrip::before{ background: var(--dotW5); box-shadow: 0 0 0 4px rgba(245,158,11,.16); }

/* ---------- TOOLTIP ---------- */
.tooltip{
  position: fixed;
  z-index: 80;
  display: none;
  max-width: 320px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15,23,36,.94);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: var(--shadow);
  color: rgba(255,255,255,.92);
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
}
.tooltip.show{ display: block; }
.tooltip b{ color: rgba(255,255,255,.95); }

/* ---------- MODAL ---------- */
.modalOverlay{
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  z-index: 50;
}
.modalOverlay.open{ display: grid; }

.modal{
  width: min(560px, 96vw);
  border-radius: 18px;
  background: rgba(15,23,36,.92);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modalHeader{
  padding: 14px 14px 10px;
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.modalTitle{ font-weight: 800; letter-spacing: .2px; }
.modalSub{
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  text-transform: capitalize;
}

.iconBtn{
  appearance:none;
  background: transparent;
  border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.85);
  width: 36px;
  height: 36px;
  border-radius: 12px;
  cursor:pointer;
}

/* ---------- FORM ---------- */
.form{
  padding: 14px;
  display:grid;
  gap: 12px;
}

.field{ display:grid; gap: 6px; }
.field span{ font-size: 12px; color: var(--muted); }

.field input,
.field textarea,
.field select{
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  outline: none;
}

.field input:focus,
.field textarea:focus,
.field select:focus{
  border-color: rgba(139,92,246,.40);
  box-shadow: 0 0 0 4px rgba(139,92,246,.12);
}

.twoCol{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.formActions{
  display:flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 2px;
}

/* chips */
.chips{ display:flex; flex-wrap: wrap; gap: 8px; }
.chip{
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.86);
  font-size: 12px;
  font-weight: 800;
}

/* overtime box */
.overtimeBox{
  border-radius: 16px;
  background: rgba(139,92,246,.10);
  border: 1px solid rgba(139,92,246,.22);
  padding: 12px;
}
.otTop{ display:flex; align-items:center; justify-content: space-between; gap: 10px; }
.otTitle{ font-weight: 900; letter-spacing: .2px; }
.otValue{ font-weight: 900; }
.otSub{ margin-top: 6px; color: rgba(255,255,255,.72); font-size: 12px; }

/* riepilogo list */
.list{ display:grid; gap: 10px; }
.item{
  border-radius: 16px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  padding: 12px;
}
.itemTitle{ font-weight: 900; }
.itemMeta{ color: rgba(255,255,255,.70); font-size: 12px; margin-top: 6px; }
.itemPeople{ margin-top: 8px; display:flex; flex-wrap: wrap; gap: 6px; }
.itemActions{ display:flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }

/* multi-day type */
.typeGrid{ display:grid; gap: 10px; }

@media (max-width: 520px){
  .stage{ grid-template-columns: 52px 1fr 52px; }
  .navArrow{ width: 46px; height: 46px; border-radius: 16px; font-size: 30px; }
  .day{ height: 54px; border-radius: 16px; }
  .twoCol{ grid-template-columns: 1fr; }
  .monthCard{ width: 100%; }
}
