/* ResPro Billing Platform — Design Language
 * Brand: ResPro Health teal (#1a4549) — sidebar + primary buttons
 * Functional: green/amber/red status, blue informational
 * Typography: system sans-serif, 14px base
 * Brand guide: ./docs/design/brand-guide.md
 */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f8fafc;
  color: #1e293b;
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
}

/* ── Sidebar ───────────────────────────────────────────── */

.sidebar {
  width: 220px;
  min-width: 220px;
  background: #122f32;  /* ResPro teal dark */
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid #1a4549;  /* ResPro teal */
}

.app-name {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.app-sub {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13px;
  color: #94a3b8;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}

.nav-item:hover { background: #1a4549;  /* ResPro teal */ color: #e2e8f0; }

.nav-item.active {
  background: #1d4ed8;
  color: #fff;
  border-left-color: #60a5fa;
  font-weight: 500;
}

.nav-icon { font-size: 15px; width: 18px; text-align: center; }

.nav-divider { height: 1px; background: #1a4549;  /* ResPro teal */ margin: 8px 0; }

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid #334155;
  font-size: 12px;
  color: #475569;
}

/* ── Main layout ──────────────────────────────────────── */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 28px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: #64748b;
}

.avatar {
  width: 30px; height: 30px;
  background: #dbeafe;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #1d4ed8;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ── Tabs ─────────────────────────────────────────────── */

.tab-row {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 28px;
}

.tab {
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab.active {
  color: #1d4ed8;
  border-bottom-color: #1d4ed8;
}

.tab-badge {
  display: inline-block;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 6px;
}

/* ── Upload page ──────────────────────────────────────── */

.upload-context {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.client-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: #166534;
  font-weight: 500;
}

.client-badge-icon { font-size: 15px; }

.drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #fff;
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 24px;
  max-width: 640px;
}

.drop-zone:hover,
.drop-zone-active {
  border-color: #3b82f6;
  background: #f0f7ff;
}

.drop-icon { font-size: 40px; margin-bottom: 14px; }

.drop-primary {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 6px;
}

.drop-secondary {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 14px;
}

.browse-link {
  color: #1d4ed8;
  text-decoration: underline;
  cursor: pointer;
}

.file-types {
  display: inline-flex;
  gap: 8px;
  font-size: 11px;
}

.file-chip {
  background: #f1f5f9;
  color: #64748b;
  border-radius: 4px;
  padding: 2px 8px;
  font-family: monospace;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 10px;
}

/* Upload result feedback */
.upload-result {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  margin-top: 16px;
  max-width: 640px;
  font-size: 13px;
}

.upload-result-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.upload-result-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.upload-result-icon { font-size: 16px; margin-top: 1px; }

/* ── Tables ───────────────────────────────────────────── */

.recent-table {
  width: 100%;
  max-width: 640px;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.recent-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.recent-table td {
  padding: 11px 16px;
  font-size: 13px;
  color: #374151;
  border-bottom: 1px solid #f1f5f9;
}

.recent-table tr:last-child td { border-bottom: none; }

/* ── Status badges ─────────────────────────────────────── */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.status-complete { background: #dcfce7; color: #166534; }
.status-review   { background: #fef3c7; color: #92400e; }
.status-proc     { background: #dbeafe; color: #1e40af; }
.status-failed   { background: #fee2e2; color: #991b1b; }

/* ── Dashboard cards ──────────────────────────────────── */

.hero-card {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  border-radius: 12px;
  padding: 24px 28px;
  color: #fff;
  max-width: 680px;
  margin-bottom: 20px;
}

.hero-label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.hero-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.hero-sub { font-size: 13px; opacity: 0.8; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  max-width: 680px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 18px 20px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
  font-variant-numeric: tabular-nums;
}

.stat-value.green { color: #16a34a; }
.stat-value.amber { color: #d97706; }
.stat-label { font-size: 12px; color: #64748b; margin-top: 4px; }

/* ── Buttons ──────────────────────────────────────────── */

.btn-primary {
  background: #1d4ed8;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}

.btn-primary:hover { background: #1e40af; }

.btn-secondary {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: border-color 0.15s;
}

.btn-secondary:hover { border-color: #9ca3af; }

.btn-amber {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-full { width: 100%; justify-content: center; }

/* ── Forms ────────────────────────────────────────────── */

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #1e293b;
  background: #fff;
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input-mono { font-family: monospace; letter-spacing: 0.15em; font-size: 18px; text-align: center; }

/* ── Login page ───────────────────────────────────────── */

body.login-body {
  display: block;
  background: #f1f5f9;
  height: 100vh;
  overflow: auto;
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-heading {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 24px;
  text-align: center;
}

.login-message {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.login-mfa-hint {
  font-size: 13px;
  color: #64748b;
  text-align: center;
  margin-bottom: 16px;
}

.form-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  gap: 12px;
  color: #94a3b8;
  font-size: 12px;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.login-recovery-link {
  display: block;
  text-align: center;
  margin-top: 12px;
  font-size: 12px;
  color: #64748b;
  text-decoration: underline;
}

.login-hipaa-note {
  margin-top: 24px;
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.6;
}

/* ── HTMX loading indicator ──────────────────────────── */

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-request.htmx-indicator { display: inline; }

/* ── Alpine cloak ─────────────────────────────────────── */
[x-cloak] { display: none !important; }
