/* Shared action geometry. See docs/BUTTONSTANDARD.md. Page CSS controls layout,
   not button padding or intrinsic widths. Navigation and help triggers are separate. */
:root {
  --button-height: 40px;
  --button-padding-x: 14px;
  --button-gap: 6px;
  --button-radius: 5px;
  --button-compact-height: 30px;
  --button-compact-padding-x: 10px;
  --button-compact-font-size: 12px;
  --button-control-height: 36px;
}
:root body :is(.primary-button, .secondary-button, .danger-button, .icon-button, .table-action-button, .summary-action-button):not(.mobile-menu) {
  --action-height: var(--button-height);
  --action-padding-x: var(--button-padding-x);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: var(--action-height);
  min-height: var(--action-height);
  width: max-content;
  min-width: max-content;
  max-width: none;
  padding: 0 var(--action-padding-x);
  gap: var(--button-gap);
  border-radius: var(--button-radius);
  line-height: 1.25;
  white-space: nowrap;
  flex: 0 0 auto;
}
:root body :is(.table-action-button, .button--compact):not(.mobile-menu),
:root body td :is(.primary-button, .secondary-button, .danger-button, .icon-button, .summary-action-button):not(.mobile-menu) {
  --action-height: var(--button-compact-height);
  --action-padding-x: var(--button-compact-padding-x);
  font-size: var(--button-compact-font-size);
  font-weight: 500;
}
/* Named square selectors must match/exceed the text-action specificity above.
   Otherwise max-content width and text padding win for danger buttons. */
:root body .button--control:not(.mobile-menu) { --action-height: var(--button-control-height); }
:root body :is(.icon-button, .add-button, .button--icon):not(.mobile-menu) {
  width: var(--action-height, var(--button-height));
  min-width: var(--action-height, var(--button-height));
  height: var(--action-height, var(--button-height));
  min-height: var(--action-height, var(--button-height));
  padding: 0; flex: 0 0 var(--action-height, var(--button-height));
}
:root body .button--field-icon:not(.mobile-menu) { --action-height: var(--field-height); }
:root body td :is(.add-button, .button--icon) { --action-height: var(--button-compact-height); }
/* SVG icons keep their own square size when neighbouring text needs room. */
:root body :is(.primary-button, .secondary-button, .danger-button, .icon-button, .table-action-button, .summary-action-button) > svg {
  flex-shrink: 0;
  aspect-ratio: 1;
}
:root body .button--block:not(.mobile-menu) { width: 100%; min-width: 0; }
:root body .obligation-row-actions,
:root body .property-journal-actions { width: max-content; margin-left: auto; }
:root body .obligation-row-actions > .table-action-button { flex: 0 0 auto; }
/* The heading follows the actual control/group width, maintained centrally. */
:root body th.table-action-heading > .table-action-label { width: var(--table-action-width); max-width: none; }
/* Menu toggle retains its existing independent geometry. */
:root body .mobile-menu { width: 43px; height: 43px; padding: 0; }
/* Chart legend switches are selection controls, retaining the legend's compact layout. */
.equity-legend-option, .chart-legend-toggle { display:inline-flex; align-items:center; gap:var(--button-gap); padding:3px 5px; }

/* Native file buttons fit inside the shared field, including its border/inset. */
:root { --file-control-inset: 4px; }
:root body input[type="file"]:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]) {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  height: var(--field-height);
  min-height: var(--field-height);
  padding: var(--file-control-inset);
  line-height: calc(var(--field-height) - 2px - 2 * var(--file-control-inset));
}
:root body input[type="file"]::file-selector-button {
  box-sizing: border-box;
  height: calc(var(--field-height) - 2px - 2 * var(--file-control-inset));
  min-height: 0;
  vertical-align: top;
  white-space: nowrap;
}
