/* CRM Design System Layer (on top of Dashforge) */
:root {
  --font-xs: 0.75rem;   
  --font-sm: 0.8125rem; 
  --font-base: clamp(0.85rem, 0.2vw + 0.8rem, 0.875rem);
  --font-md: clamp(0.95rem, 0.4vw + 0.85rem, 1rem);
  --font-lg: clamp(1.05rem, 0.6vw + 0.95rem, 1.125rem);
  --font-xl: clamp(1.2rem, 1vw + 1rem, 1.375rem);
  --font-xxl: clamp(1.4rem, 1.5vw + 1rem, 1.75rem);

  --lh-tight: 1.2;
  --lh-normal: 1.4;
  --lh-relaxed: 1.6;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 1.5rem;
  --space-xxl: 2rem;

  --crm-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --crm-shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);

  --crm-bg-page: #f4f6fb;
  --crm-bg-card: #ffffff;
  --crm-bg-muted: #f9fafc;
  --crm-bg-light-gray: #e1e9f1;

  --crm-text-primary: #1f2933;
  --crm-text-secondary: #44505C;
  --crm-text-muted: #6c757d;

  --crm-border: #d9e2ec;
  --crm-border-light: #edf2f7;

  --crm-radius-sm: 4px;
  --crm-radius-md: 8px;
  --crm-radius-lg: 12px;

  --font-primary: 'Roboto', sans-serif;
}

body {
  background-color: var(--crm-bg-page);
  color: var(--crm-text-primary);
  font-size: var(--font-base);
  line-height: var(--lh-normal);
  font-family: var(--font-primary);
  padding-top: env(safe-area-inset-top);
}

h1, .h1 {
  font-size: var(--font-xxl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  margin-bottom: var(--space-lg);
}
h2, .h2 {
  font-size: var(--font-xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  margin-bottom: var(--space-lg);
}
h3, .h3 {
  font-size: var(--font-lg);
  font-weight: var(--fw-medium);
  line-height: var(--lh-normal);
  margin-bottom: var(--space-sm);
}
h4, .h4 {
  font-size: var(--font-md);
  font-weight: var(--fw-medium);
  line-height: var(--lh-normal);
  margin-bottom: var(--space-sm);
}
h5, .h5 {
  font-size: var(--font-base);
  font-weight: var(--fw-medium);
  line-height: var(--lh-normal);
  margin-bottom: var(--space-xs);
}
h6, .h6 {
  font-size: var(--font-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-normal);
  margin-bottom: var(--space-xs);
}

.page-title {
  font-size: var(--font-lg);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  margin-bottom: var(--space-lg);
}
.section-title {
  font-size: var(--font-xl);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--space-lg);
}
.card-title {
  font-size: var(--font-lg);
  font-weight: var(--fw-medium);
  line-height: var(--lh-normal);
  margin-bottom: var(--space-md);
}
.subsection-title {
  font-size: var(--font-md);
  font-weight: var(--fw-medium);
  margin-bottom: var(--space-sm);
}
.group-title {
  font-size: var(--font-base);
  font-weight: var(--fw-medium);
  margin-bottom: var(--space-xs);
}

.card {
  border-color: var(--crm-border);
  border-radius: var(--crm-radius-md);
  background-color: var(--crm-bg-card);
  box-shadow: var(--crm-shadow-sm);
}

.table {
  font-size: var(--font-sm);
}
.table thead th {
  font-weight: 500;
  background-color: var(--crm-light-gray);
  color: var(--crm-text-secondary);
}
.thead {
  background-color: var(--crm-bg-light-gray);
  color: var(--crm-text-secondary);
}
.table td, .table th {
  padding: var(--space-xs) var(--space-sm);
  vertical-align: middle;
}

.form-label {
  font-size: var(--font-base);
  font-weight: 500;
  margin-bottom: var(--space-xs);
  display: block;
}
.form-control {
  font-size: var(--font-base);
  line-height: 1.5;
  border-radius: var(--crm-radius-sm);
  border-color: var(--crm-border);
}
.form-help {
  font-size: var(--font-sm);
  color: var(--crm-text-secondary);
  margin-top: var(--space-xs);
}

/* For Dark Mode */
[data-theme="dark"] {
  --crm-bg-page: #1e1f25;
  --crm-bg-card: #2a2d35;
  --crm-bg-muted: #323641;

  --crm-text-primary: #f1f3f5;
  --crm-text-secondary: #cbd5e1;
  --crm-text-muted: #9ca3af;

  --crm-border: #3a3f4b;
  --crm-border-light: #2f3541;

  --crm-shadow-sm: none;
  --crm-shadow-md: none;
}