/* R11.6.3 - Daily Work first-frame geometry stability. Pages-only.
   Fix only rendering/layout; all API calls and data fields are unchanged. */

/* The old page-entrance translation moved the whole dashboard on navigation. */
body.r107-ui #content .r114-dashboard {
  animation: none !important;
  transform: none !important;
  opacity: 1 !important;
}

/* The live fetch/error message is reparented into the existing hero before paint.
   It MUST NOT be a separate flex item between filters and KPI cards. */
body.r107-ui #content .r114-dashboard .r114-hero > .r114-inline-state {
  position: absolute !important;
  z-index: 5;
  right: 12px;
  bottom: 6px;
  top: auto;
  box-sizing: border-box;
  width: max-content;
  max-width: min(380px, calc(100% - 24px));
  margin: 0;
  padding: 3px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid var(--dw-line);
  background: color-mix(in srgb, var(--dw-card) 93%, transparent);
  box-shadow: 0 2px 8px #0000000b;
}

/* Errors remain readable and can wrap, but never push the dashboard. */
body.r107-ui #content .r114-dashboard .r114-hero > .r114-inline-state.visible:not(.fetching) {
  position: fixed !important;
  top: auto;
  right: 18px;
  bottom: 20px;
  width: max-content;
  max-width: min(440px, calc(100vw - 36px));
  padding: 10px 12px;
  white-space: normal;
  overflow-wrap: anywhere;
  z-index: 80;
  pointer-events: auto;
  box-shadow: 0 10px 28px #0000002b;
}

/* Reserve space for the longer verified Work master message, including mobile.
   Replacing "Checking..." with actual source text must not resize the panel. */
body.r107-ui #content .r114-dashboard .r114-status-note {
  min-height: 76px !important;
}

/* The register's previous placeholder row was taller than a real data row.
   Keep the scroll viewport the same height during loading and after records arrive;
   the table itself scrolls within it and does not resize the page. */
body.r107-ui #content .r114-dashboard .r114-register .r114-table-scroll {
  height: clamp(220px, 42vh, 400px) !important;
  max-height: 400px !important;
}

/* Keep the numbers inside their existing slots while replacing loading values. */
body.r107-ui #content .r114-dashboard .r114-kpi-info strong,
body.r107-ui #content .r114-dashboard .r114-today-stat strong,
body.r107-ui #content .r114-dashboard .r114-donut strong {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  body.r107-ui #content .r114-dashboard .r114-hero > .r114-inline-state {
    right: 8px;
    bottom: 5px;
    max-width: calc(100% - 16px);
    font-size: 9px;
  }
}

@media print {
  body.r107-ui #content .r114-dashboard .r114-register .r114-table-scroll {
    height: auto !important; max-height: none !important;
  }
}
