/* Mobile workbench: focus on the actual task, not setup illustrations.
 *  Reorders document sections to match reading and keyboard order.
 *  This file is web-only and loaded after feature-specific styles.
 */

/* Service bot avatars must never grow to the dimensions of the SVG asset. */
.app-page .channels-page-shell .service-bot-identity .channel-platform-logo {
  display:inline-flex;
  flex:0 0 44px;
  align-items:center;
  justify-content:center;
  width:44px;
  height:44px;
  min-width:44px;
  min-height:44px;
  padding:8px;
  overflow:hidden;
  border-radius:12px;
  border:1px solid var(--ui-line);
  background:var(--ui-surface);
}
.app-page .channels-page-shell .service-bot-identity .channel-platform-logo :is(svg,img,.brand-icon) {
  display:block;
  width:26px;
  height:26px;
  max-width:100%;
  max-height:100%;
  object-fit:contain;
}
.app-page .channels-page-shell .service-bot-identity {
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}
.app-page .channels-page-shell .service-bot-identity .service-bot-copy {
  min-width:0;
  overflow-wrap:anywhere;
}
.app-page .channels-page-shell .service-bot-identity .service-bot-copy strong {
  font-size:13px;
  line-height:1.8;
}
.app-page .channels-page-shell .service-bot-card {
  display:flex;
  flex-direction:column;
  align-items:stretch;
  min-width:0;
  padding:14px 16px;
  gap:9px;
}
.app-page .channels-page-shell .service-bot-card >.status-chip {
  align-self:flex-start;
  font-size:11px;
}
.app-page .channels-page-shell .service-bot-actions .button {
  min-height:44px;
  border-radius:10px;
  font-size:12px;
}
.app-page .channels-page-shell .service-bots-help,
.app-page .channels-page-shell .connection-path-note p {
  font-size:12px;
  line-height:2;
}
.app-page .channels-page-shell .service-bot-link,
.app-page .channels-page-shell .service-bot-copy small {
  font-size:12px;
  line-height:1.8;
}

/* Desktop channels retain a functional dual-column workspace, now
   matching the accessible DOM order (channels followed by bot setup). */
@media(min-width:1200px){
  .app-page main.dashboard-shell.channels-page-shell{
    grid-template-areas:
      "intro intro"
      "stats stats"
      "list bots"
      "flow flow"
      "note note";
    grid-template-columns:minmax(0,1.25fr) minmax(280px,.75fr);
  }
}

/* Comfortable text / touch targets in both themes. */
.app-page .channels-page-shell .channel-card-details :is(span,strong),
.app-page .accounts-connections-shell .connected-account-identity p,
.app-page .accounts-connections-shell .telegram-account-identity p {
  font-size:12px;
  line-height:1.8;
}
.app-page .channels-page-shell .channel-card-actions .button,
.app-page .channels-page-shell .channel-filter-actions button,
.app-page .accounts-connections-shell .connected-account-actions .button,
.app-page .accounts-connections-shell .telegram-actions .button{
  min-height:44px;
  font-size:12px;
}
.app-page .accounts-connections-shell .connected-destination-row,
.app-page .accounts-connections-shell .telegram-dialog-row{
  line-height:1.8;
  overflow-wrap:anywhere;
}
.app-page .accounts-connections-shell .connected-platform-tab{
  font-size:12px;
  min-height:56px;
}

/* Feature-specific mobile adjustments: short, discoverable and readable. */
@media(max-width:900px){
  .app-page main.dashboard-shell.channels-page-shell{
    display:grid;
    grid-template-columns:minmax(0,1fr);
    grid-template-areas:
      "intro"
      "stats"
      "list"
      "bots"
      "flow"
      "note";
    gap:12px;
    align-content:start;
    min-width:0;
  }
  .app-page .channels-page-shell>.channels-hero{grid-area:intro}
  .app-page .channels-page-shell>.channels-stats{grid-area:stats}
  .app-page .channels-page-shell>.channels-list-panel{grid-area:list}
  .app-page .channels-page-shell>.service-bots-panel{grid-area:bots}
  .app-page .channels-page-shell>.connection-flow{grid-area:flow}
  .app-page .channels-page-shell>.connection-path-note{grid-area:note}
  .app-page .channels-page-shell .service-bot-grid{
    grid-template-columns:repeat(auto-fit,minmax(min(100%,255px),1fr));
    gap:9px;
  }
  .app-page .channels-page-shell .channels-grid{
    grid-template-columns:1fr;
    gap:10px;
  }
  .app-page main.accounts-connections-shell{
    display:block;
    min-width:0;
  }
  .app-page .accounts-connections-shell .connection-platform-heading{
    margin-block-start:2px;
  }
  .app-page .accounts-connections-shell .connection-accounts-flow{
    display:flex;
    gap:8px;
    padding:0;
    margin:0 0 8px;
    overflow-x:auto;
    overscroll-behavior-inline:contain;
    scrollbar-width:thin;
  }
  .app-page .accounts-connections-shell .connection-accounts-flow>.connection-flow-step{
    flex:0 0 auto;
    min-height:44px;
    padding:8px 11px;
    gap:8px;
    border-radius:10px;
  }
  .app-page .accounts-connections-shell .connection-accounts-flow .connection-flow-step>div{
    display:block;
  }
  .app-page .accounts-connections-shell .connection-accounts-flow .connection-flow-step small{
    display:none;
  }
  .app-page .accounts-connections-shell .connection-accounts-flow .connection-flow-step strong{
    font-size:11px;
    white-space:nowrap;
  }
  .app-page .accounts-connections-shell .connection-accounts-flow .connection-flow-step>span{
    width:25px;height:25px;border-radius:8px;
  }
  .app-page .accounts-connections-shell .connection-path-note{
    margin-top:12px;
  }
}
@media(max-width:760px){
  .app-page .app-main>main.dashboard-shell{
    padding-bottom:calc(105px + env(safe-area-inset-bottom));
  }
  .app-page .channels-page-shell .channels-stats{
    gap:7px;
  }
  .app-page .channels-page-shell .channel-stat-card{
    min-height:76px;
    padding:10px 12px;
    gap:5px;
  }
  .app-page .channels-page-shell .channel-stat-icon{
    width:29px;height:29px;
  }
  .app-page .channels-page-shell .channel-stat-card strong{
    font-size:21px;
  }
  .app-page .channels-page-shell .channels-list-panel,
  .app-page .channels-page-shell .service-bots-panel{
    padding:15px;
    border-radius:15px;
  }
  .app-page .channels-page-shell .channels-list-heading{
    align-items:flex-start;
    gap:10px;
    margin-bottom:12px;
  }
  .app-page .channels-page-shell .channels-list-heading :is(h2,strong){
    font-size:16px;
  }
  .app-page .channels-page-shell .channels-list-actions{
    display:flex;flex-wrap:wrap;gap:8px;
    align-items:center;
    width:100%;
  }
  .app-page .channels-page-shell .channels-list-actions .channels-add-button{
    min-height:44px;
  }
  .app-page .channels-page-shell .service-bot-card{
    padding:13px 14px;
    gap:8px;
  }
  .app-page .channels-page-shell .service-bots-help{
    margin:0 0 12px;
  }
  .app-page .channels-page-shell .connection-flow{
    display:flex;
    gap:7px;
    overflow-x:auto;
    padding:2px 0;
    scrollbar-width:thin;
  }
  .app-page .channels-page-shell .connection-flow-step{
    flex:0 0 auto;
    width:200px;
    min-height:55px;
    padding:8px 10px;
    gap:8px;
  }
  .app-page .channels-page-shell .connection-flow-step>span{
    width:27px;height:27px;flex:none;
  }
  .app-page .channels-page-shell .connection-flow-step strong{
    font-size:12px;
  }
  .app-page .channels-page-shell .connection-flow-step small{
    font-size:11px;
  }
  .app-page .channels-page-shell .connection-path-note{
    padding:14px;
  }
  .app-page .accounts-connections-shell .connection-platform-heading{
    margin-top:11px;
  }
  .app-page .accounts-connections-shell .connection-platform-heading h2{
    font-size:17px;
  }
  .app-page .accounts-connections-shell .connection-platform-heading p{
    font-size:12px;
    line-height:1.9;
  }
  .app-page .accounts-connections-shell .connection-platform-hint{
    display:none;
  }
  .app-page .accounts-connections-shell .connected-platform-tabs{
    margin-block:10px;
    display:flex;
    flex-wrap:nowrap;
    overflow-x:auto;
    scroll-snap-type:x proximity;
    scrollbar-width:thin;
    padding-bottom:8px;
  }
  .app-page .accounts-connections-shell .connected-platform-tab{
    flex:0 0 112px;
    min-height:56px;
    scroll-snap-align:start;
    border-radius:12px;
  }
  .app-page .accounts-connections-shell .connected-account-panel,
  .app-page .accounts-connections-shell .telegram-account-panel,
  .app-page .accounts-connections-shell .connected-destinations-panel,
  .app-page .accounts-connections-shell .telegram-destinations-panel {
    padding:15px;
    border-radius:14px;
  }
  .app-page .accounts-connections-shell .connected-account-identity h2,
  .app-page .accounts-connections-shell .telegram-account-identity h2 {
    font-size:17px;
  }
  .app-page .accounts-connections-shell .connected-account-form,
  .app-page .accounts-connections-shell .telegram-login-form{
    max-width:100%;
    padding:13px;
  }
  .app-page .accounts-connections-shell .connected-platform-pane:not([hidden]){
    display:grid;
    gap:10px;
  }
  .app-page .accounts-connections-shell .connection-path-note{
    border-radius:13px;
    padding:13px 15px;
  }
  .app-page .accounts-connections-shell .connection-path-note p{
    font-size:12px;
    line-height:1.85;
  }
  .app-page .publish-shell .studio-flow-guide{
    display:flex;
    gap:6px;
    padding:6px;
    overflow-x:auto;
    max-width:100%;
    scrollbar-width:thin;
    flex-wrap:nowrap;
  }
  .app-page .publish-shell .studio-flow-item{
    display:inline-flex;
    flex:0 0 auto;
    min-height:40px;
    padding:7px 9px;
    gap:7px;
    white-space:nowrap;
    font-size:11px;
  }
  .app-page .publish-shell .studio-flow-item span{
    width:24px;height:24px;min-width:24px;
  }
  .app-page .publish-shell #publish-text{
    min-height:130px;
  }
  .app-page .publish-shell .composer-section{
    margin-top:14px;
    padding-top:16px;
  }
  .app-page .publish-shell .publish-completeness{
    margin-bottom:10px;
  }
  .app-page .publish-shell .publish-upload-zone{
    min-height:95px;
  }
  .app-page .publish-shell .composer-section-head p,
  .app-page .publish-shell .publish-upload-copy small,
  .app-page .publish-shell .selection-copy small{
    font-size:12px;
    line-height:1.85;
  }
  .app-page .transfer-shell .studio-transfer-steps{
    display:flex;
    flex-direction:row;
    flex-wrap:nowrap;
    gap:6px;
    padding:6px;
    max-width:100%;
    overflow-x:auto;
    scrollbar-width:thin;
    scroll-snap-type:x proximity;
  }
  .app-page .transfer-shell .studio-transfer-steps li{
    display:flex;
    flex:0 0 auto;
    flex-direction:row;
    min-height:42px;
    padding:7px 10px;
    font-size:11px;
    gap:6px;
    scroll-snap-align:start;
    white-space:nowrap;
  }
  .app-page .transfer-shell .studio-transfer-steps li:before{
    min-width:23px;height:23px;
  }
  .app-page .transfer-shell .transfer-resolver,
  .app-page .transfer-shell .transfer-preview-panel,
  .app-page .transfer-shell .transfer-config-panel,
  .app-page .transfer-shell .transfer-status-panel{
    padding:15px;
  }
  .app-page .transfer-shell .transfer-url-row .button,
  .app-page .publish-shell #publish-submit,
  .app-page .downloads-library-shell .downloads-create-button,
  .app-page .downloads-library-shell .downloads-library-new {
    min-height:44px;
  }
  .app-page .downloads-library-shell .downloads-summary-grid{
    gap:6px;
  }
  .app-page .downloads-library-shell .downloads-summary-card{
    display:grid;
    align-content:center;
    justify-items:start;
    min-height:79px;
    padding:10px;
    gap:5px;
  }
  .app-page .downloads-library-shell .downloads-summary-card dt{
    font-size:11px;
    line-height:1.7;
    max-width:100%;
  }
  .app-page .downloads-library-shell .downloads-summary-card dd{
    font-size:21px;
    line-height:1.1;
    margin:0;
  }
  .app-page .downloads-library-shell .downloads-summary-marker{
    width:7px;height:7px;top:11px;inset-inline-end:9px;
  }
  .app-page .downloads-library-shell .history-filters button{
    font-size:12px;
    min-height:42px;
  }
  .app-page .downloads-library-shell .download-row-actions .button,
  .app-page .publish-shell .publish-history-actions .button{
    min-height:44px;
    font-size:12px;
  }
  .app-page .automation-shell .auto-sticky{
    bottom:calc(77px + env(safe-area-inset-bottom));
  }
  .app-page .billing-shell .billing-table th,
  .app-page .billing-shell .billing-table td{
    font-size:12px;
    line-height:1.8;
    padding:12px;
  }
  .app-page .team-shell .team-member-actions .button{
    min-height:44px;
  }
}
@media(max-width:380px){
  .app-page .channels-page-shell .channels-stats{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
  .app-page .channels-page-shell .channel-stat-card{
    padding:8px;
  }
  .app-page .channels-page-shell .channel-stat-card span{
    font-size:11px;
  }
}
