/* HIRECRM Enterprise Clean SaaS V3 — Data Density & Forms Polish
   UI-only hardening layer. Backend/business logic untouched.
*/

:root {
  --ecsv3-bg: #f8fafc;
  --ecsv3-surface: #ffffff;
  --ecsv3-soft: #fbfcfe;
  --ecsv3-border: #e7ecf3;
  --ecsv3-border-soft: #edf2f7;
  --ecsv3-text: #0f172a;
  --ecsv3-muted: #64748b;
  --ecsv3-accent: #2563eb;
  --ecsv3-focus: 0 0 0 3px rgba(37, 99, 235, .14);
  --ecsv3-radius: 12px;
  --ecsv3-radius-sm: 8px;
  --ecsv3-control: 34px;
  --ecsv3-control-sm: 30px;
  --ecsv3-row: 42px;
}

/* Data tables and registries */
.table-card,
.table-container,
.table-responsive,
.platform-table-wrapper,
.registry-table-wrapper,
.datagrid,
.data-grid,
.card-body:has(table),
.panel-card__body:has(table),
.section-card__body:has(table) {
  background: var(--ecsv3-surface) !important;
  border: 1px solid var(--ecsv3-border) !important;
  border-radius: var(--ecsv3-radius) !important;
  box-shadow: none !important;
  overflow-x: auto !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.table-card table,
.table-container table,
.table-responsive table,
.platform-table-wrapper table,
.registry-table-wrapper table,
.datagrid table,
.data-grid table {
  min-width: max-content;
}

table,
.data-table,
.platform-table,
.registry-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

table thead th,
.data-table thead th,
.platform-table thead th,
.registry-table thead th {
  height: 36px !important;
  padding: 0 10px !important;
  background: var(--ecsv3-soft) !important;
  border-bottom: 1px solid var(--ecsv3-border) !important;
  color: var(--ecsv3-muted) !important;
  font-size: .6875rem !important;
  line-height: 1.2 !important;
  font-weight: 850 !important;
  letter-spacing: .055em !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
}

table tbody td,
.data-table tbody td,
.platform-table tbody td,
.registry-table tbody td {
  height: var(--ecsv3-row) !important;
  padding: 6px 10px !important;
  border-bottom: 1px solid var(--ecsv3-border-soft) !important;
  color: var(--ecsv3-text) !important;
  font-size: .8125rem !important;
  line-height: 1.35 !important;
  vertical-align: middle !important;
}

table tbody tr:last-child td {
  border-bottom-color: transparent !important;
}

table tbody tr:hover {
  background: var(--ecsv3-bg) !important;
}

td .btn,
td .button,
.table-actions .btn,
.table-actions .button,
.registry-actions .btn,
.registry-actions .button {
  min-height: var(--ecsv3-control-sm) !important;
  height: auto !important;
  padding-inline: 8px !important;
  font-size: .75rem !important;
  border-radius: var(--ecsv3-radius-sm) !important;
}

/* Forms and filters */
.filter-card,
.filter-panel,
.enterprise-filters-grid,
.registry-filters,
.list-filters,
.search-filters,
.form-card,
.form-panel,
.form-section,
[class*="filters-panel"],
[class*="filter-panel"] {
  background: var(--ecsv3-surface) !important;
  border: 1px solid var(--ecsv3-border) !important;
  border-radius: var(--ecsv3-radius) !important;
  box-shadow: none !important;
}

.enterprise-filters-grid,
.registry-filters,
.list-filters,
.search-filters,
.filter-grid,
.filters-grid {
  padding: 10px !important;
  gap: 8px !important;
  align-items: end !important;
}

.form-grid,
.enterprise-form-grid,
.field-grid,
.form-row,
.field-row {
  gap: 10px !important;
  min-width: 0 !important;
}

.form-grid > *,
.enterprise-form-grid > *,
.field-grid > *,
.form-row > *,
.field-row > * {
  min-width: 0 !important;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
.form-input,
.form-select {
  min-height: var(--ecsv3-control) !important;
  height: auto !important;
  padding: 0 10px !important;
  background: #fff !important;
  border: 1px solid var(--ecsv3-border) !important;
  border-radius: var(--ecsv3-radius-sm) !important;
  color: var(--ecsv3-text) !important;
  font-size: .8125rem !important;
  line-height: 1.25 !important;
}

textarea,
.form-textarea {
  min-height: 38px !important;
  padding: 8px 10px !important;
  background: #fff !important;
  border: 1px solid var(--ecsv3-border) !important;
  border-radius: var(--ecsv3-radius-sm) !important;
  color: var(--ecsv3-text) !important;
  font-size: .8125rem !important;
  line-height: 1.4 !important;
}

label,
.form-label,
.field-label {
  margin-bottom: 4px !important;
  color: #334155 !important;
  font-size: .75rem !important;
  line-height: 1.25 !important;
  font-weight: 750 !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ecsv3-accent) !important;
  box-shadow: var(--ecsv3-focus) !important;
}

/* Metrics */
.metric-card,
.kpi-card,
.stat-card,
[data-kpi],
.report-card__metric,
.dashboard-kpi,
.dashboard-metric,
.dashboard-summary-card,
.erp-kpi-card {
  box-shadow: none !important;
}

.metric-card small,
.kpi-card small,
.stat-card__label,
.metric-card__label,
.kpi-card__label,
.report-card__metric-label,
.dashboard-kpi__label,
.dashboard-metric__label {
  font-size: .6875rem !important;
  line-height: 1.2 !important;
  letter-spacing: .055em !important;
  text-transform: uppercase !important;
  color: var(--ecsv3-muted) !important;
  font-weight: 850 !important;
}

.metric-card strong,
.kpi-card strong,
.stat-card__value,
.metric-card__value,
.kpi-card__value,
.report-card__metric-value,
.dashboard-kpi__value,
.dashboard-metric__value,
.erp-kpi-card__value {
  font-size: 1.25rem !important;
  line-height: 1.08 !important;
  letter-spacing: -.025em !important;
  color: var(--ecsv3-text) !important;
  font-weight: 850 !important;
}

/* Action bars */
.action-bar,
.quick-actions,
.quickbar,
.toolbar,
.command-strip,
.page-intro__actions,
.report-card__actions,
.calendar-toolbar,
.calendar-quick-actions,
.ai-assistant-suggestions,
.ai-assistant-composer__quickbar,
[data-action-bar],
[data-quick-actions] {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  white-space: nowrap !important;
  scrollbar-width: thin;
}

.action-bar > *,
.quick-actions > *,
.quickbar > *,
.toolbar > *,
.command-strip > *,
.page-intro__actions > *,
.report-card__actions > *,
.calendar-toolbar > *,
.calendar-quick-actions > *,
.ai-assistant-suggestions > *,
.ai-assistant-composer__quickbar > *,
[data-action-bar] > *,
[data-quick-actions] > * {
  flex: 0 0 auto !important;
}

.action-bar .btn,
.quick-actions .btn,
.toolbar .btn,
.command-strip .btn,
.page-intro__actions .btn,
.report-card__actions .btn {
  min-height: var(--ecsv3-control-sm) !important;
  padding-inline: 10px !important;
  font-size: .75rem !important;
}

/* Page headers */
.page-intro,
.page-header,
.workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.page-intro__content,
.page-header__content,
.workspace-header__content {
  min-width: 0;
}

.page-intro__description,
.page-intro__subtitle,
.page-description,
.page-meta,
.workspace-subtitle {
  max-width: 860px !important;
}

/* No clipped text */
h1,
h2,
h3,
h4,
h5,
h6,
button,
.btn,
.button,
.badge,
.chip,
.pill,
.tag,
.status-badge,
.priority-pill,
label,
small {
  overflow: visible !important;
  max-height: none !important;
}

/* Responsive */
@media (max-width: 1024px) {
  .enterprise-filters-grid,
  .registry-filters,
  .list-filters,
  .search-filters,
  .filter-grid,
  .filters-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  .page-intro,
  .page-header,
  .workspace-header {
    display: grid !important;
  }

  .page-intro__actions,
  .page-header__actions,
  .workspace-header__actions {
    width: 100% !important;
  }

  .enterprise-filters-grid,
  .registry-filters,
  .list-filters,
  .search-filters,
  .filter-grid,
  .filters-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    padding: 8px !important;
  }

  table tbody td,
  .data-table tbody td,
  .platform-table tbody td,
  .registry-table tbody td {
    height: 40px !important;
  }
}

@media (max-width: 390px) {
  .table-card,
  .table-container,
  .table-responsive,
  .platform-table-wrapper,
  .registry-table-wrapper {
    border-radius: 10px !important;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  .form-input,
  .form-select,
  .btn,
  .button,
  button:not(.sidebar *):not(.topbar *):not(.global-ai-widget *):not(.worker-ai-chat *) {
    min-height: 34px !important;
  }
}

.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 * {
  text-rendering: auto;
}
