/* Web-only table contract. Native/desktop layouts are intentionally unchanged. */
.web-app .page,
.web-app .panel,
.web-table.q-table__container {
  min-width: 0;
  max-width: 100%;
}
.web-table.q-table__container {
  overflow: hidden;
}
.web-table .q-table__middle {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: min(60dvh, 640px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.web-table .q-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--panel2);
}
.web-table .q-table th.table-col-actions,
.web-table .q-table td.table-col-actions {
  position: sticky;
  right: 0;
  left: auto;
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  padding: 3px 6px;
  text-align: center;
  white-space: nowrap;
  background: var(--panel);
  box-shadow: -1px 0 0 var(--border), -5px 0 8px rgb(0 0 0 / 5%);
  z-index: 3;
}
.web-table .q-table thead th.table-col-actions {
  z-index: 7;
  background: var(--panel2);
}
.web-table .q-table .text-right {
  font-variant-numeric: tabular-nums;
}
.web-table .table-action-trigger {
  width: 32px;
  min-width: 32px;
  height: 32px;
}
.table-action-menu {
  min-width: min(230px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 10px 28px rgb(22 48 32 / 18%);
}
.table-action-menu .q-item { min-height: 42px; }
.table-action-menu .q-item__section--avatar { min-width: 36px; padding-right: 8px; }
.table-action-menu .q-item__label { overflow-wrap: anywhere; }
.web-table .q-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.resource-status { display:flex; align-items:center; flex-wrap:wrap; gap:8px; min-width:0; min-height:32px; font-size:12px; }
.web-app .web-table .q-table__bottom:has(.resource-status),
.q-dialog .web-table .q-table__bottom:has(.resource-status) { display:flex !important; padding:6px 10px; flex:none; min-height:38px; }
.web-table .q-table__bottom--nodata { min-height:70px; }
.web-table .q-table td.table-col-number { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
.web-table .q-table td.table-col-date { white-space:nowrap; font-variant-numeric:tabular-nums; }
.web-table .table-cell-value,
.web-table .table-full-value { display:block; max-width:30ch; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.web-table .table-full-value { padding:0; border:0; background:transparent; color:inherit; text-align:inherit; cursor:pointer; text-decoration:underline dotted; text-underline-offset:3px; }
.web-table .table-col-number .table-cell-value { max-width:none; }
.web-table .task-table-title { max-width:32ch; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.table-text-dialog .q-dialog__message { overflow-wrap:anywhere; white-space:pre-wrap; }
.web-app .report-tabs { border-bottom:0; }
.web-app .report-panel .report-toolbar { margin-bottom:12px; }
.web-app .report-debt-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin-bottom:12px; }
.web-app .report-debt-kpis .kpi { display:flex; flex-direction:column; padding:8px; font-size:12px; }
.web-app .report-debt-kpis b { font-size:18px; font-variant-numeric:tabular-nums; }
.web-app .report-panel .debt-filters { flex-wrap:wrap; }
.web-app .report-panel .debt-filters .q-field { flex:1 1 150px; min-width:130px; }

/* Keep controls reachable on short windows and multi-table screens.
   The page may scroll when controls alone do not fit; rows still scroll locally. */
.web-app.table-workspace .page { overflow: auto; }
.web-app.table-workspace .page > .web-table,
.web-app.table-workspace .panel > .web-table {
  min-height: 170px;
  flex-basis: 170px;
}
.web-app.table-workspace .page > .panel:has(> .web-table) {
  flex-basis: auto;
  min-height: min-content;
  overflow: visible;
}
.web-app.table-workspace .web-table .q-table__middle { max-height: none; }
.q-dialog .web-table .q-table__middle { max-height: min(36dvh, 420px); }

@media (max-width: 700px) {
  .web-app .report-debt-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
  /* Two pinned edges must not cover the data on a phone. Keep only actions. */
  .web-table .q-table th:first-child:not(.table-col-actions),
  .web-table .q-table td:first-child:not(.table-col-actions),
  .web-app .debt-register .web-table .q-table th:nth-child(2),
  .web-app .debt-register .web-table .q-table td:nth-child(2) {
    left: auto;
    position: static;
    box-shadow: none;
  }
  .web-table .q-table thead th:first-child:not(.table-col-actions),
  .web-app .debt-register .web-table .q-table thead th:nth-child(2) { position: sticky; }
  .web-table .q-table .table-action-trigger { min-width: 40px; min-height: 40px; }
}
