/* GLOBAL_FULL_WIDTH_UI_V1_START
   Full-width business UI layout.
   Safe CSS-only patch. No DB/API/business logic changes.
*/

:root {
  --gfwu-page-max: 100vw;
  --gfwu-page-pad-x: 14px;
  --gfwu-card-radius: 14px;
  --gfwu-border: rgba(148, 163, 184, 0.18);
  --gfwu-bg-soft: rgba(15, 23, 42, 0.58);
}

/* Main containers: reduce left/right dead space */
main,
.main,
.content,
.content-wrapper,
.page,
.page-content,
.app-content,
.container,
.container-fluid,
.wrapper,
section {
  max-width: var(--gfwu-page-max) !important;
}

.container,
.container-fluid,
.page,
.page-content,
.content,
.content-wrapper,
.main,
.app-content {
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Keep page readable but use screen width */
body .container,
body .container-fluid {
  padding-left: var(--gfwu-page-pad-x) !important;
  padding-right: var(--gfwu-page-pad-x) !important;
}

/* Common report/form/table cards */
.card,
.panel,
.box,
.table-card,
.table-wrap,
.table-wrapper,
.report-card,
.report-panel,
.doctors-panel,
.finance-panel,
.recepts-panel,
.analytics-panel,
#report-root,
#reports-root,
#app,
.app-shell {
  max-width: 100% !important;
}

/* Make tables use available width */
table {
  width: 100% !important;
}

/* Table wrappers: full-width, safe horizontal scroll */
.table-responsive,
.table-wrapper,
.table-wrap,
.grid-wrapper,
.data-table-wrap,
.report-table-wrap,
.doctors-table-wrap,
.recepts-table-wrap,
.finance-table-wrap,
.analytics-table-wrap,
div:has(> table) {
  max-width: 100% !important;
  overflow-x: auto !important;
}

/* Prevent narrow report blocks */
[class*="report"],
[class*="Report"],
[class*="analytics"],
[class*="Analytics"],
[class*="history"],
[class*="History"] {
  max-width: 100% !important;
}

/* Forms and filters: allow row wrapping cleanly */
.filters,
.filter-row,
.toolbar,
.actions,
.controls,
.form-row,
.search-row,
.report-filters,
.topbar,
.subbar {
  max-width: 100% !important;
  flex-wrap: wrap !important;
}

/* Inputs/selects should not force layout collapse */
input,
select,
textarea,
button {
  max-width: 100%;
}

/* Wide tables: compact but readable */
th,
td {
  white-space: nowrap;
}

/* Table header readability */
thead th {
  position: relative;
  z-index: 1;
}

/* Reports — Recepts / Reports — Doctors / Finance cards */
.rd-kpi-dashboard-v55,
.rd-pbd-v54-summary,
.rd-cw-v52-summary,
.rd-adv-v53-summary,
.rd-filter-row-v58,
[class*="summary"],
[class*="kpi"],
[class*="KPI"] {
  max-width: 100% !important;
}

/* Specific broad layout for known pages */
body:has(a[href*="doctor-base"]) main,
body:has(a[href*="reports"]) main,
body:has(a[href*="finance"]) main,
body:has(a[href*="sell-analytics"]) main,
body:has(a[href*="recepts"]) main {
  width: 100% !important;
  max-width: 100vw !important;
}

/* If app has centered max-width blocks, relax them */
[style*="max-width"] {
  max-width: 100% !important;
}

/* Keep top navigation full width */
nav,
.navbar,
.header,
.top-nav,
.main-nav {
  max-width: 100% !important;
}

/* Full-width page rhythm */
body {
  overflow-x: hidden;
}

main {
  padding-left: var(--gfwu-page-pad-x) !important;
  padding-right: var(--gfwu-page-pad-x) !important;
}

/* Data modules need full screen table space */
.module-card,
.module-panel,
.crud-panel,
.crud-card {
  width: 100% !important;
  max-width: 100% !important;
}

/* GLOBAL_FULL_WIDTH_UI_V1_END */
