/* v25.25 | Responsive alignment and accessible admin controls */
/* Manual refresh buttons: consistent size and a visible busy state. */
#dashboard button[id^="refresh-"],#dashboard #refresh-audit{display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:6px!important;white-space:nowrap!important;min-height:36px!important;padding:8px 13px!important;border-radius:9px!important;background:#fff!important;color:#2e5e94!important;border:1px solid #d6e3f3!important;font-size:11px!important;font-weight:760!important;cursor:pointer}
#dashboard button[id^="refresh-"]:hover:not(:disabled),#dashboard #refresh-audit:hover:not(:disabled){background:#eaf3ff!important;border-color:#b9d1ec!important}
#dashboard button[id^="refresh-"]:disabled,#dashboard #refresh-audit:disabled{opacity:.68!important;cursor:progress!important}
#dashboard .admin-refreshing:before,#dashboard #refresh-audit.is-refreshing:before{content:"";display:inline-block;width:12px;height:12px;border:2px solid #bfd6f1;border-top-color:#286ab2;border-radius:50%;animation:adminSpin .75s linear infinite}
@keyframes adminSpin{to{transform:rotate(360deg)}}
/* Audit: controls take only the space they need, not half of an entire desktop panel. */
#dashboard #audit-view .audit-sort-controls{display:grid!important;grid-template-columns:repeat(2,minmax(0,225px))!important;gap:10px!important;justify-content:start!important;align-items:end!important;width:fit-content!important;max-width:100%!important;padding:10px 12px!important}
#dashboard #audit-view .audit-sort-controls .field{margin:0!important;min-width:0!important;width:100%!important}
#dashboard #audit-view .audit-sort-controls select{width:100%!important}
/* Audit table scrolls horizontally instead of breaking an event word into letters. */
#dashboard #audit-view .table-wrap{width:100%!important;max-width:100%!important;overflow-x:auto!important;overflow-y:auto!important;overscroll-behavior-x:contain!important;border-radius:11px!important;-webkit-overflow-scrolling:touch!important}
#dashboard #audit-view .table-wrap>table{min-width:850px!important;width:100%!important;table-layout:auto!important;border-collapse:separate!important;border-spacing:0!important}
#dashboard #audit-view .table-wrap th,#dashboard #audit-view .table-wrap td{word-break:normal!important;overflow-wrap:normal!important;white-space:nowrap!important;vertical-align:middle!important;min-width:65px!important}
#dashboard #audit-view .table-wrap th:nth-child(2),#dashboard #audit-view .table-wrap td:nth-child(2){min-width:190px!important}
#dashboard #audit-view .audit-event-chip{white-space:nowrap!important;word-break:normal!important;overflow-wrap:normal!important;max-width:none!important;min-width:max-content!important;line-height:1.4!important;padding:6px 9px!important}
#dashboard #audit-view .table-wrap th:last-child,#dashboard #audit-view .table-wrap td:last-child{white-space:normal!important;min-width:160px!important;max-width:360px!important;overflow-wrap:break-word!important}
/* Trader selector in the same line with real equal-width fields. */
#dashboard #settings-view .per-user-settings #user-display-settings-form .settings-user-pick-row{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;align-items:end!important;gap:10px!important;width:100%!important}
#dashboard #settings-view .settings-user-pick-row>.field:not(.full){width:100%!important;max-width:none!important;min-width:0!important;min-height:0!important;align-self:end!important;display:flex!important;flex-direction:column!important;gap:6px!important;margin:0!important}
#dashboard #settings-view #settings-user-search,#dashboard #settings-view #settings-user-select{box-sizing:border-box!important;display:block!important;width:100%!important;max-width:none!important;min-width:0!important;height:42px!important;min-height:42px!important;margin:0!important;padding:9px 12px!important;border:1px solid #d8e5f4!important;border-radius:9px!important;background:#fff!important}
#dashboard #settings-view .settings-user-pick-row>.field.full{grid-column:1/-1!important}
/* Clear distinction between the three independent trade filters. */
#dashboard #trades-view .trade-filter-controls{display:grid!important;grid-template-columns:minmax(0,1.15fr) minmax(0,.9fr) minmax(0,.9fr) auto!important;align-items:end!important;gap:10px!important;padding:12px!important}
#dashboard #trades-view .trade-filter-controls>.field{display:flex!important;flex-direction:column!important;gap:7px!important;width:100%!important;max-width:none!important;min-width:0!important;margin:0!important;align-self:end!important}
#dashboard #trades-view .trade-filter-controls .trade-user-field{display:flex!important;flex-direction:column!important;gap:7px!important}
#dashboard #trades-view .trade-filter-controls>.field input,#dashboard #trades-view .trade-filter-controls>.field select{display:block!important;box-sizing:border-box!important;width:100%!important;height:40px!important;min-height:40px!important;margin:0!important;padding:9px 11px!important;border-radius:9px!important;background:#fff!important}
#dashboard #trades-view #clear-trade-filters{align-self:end!important;justify-self:end!important;height:40px!important;min-height:40px!important;margin:0!important;padding:9px 12px!important}
/* Compact, light desktop-style trade editing row. The parent table supplies horizontal scrolling. */
#dashboard .trade-edit-row>td{background:#f5f9ff!important;white-space:normal!important;padding:12px!important}
#dashboard .trade-edit-form{display:grid!important;grid-template-columns:repeat(5,minmax(120px,1fr))!important;gap:10px!important;align-items:end!important;min-width:755px!important;width:100%!important;padding:12px!important;background:#fff!important;border:1px solid #dce7f5!important;border-radius:11px!important;box-shadow:0 2px 7px #234f7910!important}
#dashboard .trade-edit-form label{display:flex!important;flex-direction:column!important;min-width:0!important;max-width:none!important;margin:0!important;color:#466482!important;font-size:11px!important;font-weight:740!important;gap:6px!important}
#dashboard .trade-edit-form input{box-sizing:border-box!important;width:100%!important;min-width:0!important;height:40px!important;min-height:40px!important;border:1px solid #d7e4f3!important;border-radius:8px!important;background:#fff!important;color:#254668!important;font-size:12px!important;padding:8px 10px!important}
#dashboard .trade-edit-form .trade-edit-actions{grid-column:1/-1!important;display:flex!important;gap:7px!important;justify-content:flex-end!important}
#dashboard .trade-edit-form .trade-edit-actions button{min-height:36px!important;height:auto!important}
#dashboard .trade-edit-form>p{grid-column:1/-1!important;margin:0!important;font-size:10px!important;color:#687f9a!important;line-height:1.5!important}
/* Prominent, quote-dependent BTC examples; no invented price values. */
#dashboard #margin-view .margin-scenario-cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:4px 0 17px}
#dashboard #margin-view .margin-scenario-card{border:1px solid #dbe6f5;border-radius:12px;background:#fff;overflow:hidden;box-shadow:0 2px 5px #244d7608;min-width:0}
#dashboard #margin-view .scenario-quantity{background:#eaf2ff;padding:12px;border-bottom:1px solid #dbe7f5;display:flex;flex-direction:column;gap:4px}
#dashboard #margin-view .scenario-quantity span{color:#6483a6;font-size:9px;font-weight:850;letter-spacing:.08em}
#dashboard #margin-view .scenario-quantity strong{font-size:17px!important;color:#1d558d!important;line-height:1.2}
#dashboard #margin-view .scenario-detail{padding:10px 12px;display:flex;flex-direction:column;gap:5px}
#dashboard #margin-view .scenario-detail span{color:#768da5;font-size:10px;font-weight:650}
#dashboard #margin-view .scenario-detail strong{color:#243e5c!important;font-size:13px!important;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
#dashboard #margin-view .scenario-reserved{border-top:1px solid #e7eef8;background:#fafcff}
#dashboard #margin-view .scenario-reserved strong{color:#17609a!important}
#dashboard #margin-view .margin-scenario-head{margin-top:19px!important;padding-bottom:12px!important}
#dashboard #margin-view .margin-scenario-head h3{font-size:16px!important}
/* Touch input sizes prevent the common iOS focus zoom without restricting pinch zoom. */
@media(max-width:900px){
 #dashboard input:not([type=checkbox]):not([type=radio]),#dashboard select,#dashboard textarea,
 #dialog-backdrop input:not([type=checkbox]):not([type=radio]),#dialog-backdrop select,#dialog-backdrop textarea,
 #fake-trade-dialog input:not([type=checkbox]):not([type=radio]),#fake-trade-dialog select,#fake-trade-dialog textarea{font-size:16px!important}
 #dashboard #trades-view .trade-filter-controls{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px!important}
 #dashboard #trades-view #clear-trade-filters{grid-column:2!important;justify-self:stretch!important;width:100%!important}
 #dashboard #margin-view .margin-scenario-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 #dashboard #margin-view .margin-scenario-card .scenario-quantity{padding:10px}
 #dashboard #margin-view .scenario-detail{padding:9px 10px}
 /* Margin refresh remains beside the heading. */
 #dashboard #margin-view .split-head:has(#refresh-margin){display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:start!important;gap:8px!important}
 #dashboard #margin-view #refresh-margin{width:auto!important;min-width:0!important;justify-self:end!important;align-self:start!important}
 #dashboard #margin-view .split-head:has(#refresh-margin) h2{font-size:15px!important;line-height:1.2!important}
 /* Pages that only contain language control: keep in the header, not a separate row. */
 #dashboard .main-head.only-language{grid-template-columns:42px minmax(0,1fr) 74px!important}
 #dashboard .main-head.only-language .head-actions{grid-column:3!important;grid-row:1!important;justify-self:end!important;width:74px!important}
 #dashboard .main-head.only-language .head-actions .admin-head-language{min-width:0!important;width:74px!important;height:39px!important}
}
@media(max-width:620px){
 #dashboard #audit-view .audit-sort-controls{grid-template-columns:repeat(2,minmax(0,1fr))!important;width:100%!important;max-width:100%!important;gap:6px!important;padding:8px!important}
 #dashboard #audit-view .audit-sort-controls .field{min-width:0!important}
 #dashboard #audit-view .audit-sort-controls select{font-size:16px!important;min-height:42px!important;height:42px!important;padding:7px 20px 7px 7px!important}
 #dashboard #settings-view .settings-user-pick-row>.field:not(.full){max-width:none!important;width:100%!important;margin:0!important}
 #dashboard #settings-view #settings-user-search,#dashboard #settings-view #settings-user-select{font-size:16px!important;min-height:43px!important;height:43px!important;padding:8px 7px!important}
 #dashboard #trades-view .trade-filter-controls{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px!important;padding:9px!important}
 #dashboard #trades-view .trade-filter-controls .trade-id-field{grid-column:1/-1!important}
 #dashboard #trades-view .trade-filter-controls .trade-user-field,#dashboard #trades-view .trade-filter-controls .trade-account-field{grid-column:auto!important}
 #dashboard #trades-view #clear-trade-filters{grid-column:1/-1!important;justify-self:end!important;width:auto!important;min-width:115px!important}
 #dashboard .trade-edit-row>td{padding:7px!important}
 #dashboard .trade-edit-form{min-width:740px!important;gap:8px!important;padding:9px!important}
 #dashboard .trade-edit-form input{font-size:16px!important;min-height:43px!important}
 #dashboard .main-head.only-language .head-actions{max-width:74px!important}
}
@media(max-width:360px){
 #dashboard #margin-view .scenario-quantity strong{font-size:14px!important}
 #dashboard #audit-view .audit-sort-controls{gap:4px!important;padding:6px!important}
 #dashboard #audit-view .audit-sort-controls .field{font-size:10px!important}
 #dashboard #trades-view .trade-filter-controls .trade-user-field,#dashboard #trades-view .trade-filter-controls .trade-account-field{grid-column:1/-1!important}
}

#dashboard #audit-view .audit-scroll-hint{display:none;font-size:11px;color:#6984a2;margin:0 0 8px}
@media(max-width:900px){#dashboard #audit-view .audit-scroll-hint{display:block}}
