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

/* Toggle Switch Styles */
.toggle-switch {
  position: relative;
  width: 50px;
  height: 28px;
  display: inline-block;
}

.toggle-input {
  display: none;
}

.toggle-label {
  display: block;
  cursor: pointer;
  background: #c6c6c8;
  border-radius: 28px;
  position: relative;
  transition: background-color 0.3s;
  height: 28px;
}

.toggle-switch-handle {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked + .toggle-label {
  background: #34c759;
}

.toggle-input:checked + .toggle-label .toggle-switch-handle {
  transform: translateX(22px);
}

.info-box {
  background: #f0f9ff;
  border: 1px solid #007aff30;
  border-radius: 8px;
  padding: 12px 16px;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 24px;
  font-weight: 700;
  color: #007aff;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.role-badge {
  background: #007aff;
  color: white;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
}

.role-badge.visitor {
  background: #34c759;
}

.btn {
  background: #007aff;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.btn:hover {
  background: #0056cc;
  transform: translateY(-1px);
}

.btn.secondary {
  background: #007aff;
}

.btn.secondary:hover {
  background: #0056cc;
}

.btn.danger {
  background: #ff3b30;
}

.btn.danger:hover {
  background: #d70015;
}

.btn.refresh {
  background: #34c759;
  position: relative;
  min-width: 180px;
  text-align: center;
}

.btn.refresh:hover {
  background: #28a745;
}

.btn.refresh.loading {
  background: #34c759;
  cursor: not-allowed;
  opacity: 0.8;
}

.btn.refresh .spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

.btn.refresh.loading .spinner {
  display: inline-block;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e5e7;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: #007aff;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr 1fr;
  gap: 16px;
  align-items: end;
}

.entries-grid {
  overflow-x: auto;
}

.entries-table {
  width: 100%;
  border-collapse: collapse;
}

.entries-header,
.entry-item {
  border-bottom: 1px solid #F2F2F7;
}

.entries-header {
  background: #F2F2F7;
  font-weight: 600;
}

.entries-header th,
.entry-item td {
  padding: 12px;
  text-align: left;
}

.entry-select-cell {
  text-align: center;
  width: 24px;
}

.entry-date {
  font-weight: 600;
  color: #1d1d1f;
  white-space: nowrap;
}

.entry-hours {
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.entry-ticket {
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.entry-description {
  color: #3a3a3c;
}

.entry-invoice {
  color: #3a3a3c;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.invoice-assign-bar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: linear-gradient(135deg, #007aff, #5ac8fa);
  color: white;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
}

.stat-number {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-label {
  opacity: 0.9;
  font-size: 14px;
}

.tabs {
  display: flex;
  background: #f2f2f7;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
}

.tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}

.tab:link,
.tab:visited,
.tab:hover,
.tab:active {
  text-decoration: none;
  color: inherit;
}

.tab.active {
  background: white;
  color: #007aff;
}

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #007aff, #5ac8fa);
}

.login-card {
  background: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

.login-title {
  text-align: center;
  margin-bottom: 32px;
  font-size: 28px;
  font-weight: 700;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.alert.error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

.alert.success {
  background: #e8f5e8;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid #e5e5e7;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f2f2f7;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
  background: #f2f2f7;
}

.autocomplete-wrapper {
  position: relative;
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .entry-item {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .entries-header {
    display: none;
  }

  .header {
    flex-direction: column;
    gap: 16px;
  }
}
