:root {
  --navy: #0f172a;
  --navy-light: #1e293b;
  --nardo: #9ca3af;
  --nardo-dark: #6b7280;
  --text: #f1f5f9;
  --accent: #38bdf8;
  --ok: #10b981;
  --danger: #ef4444;
  --radius: 1.1rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #1e293b 0%, #0f172a 55%, #0f172a 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 0.75rem 5rem;
}

/* HEADER */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .6rem;
}

.user-badge {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  background: linear-gradient(160deg, rgba(56,189,248,.9), rgba(15,23,42,1));
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #0f172a;
  border: 2px solid rgba(241,245,249,.4);
  box-shadow: 0 5px 12px rgba(0,0,0,.25);
}

.app-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: .01em;
  text-align: center;
  flex: 1;
}

.icon-btn {
  background: rgba(156,163,175,.08);
  border: 1px solid rgba(148,163,184,.15);
  color: #fff;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: .8rem;
  cursor: pointer;
  font-size: 1.05rem;
}

/* MESE */
.month-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-bottom: .5rem;
}

.round-btn {
  background: rgba(15,23,42,.35);
  border: 1px solid rgba(148,163,184,.20);
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 1.25rem;
  cursor: pointer;
}

.month-label {
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: capitalize;
}

/* GIORNI SETTIMANA */
.weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(2rem, 1fr));
  gap: .4rem;
  text-align: center;
  font-size: .65rem;
  color: rgba(241,245,249,.45);
  margin-bottom: .35rem;
  text-transform: uppercase;
}

/* CALENDARIO */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(2.3rem, 1fr));
  gap: .4rem;
}

.day {
  background: rgba(15,23,42,.35);
  border: 1px solid rgba(148,163,184,.08);
  border-radius: .9rem;
  min-height: 4.4rem;
  padding: .35rem .4rem .4rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  cursor: pointer;
  transition: .12s ease-out;
  position: relative;
}

.day:hover {
  border: 1px solid rgba(56,189,248,.5);
}

.day .num {
  font-weight: 600;
  font-size: .9rem;
}

.day.empty {
  background: transparent;
  border: none;
  cursor: default;
}

.badges {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.badge {
  font-size: .6rem;
  padding: .1rem .4rem .15rem;
  border-radius: 999px;
  border: 1px solid transparent;
  line-height: 1;
  white-space: nowrap;
}

.badge.work {
  background: rgba(56,189,248,.12);
  border-color: rgba(56,189,248,.3);
  color: #e2f3ff;
}

.badge.extra {
  background: rgba(16,185,129,.12);
  border-color: rgba(16,185,129,.35);
  color: #e8fff6;
}

.badge.absence {
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.35);
  color: #fee2e2;
}

.badge.trip {
  background: rgba(244,244,245,.1);
  border-color: rgba(244,244,245,.25);
  color: #fff;
  display: flex;
  align-items: center;
  gap: .1rem;
}

.day.is-absence {
  background: rgba(239,68,68,.08);
  border-color: rgba(239,68,68,.35);
}

.day.is-extra {
  background: rgba(16,185,129,.08);
  border-color: rgba(16,185,129,.35);
}

.day.is-work {
  background: rgba(56,189,248,.05);
  border-color: rgba(56,189,248,.25);
}

/* POPUP (SHEET) */
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.4);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  z-index: 50;
  transition: opacity .15s ease-out;
}

.sheet.hidden {
  opacity: 0;
  pointer-events: none;
}

.sheet-inner {
  background: rgba(15,23,42,1);
  width: min(100%, 490px);
  border-top-left-radius: 1.3rem;
  border-top-right-radius: 1.3rem;
  border: 1px solid rgba(148,163,184,.12);
  box-shadow: 0 -10px 35px rgba(0,0,0,.3);
  display: flex;
  flex-direction: column;
  max-height: 100vh;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .8rem 1rem .5rem;
  border-bottom: 1px solid rgba(148,163,184,.05);
}

.sheet-header h2 {
  font-size: 1rem;
  margin: 0;
}

.close-btn {
  background: rgba(148,163,184,.08);
  border: 1px solid rgba(148,163,184,.15);
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 1.1rem;
  cursor: pointer;
}

.sheet-body {
  padding: .5rem 1rem 1rem;
  overflow-y: auto;
  gap: .4rem;
  display: flex;
  flex-direction: column;
}

label {
  font-size: .7rem;
  margin-top: .35rem;
  margin-bottom: .2rem;
  color: rgba(241,245,249,.8);
}

input, select, textarea {
  width: 100%;
  background: rgba(15,23,42,.4);
  border: 1px solid rgba(148,163,184,.12);
  border-radius: .65rem;
  padding: .45rem .6rem;
  color: #fff;
  font-size: .8rem;
}

textarea {
  resize: vertical;
  min-height: 3.4rem;
}

.row {
  display: flex;
  gap: .4rem;
}

.row > div {
  flex: 1;
}

.toggle-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
}

.toggle-label {
  font-size: .7rem;
  color: rgba(241,245,249,.7);
}

/* SWITCH */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

.switch input { display: none; }

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(148,163,184,.2);
  border-radius: 999px;
  transition: .15s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 999px;
  transition: .15s;
}

.switch input:checked + .slider {
  background: rgba(56,189,248,.6);
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* BOTTONI */
.primary-btn {
  background: var(--accent);
  border: none;
  border-radius: .85rem;
  padding: .6rem 1rem;
  color: #0f172a;
  font-weight: 600;
  margin: .4rem 1rem 1rem;
  cursor: pointer;
  font-size: .85rem;
}

.save-msg {
  margin: 0 .8rem .8rem;
  font-size: .7rem;
  color: rgba(241,245,249,.6);
}
.export-box {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}



/* RESPONSIVE */
  @media (min-width: 768px) {
  .sheet {
    align-items: center;
  }
  .sheet-inner {
    border-radius: 1.3rem;
    max-height: 85vh;
  }
  .calendar {
    min-height: 480px;
  }
}
@media (min-width: 480px) {
  .day {
    min-height: 5.2rem;
  }
}
.user-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}
.user-role {
  font-size: 0.65rem;
  color: rgba(241,245,249,0.7);
  margin-top: -0.2rem;
}
