/* ==========================================================================
   iThuba design system (v2)
   Load this LAST on every page:  <link rel="stylesheet" href="/css/ithuba-theme.css">
   (employer/ and admin/ pages use ../css/ithuba-theme.css)

   Component layer only: layout, cards, forms, badges, alerts, tables, footer, mobile fixes.
   It has NO colours, fonts or radii of its own. Every token below points at iThuba's
   existing variables: employer/tokens.css on employer-portal pages (checked first), then
   styles.css on worker and admin pages, then a hex fallback.
   Base element rules use :where() so page CSS can still override; .it-* components are explicit.
   ========================================================================== */

:root {
  /* Dark surfaces (header bars, hero, footer) */
  --it-navy-950: var(--color-dark-surface, var(--color-secondary, #001f3f));
  --it-navy-900: var(--color-ink-theme, var(--color-secondary, #001f3f));

  /* Primary (buttons, links) */
  --it-blue-700: var(--color-ink, var(--color-primary-dark, #1e5f3a));
  --it-blue-600: var(--color-ink-theme, var(--color-primary, #228B22));
  --it-blue-500: var(--color-teal, var(--color-primary-light, #2e8b57));
  --it-blue-300: var(--color-teal, var(--color-primary-light, #2e8b57));
  --it-blue-100: var(--color-border, var(--color-gray-200, #E8E6E1));
  --it-blue-50:  var(--color-paper, var(--color-gray-100, #f8f9fa));

  /* Text on dark surfaces (header, hero, footer) */
  --it-on-dark:       var(--color-dark-text-muted, #d6dde6);
  --it-on-dark-muted: var(--color-dark-text-faint, #9fb0c3);

  /* Neutrals */
  --it-grey-25:  var(--color-surface, #ffffff);
  --it-grey-50:  var(--color-paper, var(--color-gray-50, #F9F9F9));
  --it-grey-100: var(--color-paper, var(--color-gray-100, #f8f9fa));
  --it-grey-200: var(--color-border, var(--color-gray-300, #dee2e6));
  --it-grey-300: var(--color-border, var(--color-gray-300, #dee2e6));
  --it-grey-400: var(--color-text-faint, var(--color-gray-400, #999));
  --it-grey-500: var(--color-text-muted, var(--color-gray-500, #6c757d));
  --it-grey-600: var(--color-text-secondary, var(--color-gray-600, #666));
  --it-grey-800: var(--color-text, var(--color-gray-800, #333));
  --it-grey-900: var(--color-text, var(--color-gray-900, #1a2332));

  /* Verified / success */
  --it-mint-50:  var(--color-teal-bg, #d4edda);
  --it-mint-500: var(--color-teal, var(--color-verified, #28a745));
  --it-mint-600: var(--color-teal, var(--color-verified, #28a745));
  --it-mint-700: var(--color-teal, var(--color-success, #2D5A3A));

  /* Accent that must pop (CTA, steps, banner) */
  --it-gold-300: var(--color-amber-bg, var(--color-accent-light, #e8d4a0));
  --it-gold-400: var(--color-amber, var(--color-accent-light, #e8d4a0));
  --it-gold-500: var(--color-amber, var(--color-accent, #c9a961));
  --it-gold-600: var(--color-amber-text, #a88a4a);
  --it-gold-ink: var(--color-text, var(--color-gray-900, #1a2332));

  /* Status */
  --it-danger:    var(--color-danger, #8B4545);
  --it-danger-50: #f8d7da;
  --it-warning-50:#fff3cd;

  /* Type: employer portal uses its own fonts (tokens.css); worker/admin the system stack */
  --it-font: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
  --it-font-heading: var(--font-display, var(--it-font));

  /* Shape + depth: each area keeps its own corner radii */
  --it-radius: var(--radius-sm, 4px);
  --it-radius-lg: var(--radius-md, 6px);
  --it-border: 1px solid var(--it-grey-200);
  --it-shadow-sm: 0 1px 2px rgba(0, 31, 63, 0.06);
  --it-shadow:    0 2px 8px rgba(0, 31, 63, 0.08);
  --it-shadow-lg: 0 10px 30px rgba(0, 31, 63, 0.14);

  /* Layout */
  --it-max: 1180px;
  --it-gutter: clamp(16px, 4vw, 32px);
}

/* ---------- Base (low specificity) ---------- */
:where(html) { -webkit-text-size-adjust: 100%; }
:where(body) {
  font-family: var(--it-font);
  color: var(--it-grey-900);
  background: var(--it-grey-100);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
:where(h1, h2, h3, h4, h5, h6) {
  font-family: var(--it-font-heading);
  color: var(--it-navy-900);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
:where(a) { color: var(--it-blue-600); }
:where(a:hover) { color: var(--it-blue-700); }
:where(input, select, textarea) {
  font-family: var(--it-font);
  font-size: 0.95rem;
  color: var(--it-grey-900);
  background: #fff;
  border: 1px solid var(--it-grey-300);
  border-radius: var(--it-radius);
  padding: 0.65rem 0.8rem;
}
:where(input, select, textarea):focus {
  outline: 2px solid var(--it-blue-500);
  outline-offset: 1px;
  border-color: var(--it-blue-500);
}
:where(label) { font-weight: 600; color: var(--it-grey-800); font-size: 0.875rem; }
:where(table) { border-collapse: collapse; }
:where(th) {
  background: var(--it-grey-50);
  color: var(--it-grey-600);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--it-grey-200);
}
:where(td) { padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--it-grey-200); }
:where(::selection) { background: var(--it-blue-100); }

/* ---------- Layout ---------- */
.it-container { width: 100%; max-width: var(--it-max); margin: 0 auto; padding: 0 var(--it-gutter); }
.it-section { padding: clamp(40px, 7vw, 88px) 0; }
.it-section--white { background: #fff; }
.it-section--grey { background: var(--it-grey-100); }
.it-section--navy { background: linear-gradient(135deg, var(--it-navy-950), var(--it-navy-900) 60%, var(--it-blue-700)); color: #fff; }
.it-section--navy :where(h1, h2, h3, h4) { color: #fff; }
.it-eyebrow {
  display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--it-blue-600); margin-bottom: 0.75rem;
}
.it-section--navy .it-eyebrow { color: var(--it-gold-500); }
.it-title { font-size: clamp(1.6rem, 3.2vw, 2.4rem); margin: 0 0 0.75rem; }
.it-lead { font-size: 1.1rem; color: var(--it-grey-600); max-width: 62ch; }
.it-section--navy .it-lead { color: var(--it-on-dark); }
.it-center { text-align: center; }
.it-center .it-lead { margin-left: auto; margin-right: auto; }
.it-grid { display: grid; gap: 24px; }
.it-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.it-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.it-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .it-grid--3, .it-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .it-grid--2, .it-grid--3, .it-grid--4 { grid-template-columns: 1fr; } }

/* ---------- Top navigation ---------- */
.it-nav { background: var(--it-navy-900); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 0 rgba(255,255,255,0.06), var(--it-shadow); }
.it-nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 68px; }
.it-nav__brand img { height: 40px; width: auto; display: block; }
.it-nav__links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.it-nav__links a { color: #fff; text-decoration: none; font-weight: 500; font-size: 0.95rem; padding: 10px 14px; border-radius: var(--it-radius); opacity: 0.88; }
.it-nav__links a:hover, .it-nav__links a[aria-current="page"] { opacity: 1; background: rgba(255,255,255,0.1); }
.it-nav__cta { margin-left: 8px; }
@media (max-width: 760px) { .it-nav__links { display: none; } }

/* ---------- Buttons ---------- */
.it-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--it-font); font-weight: 600; font-size: 0.95rem; line-height: 1;
  padding: 0.85rem 1.4rem; border-radius: var(--it-radius); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.it-btn:active { transform: translateY(1px); }
.it-btn:focus-visible { outline: 3px solid var(--it-blue-300); outline-offset: 2px; }
.it-btn--primary { background: var(--it-blue-600); color: #fff; box-shadow: var(--it-shadow-sm); }
.it-btn--primary:hover { background: var(--it-blue-700); color: #fff; }
.it-btn--outline { background: transparent; color: var(--it-blue-600); border-color: var(--it-blue-600); }
.it-btn--outline:hover { background: var(--it-blue-50); color: var(--it-blue-700); }
.it-btn--light { background: #fff; color: var(--it-navy-900); }
.it-btn--light:hover { background: var(--it-blue-50); }
.it-btn--ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,0.55); }
.it-btn--ghost-light:hover { background: rgba(255,255,255,0.12); color: #fff; }
.it-btn--accent { background: var(--it-gold-500); color: var(--it-gold-ink); box-shadow: 0 2px 0 var(--it-gold-600); }
.it-btn--accent:hover { background: var(--it-gold-400); color: var(--it-gold-ink); }
.it-btn--sm { padding: 0.55rem 0.9rem; font-size: 0.85rem; }
.it-btn--lg { padding: 1rem 1.8rem; font-size: 1.02rem; }
.it-btn--block { display: flex; width: 100%; }
.it-btn:disabled, .it-btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Hero ---------- */
.it-hero { background: linear-gradient(135deg, var(--it-navy-950) 0%, var(--it-navy-900) 55%, var(--it-blue-700) 100%); color: #fff; position: relative; overflow: hidden; }
.it-hero::after { content: ''; position: absolute; inset: auto -10% -40% auto; width: 60%; aspect-ratio: 1; background: radial-gradient(closest-side, rgba(143,177,230,0.28), transparent); pointer-events: none; }
.it-hero__inner { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: center; padding-top: clamp(48px, 8vw, 104px); padding-bottom: clamp(48px, 8vw, 104px); position: relative; z-index: 1; }
.it-hero h1 { color: #fff; font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 800; margin: 0 0 1rem; }
.it-hero h1 em { font-style: normal; color: var(--it-gold-500); }
.it-hero p { color: var(--it-on-dark); font-size: 1.15rem; max-width: 56ch; }
.it-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.it-hero__art { display: flex; justify-content: center; }
.it-hero__art img { width: min(100%, 360px); height: auto; filter: drop-shadow(0 18px 40px rgba(0,0,0,0.35)); }
@media (max-width: 860px) { .it-hero__inner { grid-template-columns: 1fr; text-align: left; } .it-hero__art { order: 2; } .it-hero__art img { width: 130px; } }

/* ---------- Cards ---------- */
.it-card { background: #fff; border: var(--it-border); border-radius: var(--it-radius-lg); box-shadow: var(--it-shadow-sm); padding: 28px; }
.it-card--hover { transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s; }
.it-card--hover:hover { box-shadow: var(--it-shadow-lg); transform: translateY(-2px); border-color: var(--it-blue-300); }
.it-card--accent { border-top: 3px solid var(--it-blue-600); }
.it-card h3 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.it-card p { margin: 0; color: var(--it-grey-600); }
.it-icon { width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; background: var(--it-blue-50); color: var(--it-blue-600); border-radius: var(--it-radius); margin-bottom: 16px; font-size: 1.4rem; font-weight: 700; }
.it-icon--mint { background: var(--it-mint-50); color: var(--it-mint-700); }
.it-icon--gold { background: var(--it-gold-300); color: var(--it-gold-ink); }
.it-step { counter-increment: it-step; position: relative; }
.it-step::before { content: counter(it-step); display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 50%; background: var(--it-gold-500); color: var(--it-gold-ink); font-weight: 800; margin-bottom: 14px; }
.it-steps { counter-reset: it-step; }

/* ---------- Accent call-out band ---------- */
.it-banner { background: linear-gradient(135deg, var(--it-gold-500), var(--it-gold-400)); color: var(--it-gold-ink); padding: 22px 0; font-weight: 700; text-align: center; }
.it-banner a { color: var(--it-gold-ink); }

/* ---------- Stats ---------- */
.it-stat { text-align: center; padding: 8px 12px; }
.it-stat__num { display: block; font-size: clamp(1.8rem, 3vw, 2.5rem); font-weight: 800; color: var(--it-blue-600); line-height: 1.1; }
.it-stat__label { display: block; color: var(--it-grey-600); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }

/* ---------- Forms ---------- */
.it-form-card { background: #fff; border: var(--it-border); border-top: 4px solid var(--it-blue-600); border-radius: var(--it-radius-lg); box-shadow: var(--it-shadow); padding: clamp(22px, 4vw, 40px); width: 100%; max-width: 520px; margin: 0 auto; }
.it-form-card h1, .it-form-card h2 { margin-top: 0; }
.it-field { margin-bottom: 18px; }
.it-field > label { display: block; margin-bottom: 6px; }
.it-field input, .it-field select, .it-field textarea { width: 100%; }
.it-help { font-size: 0.8rem; color: var(--it-grey-500); margin-top: 4px; }
.it-error { color: var(--it-danger); font-size: 0.85rem; }

/* ---------- Badges / status ---------- */
.it-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 700; padding: 3px 9px; border-radius: var(--it-radius, 4px); background: var(--it-grey-200); color: var(--it-grey-800); }
.it-badge--blue { background: var(--it-blue-50); color: var(--it-blue-700); }
.it-badge--mint { background: var(--it-mint-50); color: var(--it-mint-700); }
.it-badge--gold { background: var(--it-gold-300); color: var(--it-gold-ink); }
.it-badge--danger { background: var(--it-danger-50); color: var(--it-danger); }

/* ---------- Alerts ---------- */
.it-alert { border-radius: var(--it-radius); padding: 12px 16px; border: 1px solid var(--it-blue-100); background: var(--it-blue-50); color: var(--it-blue-700); }
.it-alert--success { background: var(--it-mint-50); border-color: #c3e6cb; color: var(--it-mint-700); }
.it-alert--warning { background: var(--it-warning-50); border-color: var(--it-gold-300); color: #856404; }
.it-alert--danger { background: var(--it-danger-50); border-color: #f5c6cb; color: var(--it-danger); }

/* ---------- Page header strip (inside the app) ---------- */
.it-pagehead { background: #fff; border-bottom: var(--it-border); }
.it-pagehead__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 22px; padding-bottom: 22px; flex-wrap: wrap; }
.it-pagehead h1 { margin: 0; font-size: 1.5rem; }
.it-crumbs { font-size: 0.8rem; color: var(--it-grey-500); }

/* ---------- Tables ---------- */
.it-table-wrap { background: #fff; border: var(--it-border); border-radius: var(--it-radius-lg); box-shadow: var(--it-shadow-sm); overflow-x: auto; }
.it-table { width: 100%; }
.it-table tbody tr:hover { background: var(--it-blue-50); }

/* ---------- Footer ---------- */
.it-footer { background: var(--it-navy-950); color: var(--it-on-dark); padding: 56px 0 24px; font-size: 0.92rem; }
.it-footer a { color: var(--it-on-dark); text-decoration: none; }
.it-footer a:hover { color: #fff; text-decoration: underline; }
.it-footer__grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
.it-footer h4 { color: #fff; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 14px; }
.it-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.it-footer__brand img { height: 42px; margin-bottom: 12px; }
.it-footer__legal { border-top: 1px solid rgba(255,255,255,0.12); margin-top: 36px; padding-top: 18px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--it-on-dark-muted); font-size: 0.82rem; }
@media (max-width: 760px) { .it-footer__grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Utilities ---------- */
.it-mt-0 { margin-top: 0; } .it-mt-2 { margin-top: 16px; } .it-mt-4 { margin-top: 32px; }
.it-mb-0 { margin-bottom: 0; } .it-mb-2 { margin-bottom: 16px; } .it-mb-4 { margin-bottom: 32px; }
.it-hide-sm { } @media (max-width: 620px) { .it-hide-sm { display: none !important; } }

/* ---------- Mobile hardening (phones and small tablets) ---------- */
/* wide data tables scroll inside themselves instead of stretching the page (all screen sizes) */
.results-table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 900px) {
  table.data-table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 760px) {
  input, select, textarea, .form-input, .form-textarea, .form-select { max-width: 100%; box-sizing: border-box; }
  img, svg, video, canvas, iframe { max-width: 100%; }
  .page-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
  .page-tabs .tab-btn { flex: 1 1 auto; }
  /* comfortable tap targets for text links in footers and menus */
  .it-footer a, .it-nav__links a, .it-crumbs a { display: inline-block; padding: 7px 0; }
  .it-footer ul { gap: 2px; }
  .it-btn { min-height: 44px; }
  input:not([type="checkbox"]):not([type="radio"]), select { min-height: 44px; font-size: 16px; } /* 16px stops iOS zooming on focus */
}

/* Components include their padding in their width (pages that don't set a global border-box rule) */
.it-container, .it-card, .it-form-card, .it-btn, .it-nav__inner, .it-footer__grid, .it-hero__inner, .it-banner, .it-table-wrap, .it-alert { box-sizing: border-box; }

@media (max-width: 760px) {
  /* form cards keep a gutter from the screen edge */
  .register-container, .login-container, .it-form-card { width: auto; max-width: calc(100% - 32px); margin-left: auto; margin-right: auto; }
}

/* Stacked button groups fill their panel without poking out of it */
.btn-group-vertical { display: flex; flex-direction: column; gap: 10px; }
.btn-group-vertical .btn, .btn-group-vertical button, .btn-group-vertical a { width: 100%; box-sizing: border-box; margin: 0; }

/* Phone fields everywhere: country code and number side by side, the number gets the room.
   Applies only inside a dedicated .phone-input-row or an inline-flex row, never to a whole form box. */
.phone-input-row { display: flex; gap: 6px; align-items: stretch; }
.phone-input-row > select,
div[style*="display:flex"] > select[aria-label*="ountry code"] { flex: 0 0 38%; max-width: 38%; min-width: 0; width: auto; text-overflow: ellipsis; }
.phone-input-row > input,
div[style*="display:flex"] > select[aria-label*="ountry code"] ~ input { flex: 1 1 auto; min-width: 0; width: auto !important; max-width: none; }
/* keep the code picker and the number box the same height */
.phone-input-row > select, .phone-input-row > input { margin: 0 !important; box-sizing: border-box; min-height: 44px; height: 44px; }
