/* HIRECRM Typography & Controls Master Fix
   Final UI-only system layer dedicated to typography/buttons/controls consistency.
   Loaded after full-system visual audit.
   Goals:
   - one typography scale across pages;
   - one button/control rhythm;
   - consistent tabs/chips/badges;
   - prevent clipped Cyrillic;
   - reduce page-specific CSS font/control drift.
*/

:root {
  /* Typography scale */
  --tcm-font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --tcm-xs: 0.6875rem;      /* 11px */
  --tcm-sm: 0.75rem;        /* 12px */
  --tcm-md: 0.8125rem;      /* 13px */
  --tcm-base: 0.875rem;     /* 14px */
  --tcm-lg: 1rem;           /* 16px */
  --tcm-xl: 1.25rem;        /* 20px */
  --tcm-h1: 1.5rem;         /* 24px */
  --tcm-h1-laptop: 1.375rem;/* 22px */
  --tcm-h1-mobile: 1.25rem; /* 20px */

  --tcm-line-title: 1.2;
  --tcm-line-body: 1.42;
  --tcm-line-control: 1.25;
  --tcm-letter-tight: -0.03em;

  /* Control system */
  --tcm-control-h: 34px;
  --tcm-control-h-sm: 30px;
  --tcm-control-h-lg: 38px;
  --tcm-input-h: 34px;
  --tcm-btn-px: 12px;
  --tcm-btn-px-sm: 10px;
  --tcm-radius: 8px;
  --tcm-radius-card: 12px;
  --tcm-gap: 8px;

  --tcm-bg: #f8fafc;
  --tcm-surface: #ffffff;
  --tcm-soft: #fbfcfe;
  --tcm-border: #e7ecf3;
  --tcm-border-strong: #cbd5e1;
  --tcm-text: #0f172a;
  --tcm-muted: #64748b;
  --tcm-accent: #2563eb;
  --tcm-accent-hover: #1d4ed8;
  --tcm-danger: #dc2626;
  --tcm-focus: 0 0 0 3px rgba(37, 99, 235, .14);
}

/* 1. Font rendering and base text. */
body,
input,
select,
textarea,
button {
  font-family: var(--tcm-font-family) !important;
  text-rendering: geometricPrecision;
}

/* 2. Global page heading consistency. */
.page-shell h1,
.enterprise-page h1,
.workspace-shell h1,
.page-intro__title,
.page-title,
.page-header h1,
.workspace-header h1,
.dashboard-hero h1,
.module-hero h1,
.registry-hero h1,
.ai-assistant-hero h1,
.public-auth-heading h1 {
  font-size: var(--tcm-h1) !important;
  line-height: var(--tcm-line-title) !important;
  letter-spacing: var(--tcm-letter-tight) !important;
  font-weight: 850 !important;
  color: var(--tcm-text) !important;
  overflow: visible !important;
  max-height: none !important;
  padding-block: 1px 2px !important;
}

/* 3. Section/card title consistency. */
.page-shell h2,
.enterprise-page h2,
.workspace-shell h2,
.card-title,
.panel-card__title,
.section-title,
.report-card__title,
.registry-card__title,
[class$="__title"] {
  font-size: var(--tcm-lg) !important;
  line-height: 1.25 !important;
  font-weight: 800 !important;
  color: var(--tcm-text) !important;
  letter-spacing: -0.015em !important;
  overflow: visible !important;
}

.card .card-title,
.card [class$="__title"],
.panel-card [class$="__title"],
.section-card [class$="__title"],
.table-card [class$="__title"],
.registry-card [class$="__title"] {
  font-size: var(--tcm-md) !important;
  line-height: 1.28 !important;
}

/* 4. Body, helper, meta text. */
.page-shell,
.enterprise-page,
.workspace-shell,
.page-container {
  font-size: var(--tcm-base) !important;
  line-height: var(--tcm-line-body) !important;
}

.page-shell p,
.enterprise-page p,
.workspace-shell p,
.card-subtitle,
.panel-card__subtitle,
.section-subtitle,
.page-description,
.page-meta,
.help-text,
.helper-text,
.field-help,
.form-help,
.helptext,
[class$="__description"],
[class$="__hint"],
[class$="__meta"] {
  font-size: var(--tcm-md) !important;
  line-height: var(--tcm-line-body) !important;
  color: var(--tcm-muted) !important;
}

/* 5. Labels and captions. */
label,
.form-label,
.field-label,
.card-eyebrow,
.eyebrow,
.stat-card__label,
.metric-card__label,
.kpi-card__label,
.badge-label,
.table-caption,
small {
  font-size: var(--tcm-sm) !important;
  line-height: 1.35 !important;
  color: var(--tcm-muted) !important;
}

/* 6. Buttons: one system. */
.btn,
.button,
button:not(.sidebar *):not(.topbar *):not(.global-ai-widget *):not(.worker-ai-chat *),
input[type="submit"],
input[type="button"] {
  min-height: var(--tcm-control-h) !important;
  height: auto !important;
  padding: 0 var(--tcm-btn-px) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  border-radius: var(--tcm-radius) !important;
  font-size: var(--tcm-md) !important;
  line-height: var(--tcm-line-control) !important;
  font-weight: 750 !important;
  white-space: nowrap !important;
  text-decoration: none !important;
  box-shadow: none !important;
  overflow: visible !important;
}

.btn-sm,
.btn.btn-sm,
.button-sm,
.btn-small,
button.btn-sm {
  min-height: var(--tcm-control-h-sm) !important;
  padding-inline: var(--tcm-btn-px-sm) !important;
  font-size: var(--tcm-sm) !important;
}

.btn-lg,
.btn.btn-lg,
.button-lg {
  min-height: var(--tcm-control-h-lg) !important;
  padding-inline: 14px !important;
  font-size: var(--tcm-base) !important;
}

/* Buttons with icons must not become unreadable squares unless explicitly icon-only. */
.btn i,
.button i,
button i,
.btn svg,
.button svg,
button svg {
  flex: 0 0 auto;
}

.btn-icon,
button.btn-icon,
.icon-button,
.button-icon {
  width: var(--tcm-control-h) !important;
  min-width: var(--tcm-control-h) !important;
  padding-inline: 0 !important;
}

/* 7. Inputs/selects/textarea. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
.form-input,
.form-select {
  min-height: var(--tcm-input-h) !important;
  height: auto !important;
  padding: 0 10px !important;
  border-radius: var(--tcm-radius) !important;
  font-size: var(--tcm-md) !important;
  line-height: var(--tcm-line-control) !important;
}

textarea,
.form-textarea {
  min-height: 38px !important;
  padding: 8px 10px !important;
  border-radius: var(--tcm-radius) !important;
  font-size: var(--tcm-md) !important;
  line-height: 1.4 !important;
}

/* Focus state: same everywhere. */
input:focus,
select:focus,
textarea:focus,
button:focus-visible,
.btn:focus-visible,
.button:focus-visible,
a:focus-visible {
  outline: none !important;
  box-shadow: var(--tcm-focus) !important;
}

/* 8. Chips, tabs, badges. */
.badge,
.status-badge,
.priority-pill,
.chip,
.pill,
.tag,
.task-list-enterprise-status,
.task-list-enterprise-priority {
  min-height: 22px !important;
  height: auto !important;
  padding: 2px 8px !important;
  border-radius: 999px !important;
  font-size: var(--tcm-sm) !important;
  line-height: 1.25 !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
  overflow: visible !important;
}

.section-tabs a,
.section-tabs button,
.nav-tabs a,
.nav-tabs button,
.tab-list a,
.tab-list button,
.tabs a,
.tabs button,
[role="tab"] {
  min-height: 32px !important;
  padding: 0 4px !important;
  font-size: var(--tcm-md) !important;
  line-height: var(--tcm-line-control) !important;
  font-weight: 750 !important;
}

/* 9. Tables: strict type and button rhythm. */
table,
.data-table,
.platform-table,
.registry-table {
  font-size: var(--tcm-md) !important;
  line-height: 1.35 !important;
}

table th,
.data-table th,
.platform-table th,
.registry-table th {
  font-size: var(--tcm-xs) !important;
  line-height: 1.2 !important;
  font-weight: 850 !important;
  letter-spacing: .055em !important;
}

table td,
.data-table td,
.platform-table td,
.registry-table td {
  font-size: var(--tcm-md) !important;
  line-height: 1.35 !important;
}

td .btn,
td .button,
.table-actions .btn,
.table-actions .button {
  min-height: var(--tcm-control-h-sm) !important;
  font-size: var(--tcm-sm) !important;
  padding-inline: 8px !important;
}

/* 10. Action bars/filters. */
.action-bar,
.quick-actions,
.quickbar,
.toolbar,
.command-strip,
.filter-panel,
.filter-card,
.enterprise-filters-grid,
.registry-filters,
.list-filters,
.search-filters {
  gap: var(--tcm-gap) !important;
}

.action-bar .btn,
.quick-actions .btn,
.quickbar .btn,
.toolbar .btn,
.command-strip .btn,
.filter-panel .btn,
.filter-card .btn {
  min-height: var(--tcm-control-h-sm) !important;
  font-size: var(--tcm-sm) !important;
  padding-inline: 10px !important;
}

/* 11. Public login must remain polished but aligned with system. */
.public-auth-heading h1 {
  font-size: 1.5rem !important;
}

.public-auth-field label {
  font-size: var(--tcm-md) !important;
}

.public-auth-field input,
.public-auth-submit {
  min-height: 42px !important;
  font-size: var(--tcm-base) !important;
}

/* 12. Prevent clipping and weird text crops. */
h1,
h2,
h3,
h4,
h5,
h6,
button,
.btn,
.button,
.badge,
.chip,
.pill,
.status-badge,
.priority-pill,
label,
small {
  overflow: visible !important;
  max-height: none;
}

/* 13. Responsive typography/control caps. */
@media (max-width: 1440px), (max-height: 850px) {
  :root {
    --tcm-h1: var(--tcm-h1-laptop);
    --tcm-control-h: 32px;
    --tcm-control-h-sm: 29px;
    --tcm-input-h: 32px;
  }

  .page-shell h1,
  .enterprise-page h1,
  .workspace-shell h1,
  .page-intro__title,
  .page-title,
  .page-header h1,
  .workspace-header h1 {
    font-size: var(--tcm-h1-laptop) !important;
  }
}

@media (max-width: 768px) {
  :root {
    --tcm-h1: var(--tcm-h1-mobile);
    --tcm-base: 0.8125rem;
    --tcm-md: 0.78125rem;
  }

  .page-shell h1,
  .enterprise-page h1,
  .workspace-shell h1,
  .page-intro__title,
  .page-title,
  .page-header h1,
  .workspace-header h1,
  .public-auth-heading h1 {
    font-size: var(--tcm-h1-mobile) !important;
  }

  .btn,
  .button,
  button:not(.sidebar *):not(.topbar *):not(.global-ai-widget *):not(.worker-ai-chat *) {
    min-height: 34px !important;
  }
}

@media (max-width: 390px) {
  :root {
    --tcm-control-h: 34px;
    --tcm-control-h-sm: 30px;
    --tcm-input-h: 34px;
  }

  .action-bar .btn,
  .quick-actions .btn,
  .toolbar .btn,
  .command-strip .btn {
    padding-inline: 8px !important;
  }
}

/* Protected chrome: keep its dedicated styles. */
.sidebar,
.sidebar *,
.topbar,
.topbar *,
.global-search,
.global-search *,
.global-ai-widget,
.global-ai-widget *,
.worker-ai-chat,
.worker-ai-chat *,
.mobile-bottom-nav,
.mobile-bottom-nav * {
  font-family: inherit;
}
