/* Uniquely Paws — Main Stylesheet v3
   Design: Clean SaaS, Inter, white sidebar, brand red accents */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --brand:          #991415;
  --brand-dark:     #7a0f10;
  --brand-light:    #fef2f2;
  --brand-mid:      rgba(153,20,21,0.08);
  --brand-hover:    #e3dc58;

  --bg:             #f4f5f7;
  --surface:        #ffffff;
  --border:         #e5e7eb;
  --border-light:   #f3f4f6;

  --text-primary:   #111827;
  --text-secondary: #374151;
  --text-muted:     #6b7280;
  --text-subtle:    #9ca3af;

  --sidebar-w:      252px;
  --topbar-h:       64px;
  --radius:         10px;
  --radius-sm:      8px;
  --radius-xs:      6px;

  --shadow-xs:      0 1px 2px rgba(0,0,0,0.06);
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:         0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:      0 10px 25px rgba(0,0,0,0.08), 0 5px 10px rgba(0,0,0,0.04);
  --transition:     0.15s ease;

  /* backward-compat aliases for inline styles in templates */
  --clay:      var(--brand);
  --bark:      var(--text-primary);
  --text-sub:  var(--text-muted);
  --sand:      var(--border);
  --sand-dark: var(--border-dark);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-secondary);
  display: flex;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── LOGO IMAGES ─────────────────────────── */
.brand-logo-img {
  height: 36px;
  width: auto;
  max-width: 44px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
}

.login-logo-img {
  height: 80px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  display: block;
  margin: 0 auto 1rem;
}

/* ── LOGIN PAGE ──────────────────────────── */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fb;
  background-image: radial-gradient(ellipse at 30% 40%, rgba(153,20,21,0.06) 0%, transparent 60%);
  min-height: 100vh;
}

.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: fadeUp 0.4s ease both;
}

.login-brand { text-align: center; margin-bottom: 2rem; }

.login-logo {
  width: 52px; height: 52px;
  background: var(--brand);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  color: #fff;
  font-size: 1.3rem;
  box-shadow: 0 4px 12px rgba(153,20,21,0.3);
}

.login-brand h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.login-brand p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* ── SIDEBAR ─────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0 1rem;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  width: 32px; height: 32px;
  background: var(--brand);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.brand-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  display: block;
  line-height: 1.2;
}

.brand-role {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

.nav-links {
  list-style: none;
  padding: 0.75rem;
  flex: 1;
}

.nav-links li a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  border-radius: var(--radius-xs);
  margin-bottom: 2px;
}

.nav-links li a:hover {
  color: var(--text-primary);
  background: var(--border-light);
}

.nav-links li a.active {
  color: var(--brand);
  background: var(--brand-light);
  font-weight: 600;
}

.nav-links li a.active .nav-icon { color: var(--brand); }

.nav-icon {
  font-size: 0.85rem;
  width: 1rem;
  text-align: center;
  color: var(--text-subtle);
  flex-shrink: 0;
  transition: color var(--transition);
}

.nav-links li a:hover .nav-icon { color: var(--text-secondary); }

.nav-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0.5rem 0.75rem;
}

.sidebar-footer {
  padding: 0.875rem;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
}

.user-avatar {
  width: 30px; height: 30px;
  background: var(--brand);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 0.75rem;
  flex-shrink: 0;
}

.user-name {
  display: block;
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.user-role {
  font-size: 0.66rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition);
}

.logout-btn:hover {
  background: var(--brand-light);
  color: var(--brand);
}

/* ── MAIN CONTENT ────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.topbar-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.content-body {
  padding: 2rem 2.5rem;
  flex: 1;
}

/* ── PAGE HEADER ─────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.page-header-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-header-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ── FLASH MESSAGES ──────────────────────── */
.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  margin: 1rem 2rem 0;
  border-radius: var(--radius-sm);
  font-size: 0.855rem;
  font-weight: 500;
  animation: fadeDown 0.3s ease;
}

.flash-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.flash-error   { background: var(--brand-light); color: var(--brand); border: 1px solid #fecaca; }
.flash-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.flash-close   { background: none; border: none; font-size: 1rem; cursor: pointer; color: inherit; opacity: 0.5; }

/* ── STAT CARDS ──────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.stat-icon-wrap {
  width: 38px; height: 38px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  margin-bottom: 0.875rem;
}

.stat-icon-wrap.red   { background: var(--brand-light); color: var(--brand); }
.stat-icon-wrap.green { background: #f0fdf4; color: #16a34a; }
.stat-icon-wrap.blue  { background: #eff6ff; color: #2563eb; }
.stat-icon-wrap.amber { background: #fffbeb; color: #d97706; }

.stat-value {
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 0.3rem;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── ACTIVE CLINIC BANNER ────────────────── */
.active-clinic-banner {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border: none;
  color: #fff;
  padding: 1.75rem 2rem;
}

.active-clinic-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.badge-live {
  background: rgba(255,255,255,0.16);
  color: #fff;
  gap: 0.4rem;
}

.badge-live i {
  color: #4ade80;
  font-size: 0.5rem;
  animation: pulseLive 1.6s ease-in-out infinite;
}

.active-clinic-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0.6rem 0 0.35rem;
}

.active-clinic-meta {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
}

.active-clinic-meta i { width: 1rem; text-align: center; }
.active-clinic-sep { margin: 0 0.5rem; color: rgba(255,255,255,0.4); }

.active-clinic-stat {
  margin-top: 1.1rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.active-clinic-stat-value {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.active-clinic-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.75);
}

.active-clinic-actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  align-items: stretch;
  flex-shrink: 0;
}

.active-clinic-actions .btn-lg {
  background: #fff;
  color: var(--brand);
  border-color: #fff;
  justify-content: center;
}
.active-clinic-actions .btn-lg:hover {
  background: var(--brand-light);
  color: var(--brand-dark);
  border-color: var(--brand-light);
  transform: translateY(-1px);
}

.active-clinic-actions .btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.4);
  justify-content: center;
}
.active-clinic-actions .btn-outline:hover {
  background: rgba(255,255,255,0.12);
  border-color: #fff;
  color: #fff;
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* ── CARDS ───────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-xs);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card-body { padding: 1.25rem; }

/* ── TABLES ──────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.845rem; }

thead th {
  background: var(--border-light);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.8rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border-light); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafafa; }
tbody td { padding: 0.9rem 1.25rem; color: var(--text-secondary); vertical-align: middle; }

/* ── FORMS ───────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="tel"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.575rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(153,20,21,0.08);
}

textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); }

/* ── BUTTONS ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.525rem 1rem;
  border-radius: var(--radius-xs);
  font-family: 'Inter', sans-serif;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-decoration: none;
  transition: all var(--transition);
  line-height: 1;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: #111;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(227,220,88,0.4);
}

.btn-success {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}
.btn-success:hover { background: #15803d; border-color: #15803d; }

.btn-outline {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-light);
}

.btn-danger {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-danger:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--border-light); color: var(--text-primary); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.775rem; }
.btn-lg { padding: 0.7rem 1.375rem; font-size: 0.9rem; }

/* ── BADGES ──────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.175rem 0.55rem;
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-clay  { background: var(--brand-light); color: var(--brand); }
.badge-sage  { background: #f0fdf4; color: #15803d; }
.badge-bark  { background: #f1f5f9; color: #475569; }
.badge-muted { background: var(--border-light); color: var(--text-muted); }
.badge-dog   { background: #fff7ed; color: #c2410c; }
.badge-cat   { background: #f0fdf4; color: #15803d; }
.badge-blue  { background: #eff6ff; color: #1d4ed8; }
.badge-amber { background: #fffbeb; color: #d97706; }

/* ── PROGRESS BAR ────────────────────────── */
.progress-track {
  height: 5px;
  background: var(--border-light);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 0.375rem;
}

.progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 100px;
  transition: width 0.9s ease;
}

/* ── CHARTS ──────────────────────────────── */
.chart-wrap {
  position: relative;
  height: 280px;
}

/* ── SECTION DIVIDER ─────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 1rem;
  color: var(--text-subtle);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── CHECKBOX GROUP ──────────────────────── */
.check-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.check-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  transition: all var(--transition);
}

.check-label input { display: none; }
.check-label:has(input:checked) {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ── RADIO TOGGLE ────────────────────────── */
.radio-group { display: flex; gap: 0.5rem; }

.radio-label {
  flex: 1;
  text-align: center;
  padding: 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 0.855rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  transition: all var(--transition);
}

.radio-label input { display: none; }
.radio-label:has(input:checked) {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #fff;
  font-weight: 600;
}

/* ── TOOLBAR / SEARCH ────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 300px;
}

.search-wrap i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.78rem;
  pointer-events: none;
}

.search-wrap input { padding-left: 2.1rem; }

/* ── MODAL ───────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,0.35);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.75rem;
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.25s ease;
  border: 1px solid var(--border);
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* ── EMPTY STATE ─────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  color: var(--border);
  display: block;
}

.empty-state p { font-size: 0.875rem; }

/* ── UTILITIES ───────────────────────────── */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-sm      { gap: 0.5rem; }
.gap-md      { gap: 1rem; }
.justify-between { justify-content: space-between; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted  { color: var(--text-muted); font-size: 0.835rem; }
.text-center { text-align: center; }
.fw-5 { font-weight: 500; }
.fw-6 { font-weight: 600; }
.fw-7 { font-weight: 700; }

/* ── PRINT ───────────────────────────────── */
@media print {
  .sidebar, .topbar, .btn, .flash, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  .content-body { padding: 0; }
  body { background: white; }
}

/* ── ANIMATIONS ──────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-in { animation: fadeUp 0.3s ease both; }

/* ── LAYOUT HELPERS (responsive grids) ─────── */
.two-col-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.equal-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

/* ── SIDEBAR TOGGLE (mobile only) ───────────── */
.sidebar-toggle {
  display: none !important;  /* hidden on desktop — overridden below on mobile */
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  background: transparent;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--border-light); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 99;
  backdrop-filter: blur(1px);
}
.sidebar-backdrop.open { display: block; }

/* ── RESPONSIVE: TABLET (≤ 960px) ─────────── */
@media (max-width: 960px) {
  .two-col-grid   { grid-template-columns: 1fr; }
  .equal-col-grid { grid-template-columns: 1fr; }
}

/* ── RESPONSIVE: MOBILE (≤ 768px) ─────────── */
@media (max-width: 768px) {

  /* Sidebar slides off-screen */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
    position: fixed;
    z-index: 100;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  }

  /* Close nav links on tap */
  .nav-links li a { font-size: 1rem; padding: 0.75rem 1rem; }

  /* Main content goes full width */
  .main-content { margin-left: 0; }

  /* Show hamburger on mobile */
  .sidebar-toggle { display: flex !important; }

  /* Topbar */
  .topbar { padding: 0 1rem; gap: 0.75rem; }
  .topbar-meta { display: none; }
  .page-title { font-size: 1rem; }

  /* Content padding */
  .content-body { padding: 1.25rem 1rem; }

  /* Flash messages */
  .flash { margin: 0.75rem 1rem 0; font-size: 0.85rem; }

  /* Stat cards — 2 columns */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }
  .stat-card { padding: 1.1rem 1rem; }
  .stat-value { font-size: 1.75rem; }
  .stat-label { font-size: 0.68rem; }
  .stat-icon-wrap { width: 34px; height: 34px; font-size: 0.85rem; margin-bottom: 0.75rem; }

  /* Cards */
  .card-header {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
  }
  .card-body { padding: 1rem; }

  /* Tables — keep horizontal scroll */
  thead th { padding: 0.65rem 0.875rem; font-size: 0.68rem; }
  tbody td { padding: 0.75rem 0.875rem; font-size: 0.84rem; }

  /* Forms */
  .form-grid { grid-template-columns: 1fr; }
  .radio-group { flex-direction: column; gap: 0.4rem; }

  /* Page header */
  .page-header { flex-direction: column; gap: 0.75rem; }

  /* Modals */
  .modal { padding: 1.25rem; width: 95%; margin: 1rem; }

  /* Login */
  .login-card { padding: 1.75rem 1.25rem; margin: 1rem; }

  /* Toolbar */
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-wrap { max-width: 100%; }

  /* Two col becomes one */
  .two-col-grid, .equal-col-grid { grid-template-columns: 1fr; }

  /* Charts */
  .chart-wrap { height: 220px; }

  /* Active clinic banner */
  .active-clinic-banner { padding: 1.25rem; }
  .active-clinic-content { flex-direction: column; align-items: stretch; }
  .active-clinic-title { font-size: 1.2rem; }
  .active-clinic-actions { width: 100%; }
}

/* ── RESPONSIVE: SMALL PHONES (≤ 480px) ─── */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .btn { font-size: 0.82rem; }
  .card-title { font-size: 0.875rem; }

  /* Stack card-header actions below title */
  .card-header { flex-direction: column; align-items: flex-start; }
  .card-header .btn,
  .card-header input[type="text"] { width: 100%; }
}
