/* Wolfy Widget Giornata */
#wolfy-giornata-widget {
  position: fixed;
  z-index: 2050;
  right: 24px;
  bottom: 24px;
  width: 360px;
  max-width: calc(100vw - 24px);
  background: #1e2a3a;
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  font-size: 12px;
  user-select: none;
  display: none;
}

#wolfy-giornata-widget.is-visible {
  display: block;
}

#wolfy-giornata-widget.is-minimized {
  width: auto;
  min-width: 0;
  border-radius: 10px;
}

#wolfy-giornata-widget.is-minimized .wg-body {
  display: none;
}

#wolfy-giornata-widget.is-minimized .wg-header {
  border-radius: 10px;
  padding: 6px 8px;
}

#wolfy-giornata-widget.is-minimized .wg-title {
  display: none;
}

.wg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #162030;
  border-radius: 10px 10px 0 0;
}

.wg-drag-grip {
  cursor: grab;
}

.wg-drag-grip:active {
  cursor: grabbing;
}

.wg-header-icon {
  opacity: 0.85;
}

.wg-header .wg-title {
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: 1;
  text-transform: uppercase;
  font-size: 11px;
  opacity: 0.9;
  cursor: default;
}

.wg-timer-display {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13px;
  min-width: 64px;
  text-align: right;
}

.wg-timer-display.is-running {
  color: #7dffa3;
}

.wg-header .wg-btn-icon {
  background: transparent;
  border: 0;
  color: #adb5bd;
  padding: 0 2px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.wg-header .wg-btn-icon:hover {
  color: #fff;
}

.wg-header .wg-btn-new {
  color: #7dffa3;
}

.wg-header .wg-btn-new:hover {
  color: #b6ffcf;
}

.wg-body {
  padding: 8px 10px 10px;
}

.wg-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
  overflow: hidden;
}

.wg-chip-wrap {
  position: relative;
  min-width: 0;
}

.wg-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 30px;
  padding: 4px 18px 4px 6px;
  border-radius: 6px;
  border: 2px solid transparent;
  background: #2b3b50;
  color: #fff;
  font-weight: 700;
  font-size: 10px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.wg-chip-code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.wg-chip-close {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  padding: 0;
  cursor: pointer;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wg-chip-close:hover {
  background: #dc3545;
}

.wg-chip.is-active {
  border-color: #7dffa3;
  box-shadow: 0 0 0 1px rgba(125, 255, 163, 0.35);
}

.wg-chip.is-must {
  outline: 1px solid rgba(220, 53, 69, 0.55);
}

.wg-chip.is-secondary {
  opacity: 0.95;
}

.wg-secondary-toggle {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 4px 6px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  background: transparent;
  color: #ced4da;
  font-size: 10px;
  cursor: pointer;
}

.wg-secondary-toggle:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}

.wg-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.wg-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: #2b3b50;
  border: 0;
  border-radius: 6px;
  color: #e9ecef;
  padding: 6px 2px;
  cursor: pointer;
  font-size: 10px;
  line-height: 1.1;
}

.wg-action i {
  font-size: 16px;
}

.wg-action:hover {
  background: #3a4d66;
  color: #fff;
}

.wg-action.is-active {
  background: #198754;
  color: #fff;
}

.wg-action.wg-danger {
  background: #c82333;
  color: #fff;
}

.wg-action.wg-danger:hover,
.wg-action.wg-danger.is-active {
  background: #a71d2a;
  color: #fff;
}

.wg-empty {
  grid-column: 1 / -1;
  opacity: 0.65;
  font-style: italic;
  margin-bottom: 4px;
}

.wg-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  min-height: 18px;
}

.wg-status-line {
  flex: 1;
  min-width: 0;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.wg-time-boxes {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}

.wg-time-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 16px;
  padding: 0 3px;
  background: #ffc107;
  color: #111;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border-radius: 3px;
  line-height: 1;
  white-space: nowrap;
}

/* Interrupt modal */
#wg-interrupt-modal .modal-content {
  border-radius: 8px;
}

#wg-interrupt-results .list-group-item {
  cursor: pointer;
}

#wg-interrupt-results .list-group-item:hover {
  background: #f1f5f9;
}

@media (max-width: 767px) {
  #wolfy-giornata-widget {
    display: none !important;
  }
}

/* === Calendario chiusura giornata (zoom + scroll 0–24h) === */
.giornata-day-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.giornata-day-toolbar .btn {
  min-width: 36px;
}

.giornata-day-viewport {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #fff;
  max-width: 100%;
}

.giornata-day-inner {
  position: relative;
  min-height: 140px;
}

.giornata-day-cal {
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: #fff;
}

.giornata-day-hours {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 10px;
  color: #64748b;
  position: sticky;
  top: 0;
  z-index: 2;
}

.giornata-day-hours span {
  flex: none;
  text-align: left;
  padding: 4px 0 4px 2px;
  border-right: 1px solid #edf2f7;
  box-sizing: border-box;
}

.giornata-day-track {
  position: relative;
  height: 160px;
  background-color: #fff;
}

.giornata-day-track::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, #edf2f7 1px, transparent 1px);
  background-size: var(--gd-hour-px, 96px) 100%;
  pointer-events: none;
}

.giornata-day-workband {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(32, 201, 151, 0.06);
  border-left: 1px dashed rgba(32, 201, 151, 0.45);
  border-right: 1px dashed rgba(32, 201, 151, 0.45);
  pointer-events: none;
  z-index: 0;
}

.giornata-day-block {
  position: absolute;
  top: 8px;
  height: 48px;
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  padding: 6px 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  cursor: default;
  min-width: 8px;
  box-sizing: border-box;
  z-index: 1;
}

.giornata-day-block.is-resizable {
  cursor: grab;
}

.giornata-day-block .gd-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  z-index: 3;
  background: rgba(255, 255, 255, 0.15);
}

.giornata-day-block .gd-handle-left {
  left: 0;
  border-radius: 4px 0 0 4px;
}

.giornata-day-block .gd-handle-right {
  right: 0;
  border-radius: 0 4px 4px 0;
}

.giornata-day-block .gd-handle:hover {
  background: rgba(255, 255, 255, 0.45);
}

.giornata-day-block.is-dragging {
  opacity: 0.9;
  z-index: 5;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
}

.giornata-day-block.is-linked {
  box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.85);
}

.giornata-day-block strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.giornata-day-block small {
  opacity: 0.9;
  display: block;
  pointer-events: none;
}

.giornata-timeline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid #eee;
}

.giornata-timeline-row.is-editing {
  background: #fff8e1;
}
