/* Phone refinements are last in the cascade; desktop layout remains untouched. */
.mobile-overview-edit,.mobile-chart-price-alert,.mobile-history-filter,.mobile-history-note{display:none}
@media(max-width:700px), (pointer:coarse) and (max-width:1000px) and (max-height:600px){
 html:has(dialog[open]){scrollbar-gutter:auto}
 #alert-settings-dialog .alert-delivery{display:none!important}
 body .market-overview .overview-remove{display:none!important}
 body .market-overview .overview-name{padding-right:0}
 .mobile-overview-tools{display:flex;align-items:center;justify-content:center;align-self:center;min-width:0;height:38px}
 body .market-overview .mobile-overview-tools .overview-add{width:40px;flex:0 0 40px;min-height:38px;height:38px}
 body .market-overview .mobile-overview-tools .mobile-overview-edit{flex:1;min-height:38px;height:38px;border-left:1px solid #ffffff08}
 body .market-overview .overview-add{width:100%;min-height:30px;height:30px;font-size:16px}
 body .market-overview .mobile-overview-edit{display:flex;align-items:center;justify-content:center;height:30px;min-height:30px;padding:0 8px;background:transparent;border:0;border-radius:5px;color:#8f9fb4;font-size:10px;font-family:inherit}
 .mobile-overview-editor-row{display:flex;align-items:center;gap:3px;padding:7px 0;border-bottom:1px solid #ffffff09}
 .mobile-overview-editor-row>span{flex:1;min-width:0;font-size:13px;line-height:1.5;color:#cfdaea;padding-right:6px;overflow-wrap:anywhere}
 .mobile-overview-editor-row button{display:grid;place-items:center;flex:0 0 40px;width:40px;height:42px;border:0;border-radius:7px;background:transparent;color:#a3b5cc;padding:0}
 .mobile-overview-editor-row button:disabled{opacity:.2}
 .mobile-overview-editor-row button:active{background:#ffffff09}
 .mobile-overview-editor-row button svg{width:18px;height:18px}
 .mobile-overview-editor-row .mobile-overview-remove{color:#b9949e}
 #mobile-overview-editor .mobile-primary{margin-top:16px;width:100%}
 .mobile-bottom-nav button{position:relative}
 .mobile-alert-badge{position:absolute;top:3px;left:calc(50% + 8px);min-width:15px;padding:2px 4px;border-radius:8px;background:#405676;color:#ecf3ff;font-size:8px;line-height:11px;font-variant-numeric:tabular-nums;border:2px solid #10161f}
 .mobile-alert-badge[hidden]{display:none}
 .mobile-bottom-nav button[data-monitoring=on]>svg{color:#b3cbed}
 #mobile-alerts{inset:0;margin:0;width:100%;max-width:none;height:100dvh;max-height:var(--mobile-visible-height,100dvh);border:0;border-radius:0;padding-top:env(safe-area-inset-top);background:#101720}
 #mobile-alerts:not([open]){display:none!important}
 #mobile-alerts>header{padding:6px 16px;border-bottom:1px solid #ffffff09}
 #mobile-alerts>.mobile-sheet-body{display:flex;flex:1;flex-direction:column;min-height:0;overflow:hidden;gap:0;padding:0}
 .mobile-alert-controls{padding:10px 16px 8px;flex-shrink:0}
 .mobile-alert-master{display:flex;align-items:center;gap:10px;min-height:40px}
 #mobile-alerts .movement-setting{display:flex;align-items:center;gap:9px;flex:1;padding:0;min-height:40px;margin:0;border:0;border-radius:0;background:transparent;font-size:13px;font-weight:550;white-space:nowrap}
 #mobile-alerts .movement-setting input[type=checkbox]{order:0;appearance:auto;width:18px;height:18px;min-width:18px;min-height:18px;flex:0 0 18px;margin:0;padding:0;accent-color:#aac3e2}
 #mobile-alerts .movement-setting input::after{display:none}
 .mobile-alert-state{font-size:10px;color:#8191a6;font-weight:500}
 .mobile-alert-state[data-state=on]{color:#8ac8ae}
 .mobile-alert-monitor-note{font-size:10px;color:#91a2b9;line-height:1.5;margin:2px 0 7px}
 .mobile-phone-delivery{font-size:10px;color:#8e9eb3;border-top:1px solid #ffffff07;padding-top:5px}
 .mobile-phone-delivery>summary{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:30px;cursor:pointer;list-style:none}
 .mobile-phone-delivery>summary::-webkit-details-marker{display:none}
 .mobile-phone-delivery>summary>span:last-child{font-size:9px;color:#76879e}
 .mobile-phone-delivery>summary>span:last-child::after{content:' ⌄';padding-left:5px}
 .mobile-phone-delivery p{font-size:11px;line-height:1.6;margin:5px 0 9px;color:#a6b5c9}
 .mobile-alert-tabs{display:flex;flex-shrink:0;gap:3px;padding:3px;margin:0 16px 9px;background:#0b1119;border:1px solid #ffffff06;border-radius:9px}
 .mobile-alert-tabs button{flex:1;min-height:38px;padding:6px 8px;border:0;border-radius:6px;background:transparent;color:#8b9db5;font-size:12px;font-weight:500}
 .mobile-alert-tabs button[aria-selected=true]{color:#e1ebf8;background:#243348}
 .mobile-activity-count{font-size:9px;margin-left:6px;color:#a0b4cf;font-variant-numeric:tabular-nums}
 .mobile-alert-feedback{flex-shrink:0;margin:0 16px 8px;color:#a3c9b9;font-size:11px;line-height:1.4}
 .mobile-alert-panels{flex:1;min-height:0;display:flex;overflow:hidden}
 .mobile-keyboard #mobile-alerts .mobile-alert-controls{display:none}
 #mobile-alerts #alert-history-dialog,#mobile-alerts #alert-settings-dialog{position:static;inset:auto;margin:0;padding:0;width:100%;max-width:none;height:100%;max-height:none;min-height:0;flex:1;overflow:hidden;border:0;border-radius:0;box-shadow:none;background:transparent}
 #mobile-alerts #alert-history-dialog[open],#mobile-alerts #alert-settings-dialog[open]{display:flex;flex-direction:column}
 #mobile-alerts #alert-history-dialog[hidden],#mobile-alerts #alert-settings-dialog[hidden]{display:none!important}
 #mobile-alerts #alert-history-dialog>header,#mobile-alerts #alert-settings-dialog>header{display:none}
 #mobile-alerts .history-controls{padding:0 16px 8px;flex-shrink:0}
 .mobile-history-search-row{display:flex;gap:7px;align-items:center}
 #mobile-alerts #history-search{min-width:0;flex:1;height:42px;min-height:42px;font-size:16px;margin:0;padding:8px 10px;background:#0e151e;border-color:#28364a;border-radius:8px}
 .mobile-history-filter{display:flex;align-items:center;justify-content:center;gap:5px;min-height:42px;padding:6px 9px;background:transparent;color:#a7b9d1;border:1px solid #2b394b;border-radius:8px;font-size:10px}
 .mobile-history-filter svg{width:15px;height:15px}
 #mobile-alerts #mobile-history-options{display:none;padding-top:9px}
 #mobile-alerts .mobile-history-filtering #mobile-history-options{display:block}
 #mobile-alerts .history-filters select{font-size:12px;min-height:40px;height:40px}
 #mobile-alerts .history-tools{margin-top:4px}
 #mobile-alerts .history-tools label,#mobile-alerts #history-mark-read{font-size:11px;min-height:36px}
 #mobile-alerts #history-entries{padding:0 10px 6px;scrollbar-width:thin}
 #mobile-alerts .history-day{padding:8px 6px;font-size:10px}
 #mobile-alerts .history-entry{gap:8px;padding:10px 7px;border-radius:7px}
 #mobile-alerts .history-avatar{width:26px;height:26px;flex-basis:26px;font-size:9px}
 #mobile-alerts .history-entry-heading{gap:6px}
 #mobile-alerts .history-entry-heading strong{font-size:12px}
 #mobile-alerts .history-entry-heading time{font-size:9px}
 #mobile-alerts .history-period{font-size:9px}
 #mobile-alerts .history-entry-meta{font-size:10px;line-height:1.5}
 #mobile-alerts .history-footer{padding:7px 16px max(8px,env(safe-area-inset-bottom));min-height:0;font-size:9px;line-height:1.3}
 #mobile-alerts .history-footer>span:not(.mobile-history-note){display:none}
 #mobile-alerts .history-footer .mobile-history-note{display:block;font-size:9px}
 #mobile-alerts .history-footer br,#mobile-alerts #history-settings{display:none}
 #mobile-alerts #history-pagination{padding:6px 16px;font-size:10px}
 #mobile-alerts #history-pagination button{min-height:34px;padding:5px 9px;font-size:10px}
 #mobile-alerts #alert-rules-content{min-height:0;flex:1;overflow-y:auto;overscroll-behavior:contain;padding:0 16px;scrollbar-width:thin}
 #mobile-alerts .settings-intro{margin:2px 0 12px;font-size:11px;line-height:1.6}
 #mobile-alerts .settings-section-heading{margin:12px 0 9px;gap:5px}
 #mobile-alerts .settings-section-heading h3{font-size:12px}
 #mobile-alerts .market-scope-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
 #mobile-alerts .market-scope{padding:10px 9px;gap:7px;min-height:46px;border-radius:8px}
 #mobile-alerts .market-scope strong{font-size:11px;font-weight:500}
 #mobile-alerts .market-scope small{display:none}
 #mobile-alerts .scope-count{display:none}
 #mobile-alerts .settings-section-note{font-size:10px;line-height:1.6;margin:8px 0}
 #mobile-alerts .settings-detail{margin-top:12px;padding-top:12px}
 #mobile-alerts .settings-detail summary{font-size:12px;min-height:38px;padding-bottom:4px}
 #mobile-alerts .settings-detail summary>span{font-size:10px}
 #mobile-alerts .settings-observation{font-size:10px;line-height:1.6;color:#8195af;margin:16px 0}
 #mobile-alerts .settings-footer{position:static;flex-shrink:0;padding:9px 16px max(10px,env(safe-area-inset-bottom));gap:8px;background:#101720}
 #mobile-alerts .settings-footer button{min-height:42px;font-size:11px;padding:7px 11px}
 #mobile-alerts #reset-alert-rules{font-size:10px}
 #mobile-alerts .alert-level-editor{display:grid;grid-template-columns:1fr 1fr;gap:8px}
 #mobile-alerts #level-symbol{grid-column:1/-1}
 #mobile-alerts #add-price-level{grid-column:1/-1;min-height:42px}
 #mobile-alerts #level-price,#mobile-alerts #level-direction,#mobile-alerts #level-symbol{width:100%;min-width:0;margin:0;font-size:16px}
 #mobile-alerts .price-level-row{font-size:11px;gap:8px}
 #mobile-alerts .price-level-row>span{min-width:0;overflow-wrap:anywhere}
 #mobile-alerts .price-level-row>button{min-width:40px;min-height:40px}
 #asset-chart-dialog header{max-height:none;overflow:visible;gap:4px 8px;padding:max(7px,env(safe-area-inset-top)) 12px 9px}
 #asset-chart-dialog .chart-identity{grid-column:1;grid-row:1;max-width:none;min-width:0;gap:7px}
 #asset-chart-dialog .chart-actions{gap:2px}
 #asset-chart-dialog #asset-chart-title{font-size:13px}
 #asset-chart-dialog .chart-actions a,#asset-chart-dialog #close-asset-chart{width:40px;height:42px;min-height:42px}
 #asset-chart-dialog .chart-actions .mobile-chart-details{min-height:42px;padding:6px 8px;background:transparent;border-color:#ffffff0a;font-size:11px}
 #asset-chart-dialog .chart-data-line{display:contents}
 #asset-chart-dialog .chart-asset-details{display:block;grid-column:1/-1;grid-row:3;min-width:0;margin-top:5px}
 #asset-chart-dialog .chart-asset-details:not(:has(.tip-summary)),#asset-chart-dialog .chart-secondary-metric{display:none}
 #asset-chart-dialog .chart-description>:not(.tip-summary){display:none}
 #asset-chart-dialog .chart-description .tip-summary{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;font-size:11px;line-height:1.55;color:#aebdd0;margin:0}
 #asset-chart-dialog .chart-data-line .chart-metrics{grid-column:1;grid-row:2;display:flex;gap:18px;padding:6px 0 0;margin:0;border:0;min-width:0}
 #asset-chart-dialog .chart-metrics dt{font-size:9px;margin:0 0 3px}
 #asset-chart-dialog .chart-metrics dd{font-size:11px;white-space:nowrap}
 #asset-chart-dialog .mobile-chart-price-alert{grid-column:2;grid-row:2;align-self:center;display:flex;align-items:center;justify-content:center;gap:5px;min-height:40px;padding:5px 8px;border:1px solid #344860;border-radius:7px;background:#1b2b3f;color:#c4d7ef;font-size:10px;white-space:nowrap}
 .mobile-chart-price-alert svg{width:15px;height:15px}
 #asset-chart-dialog .chart-intervals{padding:4px 10px}
 #asset-chart-dialog .chart-intervals button{min-height:36px}
 #mobile-asset-details .tip-summary{font-size:13px;line-height:1.65}
 #mobile-asset-details .tip-heading strong{font-size:18px}
 #movement-toasts .movement-toast-hint{font-size:9px;line-height:11px}
 #movement-toasts:has(.movement-toast):not(:empty){z-index:44}
 body:has(#mobile-alerts[open]) #movement-toasts{display:none}
}

/* Compact chart header on phones, including landscape touch layouts. */
@media(max-width:700px), (pointer:coarse) and (max-width:1000px) and (max-height:600px){
 #asset-chart-dialog header{gap:3px 8px;padding:max(5px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) 6px max(10px,env(safe-area-inset-left))}
 #asset-chart-dialog .chart-identity{align-self:center;max-width:none}
 #asset-chart-dialog .chart-logo{width:25px;height:25px;flex-basis:25px}
 #asset-chart-dialog #asset-chart-title{line-height:17px}
 #asset-chart-dialog .chart-symbol-line{line-height:13px}
 #asset-chart-dialog .chart-asset-details{grid-column:1/-1;grid-row:2;margin:0}
 #asset-chart-dialog .chart-description{display:block}
 #asset-chart-dialog .chart-description .tip-summary{-webkit-line-clamp:2;font-size:11px;line-height:15px;margin:0}
 #asset-chart-dialog .chart-data-line .chart-metrics{grid-column:1;grid-row:3;align-self:center;gap:12px;padding:4px 0 0;min-width:0}
 #asset-chart-dialog .chart-metrics>div{min-width:0}
 #asset-chart-dialog .chart-metrics dt{line-height:12px;margin:0 0 1px}
 #asset-chart-dialog .chart-metrics dd{font-size:11px;line-height:15px;overflow:hidden;text-overflow:ellipsis}
 #asset-chart-dialog .mobile-chart-price-alert{grid-column:2;grid-row:3;min-height:40px;padding:4px 7px;font-size:10px}
 #asset-chart-dialog .chart-intervals{padding:2px 10px}
}
