/* Only the mobile controls are hidden globally. All layout overrides are bounded. */
.mobile-control,.mobile-bottom-nav,.mobile-map-open { display:none; }
@media (max-width:900px) {
  .s-columns > * { min-width:0; }
  .s-columns { grid-template-columns:minmax(0,1fr); }
}
@media (max-width:760px) {
  html { scroll-padding-bottom:90px; }
  body:has(dialog[open]) { overflow:hidden; }
  .mobile-control { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:10px 14px; border:1px solid var(--border); border-radius:10px; background:var(--card); color:var(--foreground); font:600 14px var(--font-sans, sans-serif); cursor:pointer; }
  :is(.mobile-client,.agency2,.support-app,dialog) :is(input,select,textarea) { font-size:16px; max-width:100%; }
  :is(.mobile-client,.agency2,.support-app,dialog) :is(button,.btn,.s-btn,.tabs-nav a,.s-tabs a,.a2-tabs a) { min-height:44px; }
  :is(.mobile-client,.agency2,.support-app,dialog) .icon-btn { min-width:44px; }
  :is(.mobile-client,.agency2,.support-app) :is(.main,.page,.s-main,.a2-page,.s-page) { min-width:0; }
  :is(.mobile-client,.agency2,.support-app) :is(p,.cell-sub,.s-muted,.s-list,.a2-hint) { font-size:14px; line-height:1.55; }
  :is(.s-tabs,.a2-tabs,.tabs-nav) { max-width:100%; overflow-x:auto; flex-wrap:nowrap; scrollbar-width:thin; }
  :is(.s-tabs,.a2-tabs,.tabs-nav) > * { flex-shrink:0; }

  /* Client navigation: one header and five stable destinations. */
  [data-premium] .mobile-client .app-simple { display:flex; flex-direction:column; }
  [data-premium] .mobile-client .app-simple > .sidebar { display:none; }
  [data-premium] .mobile-client .topbar { min-height:60px; height:60px; padding:8px 16px; flex-wrap:nowrap; }
  [data-premium] .mobile-client .topbar h1 { font-size:19px; }
  [data-premium] .mobile-client .page { padding:18px 16px calc(88px + env(safe-area-inset-bottom)); }
  .mobile-bottom-nav { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); position:fixed; z-index:45; bottom:0; left:0; right:0; padding:6px 4px calc(6px + env(safe-area-inset-bottom)); background:var(--card); border-top:1px solid var(--border); box-shadow:0 -6px 24px #0000000d; }
  .mobile-bottom-nav > :is(a,button) { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; padding:5px 0; min-height:52px; border:0; border-radius:9px; color:var(--muted-foreground); background:transparent; font-size:10px; text-decoration:none; font-weight:500; }
  .mobile-bottom-nav svg { width:21px; height:21px; }
  .mobile-bottom-nav button > span:first-child { height:21px; font-size:20px; line-height:16px; }
  .mobile-bottom-nav [aria-current="page"] { color:var(--primary); background:var(--primary-soft); font-weight:700; }
  .mobile-drawer { position:fixed; margin:0 0 0 auto; inset:0; height:100dvh; max-height:100dvh; width:min(340px,90vw); max-width:none; border:0; border-left:1px solid var(--border); border-radius:0; background:var(--card); color:var(--foreground); padding:0; }
  .mobile-drawer[open] { display:flex; flex-direction:column; }
  .mobile-drawer::backdrop { background:#0009; backdrop-filter:blur(3px); }
  .mobile-drawer > header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px; border-bottom:1px solid var(--border); }
  .mobile-drawer-links { display:grid; gap:4px; overflow:auto; padding:12px; }
  .mobile-drawer-links a { display:flex; gap:12px; align-items:center; min-height:48px; padding:12px; font-size:14px; color:var(--foreground); border-radius:8px; }
  .mobile-drawer-links .active { background:var(--primary-soft); color:var(--primary); }
  .mobile-drawer-links svg { width:20px; height:20px; }
  .mobile-drawer > footer { margin-top:auto; padding:12px 16px calc(20px + env(safe-area-inset-bottom)); border-top:1px solid var(--border); }
  .mobile-drawer :is(.client-sidebar-foot,.a2-sidebar-bottom,.s-side-bottom) { display:flex; flex-direction:column; gap:8px; padding:0; margin:0; }
  .mobile-drawer :is(.client-space-link,.a2-original,.s-side-bottom .s-nav a) { font-size:12px; min-height:44px; padding:10px 0; }
  .mobile-drawer .client-sidebar-foot .user-chip { display:flex; width:100%; padding:12px 0; }
  .mobile-drawer .client-sidebar-foot .user-chip > div { display:block; }
  .mobile-sample { color:var(--muted-foreground); font-size:11px; margin:12px 0 0; }

  /* Drawers overlay the page; scope selectors stay immediately accessible. */
  [data-premium] .agency2 { display:block; }
  [data-premium] .agency2 > .sidebar,.support-app > .s-sidebar { position:relative!important; inset:auto; margin:0; height:64px; min-height:64px; max-height:64px; padding:0 16px; display:flex; flex-direction:row; align-items:center; border:0; border-bottom:1px solid var(--border); border-radius:0; }
  [data-premium] .agency2 > .sidebar .brand,.s-sidebar .s-brand { padding:0; font-size:14px; }
  [data-premium] .agency2 > .sidebar > :is(.nav,.a2-sidebar-bottom),.s-sidebar > :is(.s-nav,.s-side-bottom) { display:none; }
  [data-premium] .agency2 .a2-mobile-menu,.s-sidebar .s-mobile { display:block; position:static; margin-left:auto; padding:8px 12px; font-size:14px; }
  .support-app { display:block; }
  .a2-topbar,.s-top { padding:8px 16px; min-height:60px; gap:8px; }
  .a2-topbar label,.s-top label { flex:1; min-width:0; font-size:11px; }
  .a2-topbar #a2-client { width:100%; max-width:220px; }
  .a2-topbar > .spacer { display:none; }
  .a2-topbar [data-action="assistant"] { font-size:0; min-width:44px; width:44px; padding:10px; gap:0; }
  .a2-topbar [data-action="assistant"] svg { width:18px; height:18px; }
  .a2-topbar .a2-snapshot,.s-top .s-environment { display:none; }
  .s-top { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px; }
  .s-top label { display:flex; flex-direction:column; align-items:stretch; gap:4px; }
  .s-top select { width:100%; min-width:0; padding-inline:6px; }
  .s-top .icon-btn { align-self:end; }
  [data-premium] .agency2 .a2-page,.s-page { padding:18px 16px 32px; }
  .a2-heading,.s-heading { margin-bottom:18px; gap:12px; flex-wrap:wrap; }
  .a2-heading h1,.s-heading h1 { font-size:26px; }
  .a2-heading p,.s-heading p { font-size:14px; }
  .a2-heading .a2-eyebrow,.s-eyebrow { display:none; }
  .a2-metric,.s-stat { padding:14px; }
  .a2-panel,.s-panel { padding:16px; }
  .a2-panel h2,.s-panel h2 { font-size:17px; }
  .s-row,.a2-work-row { flex-wrap:wrap; gap:10px; font-size:14px; }
  .s-row > div,.a2-work-row > div { min-width:0; overflow-wrap:anywhere; }
  .s-badge,.a2-status { font-size:12px; white-space:normal; }
  .s-controls { align-items:stretch; }
  .s-controls > :is(input,label) { width:100%; }
  .s-controls label select { flex:1; min-width:0; }

  /* Stacked records retain every column and their original actions. */
  table.mobile-cards,table.mobile-cards tbody { display:block; width:100%; min-width:0; }
  table.mobile-cards thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  table.mobile-cards tr { display:block; border:1px solid var(--border); border-radius:10px; margin:0 0 12px; padding:10px 12px; background:var(--card); }
  table.mobile-cards td { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:6px 12px; min-width:0; padding:8px 0; border:0; font-size:14px; white-space:normal; overflow-wrap:anywhere; }
  table.mobile-cards td::before { content:attr(data-label); flex:0 0 100%; font-size:11px; color:var(--muted-foreground); font-weight:500; }
  table.mobile-cards td:first-child { font-weight:600; }
  table.mobile-cards td > * { max-width:100%; }
  .s-table-wrap { overflow:visible; }
  .appr-foot { display:flex; flex-wrap:wrap; gap:8px; }
  .appr-foot .spacer { display:none; }
  .appr-foot > a { flex-basis:100%; }
  .appr-top { flex-wrap:wrap; }
  .appr-detail .field-row { flex-wrap:wrap; gap:8px; }
  .appr-detail .field-row > * { min-width:0; max-width:100%; }
  .mobile-client .field-row { flex-wrap:wrap; gap:8px; }
  .mobile-client .field-row .v { min-width:0; overflow-wrap:anywhere; }
  .mobile-client .seg { max-width:100%; flex-wrap:wrap; }

  /* Advertising: compact totals, progressively disclosed notes and filters. */
  .ads-heading-publicidad h2 { display:none; }
  .ads-heading-publicidad .ads-heading-meta { display:none; }
  .ads-heading-publicidad { margin:12px 0; }
  .ads-title-row { gap:0; }
  .ads-levels { width:100%; gap:0; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); }
  .ads-levels a { min-width:0; padding:12px 3px; font-size:12px; text-align:center; }
  .ads-navigation { margin-bottom:10px; }
  .ads-page .tabs-nav a { padding:12px 10px; font-size:13px; }
  .ads-navigation .tabs-nav { gap:0; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); }
  .ads-navigation .tabs-nav a { padding-inline:4px; text-align:center; }
  .ads-metrics.mobile-results { grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-bottom:12px; }
  .ads-metric { padding:12px 8px; min-width:0; }
  .ads-metric:last-child { grid-column:auto; display:flex; align-items:stretch; }
  .ads-metric > span { font-size:11px; min-height:32px; }
  .ads-metric strong { font-size:22px; margin:8px 0 0; }
  .ads-metric strong span { font-size:14px; }
  .mobile-results:not(.mobile-expanded) .ads-metric small { display:none; }
  .ads-metric small { font-size:12px; overflow-wrap:anywhere; }
  #ads-content > .mobile-control { margin:4px 0 10px; min-height:44px; }
  .mobile-filters:not(.mobile-expanded) { display:none; }
  .ads-filters.mobile-expanded { display:flex; flex-wrap:wrap; padding:12px; background:var(--card); border:1px solid var(--border); border-radius:10px; }
  .ads-filters label { flex:1 1 120px; min-width:0; }
  .ads-filters :is(input,select) { width:100%; }
  .ads-attention { padding:12px; gap:8px; margin:0 0 8px; font-size:13px; }
  .ads-attention > span { flex:1 1 calc(100% - 32px); }
  .ads-attention > button { flex:1; }
  .ads-attention button { margin-left:0; }
  .ads-list-label { margin-top:0; }
  .ads-event,.a2-event { display:grid; grid-template-columns:64px minmax(0,1fr); gap:8px 12px; align-items:start; text-align:left; }
  .a2-event > .a2-status,.ads-event > .ads-status { grid-column:2; justify-self:start; margin-left:0; }
  .a2-event-date { min-width:0; }
  .a2-event > span:nth-child(2),.ads-event-description { min-width:0; }
  .a2-event strong { font-size:15px; line-height:1.45; }
  .a2-event small { font-size:12px; line-height:1.45; }

  /* Message composer stays in the viewport; the history owns its scrolling. */
  [data-premium] .mobile-client .messages-app { height:calc(100dvh - 65px - env(safe-area-inset-bottom)); }
  [data-premium] .mobile-client .messages-page { padding:0; }
  .messages-thread-head { padding:8px 12px; }
  .messages-thread-head > .avatar { width:32px; height:32px; }
  .messages-assistant { font-size:12px; padding:6px 12px; }
  .conversation-name { font-size:15px; }
  .conversation-channels { font-size:12px; }
  [data-premium] .agency2.a2-inbox-page { display:flex; flex-direction:column; height:100dvh; overflow:hidden; }
  .agency2.a2-inbox-page > .sidebar { flex:none; }
  .agency2.a2-inbox-page > .main { display:flex; flex-direction:column; flex:1; min-height:0; overflow:hidden; }
  .a2-inbox-page .a2-topbar { flex:none; }
  [data-premium] .a2-inbox-page .a2-page { flex:1; height:auto; min-height:0; padding:0 0 env(safe-area-inset-bottom); }
  .a2-inbox-page:has(.is-thread-open) .a2-message-heading { display:none; }
  [data-premium] .agency2.a2-inbox-page:has(.messages-composer textarea:focus) > .sidebar { display:none; }
  .messages-workspace:has(.messages-composer textarea:focus) .messages-assistant { display:none; }

  /* Technical forms and relationship lists. */
  .s-dialog[open] { display:flex; flex-direction:column; overflow:hidden; width:calc(100vw - 16px); max-height:calc(100dvh - 16px); margin:auto; }
  .s-dialog-head { flex:none; padding:12px 16px; }
  .s-dialog-body { min-height:0; overflow-y:auto; padding:16px; scroll-padding-bottom:90px; }
  .s-dialog .s-form > .s-actions { position:sticky; bottom:-16px; z-index:2; margin:16px -16px -16px; padding:12px 16px calc(12px + env(safe-area-inset-bottom)); border-top:1px solid var(--border); background:var(--card); justify-content:space-between; }
  .s-dialog .s-form > .s-actions > button { flex:1; }
  .mobile-profile-section { border:1px solid var(--border); border-radius:10px; padding:12px; }
  .mobile-profile-section summary { min-height:44px; display:list-item; align-content:center; font-size:14px; font-weight:600; cursor:pointer; }
  .mobile-profile-section fieldset { margin:0; padding:0; border:0; min-width:0; }
  .mobile-profile-section :is(legend,h3) { display:none; }
  .s-check-grid { grid-template-columns:minmax(0,1fr); }
  .s-check-grid label { min-height:44px; font-size:14px; }
  .s-flow-edit { grid-template-columns:minmax(0,1fr); padding:12px 0; }
  .s-org-layout { display:flex; flex-direction:column; }
  .s-org-layout > .s-org-scroll { display:none; }
  .s-org-layout > .s-org-detail { width:100%; }
  .s-org-toolbar { flex-wrap:wrap; }
  .s-org-toolbar > label { width:100%; }
  .s-org-toolbar select { width:100%; }
  .s-org-toolbar .s-org-legend { display:none; }
  .mobile-map-open { display:inline-flex; margin-bottom:12px; }
  .mobile-map-dialog { background:var(--card); color:var(--foreground); width:calc(100vw - 16px); max-width:none; max-height:calc(100dvh - 16px); padding:0; border:1px solid var(--border); border-radius:12px; }
  .mobile-map-dialog[open] { display:flex; flex-direction:column; }
  .mobile-map-dialog > header { display:flex; align-items:center; justify-content:space-between; padding:12px; gap:12px; }
  .mobile-map-dialog .s-org-scroll { display:block; min-height:0; overflow:auto; }
  .s-org-flow { min-height:44px; }
  .s-org-flow small,.s-org-detail p { font-size:14px; }

  /* Entry portal: three concise, distinct workspace choices. */
  .entry-shell { padding:0 16px; }
  .entry-header { padding:12px 0; }
  .entry-intro { padding:20px 0; text-align:left; }
  .entry-eyebrow { display:none; }
  .workspace-portal .entry-title { font-size:30px; line-height:1.1; }
  .entry-description { margin:10px 0 0; font-size:14px; line-height:1.45; }
  .entry-grid { gap:12px; }
  .entry-card { position:relative; padding:14px 16px; }
  .entry-card h2 { margin:8px 0 6px; font-size:24px; }
  .entry-card-description { margin:0; padding-right:32px; font-size:14px; line-height:1.4; }
  .entry-preview,.entry-features { display:none; }
  .entry-card-footer { border:0; padding:8px 0 0; margin:0; min-height:32px; font-size:12px; }
  .entry-card-footer .entry-arrow { position:absolute; right:16px; top:55px; }
  .entry-role { font-size:10px; }
  .entry-card-icon { width:24px; height:24px; }
  .entry-connection { padding:16px 0; font-size:12px; }
  .entry-footer { font-size:12px; }
}
