:root {
  --primary: #080d1b;
  --primary-light: #1769ff;
  --background: #070b14;
  --surface: #101827;
  --text: #f1f5ff;
  --muted: #91a0b8;
  --border: #26344d;
  --radius: 14px;

  --sl-bg: #030b1c;
  --sl-panel: #071832;
  --sl-blue: #087cff;
  --sl-cyan: #00d9ff;
  --sl-white: #f3f7ff;
  --sl-muted: #a9c4ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding-bottom: 90px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse at 50% 0%, #102b59 0%, transparent 48%),
    linear-gradient(180deg, #030b1c, #020817 100%);
  color: var(--sl-white);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  background: var(--primary-light);
  color: white;
  cursor: pointer;
}

button:active {
  opacity: 0.8;
}

/* INTESTAZIONE SHIFTLOG */

.app-header {
  position: relative;
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: transparent;
  border-bottom: none;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
}

.brand-logo {
  display: block;
  width: 68px;
  height: 68px;
  flex-shrink: 0;
  color: var(--sl-blue);
  filter:
    drop-shadow(0 0 5px var(--sl-cyan))
    drop-shadow(0 0 13px rgba(0, 140, 255, .55));
}

.brand h1 {
  margin: 0;
  font-size: 39px;
  font-weight: 600;
  letter-spacing: -1.5px;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(0, 124, 255, .25);
}

.word-shift {
  color: #f5f7ff;
}

.word-log {
  color: #078cff;
  text-shadow: 0 0 9px rgba(0, 140, 255, .35);
}

.settings-button {
  position: static;
  transform: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  color: white;
  font-size: 35px;
  filter: drop-shadow(0 0 7px var(--sl-cyan));
}

.settings-button:active {
  background: transparent;
  opacity: .7;
}

/* CONTENITORE PRINCIPALE */

#app-content {
  width: min(100% - 24px, 800px);
  margin: 20px auto;
  padding: 12px;
  background: transparent;
  color: var(--text);
  border: none;
  border-radius: var(--radius);
  box-shadow: none;
}

/* CALENDARIO */

.calendar {
  width: 100%;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.calendar-header h2 {
  margin: 0;
  font-size: 20px;
  text-align: center;
}

.calendar-header button {
  min-width: 44px;
  font-size: 25px;
  padding: 7px;
}

.calendar-heading {
  display: grid;
  grid-template-columns: 58px 1fr 58px;
  align-items: center;
  gap: 10px;
  min-height: 76px;
  margin-bottom: 28px;
  padding: 8px;
  border: 2px solid var(--sl-blue);
  border-radius: 22px;
  background: linear-gradient(120deg, #09244b, #06142e, #09244b);
  box-shadow:
    0 0 8px var(--sl-blue),
    inset 0 0 18px rgba(0, 119, 255, .22);
}

.calendar-heading h2 {
  margin: 0;
  text-align: center;
  color: white;
  font-size: 24px;
  font-weight: 700;
}

.month-arrow {
  width: 52px;
  height: 54px;
  padding: 0;
  border: 1px solid var(--sl-blue);
  border-radius: 14px;
  background: linear-gradient(145deg, #103c79, #061a3c);
  color: var(--sl-cyan);
  font-size: 42px;
  line-height: 1;
  box-shadow:
    0 0 8px rgba(0, 124, 255, .7),
    inset 0 0 12px rgba(0, 217, 255, .15);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--sl-blue);
  border-radius: 22px;
  background: rgba(4, 17, 39, .9);
  box-shadow:
    0 0 8px rgba(0, 124, 255, .55),
    inset 0 0 20px rgba(0, 124, 255, .08);
}

.calendar-weekday {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  padding: 8px 0;
  background: linear-gradient(180deg, #102647, #09172d);
  color: #e7f2ff;
  border-right: 1px solid #29456c;
  border-bottom: 1px solid #29456c;
  font-size: 12px;
  font-weight: 700;
}

.calendar-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-width: 0;
  min-height: 112px;
  padding: 9px 5px;
  overflow: hidden;
  border: 0;
  border-right: 1px solid #29456c;
  border-bottom: 1px solid #29456c;
  border-radius: 0;
  background: rgba(5, 18, 40, .88);
  color: white;
  font-size: 15px;
  text-align: left;
}

.calendar-day.empty {
  background: rgba(3, 12, 28, .7);
  border: 0;
  pointer-events: none;
}

.calendar-day.today {
  background: #092752;
  color: white;
  box-shadow:
    inset 0 0 0 2px var(--sl-cyan),
    0 0 12px var(--sl-blue);
  border-radius: 10px;
  z-index: 1;
}

.day-number {
  margin-bottom: 7px;
  font-size: 16px;
  font-weight: 700;
}

/* EVENTI CALENDARIO */

.calendar-event {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  padding: 5px 2px;
  margin-top: 3px;
  border-radius: 9px;
  color: white;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

.calendar-event svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.calendar-event small {
  color: white;
  font-size: 9px;
}

.calendar-event.turno {
  background: linear-gradient(135deg, #087cff, #0649bb);
  box-shadow: 0 0 9px rgba(0, 124, 255, .65);
}

.calendar-event.ferie {
  background: linear-gradient(135deg, #00bd72, #00864f);
  box-shadow: 0 0 9px rgba(0, 220, 130, .5);
}

.calendar-event.malattia,
.calendar-event.infortunio {
  background: linear-gradient(135deg, #e52b50, #a90c31);
  box-shadow: 0 0 9px rgba(255, 35, 75, .45);
}

.calendar-event.permesso {
  background: linear-gradient(135deg, #8b36ed, #5514b4);
  box-shadow: 0 0 9px rgba(139, 54, 237, .5);
}

.calendar-event.festivita {
  background: linear-gradient(135deg, #ed3453, #a90c31);
  box-shadow: 0 0 9px rgba(237, 52, 83, .5);
}

.calendar-event.pnr,
.calendar-event.riposo {
  background: linear-gradient(135deg, #526a91, #263d60);
}

/* ASSEGNAZIONE RAPIDA */

.quick-assignment {
  margin-top: 28px;
  padding: 17px;
  border: 2px solid var(--sl-blue);
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(0, 111, 255, .17), transparent 65%),
    linear-gradient(145deg, #0a2041, #06142b 75%);
  box-shadow:
    0 0 9px rgba(0, 124, 255, .7),
    inset 0 0 22px rgba(0, 124, 255, .13);
}

.quick-assignment h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  color: white;
  font-size: 19px;
}

.quick-assignment h3 svg {
  width: 32px;
  height: 32px;
  fill: var(--sl-cyan);
  stroke: var(--sl-cyan);
  filter: drop-shadow(0 0 7px var(--sl-cyan));
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 12px;
}

.quick-field {
  min-width: 0;
}

.quick-field label {
  display: block;
  margin-bottom: 7px;
  color: white;
  font-size: 13px;
  font-weight: 600;
}

.input-icon {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 54px;
  padding: 0 9px;
  border: 1px solid #1769c9;
  border-radius: 13px;
  background: linear-gradient(145deg, #102c53, #07172f);
  box-shadow:
    inset 0 0 10px rgba(0, 124, 255, .12),
    0 0 5px rgba(0, 124, 255, .35);
}

.input-icon svg {
  width: 23px;
  height: 23px;
  flex-shrink: 0;
  fill: none;
  stroke: var(--sl-cyan);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.input-icon input,
.input-icon select {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 8px 2px;
  border: none;
  outline: none;
  background: transparent;
  color: white;
  font-size: 13px;
}

.input-icon select option {
  background: #07172f;
  color: white;
}

.quick-save {
  width: 100%;
  min-height: 57px;
  margin-top: 19px;
  border: 1px solid var(--sl-cyan);
  border-radius: 15px;
  background: linear-gradient(110deg, #087cff, #0755d8, #087cff);
  color: white;
  font-size: 15px;
  font-weight: 700;
  box-shadow:
    0 0 10px rgba(0, 124, 255, .8),
    inset 0 1px 8px rgba(255, 255, 255, .2);
}

.selected-date {
  margin: 12px 0 0;
  color: var(--sl-muted);
  font-size: 12px;
  text-align: center;
}

/* DETTAGLIO GIORNO */

.day-details {
  margin-top: 15px;
  color: white;
}

.day-entry {
  padding: 15px;
  border: 1px solid var(--sl-blue);
  border-radius: 14px;
  background: #0a1b35;
  box-shadow: 0 0 9px rgba(0, 124, 255, .3);
}

.day-entry button {
  margin-top: 8px;
}

/* IMPOSTAZIONI */

.backup-action {
  margin: 12px 0;
}

.settings-section .icon-action {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 13px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  margin: 0;
  background: #101e33;
  border: 1px solid #28518a;
  border-radius: 12px;
  color: #eaf3ff;
  text-align: left;
  font-size: 14px;
}

.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  background: #1769ff;
  color: #fff;
  font-size: 21px;
}

.backup-date {
  margin: 12px 2px 18px;
  color: #91a0b8;
  font-size: 12px;
}

.backup-date strong {
  color: #dce7f8;
  font-weight: 600;
}

#areaRipristino[hidden] {
  display: none !important;
}

#areaRipristino {
  margin-top: 14px;
  padding: 14px;
  background: #080f1d;
  border: 1px solid #263854;
  border-radius: 12px;
}

.settings-description {
  margin: 0 0 10px;
  color: #b6c3d8;
  font-size: 13px;
}

#areaRipristino textarea {
  display: block;
  width: 100%;
  min-height: 90px;
  margin: 0 0 12px;
  padding: 12px;
  background: #101827;
  color: #fff;
  border: 1px solid #30435f;
  border-radius: 9px;
  font-size: 13px;
  resize: vertical;
}

#areaRipristino button {
  margin: 0;
}

/* LEGENDA NASCOSTA */

.calendar-legend {
  display: none !important;
}

/* BARRA INFERIORE */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  justify-items: stretch;
  gap: 0;
  min-height: 0;
  padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #081d3c, #030b1c 90%);
  border: 1px solid #126bce;
  border-bottom: none;
  border-radius: 25px 25px 0 0;
  box-shadow:
    0 -5px 18px rgba(0, 110, 255, .25),
    inset 0 1px 12px rgba(0, 124, 255, .14);
}

.bottom-nav .nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  justify-self: stretch;
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 62px;
  gap: 4px;
  margin: 0;
  padding: 4px 2px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: #b7c9e8;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.bottom-nav .nav-item svg.nav-icon {
  display: block !important;
  flex: 0 0 30px !important;
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  max-width: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
  margin: 0 auto;
  overflow: visible;
  fill: none !important;
  stroke: #16c8ff !important;
  color: #16c8ff !important;
}

.bottom-nav .nav-item svg.nav-icon * {
  stroke: #16c8ff !important;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-nav .nav-item svg.nav-icon .bar,
.bottom-nav .nav-item svg.nav-icon .pie-fill {
  fill: #16c8ff !important;
}

.bottom-nav .nav-item span {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.bottom-nav .nav-item.active {
  background: transparent;
  color: var(--sl-cyan);
  text-shadow: 0 0 9px var(--sl-cyan);
}

.bottom-nav .nav-item.active svg.nav-icon {
  filter:
    drop-shadow(0 0 5px #00aaff)
    drop-shadow(0 0 9px #008cff);
}

.bottom-nav .nav-item.active::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 18%;
  right: 18%;
  height: 3px;
  border-radius: 5px;
  background: var(--sl-cyan);
  box-shadow:
    0 0 8px var(--sl-cyan),
    0 0 17px var(--sl-blue);
}

/* ADATTAMENTO SCHERMI PICCOLI */

@media (max-width: 420px) {
  .app-header {
    padding: 16px;
  }

  .brand {
    gap: 12px;
  }

  .brand-logo {
    width: 58px;
    height: 58px;
  }

  .brand h1 {
    font-size: 32px;
  }
}

@media (max-width: 390px) {
  .calendar-day {
    min-height: 94px;
    padding: 7px 3px;
  }

  .day-number {
    font-size: 14px;
  }

  .calendar-event {
    font-size: 9px;
  }

  .quick-assignment {
    padding: 12px;
  }

  .quick-grid {
    gap: 13px 8px;
  }

  .input-icon {
    padding: 0 5px;
  }

  .input-icon svg {
    width: 19px;
    height: 19px;
  }

  .input-icon input,
  .input-icon select {
    font-size: 11px;
  }
}

@media (max-width: 600px) {
  #app-content {
    padding: 12px;
  }
}

/* CORREZIONE CAMPI DATA - ASSEGNAZIONE RAPIDA */

.quick-assignment .quick-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 8px;
  width: 100%;
  min-width: 0;
}

.quick-assignment .quick-field {
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.quick-assignment .input-icon {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  height: 48px;
  gap: 4px;
  padding: 0 6px;
  overflow: hidden;
}

.quick-assignment .input-icon input[type="date"] {
  display: block;
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  max-width: 100%;
  height: 42px;
  padding: 4px 0;
  font-size: 11px;
  font-weight: 600;
  color: #f3fbff;
  color-scheme: dark;
  box-sizing: border-box;
}

.quick-assignment .input-icon input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}

@media (max-width: 390px) {
  .quick-assignment .quick-grid {
    gap: 10px 6px;
  }

  .quick-assignment .input-icon {
    padding: 0 4px;
    gap: 3px;
  }

  .quick-assignment .input-icon input[type="date"] {
    font-size: 10px;
  }
}

/* SALUTO PERSONALE */

.user-greeting {
  width: min(100% - 32px, 800px);
  margin: -4px auto 14px;
  padding: 5px 12px;
  color: #65DFFF;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .3px;
  text-align: center;
  text-shadow:
    0 0 6px rgba(0, 217, 255, .45),
    0 0 13px rgba(0, 124, 255, .25);
}

.user-greeting[hidden] {
  display: none !important;
}

/* BARRE FISSE E CONTENUTO */

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.app-header {
  flex: 0 0 auto;
}

#app-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  margin: 0 auto;
  padding-bottom: 110px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
}

html {
  background-color: #020817;
}

body {
  background-color: #020817;
}

.bottom-nav {
  bottom: 0;
  padding-bottom: calc(5px + env(safe-area-inset-bottom));
}

/* ==========================================
   SHIFTLOG - CALENDARIO RESPONSIVE
   OTTIMIZZAZIONE IPAD E TABLET
   ========================================== */

@media screen and (min-width: 700px) {

  .calendar-page {
    width: 100%;
    box-sizing: border-box;
  }

  .calendar-page .calendar-heading {
    min-height: 62px;
    margin-bottom: 14px;
    padding: 5px 8px;
  }

  .calendar-page .calendar-heading h2 {
    font-size: 22px;
  }

  .calendar-page .calendar-mode-bar {
    margin-bottom: 8px;
  }

  .calendar-page .calendar-grid {
    height: clamp(540px, calc(100dvh - 740px), 620px);
    grid-template-rows: 38px repeat(4, minmax(0, 1fr));
  }

  .calendar-page .calendar-grid:has(> .calendar-day:nth-child(36)) {
    grid-template-rows: 38px repeat(5, minmax(0, 1fr));
  }

  .calendar-page .calendar-grid:has(> .calendar-day:nth-child(43)) {
    grid-template-rows: 38px repeat(6, minmax(0, 1fr));
  }

  .calendar-page .calendar-weekday {
    min-height: 0;
    height: 38px;
    padding: 5px 0;
  }

  .calendar-page .calendar-day {
    min-height: 0;
    height: 100%;
    padding: 6px 4px;
    overflow: hidden;
  }

  .calendar-page .day-number {
    margin-bottom: 5px;
  }

  .calendar-page .calendar-event {
    font-size: 10px;
    padding: 4px 2px;
    margin-top: 2px;
  }

  .calendar-page .calendar-event svg {
    width: 19px;
    height: 19px;
  }

  .calendar-page .quick-assignment {
    margin-top: 14px;
    padding: 12px;
  }

  .calendar-page .quick-assignment h3 {
    margin-bottom: 10px;
    font-size: 17px;
  }

  .calendar-page .quick-start {
    margin-top: 5px;
  }

  .calendar-page #pannelloRapida:not([hidden]) {
    max-height: none;
  }
}

/* IPAD E TABLET CON POCA ALTEZZA */

@media screen and (min-width: 700px) and (max-height: 800px) {

  .calendar-page .calendar-heading {
    min-height: 54px;
    margin-bottom: 8px;
  }

  .calendar-page .calendar-grid {
    height: 540px;
  }

  .calendar-page .calendar-weekday {
    height: 32px;
  }

  .calendar-page .calendar-grid {
    grid-template-rows: 32px repeat(4, minmax(0, 1fr));
  }

  .calendar-page .calendar-grid:has(> .calendar-day:nth-child(36)) {
    grid-template-rows: 32px repeat(5, minmax(0, 1fr));
  }

  .calendar-page .calendar-grid:has(> .calendar-day:nth-child(43)) {
    grid-template-rows: 32px repeat(6, minmax(0, 1fr));
  }

  .calendar-page .quick-assignment {
    margin-top: 8px;
    padding: 9px;
  }
}

/* ASSEGNAZIONE RAPIDA APERTA */

@media screen and (min-width: 700px) {

  .calendar-page:has(#pannelloRapida:not([hidden])) {
    padding-bottom: 20px;
  }

  #app-content:has(.calendar-page #pannelloRapida:not([hidden])) {
    padding-bottom: 110px;
  }
}

/* ==========================================
   OTTIMIZZAZIONE ORIZZONTALE TABLET
   BARRE PIÙ COMPATTE, CALENDARIO INVARIATO
   ========================================== */

@media screen and (min-width: 700px)
       and (min-height: 600px)
       and (orientation: landscape) {

  .app-header {
    min-height: 76px;
    padding: 8px 20px;
  }

  .brand {
    gap: 13px;
  }

  .brand-logo {
    width: 48px;
    height: 48px;
  }

  .brand h1 {
    font-size: 29px;
    letter-spacing: -1px;
  }

  .settings-button {
    width: 42px;
    height: 42px;
    font-size: 30px;
  }

  #app-content {
    margin-top: 8px;
  }

  .bottom-nav {
    padding: 3px 8px calc(3px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
  }

  .bottom-nav .nav-item {
    min-height: 48px;
    gap: 2px;
    padding: 2px;
    font-size: 10px;
  }

  .bottom-nav .nav-item svg.nav-icon {
    flex: 0 0 24px !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
  }

  .bottom-nav .nav-item span {
    font-size: 10px;
    line-height: 1.1;
  }
}

/* ==========================================
   OTTIMIZZAZIONE ORIZZONTALE SMARTPHONE
   ========================================== */

@media screen and (orientation: landscape)
       and (max-height: 599px) {

  .app-header {
    min-height: 58px;
    padding: 5px 12px;
  }

  .brand {
    gap: 9px;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
  }

  .brand h1 {
    font-size: 25px;
    letter-spacing: -.8px;
  }

  .settings-button {
    width: 38px;
    height: 38px;
    font-size: 27px;
  }

  #app-content {
    margin-top: 6px;
    padding-bottom: 85px;
  }

  .bottom-nav {
    padding: 2px 5px calc(2px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
  }

  .bottom-nav .nav-item {
    min-height: 42px;
    gap: 1px;
    padding: 1px;
    font-size: 9px;
  }

  .bottom-nav .nav-item svg.nav-icon {
    flex: 0 0 21px !important;
    width: 21px !important;
    height: 21px !important;
    min-width: 21px !important;
    max-width: 21px !important;
    min-height: 21px !important;
    max-height: 21px !important;
  }

  .bottom-nav .nav-item span {
    font-size: 9px;
    line-height: 1.1;
  }
}

/* ==========================================
   PROTEZIONE SMARTPHONE IN VERTICALE
   ========================================== */

@media screen and (max-width: 699px)
       and (orientation: portrait) {

  .app-header {
    min-height: 0;
  }

  #app-content {
    padding-bottom: 100px;
  }

  .bottom-nav .nav-item {
    min-height: 56px;
  }
}

/* ==========================================
   SHIFTLOG - OTTIMIZZAZIONE TABLET VERTICALE
   PIÙ SPAZIO AL CALENDARIO
   ========================================== */

@media screen and (min-width: 700px)
       and (orientation: portrait) {

  .calendar-page .calendar-grid {
    height: 600px;
  }

  .calendar-page .calendar-day {
    padding: 7px 4px;
  }

  .calendar-page .day-number {
    margin-bottom: 6px;
  }

  .calendar-page .quick-assignment {
    margin-top: 9px;
    padding: 10px;
  }

  .calendar-page .quick-assignment h3 {
    margin-bottom: 8px;
  }

  #app-content {
    padding-bottom: 150px;
  }
}

/* ==========================================
   STRAORDINARIO - MAGGIORE LEGGIBILITÀ
   ========================================== */

.calendar-page .calendar-event .overtime-badge {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 3px auto 0;
  padding: 3px 5px;
  border: 1px solid rgba(101, 223, 255, .75);
  border-radius: 6px;
  color: #65DFFF;
  background: rgba(20, 137, 184, .25);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  text-align: center;
  box-sizing: border-box;
}

/* ==========================================
   CORREZIONE EVENTI - TABLET VERTICALE
   ICONA E NOME AFFIANCATI
   ORARIO E STRAORDINARIO SEMPRE LEGGIBILI
   ========================================== */

@media screen and (min-width: 700px)
       and (orientation: portrait) {

  .calendar-page .calendar-event {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-items: center;
    justify-items: center;
    column-gap: 3px;
    row-gap: 3px;
    width: 100%;
    min-width: 0;
    padding: 5px 3px;
    margin-top: 2px;
    font-size: 10px;
    line-height: 1.25;
    text-align: center;
    overflow: visible;
  }

  .calendar-page .calendar-event > svg {
    grid-column: 1;
    grid-row: 1;
    width: 19px;
    height: 19px;
    min-width: 19px;
    min-height: 19px;
    margin: 0;
    flex: none;
  }

  .calendar-page .calendar-event > span:not(.overtime-badge) {
    grid-column: 2;
    grid-row: 1;
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .calendar-page .calendar-event > .overtime-badge {
    grid-column: 1 / -1;
    grid-row: 2;
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 3px 6px;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .calendar-page .calendar-event > small {
    grid-column: 1 / -1;
    grid-row: 3;
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    color: #ffffff;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    text-align: center;
    letter-spacing: -.2px;
  }

  .calendar-page .calendar-event:not(:has(> .overtime-badge)) > small {
    grid-row: 2;
  }

  .calendar-page .calendar-day {
    overflow: hidden;
    min-width: 0;
  }
}

/* ==========================================
   CORREZIONE MIRATA STRAORDINARIO
   SOLO TABLET VERTICALE
   ========================================== */

@media screen and (min-width: 700px)
       and (orientation: portrait) {

  /* Recupera spazio sopra il turno, solo nei giorni interessati */

  .calendar-page .calendar-day:has(.overtime-badge) {
    padding-top: 4px;
  }

  .calendar-page .calendar-day:has(.overtime-badge) .day-number {
    margin-bottom: 2px;
  }

  /* Compatta il contenitore del turno con straordinario */

  .calendar-page .calendar-event:has(> .overtime-badge) {
    padding: 2px 3px;
    margin-top: 0;
    row-gap: 1px;
  }

  /* Icona leggermente più compatta */

  .calendar-page .calendar-event:has(> .overtime-badge) > svg {
    width: 17px;
    height: 17px;
    min-width: 17px;
    min-height: 17px;
  }

  /* Badge più basso, senza ridurre la leggibilità */

  .calendar-page .calendar-event:has(> .overtime-badge) > .overtime-badge {
    margin: 0 auto;
    padding: 1px 5px;
    font-size: 9px;
    line-height: 1.15;
  }

  /* Orario compatto ma sempre su una sola riga */

  .calendar-page .calendar-event:has(> .overtime-badge) > small {
    font-size: 9px;
    line-height: 1.15;
    letter-spacing: -.25px;
  }
}

