/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --primary:        #0d9488;
  --primary-dark:   #0f766e;
  --primary-light:  #ccfbf1;
  --bg:             #f0f4f8;
  --surface:        #ffffff;
  --surface-raised: #f8fafb;
  --text:           #0f172a;
  --text-secondary: #64748b;
  --text-tertiary:  #94a3b8;
  --border:         #e2e8f0;
  --border-focus:   rgba(13,148,136,.5);
  --error:          #dc2626;
  --success:        #10b981;
  --warning:        #f59e0b;
  --info:           #3b82f6;
  --radius:         10px;
  --radius-sm:      6px;
  --radius-lg:      16px;
  --radius-badge:   4px;
  /* tinted shadow — carries the surface hue */
  --shadow-sm:  0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow:     0 4px 12px rgba(15,23,42,.08), 0 1px 3px rgba(15,23,42,.05);
  --shadow-md:  0 8px 24px rgba(13,148,136,.09), 0 2px 6px rgba(15,23,42,.06);
}

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

/* ── Base ───────────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { text-decoration: none; color: var(--primary); }

/* ── Container ──────────────────────────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ── Auth Page ──────────────────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f4f8;
  /* subtle radial ambient — not the AI blue gradient */
  background-image:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(13,148,136,.12) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 90% 90%, rgba(13,148,136,.07) 0%, transparent 60%);
}

.auth-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 44px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

/* Logo mark in auth */
.auth-card h1 {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  margin-bottom: 2px;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 36px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 500;
}

.auth-card h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 24px;
  color: var(--text);
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text);
  letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--border-focus);
}

.form-group input::placeholder { color: var(--text-tertiary); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background .15s, box-shadow .15s, transform .1s, opacity .15s;
  letter-spacing: 0.01em;
  user-select: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(13,148,136,.3);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 3px 10px rgba(13,148,136,.35);
}

.btn-secondary {
  background: var(--surface-raised);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--bg); }

.btn-danger {
  background: var(--error);
  color: #fff;
}
.btn-danger:hover { background: #b91c1c; }

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-info {
  background: var(--info);
  color: #fff;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }

/* ── Dashboard Layout ───────────────────────────────────────────────────── */
.dashboard { display: flex; min-height: 100dvh; }

.sidebar {
  width: 240px;
  background: #0f172a; /* deep navy — gives medical authority */
  padding: 20px 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
  border-right: none;
  flex-shrink: 0;
}

.sidebar .logo {
  padding: 4px 20px 20px;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.sidebar .role-badge {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(13,148,136,.25);
  color: var(--primary-light);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 0 20px 8px;
  border: 1px solid rgba(13,148,136,.3);
}

#doctor-name,
#pharmacy-name,
#lab-name,
#hospital-name,
#staff-name {
  color: #64748b;
  font-size: 13px;
  padding: 0 20px 16px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  transition: background .12s, color .12s;
  border-left: 3px solid transparent;
  margin: 1px 0;
}

.sidebar nav a:hover {
  background: rgba(255,255,255,.05);
  color: #e2e8f0;
  border-left-color: transparent;
}

.sidebar nav a.active {
  background: rgba(13,148,136,.15);
  color: #2dd4bf;
  border-left-color: var(--primary);
  font-weight: 600;
}

.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 28px 32px;
  min-width: 0;
}

/* Page headings */
.main-content h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text);
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* ── Stats Grid ─────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow .15s, transform .15s;
}

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

.stat-card .icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-card .stat-value,
.stat-card .value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.stat-card .stat-label,
.stat-card .label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 4px;
  letter-spacing: 0.01em;
}

/* ── Table ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

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

th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border);
  background: var(--surface-raised);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(13,148,136,.03); }

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius-badge);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-success  { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-warning  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-error    { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.badge-info     { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-pending  { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.badge-secondary { background: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff; }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.tab {
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-secondary);
  transition: color .12s, border-color .12s;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  user-select: none;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Modals ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 520px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(15,23,42,.2);
  border: 1px solid var(--border);
  transform: translateY(8px);
  transition: transform .2s;
}

.modal-overlay.show .modal { transform: translateY(0); }

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 20px;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Skeleton Loaders ───────────────────────────────────────────────────── */
@keyframes sk-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.sk {
  display: inline-block;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 1200px 100%;
  animation: sk-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}
.sk-text  { height: 12px; }
.sk-title { height: 16px; }
.sk-block { height: 40px; }
.sk-circle { border-radius: 50%; }
/* Full-width skeleton row inside a <table> */
.sk-row td {
  padding: 14px 24px;
}
.sk-row .sk { width: 100%; display: block; }

/* Skeleton stat card value */
.sk-stat {
  height: 28px;
  width: 64px;
  display: inline-block;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  padding: 11px 22px;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  z-index: 200;
  animation: toastIn .25s cubic-bezier(.16,1,.3,1);
  box-shadow: 0 8px 24px rgba(15,23,42,.2);
  white-space: nowrap;
}

.toast-success { background: var(--success); }
.toast-error   { background: var(--error); }
.toast-info    { background: var(--info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Utility ────────────────────────────────────────────────────────────── */
.text-muted  { color: var(--text-secondary); }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 12px; }
.font-mono   { font-variant-numeric: tabular-nums; font-family: 'Geist Mono', 'JetBrains Mono', monospace; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
