:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e3e8f0;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --gray: #9ca3af;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 32px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 58px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { font-weight: 700; font-size: 17px; }
.nav { display: flex; gap: 6px; }
.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 500;
}
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.active { background: var(--primary); color: #fff; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.page-head h1 { margin: 0; font-size: 24px; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 16px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.metrics.three { grid-template-columns: repeat(3, 1fr); }
.metrics.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 800px) {
  .metrics, .metrics.three, .metrics.four { grid-template-columns: repeat(2, 1fr); }
}
.metric {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.metric.accent { background: linear-gradient(135deg, #2563eb, #1e40af); color: #fff; border: none; }
.metric.accent .metric-label, .metric.accent .metric-sub { color: rgba(255,255,255,0.85); }
.metric-label { font-size: 13px; color: var(--muted); }
.metric-value { font-size: 30px; font-weight: 700; margin: 4px 0; }
.metric-sub { font-size: 12px; color: var(--muted); }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.data-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.data-table tr:last-child td { border-bottom: none; }
.clickable { cursor: pointer; }
.clickable:hover { background: var(--bg); }
.muted { color: var(--muted); }

.search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
.badge.scheduled { background: var(--primary); }
.badge.completed { background: var(--green); }
.badge.cancelled { background: var(--gray); }
.badge.no_show   { background: var(--red); }
.badge.cat       { background: #475569; }

/* Financials: hidden/blurred by default until revealed */
.finance-card .finance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.finance-card .finance-head h2 { margin: 0; }
.small { font-size: 12px; font-weight: 500; }
.btn.small { padding: 6px 12px; font-size: 13px; }

/* When hidden, blur every .money element and block interaction */
body.hide-money .money {
  filter: blur(7px);
  user-select: none;
  pointer-events: none;
  transition: filter .15s ease;
}
.money { transition: filter .15s ease; }

/* Buttons */
.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #f3c4c4; }
.btn.danger:hover { background: #fdecec; }

/* Legend */
.legend { display: flex; gap: 18px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend .dot, .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.hidden, .hidden { display: none; }
.modal {
  background: var(--card);
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h2 { margin: 0 0 16px; font-size: 19px; }
.modal label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.modal label.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.modal input[type=text], .modal input[type=email], .modal input[type=date],
.modal input[type=time], .modal input[type=number], .modal select, .modal textarea {
  width: 100%;
  margin-top: 5px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
.modal .row { display: flex; gap: 12px; }
.modal .row label { flex: 1; }
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.modal-actions .spacer { flex: 1; }

/* FullCalendar tweaks */
#calendar { font-size: 14px; }
.fc .fc-button-primary { background: var(--primary); border-color: var(--primary); }
.fc .fc-button-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.fc .fc-daygrid-day:hover { background: #eef2ff; cursor: pointer; }
.fc-event { cursor: pointer; }
