/* Phone layout (≤760px): bottom tab bar, sticky header, tables as cards, dialogs as bottom sheets,
   bigger tap targets, compact live feed. Nothing here applies on wider screens. */
.mobile-tabbar{display:none}
@media(max-width:760px){
  :root{--tabbar:62px}
  /* Bottom tab bar */
  .mobile-tabbar{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:4px;position:fixed;left:0;right:0;bottom:0;z-index:40;height:calc(var(--tabbar) + env(safe-area-inset-bottom));padding:6px 8px env(safe-area-inset-bottom);background:color-mix(in srgb,var(--bg) 88%,transparent);-webkit-backdrop-filter:saturate(1.4) blur(14px);backdrop-filter:saturate(1.4) blur(14px);border-top:1px solid var(--line)}
  .mobile-tab{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:48px;border:0;border-radius:12px;background:none;color:var(--muted);font:inherit;font-size:10px;line-height:1.2;text-decoration:none;cursor:pointer;-webkit-tap-highlight-color:transparent}
  .mobile-tab svg{width:20px;height:20px;padding:3px 14px;box-sizing:content-box;border-radius:999px;fill:none;stroke:currentColor;stroke-width:1.7;transition:background-color .2s,color .2s}
  .mobile-tab.active{color:var(--text);font-weight:500}
  .mobile-tab.active svg{background:var(--tint-green);color:var(--tint-green-text)}
  .mobile-tab:active svg{background:var(--hover)}
  .main-wrap{padding-bottom:calc(var(--tabbar) + env(safe-area-inset-bottom))}
  #toast{bottom:calc(var(--tabbar) + 14px + env(safe-area-inset-bottom))}
  .notification-stack{bottom:calc(var(--tabbar) + 10px + env(safe-area-inset-bottom))}
  .notification-center{left:8px;right:8px;top:62px;width:auto;max-width:none;max-height:calc(100dvh - 62px - var(--tabbar) - 16px)}

  /* Sticky header and roomier drawer */
  .topbar{position:sticky;top:0;z-index:20;height:56px;padding:0 10px 0 6px;background:color-mix(in srgb,var(--bg) 86%,transparent);-webkit-backdrop-filter:saturate(1.4) blur(14px);backdrop-filter:saturate(1.4) blur(14px)}
  .sidebar{width:280px;box-shadow:0 0 40px rgba(0,0,0,.18)}
  .nav-item{min-height:44px}
  .icon-button{min-width:40px;min-height:40px}
  .main-wrap main{padding:18px 16px 24px}

  /* Inputs at 16px: smaller text makes iOS zoom the page on focus */
  input,select,textarea{font-size:16px!important}

  /* Page actions: two per row, the primary one full width */
  .heading-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  /* A lone button, or the primary one closing an odd row, takes the full width; two buttons share a row */
  .heading-actions>:only-child,.heading-actions>.button.primary:nth-child(odd):last-child{grid-column:1/-1}
  .heading-actions .button{min-height:44px;padding:10px}

  /* Filter and tab rows scroll sideways instead of wrapping into three lines */
  .account-toolbar .filters,.admin-tabs{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;margin-left:-8px;margin-right:-8px;padding:2px 8px 4px}
  .account-toolbar .filters::-webkit-scrollbar,.admin-tabs::-webkit-scrollbar{display:none}
  .filter,.admin-tabs button{flex-shrink:0;min-height:38px}
  .segmented button{min-height:32px;padding:6px 10px}

  /* Tables become cards: title cell on top, then "label — value" rows */
  .table-scroll{background:transparent}
  .table-scroll table:not(.admin-log-table),.table-scroll table:not(.admin-log-table) tbody,.table-scroll table:not(.admin-log-table) tfoot{display:block;min-width:0!important;white-space:normal}
  .table-scroll table:not(.admin-log-table) thead{display:none}
  .table-scroll table:not(.admin-log-table) tr{display:grid;gap:7px;padding:14px 16px;border-bottom:1px solid var(--line)}
  .table-scroll table:not(.admin-log-table) :is(td,th){display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:4px 8px;min-width:0;padding:0!important;border:0!important;text-align:right;position:static!important;background:none!important;font-size:13px}
  .table-scroll table:not(.admin-log-table) :is(td,th)::before{content:attr(data-label);flex-shrink:0;margin-right:auto;color:var(--muted);font-size:11px;font-weight:400;text-align:left}
  .table-scroll table:not(.admin-log-table) :is(td,th):first-child{justify-content:flex-start;text-align:left;margin-bottom:2px;font-weight:500}
  .table-scroll table:not(.admin-log-table) :is(td,th):first-child::before,.table-scroll table:not(.admin-log-table) :is(td,th)[data-label=""]::before{content:none}
  .table-scroll table:not(.admin-log-table) td[data-label=""]{justify-content:flex-end}
  .table-scroll table:not(.admin-log-table) td.empty{justify-content:center;text-align:center}
  .table-scroll table:not(.admin-log-table) tfoot tr{margin:10px 12px 12px;border:0;border-radius:12px;background:var(--hover)}
  .table-scroll table:not(.admin-log-table) .account-row td:last-child{display:none}
  .account-row:active{background:var(--hover)}
  .balance-scroll{max-height:none}
  .balance-sort-mobile{display:flex;align-items:center;gap:8px;width:100%;font-size:12px;color:var(--muted)}
  .balance-sort-mobile select{flex:1;min-height:40px;border:1px solid var(--line);border-radius:10px;background:var(--raised);color:var(--text);padding:0 10px}

  /* Dialogs slide up as bottom sheets; drag the top strip down to close */
  dialog:not(.farm-session-modal){margin:auto 0 0;width:100%;max-width:100%;max-height:90dvh;border-radius:22px 22px 0 0;border-width:1px 0 0;padding-bottom:env(safe-area-inset-bottom);overscroll-behavior:contain}
  dialog[open]:not(.farm-session-modal){animation:m-sheet .3s cubic-bezier(.2,.8,.2,1)}
  dialog:not(.farm-session-modal) .modal{padding:10px 20px 22px}
  dialog:not(.farm-session-modal) .modal::before{content:'';display:block;width:40px;height:4px;border-radius:2px;background:var(--line);margin:0 auto 14px}
  .modal-actions{flex-direction:column-reverse;align-items:stretch}
  .modal-actions .button{width:100%;min-height:46px}
  .m-pop{animation:none}

  /* Compact live feed: one header row, smaller cards */
  .live-feed{padding:8px 16px 10px;gap:8px}
  .live-head{gap:4px 8px;padding-right:32px}
  .live-stats,.live-privacy-button span{display:none}
  .live-card{flex-basis:96px;max-width:96px;height:86px;padding:6px 8px 9px}
  .live-art{height:32px}
  .live-art .item-icon{height:34px}
  @keyframes live-in{from{flex-basis:0;max-width:0;opacity:0}to{flex-basis:96px;max-width:96px;opacity:1}}

  /* «Баланс и вывод»: section chips stick under the header */
  .wallet-subnav{position:sticky;top:56px;z-index:15;width:auto;max-width:none;margin:0 -16px 16px;padding:8px 16px;border-radius:0;background:color-mix(in srgb,var(--bg) 90%,transparent);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);box-shadow:0 1px 0 var(--line)}
  .wallet-subnav button{min-height:34px;background:var(--panel)}
  .wallet-section{scroll-margin-top:118px}
  .wallet-totals{flex-direction:column;align-items:flex-start;gap:4px}
  .setting-row select{max-width:150px}
  /* Overview: accounts as a compact list, drop cards as a swipeable row, tighter cycle ring */
  .overview-accounts .table-toolbar,.overview-accounts .table-bottom{display:none}
  .overview-accounts .table-scroll table:not(.admin-log-table) tr{grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:4px 12px;padding:12px 14px}
  .overview-accounts .table-scroll table:not(.admin-log-table) td:first-child{grid-row:span 2;margin:0}
  .overview-accounts .table-scroll table:not(.admin-log-table) td:nth-child(n+2)::before{content:none}
  .overview-accounts .table-scroll table:not(.admin-log-table) td:nth-child(4){display:none}
  .overview-accounts .table-scroll table:not(.admin-log-table) td:nth-child(3) .muted:not(:only-child){display:none}
  .overview-accounts .panel{overflow:hidden}
  .drops-strip{margin-top:22px}
  .drop-cards{display:flex;gap:10px;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;margin:0 -16px;padding:0 16px 4px}
  .drop-cards::-webkit-scrollbar{display:none}
  .drop-card{flex:0 0 78%;scroll-snap-align:start}
  .ring-row{gap:20px;padding:18px}
  .ring{width:104px;height:104px}
  .week-strip .week-right{flex-basis:100%;color:var(--muted)}
  /* Scheme picker: two compact options side by side, so the numbers are reachable without scrolling */
  .payout-scheme{padding:12px;gap:10px;margin-bottom:14px}
  .payout-scheme>div:first-child p{display:none}
  .payout-scheme h2{font-size:13px}
  .payout-options{display:grid;grid-template-columns:1fr 1fr;gap:8px;width:100%}
  .payout-option{min-width:0;padding:10px 12px;gap:8px}
  .payout-option small{display:none}
  .payout-option strong{font-size:13px}
}
@keyframes m-sheet{from{transform:translateY(100%)}to{transform:none}}
@media(max-width:760px) and (prefers-reduced-motion:reduce){dialog[open]:not(.farm-session-modal){animation:none}}
