.mobile-bottom-nav,.mobile-only-inline{display:none}
@media(max-width:700px),(max-height:500px){
  .modal-backdrop:has(#monitor-quick-trade-form){top:var(--mobile-viewport-top,0px);bottom:auto;height:var(--mobile-viewport-height,100dvh);padding:8px;overflow:hidden;min-width:0}
  .modal:has(#monitor-quick-trade-form){position:relative;display:flex;flex-direction:column;width:100%;min-width:0;max-width:100%;height:100%;max-height:100%;overflow:hidden}
  .modal:has(#monitor-quick-trade-form) .modal-head{flex:none;padding:12px 14px}
  .modal:has(#monitor-quick-trade-form) .modal-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:12px 14px calc(80px + env(safe-area-inset-bottom,0px));overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
  #monitor-quick-trade-form{min-width:0;display:contents}
  #monitor-quick-trade-form input,#monitor-quick-trade-form textarea{width:100%;max-width:100%;min-width:0;font-size:16px}
  #monitor-quick-trade-form textarea{max-height:120px}
  #monitor-quick-trade-form>.form-actions{position:absolute;bottom:0;left:14px;right:14px;z-index:3;display:flex;flex-wrap:nowrap;background:var(--surface);border-top:1px solid var(--line);padding:10px 0 calc(10px + env(safe-area-inset-bottom,0px));margin-top:12px}
  #monitor-quick-trade-form>.form-actions>button{flex:1;min-height:44px}
  #monitor-quick-file-list{overflow-wrap:anywhere;min-width:0}
}
.monitor-unit-field{min-width:100px}.monitor-unit-field select{min-height:38px}
.mobile-menu-links{display:grid;gap:6px}.mobile-menu-links a{display:flex;justify-content:space-between;padding:13px 15px;border-radius:9px;background:var(--surface2);font-size:14px}.mobile-menu-links a[aria-current=page]{color:var(--primary);background:var(--primary-soft)}
@media(max-width:700px){
  .shell{min-height:100dvh}
  html{scroll-padding-bottom:90px;-webkit-text-size-adjust:100%;text-size-adjust:100%}
  .shell{padding-bottom:calc(76px + env(safe-area-inset-bottom,0px));min-width:0}.sidebar{display:none}
  .mobile-bottom-nav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));position:fixed;z-index:45;inset:auto 0 0;height:calc(64px + env(safe-area-inset-bottom,0px));padding:4px max(6px,env(safe-area-inset-right,0px)) calc(4px + env(safe-area-inset-bottom,0px)) max(6px,env(safe-area-inset-left,0px));background:var(--surface);border-top:1px solid var(--line);box-shadow:0 -3px 18px #25355506}
  .mobile-bottom-nav>a,.mobile-bottom-nav>button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-width:0;min-height:0;height:56px;padding:4px 0;margin:0;border:0;box-shadow:none;background:transparent;color:var(--muted);font-size:10px;line-height:1.2;letter-spacing:-.03em;border-radius:10px;white-space:nowrap}
  .mobile-bottom-nav .icon{width:20px;height:20px;flex:none}.mobile-bottom-nav .active{color:var(--primary);background:var(--primary-soft);font-weight:600}
  .mobile-only-inline{display:inline}.content{padding:18px 12px 24px;min-width:0;max-width:100%}.main,.panel,.panel-body,.grid-main>*,.grid-equal>*,.cards>*,.note-paper{min-width:0}
  .topbar{height:auto;min-height:54px;padding:9px 12px;flex-wrap:wrap;gap:8px}.mobile-title{font-size:15px;flex-shrink:0}.top-actions{margin-left:auto;max-width:100%;flex-wrap:wrap}.top-actions input{width:108px}.top-actions select{width:94px}.top-actions .icon{width:18px;height:18px}
  .page-head h1{font-size:23px;margin-bottom:12px}.page-head .actions{gap:6px;display:flex;flex-wrap:wrap}.page-head .actions>*{min-width:0}.page-head .actions button,.page-head .actions .link-btn{font-size:11px;min-height:36px;padding:7px 9px}
  .segmented{max-width:100%;flex-wrap:wrap;justify-content:flex-start}.pnl-control-row{flex-wrap:wrap}.pnl-controls .segmented{display:flex;flex-wrap:wrap}.pnl-control-row>.muted{overflow-wrap:anywhere}
  .pnl-summary-five{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible;gap:9px;padding:0;margin:0 0 16px;scroll-snap-type:none}.pnl-summary-card{min-width:0;min-height:104px;padding:14px}.pnl-summary-card:first-child{grid-column:1/-1;min-height:105px}.pnl-summary-card .metric-value{font-size:24px}.pnl-summary-card:first-child .metric-value{font-size:30px}.pnl-summary-card .metric-top{margin-bottom:7px}.pnl-metric-date{margin-top:6px}
  .pc-plot-column{padding:14px 3px 0}.pc-plot{min-width:0}.pc-plot-footer{flex-wrap:wrap}.pc-readout{padding:18px 14px}.pc-periods{display:block}.pc-periods dd{font-size:12px}.pc-value-block strong{font-size:15px}
  .note-list{display:grid;grid-template-columns:1fr;overflow:visible;gap:8px}.note-select{min-width:0;padding:12px}.note-paper{padding:18px}.doc-item{flex-wrap:wrap}.doc-main{min-width:0}.doc-main strong,.prose,.note-paper,.file-chip{overflow-wrap:anywhere}.table-tools{flex-wrap:wrap}.table-tools .search{min-width:0;max-width:100%;width:100%}
  .table-wrap:has(>.mobile-records){overflow:visible}.mobile-records{display:block;width:100%;table-layout:auto;min-width:0}.mobile-records thead{display:none}.mobile-records tbody{display:block}.mobile-records tbody tr{display:block;padding:10px 12px;border-bottom:1px solid var(--line)}.mobile-records tbody td{display:flex;justify-content:space-between;align-items:baseline;gap:12px;min-width:0!important;width:auto!important;padding:5px 0!important;border:0;text-align:right;white-space:normal;position:static;overflow-wrap:anywhere;height:auto}.mobile-records td:before{content:attr(data-label);font-size:11px;font-weight:400;color:var(--muted);text-align:left;flex:0 0 34%}.mobile-records td:first-child{font-weight:600;font-size:14px;padding-bottom:8px!important}.mobile-records td[colspan]{display:block;text-align:left}.mobile-records td[colspan]:before{content:none}.mobile-records td>input,.mobile-records td>select{min-width:0;max-width:62%;font-size:16px}.mobile-records td .icon{flex-shrink:0}
  .monitor-toolbar{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:end;margin-bottom:12px}.monitor-toolbar .field{min-width:0;font-size:10px}.monitor-toolbar input,.monitor-toolbar select{font-size:12px;min-height:36px;padding:7px 9px}.monitor-toolbar>small{flex-basis:100%;font-size:10px;margin-top:0}.monitor-unit-field{margin-left:auto}.monitor-section{margin-top:14px}
  .monitor-spreadsheet .panel-head{padding:12px 10px;gap:6px}.monitor-spreadsheet .panel-head h2{font-size:14px}.monitor-spreadsheet .panel-head>.muted{font-size:10px}
  .monitor-sheet-wrap{overflow:visible;max-height:none}.monitor-sheet{width:100%;table-layout:fixed;font-size:12px}.monitor-sheet td.num{min-width:0}.monitor-sheet td,.monitor-sheet th{padding:7px 5px;height:auto;line-height:1.4;border-left:0;border-right:0;white-space:normal}.monitor-sheet thead th{position:static;font-size:10px}
  .monitor-sheet .monitor-name{position:static;min-width:0;padding-left:calc(5px + var(--depth)*8px);white-space:normal;overflow-wrap:anywhere;background:transparent}.monitor-toggle{width:24px;height:28px;min-height:28px;margin-right:2px;vertical-align:middle}.monitor-toggle-space{width:10px}.monitor-account{display:inline;white-space:normal;overflow-wrap:anywhere;font-size:11px;line-height:1.5;max-width:calc(100% - 16px);vertical-align:middle;text-align:left;padding:3px 0}.monitor-name>span:not(.monitor-toggle-space){font-size:11px}.monitor-hq-row .monitor-name>span{font-size:14px}
  .monitor-pnl-sheet th:first-child{width:36%}.monitor-pnl-sheet th:nth-child(2),.monitor-pnl-sheet th:nth-child(3){width:32%}.monitor-pnl-sheet th:nth-child(n+4),.monitor-pnl-sheet td:nth-child(n+4){display:none}.monitor-pnl-sheet td.num{font-size:15px;font-weight:500}.monitor-pnl-sheet .monitor-hq-row td.num{font-size:22px}.monitor-pnl-sheet .monitor-team-row td.num{font-size:16px}
  .monitor-sheet:not(.mobile-records) td{padding-top:4px;padding-bottom:4px}.monitor-toggle{height:24px;min-height:24px}.monitor-hq-row td{padding-top:7px!important;padding-bottom:7px!important}
  .monitor-position-sheet th:first-child{width:40%}.monitor-position-sheet th:nth-child(2),.monitor-position-sheet th:nth-child(3){width:30%}.monitor-position-sheet th:nth-child(n+4),.monitor-position-sheet td:nth-child(n+4){display:none}.monitor-position-sheet td.num{font-size:11px;letter-spacing:-.04em;overflow-wrap:anywhere}.monitor-position-sheet .monitor-hq-row td.num{font-size:13px;font-weight:600}
  .monitor-holdings.mobile-records td{font-size:12px}.monitor-holdings.mobile-records td:first-child{font-size:14px}.monitor-holdings.mobile-records td small{margin-left:6px}
  .modal-backdrop{padding:10px}.modal{max-height:calc(100dvh - 20px)}.modal-body{padding:16px}.modal-body input,.modal-body select,.modal-body textarea{font-size:16px}.modal-body .table-wrap{max-width:100%}.form-actions{flex-wrap:wrap}.form-actions button{min-height:40px}#toast{bottom:calc(78px + env(safe-area-inset-bottom,0px))}
}

@media(max-width:700px){.workbook-panel .table-wrap:has(>.mobile-records){max-height:none;overflow:visible}.mobile-records td input,.mobile-records td select{width:62%}.monitor-account-modal{width:100%!important;max-width:100%!important}.calendar-cell{min-width:0}.cal-event{overflow-wrap:anywhere;white-space:normal}}

/* Keep complete numeric columns: hiding cells while retaining colgroup widths
   squeezed the first three columns and clipped their values on iOS. */
@media(max-width:700px){
 .monitor-sheet-wrap,.monitor-daily-wrap{overflow-x:auto!important;max-width:100%;-webkit-overflow-scrolling:touch}
 .monitor-pnl-sheet{width:1020px!important;min-width:1020px!important}
 .monitor-position-sheet,.monitor-daily-tree{width:740px!important;min-width:740px!important}
 .monitor-sheet col:first-child{width:180px!important}
 .monitor-sheet col:not(:first-child){width:140px!important}
 .monitor-sheet:not(.monitor-holdings) th,.monitor-sheet:not(.monitor-holdings) td{display:table-cell!important}
 .monitor-sheet td.num{overflow:visible!important;text-overflow:clip!important;white-space:nowrap!important;overflow-wrap:normal}
 .monitor-sheet th:first-child{width:180px!important}
 .monitor-sheet th:not(:first-child){width:140px!important}
}

@media (max-width: 760px) {
  .modal.wide:has(#monitor-month-form) { max-width: calc(100vw - 20px); min-width: 0; }
}

.monitor-page-head kbd,#monitor-quick-trade-form kbd{font:inherit;font-size:.78em;opacity:.8;white-space:nowrap}
@media (hover:none),(max-width:700px){.monitor-page-head kbd,#monitor-quick-trade-form kbd{display:none}}

/* Compact the mobile eok view without clipping full won amounts in other units. */
@media(max-width:700px){
 table.monitor-sheet[data-display-unit]{--monitor-label-width:192px;--monitor-number-width:140px}
 table.monitor-sheet[data-display-unit="eok"]{--monitor-number-width:76px}
 table.monitor-pnl-sheet[data-display-unit]{width:calc(var(--monitor-label-width) + 6*var(--monitor-number-width))!important;min-width:calc(var(--monitor-label-width) + 6*var(--monitor-number-width))!important}
 table.monitor-position-sheet[data-display-unit],table.monitor-daily-tree[data-display-unit]{width:calc(var(--monitor-label-width) + 4*var(--monitor-number-width))!important;min-width:calc(var(--monitor-label-width) + 4*var(--monitor-number-width))!important}
 table.monitor-sheet[data-display-unit] col:first-child,table.monitor-sheet[data-display-unit] th:first-child{width:var(--monitor-label-width)!important}
 table.monitor-sheet[data-display-unit] col:not(:first-child),table.monitor-sheet[data-display-unit] th:not(:first-child){width:var(--monitor-number-width)!important}
 table.monitor-sheet[data-display-unit] td,table.monitor-sheet[data-display-unit] th{padding-left:5px;padding-right:5px}
 table.monitor-sheet[data-display-unit] td.monitor-name{position:sticky;left:0;z-index:1;min-width:0;padding-left:calc(6px + var(--depth,0)*8px)!important;background:var(--surface,#fff)}
 table.monitor-daily-tree[data-display-unit] td.monitor-name{padding-left:calc(27px + var(--depth,0)*8px)!important}
 table.monitor-daily-tree[data-display-unit] .monitor-hide-row{left:5px;width:16px;height:16px}
 table.monitor-sheet[data-display-unit] th:first-child{position:sticky;left:0;z-index:3;background:var(--surface2,#f6f7fb)}
 table.monitor-sheet[data-display-unit] .monitor-toggle{width:23px;height:24px;min-height:24px;margin-right:3px}
 table.monitor-sheet[data-display-unit] .monitor-hq-row td{padding-top:5px!important;padding-bottom:5px!important}
 table.monitor-sheet[data-display-unit] .monitor-hq-row .monitor-name{white-space:nowrap;overflow-wrap:normal}
 table.monitor-sheet[data-display-unit] .monitor-hq-row .monitor-name>span{font-size:12px;white-space:nowrap}
 table.monitor-sheet[data-display-unit="eok"] tr[data-numeric-level="hq"]{--number-size:14px;--number-inset:10px}
 table.monitor-sheet[data-display-unit="eok"] tr[data-numeric-level="team"]{--number-size:13.5px;--number-inset:8px}
 table.monitor-sheet[data-display-unit="eok"] tr[data-numeric-level="strategy"]{--number-size:13px;--number-inset:7px}
 table.monitor-sheet[data-display-unit="eok"] tr[data-numeric-level="account"]{--number-size:12.5px;--number-inset:6px}
 table.monitor-sheet[data-display-unit="eok"] tr[data-numeric-level="instrument"]{--number-size:12px;--number-inset:5px}
 table.monitor-sheet[data-display-unit="eok"] .column-button{gap:3px}
}

/* Account holdings use cards on phones, never the main sheet's table-cell override. */
@media(max-width:700px){
 .monitor-account-modal .modal-head{padding:14px 16px}
 .monitor-account-modal .modal-head h2{font-size:17px;line-height:1.4}
 .monitor-account-modal .modal-body{padding:12px;overflow-x:hidden}
 .monitor-account-modal .monitor-account-note{font-size:11px;margin-bottom:10px;line-height:1.5}
 .monitor-account-modal .table-wrap{overflow:visible;max-width:100%;max-height:none}
 .monitor-account-modal table.monitor-holdings.mobile-records{display:block;width:100%!important;min-width:0!important;max-width:100%;table-layout:auto!important}
 .monitor-account-modal .monitor-holdings.mobile-records thead{display:block;position:static;margin-bottom:10px}
 .monitor-account-modal .monitor-holdings.mobile-records thead tr{display:flex;flex-wrap:wrap;gap:4px;padding:0;border:0}
 .monitor-account-modal .monitor-holdings.mobile-records thead th{display:block!important;position:static;width:auto!important;min-width:0!important;padding:2px 6px!important;font-size:10px}
 .monitor-account-modal .monitor-holdings .column-button{gap:5px;min-height:28px;padding:2px 0}
 .monitor-account-modal .monitor-holdings.mobile-records tbody{display:grid;gap:10px}
 .monitor-account-modal .monitor-holdings.mobile-records tbody tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 14px;padding:12px;border:1px solid var(--line,#e4e7ed);border-radius:10px;background:var(--surface,#fff)}
 .monitor-account-modal .monitor-holdings.mobile-records tbody tr[hidden]{display:none!important}
 .monitor-account-modal .monitor-holdings.mobile-records tbody td{display:flex!important;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:3px;width:auto!important;min-width:0!important;height:auto!important;padding:0!important;border:0;white-space:normal!important;overflow-wrap:anywhere;text-align:left;font-size:13px;line-height:1.4;overflow:visible!important}
 .monitor-account-modal .monitor-holdings.mobile-records tbody td:before{flex:none;width:auto;font-size:10px;line-height:1.3;color:var(--muted,#6d7078);white-space:normal;font-weight:400}
 .monitor-account-modal .monitor-holdings.mobile-records tbody td:first-child{grid-column:1/-1;font-size:15px;line-height:1.45;font-weight:700;word-break:keep-all;padding-bottom:7px!important;border-bottom:1px solid var(--line,#e4e7ed)}
 .monitor-account-modal .monitor-holdings.mobile-records tbody td:first-child:before{content:none}
 .monitor-account-modal .monitor-holdings.mobile-records tbody td:nth-child(4){order:7}
 .monitor-account-modal .monitor-holdings.mobile-records tbody td:nth-child(5){order:5}
 .monitor-account-modal .monitor-holdings.mobile-records tbody td:nth-child(6){order:6}
 .monitor-account-modal .monitor-holdings.mobile-records tbody td:nth-child(7){order:3;font-size:15px}
 .monitor-account-modal .monitor-holdings.mobile-records tbody td:nth-child(8){order:4;font-size:15px}
 .monitor-account-modal .monitor-holdings.mobile-records tbody td:nth-child(9){order:8;font-size:11px}
 .monitor-account-modal .monitor-holdings.mobile-records tbody td small{margin:0;display:block;font-size:10px;line-height:1.4}
 .monitor-account-modal .monitor-holdings.mobile-records tbody td[colspan]{grid-column:1/-1;font-size:13px;border:0}
}
