/* Shared screen density. Keep print/export layouts and theme colors in their owners. */
:root {
  --ui-font-size: 13px;
  --ui-help-size: 12px;
  --ui-control-height: 34px;
  --ui-gap: 8px;
  --ui-section-gap: 12px;
  --ui-radius: 6px;
}
@media screen {
  body { font-size: var(--ui-font-size) !important; }
  /* Specific page styles retain their colors; shared dimensions take precedence. */
  html body button:not(.file-action):not(#sidebarBackdrop):not(.overview-scb-dot) {
    font-family: inherit;
    font-size: var(--ui-font-size) !important;
    font-weight: 600;
    line-height: 1.25;
    min-height: var(--ui-control-height) !important;
    height: var(--ui-control-height) !important;
    border-radius: var(--ui-radius);
    padding: var(--ui-button-padding, 6px 10px) !important;
    gap: 6px;
    vertical-align: middle;
  }
  html body button:is([data-ui-icon], [data-ui-symbol]) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  button[data-ui-icon]::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    background: currentColor;
    mask: var(--button-icon) center / contain no-repeat;
    -webkit-mask: var(--button-icon) center / contain no-repeat;
  }
  /* Symbol-only buttons (arrows, drag handles, crosses, plus, a lone SVG) are compact squares;
     their caption is the hover tooltip and aria-label, never visible text. */
  html body button[data-ui-symbol]:not(#sidebarToggle):not(#mobileMenuButton) { min-width: var(--ui-control-height); padding-inline: 0 !important; line-height: 1; }
  html body .point-mapping-table th:is(:first-child, :last-child) { width: 100px; }
  html body .live-summary-table th:first-child { width: 100px; }
  html body :is(main, dialog, .login) :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select) {
    font-size: var(--ui-font-size) !important;
    min-height: var(--ui-control-height) !important;
    height: var(--ui-control-height) !important;
    padding: var(--ui-field-padding, 5px 8px) !important;
    border-radius: var(--ui-radius);
  }
  html body :is(main, dialog) textarea { font-size: var(--ui-font-size) !important; line-height: 1.4; }
  html body :is(main, dialog) label { font-size: var(--ui-font-size) !important; gap: 4px; }
  html body :is(main, dialog) :is(.grid, .fields, .metrics, .review-grid) { gap: var(--ui-section-gap); }
  html body :is(main, dialog) :is(.toolbar, .actions, .checks) { gap: var(--ui-gap); }
  html body main .card { padding: 16px; margin-block: var(--ui-section-gap); }
  html body :is(main, dialog) h2 { font-size: 18px; margin-bottom: var(--ui-section-gap); }
  html body :is(main, dialog) h3 { font-size: 15px; }
  html body :is(main, dialog) :is(.hint, .help, small) { font-size: var(--ui-help-size); }
  html body :is(main, dialog) table {
    --ui-control-height: 26px;
    --ui-button-padding: 3px 6px;
    --ui-field-padding: 3px 6px;
    font-size: var(--ui-font-size) !important;
    line-height: 1.35;
  }
  html body :is(main, dialog) :is(th, td) {
    font-size: var(--ui-font-size) !important;
    padding: 2px 8px !important;
    vertical-align: middle;
  }
  html body :is(main, dialog) td { font-variant-numeric: tabular-nums; }
  @media (pointer: coarse) {
    html body button:not(.file-action):not(#sidebarBackdrop):not(.overview-scb-dot) { min-height: 40px !important; }
  }
}
