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

:root {
  /* Brand palette — identical to schedulemyvax */
  --brand-50:  #eff6ff;
  --brand-100: #dbeafe;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-800: #1e40af;
  --brand-900: #1e3a8a;

  /* Grays */
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;

  /* Semantic */
  --bg:       var(--gray-100);
  --card-bg:  #ffffff;
  --text:     var(--gray-900);
  --muted:    var(--gray-500);
  --border:   var(--gray-100);
  --border-md: var(--gray-200);

  --success:    #166534;
  --success-bg: #dcfce7;
  --success-bd: #86efac;
  --error:      #991b1b;
  --error-bg:   #fee2e2;
  --error-bd:   #fca5a5;
  --warning:    #92400e;
  --warning-bg: #fef3c7;
  --warning-bd: #fcd34d;
  --blue-light-bg: var(--brand-50);

  --sidebar-w: 256px;
  --radius-lg: 0.5rem;
  --radius-xl: 0.85rem;
  --radius-2xl: 1.1rem;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

html {
  font-size: 17px; /* slightly large — matches schedulemyvax's elderly-friendly sizing */
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

a { color: var(--brand-700); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Login Page ───────────────────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-wrap { width: 100%; max-width: 360px; }

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
}

.login-icon svg { width: 52px; height: 52px; }

.login-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.3;
  margin-bottom: 4px;
}

.login-header p {
  color: var(--gray-500);
  font-size: 0.9rem;
}

/* Card — matches schedulemyvax .card */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  padding: 24px;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.75rem;
  color: var(--gray-400);
}

/* Form elements — matches .form-label / .form-input */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-xl);
  padding: 12px 16px;
  font-size: 1rem;
  color: var(--gray-900);
  background: white;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
}

.form-input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* Buttons — matches .btn-primary / .btn-secondary / .btn-danger */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--brand-700);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius-xl);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .15s;
  width: 100%;
  text-decoration: none;
  line-height: 1;
}
.btn-primary:hover { background: var(--brand-800); text-decoration: none; color: white; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: white;
  color: var(--brand-700);
  border: 2px solid var(--brand-700);
  padding: 8px 16px;
  border-radius: var(--radius-xl);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
  line-height: 1;
}
.btn-secondary:hover { background: var(--brand-50); text-decoration: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: var(--gray-500);
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all .15s;
}
.btn-ghost:hover { background: var(--gray-200); color: var(--gray-700); }

.btn-sm { padding: 8px 14px; font-size: 0.85rem; }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-xl);
  font-size: 0.9rem;
  margin-bottom: 16px;
  border: 1px solid;
}
.alert-error   { background: var(--error-bg);   color: var(--error);   border-color: var(--error-bd); }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success-bd); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-bd); }

/* ── App Shell ────────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  background: var(--gray-100);
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--brand-900);
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  inset-y: 0;
  left: 0;
  z-index: 30;
  overflow-y: auto;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--brand-800);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #93c5fd; /* blue-300 */
}

.brand-icon svg { width: 24px; height: 24px; fill: #93c5fd; }

.brand-text {}
.brand-text .brand-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
  line-height: 1.2;
}
.brand-text .brand-sub {
  font-size: 0.75rem;
  color: #93c5fd;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(147,197,253,.5);
  padding: 10px 12px 4px;
}

/* Nav links — matches schedulemyvax Link styles */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  color: #bfdbfe; /* blue-200 */
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--brand-800); color: white; text-decoration: none; }
.nav-item.active { background: var(--brand-700); color: white; }
.nav-item svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--brand-800);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user {
  font-size: 0.75rem;
  color: #93c5fd;
  padding: 0 4px;
  line-height: 1.6;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  font-size: 0.75rem;
  color: #bfdbfe;
  cursor: pointer;
  transition: all .15s;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.sidebar-logout:hover { background: var(--brand-800); color: white; }
.sidebar-logout svg { width: 12px; height: 12px; fill: currentColor; }

/* ── Main Content ─────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  overflow-y: auto;
  min-width: 0;
}

.page-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content-area { padding: 24px; }

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

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue   { background: var(--brand-50); }
.stat-icon.blue svg { fill: var(--brand-700); }
.stat-icon.green  { background: var(--success-bg); }
.stat-icon.green svg { fill: var(--success); }
.stat-icon.red    { background: var(--error-bg); }
.stat-icon.red svg { fill: var(--error); }
.stat-icon.yellow { background: var(--warning-bg); }
.stat-icon.yellow svg { fill: var(--warning); }

.stat-label { font-size: 0.78rem; color: var(--gray-500); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-sub   { font-size: 0.75rem; color: var(--gray-400); margin-top: 4px; }

/* ── Section ──────────────────────────────────────────────────────────────── */
.section { margin-bottom: 24px; }

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

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
}

/* ── Workflow Cards ───────────────────────────────────────────────────────── */
.workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.workflow-card {
  background: var(--card-bg);
  border-radius: var(--radius-2xl);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.workflow-card:hover {
  border-color: var(--brand-500);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}

.workflow-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.workflow-wf-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xl);
  background: var(--brand-50);
  display: flex;
  align-items: center;
  justify-content: center;
}
.workflow-wf-icon svg { width: 20px; height: 20px; fill: var(--brand-700); }

.workflow-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 3px;
}
.workflow-meta { font-size: 0.8rem; color: var(--gray-400); }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-green  { background: var(--success-bg); color: var(--success); }
.badge-red    { background: var(--error-bg);   color: var(--error); }
.badge-yellow { background: var(--warning-bg); color: var(--warning); }
.badge-blue   { background: var(--brand-100);  color: var(--brand-700); }
.badge-gray   { background: var(--gray-100);   color: var(--gray-500); }

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

table { width: 100%; border-collapse: collapse; min-width: 500px; }

thead tr { background: var(--gray-50); border-bottom: 1px solid var(--gray-200); }

th {
  padding: 10px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-900);
}

tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

.td-muted { color: var(--gray-500); font-size: 0.85rem; }
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: var(--brand-50); }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}

.modal {
  background: white;
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 720px;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); }

.modal-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  border: none;
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: pointer;
  font-size: 18px;
  transition: all .15s;
}
.modal-close:hover { background: var(--gray-200); color: var(--gray-900); }

.modal-body { padding: 22px; }

/* ── Code block ───────────────────────────────────────────────────────────── */
.data-block {
  background: #1e2a3a;
  border-radius: var(--radius-lg);
  padding: 14px;
  overflow-x: auto;
  max-height: 360px;
  overflow-y: auto;
}
.data-block pre {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.78rem;
  color: #93c5fd;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
}

/* ── Utility ──────────────────────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--gray-400);
  gap: 10px;
  font-size: 0.9rem;
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-400);
}
.empty-state p { font-size: 0.9rem; }

.text-muted   { color: var(--gray-400); }
.text-success { color: var(--success); }
.text-error   { color: var(--error); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .workflow-grid { grid-template-columns: 1fr; }
}
