/* ===== Fluid sizing: the whole app scales with the screen (added 2026-10-20) =====
   variables.css keeps the design at a laptop (1366 x 650 px). On bigger
   screens that looked zoomed out: small text and boxes on a large, empty
   screen. Here ONE unit, --u, grows with the free screen size and every size
   token is made from it, so text, boxes, buttons, table rows, the menu,
   toolbar, status bar and the spaces between them all grow together and stay
   in proportion:
     --u = 1px  on 1366 x 650 or smaller (same as before)
     --u ~ 1.2px on a 1920 x 900 window
     --u = 1.32px at most (2K / 4K monitors), so nothing gets oversized.
   It follows BOTH width and height: a wide but short window does not get
   taller rows that would push content off the screen.
   Exceptions: the billing screen keeps 1px (its one-screen layout is tuned
   by height in components.css), printing keeps the fixed sizes.
   Touch screens get larger tap targets; phones slightly larger text.
   Remove this file from layout.php to go back to the fixed sizes. */
@media screen {
  :root {
    --u: clamp(1px, min(calc(0.0397vw + 0.4577px), calc(0.1048vh + 0.3188px)), 1.32px);
  }
  /* Billing now scales with the same --u as every other page (2026-10-21):
     it used to be pinned to 1px, so its text looked small next to the other tabs. */

  /* The tokens are worked out again on <body> so a page (billing) can set its own --u. */
  :root, body {
    --fs-xs:   calc(11 * var(--u));
    --fs-sm:   calc(12 * var(--u));
    --fs-base: calc(14 * var(--u));
    --fs-md:   calc(15 * var(--u));
    --fs-lg:   calc(18 * var(--u));
    --fs-xl:   calc(22 * var(--u));
    --fs-kpi:  calc(30 * var(--u));
    --row-h:       calc(34 * var(--u));
    --input-h:     calc(34 * var(--u));
    --btn-h:       calc(34 * var(--u));
    --nav-h:       calc(60 * var(--u));
    --toolbar-h:   calc(46 * var(--u));
    --statusbar-h: calc(34 * var(--u));
    --gap:         calc(10 * var(--u));
  }

  /* Fixed sizes that do not come from the tokens: same unit. */
  body:not([data-page="billing"]) :where(input[type="checkbox"], input[type="radio"]) { width: calc(16 * var(--u)); height: calc(16 * var(--u)); }
  .logo-square, .user-menu summary { width: calc(40 * var(--u)); height: calc(40 * var(--u)); }
  .user-menu-body { top: calc(46 * var(--u)); min-width: calc(200 * var(--u)); }
  .tile { min-height: calc(64 * var(--u)); }
  .tile-icon { flex-basis: calc(44 * var(--u)); width: calc(44 * var(--u)); height: calc(44 * var(--u)); }
  .modal { max-width: calc(460 * var(--u)); }
  .modal-narrow { max-width: calc(380 * var(--u)); }
  .modal:has(.info-table) { max-width: calc(580 * var(--u)); }
  .modal:has(.pos-catlist) { max-width: calc(560 * var(--u)); }
  .toast { max-width: calc(360 * var(--u)); }
  .auth-wrap { max-width: calc(420 * var(--u)); }
  .wrap { max-width: calc(960 * var(--u)); }
  .bar-chart { height: calc(170 * var(--u)); }
  .bar { max-width: calc(46 * var(--u)); }
  .data-grid .info-btn { width: calc(30 * var(--u)); min-height: calc(28 * var(--u)); font-size: calc(15 * var(--u)); }
  .lang-toggle { min-height: calc(40 * var(--u)); font-size: var(--fs-base); }
  /* Single forms (trader, expense, user, employee, masters): wider on big
     screens so their rows hold more fields instead of one long column. */
  .form-card { max-width: min(100%, calc(900 * var(--u))); }
  /* Headings already use the --fs-* tokens (base.css), so they follow too. */
}

/* Tablets and phones (touch): every input, select and button at least 40px
   high so it is easy to tap; table rows a little taller. */
@media screen and (pointer: coarse) {
  :root, body { --input-h: max(40px, calc(34 * var(--u))); --btn-h: max(40px, calc(34 * var(--u))); --row-h: max(38px, calc(34 * var(--u))); }
}
/* Phones: slightly larger text (15px also stops phones zooming into a box
   when it is tapped), the smaller KPI number from responsive.css kept. */
@media screen and (max-width: 820px) {
  :root { --u: 1.07px; }
  :root, body { --fs-kpi: 26px; }
  /* Rows stack into one column here; the fields' "160px wide" flex basis
     then turned into a 160px HEIGHT, leaving big empty gaps between fields. */
  .form-row > * { flex-basis: auto; }
}
