/* Global ERP typography scale.
   Loaded last so shared dashboards, forms, tables and navigation use one scale. */
:root {
  --type-display: 40px;
  --type-h1: 32px;
  --type-h2: 24px;
  --type-h3: 18px;
  --type-body: 16px;
  --type-ui: 15px;
  --type-table: 14px;
  --type-label: 13px;
  --type-meta: 12px;
}

html { font-size: 16px; }

body {
  font-size: var(--type-body) !important;
  line-height: 1.5;
}

@media (max-width: 600px) {
  body { font-size: 15px !important; }
}

/* Shared dashboard headings */
.erp-dash-title {
  font-size: var(--type-h1) !important;
  line-height: 1.18 !important;
  font-weight: 800 !important;
}
.erp-dash-sub {
  font-size: var(--type-ui) !important;
  line-height: 1.55 !important;
}
.erp-section-title {
  font-size: var(--type-label) !important;
}
.erp-card h3,
.erp-card-title {
  font-size: var(--type-h3) !important;
  line-height: 1.3 !important;
}
.erp-card p,
.erp-card {
  font-size: var(--type-ui) !important;
  line-height: 1.55 !important;
}
.erp-stat-label { font-size: var(--type-meta) !important; }
.erp-stat-value { font-size: 28px !important; }
.erp-row { font-size: var(--type-table) !important; }
.erp-row .meta { font-size: var(--type-meta) !important; }
.erp-badge { font-size: var(--type-meta) !important; }

/* Navigation */
.erp-nav-link {
  font-size: var(--type-ui) !important;
  font-weight: 600;
}
.erp-nav-brand { font-size: 20px !important; }
.erp-nav-user-info { font-size: var(--type-table) !important; }

/* Forms and controls */
label,
.form-label,
.access-field label,
.field-label {
  font-size: var(--type-label) !important;
}
input,
select,
textarea {
  font-size: var(--type-ui) !important;
  line-height: 1.4;
}
button,
.btn,
input[type="submit"],
input[type="button"] {
  font-size: var(--type-table) !important;
}
@media (max-width: 600px) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Data tables */
table th,
.table th {
  font-size: var(--type-label) !important;
}
table td,
.table td {
  font-size: var(--type-table) !important;
}

/* Users and permission matrix */
.access-card-head h2 {
  font-size: 20px !important;
}
.access-field label {
  font-size: var(--type-label) !important;
}
.access-field input,
.access-field select {
  font-size: var(--type-ui) !important;
}
.access-table th {
  font-size: var(--type-label) !important;
}
.access-table td {
  font-size: var(--type-table) !important;
}
.permission-intro,
.permission-footnote {
  font-size: var(--type-table) !important;
  line-height: 1.6 !important;
}
.permission-legend {
  font-size: var(--type-label) !important;
}
.permission-table {
  font-size: var(--type-table) !important;
}
.permission-table th,
.permission-table td {
  font-size: var(--type-table) !important;
}
.permission-table thead th {
  font-size: var(--type-label) !important;
}
.permission-table td:first-child {
  font-size: var(--type-table) !important;
}
.matrix-role {
  font-size: var(--type-label) !important;
}
.perm-cell {
  font-size: 17px !important;
}
.perm-cell span {
  font-size: var(--type-meta) !important;
}
.permission-policy {
  font-size: var(--type-meta) !important;
}

/* Shared page tabs and injected tools */
.erp-page-tab { font-size: var(--type-table) !important; }
.erp-dynamic-search-input { font-size: var(--type-ui) !important; }

/* Small print and game UIs keep their dedicated sizing. */
@media print {
  body { font-size: 11pt !important; }
}

/* Permission symbols should remain prominent after table sizing. */
.permission-table td.perm-cell {
  font-size: 17px !important;
}

/* Neutral text for ERP pages. Games are excluded via body.game-page. */
body:not(.game-page) a:not(.erp-nav-brand):not(.erp-nav-link):not(.btn) {
  color: inherit !important;
}
body:not(.game-page) .erp-nav-link,
body:not(.game-page) .erp-nav-link.active,
body:not(.game-page) .erp-page-tab,
body:not(.game-page) .erp-page-tab.active {
  color: var(--text, #111827) !important;
}
body:not(.game-page) :is(
  .status-badge,
  .role-badge,
  .matrix-role,
  .erp-badge,
  .badge,
  .badge-active,
  .badge-inactive,
  .tag,
  .pill,
  [class*="status-badge"],
  [class*="role-badge"],
  [class*="perm-yes"],
  [class*="perm-partial"],
  [class*="perm-no"],
  [class*="user-perm-result"],
  .permission-policy
) {
  color: var(--text, #111827) !important;
}
body:not(.game-page) :is(
  .status-badge,
  .role-badge,
  .matrix-role,
  .erp-badge,
  .badge,
  .badge-active,
  .badge-inactive,
  .tag,
  .pill,
  [class*="status-badge"],
  [class*="role-badge"]
) {
  background: #f3f4f6 !important;
  border-color: #cbd5e1 !important;
}
body:not(.game-page) :is(
  .text-danger,
  .text-success,
  .text-warning,
  .text-info,
  .text-primary,
  .error,
  .success,
  .warning,
  .notice,
  .alert,
  [class*="alert-"],
  [class*="notice-"]
) {
  color: var(--text, #111827) !important;
}
body:not(.game-page) .permission-legend :is(.perm-yes, .perm-partial, .perm-no) {
  color: var(--text, #111827) !important;
}
body:not(.game-page) .btn.btn-destructive {
  color: #b42318 !important;
}
