/* Shared layout guardrails for the merchant workbench and operations console.
   Keep cards flexible, preserve readable table columns, and let long values wrap
   inside their own cell instead of pushing adjacent cards out of alignment. */
:where(.panel, .feature, .price-grid article, .contact-card, .terminal-public-card,
  .checkout-card, .preview-card, .preview-provider) {
  min-width: 0;
}

/* Keep the merchant workbench on the same wide desktop rhythm as the
   operations console. The legacy 1120px cap left a large unused area beside
   the dashboard on wide screens. */
.dashboard-page .dash-content {
  width: 100%;
  max-width: 1600px;
}

@media (min-width: 901px) {
  .dashboard-page .dash {
    padding-left: 32px;
    padding-right: 32px;
  }
}

:where(.panel > header, .section-heading, .merchant-settlement-panel > header,
  .onboarding-panel-heading, .unified-flow-head, .preview-card > h3) {
  min-width: 0;
}

:where(.panel > header > div:first-child, .section-heading > div:first-child,
  .merchant-settlement-panel > header > div:first-child,
  .onboarding-panel-heading > div:first-child, .unified-flow-head > div:first-child) {
  min-width: 0;
}

:where(.panel > header h2, .panel > header h3, .panel > header p,
  .section-heading h2, .section-heading p, .merchant-settlement-panel small,
  .unified-flow-head p) {
  overflow-wrap: anywhere;
}

/* Grid children should occupy the same row height while their inner content
   remains allowed to shrink. */
:where(.dash-panels > .panel, .merchant-detail-grid > .panel,
  .terminal-summary > .panel, .wallet-grid > .panel, .fee-cards > .panel,
  .member-plan-grid > .panel, .member-balance-grid > article) {
  height: 100%;
}

:where(.table-scroll, .orders, .account-table-wrap) {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

:where(.orders table, .merchant-detail-grid table, .account-management table,
  .ops-panel table) {
  width: 100%;
}

:where(.orders th, .orders td, .merchant-detail-grid th,
  .merchant-detail-grid td, .account-management th, .account-management td,
  .ops-panel th, .ops-panel td) {
  overflow-wrap: anywhere;
}

.account-management .account-card {
  display: flex;
  flex-direction: column;
}

.account-management .account-card > header {
  min-width: 0;
}

.account-management .account-card > header h3 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.account-management .account-card > .account-table-wrap,
.account-management .account-card > form {
  min-width: 0;
}

#ops .ops-panel > .panel,
#ops .ops-overview-grid > .panel,
#ops .ops-cards > .panel {
  min-width: 0;
}

#ops .ops-todo > span:first-child,
#ops .ops-shortcut-grid b,
#ops .ops-activity-item b {
  min-width: 0;
  overflow-wrap: anywhere;
}

#ops .ops-panel .table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

@media (max-width: 900px) {
  .merchant-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .merchant-detail-grid .panel:nth-child(3),
  .merchant-detail-grid .panel:nth-child(4),
  .merchant-detail-grid .merchant-settlement-panel {
    grid-column: auto;
  }

  .member-current {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .member-plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .member-current,
  .member-plan-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-management .account-card > header {
    align-items: flex-start;
  }

  .account-management .account-card > header .btn,
  .account-management .account-card > header .account-note {
    max-width: 100%;
    white-space: normal;
    text-align: right;
  }
}
