/* Responsive content layer. Load after the existing component styles.
   Works with the 0.3.0 pages and the optional vmm-workspace shell.
   Wide records scroll inside their table, never by clipping the document. */
:root {
  --ava-content-width: 1580px;
  --ava-content-gap: 24px;
  --ava-content-border: #dfe8ec;
  --ava-content-muted: #526875;
}

body #content {
  width: 100%;
  max-width: var(--ava-content-width);
  min-width: 0;
  margin-inline: auto;
}
body :is(#content, #dialog-content, .auth, .shared-report) {
  overflow-wrap: break-word;
}
body :is(#content, #dialog-content, .auth, .shared-report) :is(h1, h2, h3, h4, p, label, legend) {
  overflow-wrap: anywhere;
}
body :is(#content, #dialog-content, .auth, .shared-report) :is(button, .button-link, summary, .doc-link) {
  min-height: 44px;
  line-height: 1.8;
}
body :is(#content, #dialog-content, .auth, .shared-report) :is(button, .button-link) {
  max-width: 100%;
  font-size: 14px;
}
body :is(#content, #dialog-content, .auth, .shared-report) :is(input, textarea, select) {
  min-width: 0;
  max-width: 100%;
  min-height: 46px;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.75;
}
body :is(#content, #dialog-content, .auth, .shared-report) :is(input[type=checkbox], input[type=radio]) {
  min-height: 20px;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}
body :is(#content, #dialog-content, .auth, .shared-report) label:has(> :is(input[type=checkbox], input[type=radio])) {
  min-height: 44px;
  align-content: center;
  line-height: 2;
  cursor: pointer;
}
body :is(#content, #dialog-content, .auth, .shared-report) :is(input, textarea, select):focus-visible {
  outline: 3px solid #328da0;
  outline-offset: 3px;
}
body :is(#content, #dialog-content, .auth, .shared-report) summary:focus-visible {
  outline: 3px solid #328da0;
  outline-offset: 2px;
}
body :is(#content, #dialog-content, .auth, .shared-report) :is(.muted, small, .field-help) {
  font-size: 13px;
  line-height: 1.95;
}
body :is(#content, #dialog-content, .auth, .shared-report) .field-help {
  color: var(--ava-content-muted);
}
body :is(#content, #dialog-content, .shared-report) :is(.panel, .card) {
  border-color: var(--ava-content-border);
  border-radius: 17px;
  box-shadow: 0 3px 14px rgb(23 44 58 / 3%);
}
body :is(#content, #dialog-content) .panel {
  padding: clamp(18px, 2.2vw, 28px);
  margin-bottom: var(--ava-content-gap);
}
body :is(#content, #dialog-content, .shared-report) :is(.grid2, .cards) {
  gap: var(--ava-content-gap);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
body :is(#content, #dialog-content) .cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: var(--ava-content-gap);
}
body :is(#content, #dialog-content) .cards:has(> :nth-child(4)) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
body :is(#content, #dialog-content, .shared-report) :is(.grid2, .cards, .row, .report-chart-layout, .report-details-grid) > * {
  min-width: 0;
}
body :is(#content, #dialog-content) .cards .card {
  padding: 20px 22px;
  margin: 0;
}
body :is(#content, #dialog-content) .cards .stat {
  font-size: clamp(24px, 2.2vw, 32px);
  line-height: 1.65;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
body :is(#content, #dialog-content) .cards .stat.money {
  font-size: clamp(21px, 1.8vw, 27px);
}
body :is(#content, #dialog-content, .shared-report) .row {
  gap: 10px 12px;
}
body :is(#content, #dialog-content, .shared-report) .badge {
  white-space: normal;
  max-width: 100%;
  font-size: 12px;
  line-height: 1.8;
  text-align: start;
}
body :is(#content, #dialog-content) :is(.notice, .estimate, .tariffs) {
  font-size: 14px;
  line-height: 2;
  overflow-wrap: anywhere;
}
body :is(#content, #dialog-content) .estimate p {
  font-size: 13px;
}
body :is(#content, #dialog-content, .shared-report) .empty {
  padding: 36px 20px;
}
body :is(#content, #dialog-content, .shared-report) .empty p {
  font-size: 14px;
}
body :is(#content, #dialog-content, .shared-report) .table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e3ebef;
  border-radius: 12px;
  scrollbar-width: thin;
  scrollbar-color: #9db6c0 #f1f6f8;
}
body :is(#content, #dialog-content, .shared-report) .table-wrap > table {
  min-width: 640px;
  width: 100%;
  font-size: 14px;
}
body :is(#content, #dialog-content, .shared-report) :is(td, th) {
  padding: 14px 16px;
  vertical-align: top;
  line-height: 1.95;
}
body :is(#content, #dialog-content, .shared-report) th {
  font-size: 12px;
  color: #526875;
  font-weight: 600;
  background: #f5f8fa;
}
body :is(#content, #dialog-content, .shared-report) td:first-child {
  max-width: 320px;
  white-space: nowrap;
  min-width: 140px;
  overflow-wrap: anywhere;
}
body #content .send-id { white-space: nowrap; overflow-wrap: normal; word-break: normal; min-width: 30ch; }
body #content .workspace-campaign-id { display: none; }
@media (max-width: 760px) {
  body #content .workspace-id-column { display: none; }
  body #content td:has(> .workspace-campaign-id) { min-width: 230px; max-width: 300px; white-space: normal; }
  body #content .workspace-campaign-id { display: block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; margin-top: 8px; color: #526875; }
}
body :is(#content, #dialog-content, .shared-report) td :is(.muted, small, .send-id) {
  font-size: 12px;
}
body :is(#content, #dialog-content, .shared-report) td button {
  min-height: 44px;
  font-size: 13px;
  padding-inline: 12px;
}
body #tariff-form .table-wrap > table {
  min-width: 560px;
}
body #tariff-form td input {
  min-width: 140px;
}
body :is(#content, #dialog-content) :is(.send-id, .token, code, bdi) {
  overflow-wrap: anywhere;
}
body :is(#content, #dialog-content) .user-filters {
  gap: 12px;
}
body :is(#content, #dialog-content) .user-filters :is(input, select) {
  min-width: min(100%, 180px);
  flex-basis: 180px;
}
body :is(#content, #dialog-content) .user-filters input {
  flex-grow: 2;
}
body :is(#content, #dialog-content) fieldset {
  min-width: 0;
}
body :is(#content, #dialog-content) .choice-row {
  grid-template-columns: 72px minmax(0, 1fr);
}
body :is(#content, #dialog-content) audio {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 44px;
}
body #content .media-workspace {
  grid-template-columns: minmax(260px, .85fr) minmax(0, 1.4fr);
}
body :is(#content, #dialog-content) .media-item :is(h3, .row) {
  overflow-wrap: anywhere;
}
body :is(#content, #dialog-content) .media-tags span {
  font-size: 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
body :is(#content, #dialog-content) :is(.workflow-section-head p, .workflow-dialog-intro, .workflow-disclosure > summary, .workflow-stage > small) {
  font-size: 14px;
  line-height: 2;
}
body #campaign-form .wizard-nav {
  gap: 10px;
  padding-bottom: 18px;
  margin-bottom: 22px;
}
body #campaign-form .wizard-nav button {
  font-size: 13px;
  min-height: 58px;
}
body :is(#content, #dialog-content) :is(.workflow-stage, .workflow-quick-form, .audio-editor) {
  min-width: 0;
}
body :is(#content, #dialog-content) .workflow-check-item :is(strong, small) {
  font-size: 13px;
}
body :is(#content, #dialog-content) .workflow-disclosure > .table-wrap {
  width: calc(100% - 36px);
  max-width: calc(100% - 36px);
}
body :is(#content, #dialog-content) .workflow-submit-bar {
  padding: 20px;
  background: #f7fafb;
}
body :is(#content, #dialog-content) .workflow-submit-bar label {
  font-size: 14px;
}
body :is(#content, #dialog-content) .workflow-line-controls form label {
  min-width: 130px;
}
body :is(#content, #dialog-content) :is(.policy-metrics, .voice-line p, .journey-item p, .timeline li, .review-queue-item, .content-approval-panel > p) {
  font-size: 13px;
}
body #report-content .campaign-toolbar {
  grid-template-columns: minmax(0, 1fr) auto auto;
}
body #report-content .campaign-toolbar > .toolbar-group:first-child {
  flex-wrap: wrap;
}
body #report-content .campaign-toolbar .toolbar-label {
  font-size: 12px;
}
body #report-content .report-toolbar-tools > summary {
  font-size: 14px;
}
body #report-content .report-toolbar-tools > .toolbar-group {
  max-width: min(320px, 100%);
}
body :is(#content, #dialog-content, .shared-report) .report-compact-card {
  min-width: 0;
}
body :is(#content, #dialog-content, .shared-report) .report-compact-card strong {
  font-size: 26px;
  overflow-wrap: anywhere;
}
body :is(#content, #dialog-content, .shared-report) .report-chart-layout {
  grid-template-columns: 260px minmax(0, 1fr);
}
body :is(#content, #dialog-content, .shared-report) .report-legend-item {
  min-height: 48px;
}
body :is(#content, #dialog-content, .shared-report) :is(.report-chart-detail, .report-detail-row, .report-key-row, .report-denominator-note) {
  font-size: 13px;
}
body #content .workspace-overview {
  max-width: 100%;
}
body #content :is(.workspace-metric-label, .workspace-metric > small, .workspace-task strong, .workspace-service-row strong) {
  font-size: 13px;
}
body #content :is(.workspace-welcome p, .workspace-task small, .workspace-service-row small, .workspace-wallet-note, .workspace-panel-heading p) {
  font-size: 12px;
}
body #content .workspace-wallet-label {
  font-size: 14px;
}
body #content .workspace-recent-table td {
  font-size: 13px;
}
body #content .workspace-panel-heading h2 {
  font-size: 16px;
}
body #content :is(.workspace-wallet-owner, .workspace-wallet dt, .workspace-wallet dd, .workspace-overview-footnote) {
  font-size: 12px;
}
body #provider-balances-bar {
  margin-block: 0 24px;
  padding: 16px;
  border-color: var(--ava-content-border);
}
body #provider-balances-bar .provider-credit-heading {
  font-size: 13px;
}
body #provider-balances-bar .provider-credit-heading button {
  min-height: 44px !important;
  padding: 9px 12px !important;
  font-size: 12px !important;
}
body #provider-balances-bar .provider-credit {
  padding: 14px;
}
body #provider-balances-bar .provider-credit > span {
  font-size: 12px;
}
body #provider-balances-bar .provider-credit strong {
  font-size: 15px;
}
body #provider-balances-bar .provider-credit small {
  font-size: 11px;
  line-height: 1.9;
}
body dialog#dialog {
  width: min(1180px, calc(100% - 48px));
  max-width: calc(100% - 48px);
  max-height: calc(100dvh - 48px);
  padding: 28px;
  margin: auto;
  overscroll-behavior: contain;
}
body dialog#dialog button {
  min-height: 44px;
  font-size: 14px;
  padding: 10px 15px;
}
body #close-dialog {
  min-width: 110px;
}
body .shared-report {
  width: calc(100% - 48px);
  max-width: 1280px;
  margin: 24px auto;
  padding: clamp(18px, 3vw, 32px);
}
body .shared-report > p {
  overflow-wrap: anywhere;
}
body .shared-report > .row > a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--ava-content-border);
  border-radius: 9px;
  background: #f8fbfc;
}

@media (max-width: 1200px) {
  body #content :is(.voice-lines-workspace, .policy-settings-grid) {
    grid-template-columns: minmax(0, 1fr);
  }
  body #content .voice-lines-workspace > #new-voice-line {
    position: static;
  }
}

@media (max-width: 960px) {
  body #content .media-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  body #content .media-upload-panel {
    position: static;
  }
  body #content .workspace-overview-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  body #content .workspace-wallet {
    grid-row: auto;
  }
  body :is(#content, #dialog-content) .cards:has(> :nth-child(4)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  :root {
    --ava-content-gap: 18px;
  }
  body :is(#content, #dialog-content, .shared-report) .grid2 {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }
  body :is(#content, #dialog-content, .auth, .shared-report) :is(input, select, textarea) {
    font-size: 16px;
  }
  body :is(#content, #dialog-content, .auth, .shared-report) label {
    font-size: 14px;
  }
  body :is(#content, #dialog-content) .cards {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  body :is(#content, #dialog-content) .cards .card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 16px;
    padding: 17px 20px;
  }
  body :is(#content, #dialog-content) .cards .card .stat {
    font-size: 26px;
    margin: 0;
  }
  body :is(#content, #dialog-content) .cards .card .stat.money {
    font-size: 23px;
  }
  body :is(#content, #dialog-content) .cards .card .muted {
    font-size: 13px;
  }
  body :is(#content, #dialog-content) .workflow-final-check {
    grid-template-columns: minmax(0, 1fr);
  }
  body :is(#content, #dialog-content) .workflow-check-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }
  body :is(#content, #dialog-content) .workflow-check-item strong {
    max-width: 65%;
    text-align: end;
  }
  body #report-content .campaign-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }
  body #report-content .campaign-toolbar > .toolbar-group {
    grid-column: auto;
    width: 100%;
  }
  body #report-content .campaign-toolbar > .toolbar-group:first-child .toolbar-label {
    max-width: none;
    flex-basis: 100%;
  }
  body #report-content .campaign-toolbar > .toolbar-group:first-child :is(button, .button-link) {
    flex: 1 1 100px;
  }
  body #report-content .report-toolbar-tools {
    display: block;
  }
  body #report-content .report-toolbar-tools > .toolbar-group {
    position: static;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    margin-top: 8px;
    box-shadow: none;
  }
  body #report-content .campaign-toolbar > .toolbar-danger {
    padding: 0;
  }
  body #report-content .campaign-toolbar > .toolbar-danger button {
    width: 100%;
  }
  body :is(#content, #dialog-content, .shared-report) :is(.report-chart-layout, .report-details-grid, .report-audio) {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }
  body :is(#content, #dialog-content, .shared-report) .report-legend {
    grid-template-columns: minmax(0, 1fr);
  }
  body :is(#content, #dialog-content) :is(.policy-actions, .workflow-review-actions) > label {
    min-width: 0;
    flex-basis: 100%;
  }
  body #provider-balances-bar .provider-credit-cards {
    grid-template-columns: minmax(0, 1fr);
  }
  body #provider-balances-bar .provider-credit {
    grid-template-columns: 90px minmax(0, 1fr);
  }
  body #provider-balances-bar .provider-credit small {
    grid-column: 1 / -1;
  }
  body .shared-report {
    width: calc(100% - 32px);
    margin-block: 16px;
  }
  body .shared-report h1 {
    font-size: 23px;
  }
  body dialog#dialog {
    width: calc(100% - 24px);
    max-width: calc(100% - 24px);
    max-height: calc(100dvh - 24px);
    padding: 20px;
    border-radius: 17px;
  }
}

@media (max-width: 560px) {
  body :is(#content, #dialog-content, .shared-report) .panel {
    padding: 18px 16px;
    border-radius: 14px;
  }
  body :is(#content, #dialog-content) .cards:has(> :nth-child(4)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body :is(#content, #dialog-content) .cards:has(> :nth-child(4)) .card {
    display: grid;
    gap: 6px;
    padding: 15px;
  }
  body :is(#content, #dialog-content) .user-filters :is(input, select) {
    flex-basis: 100%;
    width: 100%;
  }
  body :is(#content, #dialog-content) .panel > .row.between > div {
    width: 100%;
  }
  body :is(#content, #dialog-content) .panel > .row.between > button {
    flex-grow: 1;
  }
  body :is(#content, #dialog-content) .actions.row > button {
    flex: 1 1 140px;
  }
  body :is(#content, #dialog-content) .financial-report-filters .actions > button {
    flex-basis: 100%;
  }
  body :is(#content, #dialog-content) .choice-row {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 8px;
  }
  body #campaign-form .wizard-nav {
    gap: 6px;
  }
  body #campaign-form .wizard-nav button {
    min-height: 78px;
    font-size: 12px;
    line-height: 1.8;
    flex-direction: column;
    padding: 9px 5px;
    gap: 6px;
  }
  body :is(#content, #dialog-content) .wizard-controls > button {
    flex: 1;
  }
  body :is(#content, #dialog-content) :is(.workflow-submit-bar, .content-approval-panel) {
    padding: 16px;
  }
  body :is(#content, #dialog-content) .workflow-disclosure > summary {
    padding: 14px;
  }
  body :is(#content, #dialog-content) .workflow-disclosure > summary ~ :not(summary) {
    margin-inline: 14px;
  }
  body :is(#content, #dialog-content) .workflow-disclosure > :is(input, select, textarea) {
    width: calc(100% - 28px);
  }
  body :is(#content, #dialog-content) .workflow-disclosure > .table-wrap {
    width: calc(100% - 28px);
    max-width: calc(100% - 28px);
  }
  body :is(#content, #dialog-content) :is(.voice-line form, .workflow-line-controls form) > label {
    min-width: 0;
    width: 100%;
    flex-basis: 100%;
  }
  body :is(#content, #dialog-content) :is(.voice-line form, .workflow-line-controls form) > button {
    width: 100%;
  }
  body :is(#content, #dialog-content) .sms-settings-tabs [role=tab] {
    flex: 1 1 100%;
    font-size: 14px;
    justify-content: center;
    min-width: 0;
  }
  body :is(#content, #dialog-content) .sms-line-card {
    padding: 16px;
  }
  body :is(#content, #dialog-content) .report-compact-cards {
    gap: 10px;
  }
  body :is(#content, #dialog-content) .report-compact-card {
    padding: 14px;
  }
  body :is(#content, #dialog-content) .report-compact-card strong {
    font-size: 24px;
  }
  body :is(#content, #dialog-content) .report-compact-card small {
    font-size: 12px;
  }
  body :is(#content, #dialog-content) .readiness {
    display: block;
    font-size: 14px;
    padding: 16px;
  }
  body :is(#content, #dialog-content) .readiness dd {
    margin: 3px 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ava-content-border);
  }
  body :is(#content, #dialog-content) .readiness dd:last-child {
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
  }
  body #content .workspace-welcome {
    min-height: 0;
    padding: 22px;
  }
  body #content .workspace-welcome p {
    max-width: 100%;
    font-size: 14px;
  }
  body #content .workspace-welcome .row {
    align-items: stretch;
  }
  body #content .workspace-welcome button {
    font-size: 13px;
  }
  body #content .workspace-section-heading {
    gap: 4px 12px;
  }
  body #content .workspace-section-heading > span {
    font-size: 12px;
  }
  body #content .workspace-metrics {
    gap: 12px;
  }
  body #content .workspace-metric {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    padding: 16px;
  }
  body #content .workspace-metric-icon {
    grid-area: auto;
    width: 34px;
    height: 34px;
    font-size: 15px;
    margin-bottom: 4px;
  }
  body #content .workspace-metric-label,
  body #content .workspace-metric > strong,
  body #content .workspace-metric > small {
    grid-area: auto;
  }
  body #content .workspace-metric > strong {
    font-size: 27px;
    overflow-wrap: anywhere;
  }
  body #content .workspace-metric > small {
    font-size: 12px;
  }
  body #content .workspace-task {
    gap: 10px;
  }
  body #content .workspace-task > span:nth-child(2) {
    min-width: 0;
  }
  body #content .workspace-wallet-amount {
    font-size: 30px;
  }
  body #provider-balances-bar .provider-credit-heading .row {
    gap: 8px;
  }
  body #provider-balances-bar .provider-credit-heading .row button {
    flex: 1;
  }
  body dialog#dialog {
    width: calc(100% - 16px);
    max-width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
    padding: 20px 16px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
  body #dialog-content > h2:first-child {
    font-size: 21px;
  }
  body #close-dialog {
    width: 100%;
    margin-top: 22px;
  }
  body .auth {
    padding: 20px 16px;
  }
  body .auth .panel {
    padding: 26px 22px;
  }
  body #toast {
    left: auto;
    right: auto;
    inset-inline: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    max-width: none;
    font-size: 14px;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 359px) {
  body :is(#content, #dialog-content) .cards .card {
    display: grid;
    gap: 6px;
  }
  body #content .workspace-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
  body :is(#content, #dialog-content) .report-compact-cards {
    grid-template-columns: minmax(0, 1fr);
  }
  body #provider-balances-bar .provider-credit {
    grid-template-columns: minmax(0, 1fr);
  }
  body #content .workspace-panel-heading {
    flex-wrap: wrap;
  }
  body #content .workspace-panel-heading .workspace-text-button {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body :is(#content, #dialog-content, .shared-report) *,
  body :is(#content, #dialog-content, .shared-report) *::before,
  body :is(#content, #dialog-content, .shared-report) *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body :is(#content, #dialog-content, .shared-report) :is(.panel, .card) {
    box-shadow: none;
  }
  body :is(#content, #dialog-content, .shared-report) .table-wrap {
    overflow: visible;
  }
  body :is(#content, #dialog-content, .shared-report) .table-wrap > table {
    min-width: 0;
    font-size: 10pt;
  }
  body .shared-report {
    width: 100%;
    max-width: none;
    margin: 0;
    border: 0;
    padding: 0;
  }
}
