:root {
  --bg: #f7f8fb;
  --text: #202124;
  --card: #ffffff;
  --muted: #5f6368;
  --line: #d0d7de;
  --dark: #111827;
}

* {
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1.4;
}

header {
  padding: 1rem 1rem 0.5rem;
  text-align: center;
}

.account-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.account-email,
.account-sync,
.status-text {
  color: var(--muted);
}

.account-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.status-text.error {
  color: #b91c1c;
}

h1 {
  margin: 0;
}

.brand-logo {
  display: block;
  width: min(320px, 80vw);
  height: auto;
  margin: 0 auto;
}

.subtitle {
  color: var(--muted);
  margin: 0.25rem 0 0;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.status-card {
  max-width: 1180px;
  margin: 0 auto;
}

h2 {
  margin-top: 0;
  font-size: 1.4rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
}

input,
select,
textarea,
button {
  font-size: 1rem;
  padding: 0.6rem;
  border-radius: 12px;
  border: 1px solid var(--line);
}

button {
  background: var(--dark);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.16);
}

.grid {
  display: grid;
  gap: 0.75rem;
}

.two-col {
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
}

.full-width {
  grid-column: 1 / -1;
}

.chip-list,
.schedule-list {
  padding: 0;
  margin: 0.8rem 0 0;
  list-style: none;
  display: grid;
  gap: 0.6rem;
}

.service-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.service-actions {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}

.btn-sm {
  background: #374151;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.btn-danger {
  background: #b91c1c;
}

.btn-secondary {
  background: #e5e7eb;
  color: var(--dark);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  border-radius: 1000px;
  font-weight: 700;
  color: #fff;
}

.schedule-item {
  border-left: 12px solid #2f80ed;
  padding: 0;
  border-radius: 14px;
  background: #f9fafb;
  overflow: hidden;
}

.schedule-meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.schedule-button {
  width: 100%;
  text-align: left;
  color: inherit;
  background: transparent;
  border: none;
  padding: 0.8rem 1rem;
  box-shadow: none;
  transform: none;
}

.schedule-button:hover,
.schedule-button:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(47, 128, 237, 0.16);
}

#empty-state {
  color: var(--muted);
}

.calendar-card {
  padding: 1rem;
}

.calendar-header,
.calendar-toolbar,
.calendar-tabs,
.calendar-nav,
.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.calendar-header,
.calendar-toolbar {
  justify-content: space-between;
  flex-wrap: wrap;
}

.calendar-copy {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.calendar-title {
  margin: 0;
  font-size: 1.2rem;
}

.calendar-nav-btn,
.calendar-today-btn,
.view-tab,
.modal-close {
  min-height: 48px;
}

.calendar-today-btn {
  min-width: 96px;
}

.view-tab {
  background: #eef2f7;
  color: var(--dark);
  border: 1px solid transparent;
  min-width: 92px;
}

.view-tab.active {
  background: var(--dark);
  color: #fff;
}

.calendar-shell {
  margin-top: 1rem;
  border-radius: 18px;
  border: 1px solid #edf0f3;
  overflow: hidden;
  background: #fff;
  min-height: 640px;
  position: relative;
}

#calendar {
  padding: 0.5rem;
}

.fc {
  --fc-border-color: #edf0f3;
  --fc-button-text-color: #fff;
  --fc-button-bg-color: var(--dark);
  --fc-button-border-color: var(--dark);
  --fc-button-hover-bg-color: #1f2937;
  --fc-button-hover-border-color: #1f2937;
  --fc-button-active-bg-color: #1f2937;
  --fc-button-active-border-color: #1f2937;
  --fc-page-bg-color: #fff;
  --fc-neutral-bg-color: #f8fafc;
  --fc-today-bg-color: rgba(47, 128, 237, 0.08);
  font-size: 0.95rem;
}

.fc .fc-toolbar {
  display: none;
}

.fc .fc-scrollgrid,
.fc .fc-timegrid-slot,
.fc .fc-timegrid-axis,
.fc .fc-daygrid-day,
.fc .fc-col-header-cell {
  border-color: #edf0f3;
}

.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number,
.fc .fc-timegrid-axis-cushion,
.fc .fc-timegrid-slot-label-cushion {
  padding: 0.75rem 0.55rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.fc .fc-daygrid-day-number {
  font-size: 1rem;
}

.fc .fc-timegrid-slot-label-cushion,
.fc .fc-timegrid-axis-cushion {
  font-size: 0.9rem;
}

.fc .fc-event {
  border: none;
  border-radius: 14px;
  padding: 0.2rem 0.3rem;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.fc .fc-event:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.16);
}

.fc .fc-event-main {
  padding: 0.15rem 0.3rem;
  overflow: hidden;
}

.fc .calendar-event-content {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.fc .calendar-event-title,
.fc .calendar-event-time {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fc .calendar-event-time {
  opacity: 0.9;
}

.fc .focused-calendar-day {
  background: rgba(47, 128, 237, 0.12);
}

.fc .focused-calendar-day .fc-daygrid-day-number {
  color: #1d4ed8;
}

.fc .fc-timegrid-event .fc-event-main {
  padding: 0.35rem 0.45rem;
}

.fc .fc-highlight {
  background: rgba(47, 128, 237, 0.12);
}

/* Prevent FullCalendar's internal scroller from interfering with page scroll */
.fc .fc-scroller {
  overflow: auto !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 0.75rem;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100dvh - 1.5rem);
  overflow: auto;
  background: #fff;
  border-radius: 22px;
  padding: 1rem;
  box-shadow: 0 20px 50px rgba(17, 24, 39, 0.2);
}

.modal-header {
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.modal-header h2 {
  margin-bottom: 0;
}

.modal-close {
  background: #eef2f7;
  color: var(--dark);
  border: none;
  min-width: 48px;
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.modal-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.auth-page {
  min-height: 100vh;
}

.auth-shell {
  max-width: 560px;
}

.auth-card {
  display: grid;
  gap: 1rem;
}

.auth-copy,
.setup-copy {
  margin: 0;
  color: var(--muted);
}

.auth-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.auth-actions > button {
  flex: 1 1 180px;
}

/* ─── Tablet breakpoint ─────────────────────────────────────── */
@media (max-width: 768px) {
  .calendar-shell {
    min-height: 520px;
  }

  .calendar-header {
    gap: 0.5rem;
  }

  .calendar-title {
    font-size: 1.05rem;
  }

  .fc .fc-col-header-cell-cushion,
  .fc .fc-daygrid-day-number,
  .fc .fc-timegrid-axis-cushion,
  .fc .fc-timegrid-slot-label-cushion {
    padding: 0.65rem 0.4rem;
  }

  .modal-card {
    padding: 0.85rem;
  }

  .modal-actions {
    gap: 0.5rem;
  }
}

/* ─── Mobile breakpoint ─────────────────────────────────────── */
@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  header {
    padding: 0.75rem 0.75rem 0.4rem;
  }

  .brand-logo {
    width: min(240px, 70vw);
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .account-bar {
    gap: 0.5rem;
    font-size: 0.85rem;
  }

  main {
    padding: 0.75rem;
    gap: 0.75rem;
  }

  .card {
    padding: 0.85rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  .calendar-shell {
    min-height: calc(100dvh - 220px);
  }

  .calendar-header {
    gap: 0.4rem;
  }

  .calendar-copy {
    display: none;
  }

  .calendar-tabs,
  .calendar-nav,
  .modal-actions,
  .auth-actions {
    width: 100%;
  }

  .calendar-tabs > button,
  .calendar-nav > button,
  .modal-actions > button,
  .auth-actions > button {
    flex: 1 1 0;
  }

  .view-tab {
    min-width: 0;
    font-size: 0.9rem;
  }

  .fc {
    font-size: 0.85rem;
  }

  .fc .fc-timegrid-axis-cushion,
  .fc .fc-timegrid-slot-label-cushion,
  .fc .fc-col-header-cell-cushion,
  .fc .fc-daygrid-day-number {
    padding: 0.5rem 0.25rem;
  }

  .fc .fc-event-title,
  .fc .fc-event-time {
    font-size: 0.8rem;
  }

  .modal-card {
    padding: 0.75rem;
    border-radius: 16px;
    max-height: calc(100dvh - 1rem);
  }

  .modal-header h2 {
    font-size: 1.1rem;
  }

  .modal-actions {
    flex-direction: column;
    gap: 0.4rem;
  }

  .modal-actions > button {
    width: 100%;
  }

  .schedule-button {
    padding: 0.7rem 0.85rem;
  }

  .schedule-meta {
    font-size: 0.85rem;
  }

  input,
  select,
  textarea {
    font-size: 16px; /* prevent iOS auto-zoom on focus */
  }
}
