/* Shared responsive frame for the billing portal. Desktop styles live in the base sheets. */
@media (max-width: 1023px) {
  .layout { display: block; min-width: 0; }
  .layout > .sidebar { display: none; }
  .main, .content, #workspace, .card, .dt-block { min-width: 0; max-width: 100%; }
  .header { position: sticky; top: 0; display: flex; flex-wrap: nowrap; gap: 12px; align-items: center; padding: 16px 20px; }
  .header__where { flex: 1; min-width: 0; }
  .header__tools { min-width: 0; }
  .mobile-menu[hidden] { display: block; flex: none; }
  .mobile-menu__toggle { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--navy); font: 600 14px var(--font-ui); cursor: pointer; list-style: none; }
  .mobile-menu__toggle::-webkit-details-marker { display: none; }
  .mobile-menu__panel { position: absolute; z-index: 20; top: 100%; left: 0; width: min(320px, 100vw); max-height: calc(100dvh - 72px); overflow-y: auto; padding: 16px 14px; background: var(--navy); color: var(--surface); border: 1px solid var(--navy-500); }
  .mobile-menu__panel .sidebar__summary, .mobile-menu__panel .sidebar__item { min-height: 40px; }
  .content { padding: 24px 20px 56px; }
  .toolbar, .filters, .filter-chips, .pickers, .form__actions { max-width: 100%; flex-wrap: wrap; }
  .tabs { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .tabs__tab { flex: none; min-height: 40px; align-items: center; }
  .kpi-grid > * { min-width: 0; }
  .kpi__value, .dt__num, .kpi__line .mono { overflow-wrap: normal; white-space: nowrap; }
  .table-scroll, #workspace :has(> table) { min-width: 0; max-width: 100%; overflow-x: auto; }
  .table-scroll table, #workspace table { width: max-content; min-width: 100%; }
  #workspace .table-scroll .dt.company-rules-table { min-width: 800px; }
  .choose__search .input { min-width: 0; flex: 1 1 220px; }
  .picklist__row { min-width: 0; }
}

@media (max-width: 599px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea { font-size: 16px !important; }
  .choose__pager-links a { display: inline-flex; align-items: center; min-height: 40px; }
  .header { padding: 12px 16px; }
  .header__where { overflow: hidden; }
  .crumb { max-width: 100%; flex-wrap: wrap; }
  .crumb > * { min-width: 0; }
  .crumb__scope { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .crumb__scope { min-height: 40px; font-size: 13px; }
  .page-title { font-size: 23px; }
  .crumb, .content :is(small, .eyebrow, .dt__meta, .dt__h, .kpi__label, .kpi__sub, .kpi__note, .tabs__count, .chip, .picker__label, .filter .mono, .field__label, .muted, .todo__why, .facts__label, .facts__note, .facts__value, .facts__more > summary), .mobile-menu__panel .sidebar__count { font-size: 13px; }
  .mobile-menu__panel .usermenu__current { min-height: 40px; }
  .mobile-menu__panel :is(.usermenu__email, .usermenu__avatar) { font-size: 13px; }
  .mobile-menu__panel .usermenu__avatar { width: 32px; height: 32px; }
  .mobile-menu__panel .usermenu__item { min-height: 40px; }
  .content { padding: 18px 16px 48px; gap: 16px; }
  .toolbar > *, .form__row > * { min-width: 0; }
  .form__row { grid-template-columns: minmax(0, 1fr); }
  .filter, .filter-chip, .seg__b, .btn, .pickers select, .pickers input, .form input, .form select, .form textarea, .choose__search .input { min-height: 40px; font-size: max(13px, 1em); }
  .form__actions > * { flex: 1 1 auto; }
  .kpi__value { font-size: clamp(20px, 6vw, 32px); }
  .table-scroll, #workspace :has(> table) { container-type: inline-size; }
  :is(.table-scroll table, #workspace :has(> table) > table):not(:has(:is(thead th, tbody td):first-child input[type="checkbox"])) :is(th, td):first-child:not([colspan]) {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 0;
    max-width: 45cqw;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--surface);
  }
  :is(.table-scroll table, #workspace :has(> table) > table):not(:has(:is(thead th, tbody td):first-child input[type="checkbox"])) thead th:first-child { z-index: 2; }
  #workspace .table-scroll .dt.company-rules-table :is(th, td):first-child { min-width: 120px; }
  #workspace .table-scroll .dt.company-user-table :is(th, td):first-child { min-width: 0; width: 16%; max-width: 45cqw; }
  .company-user-table__identity > div, .company-user-table__identity .permissions-table__subject { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .login { padding: 16px; }
  .login__card { min-width: 0; padding: 28px 20px; }
  .login__card .btn { min-height: 40px; }
  .choose__search > button { flex: 1 1 100%; }
  .seg { max-width: 100%; flex-wrap: wrap; overflow: visible; }
  .seg__b { min-width: 0; }
  .picklist__row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .picklist__row > button { justify-self: stretch; }
}

@media (max-width: 599px) {
  .company-profile.company-settings-view .facts__row { flex-wrap: wrap; }
  .company-profile.company-settings-view .facts__row > .facts__head { display: contents; }
  .company-profile.company-settings-view .facts__row > .facts__head > .facts__label { order: 0; flex: 1 1 100%; }
  #workspace .company-profile.company-settings-view .facts__row > .facts__value { order: 1; flex: 1 1 100%; text-align: left; white-space: normal; overflow-wrap: normal; }
  .company-profile.company-settings-view .facts__row > .facts__head > .facts__note { order: 2; flex: 1 1 100%; }
}

@media(max-width:599px){.flow-page .admin-bar,.flow-page .admin-bar__actions{flex-wrap:wrap;max-width:100%}.flow-page .searchbox,.flow-page .picker{max-width:100%}.flow-page .tabs{overflow-x:auto;max-width:100%}.flow-page .tabs__tab{white-space:nowrap}.flow-page .flow-queue{padding:12px}.modal .flow-dialog{padding:12px}}
@media(max-width:599px){.flow-page .page-head{display:flex;flex-direction:column}.flow-page .page-head__text{width:100%;flex:auto}.flow-page .page-head__tools{width:100%}.flow-dialog>.chip{justify-self:start}}
