:root {
  --pbc-bg: #0f172a;
  --pbc-panel: rgba(255, 255, 255, 0.88);
  --pbc-border: rgba(15, 23, 42, 0.1);
  --pbc-text: #0f172a;
  --pbc-muted: #64748b;
  --pbc-accent: #2563eb;
  --pbc-accent-strong: #1d4ed8;
  --pbc-success: #16a34a;
  --pbc-success-soft: rgba(22, 163, 74, 0.12);
  --pbc-warn: #dc2626;
  --pbc-warn-soft: rgba(220, 38, 38, 0.12);
  --pbc-open: rgba(37, 99, 235, 0.12);
  --pbc-booked: rgba(22, 163, 74, 0.14);
  --pbc-shadow: 0 24px 48px rgba(15, 23, 42, 0.16);
  --pbc-radius-xl: 24px;
  --pbc-radius-lg: 18px;
  --pbc-radius-md: 14px;
  --pbc-transition: 180ms ease;
}

.pbc-wrapper * {
  box-sizing: border-box;
}

.pbc-wrapper {
  color: var(--pbc-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.16), transparent 35%),
    radial-gradient(circle at bottom left, rgba(22, 163, 74, 0.14), transparent 30%),
    linear-gradient(135deg, #eff6ff, #f8fafc 55%, #eef2ff);
  border-radius: 32px;
  padding: 24px;
  box-shadow: var(--pbc-shadow);
  overflow: hidden;
}

.pbc-shell {
  background: var(--pbc-panel);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: var(--pbc-radius-xl);
  backdrop-filter: blur(18px);
  padding: 22px;
}

.pbc-toolbar,
.pbc-toolbar-group,
.pbc-toolbar-group-right,
.pbc-segmented,
.pbc-form-actions,
.pbc-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pbc-toolbar {
  justify-content: space-between;
  margin-bottom: 12px;
}

.pbc-current-range {
  font-weight: 700;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  letter-spacing: -0.02em;
}

.pbc-btn,
.pbc-segmented-btn,
.pbc-event,
.pbc-week-card,
.pbc-mini-add,
.pbc-link {
  transition: transform var(--pbc-transition), box-shadow var(--pbc-transition), background var(--pbc-transition), color var(--pbc-transition), border-color var(--pbc-transition), opacity var(--pbc-transition);
}

.pbc-btn,
.pbc-segmented-btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}

.pbc-btn:hover,
.pbc-segmented-btn:hover,
.pbc-event:hover,
.pbc-week-card:hover,
.pbc-mini-add:hover {
  transform: translateY(-1px);
}

.pbc-btn-primary {
  background: linear-gradient(135deg, var(--pbc-accent), var(--pbc-accent-strong));
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
}

.pbc-btn-primary:hover {
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.3);
}

.pbc-btn-secondary,
.pbc-segmented-btn {
  background: rgba(255,255,255,0.9);
  border-color: var(--pbc-border);
  color: var(--pbc-text);
}

.pbc-segmented {
  background: rgba(148, 163, 184, 0.12);
  padding: 4px;
  border-radius: 999px;
}

.pbc-segmented-btn.is-active {
  background: #fff;
  color: var(--pbc-accent);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.pbc-legend {
  margin-bottom: 14px;
  color: var(--pbc-muted);
  font-size: 0.95rem;
}

.pbc-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pbc-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.pbc-dot-open { background: var(--pbc-accent); }
.pbc-dot-booked { background: var(--pbc-success); }

.pbc-feedback {
  min-height: 24px;
  margin: 6px 0 16px;
  font-weight: 600;
}

.pbc-feedback.is-success { color: var(--pbc-success); }
.pbc-feedback.is-error { color: var(--pbc-warn); }
.pbc-feedback.is-info { color: var(--pbc-accent); }

.pbc-weekdays,
.pbc-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}

.pbc-weekdays {
  margin-bottom: 12px;
}

.pbc-weekday {
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--pbc-muted);
  padding: 0 4px;
  font-weight: 700;
}

.pbc-day {
  min-height: 160px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: var(--pbc-radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.pbc-day::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.26));
  opacity: 0;
  transition: opacity var(--pbc-transition);
  pointer-events: none;
}

.pbc-day:hover::after,
.pbc-day.is-selected::after {
  opacity: 1;
}

.pbc-day.is-muted {
  opacity: 0.6;
}

.pbc-day.is-today {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.pbc-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pbc-day-number {
  font-weight: 800;
  font-size: 1rem;
}

.pbc-mini-add {
  border: none;
  background: rgba(37, 99, 235, 0.1);
  color: var(--pbc-accent);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.pbc-day-events,
.pbc-week-column-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pbc-empty,
.pbc-week-empty {
  color: var(--pbc-muted);
  font-size: 0.88rem;
  padding: 10px;
  border: 1px dashed rgba(148,163,184,0.35);
  border-radius: 12px;
  background: rgba(248,250,252,0.7);
}

.pbc-event,
.pbc-week-card {
  width: 100%;
  border: 1px solid transparent;
  text-align: left;
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

.pbc-event.is-open,
.pbc-week-card.is-open {
  background: linear-gradient(135deg, #fff, var(--pbc-open));
  border-color: rgba(37, 99, 235, 0.18);
}

.pbc-event.is-booked,
.pbc-week-card.is-booked {
  background: linear-gradient(135deg, #fff, var(--pbc-booked));
  border-color: rgba(22, 163, 74, 0.18);
}

.pbc-event-time,
.pbc-week-card-time,
.pbc-week-card-status {
  display: block;
  color: var(--pbc-muted);
  font-size: 0.84rem;
  margin-bottom: 4px;
}

.pbc-event-title {
  display: block;
  font-weight: 700;
  line-height: 1.3;
}

.pbc-week-columns {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}

.pbc-week-column {
  background: rgba(255,255,255,0.84);
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: var(--pbc-radius-lg);
  min-height: 280px;
  padding: 12px;
}

.pbc-week-column.is-today {
  border-color: rgba(37, 99, 235, 0.35);
}

.pbc-week-column-head {
  margin-bottom: 12px;
}

.pbc-week-column-day {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pbc-muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.pbc-week-column-date {
  font-size: 1rem;
  font-weight: 700;
}

.pbc-modal[hidden] { display: none; }

.pbc-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.pbc-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(6px);
}

.pbc-modal-dialog {
  position: relative;
  width: min(760px, calc(100vw - 28px));
  margin: 5vh auto;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 26px;
  box-shadow: 0 28px 70px rgba(15,23,42,0.28);
  padding: 28px;
  max-height: 90vh;
  overflow: auto;
}

.pbc-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  border: none;
  background: transparent;
  color: var(--pbc-muted);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.pbc-modal-subtitle {
  color: var(--pbc-muted);
  margin-top: -6px;
  margin-bottom: 18px;
}

.pbc-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pbc-form-full {
  grid-column: 1 / -1;
}

.pbc-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  color: var(--pbc-text);
}

.pbc-form input,
.pbc-form textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,0.35);
  background: rgba(248,250,252,0.9);
  padding: 12px 14px;
  color: var(--pbc-text);
  outline: none;
}

.pbc-form input:focus,
.pbc-form textarea:focus {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.pbc-form-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.pbc-event-detail p {
  margin: 0 0 10px;
}

.pbc-status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

.pbc-status-pill.is-open {
  background: var(--pbc-open);
  color: var(--pbc-accent);
}

.pbc-status-pill.is-booked {
  background: var(--pbc-booked);
  color: var(--pbc-success);
}

.pbc-divider {
  border: none;
  border-top: 1px solid rgba(148,163,184,0.22);
  margin: 20px 0;
}

.pbc-link {
  color: var(--pbc-accent);
  font-weight: 700;
  text-decoration: none;
}

.pbc-link:hover {
  color: var(--pbc-accent-strong);
}

body.pbc-modal-open {
  overflow: hidden;
}

@media (max-width: 980px) {
  .pbc-weekdays,
  .pbc-grid,
  .pbc-week-columns {
    gap: 10px;
  }

  .pbc-day {
    min-height: 140px;
  }
}

@media (max-width: 860px) {
  .pbc-toolbar {
    align-items: flex-start;
  }

  .pbc-weekdays,
  .pbc-grid,
  .pbc-week-columns,
  .pbc-form-grid {
    grid-template-columns: 1fr;
  }

  .pbc-day {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .pbc-wrapper {
    padding: 14px;
    border-radius: 24px;
  }

  .pbc-shell {
    padding: 16px;
    border-radius: 20px;
  }

  .pbc-modal-dialog {
    width: calc(100vw - 16px);
    margin: 2vh auto;
    padding: 20px;
  }

  .pbc-btn,
  .pbc-segmented-btn {
    width: 100%;
    justify-content: center;
  }

  .pbc-toolbar-group,
  .pbc-toolbar-group-right {
    width: 100%;
  }
}
