/* Phone layout (loaded by m.html only — the desktop window never sees these rules).

   Layout is chosen from the space actually available, not from the device model.
   mobile.js puts one of these classes on <html> and updates it live while the phone is
   folded, unfolded, rotated or put in Split View:

     t-narrow   one column                      (iPhone Duo closed; Split View halves; any ordinary iPhone)
     t-medium   roomier single page             (iPhone Duo open, held upright: the fold runs across the middle)
     t-wide     two columns split at the centre (iPhone Duo open, held sideways: the fold runs down the middle)

   plus: roomy (a narrow layout with room for more columns), short (very low screens), standalone (opened from the Home Screen).

   Fold rule for t-wide: everything is laid out as a left half and a right half with a gutter
   (--gut) on the centre line, so no button, figure or chart sits on the fold. */

:root {
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --pad: 12px; --gut: 12px; --nav-h: 54px; --top-h: 50px;
  --side: max(var(--pad), var(--sal), var(--sar)); /* same on both sides: the page centre stays on the screen centre */
}
html.mob { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; background: var(--bg); }
.mob body { font-size: 14px; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; min-height: 100dvh; }
.mob.modal-open, .mob.modal-open body { overflow: hidden; }
.mob #app { display: block; min-height: 100dvh; }
.mob main { padding: 0 var(--side) calc(var(--nav-h) + var(--sab) + 18px); }
.mob [hidden] { display: none !important; }

/* inputs: 16px stops iOS from zooming the page when a field gets focus; bigger touch targets */
.mob input[type=text], .mob input[type=search], .mob input[type=number], .mob input[type=date], .mob input[type=tel], .mob select, .mob textarea { font-size: 16px; padding: 8px 10px; border-radius: 9px; }
.mob input[type=search] { background: var(--panel2); border: 1px solid var(--line2); outline: none; min-width: 0; -webkit-appearance: none; appearance: none; }
.mob select { max-width: 100%; }
.mob .btn { padding: 9px 14px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.mob .btn.sm { padding: 6px 11px; min-height: 34px; font-size: 13px; }
.mob .btn.icon { padding: 0; width: 40px; min-height: 40px; flex: none; }
.mob .btn.icon svg { width: 19px; height: 19px; }
.mob .seg button { padding: 9px 13px; min-height: 40px; }
.mob input[type=checkbox] { width: 20px; height: 20px; }
.mob a { -webkit-touch-callout: none; }

/* ---------- header ---------- */
.mob #top { top: 0; z-index: 30; gap: 8px; flex-wrap: nowrap; padding: calc(var(--sat) + 6px) 0 6px; background: var(--bg); min-height: calc(var(--top-h) + var(--sat)); }
.mob #top .hl { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.mob #top .hr { display: flex; align-items: center; gap: 8px; min-width: 0; flex: none; }
.mob #top .logo { display: none; flex: none; border-radius: 6px; }
.mob #top h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mob #filters { flex-wrap: nowrap; gap: 8px; min-width: 0; }
.mob #filters select { max-width: 132px; padding-right: 4px; text-overflow: ellipsis; }
.mob #filters .seg { display: none; }
.mob #filters .fbtn { position: relative; }
.mob #filters .fbtn i { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.mob #statusline { display: none; font-size: 12px; color: var(--text2); padding: 0 2px 8px; }
.mob #top:has(#refresh.spinning) + #statusline, .mob #statusline.err { display: block; }
.mob #statusline.err { color: var(--neg-text); }
.mob #chips { display: flex; gap: 6px; flex-wrap: wrap; padding-bottom: 8px; }
.mob #chips:empty { display: none; }
.mob #chips .pill { font-size: 12.5px; padding: 5px 10px; white-space: normal; }
.mob #chips .pill button { padding: 2px 4px 2px 8px; font-size: 14px; }
.mob .note { padding: 10px 12px; line-height: 1.55; }

/* ---------- bottom tab bar ---------- */
.mob #nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; flex-direction: row; gap: 0; padding: 0 var(--side) var(--sab); height: calc(var(--nav-h) + var(--sab)); background: rgba(16,19,23,.96); border-top: 1px solid var(--line); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.mob #nav a { flex-direction: column; justify-content: center; gap: 3px; padding: 4px 2px; border-radius: 0; font-size: 10.5px; color: var(--muted); min-width: 0; }
.mob #nav a svg { width: 22px; height: 22px; opacity: 1; }
.mob #nav a.on { background: none; color: var(--accent); }
.mob #nav a:hover { background: none; }
.mob #nav .nav-st { display: none; }

/* ---------- cards & grids ---------- */
.mob .grid { gap: 8px; }
.mob .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mob .g2, .mob .g3, .mob .g21 { grid-template-columns: minmax(0, 1fr); }
.mob .mt { margin-top: 8px; }
.mob .card { padding: 11px 12px; container-type: inline-size; }
.mob .card-h { flex-wrap: wrap; row-gap: 6px; }
.mob .stat { min-height: 0; }
.mob .stat .v, .mob .card > .v { font-size: 19px !important; white-space: nowrap; }
.mob .stat svg { display: none; }
.mob .stat .sub, .mob .sub2 { white-space: normal; font-size: 11.5px; }
.mob .chart { height: 220px; }
.mob .chart.sm { height: 200px; }
.mob .empty { padding: 34px 14px; }
.mob .kv > div { padding: 8px 2px; }
.mob .tbl-wrap { -webkit-overflow-scrolling: touch; }
.mob th, .mob td { padding: 8px 6px; }
.mob .pill { font-size: 12px; padding: 2px 8px; }
.mob .pill.big { font-size: 13.5px; padding: 6px 11px; }
.mob .pill.big button { padding: 2px 2px 2px 8px; font-size: 15px; opacity: .85; }
.mob button.pill.add { border: 1px dashed var(--line2); background: transparent; color: var(--text2); cursor: pointer; font-family: inherit; }
.mob .tt-go { margin-top: 8px; padding: 7px 10px; border-radius: 7px; background: var(--accent); color: #fff; font-weight: 600; text-align: center; cursor: pointer; }

/* generic tables shown as cards (mobile.js labels the cells) */
.mob table.cards, .mob table.cards tbody { display: block; }
.mob table.cards thead { display: none; }
.mob table.cards tbody { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.mob table.cards tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.mob table.cards td { display: block; padding: 0; border: 0; text-align: left; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.mob table.cards td::before { content: attr(data-l); display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mob table.cards td:first-child { grid-column: 1 / -1; font-size: 14.5px; }
.mob table.cards td:first-child::before { display: none; }
.mob table.cards .winbar { width: 34px; margin-right: 5px; }
.mob .card:has(> .tbl-wrap > table.cards), .mob .card:has(> table.cards) { background: none; border: 0; padding: 0; }
.mob .card:has(> .tbl-wrap > table.cards) > .card-h { padding: 4px 2px 0; }

/* ---------- trade cards ---------- */
.mob .tcards { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.mob .tc { border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: 10px 12px; cursor: pointer; min-width: 0; }
.mob .tc.sel { border-color: var(--accent); background: var(--accent-soft); }
.mob .tc-a { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mob .tc-a b { font-size: 15px; }
.mob .tc-a .tc-p { margin-left: auto; font-weight: 650; font-size: 15px; white-space: nowrap; }
.mob .tc-b { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; margin-top: 5px; font-size: 12.5px; color: var(--text2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mob .tc-b span:last-child { color: var(--muted); }
/* a list of trade cards does not need a second frame around it */
.mob .card:has(> .tcards), .mob .card:has(> .tl-tools) { background: none; border: 0; padding: 0; }
.mob .day .tcards { margin: 0 -2px; }
.mob .tc-c { margin-top: 7px; display: flex; gap: 5px; flex-wrap: wrap; }
.mob .tc-c:empty { display: none; }
.mob .tc-none { color: var(--muted); text-align: center; padding: 26px 10px; }
.mob .tl-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin: 2px 0 10px; }
.mob .tl-tools input { grid-column: 1 / -1; width: 100%; }
.mob .tl-tools select { width: 100%; }
.mob .pager { justify-content: space-between; padding-top: 12px; }

/* ---------- calendar (compact whenever its card is narrow) ---------- */
@container (max-width: 560px) {
  .mob .cal { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
  .mob .cal .wk, .mob .cal .hd:nth-child(8) { display: none; }
  .mob .cal .c { min-height: 46px; padding: 4px 3px; border-radius: 6px; }
  .mob .cal .dn { font-size: 10.5px; }
  .mob .cal .dn span + span { display: none; }
  .mob .cal .pv { font-size: 10.5px; letter-spacing: -.4px; }
  .mob .cal .pv .pv-l, .mob .cal .ct { display: none; }
  .mob .cal .pv .pv-s { display: inline; }
  .mob .cal .hd { font-size: 10.5px; }
}
.mob .card-h b[style*="min-width:118px"] { min-width: 104px !important; }

/* ---------- journal ---------- */
.mob .day-h { gap: 6px; flex-wrap: wrap; }
.mob .day-h h3 { font-size: 14.5px; }
.mob .day-s { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px 6px; }
.mob .day-s .big { grid-column: 1 / -1; padding-right: 0; justify-content: space-between; }
.mob .day-s .big .v { font-size: 21px; }
.mob .day-s .m { padding: 0; border: 0; min-width: 0; }
.mob .day-s .m > span { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mob .day-s .m b { font-size: 13px; white-space: nowrap; }
.mob .day-note { font-size: 13.5px; }
.mob #noteBox { min-height: 110px; }

/* ---------- reports ---------- */
.mob .rep-pick { position: sticky; top: calc(var(--top-h) + var(--sat)); z-index: 20; background: var(--bg); padding: 0 0 8px; }
.mob .rep-pick select { width: 100%; font-weight: 600; }

/* ---------- trade detail ---------- */
.mob #modal { padding: 0; background: var(--bg); align-items: stretch; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.mob .mdlg { width: 100%; min-height: 100%; border: 0; border-radius: 0; box-shadow: none; background: var(--bg); padding: 0 var(--side) calc(var(--sab) + 22px); }
.mob .mdlg .dlg-h { position: sticky; top: 0; z-index: 5; background: var(--bg); margin: 0 calc(-1 * var(--side)) 4px; padding: calc(var(--sat) + 6px) var(--side) 6px; gap: 6px; border-bottom: 1px solid var(--line); }
.mob .mdlg .dlg-h h2 { font-size: 16px; gap: 6px; min-width: 0; margin-right: auto; white-space: nowrap; overflow: hidden; }
.mob .mdlg .d-pnl { font-size: 17px; font-weight: 650; white-space: nowrap; }
.mob .mdlg .detail { display: block; }
.mob .mdlg .card-h { margin: 8px 0 6px; flex-wrap: nowrap; }
.mob .mdlg .card-h .sp { flex: none; }
.mob .mdlg #dChart { height: 300px; touch-action: pan-y; }
.mob .mdlg .d-legend { margin: 4px 0 10px; line-height: 1.5; }
.mob .stars.big button { font-size: 32px; padding: 0 5px; line-height: 1.1; }
.mob .tag-ed .row { gap: 7px; }
.mob .tag-ed .sugg { margin-top: 8px; }
.mob .newtag { display: inline-flex; gap: 6px; align-items: center; }
.mob .newtag input { width: 150px; padding: 6px 9px; }
.mob table.execs td, .mob table.execs th { font-size: 12.5px; padding: 7px 5px; }

/* ---------- sheets, popover, toasts, tips, pairing ---------- */
.mob #sheet { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; }
.mob .sheet { width: 100%; max-height: 78dvh; overflow: auto; background: var(--panel); border-radius: 16px 16px 0 0; border-top: 1px solid var(--line2); padding: 14px var(--side) calc(var(--sab) + 14px); }
.mob .sheet h2 { font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; }
.mob .sheet h2 .btn { margin-left: auto; }
.mob .f-row { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 8px; align-items: center; margin-bottom: 10px; }
.mob .f-row > label { color: var(--text2); font-size: 13px; }
.mob .f-row .btn, .mob .f-row select { width: 100%; justify-content: space-between; max-width: none; }
.mob .f-row .seg { display: inline-flex; justify-self: start; }
.mob .f-dates { display: flex; gap: 6px; align-items: center; }
.mob .f-dates input { flex: 1; min-width: 0; }
.mob #pop { top: auto !important; left: var(--side) !important; right: var(--side); bottom: calc(var(--sab) + 12px); max-height: 60dvh; padding: 8px; border-radius: 14px; }
.mob #pop label { padding: 11px 10px; font-size: 15px; }
.mob #pop .pop-f { position: sticky; bottom: -8px; background: var(--panel2); padding: 8px 4px; }
.mob #toasts { left: var(--side); right: var(--side); bottom: calc(var(--nav-h) + var(--sab) + 10px); align-items: stretch; }
.mob .toast { max-width: none; }
.mob #tip { position: fixed; z-index: 90; max-width: min(300px, calc(100vw - 24px)); background: var(--panel3); border: 1px solid var(--line2); border-radius: 9px; padding: 8px 11px; font-size: 13px; line-height: 1.45; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.mob [title]:not(button):not(a):not(select):not(input) { cursor: help; }
.mob .gate { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: calc(var(--sat) + 20px) var(--side) calc(var(--sab) + 20px); }
.mob .gate-card { width: min(420px, 100%); }
.mob .gate-card img { display: block; margin: 0 auto 14px; border-radius: 16px; }
.mob .gate-card h1 { font-size: 21px; text-align: center; margin-bottom: 8px; }
.mob .gate-card p, .mob .gate-card li { color: var(--text2); line-height: 1.6; }
.mob .gate-card ol, .mob .gate-card ul { padding-left: 20px; margin: 8px 0 14px; }
.mob .gate-card input { width: 100%; margin-bottom: 10px; }
.mob .gate-card input.code { font-size: 26px; letter-spacing: .18em; text-align: center; font-variant-numeric: tabular-nums; padding: 12px; }
.mob .gate-card .btn { width: 100%; }
.mob .gate-err { color: var(--neg-text); margin: 0 0 10px; }
.mob .set h2 { font-size: 15px; margin-bottom: 8px; }
.mob .set .card { margin-bottom: 8px; }
.mob .set .kv > div:nth-child(even) { white-space: normal; word-break: break-word; }
.mob .set .row { gap: 8px; }

/* ---------- roomy narrow (e.g. iPhone Duo closed and held sideways: 594 wide) ---------- */
.mob.roomy .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mob.roomy .tcards, .mob.roomy table.cards tbody { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- short screens (iPhone Duo closed, sideways: about 370 high) ---------- */
.mob.short { --nav-h: 42px; }
.mob.short #top { position: static; }
.mob.short #nav a span { display: none; }
.mob.short .rep-pick { position: static; }
.mob.short .mdlg #dChart { height: 210px; }
.mob.short .sheet { max-height: 92dvh; }

/* ---------- t-medium: iPhone Duo open, upright (about 669 wide, fold across the middle) ---------- */
.mob.t-medium, .mob.t-wide { --pad: 16px; --gut: 16px; }
.mob.t-medium #top .logo, .mob.t-wide #top .logo { display: block; }
.mob.t-medium #top h1, .mob.t-wide #top h1 { font-size: 19px; }
.mob.t-medium #filters .seg, .mob.t-wide #filters .seg { display: inline-flex; }
.mob.t-medium #filters select, .mob.t-wide #filters select { max-width: 170px; }
.mob.t-medium .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mob.t-medium .g2, .mob.t-medium .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mob.t-medium .g3 > :nth-child(3) { grid-column: 1 / -1; }
.mob.t-medium .chart { height: 250px; }
.mob.t-medium .tcards, .mob.t-medium table.cards tbody { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mob.t-medium .day .tcards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mob.t-medium .day-s { grid-template-columns: 1.6fr repeat(4, minmax(0, 1fr)); }
.mob.t-medium .day-s .big { grid-column: 1; grid-row: 1 / span 2; flex-direction: column; align-items: flex-start; gap: 6px; }
.mob.t-medium .tl-tools { grid-template-columns: 2fr 1fr 1fr; }
.mob.t-medium .tl-tools input { grid-column: auto; }
/* the fold runs across the middle: the chart fills the upper half, everything you touch is in the lower half */
.mob.t-medium .mdlg #dChart { height: clamp(260px, calc(50dvh - var(--sat) - 122px), 520px); }
.mob.t-medium .sheet { max-height: 47dvh; }
.mob.t-medium #pop { max-height: 44dvh; }

/* ---------- t-wide: iPhone Duo open, sideways (about 951 wide, fold down the middle) ---------- */
.mob.t-wide { --gut: 22px; --nav-h: 44px; } /* open sideways the real iPhone Duo is only 537 high (not the published 585): the tab bar, already icons beside text here, gives 10 px back (V1.0) */
.mob.t-wide #top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gut); align-items: center; }
.mob.t-wide #top .hr { justify-content: flex-end; }
.mob.t-wide .grid { column-gap: var(--gut); }
.mob.t-wide .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; column-gap: 8px; }
.mob.t-wide .g4 > :nth-child(4n+2) { margin-right: calc((var(--gut) - 8px) / 2); }
.mob.t-wide .g4 > :nth-child(4n+3) { margin-left: calc((var(--gut) - 8px) / 2); }
.mob.t-wide .g2, .mob.t-wide .g21, .mob.t-wide .g3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.mob.t-wide .chart { height: 240px; }
.mob.t-wide .dd-charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gut); }
.mob.t-wide .dd-charts .chart.sm { height: 240px; }
.mob.t-wide table.cards tbody { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gut); }
.mob.t-wide .pg-journal { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gut); align-items: start; }
.mob.t-wide .pg-journal .day { margin-bottom: 8px; }
.mob.t-wide .pg-journal > div:not(.card) { grid-column: 1; text-align: left !important; }
.mob.t-wide #banner .note { width: calc(50% - var(--gut) / 2); }
.mob.t-wide #chips { justify-content: flex-end; }
.mob.t-wide .rep-pick { width: calc(50% - var(--gut) / 2); }
.mob.t-wide .set { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gut); align-items: start; }
.mob.t-wide #nav { grid-template-columns: repeat(3, minmax(0, 1fr)) var(--gut) repeat(3, minmax(0, 1fr)); }
.mob.t-wide #nav a:nth-child(4) { grid-column: 5; }
.mob.t-wide #nav .nav-st { display: flex; flex-direction: column; justify-content: center; align-items: center; font-size: 10.5px; color: var(--muted); text-align: center; line-height: 1.35; padding: 0 4px; min-width: 0; overflow: hidden; }
.mob.t-wide #nav a { flex-direction: row; gap: 8px; font-size: 12.5px; }
/* trade log: list on the left of the fold, the selected trade on the right */
.mob.t-wide .split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gut); height: calc(100dvh - var(--top-h) - var(--sat) - var(--nav-h) - var(--sab) - 12px); }
.mob.t-wide[data-page="trades"] main { padding-bottom: calc(var(--nav-h) + var(--sab)); }
.mob.t-wide .pane { overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; min-width: 0; padding-bottom: 12px; }
.mob.t-wide .pane.list .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mob.t-wide .pane.list .g4 > * { margin: 0; }
.mob.t-wide .pane.detail { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 0; }
.mob.t-wide .pane.detail .mdlg { background: none; min-height: 0; padding: 0 12px 16px; }
.mob.t-wide .pane.detail .mdlg .dlg-h { background: var(--panel); margin: 0 -12px 4px; padding: 8px 12px; border-radius: 12px 12px 0 0; }
.mob.t-wide .pane.detail .mdlg #dChart { height: 250px; }
.mob.t-wide .pane-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 20px; }
/* full-screen trade detail on other pages: chart left of the fold, details right of it */
.mob.t-wide #modal .mdlg .detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gut); align-items: start; }
.mob.t-wide #modal .mdlg .d-chart { position: sticky; top: calc(var(--sat) + 58px); }
.mob.t-wide #modal .mdlg #dChart { height: clamp(220px, calc(100dvh - var(--sat) - var(--sab) - 190px), 460px); }
.mob.t-wide #modal .mdlg .dlg-h { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; }
.mob.t-wide .sheet { width: calc(50% - var(--gut) / 2); margin-left: auto; border-radius: 16px 0 0 0; max-height: 86dvh; }
.mob.t-wide #pop { left: auto !important; width: calc(50% - var(--gut) / 2 - var(--side)); }
.mob.t-wide #toasts { right: auto; width: calc(50% - var(--gut) / 2 - var(--side)); }
.mob.t-wide .gate { justify-content: flex-start; }
.mob.t-wide .gate-card { width: calc(50% - var(--gut) / 2); max-width: 430px; margin-left: auto; margin-right: calc(50% + var(--gut) / 2); }

/* ---------- setups (V0.6) ---------- */
.mob #spick { left: 0; right: 0; bottom: 0; top: auto; width: auto !important; max-height: 76dvh; border-radius: 16px 16px 0 0; border-width: 1px 0 0; padding-bottom: var(--sab); }
.mob .sp-top { padding: 10px var(--side); }
.mob .sp-list { padding: 0 calc(var(--side) - 6px) 8px; -webkit-overflow-scrolling: touch; }
.mob .sp-row { padding: 10px 7px; } .mob .sp-box { width: 20px; height: 20px; font-size: 14px; }
.mob .sp-n b { font-size: 15px; } .mob .sp-d { font-size: 12px; }
.mob .star { font-size: 22px; padding: 4px 6px; }
.mob .sp-t, .mob .sp-f { padding: 9px var(--side); font-size: 13px; }
.mob .sp-ctl .seg a { padding: 9px 16px; min-height: 40px; display: inline-flex; align-items: center; }
.mob .sp-ctl .row { gap: 8px; flex-wrap: wrap; } .mob .sp-ctl select { flex: 1; min-width: 0; }
.mob .ins-i p { font-size: 13.5px; }
.mob .sp-col { gap: 8px; } .mob .sp-map .chart { min-height: 250px; flex: none; height: 250px; }
.mob a.sp-back { display: inline-flex; }
.mob .lib-form { grid-template-columns: minmax(0, 1fr); }
.mob .lib-row .btn.sm { flex: none; }
.mob .sp-name h2 { font-size: 18px; }
.mob .sp-kv { grid-template-columns: minmax(0, 1fr); }
.mob .sp-kv > div:nth-child(odd) { border-bottom: 0; padding-bottom: 0; font-size: 12.5px; }
.mob .sp-kv > div:nth-child(even) { text-align: left; padding-top: 2px; }
.mob .sp-kv > div:nth-last-child(2) { border-bottom: 0; }
.mob table.mini td, .mob table.mini th { padding: 7px 5px; font-size: 12.5px; }
.mob #spDim, .mob #spCum { height: 200px; }
.mob .sdlg { width: 100%; min-height: 100%; border: 0; border-radius: 0; background: var(--bg); box-shadow: none; padding: calc(var(--sat) + 10px) var(--side) calc(var(--sab) + 22px); }
.mob.t-medium .pg-setups .g2 .tcards, .mob.t-medium .pg-setups .g2 table.cards tbody { grid-template-columns: minmax(0, 1fr); }
.mob.t-medium #spick { max-height: 47dvh; }
.mob.t-wide #spick { left: auto; width: calc(50% - var(--gut) / 2) !important; border-radius: 16px 0 0 0; border-left-width: 1px; max-height: 86dvh; }
.mob.t-wide .sdlg { width: calc(50% - var(--gut) / 2); margin-left: auto; min-height: 100%; }
.mob.t-wide .pg-setups > .row { width: calc(50% - var(--gut) / 2); }

/* ---------- GDTA EDGE + prop-firm ledger (V0.7) ---------- */
.mob .ge-card { padding: 10px 12px; margin-bottom: 8px; }
.mob .ge-head, .mob .ge-hl, .mob .ge-hr { gap: 8px; }
.mob .ge-head .seg button { padding: 7px 10px; min-height: 36px; font-size: 13px; }
.mob .ge-head .btn.ge-ib { min-height: 36px; width: 38px; padding: 0; }
.mob .ge-size span, .mob .ge-vol { display: none; }                     /* the three sizes as icons; loudness is the phone's own volume keys */
.mob .ge-size button { padding: 7px 9px; }
.mob .ge-dates { min-width: 0; }
.mob .ge-dates input { width: 128px; min-width: 0; padding: 7px 4px; text-align: center; }
.mob.t-narrow .ge-dates input { width: 0; flex: 1 1 0; }                    /* one column: the two fields share the line */
.mob .ge-dates input::-webkit-calendar-picker-indicator { display: none; }   /* a tap on the field opens the date wheel anyway */
.mob .ge-head .ge-dates .btn.ge-ib { width: 30px; flex: none; }
.mob .ge-stage { height: clamp(214px, 46vh, 430px); }
@supports (height: 1dvh) { .mob .ge-stage { height: clamp(214px, 46dvh, 430px); } }
.mob .ge-log, .mob .ge-stat { display: none; }
.mob.t-medium .ge-stat, .mob.t-wide .ge-stat { display: block; }
.mob.t-wide .ge-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gut); align-items: start; }
.mob.t-wide .ge-hr { justify-content: flex-end; }
.mob.t-wide .ge-speed { display: none; } .mob.t-wide .ge-head .btn.ge-spc { display: inline-flex; width: 46px; } /* half a screen per side: the speed is one button that steps through 1× 2× 3× 10× */
.mob.t-wide .ge-stat { right: 2px; }
/* one column: title, mode and size on the first line, the period on the second, the transport on the third */
.mob.t-narrow .ge-head { gap: 8px 6px; }
.mob.t-narrow .ge-hl, .mob.t-narrow .ge-hr { display: contents; }
.mob.t-narrow .ge-title { order: 1; letter-spacing: .08em; gap: 6px; }
.mob.t-narrow .ge-mode { order: 2; }
.mob.t-narrow .ge-head .ge-mode button, .mob.t-narrow .ge-head .ge-size button { padding-left: 8px; padding-right: 8px; }
.mob.t-narrow .ge-size { order: 3; margin-left: auto; }
.mob.t-narrow .ge-moreb { order: 4; }
.mob.t-narrow .ge-range { order: 5; flex: 1 1 100%; }
.mob.t-narrow .ge-range button { flex: 1 1 auto; padding-left: 4px; padding-right: 4px; }
.mob.t-narrow .ge-dates { order: 6; display: flex; flex: 1 1 100%; min-width: 0; }
.mob.t-narrow .ge-prop { order: 7; margin-right: auto; }
.mob.t-narrow .ge-speed { display: none; }
.mob.t-narrow .ge-head .btn.ge-spc { order: 8; display: inline-flex; width: 44px; }
.mob.t-narrow .ge-head [data-act="ge-pause"] { order: 9; } .mob.t-narrow .ge-head [data-act="ge-skip"] { order: 10; } .mob.t-narrow .ge-head [data-act="ge-replay"] { order: 11; } .mob.t-narrow .ge-head [data-act="ge-sound"] { order: 12; }
/* full screen on a phone: the controls sit above the stage; on one column only the first line stays until ⋯ is tapped */
.mob .ge-card.ge-full { padding: 0; margin: 0; }
.mob .ge-full .ge-head { position: static; padding: calc(var(--sat) + 8px) var(--side) 6px; background: none; }
.mob .ge-full .ge-stage { margin-bottom: var(--sab); }
.mob.t-narrow .ge-full .ge-head .btn.ge-moreb { display: inline-flex; width: 32px; }
.mob.t-narrow .ge-full:not(.ge-more) .ge-head > .ge-hl > :not(.ge-title):not(.ge-mode), .mob.t-narrow .ge-full:not(.ge-more) .ge-head > .ge-hr > :not(.ge-size):not(.ge-moreb) { display: none; }
.mob .pf-form { grid-template-columns: 96px minmax(0, 1fr); }
.mob .pf-form .hint { flex-basis: 100%; }

/* When the browser reports the two halves of the screen exactly (Viewport Segments API), use its numbers
   for the two columns instead of an even split. Has no effect where the API is not available. */
@media (horizontal-viewport-segments: 2) {
  .mob.t-wide { --gut: max(22px, calc(env(viewport-segment-left 1 0, 50vw) - env(viewport-segment-right 0 0, 50vw) + 20px)); }
}
@media (prefers-reduced-motion: no-preference) { .mob .sheet { animation: up .16s ease-out; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }

/* ---------- V0.8 ---------- */
.mob .ge-card.ge-min { padding: 6px 8px 6px 12px; }
.mob.t-narrow .dq { display: none; }
.mob .card-h .seg button { padding: 6px 11px; min-height: 32px; font-size: 13px; }
.mob .guide-b { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 2px 12px 12px; }
.mob.t-wide .guide-b { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 calc(var(--gut) + 24px); }
.mob details.guide > summary { padding: 12px; min-height: 44px; }
a.m-help { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-height: 52px; }
a.m-help b { font-size: 15px; } a.m-help span { color: var(--text2); font-size: 13px; flex: 1; min-width: 0; } a.m-help i { font-style: normal; color: var(--muted); font-size: 20px; }
.mob .hp-top { margin-bottom: 8px; gap: 8px; }
.mob .hp-find { flex: 1 1 100%; align-items: stretch; } .mob .hp-find input { font-size: 16px; min-height: 44px; }
.mob .hp-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 8px; padding: 0 12px 2px; scrollbar-width: none; } .mob .hp-chips::-webkit-scrollbar { display: none; }
.mob .hp-chips .pill { padding: 8px 13px; font-size: 13px; }
.mob .hp-sec { padding: 4px 12px 6px; margin-bottom: 8px; }
.mob .hp-e { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 11px 0; }
.mob .hp-zh { display: inline; margin-left: 8px; } .mob .hp-t b { display: inline; }
.mob.t-medium .hp-e { grid-template-columns: 200px minmax(0, 1fr); gap: 4px 16px; } .mob.t-medium .hp-zh, .mob.t-medium .hp-t b { display: block; margin-left: 0; }
.mob.t-wide .hp { max-width: none; }
.mob.t-wide .hp-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gut); align-items: end; }
.mob.t-wide .hp-chips { flex-wrap: wrap; overflow: visible; margin: 0 0 8px; padding: 0; width: calc(50% - var(--gut) / 2); }
.mob.t-wide .hp-sec { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: calc(var(--gut) + 24px); align-items: start; }
.mob.t-wide .hp-sec > h3 { grid-column: 1 / -1; } .mob.t-wide .hp-sec > h3 + .hp-e { border-top: 1px solid var(--line); }
.mob.t-wide .hp-e { grid-template-columns: minmax(0, 1fr); } .mob.t-wide .hp-zh { display: inline; margin-left: 8px; } .mob.t-wide .hp-t b { display: inline; }
.mob.t-wide .hp-e[hidden], .mob.t-wide .hp-sec[hidden] { display: none; }
.rep-sortbar { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--text2); font-size: 13px; }
.rep-sortbar select { min-height: 38px; max-width: 46%; } .rep-sortbar .btn { min-height: 38px; }

/* V1.0 — loss analysis and add location on the phone */
.mob .lx-bar i span { padding: 0 6px; font-size: 11px; }
.mob .lx-c { grid-template-columns: 64px minmax(0, 1fr); } .mob .lx-c > .btn { grid-column: 2; justify-self: start; }
.mob .lx-qa .pill.add, .mob .lx-qa .btn { min-height: 34px; }
.mob .lx-cls { grid-template-columns: minmax(0, 1fr); }
.mob .al-axis .c:nth-child(2) { display: none; }
.mob.t-wide .lx-bar { display: none; }                                         /* a figure across the fold: the four cards above carry the same shares */
.mob.t-wide .al-strip, .mob.t-wide .al-sum { width: calc(50% - var(--gut) / 2); } /* the dots stay on the left half */
.mob .lx-fix { grid-template-columns: minmax(0, 1fr); }
.mob.t-medium .lx-fix, .mob.t-wide .lx-fix { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gut); }
.mob .lx-tbl td .tiny { display: block; }
