/* ═══════════════════════════════════════════════════════════════
   SustBridge Design Tokens — v1.0
   Single source of truth for all CSS variables.
   Replaces: design-system.css, all inline :root blocks.
   Import: <link rel="stylesheet" href="/styles/design-tokens.css">
   ═══════════════════════════════════════════════════════════════ */

:root {

  /* ─── Base ─── */
  --base-bg: #ffffff;
  --base-alt: #fafbfc;

  /* ─── Contrast scale (grayscale) ───
     Used for borders, disabled states, subtle backgrounds.
     Values from Design Guidelines PDF (opacity-based). */
  --contrast-100: #2A2A2A;
  --contrast-90:  rgba(42, 42, 42, 0.90);
  --contrast-80:  rgba(42, 42, 42, 0.80);
  --contrast-70:  rgba(42, 42, 42, 0.70);
  --contrast-60:  rgba(42, 42, 42, 0.60);
  --contrast-50:  rgba(42, 42, 42, 0.52);
  --contrast-40:  rgba(42, 42, 42, 0.40);
  --contrast-30:  rgba(42, 42, 42, 0.26);
  --contrast-20:  rgba(42, 42, 42, 0.20);
  --contrast-10:  rgba(42, 42, 42, 0.10);
  --contrast-5:   rgba(42, 42, 42, 0.05);

  /* ─── Semantic text ─── */
  --text-heading:  #173F5F;
  --text-body:     #2A2A2A;
  --text-secondary: #2A2A2A;           /* alias for body in secondary contexts */
  --text-muted:    rgba(42, 42, 42, 0.52);
  --text-dim:      rgba(42, 42, 42, 0.26);
  --text-disabled: rgba(42, 42, 42, 0.35);

  /* ─── Primary (brand green) ───
     #2E7D4F from logo / Design Guidelines */
  --primary:       #2E7D4F;
  --primary-dark:  #256B42;
  --primary-text:  #005A8D;
  --primary-50:    rgba(46, 125, 79, 0.50);
  --primary-10:    rgba(46, 125, 79, 0.10);
  --primary-contrast: #ffffff;

  /* ─── Status: Error ─── */
  --error:         #E21D12;
  --error-text:    #CA150C;
  --error-50:      rgba(226, 29, 18, 0.50);
  --error-10:      rgba(226, 29, 18, 0.10);
  --error-contrast: #ffffff;

  /* ─── Status: Warning ─── */
  --warning:       #FFCC00;
  --warning-text:  #985211;
  --warning-10:    rgba(255, 204, 0, 0.10);
  --warning-contrast: var(--contrast-100);

  /* ─── Status: Success ─── */
  --success:       #158444;
  --success-text:  #0A7637;
  --success-50:    rgba(21, 132, 68, 0.50);
  --success-10:    rgba(21, 132, 68, 0.10);
  --success-contrast: #ffffff;

  /* ─── Role: Company (purple) ─── */
  --company:       #534AB7;
  --company-10:    rgba(83, 74, 183, 0.10);

  /* ─── User colors (avatars, collaborative) ─── */
  --user-0: #0F5952;
  --user-1: #85044C;
  --user-2: #0577AA;
  --user-3: #A26200;
  --user-4: #8F1F5A;
  --user-5: #584301;
  --user-6: #070636;

  /* ─── Shadows ─── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-s:  0 1px 4px rgba(0, 0, 0, 0.08);
  --shadow-m:  0 2px 8px rgba(0, 0, 0, 0.10);
  --shadow-l:  0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.15);

  /* ─── Border radius (from Shapes: small/medium/large) ─── */
  --radius-s: 4px;
  --radius-m: 8px;
  --radius-l: 12px;

  /* ─── Layout constants ─── */
  --rail-width:    56px;
  --topbar-height: 44px;
  --tabbar-height: 38px;
  --chat-collapsed-height: 46px;
  --chat-expanded-height: 180px;

  /* ─── Breakpoints (reference only — used in @media) ───
     --bp-tablet: 768px;
     --bp-phone:  480px;
  */

  /* ─── Z-index layers ─── */
  --z-rail:     10;
  --z-topbar:   10;
  --z-chat:     20;
  --z-overlay:  30;
  --z-backdrop: 29;
  --z-modal:    40;
  --z-toast:    50;

  /* ─── Typography ─── */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Roboto', 'Segoe UI', sans-serif;
  --font-mono:   'SF Mono', 'Fira Code', 'Consolas', monospace;

  /* ─── Transitions ─── */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 350ms;
}

/* ═══════════════════════════════════════
   Reset & Base
   ═══════════════════════════════════════ */

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

body {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-body);
  background: var(--base-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════
   Typography utility classes
   From Design Guidelines PDF
   ═══════════════════════════════════════ */

.heading-xxxl { font-size: 40px; font-weight: 600; line-height: 1.2; color: var(--text-heading); }
.heading-xxl  { font-size: 28px; font-weight: 600; line-height: 1.25; color: var(--text-heading); }
.heading-xl   { font-size: 22px; font-weight: 600; line-height: 1.3; color: var(--text-heading); }
.heading-l    { font-size: 18px; font-weight: 600; line-height: 1.35; color: var(--text-heading); }
.heading-m    { font-size: 16px; font-weight: 600; line-height: 1.4; color: var(--text-heading); }
.heading-s    { font-size: 14px; font-weight: 600; line-height: 1.4; text-transform: uppercase; color: var(--text-heading); }
.body-text    { font-size: 16px; font-weight: 400; line-height: 1.5; }
.small-text   { font-size: 14px; font-weight: 400; line-height: 1.5; }
.text-xs      { font-size: 12px; font-weight: 400; line-height: 1.5; }
.text-xxs     { font-size: 10px; font-weight: 400; line-height: 1.4; }

/* ═══════════════════════════════════════
   Buttons
   From Design Guidelines PDF
   ═══════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-m);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-primary { background: var(--primary); color: var(--primary-contrast); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-success { background: var(--success); color: var(--success-contrast); }
.btn-success:hover:not(:disabled) { background: #0e7038; }

.btn-error { background: var(--error); color: var(--error-contrast); }
.btn-error:hover:not(:disabled) { background: #c41812; }

.btn-ghost { background: transparent; color: var(--text-body); border: 1px solid var(--contrast-30); }
.btn-ghost:hover:not(:disabled) { background: var(--contrast-5); }

.btn-text { background: transparent; color: var(--primary); border: none; padding: 6px 10px; }
.btn-text:hover:not(:disabled) { background: var(--primary-10); }

.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ═══════════════════════════════════════
   Form inputs
   ═══════════════════════════════════════ */

.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-body);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--contrast-30);
  border-radius: var(--radius-m);
  font-family: var(--font-family);
  font-size: 16px;
  color: var(--text-body);
  background: var(--base-bg);
  transition: border-color var(--duration-fast);
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-10);
}
.form-input.invalid {
  border-color: var(--error);
  background: var(--error-10);
}
.form-input:disabled {
  background: var(--contrast-5);
  color: var(--text-disabled);
}
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--error-text); margin-top: 4px; }

/* ═══════════════════════════════════════
   Cards
   ═══════════════════════════════════════ */

.card {
  background: var(--base-bg);
  border: 1px solid var(--contrast-10);
  border-radius: var(--radius-l);
  padding: 24px;
  box-shadow: var(--shadow-xs);
}

/* ═══════════════════════════════════════
   Badges
   ═══════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
}
.badge-primary { background: var(--primary-10); color: var(--primary); }
.badge-success { background: var(--success-10); color: var(--success-text); }
.badge-warning { background: var(--warning-10); color: var(--warning-text); }
.badge-error   { background: var(--error-10);   color: var(--error-text); }
.badge-company { background: var(--company-10); color: var(--company); }

/* ═══════════════════════════════════════
   Notifications / toasts
   ═══════════════════════════════════════ */

.notification {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-m);
  font-size: 14px;
  margin-bottom: 16px;
}
.notification-success { background: var(--success); color: #fff; }
.notification-error   { background: var(--error);   color: #fff; }
.notification-warning { background: var(--warning); color: var(--contrast-100); }
.notification-info    { background: var(--primary-10); color: var(--primary); border: 1px solid var(--primary-50); }

/* ═══════════════════════════════════════
   Utility
   ═══════════════════════════════════════ */

.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-dim); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); border: 0;
}
