body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background: #f4f6fa;
  color: #111827;
}

.wrap {
  width: min(1120px, 96vw);
  margin: 20px auto;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.nav-buttons {
  display: flex;
  gap: 8px;
}

.nav-btn {
  padding: 8px 16px;
  font-size: 14px;
}

.nav-btn.active {
  background: #005f73;
}

.nav-btn:not(.active) {
  background: #9aa5b1;
}

.card {
  background: #fff;
  border: 1px solid #dbe2ec;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

.grid,
.filters {
  display: grid;
  gap: 10px;
}

.filters {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.analytics-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 20px;
}

label {
  display: grid;
  gap: 4px;
  font-size: 14px;
}

input,
select {
  border: 1px solid #c8d1de;
  border-radius: 8px;
  padding: 9px;
  font-family: inherit;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 700;
  background: #005f73;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}

.btn.ghost {
  background: #9aa5b1;
}

.btn:hover {
  opacity: 0.9;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  border-bottom: 1px solid #e5eaf1;
  text-align: left;
  padding: 8px;
  vertical-align: top;
  font-size: 13px;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  color: #4b5563;
}

.hidden {
  display: none;
}

#status {

  /* ── Calendar ── */
  .card-sub {
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: -4px;
    margin-bottom: 1rem;
  }

  .calendar-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    font-weight: 600;
  }

  .cal-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .cal-indicator.connected    { background: #22c55e; box-shadow: 0 0 6px #22c55e88; }
  .cal-indicator.disconnected { background: #9ca3af; }

  .cal-error {
    margin-top: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    color: #b91c1c;
    font-size: 0.875rem;
  }
  font-weight: 700;
}

/* Analytics Dashboard Styles */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.metric-card {
  background: linear-gradient(135deg, #005f73 0%, #00a4a4 100%);
  border-radius: 12px;
  padding: 20px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 95, 115, 0.15);
}

.metric-label {
  font-size: 12px;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
}

.analytics-sections {
  display: grid;
  gap: 24px;
}

.analytics-section {
  border-top: 2px solid #dbe2ec;
  padding-top: 16px;
}

.analytics-section h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #005f73;
}

.analytics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.analytics-row .analytics-section {
  border-top: none;
  padding-top: 0;
  background: #f9fafc;
  padding: 12px;
  border-radius: 8px;
}

.analytics-row .analytics-section h3 {
  margin-top: 0;
}

.data-table {
  overflow-x: auto;
}

.data-table table {
  width: 100%;
  font-size: 12px;
}

.data-table th,
.data-table td {
  padding: 10px 8px;
  text-align: left;
}

.data-table td {
  border-bottom: 1px solid #e5eaf1;
}

.data-table tr:hover {
  background: #f9fafc;
}

.count-badge {
  background: #e0f2f1;
  color: #005f73;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
}

.revenue-badge {
  background: #fff3e0;
  color: #e65100;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
}

/* ── Appointment modal ───────────────────────────────────────── */
.appt-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.appt-modal.hidden {
  display: none;
}

.appt-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 30, 40, 0.55);
}

.appt-modal-card {
  position: relative;
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.appt-modal-card h3 {
  margin: 0 0 16px 0;
  color: #005f73;
  font-size: 18px;
}

.appt-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: #9aa5b1;
}

.appt-modal-close:hover {
  color: #005f73;
}

.appt-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #eef2f6;
  font-size: 14px;
}

.appt-row:last-child {
  border-bottom: none;
}

.appt-key {
  color: #6b7785;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.03em;
  padding-top: 2px;
}

.appt-val {
  color: #1a2733;
  word-break: break-word;
}

.appt-val a {
  color: #00a4a4;
  font-weight: 600;
}
