/**
 * Marine Hub Mini App — Stage 1 Premium Design System (#377)
 * Tokens + reusable primitives. Loads after styles.css.
 * Screen-specific redesigns are Stages 2–3.
 *
 * Typography (system sans, no remote fonts):
 * | Token            | Size   | LH    | Weight | Tracking |
 * | display          | 1.75rem| 1.15  | 800    | -0.02em  |
 * | screen-title     | 1.35rem| 1.2   | 750    | -0.015em |
 * | section-title    | 1.05rem| 1.25  | 700    | -0.01em  |
 * | card-title       | 0.98rem| 1.3   | 700    | 0        |
 * | body             | 0.94rem| 1.45  | 400    | 0        |
 * | body-strong      | 0.94rem| 1.45  | 650    | 0        |
 * | metadata         | 0.8rem | 1.35  | 500    | 0        |
 * | label            | 0.78rem| 1.3   | 650    | 0.01em   |
 * | caption          | 0.72rem| 1.3   | 500    | 0        |
 * | button           | 0.92rem| 1.2   | 700    | 0        |
 *
 * Spacing: 4 / 8 / 12 / 16 / 20 / 24 / 32
 * Radius: sm 8 / md 12 / lg 16 / pill 999
 */

:root,
html[data-theme="light"] {
  /* Spacing scale */
  --mh-space-1: 4px;
  --mh-space-2: 8px;
  --mh-space-3: 12px;
  --mh-space-4: 16px;
  --mh-space-5: 20px;
  --mh-space-6: 24px;
  --mh-space-7: 32px;
  --mh-page-gutter: var(--mh-space-4);
  --mh-section-gap: var(--mh-space-5);
  --mh-component-gap: var(--mh-space-3);
  --mh-card-pad: var(--mh-space-4);
  --mh-row-pad-y: 12px;
  --mh-row-pad-x: 14px;

  /* Radius scale */
  --mh-radius-sm: 8px;
  --mh-radius-md: 12px;
  --mh-radius-lg: 16px;
  --mh-radius-pill: 999px;
  --radius-sm: var(--mh-radius-sm);
  --radius-md: var(--mh-radius-md);
  --radius-lg: var(--mh-radius-lg);

  /* Typography */
  --mh-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mh-type-display: 1.82rem;
  --mh-type-screen: 1.62rem;
  --mh-type-screen-weight: 800;
  --mh-type-screen-tracking: -0.03em;
  --mh-type-screen-lh: 1.12;
  --mh-type-section: 1.08rem;
  --mh-card-radius: 16px;
  --mh-type-card: 1.06rem;
  --mh-type-body: 0.94rem;
  --mh-type-meta: 0.8rem;
  --mh-type-label: 0.76rem;
  --mh-type-caption: 0.7rem;
  --mh-type-button: 0.92rem;
  --mh-card-surface: #f7f4ee;
  --mh-card-edge: color-mix(in srgb, var(--mh-border) 70%, transparent);
  --mh-kicker: #8a6f3d;
  --mh-lh-tight: 1.15;
  --mh-lh-snug: 1.25;
  --mh-lh-body: 1.45;

  /* Surface hierarchy (warm stone light) */
  --mh-surface-page: var(--mh-bg);
  --mh-surface-standard: var(--mh-surface);
  --mh-surface-raised: var(--mh-surface-elevated);
  --mh-surface-inset: var(--mh-surface-muted);
  --mh-surface-interactive: var(--mh-input-bg);
  --mh-surface-sticky: color-mix(in srgb, var(--mh-surface) 92%, transparent);
  --mh-surface-nav: var(--mh-nav-bg);
  --mh-surface-diag: color-mix(in srgb, var(--mh-surface-muted) 80%, transparent);

  /* Border / divider */
  --mh-border-subtle: color-mix(in srgb, var(--mh-border) 55%, transparent);
  --mh-border-standard: var(--mh-border);
  --mh-border-strong: color-mix(in srgb, var(--mh-text) 18%, var(--mh-border));
  --mh-line-divider: var(--mh-divider);

  /* Elevation */
  --mh-elev-flat: none;
  --mh-elev-low: 0 1px 3px rgba(15, 23, 42, 0.06);
  --mh-elev-med: 0 4px 14px rgba(15, 23, 42, 0.08);
  --mh-elev-sticky: 0 -6px 20px rgba(15, 23, 42, 0.08);

  /* Control sizing */
  --mh-control-h: 48px;
  --mh-control-h-sm: 40px;
  --mh-tap-min: var(--tap-min, 44px);

  /*
   * #681 — global button family, measured from Saved / Daily Alerts CTAs.
   * Geometry is shared; color encodes semantics. Never apply these to
   * bottom nav, chips, tabs, inputs, badges, or inline links.
   */
  --mh-btn-h: var(--mh-tap-min);
  --mh-btn-h-compact: var(--mh-tap-min);
  --mh-btn-radius: var(--mh-radius-pill);
  --mh-btn-pad-x: 18px;
  --mh-btn-pad-x-compact: 12px;
  --mh-btn-weight: 750;
  --mh-btn-primary-bg: var(--mh-accent);
  --mh-btn-primary-fg: #fff;
  --mh-btn-primary-border: transparent;
  --mh-btn-secondary-bg: transparent;
  --mh-btn-secondary-fg: var(--mh-text);
  --mh-btn-secondary-border: color-mix(in srgb, var(--mh-text) 22%, var(--mh-border-subtle));
  --mh-btn-danger-bg: var(--mh-danger);
  --mh-btn-danger-fg: #fff;
  --mh-btn-success-bg: #d1fadf;
  --mh-btn-success-fg: #037a48;
  --mh-btn-success-border: color-mix(in srgb, #039855 35%, transparent);
  --mh-btn-disabled-bg: var(--mh-surface-inset);
  --mh-btn-disabled-fg: var(--mh-disabled);

  /* #485 — salary: monochrome/silver with restrained gold ring (not green) */
  --mh-salary-fg: #121316;
  --mh-salary-bg: #eceef1;
  --mh-salary-ring: color-mix(in srgb, #c6a66a 42%, transparent);

  /* #736 — felt-not-seen canvas depth (warm stone / gold, no blue glow) */
  --mh-canvas-glow: radial-gradient(
    120% 70% at 50% -8%,
    color-mix(in srgb, #c6a66a 7%, transparent) 0%,
    transparent 55%
  );
  --mh-canvas-veil: linear-gradient(
    180deg,
    color-mix(in srgb, #f7f4ee 88%, #c6a66a 12%) 0%,
    transparent 46%
  );

  --mh-elev-low: 0 1px 2px rgba(12, 13, 15, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  --mh-elev-med: 0 4px 14px rgba(12, 13, 15, 0.07);
  --mh-elev-sticky: 0 -6px 20px rgba(12, 13, 15, 0.08);

  /*
   * #488 — semantic depth system (tonal + edge + soft shadow).
   * DEPTH 0 canvas · 1 content rows · 2 controls · 3 sticky/nav/hero CTA
   */
  --mh-depth-0-shadow: none;
  --mh-depth-0-highlight: none;
  --mh-depth-1-shadow: 0 1px 2px rgba(12, 13, 15, 0.04);
  --mh-depth-1-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  --mh-depth-2-shadow: 0 2px 8px rgba(12, 13, 15, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --mh-depth-2-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  --mh-depth-3-shadow: 0 -8px 22px rgba(12, 13, 15, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  --mh-depth-3-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  --mh-press-ms: 160ms;
  --mh-press-scale: 0.988;
  --mh-ambient-drift-ms: 28s;
  --mh-ambient-beam-ms: 30s;
  --mh-ambient-gold: color-mix(in srgb, #c6a66a 10%, transparent);
  --mh-ambient-silver: color-mix(in srgb, #c6a66a 8%, transparent);

  --mh-card-inset-y: 16px;
  --mh-card-inset-x: 14px;
  --mh-stack-gap: 10px;
  --mh-icon-text-gap: 12px;
  --mh-avatar-text-gap: 14px;
  --mh-type-status: 0.76rem;

  --screen-pad-x: var(--mh-page-gutter);
}

html[data-theme="dark"] {
  --mh-surface-page: var(--mh-bg);
  --mh-surface-standard: var(--mh-surface);
  --mh-surface-raised: var(--mh-surface-elevated);
  --mh-surface-inset: var(--mh-surface-muted);
  --mh-surface-interactive: var(--mh-input-bg);
  --mh-surface-sticky: color-mix(in srgb, var(--mh-surface-elevated) 94%, transparent);
  --mh-surface-nav: var(--mh-nav-bg);
  --mh-surface-diag: color-mix(in srgb, var(--mh-surface-muted) 88%, transparent);
  --mh-border-subtle: color-mix(in srgb, var(--mh-border) 70%, transparent);
  --mh-border-standard: var(--mh-border);
  --mh-border-strong: color-mix(in srgb, #fff 14%, var(--mh-border));
  --mh-line-divider: var(--mh-divider);
  --mh-elev-low: 0 1px 4px rgba(0, 0, 0, 0.28);
  --mh-elev-med: 0 6px 18px rgba(0, 0, 0, 0.32);
  --mh-elev-sticky: 0 -8px 22px rgba(0, 0, 0, 0.35);

  /* #485 dark salary: bright silver on raised graphite + gold micro-ring */
  --mh-salary-fg: #f4f4f2;
  --mh-salary-bg: #191b1f;
  --mh-salary-ring: color-mix(in srgb, #c6a66a 38%, transparent);
  --mh-canvas-glow: radial-gradient(
    125% 80% at 50% -14%,
    color-mix(in srgb, #c6a66a 7%, transparent) 0%,
    color-mix(in srgb, #202226 35%, transparent) 28%,
    transparent 60%
  );
  --mh-canvas-veil: linear-gradient(
    180deg,
    color-mix(in srgb, #070708 88%, transparent) 0%,
    color-mix(in srgb, #0c0d0f 55%, transparent) 28%,
    transparent 58%
  );
  --mh-elev-low: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --mh-elev-med: 0 6px 18px rgba(0, 0, 0, 0.38);
  --mh-elev-sticky: 0 -8px 22px rgba(0, 0, 0, 0.4);

  /* #488 dark depth — graphite tonal lift, no navy glow */
  --mh-depth-0-shadow: none;
  --mh-depth-0-highlight: none;
  --mh-depth-1-shadow: 0 1px 3px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  --mh-depth-1-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --mh-depth-2-shadow: 0 3px 12px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --mh-depth-2-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --mh-depth-3-shadow: 0 -10px 26px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --mh-depth-3-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --mh-ambient-gold: color-mix(in srgb, #c6a66a 16%, transparent);
  --mh-ambient-silver: color-mix(in srgb, #c8cbd0 14%, transparent);
  --mh-card-surface: #181b21;
  --mh-card-edge: color-mix(in srgb, #ffffff 9%, transparent);
  --mh-kicker: #d8be88;

  --mh-btn-primary-bg: var(--mh-accent);
  --mh-btn-primary-fg: #0c0d0f;
  --mh-btn-secondary-fg: var(--mh-text);
  --mh-btn-secondary-border: color-mix(in srgb, #fff 18%, var(--mh-border-subtle));
  /* Solid danger fill must stay dark enough for white labels. --mh-danger
     (#f87171) is the outline/text red and fails contrast as a fill. */
  --mh-btn-danger-bg: #b91c1c;
  --mh-btn-danger-fg: #fff;
  --mh-btn-success-bg: color-mix(in srgb, #039855 22%, #121316);
  --mh-btn-success-fg: #6ee7b7;
  --mh-btn-success-border: color-mix(in srgb, #6ee7b7 38%, transparent);
  --mh-btn-disabled-bg: var(--mh-surface-inset);
  --mh-btn-disabled-fg: var(--mh-disabled);

  --mh-card-inset-y: 16px;
  --mh-card-inset-x: 14px;
  --mh-stack-gap: 10px;
  --mh-icon-text-gap: 12px;
  --mh-avatar-text-gap: 14px;
  --mh-type-status: 0.76rem;
}

/* —— Typography utilities —— */
.mh-type-display {
  font-family: var(--mh-font);
  font-size: var(--mh-type-display);
  line-height: var(--mh-lh-tight);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--mh-text);
}

.mh-type-screen {
  font-family: var(--mh-font);
  font-size: var(--mh-type-screen);
  line-height: var(--mh-type-screen-lh, 1.12);
  font-weight: var(--mh-type-screen-weight, 800);
  letter-spacing: var(--mh-type-screen-tracking, -0.03em);
  color: var(--mh-text);
}

.mh-type-section {
  font-family: var(--mh-font);
  font-size: var(--mh-type-section);
  line-height: var(--mh-lh-snug);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--mh-text);
}

.mh-type-card {
  font-family: var(--mh-font);
  font-size: var(--mh-type-card);
  line-height: 1.3;
  font-weight: 700;
  color: var(--mh-text);
}

.mh-type-body {
  font-size: var(--mh-type-body);
  line-height: var(--mh-lh-body);
  font-weight: 400;
  color: var(--mh-text);
}

.mh-type-body-strong {
  font-size: var(--mh-type-body);
  line-height: var(--mh-lh-body);
  font-weight: 650;
  color: var(--mh-text);
}

.mh-type-status,
.mh-catalog-status__kicker,
.mh-coming-soon-card__kicker,
.mh-alert-state-badge {
  font-size: var(--mh-type-status, var(--mh-type-label));
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--mh-kicker, var(--mh-accent));
}

.mh-type-meta {
  font-size: var(--mh-type-meta);
  line-height: 1.35;
  font-weight: 500;
  color: var(--mh-text-secondary);
}

.mh-type-label {
  font-size: var(--mh-type-label);
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--mh-text-secondary);
}

.mh-type-caption {
  font-size: var(--mh-type-caption);
  line-height: 1.3;
  font-weight: 500;
  color: var(--mh-text-muted);
}

/* —— Surfaces —— */
.mh-surface {
  background: var(--mh-surface-standard);
  border: 1px solid transparent;
  border-radius: var(--mh-radius-lg);
  box-shadow: var(--mh-elev-low);
}

.mh-surface--elevated {
  background: var(--mh-surface-raised);
  border: 1px solid transparent;
  border-radius: var(--mh-radius-lg);
  box-shadow: var(--mh-elev-med);
}

.mh-surface--inset {
  background: var(--mh-surface-inset);
  border: 1px solid transparent;
  border-radius: var(--mh-radius-md);
  box-shadow: none;
}

/* Proof v2 salary family — Jobs list + Job Detail (Saved Stage A owns its own scoped rules) */
#view-jobs .job-card-v2__salary,
#view-jobs .mh-job-card__salary,
#view-job-detail .figma-detail-salary,
.mh-salary {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 4px 10px;
  border-radius: var(--mh-radius-pill);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: -0.008em;
  line-height: 1.25;
  color: var(--mh-salary-fg);
  background: var(--mh-salary-bg);
  border: 1px solid var(--mh-salary-ring);
  box-shadow: none;
}

.mh-surface--flat {
  background: transparent;
  border: none;
  box-shadow: none;
}

.mh-card {
  padding: var(--mh-card-pad);
  background: var(--mh-surface-standard);
  border: 1px solid var(--mh-border-subtle);
  border-radius: var(--mh-radius-lg);
  box-shadow: var(--mh-elev-low);
}

.mh-card--elevated {
  box-shadow: var(--mh-elev-med);
  border-color: var(--mh-border-standard);
}

.mh-info-group {
  display: grid;
  gap: var(--mh-space-2);
  padding: var(--mh-space-3) 0;
}

.mh-list-row {
  display: flex;
  align-items: center;
  gap: var(--mh-space-3);
  min-height: var(--mh-tap-min);
  padding: var(--mh-row-pad-y) var(--mh-row-pad-x);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--mh-line-divider);
}

.mh-list-row:last-child {
  border-bottom: none;
}

.mh-divider {
  height: 1px;
  margin: var(--mh-space-3) 0;
  background: var(--mh-line-divider);
  border: none;
}

/* —— Page / section headers —— */
.mh-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--mh-space-3);
  margin: 0 0 var(--mh-space-4);
}

.mh-page-header__titles {
  min-width: 0;
  flex: 1;
}

.mh-page-header__title {
  margin: 0;
  font-size: var(--mh-type-screen);
  line-height: var(--mh-type-screen-lh, 1.12);
  font-weight: var(--mh-type-screen-weight, 800);
  letter-spacing: var(--mh-type-screen-tracking, -0.03em);
  color: var(--mh-text);
}

.mh-page-header__subtitle {
  margin: 4px 0 0;
  font-size: var(--mh-type-meta);
  line-height: 1.35;
  font-weight: 500;
  color: var(--mh-text-muted);
}

.mh-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--mh-space-3);
  margin: 0 0 var(--mh-space-3);
}

.mh-section-header__title {
  margin: 0;
  font-size: var(--mh-type-section);
  font-weight: 700;
  color: var(--mh-text);
}

.mh-section-header__helper,
.mh-section-header__count {
  font-size: var(--mh-type-caption);
  font-weight: 600;
  color: var(--mh-text-muted);
}

/* —— Buttons (#681 Saved CTA family) —— */
.mh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: var(--mh-btn-h, var(--mh-tap-min));
  min-width: var(--mh-tap-min);
  padding: 8px var(--mh-btn-pad-x, 18px);
  border-radius: var(--mh-btn-radius, var(--mh-radius-pill));
  border: 1.5px solid transparent;
  font-family: var(--mh-font);
  font-size: var(--mh-type-button);
  font-weight: var(--mh-btn-weight, 750);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
  cursor: pointer;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease,
    opacity 0.12s ease,
    transform var(--mh-press-ms, 160ms) ease;
  -webkit-tap-highlight-color: transparent;
}

.mh-button:focus-visible {
  outline: 2px solid var(--mh-focus);
  outline-offset: 2px;
}

.mh-button:active:not(:disabled):not([aria-disabled="true"]) {
  transform: scale(var(--mh-press-scale, 0.988));
}

.mh-button--primary {
  background: var(--mh-btn-primary-bg, var(--mh-accent));
  color: var(--mh-btn-primary-fg, #fff);
  border-color: var(--mh-btn-primary-border, transparent);
  box-shadow: none;
}

.mh-button--primary:active {
  filter: brightness(0.96);
}

.mh-button--secondary,
.mh-button--outline {
  background: var(--mh-btn-secondary-bg, transparent);
  color: var(--mh-btn-secondary-fg, var(--mh-text));
  border-color: var(--mh-btn-secondary-border, var(--mh-border-subtle));
  box-shadow: none;
}

.mh-button--text,
.mh-button--ghost,
.mh-button--tertiary {
  background: transparent;
  color: var(--mh-accent);
  border-color: transparent;
  min-height: var(--mh-btn-h, var(--mh-tap-min));
  padding: 8px 10px;
  box-shadow: none;
  font-weight: 700;
}

.mh-button--danger {
  background: var(--mh-btn-danger-bg, var(--mh-danger));
  color: var(--mh-btn-danger-fg, #fff);
  border-color: var(--mh-btn-danger-bg, var(--mh-danger));
}

.mh-button--danger.mh-button--outline,
.mh-button--danger.mh-button--secondary {
  background: transparent;
  color: var(--mh-danger);
  border-color: color-mix(in srgb, var(--mh-danger) 45%, transparent);
}

.mh-button--success,
.mh-button.is-success,
.mh-button.is-copied {
  background: var(--mh-btn-success-bg, #d1fadf);
  color: var(--mh-btn-success-fg, #037a48);
  border-color: var(--mh-btn-success-border, transparent);
  box-shadow: none;
}

.mh-button--disabled,
.mh-button:disabled,
.mh-button[aria-disabled="true"] {
  background: var(--mh-btn-disabled-bg, var(--mh-surface-inset));
  color: var(--mh-btn-disabled-fg, var(--mh-disabled));
  border-color: var(--mh-border-subtle);
  box-shadow: none;
  cursor: default;
  opacity: 1;
  pointer-events: none;
  transform: none;
  filter: none;
}

.mh-button--icon {
  width: var(--mh-btn-h, var(--mh-tap-min));
  min-width: var(--mh-tap-min);
  padding: 0;
}

.mh-button--sm,
.mh-button--compact {
  min-height: var(--mh-btn-h-compact, var(--mh-tap-min));
  min-width: var(--mh-tap-min);
  padding: 6px var(--mh-btn-pad-x-compact, 12px);
  font-size: 0.82rem;
}

.mh-button.is-loading,
.mh-button--loading,
.mh-button[aria-busy="true"] {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.mh-button.is-loading::after,
.mh-button--loading::after,
.mh-button[aria-busy="true"]::after {
  content: "";
  position: absolute;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: var(--mh-text);
  animation: mh-btn-spin 0.7s linear infinite;
}

@keyframes mh-btn-spin {
  to {
    transform: rotate(360deg);
  }
}

.mh-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--mh-space-2);
}

.mh-button-row--split {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: var(--mh-space-3);
}

/* —— Inputs —— */
.mh-field {
  display: grid;
  gap: 6px;
}

.mh-field__label {
  font-size: var(--mh-type-label);
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--mh-text-secondary);
}

.mh-input,
.mh-select,
.mh-textarea {
  width: 100%;
  min-height: var(--mh-control-h);
  padding: 0 14px;
  border-radius: var(--mh-radius-md);
  border: 1px solid var(--mh-border-standard);
  background: var(--mh-surface-interactive);
  color: var(--mh-input-text);
  font-family: var(--mh-font);
  font-size: var(--mh-type-body);
  line-height: 1.3;
  box-shadow: var(--mh-elev-flat);
}

.mh-textarea {
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
}

.mh-input::placeholder,
.mh-textarea::placeholder {
  color: var(--mh-placeholder);
}

.mh-input:focus,
.mh-select:focus,
.mh-textarea:focus {
  outline: none;
  border-color: var(--mh-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mh-focus) 22%, transparent);
}

.mh-input:disabled,
.mh-select:disabled,
.mh-textarea:disabled,
.mh-input.is-disabled,
.mh-select.is-disabled {
  color: var(--mh-disabled);
  background: var(--mh-surface-inset);
  border-color: var(--mh-border-subtle);
  cursor: default;
}

.mh-input.is-error,
.mh-select.is-error,
.mh-textarea.is-error {
  border-color: var(--mh-danger);
}

.mh-field__error {
  font-size: var(--mh-type-caption);
  color: var(--mh-danger);
}

.mh-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.mh-input-wrap .mh-input {
  padding-left: 40px;
}

.mh-input-wrap__icon {
  position: absolute;
  left: 12px;
  color: var(--mh-text-muted);
  display: inline-flex;
  pointer-events: none;
}

/* —— Chips / status —— */
.mh-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: var(--mh-radius-pill);
  border: 1px solid var(--mh-border-subtle);
  background: var(--mh-surface-standard);
  color: var(--mh-text-secondary);
  font-size: var(--mh-type-caption);
  font-weight: 650;
}

.mh-chip--filter {
  cursor: pointer;
}

.mh-chip--active {
  background: color-mix(in srgb, var(--mh-accent) 12%, var(--mh-surface));
  border-color: color-mix(in srgb, var(--mh-accent) 35%, var(--mh-border));
  color: var(--mh-accent);
}

.mh-chip--category {
  background: var(--mh-surface-inset);
  border-color: transparent;
}

.mh-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: var(--mh-radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--mh-surface-inset);
  color: var(--mh-text-secondary);
}

.mh-badge--urgent,
.mh-status--urgent {
  background: color-mix(in srgb, var(--mh-warning) 16%, var(--mh-surface));
  color: var(--mh-warning);
}

.mh-badge--direct,
.mh-badge--applied,
.mh-badge--interview,
.mh-badge--offer,
.mh-status--direct,
.mh-status--applied,
.mh-status--interview,
.mh-status--offer {
  background: color-mix(in srgb, var(--mh-success) 14%, var(--mh-surface));
  color: var(--mh-success);
}

.mh-badge--rejected,
.mh-badge--closed,
.mh-status--rejected,
.mh-status--closed {
  background: color-mix(in srgb, var(--mh-danger) 12%, var(--mh-surface));
  color: var(--mh-danger);
}

.mh-badge--sync,
.mh-status--sync {
  background: color-mix(in srgb, var(--mh-accent) 12%, var(--mh-surface));
  color: var(--mh-accent);
}

/* —— In-flow action bar (demo/DS only; product docks must stay static) —— */
.mh-sticky-bar {
  position: relative;
  bottom: auto;
  z-index: auto;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: var(--mh-space-3);
  padding: 10px var(--mh-page-gutter) 10px;
  background: var(--mh-surface-sticky);
  border-top: 1px solid var(--mh-border-subtle);
  box-shadow: var(--mh-elev-sticky);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body:not([data-active-view="job-detail"]):not([data-active-view="recruiter-detail"]) .mh-sticky-bar {
  bottom: var(--mh-sticky-action-offset, calc(var(--nav-height) + var(--safe-bottom)));
  padding-bottom: 10px;
}

/* —— Empty / loading / error —— */
.mh-empty,
.mh-error,
.mh-loading {
  display: grid;
  gap: var(--mh-space-2);
  padding: var(--mh-space-6) var(--mh-space-4);
  text-align: center;
  border-radius: var(--mh-radius-lg);
  background: var(--mh-surface-inset);
}

/* Author display:grid must not defeat HTML hidden (Jobs #471 / same class as News #469). */
.mh-empty[hidden],
.mh-error[hidden],
.mh-loading[hidden] {
  display: none !important;
}

.mh-empty__title,
.mh-error__title {
  margin: 0;
  font-size: var(--mh-type-section);
  font-weight: 700;
  color: var(--mh-text);
}

.mh-empty__text,
.mh-error__text {
  margin: 0;
  font-size: var(--mh-type-meta);
  color: var(--mh-text-muted);
}

.mh-skeleton {
  display: block;
  height: 14px;
  border-radius: var(--mh-radius-sm);
  background: linear-gradient(
    90deg,
    var(--mh-surface-inset) 0%,
    color-mix(in srgb, var(--mh-surface) 70%, var(--mh-surface-inset)) 50%,
    var(--mh-surface-inset) 100%
  );
  background-size: 200% 100%;
  animation: mh-skel 1.2s ease-in-out infinite;
}

.mh-skeleton--title {
  height: 22px;
  width: 62%;
}

.mh-skeleton--row {
  height: 56px;
  margin-top: 10px;
}

@keyframes mh-skel {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* —— Component board (Visual Review / Stage 1 proof) —— */
.mh-ds-board {
  display: grid;
  gap: var(--mh-section-gap);
  padding: var(--mh-space-4);
  margin-bottom: var(--mh-space-6);
  background: var(--mh-surface-page);
}

.mh-ds-board[hidden] {
  display: none !important;
}

.mh-ds-board__block {
  display: grid;
  gap: var(--mh-space-3);
}

.mh-ds-board__label {
  margin: 0;
  font-size: var(--mh-type-caption);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mh-text-muted);
}

.mh-ds-swatches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.mh-ds-swatch {
  min-height: 56px;
  border-radius: var(--mh-radius-md);
  border: 1px solid var(--mh-border-subtle);
  display: flex;
  align-items: flex-end;
  padding: 6px 8px;
  font-size: 0.65rem;
  font-weight: 650;
  color: var(--mh-text);
}

.mh-ds-swatch--page {
  background: var(--mh-surface-page);
}
.mh-ds-swatch--standard {
  background: var(--mh-surface-standard);
}
.mh-ds-swatch--raised {
  background: var(--mh-surface-raised);
}
.mh-ds-swatch--inset {
  background: var(--mh-surface-inset);
}

/* —— #488 depth utilities + press language —— */
.mh-depth-0 {
  box-shadow: var(--mh-depth-0-shadow);
}

.mh-depth-1 {
  box-shadow: var(--mh-depth-1-shadow), var(--mh-depth-1-highlight);
}

.mh-depth-2 {
  box-shadow: var(--mh-depth-2-shadow);
}

.mh-depth-3 {
  box-shadow: var(--mh-depth-3-shadow), var(--mh-depth-3-highlight);
}

.mh-pressable {
  transition:
    transform var(--mh-press-ms) ease,
    box-shadow var(--mh-press-ms) ease,
    background-color var(--mh-press-ms) ease,
    border-color var(--mh-press-ms) ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mh-pressable:active {
  transform: scale(var(--mh-press-scale));
}

/* —— #501 reusable product primitives (ownership lives here, not a late override) —— */
.mh-kicker {
  margin: 0 0 8px;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mh-kicker, var(--mh-accent));
}

.mh-market-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 16px 14px;
  border-radius: 18px;
  background: var(--mh-card-surface, var(--mh-surface));
  border: 1px solid var(--mh-card-edge, var(--mh-border-subtle));
  box-shadow: var(--mh-depth-1-shadow), var(--mh-depth-1-highlight);
}

.mh-hub-group {
  display: grid;
  gap: 0;
  margin: 0 0 var(--mh-space-5);
  border-radius: 18px;
  background: var(--mh-card-surface, var(--mh-surface));
  border: 1px solid var(--mh-card-edge, var(--mh-border-subtle));
  overflow: hidden;
}

.mh-form-group {
  display: grid;
  gap: 10px;
  margin: 0 0 var(--mh-space-4);
  padding: 16px 14px;
  border-radius: 16px;
  background: var(--mh-card-surface, var(--mh-surface));
  border: 1px solid var(--mh-card-edge, var(--mh-border-subtle));
}

.mh-settings-group {
  display: flex;
  flex-direction: column;
  margin: 0 0 var(--mh-space-5);
  border-radius: 16px;
  background: var(--mh-card-surface, var(--mh-surface));
  border: 1px solid var(--mh-card-edge, var(--mh-border-subtle));
  overflow: hidden;
}

