* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--tg-theme-bg-color, #ffffff);
  color: var(--tg-theme-text-color, #000000);
}

#app { padding: 12px 12px 32px; }

.header {
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.back {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--tg-theme-link-color, #2481cc);
  padding: 0;
}

.list { display: flex; flex-direction: column; gap: 8px; }

.card {
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
}

.card-title { font-weight: 600; }
.card-sub { font-size: 13px; opacity: 0.7; margin-top: 4px; }

.card-actions { display: flex; gap: 8px; margin-top: 8px; }
.card-actions button {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.card-actions .confirm-booking { background: #1a7a3a; color: #fff; }
.card-actions .reject-booking { background: #b3261e; color: #fff; }

.empty { opacity: 0.6; padding: 16px; text-align: center; }
.loading { padding: 24px; text-align: center; opacity: 0.6; }
.error { padding: 24px; color: #b3261e; text-align: center; }

.detail p { line-height: 1.5; margin: 6px 0; }

.calendar-section, .list-section { margin-top: 20px; }
.calendar-section h3, .list-section h3 { font-size: 16px; margin-bottom: 8px; }

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 600;
}

.cal-nav {
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
  color: inherit;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-weekdays { margin-bottom: 4px; }

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
}

.cal-cell.weekday { font-weight: 600; opacity: 0.6; aspect-ratio: auto; padding: 4px 0; }
.cal-cell.empty { background: none; }
.cal-cell.available { background: #d4f4dd; color: #1a7a3a; }
.cal-cell.pending { background: #fff4cc; color: #a67c00; }
.cal-cell.booked { background: #fde2e1; color: #b3261e; }
.cal-cell.unavailable { background: var(--tg-theme-secondary-bg-color, #f4f4f5); opacity: 0.5; }
.cal-cell.clickable { cursor: pointer; }
.cal-cell.clickable:active { transform: scale(0.95); }

.cal-cell.in-range { background: #cfe8ff; color: #0a4a87; }
.cal-cell.range-start, .cal-cell.range-end {
  background: var(--tg-theme-button-color, #2481cc);
  color: var(--tg-theme-button-text-color, #fff);
}

.cal-selection {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.cal-selection-actions { display: flex; gap: 8px; }

.cal-selection-actions button {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.cal-confirm {
  background: var(--tg-theme-button-color, #2481cc);
  color: var(--tg-theme-button-text-color, #fff);
}

.cal-reset {
  background: var(--tg-theme-bg-color, #fff);
  color: inherit;
  border: 1px solid #ccc !important;
}

.cal-legend {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.7;
  flex-wrap: wrap;
}

.legend-item { display: flex; align-items: center; gap: 4px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.available { background: #1a7a3a; }
.dot.pending { background: #d4a900; }
.dot.booked { background: #b3261e; }
.dot.unavailable { background: #999; }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }

.tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  color: inherit;
  cursor: pointer;
  font-size: 14px;
}

.tab.active {
  background: var(--tg-theme-button-color, #2481cc);
  color: var(--tg-theme-button-text-color, #fff);
}

.form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }

.form input, .form select, .form textarea {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 14px;
  background: var(--tg-theme-bg-color, #fff);
  color: var(--tg-theme-text-color, #000);
  font-family: inherit;
}

.form textarea { min-height: 70px; resize: vertical; }
.form .checkbox { flex-direction: row; align-items: center; gap: 8px; }
.form .checkbox input { width: auto; }

.form button[type="submit"], #add-provider {
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: var(--tg-theme-button-color, #2481cc);
  color: var(--tg-theme-button-text-color, #fff);
  font-size: 15px;
  cursor: pointer;
  margin-top: 8px;
}

#add-provider { margin-bottom: 12px; margin-top: 0; }

.footer-nav { margin-top: 20px; }

.footer-nav button {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  color: inherit;
  font-size: 15px;
  cursor: pointer;
}

.contact-section { margin-top: 20px; }
.contact-section h3 { font-size: 16px; margin-bottom: 4px; }
.contact-hint { font-size: 13px; opacity: 0.7; margin: 4px 0 10px; }

.contact-actions { display: flex; flex-direction: column; gap: 8px; }

.contact-btn {
  display: block;
  padding: 12px;
  border-radius: 10px;
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  color: inherit;
  text-align: center;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}

.contact-btn-primary {
  background: var(--tg-theme-button-color, #2481cc);
  color: var(--tg-theme-button-text-color, #fff);
  font-weight: 600;
}

.rating-section {
  margin-top: 20px;
  padding: 14px;
  border-radius: 12px;
  background: var(--tg-theme-secondary-bg-color, #f4f4f5);
  text-align: center;
}

.rating-summary { font-size: 14px; margin-bottom: 8px; }

.rating-stars { font-size: 28px; }

.star {
  cursor: pointer;
  opacity: 0.3;
  padding: 0 2px;
}

.star.filled { opacity: 1; }

.rating-mine { font-size: 12px; opacity: 0.7; margin-top: 6px; }
