/* NABH Compliance Copilot — professional design system */

:root {
  --bg: #eef2f7;
  --bg-subtle: #e4eaf2;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --border: #d8e0eb;
  --border-light: #e8edf4;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: rgba(29, 78, 216, 0.1);
  --accent: #0e7490;
  --accent-soft: rgba(14, 116, 144, 0.12);
  --gold: #b45309;
  --gold-soft: rgba(180, 83, 9, 0.1);
  --sidebar-bg: #0c1526;
  --sidebar-bg-end: #152238;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #f8fafc;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --error: #dc2626;
  --success: #059669;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
  --sidebar-width: 272px;
  --header-height: 64px;
  --font: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

button, .btn, .subnav-item, .suggestion-chip, .nav-item, .module-tile {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Auth pages ─── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(29, 78, 216, 0.12), transparent 50%),
    radial-gradient(ellipse 60% 50% at 90% 100%, rgba(14, 116, 144, 0.1), transparent 50%),
    var(--bg);
}

.shell {
  width: 100%;
  max-width: 440px;
}

.auth-split {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  max-width: 960px;
  min-height: min(640px, 90vh);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.auth-split-panel {
  display: none;
  padding: 48px 40px;
  background: linear-gradient(145deg, var(--sidebar-bg) 0%, var(--sidebar-bg-end) 100%);
  color: #e2e8f0;
  flex-direction: column;
  justify-content: center;
}

.auth-split-panel h2 {
  margin: 0 0 12px;
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.auth-split-panel p {
  margin: 0;
  color: var(--sidebar-text);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 320px;
}

.auth-split-features {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.auth-split-features li {
  padding: 10px 0 10px 28px;
  position: relative;
  font-size: 0.92rem;
  color: #cbd5e1;
}

.auth-split-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
}

.auth-split-form {
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

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

.brand-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: var(--radius-md);
  object-fit: contain;
  display: block;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.brand h1 { margin: 0 0 6px; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.brand p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ─── Cards & forms ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
  transition: all 0.2s;
}

.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input, select, textarea {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font: inherit;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  background: var(--surface);
}

.btn {
  width: 100%;
  padding: 13px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.25);
}

.btn:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(29, 78, 216, 0.3);
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  box-shadow: none;
  margin-top: 0;
}

.btn-ghost:hover {
  background: var(--bg);
  border-color: var(--primary);
  color: var(--primary);
  transform: none;
  box-shadow: var(--shadow-sm);
}

.btn-sm {
  width: auto;
  padding: 8px 14px;
  font-size: 0.85rem;
  box-shadow: none;
}

.link {
  display: block;
  text-align: center;
  margin-top: 14px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
}

.error { color: var(--error); font-size: 0.875rem; margin: 0 0 12px; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0 0 14px; }
.hidden { display: none !important; }

/* ─── App layout (dashboard) ─── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-end) 100%);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-sidebar.open { transform: translateX(0); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 150;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.visible { display: block; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  padding: 2px;
}

.sidebar-brand-text strong {
  display: block;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sidebar-brand-text span {
  display: block;
  color: var(--sidebar-text);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}

.nav-section { margin-bottom: 20px; }

.nav-section-label {
  display: block;
  padding: 0 12px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 2px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sidebar-text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text-active);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.18);
  color: #fff;
  font-weight: 600;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active .nav-icon { opacity: 1; }

.sidebar-user {
  padding: 16px;
  border-top: 1px solid var(--sidebar-border);
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.3;
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: var(--sidebar-text);
}

.sidebar-logout {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--header-height);
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
  font-size: 1.2rem;
}

.app-header h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.header-logout-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
}

.header-logout-btn:hover {
  border-color: #dc2626;
  color: #dc2626;
  background: #fef2f2;
}

.header-pill {
  display: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.page-content {
  flex: 1;
  padding: 24px 20px 40px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Dashboard home ─── */
.welcome-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--surface) 0%, #f8fafc 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.home-context-bar {
  padding: 12px 16px;
  margin-top: 0;
  margin-bottom: 20px;
}

.welcome-banner h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.welcome-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(29, 78, 216, 0.15);
}

.welcome-badge.accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(14, 116, 144, 0.2);
}

.home-grid {
  display: grid;
  gap: 24px;
  margin-bottom: 20px;
}

.home-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0c4a6e 100%);
  border: none;
  color: #e2e8f0;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.home-hero::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 60%;
  height: 120%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.home-hero > * { position: relative; z-index: 1; }

.home-hero-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(147, 197, 253, 0.3);
  border-radius: 999px;
  padding: 5px 12px;
  margin-bottom: 14px;
}

.home-hero-title {
  margin: 0 0 10px;
  font-size: 1.75rem;
  line-height: 1.25;
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.home-hero-lead {
  margin: 0 0 18px;
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1.6;
  max-width: 560px;
}

.home-hero-features {
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.home-hero-features li {
  position: relative;
  padding-left: 22px;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.home-hero-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #38bdf8;
  font-weight: 700;
}

.home-copilot-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.home-copilot-form input {
  width: 100%;
  padding: 15px 18px;
  font-size: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: var(--radius-sm);
}

.home-copilot-form input::placeholder { color: #64748b; }

.home-copilot-form input:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.home-copilot-submit {
  font-size: 1rem;
  font-weight: 700;
  padding: 15px 20px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}

.home-suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.home-suggestions .hint { color: #64748b; margin: 0; }

.suggestion-chip {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  color: #e2e8f0;
  transition: all 0.15s;
}

.suggestion-chip:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #fff;
}

.home-promo-slider {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.promo-slider-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  background: #0f172a;
}

.promo-slider-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.promo-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.55s ease;
  pointer-events: none;
  overflow: hidden;
}

.promo-slide.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

.promo-slide-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.promo-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.promo-slide-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 28px 14px 12px;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.72) 55%, transparent 100%);
  color: #fff;
}

.promo-slide-caption h3 {
  margin: 0 0 4px;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
}

.promo-slide-caption p {
  margin: 0 0 8px;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #cbd5e1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.promo-cta {
  width: auto;
  margin: 0;
  padding: 6px 12px;
  font-size: 0.75rem;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.promo-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s;
}

.promo-nav:hover {
  background: rgba(37, 99, 235, 0.85);
}

.promo-prev { left: 10px; }
.promo-next { right: 10px; }

.promo-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.promo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: #cbd5e1;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.promo-dot.active {
  background: var(--primary);
  transform: scale(1.2);
}

.home-quick-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.module-section-title {
  margin: 0 0 16px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.module-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.module-tile:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.module-tile-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  background: var(--primary-soft);
}

.module-tile:nth-child(even) .module-tile-icon { background: var(--accent-soft); }

.module-tile strong {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.module-tile span {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.hub-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 28px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.15s;
}

.hub-link:hover { color: var(--primary); }

/* ─── Legacy topbar / subnav (other pages) ─── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-logo {
  border-radius: 8px;
  object-fit: contain;
}

.topbar h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.topbar button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.subnav {
  display: flex;
  gap: 8px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.subnav-item {
  flex: 0 0 auto;
  padding: 10px 18px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--muted);
  white-space: nowrap;
  transition: all 0.15s;
}

.subnav-item:hover {
  color: var(--text);
  background: var(--surface);
}

.subnav-item.active {
  background: var(--surface);
  border-color: var(--border);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.dashboard {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.dashboard .card { margin-bottom: 20px; }

.home-page { max-width: none; padding: 0; }
.home-welcome { display: none; }
.home-tools { display: none; }
.home-tools-title { margin: 0 0 10px; font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

/* ─── Lists & chips ─── */
.user-list { list-style: none; padding: 0; margin: 0; }
.user-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.user-list-cards { display: flex; flex-direction: column; gap: 12px; }

.hospital-user-group {
  margin-top: 20px;
  padding-top: 4px;
  border-top: 1px solid var(--border-light);
}

.hospital-user-group:first-child {
  margin-top: 12px;
  border-top: none;
  padding-top: 0;
}

.hospital-user-group-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.user-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.user-row-main { flex: 1; min-width: 200px; }
.user-row-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.user-edit-form { margin-top: 4px; }

.chip {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-weight: 600;
}

.chip-warn { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.chip-ok { background: #ecfdf5; border-color: #6ee7b7; color: #065f46; }
.chip-bad { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }

.standards-page,
.copilot-page,
.audits-page,
.evidence-page,
.workflow-page { max-width: 1280px; }

.list-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.list-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.list-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.list-card-code {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.85rem;
}

.list-card-title {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 600;
}

.chapter-card .chapter-number {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-light, #eff6ff);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.chapter-header-card .chapter-kicker,
.standard-header-card .chapter-kicker {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.chapter-header-card h3,
.standard-header-card h3 {
  margin: 0 0 8px;
}

.chapter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.standard-title-text {
  margin: 0 0 12px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.standards-breadcrumb {
  margin-bottom: 12px;
}

.oe-list { list-style: none; padding: 0; margin: 0; }
.oe-item { padding: 16px 0; border-bottom: 1px solid var(--border-light); }
.oe-item p { margin: 6px 0 0; line-height: 1.55; color: var(--text-secondary); }

.oe-item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.oe-item-doc-required {
  background: rgba(245, 158, 11, 0.06);
  margin: 0 -8px;
  padding: 16px 8px;
  border-radius: var(--radius-sm);
}

.oe-doc-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fdba74;
}

.oe-upload-btn {
  width: auto;
  margin: 0;
  white-space: nowrap;
}

.oe-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.oe-level-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.oe-level-commitment {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.oe-level-core {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.oe-level-excellence {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

.oe-level-achievement {
  background: #f3e8ff;
  color: #7e22ce;
  border-color: #d8b4fe;
}

.oe-item-clickable {
  cursor: pointer;
  transition: background 0.15s ease;
  border-radius: var(--radius-sm);
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
}

.oe-item-clickable:hover,
.oe-item-clickable:focus-visible {
  background: rgba(37, 99, 235, 0.05);
  outline: none;
}

.oe-content-hint {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #6ee7b7;
}

.oe-workbook {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  align-items: start;
}

.oe-workbook-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.oe-workbook-header h3 {
  margin: 4px 0 0;
  line-height: 1.35;
}

.oe-workbook-logo {
  flex-shrink: 0;
  border-radius: 8px;
}

.oe-workbook-oe {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.oe-workbook-oe-text {
  margin: 0;
  line-height: 1.55;
  color: var(--text);
}

.oe-interpretation h4 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.oe-interpretation p {
  margin: 0;
  line-height: 1.65;
  color: var(--text-secondary);
}

.oe-summary {
  margin-top: 16px;
}

.oe-summary h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.oe-summary-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.oe-summary-list li {
  padding: 10px 12px;
  background: #f1f5f9;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  line-height: 1.45;
}

.oe-workbook-images {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.oe-workbook-figure {
  margin: 0;
}

.oe-workbook-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.oe-workbook-figure figcaption {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.oe-workbook-footer {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.oe-workbook-notes h4 {
  margin: 0 0 10px;
}

.oe-notes-area {
  width: 100%;
  min-height: 320px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  line-height: 1.85;
  resize: vertical;
  background-color: #fffef8;
  background-image: repeating-linear-gradient(
    transparent,
    transparent 27px,
    #d4d4d8 27px,
    #d4d4d8 28px
  );
  background-attachment: local;
}

.oe-notes-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 900px) {
  .oe-workbook {
    grid-template-columns: 1fr;
  }
}

.search-form { display: grid; gap: 12px; margin-bottom: 16px; }
.search-form input[type="search"] {
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--bg);
}

.filter-label { display: block; margin-top: 12px; font-size: 0.875rem; font-weight: 600; }
.filter-label select { margin-top: 6px; width: 100%; }

.dashboard .btn + .btn { margin-top: 10px; }

.filter-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  align-items: end;
}

.filter-row label { margin-bottom: 0; }
.list-stack { display: grid; gap: 12px; margin-top: 12px; }

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  align-items: center;
}

.action-row .btn { width: auto; margin-top: 0 !important; }

/* ─── Copilot ─── */
.copilot-intro { margin-bottom: 16px; }

.copilot-chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 55vh;
  overflow-y: auto;
  margin-bottom: 16px;
  padding: 4px;
}

.copilot-msg { display: flex; flex-direction: column; gap: 6px; }
.copilot-msg.user { align-items: flex-end; }
.copilot-msg.assistant { align-items: flex-start; }

.copilot-bubble {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 16px;
  line-height: 1.55;
  font-size: 0.95rem;
}

.copilot-msg.user .copilot-bubble {
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.copilot-msg.assistant .copilot-bubble {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: 4px;
}

.copilot-input { display: flex; gap: 10px; align-items: center; }
.copilot-input input {
  flex: 1;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
}

.copilot-input .btn { width: auto; margin: 0; }
.copilot-sources { font-size: 0.85rem; max-width: 95%; }
.copilot-sources ul { margin: 6px 0 0; padding-left: 0; list-style: none; }
.copilot-sources li { margin-bottom: 8px; }

.copilot-source-link,
.copilot-source-static {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--surface);
  font: inherit;
  color: inherit;
}

.copilot-source-link {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.copilot-source-link:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.copilot-source-link .copilot-source-cta {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

.copilot-source-static {
  cursor: default;
}

.list-card.static { cursor: default; }
.list-card.static:hover { transform: none; }

button.list-card {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}

.step-list {
  margin: 8px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.workflow-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  resize: vertical;
}

/* ─── Audits & metrics ─── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
}

.metric-card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
}

.metric-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.metric-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.dept-compliance { margin: 8px 0 0; padding-left: 18px; }
.timeline-list { margin: 8px 0 0; padding-left: 18px; }
.timeline-list li { margin-bottom: 10px; }
.checklist-item label { margin-top: 8px; }

/* ─── Evidence ─── */
.evidence-filters { display: grid; gap: 12px; margin-top: 12px; }
.evidence-filters input,
.evidence-filters select { width: 100%; }

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.inline-form input,
.inline-form select { flex: 1; min-width: 120px; }
.inline-form .btn { width: auto; margin: 0; }

.checkbox-row {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}

.checkbox-row input { width: auto; }
.history-list { margin: 8px 0 0; padding-left: 18px; }
.history-list li { margin-bottom: 8px; }
.notif-unread { border-color: rgba(29, 78, 216, 0.3); background: var(--primary-soft); }
.approval-comment { width: 100%; margin: 8px 0; }

/* ─── Desktop layout ─── */
@media (min-width: 1024px) {
  .auth-split {
    grid-template-columns: 1fr 1fr;
  }

  .auth-split-panel {
    display: flex;
  }

  .auth-split-form {
    padding: 48px 44px;
  }

  .app-sidebar {
    transform: translateX(0);
  }

  .menu-toggle { display: none; }

  .app-main {
    margin-left: var(--sidebar-width);
  }

  .app-header {
    padding: 0 32px;
  }

  .header-pill { display: inline-flex; }

  .page-content {
    padding: 32px 32px 48px;
  }

  .home-grid {
    grid-template-columns: 1.6fr 1fr;
    align-items: stretch;
  }

  .home-copilot-form {
    flex-direction: row;
    align-items: stretch;
  }

  .home-copilot-form input { flex: 1; }

  .home-copilot-submit {
    width: auto;
    white-space: nowrap;
    min-width: 200px;
  }

  .module-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }

  .home-promo-slider {
    align-self: stretch;
  }

  .welcome-banner h2 { font-size: 1.5rem; }
  .home-hero-title { font-size: 2rem; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .module-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .home-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1023px) {
  .sidebar-overlay.visible { display: block; }
}

@media (max-width: 480px) {
  .module-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .module-tile {
    padding: 14px 12px;
    min-height: 100%;
  }

  .module-tile-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .module-tile strong {
    font-size: 0.85rem;
    line-height: 1.25;
  }

  .module-tile span {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .promo-slide-caption h3 {
    font-size: 0.85rem;
  }

  .promo-slide-caption {
    padding: 22px 10px 10px;
  }

  .welcome-banner {
    padding: 16px 18px;
  }

  .home-hero-title {
    font-size: 1.4rem;
  }
}
