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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

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

/* Login page */
.login-box {
  max-width: 400px;
  margin: 100px auto;
  padding: 40px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.login-box h1 {
  text-align: center;
  margin-bottom: 30px;
  color: #2c3e50;
}

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

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

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
}

.form-group input:focus {
  outline: none;
  border-color: #3498db;
}

.error {
  background: #fee;
  color: #c00;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 20px;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: #3498db;
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-primary:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

.btn-secondary {
  background: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.login-box .btn {
  width: 100%;
  padding: 12px;
  font-size: 16px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #ddd;
}

.header h1 {
  color: #2c3e50;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-info {
  color: #666;
}

/* Controls */
.controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  padding: 15px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-group label {
  font-weight: 500;
}

.control-group input[type="number"] {
  width: 80px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.status {
  margin-left: auto;
  color: #666;
  font-size: 14px;
}

.status.error {
  color: #c00;
  background: none;
  padding: 0;
  margin-bottom: 0;
}

/* Tables */
.tables-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .tables-container {
    grid-template-columns: 1fr;
  }
}

.table-section {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.table-section h2 {
  padding: 15px 20px;
  background: #2c3e50;
  color: white;
  font-size: 16px;
}

.table-wrapper {
  max-height: 600px;
  overflow-y: auto;
}

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

th,
td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

th {
  background: #f8f9fa;
  font-weight: 600;
  position: sticky;
  top: 0;
}

tr:hover {
  background: #f8f9fa;
}

.loading,
.empty {
  text-align: center;
  color: #999;
  padding: 40px !important;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-btn {
  padding: 12px 24px;
  border: none;
  background: #f8f9fa;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  transition:
    background 0.2s,
    color 0.2s;
}

.tab-btn:hover {
  background: #e9ecef;
}

.tab-btn.active {
  background: #3498db;
  color: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Calendar Controls */
.calendar-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  padding: 15px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  flex-wrap: wrap;
}

.calendar-controls input[type="date"] {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.calendar-status {
  margin-left: auto;
  color: #666;
  font-size: 14px;
}

.calendar-status.error {
  color: #c00;
}

/* Calendar Container */
.calendar-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 20px;
}

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

#calendar-month-year {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
}

/* Calendar Grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day-header {
  text-align: center;
  font-weight: 600;
  color: #666;
  padding: 10px;
  font-size: 12px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: default;
  font-size: 14px;
  color: #999;
  background: #f8f9fa;
  position: relative;
  transition: transform 0.1s;
}

.calendar-day.other-month {
  color: #ccc;
  background: transparent;
}

.calendar-day.highlighted {
  background: #27ae60;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.calendar-day.highlighted:hover {
  background: #219a52;
  transform: scale(1.05);
}

.calendar-day.today {
  border: 2px solid #3498db;
}

/* Calendar Tooltip */
.calendar-tooltip {
  position: fixed;
  background: #2c3e50;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  max-width: 300px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.calendar-tooltip.visible {
  opacity: 1;
}

.calendar-tooltip .tooltip-title {
  font-weight: 600;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 6px;
}

.calendar-tooltip .tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 4px;
}

.calendar-tooltip .tooltip-label {
  color: #bdc3c7;
}

.calendar-tooltip .tooltip-value {
  font-weight: 500;
}

/* Mobile Responsive Styles */
@media (max-width: 600px) {
  .container {
    padding: 10px;
  }

  /* Header stacks vertically */
  .header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .header h1 {
    font-size: 20px;
  }

  .header-controls {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .header-controls .btn {
    width: 100%;
  }

  /* Tab navigation */
  .tab-nav {
    flex-direction: row;
  }

  .tab-btn {
    flex: 1;
    padding: 12px 8px;
    font-size: 13px;
  }

  /* Controls stack vertically */
  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .control-group {
    flex-direction: column;
    gap: 4px;
    width: 100%;
  }

  .control-group input[type="number"] {
    width: 100%;
  }

  .control-group .btn {
    width: 100%;
  }

  .status {
    margin-left: 0;
    text-align: center;
  }

  /* Tables */
  .table-wrapper {
    max-height: 400px;
  }

  th,
  td {
    padding: 8px 10px;
    font-size: 13px;
  }

  .table-section h2 {
    padding: 12px 15px;
    font-size: 14px;
  }

  /* Calendar Controls */
  .calendar-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .calendar-controls .control-group {
    flex-direction: column;
    gap: 4px;
  }

  .calendar-controls input[type="date"] {
    width: 100%;
  }

  .calendar-controls .btn {
    width: 100%;
  }

  .calendar-status {
    margin-left: 0;
    text-align: center;
  }

  /* Calendar Container */
  .calendar-container {
    padding: 12px;
  }

  .calendar-header {
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
  }

  .calendar-header .btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  #calendar-month-year {
    font-size: 16px;
    width: 100%;
    text-align: center;
    order: -1;
  }

  /* Calendar Grid */
  .calendar-grid {
    gap: 2px;
  }

  .calendar-day-header {
    padding: 6px;
    font-size: 11px;
  }

  .calendar-day {
    font-size: 12px;
    border-radius: 4px;
  }

  /* Tooltip - position at bottom on mobile */
  .calendar-tooltip {
    left: 10px !important;
    right: 10px !important;
    bottom: 20px !important;
    top: auto !important;
    max-width: none;
    font-size: 12px;
  }
}

/* Small phones */
@media (max-width: 380px) {
  .header h1 {
    font-size: 18px;
  }

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

  th,
  td {
    padding: 6px 8px;
    font-size: 12px;
  }

  .calendar-day {
    font-size: 11px;
  }

  .calendar-day-header {
    font-size: 10px;
  }
}
