* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  min-height: 100vh;
}

#app {
  width: 100%;
  min-height: 100vh;
}

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.card {
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.card-center {
  max-width: 400px;
  margin: auto;
  text-align: center;
}

.card-center h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #1a1a1a;
}

.card-center p {
  color: #555;
  margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: #1a73e8;
  color: #fff;
}

.btn-primary:hover {
  background: #1557b0;
}

.btn-outline {
  background: #fff;
  color: #1a73e8;
  border: 2px solid #1a73e8;
}

.btn-outline:hover {
  background: #e8f0fe;
}

.btn-secondary {
  background: transparent;
  color: #666;
  border: 1px solid #ddd;
}

.btn-secondary:hover {
  background: #f5f5f5;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-danger {
  background: #c62828;
  color: #fff;
}

.btn-danger:hover {
  background: #b71c1c;
}

/* Header */
.admin-header {
  background: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-header h1 {
  font-size: 1.2rem;
  color: #1a1a1a;
  white-space: nowrap;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.month-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a1a1a;
  min-width: 160px;
  text-align: center;
}

.btn-nav {
  background: #f0f2f5;
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-nav:hover {
  background: #e0e2e5;
}

/* Alert banner */
.alert-banner {
  background: #fff3e0;
  border-left: 4px solid #f57c00;
  padding: 0.75rem 1.5rem;
  margin: 0.5rem 1rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #333;
}

.alert-banner .alert-text {
  flex: 1;
}

.alert-banner .btn-exclude {
  background: #f57c00;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 1rem;
  white-space: nowrap;
}

.alert-banner .btn-exclude:hover {
  background: #e65100;
}

.leave-admin-section {
  margin: 0.75rem 1rem 0;
  padding: 1rem 1.25rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.leave-admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.leave-admin-heading h2 { font-size: 1rem; }
.admin-leave-item { padding: 0.9rem 0; border-top: 1px solid #eee; font-size: 0.9rem; }
.admin-leave-item:first-child { margin-top: 0.75rem; }
.admin-leave-item span { margin-left: 0.75rem; color: #555; }
.admin-leave-item p { margin: 0.35rem 0; color: #444; }
.admin-leave-actions { display: flex; gap: 0.5rem; }
.admin-leave-empty { margin-top: 0.75rem; color: #777; font-size: 0.9rem; }

/* Grid */
.grid-wrapper {
  flex: 1;
  overflow-x: auto;
  padding: 1rem;
}

.presenze-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  font-size: 0.85rem;
}

.presenze-grid th,
.presenze-grid td {
  padding: 0.5rem 0.4rem;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
  min-width: 36px;
}

.presenze-grid th {
  background: #fafafa;
  font-weight: 600;
  color: #555;
  position: sticky;
  top: 0;
  font-size: 0.8rem;
}

.presenze-grid th.weekend,
.presenze-grid th.holiday {
  color: #bbb;
  background: #f8f8f8;
}

.day-cell.leave { font-weight: 700; cursor: pointer; }
.day-cell.leave-vacation { color: #1565c0; background: #e3f2fd; }
.day-cell.leave-permission { color: #6a1b9a; background: #f3e5f5; }

.presenze-grid th.name-col {
  text-align: left;
  padding-left: 1rem;
  min-width: 160px;
  position: sticky;
  left: 0;
  background: #fafafa;
  z-index: 2;
}

.presenze-grid td.name-cell {
  text-align: left;
  padding-left: 1rem;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
}

.presenze-grid td.day-cell {
  cursor: pointer;
  transition: background 0.15s;
  font-weight: 500;
}

.presenze-grid td.day-cell:hover {
  background: #e8f0fe;
}

.presenze-grid td.day-cell.present {
  color: #2e7d32;
}

.presenze-grid td.day-cell.present.late {
  color: #b85c00;
  background: #fff3e0;
}

.presenze-grid td.day-cell.present.late:hover {
  background: #ffe0b2;
}

.presenze-grid td.day-cell.absent {
  color: #c62828;
}

.presenze-grid td.day-cell.weekend,
.presenze-grid td.day-cell.holiday {
  color: #ccc;
  cursor: default;
  background: #fafafa;
}

.presenze-grid td.day-cell.weekend:hover,
.presenze-grid td.day-cell.holiday:hover {
  background: #fafafa;
}

/* Footer */
.admin-footer {
  background: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s;
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.modal-header h2 {
  font-size: 1.1rem;
  color: #1a1a1a;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #888;
  padding: 0.25rem;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  padding: 1.5rem;
}

.modal-body .detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f5f5f5;
}

.modal-body .detail-row:last-child {
  border-bottom: none;
}

.modal-body .detail-label {
  color: #888;
  font-size: 0.9rem;
}

.modal-body .detail-value {
  font-weight: 600;
  color: #333;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Time picker */
.time-picker-wrapper {
  margin: 1rem 0;
}

.time-picker-wrapper label {
  display: block;
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 0.4rem;
}

.time-picker-wrapper select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 1rem;
  background: #fafafa;
  cursor: pointer;
}

.time-picker-wrapper select:focus {
  outline: none;
  border-color: #1a73e8;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .admin-header h1 {
    font-size: 1rem;
    width: 100%;
    text-align: center;
  }

  .header-center {
    order: 2;
  }

  .header-right {
    order: 3;
  }

  .admin-footer {
    flex-direction: column;
  }

  .admin-footer .btn {
    width: 100%;
    text-align: center;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
