/* ============================================
   HealthyHustle - Health Coaching CRM
   ============================================ */

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

:root {
  --navy: #1A1A2E;
  --gold: #6C63FF;
  --gold-hover: #4A43C7;
  --gold-text: #5A52E0;
  --gold-light: #8B83FF;
  --cream: #F5F7FA;
  --blush: #EEF0FF;
  --white: #FFFFFF;
  --radius: 16px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --sidebar-width: 260px;
  --header-height: 64px;
  --transition: 0.2s ease;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --green-100: #DCFCE7;
  --green-600: #16A34A;
  --green-700: #15803D;
  --amber-100: #FEF3C7;
  --amber-600: #D97706;
  --amber-700: #B45309;
  --red-100: #FEE2E2;
  --red-600: #DC2626;
  --red-700: #B91C1C;
  --blue-100: #DBEAFE;
  --blue-600: #2563EB;
  --blue-700: #1D4ED8;
  --purple-100: #F3E8FF;
  --purple-600: #9333EA;
  --purple-700: #7E22CE;

  --card-bg: var(--white);
  --border: var(--gray-200);
  --text-primary: var(--navy);
  --text-muted: var(--gray-500);
  --bg-secondary: var(--gray-50);
  --focus-ring: 0 0 0 3px rgba(108, 99, 255, 0.25);

  --ch-sms: #16A34A;
  --ch-email: #2563EB;
  --ch-wa: #25D366;
  --ch-fb: #1877F2;
  --ch-ig: #E1306C;
  --ch-call: #0EA5E9;
  --ch-note: #F59E0B;
  --ch-note-bg: #FFFBEB;
  --conv-list-w: 340px;
  --conv-contact-w: 340px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--navy);
  background: var(--cream);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

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

/* --- Layout --- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform var(--transition);
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.content-body {
  padding: 32px;
  flex: 1;
  min-width: 0;
}

/* --- Sidebar --- */
.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--gray-200);
}

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

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
}

.sidebar-logo .logo-icon i,
.sidebar-logo .logo-icon svg {
  width: 20px;
  height: 20px;
}

.sidebar-logo h1,
.sidebar-logo .logo-name {
  display: block;
  line-height: 1.2;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.sidebar-logo .logo-subtitle {
  display: block;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--gray-500);
  text-transform: uppercase;
  margin-top: 2px;
}

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

.sidebar-nav .nav-section {
  margin-bottom: 8px;
}

.sidebar-nav .nav-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  padding: 6px 12px 4px;
}

.sidebar-nav .nav-separator {
  height: 1px;
  background: var(--gray-200);
  margin: 12px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--gray-600);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}

.nav-item i,
.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--gray-50);
  color: var(--navy);
}

.nav-item.active {
  background: var(--blush);
  color: var(--gold-text);
  font-weight: 600;
}

.nav-item .nav-badge,
#nav-unread-badge {
  margin-left: auto;
  background: var(--gold-text);
  color: var(--white);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-user .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user .user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user .user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* --- Header --- */
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
}

.header-search {
  position: relative;
}

.header-search input {
  padding: 8px 16px 8px 40px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  width: 280px;
  font-size: 0.875rem;
  transition: all var(--transition);
  outline: none;
}

.header-search input:focus {
  border-color: var(--gold);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.header-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  width: 18px;
  height: 18px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: all var(--transition);
}

.header-icon-btn:hover {
  background: var(--gray-100);
  color: var(--navy);
}

.mobile-menu-btn {
  display: none;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--gray-600);
}

/* --- Cards --- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2,
.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
}

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card .stat-icon.violet {
  background: var(--blush);
  color: var(--gold-text);
}

.stat-card .stat-icon.green {
  background: var(--green-100);
  color: var(--green-600);
}

.stat-card .stat-icon.amber {
  background: var(--amber-100);
  color: var(--amber-600);
}

.stat-card .stat-icon.blue {
  background: var(--blue-100);
  color: var(--blue-600);
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 2px;
}

.stat-card .stat-change {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 4px;
}

.stat-card .stat-change.up {
  color: var(--green-600);
}

.stat-card .stat-change.down {
  color: var(--red-600);
}

/* Gradient Header Card */
.card-gradient-header {
  background: linear-gradient(135deg, #6C63FF 0%, #8B83FF 100%);
  color: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px;
}

.card-gradient-header h2,
.card-gradient-header h3 {
  color: var(--white);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn i,
.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--gold-text);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--gold-hover);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
}

.btn-ghost:hover {
  background: var(--gray-100);
  color: var(--navy);
}

.btn-danger {
  background: var(--red-600);
  color: var(--white);
}

.btn-danger:hover {
  background: var(--red-700);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.btn-google {
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--gray-200);
  padding: 12px 24px;
  font-size: 0.9375rem;
}

.btn-google:hover {
  background: var(--gray-50);
  box-shadow: var(--shadow-md);
}

.btn-google img {
  width: 20px;
  height: 20px;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-lead {
  background: var(--gray-100);
  color: var(--gray-700);
}

.badge-discovery {
  background: var(--blue-100);
  color: var(--blue-700);
}

.badge-onboarding {
  background: var(--amber-100);
  color: var(--amber-700);
}

.badge-active {
  background: var(--green-100);
  color: var(--green-700);
}

.badge-maintenance {
  background: var(--purple-100);
  color: var(--purple-700);
}

/* Marker status badges */
.badge-optimal {
  background: var(--green-100);
  color: var(--green-700);
}

.badge-low {
  background: var(--amber-100);
  color: var(--amber-700);
}

.badge-high {
  background: var(--red-100);
  color: var(--red-700);
}

/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
}

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

.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.875rem;
}

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

.table tr:hover td {
  background: var(--gray-50);
}

.table .client-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table .client-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blush);
  color: var(--gold-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
}

.table .client-name {
  font-weight: 600;
  color: var(--navy);
}

.table .client-email {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

/* --- Filter Tabs --- */
.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--gray-100);
  padding: 4px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.filter-tab {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
  border: none;
  background: none;
}

.filter-tab:hover {
  color: var(--navy);
}

.filter-tab.active {
  background: var(--white);
  color: var(--navy);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

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

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

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.875rem;
  transition: all var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.form-input::placeholder {
  color: var(--gray-400);
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6l3.5 3.5L11.5 6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.form-error {
  font-size: 0.75rem;
  color: var(--red-600);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* --- Pipeline / Kanban --- */
.pipeline-container {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: calc(100vh - 200px);
}

.pipeline-column {
  min-width: 280px;
  max-width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

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

.pipeline-column-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-600);
}

.pipeline-column-count {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pipeline-cards {
  flex: 1;
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 8px;
  min-height: 120px;
}

.pipeline-cards.drag-over {
  background: var(--blush);
  border: 2px dashed var(--gold);
}

.pipeline-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  cursor: grab;
  transition: all var(--transition);
}

.pipeline-card:hover {
  box-shadow: var(--shadow-md);
}

.pipeline-card:active {
  cursor: grabbing;
}

.pipeline-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.pipeline-card .card-client-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--navy);
  margin-bottom: 4px;
}

.pipeline-card .card-program {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.pipeline-card .card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pipeline-card .card-time {
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}

.pagination-info {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.pagination-buttons {
  display: flex;
  gap: 4px;
}

.pagination-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
  background: var(--white);
  transition: all var(--transition);
  cursor: pointer;
}

.pagination-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.pagination-btn.active {
  background: var(--gold-text);
  color: var(--white);
  border-color: var(--gold);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  gap: 0;
  margin-bottom: 24px;
}

.tab {
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover {
  color: var(--navy);
}

.tab.active {
  color: var(--gold-text);
  border-bottom-color: var(--gold);
  font-weight: 600;
}

/* --- Schedule / Working Day --- */
.schedule-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}

.schedule-item:last-child {
  border-bottom: none;
}

.schedule-time {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gold-text);
  min-width: 60px;
  flex-shrink: 0;
}

.schedule-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
}

.schedule-dot.upcoming {
  background: var(--gold);
}

.schedule-dot.completed {
  background: var(--green-600);
}

.schedule-details {
  flex: 1;
}

.schedule-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy);
}

.schedule-meta {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

/* --- Split Layout (Protocols, etc.) --- */
.split-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  min-height: calc(100vh - 200px);
}

.split-sidebar {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.split-main {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.split-sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  font-weight: 600;
  font-size: 0.875rem;
}

.split-sidebar-list {
  padding: 8px;
}

.split-sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
}

.split-sidebar-item:hover {
  background: var(--gray-50);
}

.split-sidebar-item.active {
  background: var(--blush);
  color: var(--gold-text);
}

/* --- Login Page --- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
}

.login-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.login-logo .logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 32px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  font-size: 0.8125rem;
  color: var(--gray-500);
}

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

/* --- Error Pages --- */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  text-align: center;
}

.error-code {
  font-size: 6rem;
  font-weight: 800;
  color: var(--gold-text);
  line-height: 1;
  margin-bottom: 8px;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 8px;
}

.error-message {
  font-size: 0.9375rem;
  color: var(--gray-500);
  margin-bottom: 32px;
}

/* --- Chart Placeholder --- */
.chart-placeholder {
  height: 280px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-size: 0.875rem;
  border: 1px dashed var(--gray-300);
}

/* --- Calendar Placeholder --- */
.calendar-placeholder {
  height: 320px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-size: 0.875rem;
  border: 1px dashed var(--gray-300);
}

/* --- Labs List --- */
.lab-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--transition);
}

.lab-item:hover {
  background: var(--gray-50);
}

.lab-item:last-child {
  border-bottom: none;
}

.lab-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--blush);
  color: var(--gold-text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lab-info {
  flex: 1;
}

.lab-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--navy);
}

.lab-meta {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

/* --- Briefing List --- */
.briefing-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--transition);
}

.briefing-item:hover {
  background: var(--gray-50);
}

.briefing-item:last-child {
  border-bottom: none;
}

.briefing-date-block {
  width: 48px;
  text-align: center;
  flex-shrink: 0;
}

.briefing-day {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
}

.briefing-month {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--gray-500);
}

.briefing-info {
  flex: 1;
}

.briefing-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--navy);
}

.briefing-description {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 2px;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-500);
}

.empty-state > i,
.empty-state > svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
}

.empty-state h3,
.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 4px;
}

.empty-state p,
.empty-state-text {
  font-size: 0.875rem;
  max-width: 440px;
}

/* --- Utility Classes --- */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.8125rem; }
.text-base { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.text-muted { color: var(--gray-500); }
.text-navy { color: var(--navy); }
.text-gold { color: var(--gold-text); }
.text-green { color: var(--green-600); }
.text-red { color: var(--red-600); }
.text-amber { color: var(--amber-600); }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

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

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

.p-16 { padding: 16px; }
.p-24 { padding: 24px; }

.w-full { width: 100%; }
.hidden { display: none; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* --- Overlay (mobile sidebar) --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
}

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

/* --- Responsive --- */
@media (max-width: 1200px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .split-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

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

  .main-content {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .content-body {
    padding: 16px;
  }

  .content-header {
    padding: 0 16px;
  }

  .header-search input {
    width: 180px;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-card .stat-value {
    font-size: 1.375rem;
  }

  .pipeline-container {
    padding-bottom: 12px;
  }

  .pipeline-column {
    min-width: 260px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

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

  .tabs {
    overflow-x: auto;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .filter-tabs {
    overflow-x: auto;
  }
}

/* --- Print --- */
@media print {
  .sidebar,
  .sidebar-overlay,
  .mobile-menu-btn {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
  }
}

/* ============================================
   App shell additions and shared components
   ============================================ */

.lucide {
  flex-shrink: 0;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 400;
  background: var(--navy);
  color: var(--white);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
}

.skip-link:focus {
  top: 8px;
}

.muted { color: var(--gray-500); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- Flush content (full-bleed pages such as the inbox) --- */
.content-body.content-body--flush {
  padding: 0;
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));
  flex: none;
  overflow: hidden;
}

/* --- Sidebar additions --- */
.sidebar-logo .logo-mark {
  color: inherit;
}

.sidebar-foot {
  padding: 8px 12px;
  border-top: 1px solid var(--gray-200);
}

#nav-unread-badge:empty {
  display: none;
}

.sidebar-user .user-role {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-signout-form {
  flex-shrink: 0;
}

.user-signout {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--gray-500);
  transition: all var(--transition);
}

.user-signout:hover {
  background: var(--gray-100);
  color: var(--navy);
}

.user-signout svg {
  width: 18px;
  height: 18px;
}

/* --- Header additions --- */
.header-left {
  min-width: 0;
  flex: 1;
}

.header-right {
  flex-shrink: 0;
}

.header-titles {
  flex: 1 1 auto;
  min-width: 0;
}

.header-title {
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-subtitle {
  font-size: 0.8125rem;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-icon-btn svg,
.mobile-menu-btn svg {
  width: 20px;
  height: 20px;
}

.header-readonly {
  background: var(--amber-100);
  border-color: transparent;
  color: var(--amber-700);
}

.search-toggle {
  display: none;
}

.header-search form {
  position: relative;
}

.header-search input::-webkit-search-cancel-button {
  cursor: pointer;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
}

.search-results:empty,
.search-results[hidden] {
  display: none;
}

.search-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--navy);
}

.search-item:hover,
.search-item:focus-visible {
  background: var(--blush);
  outline: none;
}

.search-item-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.search-item-name,
.search-item-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-name {
  font-size: 0.875rem;
  font-weight: 600;
}

.search-item-sub {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.search-item--action {
  border-top: 1px solid var(--gray-100);
  border-radius: 0 0 6px 6px;
  margin-top: 4px;
}

.search-action-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blush);
  color: var(--gold-text);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.search-action-icon svg {
  width: 15px;
  height: 15px;
}

.search-note {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.search-note svg {
  width: 16px;
  height: 16px;
}

.search-note--error {
  color: var(--red-700);
}

.search-page-form {
  display: flex;
  gap: 8px;
}

.search-page-results {
  margin-top: 16px;
  max-width: 560px;
}

.bell-slot {
  display: inline-flex;
}

.bell-btn {
  position: relative;
}

.bell-count {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--red-600);
  color: var(--white);
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--white);
}

/* --- Page head --- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.page-head-titles {
  min-width: 0;
}

.page-head h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
}

.page-head p {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 2px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 18px 20px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: inherit;
}

.kpi--link {
  transition: border-color var(--transition), box-shadow var(--transition);
}

.kpi--link:hover {
  border-color: var(--gold-light);
  box-shadow: var(--shadow-md);
}

.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kpi-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-500);
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--blush);
  color: var(--gold-text);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.kpi-icon svg {
  width: 18px;
  height: 18px;
}

.kpi-value {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.kpi-foot {
  display: flex;
  align-items: center;
  gap: 6px 8px;
  flex-wrap: wrap;
  font-size: 0.75rem;
}

.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kpi-delta svg {
  width: 14px;
  height: 14px;
}

.kpi-delta--up,
.kpi-delta--down.is-inverted {
  background: var(--green-100);
  color: var(--green-700);
}

.kpi-delta--down,
.kpi-delta--up.is-inverted {
  background: var(--red-100);
  color: var(--red-700);
}

.kpi-delta--flat {
  background: var(--gray-100);
  color: var(--gray-600);
}

.kpi-sub {
  color: var(--gray-500);
}

.kpi-note {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--gray-600);
}

.kpi-note svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* --- Segmented control and range picker --- */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
}

.seg::-webkit-scrollbar {
  display: none;
}

.seg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--gray-600);
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition);
}

.seg-item:hover {
  color: var(--navy);
}

.seg-item.is-active,
.seg-item.active,
.seg-item[aria-current="true"],
.seg-item[aria-current="page"],
.seg-item[aria-selected="true"] {
  background: var(--white);
  color: var(--navy);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.seg-item svg {
  width: 15px;
  height: 15px;
}

.range-picker {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
}

.range-custom {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.range-custom[hidden] {
  display: none;
}

.range-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.range-field input {
  padding: 5px 8px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--navy);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}

.range-field input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: var(--focus-ring);
}

.range-label {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

/* --- Chips, badges, source markers --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  background: var(--white);
  color: var(--gray-700);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

.chip svg {
  width: 14px;
  height: 14px;
}

a.chip:hover,
button.chip:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.chip.is-active {
  border-color: var(--gold-light);
  background: var(--blush);
  color: var(--gold-text);
}

.badge-success {
  background: var(--green-100);
  color: var(--green-700);
}

.badge-warn {
  background: var(--amber-100);
  color: var(--amber-700);
}

.badge-danger {
  background: var(--red-100);
  color: var(--red-700);
}

.badge-neutral {
  background: var(--gray-100);
  color: var(--gray-700);
}

.badge-info {
  background: var(--blue-100);
  color: var(--blue-700);
}

.badge-primary {
  background: var(--blush);
  color: var(--gold-text);
}

.source-badge {
  --src: var(--gray-400);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 7px;
  border-radius: var(--radius-xs);
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.6;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: nowrap;
}

.source-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--src);
}

.source-badge--ghl { --src: #0EA5E9; }
.source-badge--stripe { --src: #635BFF; }
.source-badge--calendly { --src: #006BFF; }
.source-badge--fireflies { --src: #E1306C; }

/* --- Avatar --- */
.avatar {
  --av: 245;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  background: hsl(var(--av) 55% 45%);
  color: var(--white);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  user-select: none;
}

.avatar--xs { width: 20px; height: 20px; font-size: 0.5625rem; }
.avatar--sm { width: 28px; height: 28px; font-size: 0.6875rem; }
.avatar--lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar--xl { width: 64px; height: 64px; font-size: 1.25rem; }

/* --- Data table --- */
.data-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table-wrap--scroll {
  max-height: 70vh;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 14px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gray-500);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: var(--gray-50);
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table--compact th { padding: 8px 12px; }
.data-table--compact td { padding: 8px 12px; }

/* --- Empty state --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--gray-500);
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--blush);
  color: var(--gold-text);
  display: grid;
  place-items: center;
}

.empty-state-icon svg {
  width: 28px;
  height: 28px;
}

.empty-state-title {
  color: var(--navy);
}

.empty-state-action {
  margin-top: 16px;
}

/* --- Skeleton loading --- */
.skeleton {
  position: relative;
  overflow: hidden;
  min-height: 12px;
  border-radius: 6px;
  background: var(--gray-100);
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: hh-shimmer 1.4s ease-in-out infinite;
}

.skeleton-line { height: 12px; margin: 8px 0; }
.skeleton-line--short { width: 60%; }
.skeleton-block { height: 88px; border-radius: var(--radius-sm); }
.skeleton-circle { width: 36px; height: 36px; border-radius: 50%; }

@keyframes hh-shimmer {
  100% { transform: translateX(100%); }
}

/* --- Alerts and error fragments --- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.45;
  text-align: left;
}

.alert svg {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.alert > span,
.alert-body {
  flex: 1;
  min-width: 0;
}

.alert-info {
  background: #EFF6FF;
  border-color: #BFDBFE;
  color: var(--blue-700);
}

.alert-warn {
  background: #FFFBEB;
  border-color: #FDE68A;
  color: var(--amber-700);
}

.alert-danger {
  background: #FEF2F2;
  border-color: #FECACA;
  color: var(--red-700);
}

.alert-success {
  background: #F0FDF4;
  border-color: #BBF7D0;
  color: var(--green-700);
}

.hh-error {
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0;
}

.hh-error-text {
  flex: 1;
  min-width: 160px;
}

/* --- Section tabs --- */
.section-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--gray-200);
}

.section-tabs::-webkit-scrollbar {
  display: none;
}

.section-tabs > a,
.section-tabs > button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}

.section-tabs > a:hover,
.section-tabs > button:hover {
  color: var(--navy);
}

.section-tabs > .is-active,
.section-tabs > [aria-current="page"],
.section-tabs > [aria-selected="true"] {
  border-bottom-color: var(--gold);
  color: var(--gold-text);
  font-weight: 600;
}

.section-tabs svg {
  width: 16px;
  height: 16px;
}

/* --- Bar list (label + bar + value) --- */
.bar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  font-size: 0.8125rem;
}

.bar-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gray-700);
}

.bar-value {
  font-weight: 600;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.bar-track {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--gray-100);
}

.bar-fill {
  display: block;
  width: var(--w, 0%);
  min-width: 2px;
  height: 100%;
  border-radius: 4px;
  background: var(--bar-color, var(--gold));
}

/* --- Mini bar chart / sparkline (pure CSS columns, tooltip via title) --- */
.mini-bars {
  --h: 72px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: var(--h);
}

.mini-bar {
  flex: 1 1 0;
  min-width: 3px;
  min-height: 2px;
  height: calc(var(--v, 0) * 100%);
  border-radius: 3px 3px 0 0;
  background: var(--bar-color, var(--gold-light));
  transition: background var(--transition);
}

.mini-bar:hover,
.mini-bar.is-current {
  background: var(--gold);
}

.mini-bar.is-zero {
  background: var(--gray-200);
}

.mini-bars-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.6875rem;
  color: var(--gray-500);
}

.spark {
  --h: 28px;
  gap: 2px;
}

.spark .mini-bar {
  min-width: 2px;
  border-radius: 1px 1px 0 0;
}

/* --- Grids --- */
.grid-2 > *,
.grid-3 > * {
  min-width: 0;
}

/* --- Toasts --- */
.hh-toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.hh-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-left: 4px solid var(--gold);
  border-radius: 10px;
  background: var(--navy);
  color: var(--white);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  line-height: 1.4;
  pointer-events: auto;
  animation: hh-toast-in 0.2s ease;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.hh-toast > span {
  flex: 1;
  min-width: 0;
}

.hh-toast--success { border-left-color: var(--green-600); }
.hh-toast--warn { border-left-color: var(--amber-600); }
.hh-toast--danger { border-left-color: var(--red-600); }

.hh-toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
}

.hh-toast-close {
  padding: 0 2px;
  font-size: 1.125rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.7);
}

.hh-toast-close:hover {
  color: var(--white);
}

@keyframes hh-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --- Login and error pages --- */
.login-page,
.error-page {
  padding: 16px;
}

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

.login-note {
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.login-foot {
  margin-top: 24px;
  font-size: 0.75rem;
  color: var(--gray-500);
}

.btn-google:disabled:hover {
  background: var(--white);
}

.error-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.content-body .error-page {
  min-height: 60vh;
  background: transparent;
}

/* --- Responsive additions --- */
@media (max-width: 1100px) {
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .header-readonly {
    display: none;
  }
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .page-head {
    align-items: flex-start;
    margin-bottom: 16px;
  }

  .kpi-grid {
    gap: 12px;
    margin-bottom: 16px;
  }
}

@media (max-width: 640px) {
  .search-toggle {
    display: flex;
  }

  .header-search {
    display: none;
  }

  .content-header.search-open .header-search {
    display: flex;
    align-items: center;
    position: absolute;
    inset: 0;
    z-index: 5;
    padding: 0 12px;
    background: var(--white);
  }

  .content-header.search-open .header-search form {
    flex: 1;
  }

  .content-header.search-open .header-search input {
    width: 100%;
  }

  .content-header.search-open .search-results {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .header-title {
    font-size: 1.0625rem;
  }

  .header-subtitle {
    display: none;
  }

  .header-right {
    gap: 4px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi {
    padding: 14px;
  }

  .kpi-value {
    font-size: 1.25rem;
  }

  .kpi-icon {
    display: none;
  }

  .login-card {
    padding: 32px 20px;
  }

  .search-page-form {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after,
  .hh-toast {
    animation: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}

/* --- Touch targets --- */
@media (pointer: coarse) {
  .seg-item {
    min-width: 40px;
    min-height: 40px;
    justify-content: center;
  }

  .user-signout {
    width: 40px;
    height: 40px;
  }
}
