/* Mobile app shell (owner 22.10.2026) — phones only (≤ 760 px). Desktop is not affected. See mobile.js. */
#mtabs, #mptr, .mreq, .mgrip, .mtitle { display: none; }
.notelist > * { flex-shrink: 0; }   /* many notifications: items keep their height and the list scrolls (was squeezed) */
@media (max-width: 760px) {
  :root { --tabh: 62px; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); }
  html, body { overscroll-behavior-y: contain; -webkit-tap-highlight-color: transparent; }
  html { scroll-padding-top: 70px; }
  body { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
  input, select, textarea { font-size: 16px !important; }          /* no iOS zoom on focus */
  button, .navitem, a.fv-btn, summary { min-height: 44px; }
  button.sm, .chiptab, .tab, .idchip, .section-tab { min-height: 36px; }

  /* ── shell ── */
  .sidebar { display: none !important; }
  .shell { margin: 0 !important; padding: 0 0 calc(var(--tabh) + var(--sab) + 18px) !important; }
  .topbar { position: sticky; top: 0; z-index: 40; margin: 0 !important; border-radius: 0 0 18px 18px !important; min-height: 0 !important;
    padding: calc(var(--sat) + 8px) 12px 8px !important; gap: 6px !important; flex-wrap: nowrap !important; align-items: center;
    border-left: 0 !important; border-right: 0 !important; border-top: 0 !important; }
  .topbar .mtitle { display: block; flex: 1; min-width: 0; font-family: var(--display); font-size: 17px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .topstats, .topbar .mobile-profile, .topbar .rolechip { display: none !important; }
  .topbar .cmdk { order: 2; width: 44px; min-width: 44px; height: 44px; padding: 0; justify-content: center; flex: none; border-radius: 14px; }
  .topbar .cmdk span, .topbar .cmdk kbd { display: none; }
  .topbar .bell { order: 3; width: 44px; height: 44px; flex: none; }
  .topbar .tradeswitch { order: 4; margin-left: 0 !important; flex: none; }
  .banner { margin: 8px 12px 0; border-radius: 12px; }
  .content { padding: 14px 14px 24px !important; }

  #mtabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    height: calc(var(--tabh) + var(--sab)); padding: 6px 6px calc(var(--sab) + 4px);
    background: color-mix(in oklab, var(--bg) 82%, transparent); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-top: 1px solid var(--line-2); }
  #mtabs button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 0; padding: 4px 2px;
    background: none; border: 0; box-shadow: none; color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: .01em; border-radius: 14px; }
  #mtabs button svg { width: 23px; height: 23px; stroke-width: 1.8; }
  #mtabs button.on { color: var(--accent); }
  #mtabs button.on::before { content: ''; position: absolute; top: 2px; width: 34px; height: 3px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
  #mtabs button:active { transform: scale(.94); }
  .mbadge { position: absolute; top: 2px; right: calc(50% - 22px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--bad, #ff5d6c); color: #fff; font: 700 10px/17px var(--body, sans-serif); font-style: normal; text-align: center; }

  /* ── page head, KPI strip ── */
  .pagehead { gap: 10px !important; margin-bottom: 14px !important; }
  .pagehead .eyebrow, .pagehead > div > p, .pagehead .lede { display: none; }
  .pagehead h1, .pagehead .split { display: none !important; }   /* the title is in the top bar */
  .pagehead:not(:has(.head-actions > *)) { display: none !important; }
  .content h1.split + p, .pagehead p.muted { display: none; }
  .head-actions { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px 2px; width: calc(100% + 28px) !important; }
  .head-actions::-webkit-scrollbar { display: none; }
  .head-actions > * { flex: none; }
  .content > .cards, .content .cards { display: flex !important; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: 14px; gap: 10px !important; margin: 0 -14px 14px !important; padding: 2px 14px 4px !important; scrollbar-width: none; }
  .content .cards::-webkit-scrollbar { display: none; }
  .content .cards > .card { flex: 0 0 min(64%, 230px); scroll-snap-align: start; padding: 14px !important; }
  .card .metric { font-size: 22px !important; }
  .panel { border-radius: 18px !important; }
  .panelhead { padding: 14px 16px !important; }
  .pad { padding: 14px 16px !important; }

  /* ── filters folded ── */
  details.mfold { margin: 0 0 12px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--glass); }
  details.mfold > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 0 14px; font-weight: 600; cursor: pointer; position: relative; }
  details.mfold > summary::-webkit-details-marker { display: none; }
  details.mfold > summary svg { width: 18px; height: 18px; color: var(--accent); }
  details.mfold > summary::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; }
  details.mfold[open] > summary::after { transform: rotate(-135deg); }
  details.mfold > summary .mbadge { position: static; margin-left: 4px; background: var(--accent); color: var(--on-accent); }
  details.mfold > form { padding: 0 14px 14px; }

  /* ── tables as cards ── */
  .tablewrap { overflow: visible !important; margin: 0 !important; border: 0 !important; }
  table.mcards, table.mcards tbody { display: block; width: 100%; }
  table.mcards thead { display: none; }
  table.mcards tbody tr { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 6px; align-items: center;
    margin: 0 0 10px; padding: 14px; border: 1px solid var(--line-2); border-radius: 16px; background: var(--glass-2); }
  table.mcards tbody tr.mc-tap:active { transform: scale(.985); background: var(--glass-strong); }
  table.mcards tbody tr.fresh { box-shadow: 0 0 0 1px var(--accent), 0 0 22px color-mix(in oklab, var(--accent) 30%, transparent); }
  table.mcards td { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 !important; border: 0 !important; min-width: 0; grid-column: 1 / -1; order: 5; font-size: 14px; text-align: right; }
  table.mcards td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 12px; text-align: left; }
  table.mcards td > small, table.mcards td small { display: block; }
  table.mcards td.mc-blank, table.mcards td:empty { display: none; }
  table.mcards td.mc-head { grid-column: 1; order: 1; justify-content: flex-start; text-align: left; flex-wrap: wrap; row-gap: 2px; }
  table.mcards td.mc-head::before, table.mcards td.mc-amt::before, table.mcards td.mc-status::before, table.mcards td.mc-timer::before, table.mcards td.mc-act::before, table.mcards td.mc-check::before { display: none; }
  table.mcards td.mc-head small { width: 100%; }
  table.mcards td.mc-timer { grid-column: 2; order: 2; justify-content: flex-end; }
  table.mcards td.mc-check { position: absolute; top: 10px; right: 10px; width: auto; z-index: 1; }
  table.mcards td.mc-check input { width: 24px !important; height: 24px !important; }
  tr:has(> td.mc-check) > td.mc-timer { margin-right: 34px; }
  table.mcards td.mc-amt { grid-column: 1; order: 3; flex-direction: column; align-items: flex-start; gap: 0; text-align: left; }
  table.mcards td.mc-amt strong, table.mcards td.mc-amt .amt, table.mcards td.mc-amt b { font-size: 21px; font-family: var(--display); letter-spacing: -.01em; }
  table.mcards td.mc-status { grid-column: 2; order: 4; justify-content: flex-end; }
  table.mcards td.mc-dir { display: none; }
  table.mcards td.mc-act { order: 9; justify-content: stretch; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
  table.mcards td.mc-act > * { flex: 1 1 auto; min-height: 44px; justify-content: center; }
  table.mcards tr.mc-empty { display: block; padding: 0; border: 0; background: none; }
  table.mcards tr.mc-empty td { display: block; text-align: center; }
  table.mcards tr.mc-empty td::before { display: none; }

  /* ── dialogs → bottom sheets; the order → full screen ── */
  dialog#modal { position: fixed; inset: auto 0 0 0; margin: 0; width: 100% !important; max-width: 100% !important; max-height: calc(100dvh - var(--sat) - 10px) !important;
    border-radius: 24px 24px 0 0 !important; border-bottom: 0 !important; padding: 0 !important; padding-bottom: var(--sab) !important; transition: transform .22s cubic-bezier(.2, .8, .2, 1); animation: msheet-up .26s cubic-bezier(.2, .8, .2, 1); }
  dialog#modal.mfull { inset: 0; height: 100dvh; max-height: 100dvh !important; border-radius: 0 !important; padding-top: var(--sat) !important; }
  dialog#modal::backdrop { background: rgba(0, 0, 0, .5); backdrop-filter: blur(4px); }
  @keyframes msheet-up { from { transform: translateY(40%); opacity: .4; } to { transform: none; opacity: 1; } }
  #modal .mgrip { display: block; flex: none; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: var(--line-2); }
  #modal.mfull .mgrip { margin-top: 6px; }
  #modal .dialoghead { padding: 10px 18px 12px !important; }
  #modal .dialoghead h2 { font-size: 19px !important; }
  #modal .dialogbody { padding: 14px 18px !important; -webkit-overflow-scrolling: touch; }
  #modal .formactions, #modal .dialog-actions { padding: 12px 18px !important; }
  #modal-content > .formactions, #modal-content > .dialog-actions { position: sticky; bottom: 0; }
  #modal .dialogbody .formactions { position: static !important; padding: 12px 0 0 !important; background: none !important; border-top: 0 !important; }
  #modal .tradehead { gap: 12px; }
  #modal .tradehead .tring { width: 92px; height: 92px; }
  #modal .bigamount { font-size: 36px !important; }
  #modal .tgrid { grid-template-columns: 1fr !important; }
  .mreq { display: flex; flex-direction: column; gap: 4px; margin: 14px 0 6px; padding: 16px; border-radius: 18px;
    background: linear-gradient(135deg, color-mix(in oklab, var(--accent) 22%, transparent), color-mix(in oklab, var(--accent-2) 8%, transparent)); border: 1px solid color-mix(in oklab, var(--accent) 40%, transparent); }
  .mreq small { color: var(--text-2); font-size: 12px; }
  .mreq b { font-size: 22px; letter-spacing: .04em; word-break: break-all; }
  .mreq > span { color: var(--text-2); font-size: 14px; }
  .mreq-actions { display: flex; gap: 8px; margin-top: 8px; }
  .mreq-actions button { flex: 1; justify-content: center; }

  /* own sheets (Ще, Створити) */
  dialog.msheet { position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%; max-height: 86dvh; padding: 0 0 var(--sab); border: 1px solid var(--line-2); border-bottom: 0;
    border-radius: 24px 24px 0 0; background: var(--glass-strong); color: var(--text); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); display: flex; flex-direction: column;
    transition: transform .22s cubic-bezier(.2, .8, .2, 1); animation: msheet-up .26s cubic-bezier(.2, .8, .2, 1); }
  dialog.msheet::backdrop { background: rgba(0, 0, 0, .5); backdrop-filter: blur(4px); }
  .msheet-grip { width: 40px; height: 5px; margin: 8px auto 2px; border-radius: 3px; background: var(--line-2); flex: none; }
  .msheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 12px 4px 20px; flex: none; }
  .msheet-head b { font-family: var(--display); font-size: 18px; }
  .msheet-body { overflow: auto; padding: 4px 14px 18px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .msheet-group { margin: 14px 6px 8px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
  .msheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .msheet-grid.two { grid-template-columns: 1fr 1fr; }
  .msheet-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 78px; padding: 10px 6px; border-radius: 16px;
    background: var(--glass-2); border: 1px solid var(--line); color: var(--text); font-size: 12px; font-weight: 600; text-align: center; line-height: 1.2; box-shadow: none; }
  .msheet-item svg { width: 22px; height: 22px; color: var(--accent); }
  .msheet-item span { overflow-wrap: anywhere; hyphens: auto; font-size: 11.5px; }
  .msheet-item.on { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 14%, var(--glass-2)); }
  .msheet-item.danger svg, .msheet-item.danger { color: var(--bad, #ff5d6c); }
  .msheet-item.big { min-height: 120px; font-size: 16px; }
  .msheet-item.big svg { width: 30px; height: 30px; }
  .msheet-item small { color: var(--muted); font-weight: 400; font-size: 11.5px; }
  .msheet-item .mbadge { top: 6px; right: 8px; }

  /* search full screen, toasts above the tabs, floating bars above the tabs */
  dialog#palette { inset: 0; top: 0 !important; margin: 0; width: 100% !important; max-width: 100% !important; height: 100dvh; max-height: 100dvh !important; border-radius: 0 !important; padding-top: var(--sat) !important; }
  #palette #pal-list { max-height: calc(100dvh - 80px - var(--sat)); }
  #pal-list li[role=option] { flex-wrap: wrap; row-gap: 2px; min-height: 52px; }
  #pal-list li[role=option] span { white-space: normal !important; flex: 1 1 calc(100% - 40px); }
  #pal-list li[role=option] small { max-width: none !important; flex-basis: 100%; padding-left: 34px; }
  /* receipt: one big tap target (the iPhone offers camera, photos and files) */
  input[type=file] { width: 100%; min-height: 56px; padding: 10px; border-radius: 14px; border: 1.5px dashed color-mix(in oklab, var(--accent) 50%, transparent); background: color-mix(in oklab, var(--accent) 6%, transparent); color: var(--text-2); }
  input[type=file]::file-selector-button { margin-right: 12px; min-height: 40px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 15px; }
  #toasts { left: 12px !important; right: 12px !important; bottom: calc(var(--tabh) + var(--sab) + 12px) !important; }
  .bulkbar { bottom: calc(var(--tabh) + var(--sab) + 10px) !important; width: calc(100% - 24px); }
  .hk-help, .hk-fab { display: none !important; }

  /* notifications and dialog buttons */
  .notelist { max-height: none !important; overflow: visible !important; }
  .noteitem { height: auto !important; min-height: 0; white-space: normal; }
  .noteitem small, .noteitem b { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; display: block; -webkit-line-clamp: unset !important; max-height: none !important; }
  #modal .formactions { flex-wrap: wrap; gap: 8px; }
  #modal .formactions > button { flex: 1 1 calc(50% - 4px); min-width: 0; white-space: normal; line-height: 1.2; }
  #modal .formactions > button:last-child:nth-child(odd) { flex-basis: 100%; }
  /* Пульс: compact two-column tiles */
  .pulse-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .pulse-grid > * { padding: 12px !important; }
  /* pull to refresh */
  #mptr { display: block; position: fixed; top: calc(var(--sat) + 8px); left: 50%; z-index: 60; width: 34px; height: 34px; margin-top: -48px; border-radius: 50%;
    background: var(--glass-strong); border: 1px solid var(--line-2); box-shadow: 0 6px 20px rgba(0, 0, 0, .35); transform: translate(-50%, 0); transition: transform .2s; pointer-events: none; }
  #mptr i { position: absolute; inset: 8px; border-radius: 50%; border: 2.5px solid var(--muted); border-top-color: transparent; }
  #mptr.ready i { border-color: var(--accent); border-top-color: transparent; }
  #mptr.spin i { animation: mspin .7s linear infinite; }
  @keyframes mspin { to { transform: rotate(360deg); } }

  /* viewer toolbar fits */
  dialog.fv .fv-bar { padding-top: calc(var(--sat) + 8px) !important; }
}
/* the installed app on iOS: the status bar overlays the page (black-translucent) */
@media (max-width: 760px) and (display-mode: standalone) { .topbar { padding-top: calc(var(--sat) + 6px) !important; } }
/* the staff line on order cards (owner 29.10.2026): number · status · executor */
html.m table.mcards tr.mrow.mpo.mstf { grid-template-areas: "ava amt timer" "ava card act" "ava sub act" "ava staff staff" !important; }
html.m table.mcards tr.mrow.mstf:not(.mpo) { grid-template-areas: "ava amt timer" "ava sub status" "ava staff staff" "act act act" !important; }
html.m tr.mrow > td.mstaff { display: flex !important; grid-area: staff; align-items: center; justify-content: flex-start !important; gap: 6px; flex-wrap: wrap; padding: 6px 0 0 !important; border: 0 !important; text-align: left; }
html.m tr.mrow > td.mstaff::before { display: none !important; }
html.m td.mstaff .mnum { font: 600 11.5px var(--mono); color: var(--muted); }
html.m td.mstaff .badge { height: 22px; min-height: 22px; font-size: 11px; }
html.m td.mstaff .execchip { height: 22px !important; min-height: 22px !important; font-size: 11.5px; padding: 0 8px; max-width: 60vw; }
/* people lists on phones (owner 29.10.2026): name on top, the chips in one line, the whole card opens the person */
html.m table.mcards tbody tr:has(> td .person) { display: flex !important; flex-wrap: wrap; align-items: center; gap: 6px 6px; padding: 12px 14px !important; }
html.m table.mcards tbody tr:has(> td .person) > td { display: inline-flex !important; width: auto !important; padding: 0 !important; border: 0 !important; min-height: 0 !important; align-items: center; justify-content: flex-start !important; text-align: left !important; }
html.m table.mcards tbody tr:has(> td .person) > td::before { display: none !important; }
html.m table.mcards tbody tr:has(> td .person) > td.mc-head { flex: 1 0 100%; margin-bottom: 4px; }
html.m table.mcards tbody tr:has(> td .person) > td.mc-act { display: none !important; }
html.m table.mcards tbody tr:has(> td .person) > td:empty, html.m table.mcards tbody tr:has(> td .person) > td.mc-blank { display: none !important; }
html.m table.mcards tbody tr:has(> td .person) > td[data-label="Останній вхід"] { margin-left: auto; font-size: 12px; color: var(--muted); }
html.m table.mcards tbody tr:has(> td .person) > td small.muted { display: none; }
