.app-dialog { width: min(500px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow: auto; padding: 24px; border: 1px solid var(--control-line); border-radius: 14px; background: var(--surface); color: var(--ink); }
.app-dialog::backdrop { background: #070810ba; }
.dialog-heading { display: flex; gap: 20px; justify-content: space-between; align-items: start; }
.dialog-heading h2 { padding-top: 8px; }
.app-dialog h3 { font-size: 16px; margin-bottom: 0; }
.app-dialog summary { padding-block: 12px; }
.connection-banner { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 200; width: min(600px, calc(100% - 32px)); margin: 0; padding: 12px 16px; border: 1px solid var(--warning); border-radius: 8px; background: var(--surface); color: var(--warning); font-size: 14px; box-shadow: 0 4px 24px #0005; }
.auth-install { display: block; margin: 20px auto 0; }
.segmented button[aria-pressed="true"]:hover:enabled { background: var(--accent); color: var(--paper); }
.mobile-nav, #mobile-search-toggle { display: none; }
.home-phone-links, .holding-mobile-tools, .mobile-cell-label { display: none; }
html:has(dialog[open]) { overflow: hidden; }
.mobile-menu nav { display: grid; margin: 16px 0; }
.mobile-menu nav a { padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-weight: 600; }
.mobile-menu nav a span { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.mobile-menu-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.mobile-menu-actions a { padding-block: 12px; color: var(--cyan); }
.mobile-menu-actions form { margin: 0; }
@media (max-width: 767px), (max-width: 1000px) and (pointer: coarse) {
  body { font-size: 16px; }
  button, select, input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), summary { min-height: 44px; }
  input, select, textarea { font-size: 16px; }
  .mobile-shell .masthead { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; min-height: 64px; padding: calc(10px + env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 10px max(16px,env(safe-area-inset-left)); }
  .mobile-shell .brand { font-size: 18px; }
  .mobile-shell .brand span { font-size: 11px; }
  #mobile-search-toggle { display: block; }
  .mobile-shell .masthead .admin-menu, #nav-toggle, .mobile-shell .section-nav { display: none; }
  .mobile-shell .global-search { display: none; grid-column: 1/-1; grid-row: auto; }
  .mobile-shell .masthead.search-open .global-search { display: flex; }
  .mobile-shell main { margin-left: 0; padding: 22px max(16px,env(safe-area-inset-right)) calc(100px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)); }
  main > [data-workspace], .research-step, #home-holdings-heading, #briefing-heading { scroll-margin-top: calc(90px + env(safe-area-inset-top)); }
  .mobile-nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); position: fixed; z-index: 80; inset: auto 0 0; border-top: 1px solid var(--line); padding: 6px max(8px,env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); background: var(--surface); }
  .mobile-nav a, .mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 54px; padding: 6px 4px; color: var(--muted); background: none; border: 0; border-radius: 8px; text-decoration: none; font: 600 12px/1.2 "Segoe UI",sans-serif; }
  .mobile-nav [aria-current="page"] { color: var(--accent); background: #bd93f917; }
  .mobile-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
  .mobile-nav a:active, .mobile-nav button:active { background: var(--soft); }
  .mobile-menu { margin: auto auto max(8px,env(safe-area-inset-bottom)); width: calc(100% - 16px); max-height: calc(100dvh - 24px - env(safe-area-inset-top)); padding: 20px; }
  .connection-banner { bottom: calc(78px + env(safe-area-inset-bottom)); }
  .auth-page { padding: max(20px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)); min-height: 100dvh; }
  main.auth-panel { padding: 24px; }
  .auth-actions { flex-wrap: wrap; }
  .text-link, .auth-actions a { display: inline-flex; min-height: 44px; align-items: center; }
  .dashboard-caption, .data-note, .home-refresh-state, .muted { font-size: 13px; }
  .dashboard-chart-inspector { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .dashboard-chart-inspector input { grid-column: 1/-1; order: 1; }
  .dashboard-chart-inspector span { grid-column: 1/-1; order: 2; font-size: 13px; line-height: 1.6; }
  .dashboard-chart-inspector label, .dashboard-chart-inspector button { font-size: 13px; }
  .bar-values dt { font-size: 12px; }
  .bar-values dd { font-size: 15px; }
  .finance-actions { gap: 12px; }
  .filter-form input, .filter-form select { width: 100%; }
  .inline-check, .inline-check input, .home-account-card .account-include { min-height: 44px; }
  .inline-check input { min-height: initial; width: 20px; height: 20px; }
  .home-account-card .account-include { font-size: 14px; }
  .home-account-card input { width: 20px; height: 20px; flex-shrink: 0; }
  .research-flow { flex-wrap: wrap; }
  .research-flow li { flex-basis: 130px; }
  #dashboard { display: flex; flex-direction: column; }
  #dashboard > .home-heading { order: -6; margin-bottom: 8px; gap: 10px; }
  .home-heading .eyebrow { display: none; }
  .home-heading h1 { font-size: 24px; }
  #home-error, #home-notice { order: -5; }
  #dashboard > .home-summary { order: -4; border-top: 0; padding: 20px 0; gap: 20px; }
  .home-value > strong { font-size: 38px; }
  .home-totals { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px 22px; }
  .home-totals dt { font-size: 13px; }
  .home-totals dd { font-size: 20px; }
  .home-value .muted { font-size: 13px; }
  .home-phone-links { order: -3; display: flex; gap: 12px; padding-top: 12px; }
  .home-phone-links a { flex: 1; min-height: 44px; display: grid; place-items: center; padding: 8px; color: var(--cyan); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 600; }
  #dashboard > .home-toolbar { order: -2; margin: 20px 0 8px; gap: 12px; }
  .home-toolbar > div { display: grid; gap: 8px; width: 100%; }
  .home-toolbar label { font-size: 14px; }
  .home-toolbar select { width: 100%; max-width: 100%; }
  .home-control-actions > button { width: 100%; }
  .home-control-actions > a { justify-self: start; }
  #home-refresh-state { order: -1; margin: 4px 0 12px; }
  .investment-briefing { margin-top: 12px; padding-block: 20px; }
  .briefing-layout { gap: 16px; }
  .briefing-movers small { font-size: 12px; }
  .briefing-movers a { display: inline-flex; align-items: center; min-height: 44px; }
  .collection-status { font-size: 14px; padding-top: 16px; }
  .collection-status summary { display: flex; align-items: center; color: var(--cyan); cursor: pointer; }
  .collection-status summary::after { content: '+'; margin-left: auto; }
  .collection-status details[open] summary::after { content: '−'; }
  .home-account-card .account-date, .home-account-card .account-coverage { font-size: 13px; }
  .home-account-card button { font-size: 14px; }
  .home-holdings-section .dashboard-section-heading { display: grid; gap: 16px; }
  .holding-tools { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 10px; }
  .home-search { font-size: 14px; }
  .home-search input { min-width: 0; width: 100%; }
  .holding-tools > button { padding-inline: 10px; }
  .holding-mobile-tools { display: grid; gap: 14px; margin-block: 18px 4px; }
  .holding-mobile-tools .segmented button { flex: 1; }
  .holding-mobile-sort { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 10px; align-items: center; }
  .holding-mobile-sort label { grid-column: 1/-1; font-size: 13px; color: var(--muted); }
  .holding-mobile-sort select { width: 100%; min-width: 0; }
  .holding-mobile-sort button { font-size: 13px; }
  .holdings-scroll { overflow: visible; border: 0; margin-top: 4px; }
  .home-holdings-section table, .home-holdings-section tbody { display: block; width: 100%; min-width: 0; }
  .home-holdings-section thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .holding-main { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
  .home-holdings-section .holding-main > td { position: static; min-width: 0; width: auto; display: block; text-align: left; padding: 0; border: 0; box-shadow: none; background: none; }
  .holding-main .holding-name { grid-column: 1/-1; }
  .holding-name-line { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 10px; }
  .holding-name-line .symbol-link { font-size: 17px; min-height: 44px; display: flex; align-items: center; }
  .holding-detail-toggle { width: 44px; height: 44px; font-size: 22px; }
  .holding-chart-button { font-size: 13px; min-width: 52px; min-height: 44px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; }
  .holding-name .home-holding-name { padding: 0; margin-top: 6px; white-space: normal; font-size: 13px; line-height: 1.5; }
  .mobile-cell-label { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-bottom: 5px; }
  .home-holdings-section .holding-value { font-size: 21px; font-weight: 600; overflow-wrap: anywhere; }
  .holding-price strong { font-size: 18px; overflow-wrap: anywhere; }
  .holding-price small { font-size: 12px; }
  .home-holdings-section .holding-main .holding-change { display: none; }
  .home-holdings-section .holding-main .holding-change.phone-period { display: flex; grid-column: 1/-1; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding-top: 12px; border-top: 1px solid var(--line); }
  .holding-change .mobile-cell-label { flex: 1 0 100%; }
  .holding-change strong { font-size: 18px; }
  .holding-change small { font-size: 14px; margin: 0; }
  .home-holdings-section .holding-main .holding-weight { display: none; }
  .holding-main:has(+ .holding-details:not([hidden])) { border-radius: 10px 10px 0 0; }
  .holding-details, .holding-details > td { display: block; }
  .holding-details > td { padding: 16px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; }
  .holding-metadata { display: grid; gap: 8px; font-size: 14px; }
  .holding-comparisons, .home-contributions { font-size: 13px; line-height: 1.6; }
  .home-contributions { padding-left: 18px; }
  .holding-preview { bottom: calc(78px + env(safe-area-inset-bottom)) !important; top: auto !important; left: max(12px,env(safe-area-inset-left)) !important; right: max(12px,env(safe-area-inset-right)) !important; width: auto; max-height: calc(100dvh - 160px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border-radius: 12px; }
  .holding-preview-header button { font-size: 14px; min-width: 60px; }
  .holding-preview > .muted, .holding-preview-source, .holding-preview-readout { font-size: 13px; }
  .holding-preview .text-link { font-size: 14px; }
  .holding-totals dt { font-size: 13px; }
  .holding-totals dd { font-size: 23px; }
  .holding-history-section { margin-top: 24px; }
  .holding-breadcrumb { margin-bottom: 12px; }
}
