/*
 * Tablet-only responsive layer.
 *
 * The marker is installed only for a touch/coarse-pointer tablet geometry by
 * tablet-responsive.js. No selector in this file applies to the desktop UI.
 */

html[data-savills-tablet="true"],
html[data-savills-tablet="true"] body,
html[data-savills-tablet="true"] #root,
html[data-savills-tablet="true"] #root > div,
html[data-savills-tablet="true"] #root > div > .app-bg {
  box-sizing: border-box !important;
  max-inline-size: 100% !important;
  min-inline-size: 0 !important;
}

html[data-savills-tablet="true"] {
  --savills-tablet-touch-target: 44px;
  --savills-tablet-compact-control: 40px;
  --savills-tablet-table-control: 32px;
  --savills-tablet-table-header: 34px;
  --savills-tablet-table-row: 40px;
  --savills-tablet-bottom-nav: calc(82px + env(safe-area-inset-bottom, 0px));
  --savills-tablet-side-nav: 96px;
  -webkit-tap-highlight-color: rgba(26, 115, 232, 0.12);
  text-size-adjust: 100%;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] {
  --savills-tablet-table-row: 38px;
}

html[data-savills-tablet="true"] :where(button, a, input, select, textarea, [role="button"], [role="tab"]) {
  touch-action: manipulation;
}

html[data-savills-tablet="true"] :where(img, video, canvas, svg, iframe, object, embed) {
  max-inline-size: 100%;
}

html[data-savills-tablet="true"] #root > div .app-main {
  box-sizing: border-box !important;
  max-width: none !important;
  min-width: 0 !important;
}

html[data-savills-tablet="true"] .sav-user-profile-button {
  height: var(--savills-tablet-touch-target) !important;
  min-height: var(--savills-tablet-touch-target) !important;
  min-width: var(--savills-tablet-touch-target) !important;
  width: var(--savills-tablet-touch-target) !important;
}

/* Navigation: a labelled rail in landscape and a locally scrollable dock in portrait. */
html[data-savills-tablet="true"] #root > div .sidebar-toggle-button {
  display: none !important;
}

html[data-savills-tablet="true"] #root > div .sidebar-shell nav button .nav-label,
html[data-savills-tablet="true"] #root > div .sidebar-shell nav button > span.nav-label {
  display: block !important;
  font-family: var(--sav-font-family, "Google Sans Flex", "Google Sans", Arial, sans-serif) !important;
  font-weight: 500 !important;
  line-height: 1.08 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-align: center !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html[data-savills-tablet="true"] #root > div .sidebar-shell nav button::after {
  display: none !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] #root > div .sidebar-shell {
  bottom: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  height: 100dvh !important;
  left: 0 !important;
  max-height: 100dvh !important;
  min-width: var(--savills-tablet-side-nav) !important;
  overflow: hidden !important;
  right: auto !important;
  top: 0 !important;
  width: var(--savills-tablet-side-nav) !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] #root > div .sidebar-logo-full {
  display: none !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] #root > div .sidebar-logo-mini {
  align-items: center !important;
  display: flex !important;
  flex: 0 0 64px !important;
  height: 64px !important;
  justify-content: center !important;
  min-height: 64px !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] #root > div .sidebar-logo-mini img {
  max-height: 50px !important;
  max-width: 58px !important;
  object-fit: contain !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] #root > div .sidebar-shell nav {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column !important;
  min-height: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  padding: 2px 0 78px !important;
  scrollbar-width: thin;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] #root > div .sidebar-shell nav > div {
  flex: 0 0 auto !important;
  width: 100% !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] #root > div .sidebar-shell nav > div > div {
  display: none !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] #root > div .sidebar-shell nav button {
  align-items: center !important;
  border-radius: 0 16px 16px 0 !important;
  display: flex !important;
  flex-direction: column !important;
  font-size: 10px !important;
  gap: 3px !important;
  height: 52px !important;
  justify-content: center !important;
  margin: 1px 0 !important;
  min-height: 52px !important;
  padding: 4px 7px !important;
  width: 92px !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] #root > div .sidebar-shell nav button svg,
html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] #root > div .sidebar-shell nav button .sav-canonical-icon {
  flex: 0 0 20px !important;
  height: 20px !important;
  width: 20px !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] #root > div .sav-sidebar-logout {
  bottom: 8px !important;
  min-height: 58px !important;
  width: 100% !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] #root > div .app-main {
  --savills-tablet-page-block-padding: 20px;
  --savills-tablet-page-inline-padding: 24px;
  margin-left: var(--savills-tablet-side-nav) !important;
  min-height: 100dvh !important;
  padding: 20px 24px 38px !important;
  width: calc(100% - var(--savills-tablet-side-nav)) !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] #root > div .sidebar-shell {
  align-items: stretch !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-top: 1px solid var(--sav-light-border, #dfe3e8) !important;
  bottom: 0 !important;
  display: flex !important;
  flex-direction: row !important;
  height: var(--savills-tablet-bottom-nav) !important;
  left: 0 !important;
  max-height: var(--savills-tablet-bottom-nav) !important;
  overflow: hidden !important;
  padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  right: 0 !important;
  top: auto !important;
  width: 100dvw !important;
  z-index: 40 !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] #root > div :is(.sidebar-logo-full, .sidebar-logo-mini, .sidebar-logo-shell) {
  display: none !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] #root > div .sidebar-shell nav {
  align-items: stretch !important;
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: row !important;
  min-height: 0 !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-inline: contain !important;
  padding: 4px 6px !important;
  scroll-padding-inline: 8px !important;
  scroll-snap-type: inline proximity !important;
  scrollbar-width: thin;
  touch-action: pan-x !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] #root > div .sidebar-shell nav > div {
  flex: 0 0 76px !important;
  scroll-snap-align: center !important;
  width: 76px !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] #root > div .sidebar-shell nav > div > div {
  display: none !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] #root > div .sidebar-shell nav button {
  align-items: center !important;
  border-radius: 13px !important;
  display: flex !important;
  flex-direction: column !important;
  font-size: 10px !important;
  gap: 4px !important;
  height: 70px !important;
  justify-content: center !important;
  margin: 0 !important;
  min-height: 70px !important;
  padding: 5px 4px !important;
  width: 72px !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] #root > div .sidebar-shell nav button svg,
html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] #root > div .sidebar-shell nav button .sav-canonical-icon {
  flex: 0 0 21px !important;
  height: 21px !important;
  width: 21px !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] #root > div .sav-sidebar-logout {
  align-items: center !important;
  bottom: auto !important;
  display: flex !important;
  flex: 0 0 62px !important;
  flex-direction: column !important;
  height: 100% !important;
  justify-content: center !important;
  left: auto !important;
  min-height: var(--savills-tablet-touch-target) !important;
  padding: 4px !important;
  position: relative !important;
  right: auto !important;
  width: 62px !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] #root > div .app-main {
  --savills-tablet-page-block-padding: 18px;
  --savills-tablet-page-inline-padding: 16px;
  margin-left: 0 !important;
  min-height: 100dvh !important;
  padding: 18px 16px calc(var(--savills-tablet-bottom-nav) + 22px) !important;
  width: 100% !important;
}

/* Shared page chrome, filters, actions and locally scrollable tabs. */
html[data-savills-tablet="true"] main.app-main > header,
html[data-savills-tablet="true"] main.app-main .sav-client-invoice-heading,
html[data-savills-tablet="true"] main.app-main .sav-dashboard-v2-header,
html[data-savills-tablet="true"] main.app-main .sav-dashboard-header {
  flex-wrap: wrap !important;
  gap: 12px !important;
  height: auto !important;
  min-width: 0 !important;
}

html[data-savills-tablet="true"] #root .sav-tab-export-strip,
html[data-savills-tablet="true"] #root .sav-tab-export-action-row,
html[data-savills-tablet="true"] main.app-main .filter-bar,
html[data-savills-tablet="true"] main.app-main .purchase-actions,
html[data-savills-tablet="true"] main.app-main .purchase-filters,
html[data-savills-tablet="true"] main.app-main .sav-client-invoice-filters,
html[data-savills-tablet="true"] main.app-main .sav-finance-filter-bar {
  align-items: center !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  height: auto !important;
  min-height: var(--savills-tablet-compact-control) !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-inline: contain !important;
  scrollbar-width: thin;
  touch-action: pan-x !important;
  width: 100% !important;
}

html[data-savills-tablet="true"] #root .sav-tab-export-strip {
  justify-content: flex-end !important;
  margin: 0 !important;
  min-height: var(--savills-tablet-touch-target) !important;
  overflow: visible !important;
  padding: 0 !important;
  position: absolute !important;
  right: var(--savills-tablet-page-inline-padding, 24px) !important;
  top: var(--savills-tablet-page-block-padding, 20px) !important;
  width: auto !important;
  z-index: 12 !important;
}

html[data-savills-tablet="true"] #root :is(.sav-tab-primary-add-button, .sav-tab-excel-export-button),
html[data-savills-tablet="true"] main.app-main > header button,
html[data-savills-tablet="true"] main.app-main :is(.filter-bar, .purchase-actions, .purchase-filters, .sav-client-invoice-filters, .sav-finance-filter-bar) :is(button, select),
html[data-savills-tablet="true"] .sav-tab-search-control,
html[data-savills-tablet="true"] .sav-tab-search-control input {
  min-height: var(--savills-tablet-compact-control) !important;
}

html[data-savills-tablet="true"] .sav-tab-search-control {
  flex: 0 0 clamp(240px, 38vw, 360px) !important;
  height: var(--savills-tablet-compact-control) !important;
  margin-left: 0 !important;
  max-width: min(360px, calc(100dvw - 48px)) !important;
  min-width: min(240px, calc(100dvw - 48px)) !important;
}

html[data-savills-tablet="true"] :is([role="tablist"], .settings-tabs, .sav-access-login-tabs) {
  align-items: stretch !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-inline: contain !important;
  scroll-padding-inline: 8px !important;
  scroll-snap-type: inline proximity !important;
  scrollbar-width: thin;
  touch-action: pan-x !important;
}

html[data-savills-tablet="true"] :is([role="tablist"], .settings-tabs, .sav-access-login-tabs) > :is(button, [role="tab"]) {
  flex: 0 0 auto !important;
  min-height: var(--savills-tablet-touch-target) !important;
  scroll-snap-align: start !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] #root .sav-tab-export-strip {
  justify-content: flex-end !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] main.app-main :is(.filter-bar, .purchase-actions, .purchase-filters, .sav-client-invoice-filters, .sav-finance-filter-bar) > * {
  flex: 0 0 auto !important;
  max-width: min(360px, calc(100dvw - 48px)) !important;
}

/*
 * List tabs use the visual viewport as their frame. Page chrome stays fixed,
 * while the data grid owns both scroll axes; the document itself never grows
 * just because a table contains many rows.
 */
html[data-savills-tablet="true"] main.app-main:has(:is(
  .entity-list-table,
  .project-list-table,
  .quote-list-table,
  .purchase-panel,
  .sav-client-invoice-panel,
  .forecast-card
)) {
  display: flex !important;
  flex-direction: column !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
  position: relative !important;
}

html[data-savills-tablet="true"] main.app-main:has(:is(
  .entity-list-table,
  .project-list-table,
  .quote-list-table,
  .purchase-panel,
  .sav-client-invoice-panel,
  .forecast-card
)) > header {
  flex: 0 0 var(--savills-tablet-touch-target) !important;
  margin-bottom: 10px !important;
  min-height: var(--savills-tablet-touch-target) !important;
  padding-right: 112px !important;
}

html[data-savills-tablet="true"] main.app-main:has(:is(
  .entity-list-table,
  .project-list-table,
  .quote-list-table,
  .purchase-panel,
  .forecast-card
)) > :is(section.space-y-4, section.space-y-5) {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column !important;
  gap: 8px !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

html[data-savills-tablet="true"] main.app-main:has(:is(
  .entity-list-table,
  .project-list-table,
  .quote-list-table,
  .purchase-panel,
  .forecast-card
)) > :is(section.space-y-4, section.space-y-5) > * {
  margin-block: 0 !important;
}

html[data-savills-tablet="true"] main.app-main:has(:is(
  .entity-list-table,
  .project-list-table,
  .quote-list-table,
  .purchase-panel,
  .forecast-card
)) > :is(section.space-y-4, section.space-y-5) > :is(
  .entity-list-table,
  .project-list-table,
  .quote-list-table,
  .purchase-panel,
  .forecast-card
) {
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: auto !important;
}

html[data-savills-tablet="true"] main.app-main:has(.sav-client-invoice-panel) > .sav-client-invoice-shell {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column !important;
  gap: 8px !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

html[data-savills-tablet="true"] main.app-main:has(.sav-client-invoice-panel) .sav-client-invoice-heading {
  flex: 0 0 var(--savills-tablet-touch-target) !important;
  margin: 0 0 2px !important;
  min-height: var(--savills-tablet-touch-target) !important;
  padding-right: 112px !important;
}

html[data-savills-tablet="true"] main.app-main:has(.sav-client-invoice-panel) .sav-client-invoice-filters {
  flex: 0 0 var(--savills-tablet-compact-control) !important;
  margin: 0 !important;
}

html[data-savills-tablet="true"] main.app-main:has(.sav-client-invoice-panel) .sav-client-invoice-panel {
  flex: 1 1 auto !important;
  height: auto !important;
  margin: 0 !important;
  min-height: 0 !important;
  overflow: auto !important;
}

html[data-savills-tablet="true"] main.app-main :is(.page-title, .sav-client-invoice-heading h1) {
  font-size: 28px !important;
  line-height: 32px !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] main.app-main :is(.page-title, .sav-client-invoice-heading h1) {
  font-size: 26px !important;
  line-height: 30px !important;
}

/* Dashboard and Finance use the available tablet width instead of shrinking cards. */
html[data-savills-tablet="true"] main.app-main.sav-dashboard-main:has(.sav-dashboard-shell),
html[data-savills-tablet="true"] main.app-main.sav-dashboard-main {
  padding-top: 18px !important;
}

html[data-savills-tablet="true"] main.sav-dashboard-main .sav-dashboard-v2-header,
html[data-savills-tablet="true"] main.sav-dashboard-main .sav-dashboard-toolbar {
  align-items: stretch !important;
  flex-wrap: wrap !important;
}

html[data-savills-tablet="true"] main.sav-dashboard-main .sav-dashboard-period-controls {
  min-width: 168px !important;
  width: auto !important;
}

html[data-savills-tablet="true"] main.sav-dashboard-main .sav-dashboard-period-select {
  height: var(--savills-tablet-touch-target) !important;
  min-height: var(--savills-tablet-touch-target) !important;
  min-width: 168px !important;
  width: 100% !important;
}

html[data-savills-tablet="true"] main.sav-dashboard-main .sav-dashboard-period-range {
  align-self: end !important;
  max-width: none !important;
  padding-bottom: 7px !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] main.sav-dashboard-main .sav-dashboard-v2-header {
  align-items: stretch !important;
  flex-direction: column !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] main.sav-dashboard-main .sav-dashboard-toolbar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  justify-content: stretch !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] main.sav-dashboard-main .sav-dashboard-v2-kpis,
html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] .sav-finance-kpis.sav-dashboard-v2-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] main.sav-dashboard-main .sav-dashboard-v2-grid > [data-dashboard-chart],
html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] main.sav-dashboard-main .sav-dashboard-v2-grid > [data-dashboard-size] {
  grid-column: 1 / -1 !important;
  padding: 17px !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] .sav-finance-context {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] #root .sav-finance-grid > .sav-finance-panel {
  grid-column: 1 / -1 !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] main.sav-dashboard-main .sav-dashboard-v2-kpis,
html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] .sav-finance-kpis.sav-dashboard-v2-kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

html[data-savills-tablet="true"] .sav-dashboard-metric strong,
html[data-savills-tablet="true"] .sav-finance-kpis .sav-dashboard-metric strong {
  font-size: clamp(19px, 2.35vw, 27px) !important;
}

/* Data grids: wide information remains readable and scrolls only inside its component. */
html[data-savills-tablet="true"] :is(
  .entity-list-table,
  .project-list-table,
  .quote-list-table,
  .forecast-card,
  .purchase-panel,
  .sav-client-invoice-panel,
  .company-address-table,
  .sav-dashboard-table-wrap,
  .sav-dashboard-forecast-table-wrap,
  .sav-finance-table-wrap
) {
  box-sizing: border-box !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  overscroll-behavior-inline: contain !important;
  scrollbar-color: #aab6c5 transparent;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: thin;
  touch-action: pan-x pan-y !important;
  -webkit-overflow-scrolling: touch;
}

html[data-savills-tablet="true"] [data-savills-tablet-scroll-region="true"]:focus-visible {
  outline: 2px solid rgba(26, 115, 232, 0.55) !important;
  outline-offset: 2px !important;
}

html[data-savills-tablet="true"] :is(
  .entity-list-row,
  .entity-list-row-supplier,
  .project-list-row,
  .quote-list-row,
  .company-address-row,
  .purchase-grid-header,
  .purchase-grid-row,
  .purchase-row-details,
  .purchase-project-header
) {
  box-sizing: border-box !important;
  max-width: none !important;
  width: 100% !important;
}

html[data-savills-tablet="true"] .entity-list-row {
  min-width: 960px !important;
}

html[data-savills-tablet="true"] .entity-list-row-supplier {
  min-width: 1060px !important;
}

html[data-savills-tablet="true"] .project-list-row {
  min-width: 960px !important;
}

html[data-savills-tablet="true"] .quote-list-row {
  min-width: 1600px !important;
}

html[data-savills-tablet="true"] .company-address-row {
  min-width: 760px !important;
}

html[data-savills-tablet="true"] .purchase-panel :is(.purchase-grid-header, .purchase-grid-row, .purchase-row-details) {
  min-width: 1180px !important;
}

html[data-savills-tablet="true"] .sav-client-invoice-panel :is(.purchase-grid-header, .purchase-grid-row, .purchase-row-details) {
  min-width: calc(630px + (var(--invoice-installment-count, 5) * 110px)) !important;
}

html[data-savills-tablet="true"] .purchase-panel .purchase-project-header,
html[data-savills-tablet="true"] .sav-client-invoice-panel .purchase-project-header {
  min-width: 100% !important;
}

html[data-savills-tablet="true"] .forecast-card .responsive-table {
  font-size: 12px !important;
  min-width: 920px !important;
}

html[data-savills-tablet="true"] :is(.sav-dashboard-table, .sav-dashboard-forecast-analytics-table) {
  min-width: 780px !important;
}

html[data-savills-tablet="true"] :is(
  .entity-list-header,
  .entity-list-line,
  .project-list-header,
  .project-list-line,
  .quote-list-header,
  .quote-list-line,
  .company-address-row,
  .purchase-grid-header,
  .purchase-grid-row,
  .purchase-row-details,
  .responsive-table
) {
  font-size: 12px !important;
}

html[data-savills-tablet="true"] :is(.entity-list-header, .project-list-header, .quote-list-header, .purchase-grid-header) {
  font-size: 10px !important;
  line-height: 1.08 !important;
}

html[data-savills-tablet="true"] :is(.entity-list-line, .project-list-line, .quote-list-line, .purchase-grid-row) {
  min-height: var(--savills-tablet-table-row) !important;
}

html[data-savills-tablet="true"] :is(.entity-list-line, .project-list-line, .quote-list-line) > :is(span, div) {
  line-height: 1.15 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html[data-savills-tablet="true"] :is(.entity-list-header, .project-list-header) {
  height: 32px !important;
  min-height: 32px !important;
}

html[data-savills-tablet="true"] :is(.quote-list-header, .purchase-grid-header) {
  height: var(--savills-tablet-table-header) !important;
  min-height: var(--savills-tablet-table-header) !important;
}

html[data-savills-tablet="true"] :is(.entity-list-header, .project-list-header, .quote-list-header, .purchase-grid-header) {
  position: sticky !important;
  top: 0 !important;
  z-index: 11 !important;
}

html[data-savills-tablet="true"] :is(.entity-list-header, .entity-list-line) > :first-child,
html[data-savills-tablet="true"] :is(.project-list-header, .project-list-line) > :first-child,
html[data-savills-tablet="true"] :is(.quote-list-header, .quote-list-line) > :first-child {
  background: #ffffff !important;
  box-shadow: 8px 0 12px rgba(15, 23, 42, 0.06) !important;
  left: 0 !important;
  position: sticky !important;
  z-index: 8 !important;
}

html[data-savills-tablet="true"] :is(.entity-list-header, .project-list-header, .quote-list-header) > :first-child {
  background: #f8fafc !important;
  z-index: 10 !important;
}

html[data-savills-tablet="true"] .forecast-card .responsive-table :is(th, td):first-child {
  background: #ffffff !important;
  left: 0 !important;
  position: sticky !important;
  z-index: 5 !important;
}

html[data-savills-tablet="true"] .forecast-card .responsive-table thead th:first-child {
  background: #f5f6f8 !important;
  z-index: 7 !important;
}

html[data-savills-tablet="true"] :is(
  .quote-action-trigger,
  .project-delete,
  .project-delete-inline,
  .sav-hierarchy-toggle,
  .company-address-actions button,
  .forecast-card .responsive-table td:last-child button,
  .purchase-panel .row-expand,
  .purchase-panel .project-collapse,
  .purchase-panel .project-add-invoice,
  .purchase-panel .pdf-icon,
  .sav-client-invoice-panel .row-expand,
  .sav-client-invoice-panel .project-add-invoice,
  .sav-client-invoice-panel .pdf-icon
) {
  height: var(--savills-tablet-table-control) !important;
  min-height: var(--savills-tablet-table-control) !important;
  min-width: var(--savills-tablet-table-control) !important;
  width: var(--savills-tablet-table-control) !important;
}

html[data-savills-tablet="true"] .sav-quote-status-trigger {
  height: 34px !important;
  min-height: 34px !important;
}

html[data-savills-tablet="true"] .document-inline-item {
  min-height: 28px !important;
  min-width: 0 !important;
  padding-block: 3px !important;
}

html[data-savills-tablet="true"] :is(.sav-quote-due-date, .sav-quote-signature-date),
html[data-savills-tablet="true"] .forecast-card input.sav-forecast-input,
html[data-savills-tablet="true"] .purchase-panel :is(.supplier-input, .ht-input),
html[data-savills-tablet="true"] .sav-client-invoice-panel :is(input, select) {
  height: var(--savills-tablet-table-control) !important;
  min-height: var(--savills-tablet-table-control) !important;
}

/* The Achats component has a card-mode container query below 920px. On a
   tablet we keep its canonical desktop grid inside the local table scroller. */
html[data-savills-tablet="true"] .purchase-panel:not(.sav-client-invoice-panel) :is(
  .sav-purchase-client-header,
  .purchase-project,
  .purchase-project-header,
  .purchase-grid-header,
  .purchase-grid-row,
  .purchase-row-details
) {
  min-width: 1180px !important;
}

html[data-savills-tablet="true"] .purchase-panel:not(.sav-client-invoice-panel) .purchase-grid-header {
  display: grid !important;
  grid-template-columns: var(--purchase-grid-columns) !important;
}

html[data-savills-tablet="true"] .purchase-panel:not(.sav-client-invoice-panel) :is(.purchase-grid-row, .purchase-row-details) {
  grid-template-columns: var(--purchase-grid-columns) !important;
  grid-template-rows: auto !important;
  row-gap: 0 !important;
}

html[data-savills-tablet="true"] .purchase-panel:not(.sav-client-invoice-panel) :is(.purchase-grid-row, .purchase-row-details) > * {
  grid-column: auto !important;
  grid-row: auto !important;
}

html[data-savills-tablet="true"] .purchase-panel:not(.sav-client-invoice-panel) .purchase-row-project-slot {
  display: block !important;
}

html[data-savills-tablet="true"] .purchase-panel:not(.sav-client-invoice-panel) .purchase-project-header {
  grid-template-columns: 34px minmax(105px, 1.15fr) minmax(0, 4.9fr) minmax(82px, 0.8fr) !important;
  grid-template-rows: auto !important;
  min-height: 40px !important;
  padding: 4px 8px !important;
}

html[data-savills-tablet="true"] .purchase-panel:not(.sav-client-invoice-panel) .purchase-project-header .project-collapse {
  grid-column: 1 !important;
  grid-row: 1 !important;
}

html[data-savills-tablet="true"] .purchase-panel:not(.sav-client-invoice-panel) .purchase-project-header .project-drag {
  display: inline-flex !important;
  grid-column: 1 !important;
  grid-row: 1 !important;
}

html[data-savills-tablet="true"] .purchase-panel:not(.sav-client-invoice-panel) .purchase-project-header .project-title-group {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

html[data-savills-tablet="true"] .purchase-panel:not(.sav-client-invoice-panel) .purchase-project-header .project-subtotals {
  flex-wrap: nowrap !important;
  grid-column: 3 !important;
  grid-row: 1 !important;
}

html[data-savills-tablet="true"] .purchase-panel:not(.sav-client-invoice-panel) .purchase-project-header .project-add-invoice {
  grid-column: 4 !important;
  grid-row: 1 !important;
}

html[data-savills-tablet="true"] .purchase-panel:not(.sav-client-invoice-panel) .purchase-grid-row {
  min-height: var(--savills-tablet-table-row) !important;
  padding: 3px 8px !important;
}

/* Factures keeps its dynamic installment columns but restores the compact
   one-line project header that the desktop layout uses. */
html[data-savills-tablet="true"] .sav-client-invoice-panel :is(
  .sav-client-invoice-client-header,
  .sav-client-invoice-client-projects,
  .sav-client-invoice-project,
  .purchase-project-header
) {
  min-width: calc(630px + (var(--invoice-installment-count, 5) * 110px)) !important;
}

html[data-savills-tablet="true"] .sav-client-invoice-panel .purchase-project-header {
  grid-template-areas: none !important;
  grid-template-columns: 24px 10px minmax(130px, 1.05fr) minmax(0, 4.2fr) auto !important;
  grid-template-rows: auto !important;
  min-height: 40px !important;
  padding: 5px 9px !important;
  row-gap: 0 !important;
}

html[data-savills-tablet="true"] .sav-client-invoice-panel .purchase-project-header > * {
  grid-area: auto !important;
  grid-row: 1 !important;
}

html[data-savills-tablet="true"] .sav-client-invoice-panel .purchase-project-header .project-collapse {
  grid-column: 1 !important;
}

html[data-savills-tablet="true"] .sav-client-invoice-panel .purchase-project-header .project-drag {
  display: inline-flex !important;
  grid-column: 2 !important;
}

html[data-savills-tablet="true"] .sav-client-invoice-panel .purchase-project-header .project-title-group {
  grid-column: 3 !important;
  min-width: 130px !important;
}

html[data-savills-tablet="true"] .sav-client-invoice-panel .purchase-project-header .project-subtotals {
  display: flex !important;
  flex-wrap: nowrap !important;
  grid-column: 4 !important;
}

html[data-savills-tablet="true"] .sav-client-invoice-panel .purchase-project-header .project-add-invoice {
  grid-column: 5 !important;
}

html[data-savills-tablet="true"] .sav-client-invoice-panel .purchase-grid-row {
  min-height: 34px !important;
  padding-block: 3px !important;
}

html[data-savills-tablet="true"] .sav-client-invoice-panel :is(
  .sav-client-invoice-amount-input,
  .sav-invoice-total-ttc-input,
  .invoice-detail-cell input
) {
  height: 28px !important;
  min-height: 28px !important;
}

/* Forms and dialogs keep headers/actions visible while their content scrolls. */
html[data-savills-tablet="true"] :is(
  .project-modal-backdrop,
  .sav-client-invoice-modal-backdrop,
  .sav-user-profile-backdrop,
  .sav-maintenance-gate,
  .sav-supplier-create-backdrop,
  .sav-quote-duplicate-backdrop,
  .sav-quote-delete-backdrop,
  .quote-export-backdrop,
  .sav-project-address-confirm-backdrop,
  .sav-subsection-parent-overlay
) {
  align-items: center !important;
  box-sizing: border-box !important;
  max-height: 100dvh !important;
  max-width: 100dvw !important;
  padding: max(14px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px)) !important;
}

html[data-savills-tablet="true"] :is(
  .project-modal,
  .project-modal-wide,
  .sav-client-invoice-modal,
  .sav-user-profile-dialog,
  .sav-supplier-create-dialog,
  .sav-quote-duplicate-dialog,
  .sav-quote-delete-dialog,
  .quote-export-modal,
  .sav-project-address-confirm-dialog,
  .sav-subsection-parent-dialog
) {
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  max-height: calc(100dvh - 28px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  max-width: calc(100dvw - 28px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) !important;
  min-height: 0 !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

html[data-savills-tablet="true"] :is(
  .project-modal-body,
  .sav-client-invoice-modal-body,
  .sav-supplier-create-body,
  .sav-quote-duplicate-body,
  .quote-export-body,
  .sav-user-profile-body
) {
  flex: 1 1 auto !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch;
}

html[data-savills-tablet="true"] :is(
  .project-modal-header,
  .project-modal-footer,
  .sav-client-invoice-modal-header,
  .sav-client-invoice-modal-actions,
  .sav-supplier-create-header,
  .sav-supplier-create-actions,
  .sav-quote-duplicate-header,
  .sav-quote-duplicate-actions,
  .quote-export-header,
  .quote-export-actions
) {
  flex: 0 0 auto !important;
  flex-wrap: wrap !important;
}

html[data-savills-tablet="true"] :is(
  .project-modal-header button,
  .sav-client-invoice-modal-header button,
  .sav-supplier-create-header button,
  .sav-quote-duplicate-header button,
  .project-modal-actions button,
  .project-modal-footer > button,
  .sav-client-invoice-modal-actions button,
  .sav-supplier-create-actions button,
  .sav-quote-duplicate-actions button,
  .sav-quote-delete-actions button,
  .quote-export-actions button,
  .sav-user-profile-dialog button,
  .sav-subsection-parent-dialog button
) {
  min-height: var(--savills-tablet-touch-target) !important;
}

html[data-savills-tablet="true"] #root :is(
  .project-modal-header button,
  .sav-client-invoice-modal-header button,
  .sav-supplier-create-header button,
  .sav-quote-duplicate-header button
) {
  flex: 0 0 var(--savills-tablet-touch-target) !important;
  height: var(--savills-tablet-touch-target) !important;
  min-height: var(--savills-tablet-touch-target) !important;
  min-width: var(--savills-tablet-touch-target) !important;
  width: var(--savills-tablet-touch-target) !important;
}

html[data-savills-tablet="true"] :is(.project-modal, .sav-client-invoice-modal, .sav-supplier-create-dialog, .sav-quote-duplicate-dialog) :is(input, select, textarea) {
  font-size: 16px !important;
  min-height: var(--savills-tablet-touch-target) !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] :is(.project-modal, .project-modal-wide, .sav-client-invoice-modal, .sav-supplier-create-dialog, .sav-quote-duplicate-dialog) {
  border-radius: 18px !important;
  height: calc(100dvh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  max-height: calc(100dvh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  width: calc(100dvw - 20px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] .project-modal-wide:not(.quote-modal) .project-modal-body,
html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] :is(.sav-supplier-create-grid, .sav-supplier-create-contact-grid, .sav-quote-duplicate-grid) {
  grid-template-columns: minmax(0, 1fr) !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] .project-modal-wide:not(.quote-modal) .project-modal-body > * {
  grid-column: 1 / -1 !important;
}

/* Persistent attachment preview: tablet geometry, scroll and robust external fallback. */
html[data-savills-tablet="true"] .sav-entity-file-preview-backdrop {
  align-items: center !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  max-width: 100dvw !important;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)) !important;
  width: 100dvw !important;
}

html[data-savills-tablet="true"] .sav-entity-file-preview-modal {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  max-width: calc(100dvw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) !important;
  min-height: 0 !important;
  width: calc(100dvw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) !important;
}

html[data-savills-tablet="true"] .sav-entity-file-preview-modal .pdf-preview-header {
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  min-height: 60px !important;
  padding: 10px 14px !important;
}

html[data-savills-tablet="true"] .sav-entity-file-preview-actions {
  flex-wrap: wrap !important;
  gap: 8px !important;
}

html[data-savills-tablet="true"] .sav-entity-file-preview-actions :is(button, a) {
  align-items: center !important;
  display: inline-flex !important;
  justify-content: center !important;
  min-height: var(--savills-tablet-touch-target) !important;
  min-width: var(--savills-tablet-touch-target) !important;
}

html[data-savills-tablet="true"] .sav-tablet-document-fallback {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

html[data-savills-tablet="true"] .sav-entity-file-preview-body {
  min-height: 0 !important;
  overflow: auto !important;
  overscroll-behavior: contain !important;
  padding: 12px !important;
  touch-action: pan-x pan-y pinch-zoom !important;
  -webkit-overflow-scrolling: touch;
}

html[data-savills-tablet="true"] .sav-entity-file-preview-body iframe {
  height: 100% !important;
  min-height: 0 !important;
  touch-action: pan-x pan-y pinch-zoom !important;
  width: 100% !important;
}

html[data-savills-tablet="true"] .sav-entity-file-preview-body img {
  height: auto !important;
  margin: auto !important;
  max-height: 100% !important;
  max-width: 100% !important;
  object-fit: contain !important;
}

/* Quote editor and client preview retain the canonical A4 document in a local viewport. */
html[data-savills-tablet="true"] .quote-editor-shell {
  max-height: 100dvh !important;
  max-width: 100dvw !important;
  min-height: 0 !important;
  min-width: 0 !important;
}

html[data-savills-tablet="true"] .sav-quote-editor-toolbar,
html[data-savills-tablet="true"] .sav-quote-editor-shell .quote-editor-toolbar {
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  height: 58px !important;
  max-height: 58px !important;
  min-height: 58px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-inline: contain !important;
  padding: 6px 8px !important;
  scrollbar-width: thin;
  touch-action: pan-x !important;
}

html[data-savills-tablet="true"] .sav-quote-editor-shell .quote-editor-toolbar > div:first-child {
  flex: 0 1 180px !important;
  max-width: 180px !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html[data-savills-tablet="true"] .sav-quote-save-controls {
  flex: 0 0 auto !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  margin: 0 !important;
  min-width: max-content !important;
  overflow: visible !important;
  width: auto !important;
}

html[data-savills-tablet="true"] .sav-quote-export-actions {
  flex-wrap: nowrap !important;
  gap: 6px !important;
}

html[data-savills-tablet="true"] #root .sav-quote-editor-shell .quote-editor-toolbar button,
html[data-savills-tablet="true"] #root .sav-quote-editor-shell :is(.sav-quote-toolbar-button, .sav-quote-language-button, .sav-quote-save-button) {
  height: var(--savills-tablet-compact-control) !important;
  min-height: var(--savills-tablet-compact-control) !important;
  min-width: var(--savills-tablet-compact-control) !important;
}

html[data-savills-tablet="true"] #root .sav-quote-editor-shell :is(.sav-quote-language-button, .sav-quote-save-button, .sav-quote-toolbar-button:not(.sav-quote-icon-button)) {
  min-width: 74px !important;
}

html[data-savills-tablet="true"] #root .sav-quote-editor-shell .sav-quote-icon-button {
  width: var(--savills-tablet-compact-control) !important;
}

html[data-savills-tablet="true"] .sav-quote-editor-shell .quote-editor-toolbar > button[aria-label] {
  flex: 0 0 var(--savills-tablet-touch-target) !important;
  height: var(--savills-tablet-touch-target) !important;
  min-height: var(--savills-tablet-touch-target) !important;
  min-width: var(--savills-tablet-touch-target) !important;
  position: sticky !important;
  right: 0 !important;
  width: var(--savills-tablet-touch-target) !important;
  z-index: 4 !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] .sav-quote-editor-shell .quote-editor-toolbar > div:first-child {
  flex-basis: 140px !important;
  max-width: 140px !important;
}

html[data-savills-tablet="true"] .sav-quote-editor-shell > .quote-editor-canvas {
  justify-content: flex-start !important;
  max-width: 100% !important;
  min-height: 0 !important;
  min-width: 0 !important;
  overflow: auto !important;
  overscroll-behavior: contain !important;
  padding: 18px !important;
  touch-action: pan-x pan-y pinch-zoom !important;
  -webkit-overflow-scrolling: touch;
}

html[data-savills-tablet="true"] .sav-quote-document-host,
html[data-savills-tablet="true"] .quote-document-page {
  flex: 0 0 794px !important;
  max-width: none !important;
}

html[data-savills-tablet="true"] .sav-quote-document-host .sav-row-actions,
html[data-savills-tablet="true"] .sav-quote-document-host .sav-service-actions,
html[data-savills-tablet="true"] .sav-quote-document-host .sav-block-grip,
html[data-savills-tablet="true"] .sav-quote-document-host .sav-section-drag-handle {
  opacity: 1 !important;
  pointer-events: auto !important;
}

html[data-savills-tablet="true"] .sav-quote-document-host :is(.sav-row-actions button, .sav-service-actions button, .sav-section-inline-action) {
  min-height: 36px !important;
  min-width: 36px !important;
}

html[data-savills-tablet="true"] .sav-quote-preview-backdrop {
  align-items: stretch !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  max-width: 100dvw !important;
  padding: max(10px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px)) !important;
  width: 100dvw !important;
}

html[data-savills-tablet="true"] .sav-quote-preview-shell {
  border-radius: 14px !important;
  height: calc(100dvh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  max-height: calc(100dvh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  max-width: calc(100dvw - 20px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) !important;
  width: calc(100dvw - 20px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) !important;
}

html[data-savills-tablet="true"] .sav-quote-preview-shell .quote-editor-toolbar {
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 9px !important;
  min-height: 64px !important;
  padding: 9px 12px !important;
}

html[data-savills-tablet="true"] .sav-quote-preview-shell .quote-editor-toolbar .sav-quote-preview-toolbar-actions {
  flex-wrap: wrap !important;
  gap: 7px !important;
}

html[data-savills-tablet="true"] .sav-quote-preview-shell .quote-editor-toolbar :is(button[aria-label], a) {
  align-items: center !important;
  border: 1px solid var(--sav-light-border, #dfe3e8) !important;
  border-radius: 9px !important;
  display: inline-flex !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  height: var(--savills-tablet-touch-target) !important;
  justify-content: center !important;
  min-height: var(--savills-tablet-touch-target) !important;
  min-width: var(--savills-tablet-touch-target) !important;
  padding: 0 12px !important;
  width: auto !important;
}

html[data-savills-tablet="true"] .sav-tablet-quote-preview-fit,
html[data-savills-tablet="true"] .sav-tablet-quote-preview-open {
  background: #ffffff !important;
  color: #334155 !important;
}

html[data-savills-tablet="true"] .sav-quote-preview-shell .sav-quote-client-preview-canvas {
  min-height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  touch-action: pan-x pan-y pinch-zoom !important;
}

html[data-savills-tablet="true"] .sav-quote-client-preview-frame {
  height: 100% !important;
  min-height: 0 !important;
  touch-action: pan-x pan-y pinch-zoom !important;
}

/* Supplier analysis: a drawer in portrait, a flexible column in landscape. */
html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] .sav-quote-editor-shell.sav-offer-panel-layout {
  --sav-offer-panel-layout-width: clamp(280px, 30vw, 360px) !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] .sav-quote-editor-shell.sav-offer-panel-layout {
  --sav-offer-panel-layout-width: 0px !important;
  grid-template-columns: minmax(0, 1fr) 0 !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] .sav-quote-editor-shell.sav-offer-panel-layout.sav-offer-panel-collapsed {
  --sav-offer-panel-layout-width: 52px !important;
  grid-template-columns: minmax(0, 1fr) 52px !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] .sav-quote-editor-shell.sav-offer-panel-layout > .sav-offer-import-panel:not(.is-collapsed) {
  bottom: var(--savills-tablet-bottom-nav) !important;
  grid-column: auto !important;
  grid-row: auto !important;
  height: auto !important;
  inset: 64px 0 var(--savills-tablet-bottom-nav) auto !important;
  max-height: none !important;
  max-width: min(92dvw, 680px) !important;
  position: fixed !important;
  top: 64px !important;
  width: min(92dvw, 680px) !important;
  z-index: 2147482200 !important;
}

html[data-savills-tablet="true"] .sav-offer-import-panel :is(button, [role="button"]),
html[data-savills-tablet="true"] .sav-offer-import-header > .sav-offer-collapse-button {
  min-height: var(--savills-tablet-touch-target) !important;
  min-width: var(--savills-tablet-touch-target) !important;
}

html[data-savills-tablet="true"] .sav-offer-comparison-resizer {
  min-height: var(--savills-tablet-touch-target) !important;
  min-width: var(--savills-tablet-touch-target) !important;
  touch-action: none !important;
}

/* Settings and other dense forms reflow without removing any field. */
html[data-savills-tablet="true"] .settings-panel :is(button, select, input:not([type="color"]), textarea) {
  min-height: var(--savills-tablet-touch-target) !important;
}

html[data-savills-tablet="true"] .settings-panel :is(.sav-dashboard-settings-move, .sav-unit-delete, .company-address-actions button) {
  min-width: var(--savills-tablet-touch-target) !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] :is(.sav-dashboard-settings-header, .company-address-title, .sav-units-header) {
  align-items: stretch !important;
  flex-direction: column !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] :is(.sav-dashboard-settings-grid, .sav-unit-row, .sav-units-add-row) {
  grid-template-columns: minmax(0, 1fr) !important;
}

/* Fixed menus remain inside the visual viewport after keyboard/orientation changes. */
html[data-savills-tablet="true"] :is(
  .quote-action-menu,
  .quote-status-menu,
  .sav-section-category-menu,
  .sav-finance-quote-filter-menu,
  .sav-editor-tools,
  .purchase-supplier-dropdown,
  .sav-forecast-client-dropdown
) {
  max-height: calc(var(--savills-tablet-viewport-height, 100dvh) - 24px) !important;
  max-width: calc(var(--savills-tablet-viewport-width, 100dvw) - 24px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
}

html[data-savills-tablet="true"] :is(.quote-action-menu, .quote-status-menu, .sav-section-category-menu) button,
html[data-savills-tablet="true"] .sav-finance-quote-option {
  min-height: var(--savills-tablet-touch-target) !important;
}

html[data-savills-tablet="true"] .sav-finance-filter-bar :is(.legacy-select, .sav-finance-quote-filter-trigger) {
  height: var(--savills-tablet-touch-target) !important;
  min-height: var(--savills-tablet-touch-target) !important;
}

html[data-savills-tablet="true"] .sav-finance-filter-bar .sav-finance-filter-reset {
  flex-basis: var(--savills-tablet-touch-target) !important;
  height: var(--savills-tablet-touch-target) !important;
  min-height: var(--savills-tablet-touch-target) !important;
  min-width: var(--savills-tablet-touch-target) !important;
  width: var(--savills-tablet-touch-target) !important;
}

html[data-savills-tablet="true"] .sav-finance-quote-option input {
  height: 22px !important;
  width: 22px !important;
}

/* The Planning host itself lives outside the regular app main. */
html[data-savills-tablet="true"][data-savills-tablet-orientation="portrait"] savills-planning-module[data-savills-tablet="true"] {
  bottom: var(--savills-tablet-bottom-nav) !important;
  left: 0 !important;
}

html[data-savills-tablet="true"][data-savills-tablet-orientation="landscape"] savills-planning-module[data-savills-tablet="true"] {
  bottom: 0 !important;
  left: var(--savills-tablet-side-nav) !important;
}

@media (prefers-reduced-motion: reduce) {
  html[data-savills-tablet="true"] *,
  html[data-savills-tablet="true"] *::before,
  html[data-savills-tablet="true"] *::after {
    scroll-behavior: auto !important;
  }
}
