/*
 * GAINVO v3.1.4
 * Shared responsive text-flow and alignment safeguards.
 *
 * This layer intentionally contains no transactional or offline behaviour.
 * It corrects presentation across every authenticated workspace and public page.
 */

/* Keep flex and grid children from forcing cards wider than their containers. */
:where(
  .app-main,
  .content,
  .content > *,
  .panel,
  .panel > *,
  .topbar-title,
  .topbar-actions,
  .business-chip,
  .business-chip > *,
  .page-actions,
  .page-actions > *,
  .panel-head,
  .panel-head > *,
  .role-panel-head,
  .role-panel-head > *,
  .role-hero > *,
  .role-stat-grid > *,
  .admin-kpi-grid > *,
  .admin-mini-stats > *,
  .admin-workspace-grid > *,
  .admin-detail-grid > *,
  .inventory-summary > *,
  .v30-stat-grid > *,
  .v30-two-column > *,
  .v30-action-center > *,
  .support-detail-grid > *,
  .seller-workspace-v312 > *,
  .seller-counter-v312 > *,
  .seller-counter-actions > *,
  .seller-daily-strip > *,
  .seller-work-grid > *
) {
  min-width: 0;
}

/* Natural wrapping: preserve words when possible and break only long identifiers. */
:where(
  .content h1,
  .content h2,
  .content h3,
  .content p,
  .content small,
  .content em,
  .content dt,
  .content dd,
  .content label,
  .content .eyebrow,
  .nav-link span,
  .business-chip small,
  .business-chip strong,
  .support-message,
  .support-description,
  .support-diagnostics dd
) {
  overflow-wrap: break-word;
}

.eyebrow {
  max-width: 100%;
  line-height: 1.35;
  white-space: normal;
}

.btn,
.nav-link,
.owner-management-link,
.sheet-link-button {
  line-height: 1.25;
}

.btn {
  max-width: 100%;
  text-align: center;
  white-space: normal;
}

/* Shell and navigation alignment shared by owner, staff and Super Admin. */
.topbar-title {
  padding-right: 12px;
}

.topbar-title h1,
.topbar-title p {
  max-width: 100%;
}

.topbar-actions {
  flex: 0 0 auto;
}

.nav-link {
  text-align: left;
}

.nav-link span {
  min-width: 0;
}

.sidebar-nav {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #cbd5e1;
}

/* Shared heads, filters and action bars keep their copy left-aligned. */
.panel-head > div,
.role-panel-head > div,
.admin-page-intro > div,
.support-toolbar > div,
.modal-head > div,
.sheet-head > div {
  min-width: 0;
}

.panel-head h2,
.panel-head p,
.role-panel-head h2,
.admin-page-intro h2,
.admin-page-intro p,
.modal-head h2,
.modal-head p,
.sheet-head h2 {
  text-align: left;
}

.panel-head > a,
.role-panel-head > a {
  flex: 0 0 auto;
  text-align: right;
}

.page-actions,
.document-toolbar,
.support-toolbar {
  flex-wrap: wrap;
}

.search-filter {
  min-width: 0;
}

/* Dashboard cards: consistent copy alignment and readable value flow. */
.role-stat-grid > a,
.role-stat-grid > article,
.admin-kpi-grid > a,
.inventory-summary > a,
.inventory-summary > article {
  text-align: left;
}

.role-stat-grid strong,
.admin-kpi-grid strong,
.admin-mini-stats strong,
.inventory-summary strong,
.v30-stat-grid strong {
  max-width: 100%;
  font-variant-numeric: tabular-nums;
}

.role-stat-grid small,
.role-stat-grid em,
.admin-kpi-grid small,
.admin-kpi-grid em,
.admin-mini-stats small,
.inventory-summary small,
.v30-stat-grid small,
.v30-stat-grid span {
  line-height: 1.4;
}

/* Sales Counter: the first note is copy, not an icon. */
.seller-daily-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.seller-daily-strip > article {
  min-width: 0;
  text-align: left;
}

.seller-daily-strip > article:first-child {
  justify-items: start;
  text-align: left;
}

.seller-daily-strip > article:first-child > span {
  display: block;
  width: auto;
  height: auto;
  min-width: 0;
  max-width: 100%;
  flex: initial;
  place-items: initial;
  border-radius: 0;
  line-height: 1.4;
  overflow-wrap: break-word;
}

.seller-daily-strip > article:not(:first-child) > span {
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  display: grid;
  place-items: center;
  border-radius: 11px;
}

.seller-daily-strip > article > div {
  min-width: 0;
}

.seller-daily-strip > article strong {
  max-width: 100%;
  font-variant-numeric: tabular-nums;
}

.seller-daily-strip > article:first-child > strong {
  line-height: 1.15;
  white-space: nowrap;
}

.seller-counter-actions strong,
.seller-counter-actions small,
.seller-start-card strong,
.seller-start-card small,
.owner-counter-live strong,
.owner-counter-live em {
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: break-word;
}

/* Lists and support cases keep their main copy aligned without squeezing it. */
.role-activity-list > a > span:nth-child(2),
.owner-attention > a > span:nth-child(2),
.stock-watch > a > span:nth-child(2),
.seller-action-list > a > span:nth-child(2),
.invoice-queue > a > span:nth-child(2),
.collection-trail > a > span:nth-child(2),
.admin-queue-list > a > span:nth-child(2),
.admin-user-list article > div,
.support-list > a > span:nth-child(2),
.health-event-list article > div {
  min-width: 0;
}

.support-list strong {
  white-space: normal;
  overflow-wrap: break-word;
}

.support-list small,
.health-event-list p,
.health-event-list small {
  line-height: 1.4;
}

/* Tables retain column semantics and a steady baseline on every portal. */
.table-wrap th,
.table-wrap td,
.admin-account-table th,
.admin-account-table td,
.admin-audit-table th,
.admin-audit-table td {
  vertical-align: middle;
}

.table-wrap th:not(.text-right),
.table-wrap td:not(.text-right),
.admin-account-table th:not(.text-right),
.admin-account-table td:not(.text-right),
.admin-audit-table th:not(.text-right),
.admin-audit-table td:not(.text-right) {
  text-align: left;
}

.table-wrap .text-right,
.admin-account-table .text-right,
.admin-audit-table .text-right {
  text-align: right !important;
}

/* Empty states stay centred, while their paragraphs keep a readable line length. */
.empty-mini p,
.empty-large p,
.role-empty p,
.admin-empty-state span {
  width: min(100%, 480px);
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  line-height: 1.55;
}

@media (max-width: 1100px) {
  .seller-daily-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar-title {
    min-width: 0;
    padding-right: 6px;
  }

  .topbar-title h1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-actions,
  .document-toolbar,
  .support-toolbar {
    align-items: stretch;
  }

  .panel-head,
  .role-panel-head {
    align-items: flex-start;
  }

  .panel-head > a,
  .role-panel-head > a {
    line-height: 1.35;
  }

  .seller-daily-strip > article:not(:first-child) > span {
    width: 33px;
    height: 33px;
    flex-basis: 33px;
  }

  .seller-daily-strip > article:first-child > strong {
    font-size: clamp(19px, 6vw, 23px);
  }

  .support-list strong {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

@media (max-width: 380px) {
  .seller-daily-strip,
  .role-stat-grid,
  .admin-kpi-grid,
  .admin-mini-stats,
  .inventory-summary,
  .v30-stat-grid,
  .v30-stat-grid.three {
    grid-template-columns: minmax(0, 1fr);
  }

  .seller-daily-strip > article {
    min-height: 74px;
  }

  .seller-daily-strip > article:first-child {
    padding: 14px;
  }

  .seller-daily-strip > article:not(:first-child) {
    display: flex;
    align-items: center;
  }
}
