/* Size account grids from the space available, including tablet sidebars. */
body .account-page-grid{grid-template-columns:minmax(0,1fr) minmax(260px,320px);align-items:start;gap:20px}
body .account-page-grid>*,body .account-cards,body .account-card{min-width:0;max-width:100%}
body .account-cards{grid-template-columns:repeat(auto-fit,minmax(min(100%,350px),1fr));gap:16px;align-items:stretch}
body .account-card{display:flex;flex-direction:column;padding:20px}
body .account-card-top{flex-wrap:wrap;gap:8px}
body .account-card-top .account-mark{flex:none}
body .account-kind{max-width:100%;overflow-wrap:anywhere;font-size:11px}
body .account-card h3{font-size:18px;line-height:1.35;overflow-wrap:anywhere;margin:16px 0 6px}
body .account-card>p{font-size:13px;line-height:1.6;overflow-wrap:anywhere}
body .account-card-stats{grid-template-columns:repeat(3,minmax(0,1fr));gap:16px 12px;margin:22px 0}
body .account-card-stats>span{min-width:0;align-content:start}
body .account-card-stats small{font-size:10px;line-height:1.6;overflow-wrap:anywhere}
body .account-card-stats strong{font-size:14px;line-height:1.5;overflow-wrap:anywhere}
body .account-card .account-cashflow{margin-top:auto;min-width:0}
body .account-cashflow>summary{overflow-wrap:anywhere}
body .account-card .cashflow-compact>div{grid-template-columns:minmax(0,1fr)}
body .account-card .cashflow-compact span{grid-column:auto}
body .account-card-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-items:stretch}
body .account-card-actions .button{display:flex;align-items:center;justify-content:center;gap:7px;min-width:0;max-width:100%;min-height:40px;padding:10px 12px;font-size:12px;white-space:normal;overflow-wrap:anywhere}
body .account-card-actions .button:first-child{grid-column:1/-1}
body .presets-panel .panel-heading{align-items:flex-start;flex-wrap:wrap;gap:12px}
body .presets-panel .panel-heading>div{flex:1 1 180px;min-width:0}
body .presets-panel .panel-heading .text-link{flex:none}
body .preset-chip{max-width:100%;overflow-wrap:anywhere}
body #add-account{flex:none;white-space:nowrap}
/* Shorter content columns should stack before charts and labels become cramped. */
body .payout-content{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr))}
body .payout-month{grid-template-columns:minmax(60px,80px) minmax(20px,1fr) minmax(0,auto);gap:10px;min-width:0}
body .payout-month>*{min-width:0}
body .payout-month strong{overflow-wrap:anywhere}
/* Form controls and note filters must not impose their intrinsic width on a page. */
body .notes-workspace{grid-template-columns:minmax(0,1fr)}
body .notes-workspace>*,body .notes-toolbar>*,body .trade-log-panel,body .log-toolbar>*{min-width:0;max-width:100%}
body .notes-toolbar .notes-search{flex:1 1 100%;min-width:0}
body .notes-toolbar select{flex:1 1 145px;width:100%}
body .notes-toolbar .note-pin{white-space:normal}
body .notes-form-row{grid-template-columns:repeat(2,minmax(0,1fr))}
body .trade-range label{flex:1 1 220px;min-width:0;max-width:100%}
body .trade-range input{display:block;min-width:0;max-width:100%;box-sizing:border-box}
body .log-toolbar .search-box{flex:1 1 220px;min-width:0}
body .log-toolbar select{min-width:0;max-width:100%;flex:1 1 140px}
body .log-toolbar .button{white-space:normal}
body .social-connect-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,125px),1fr))}
body .social-connect-grid>a{display:grid;grid-template-columns:28px minmax(0,1fr);align-items:center;gap:4px 8px;min-width:0;overflow-wrap:anywhere}
body .social-connect-grid .social-glyph{grid-row:1/3}
body .social-connect-grid strong{min-width:0;overflow-wrap:anywhere;white-space:normal}
body .social-connect-grid small{grid-column:2;margin-left:0}
body .red-zone-table th{white-space:normal;overflow-wrap:anywhere;line-height:1.5}
/* Long staff-role labels must remain inside the admin form. */
.admin-page label{min-width:0}
.admin-page :is(input,select,textarea){min-width:0;max-width:100%}
.admin-page .ops-staff-form select{width:100%}
/* Keep the current page visible while earlier breadcrumb entries remain selectable. */
body .breadcrumb{display:flex;align-items:center;gap:9px}
body .breadcrumb>span{flex:none}
body .breadcrumb>button{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body .breadcrumb>strong{flex:0 0 auto;max-width:55vw;overflow:hidden;text-overflow:ellipsis}
body .breadcrumb-history{flex:none;width:30px;min-width:0;margin:0;padding:3px 2px;border:0;background:var(--surface);color:var(--ink);font:inherit;cursor:pointer}
@media(min-width:1250px){body .notes-workspace:has(.notes-editor:not([hidden])){grid-template-columns:minmax(300px,.85fr) minmax(0,1.3fr)}}
@media(max-width:1400px){body .account-page-grid{grid-template-columns:minmax(0,1fr)}}
@media(max-width:600px){body .account-cards{grid-template-columns:minmax(0,1fr)}body .account-card{padding:18px}body .account-card-stats{grid-template-columns:repeat(2,minmax(0,1fr))}}
/* A drawer that is sliding away must not catch the next tap. */
@media(max-width:760px){body .sidebar:not(.mobile-open){pointer-events:none;visibility:hidden;transition:transform .22s ease,visibility 0s linear .22s}body .sidebar.mobile-open{pointer-events:auto;visibility:visible;transition:transform .22s ease,visibility 0s}}
@media(prefers-reduced-motion:reduce){body .sidebar{transition:none!important}body .modal,body .modal-backdrop,body .account-popover{animation:none!important}}
@media(hover:none){body .button:hover:not(:disabled),body .nav-item:hover{transform:none}}
