/* Mobile application shell. Desktop dashboard rules remain in styles.css. */
@media (max-width: 720px) {
  :root {
    --app-ink: #171717;
    --app-ink-2: #df2935;
    --app-gold: #df2935;
    --app-canvas: #f5f5f7;
    --app-card: #ffffff;
    --app-line: #e8e8e8;
    --app-muted: #8a8a8a;
  }

  html {
    min-height: 100%;
    background: #df2935;
  }

  body {
    min-height: 100dvh;
    padding-top: 0;
    background: var(--app-canvas);
    color: var(--app-ink);
    -webkit-tap-highlight-color: transparent;
  }

  body.mobile-menu-open {
    overflow: hidden;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 38;
    padding-top: env(safe-area-inset-top, 0px);
    border-bottom: 0;
    background: linear-gradient(118deg, #c91320 0%, #e82f3a 58%, #f34a53 100%);
    color: #fff;
    box-shadow: 0 8px 24px rgba(120, 0, 12, 0.14);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
  }

  .topbar-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 118px;
    align-items: center;
    gap: 12px;
    min-height: 76px;
    padding: 12px 16px 11px;
  }

  .brand-lockup {
    min-width: 0;
    gap: 11px;
  }

  .brand-mark {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.2);
  }

  .brand-title-row {
    gap: 7px;
  }

  h1 {
    overflow: hidden;
    color: #fff;
    font-size: 20px;
    font-weight: 760;
    letter-spacing: -0.4px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .paper-badge {
    border-color: rgba(255, 255, 255, 0.42);
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-size: 10px;
    letter-spacing: 0.5px;
  }

  .topbar .brand-subtitle {
    max-width: 230px;
    margin-top: 4px;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.58);
    font-size: 11px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-status {
    display: block;
    width: auto;
  }

  .monitor-badge {
    display: grid;
    grid-template-columns: 7px auto;
    gap: 0 6px;
    width: 118px;
    min-height: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 7px 9px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.82);
  }

  .monitor-badge .monitor-dot {
    grid-row: 1 / 3;
    align-self: center;
    width: 7px;
    height: 7px;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
  }

  .monitor-badge strong {
    max-width: none;
    overflow: hidden;
    font-size: 10px;
    font-weight: 650;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .monitor-badge > span:last-child {
    max-width: none;
    margin: 2px 0 0;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.42);
    font-size: 9px;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tabs {
    display: none;
  }

  .pull-refresh {
    top: calc(env(safe-area-inset-top, 0px) + 76px);
    border-bottom-color: #f0d4d7;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(120, 0, 12, 0.1);
  }

  main {
    max-width: none;
    padding: 12px 0 calc(104px + env(safe-area-inset-bottom, 0px));
    transform: translateY(var(--pull-page-offset, 0px));
    transition: transform 0.18s ease;
    will-change: transform;
  }

  body.pull-refresh-active main {
    transition: none;
  }

  .metrics {
    margin: 0 12px 12px;
    border: 1px solid var(--app-line);
    border-radius: 20px;
    background: var(--app-card);
    box-shadow: 0 14px 40px rgba(17, 24, 39, 0.07);
  }

  .metric {
    border-color: var(--app-line);
    padding: 12px 15px;
    background: transparent;
  }

  .metric:first-child {
    position: relative;
    min-height: 106px;
    padding: 21px 20px;
    overflow: hidden;
    background: linear-gradient(135deg, #fffafa 0%, #ffe7e9 100%);
    color: var(--app-ink);
  }

  .metric:first-child::after {
    position: absolute;
    top: -42px;
    right: -32px;
    width: 142px;
    height: 142px;
    border: 1px solid rgba(223, 41, 53, 0.2);
    border-radius: 50%;
    box-shadow: 0 0 0 22px rgba(223, 41, 53, 0.055);
    content: "";
  }

  .metric:first-child strong {
    position: relative;
    z-index: 1;
    margin-top: 9px;
    font-size: 32px;
    font-weight: 720;
    letter-spacing: -1.1px;
    color: #8f1f28;
  }

  .metric:first-child span {
    position: relative;
    z-index: 1;
    color: #a5656b;
    font-size: 12px;
    letter-spacing: 0.8px;
  }

  .panel,
  .account-panel-shell {
    margin-right: 12px;
    margin-left: 12px;
    border: 1px solid var(--app-line);
    border-radius: 18px;
    background: var(--app-card);
    box-shadow: 0 10px 32px rgba(17, 24, 39, 0.055);
  }

  .account-panel-shell {
    overflow: visible;
  }

  .account-panel-title {
    padding: 17px 16px 0;
  }

  .account-panel-title h2,
  .section-head h2 {
    color: var(--app-ink);
    font-size: 19px;
    font-weight: 750;
    letter-spacing: -0.3px;
  }

  .account-panel-title .section-count {
    width: auto;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    padding: 0 6px;
    background: #d47a80;
    color: #ffffff;
    font-size: 11px;
  }

  .panel.account-tab-panel {
    margin: 58px 0 0;
    border: 0;
    border-radius: 0 0 18px 18px;
    box-shadow: none;
  }

  .segmented.account-filter {
    top: -46px;
    gap: 5px;
    padding: 4px;
    border: 1px solid var(--app-line);
    border-radius: 13px;
    background: #f5f5f5;
  }

  .account-filter-btn {
    min-width: 0;
    min-height: 37px;
    border: 0;
    border-radius: 9px;
    padding: 6px 10px;
    background: transparent;
    color: #666b73;
    font-size: 13px;
    box-shadow: none;
  }

  .account-filter-btn.active {
    min-height: 37px;
    background: #fff;
    color: var(--accent);
    box-shadow: 0 3px 12px rgba(17, 24, 39, 0.08);
  }

  .position-summary {
    border-color: var(--app-line);
  }

  .market-list-head,
  .recommendation-list-head {
    border-color: var(--app-line);
    background: #fafafa;
    color: #8a8b8d;
  }

  .mobile-cards {
    border-radius: 0 0 18px 18px;
    background: transparent;
  }

  .market-line {
    border-color: var(--app-line);
    background: transparent;
  }

  .mobile-card,
  .mobile-empty {
    border-color: var(--app-line);
    border-radius: 12px;
    background: #fff;
  }

  #decisions .item {
    gap: 4px;
    padding: 10px 12px;
  }

  #decisions .item time {
    font-size: 11px;
    line-height: 1.3;
  }

  #decisions .item strong {
    margin-bottom: 2px;
    font-size: 13px;
    line-height: 1.35;
  }

  #decisions .item p {
    font-size: 13px;
    line-height: 1.45;
  }

  .mobile-real-nav.mobile-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1px;
    min-height: 68px;
    border: 0;
    border-top: 1px solid #e7e7e8;
    border-radius: 18px 18px 0 0;
    padding: 7px 5px calc(7px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -7px 24px rgba(23, 23, 23, 0.09);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
  }

  .mobile-app-nav-item {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    border: 0;
    border-radius: 15px;
    padding: 4px 2px;
    background: transparent;
    color: #7b7d81;
  }

  .mobile-app-nav-item svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
  }

  .mobile-app-nav-item:first-child svg,
  .mobile-app-nav-item:nth-child(2) svg {
    fill: currentColor;
    stroke: none;
  }

  .mobile-app-nav-item strong {
    font-size: 10px;
    font-weight: 650;
    line-height: 1;
  }

  .mobile-app-nav-item.active,
  .mobile-app-nav-item.more-active {
    color: var(--accent);
  }

  .mobile-app-nav-item.active::after,
  .mobile-app-nav-item.more-active::after {
    position: absolute;
    bottom: 1px;
    width: 15px;
    height: 2px;
    border-radius: 999px;
    background: var(--accent);
    content: "";
  }

  .mobile-app-nav-primary-icon {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 10px;
    background: var(--accent);
    color: #ffffff;
    font-family: Georgia, serif;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 5px 12px rgba(223, 41, 53, 0.22);
  }

  .mobile-app-nav-primary.active .mobile-app-nav-primary-icon {
    background: #c91320;
  }

  .mobile-nav-status {
    display: none;
  }

  .mobile-more-layer {
    position: fixed;
    inset: 0;
    z-index: 120;
  }

  .mobile-more-layer[hidden] {
    display: none !important;
  }

  .mobile-more-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    padding: 0;
    background: rgba(7, 12, 20, 0.54);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
  }

  .mobile-more-sheet {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 26px 26px 0 0;
    padding: 9px 16px calc(22px + env(safe-area-inset-bottom, 0px));
    background: #f7f7f7;
    box-shadow: 0 -18px 60px rgba(7, 12, 20, 0.22);
  }

  .mobile-more-handle {
    width: 38px;
    height: 4px;
    margin: 0 auto 13px;
    border-radius: 999px;
    background: #d4d1ca;
  }

  .mobile-more-sheet > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
  }

  .mobile-more-sheet header span {
    color: var(--accent);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 1.4px;
  }

  .mobile-more-sheet header h2 {
    margin-top: 2px;
    color: var(--app-ink);
    font-size: 22px;
    letter-spacing: -0.5px;
  }

  .mobile-more-close {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #eeeeee;
    color: #65676b;
    font-size: 23px;
    font-weight: 300;
    line-height: 1;
  }

  .mobile-more-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .mobile-more-grid :is(button, a) {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 2px 10px;
    min-height: 78px;
    align-items: center;
    border: 1px solid var(--app-line);
    border-radius: 16px;
    padding: 12px;
    background: #fff;
    color: var(--app-ink);
    text-align: left;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(17, 24, 39, 0.045);
  }

  .mobile-more-grid :is(button, a) > span {
    display: grid;
    grid-row: 1 / 3;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 11px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 18px;
    font-weight: 700;
  }

  .mobile-more-grid strong {
    align-self: end;
    font-size: 14px;
    line-height: 1.2;
  }

  .mobile-more-grid em {
    align-self: start;
    overflow: hidden;
    color: var(--app-muted);
    font-size: 10px;
    font-style: normal;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-detail-page {
    padding-top: env(safe-area-inset-top, 0px);
    background: var(--app-canvas);
  }

  .detail-page-header {
    border-color: var(--app-line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }
}

@media (max-width: 360px) {
  .topbar-inner {
    padding-right: 12px;
    padding-left: 12px;
  }

  .brand-mark {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
  }

  h1 {
    font-size: 18px;
  }

  .paper-badge,
  .topbar .brand-subtitle {
    display: none;
  }

  .mobile-real-nav.mobile-bottom-nav {
    right: 0;
    left: 0;
  }
}

@media (max-width: 720px) {
  #view-monitor .intraday-monitor-panel {
    margin-top: 10px;
    margin-bottom: 18px;
  }

  .intraday-monitor-head {
    align-items: flex-start;
  }

  .intraday-monitor-head .section-action {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .intraday-monitor-status {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 10px 10px 0;
  }

  .intraday-monitor-chip {
    display: block;
    min-width: 0;
    padding: 10px 8px;
    text-align: left;
  }

  .intraday-monitor-chip .intraday-live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 4px;
    vertical-align: 1px;
  }

  .intraday-monitor-chip div {
    display: inline;
  }

  .intraday-monitor-chip strong {
    display: inline;
    font-size: 12px;
  }

  .intraday-monitor-chip em {
    margin: 4px 0 0;
    font-size: 9px;
  }

  .intraday-monitor-chip p {
    margin-top: 5px;
    text-align: left;
    font-size: 10px;
  }

  .intraday-monitor-chip small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .intraday-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 10px 10px 0;
  }

  .intraday-summary > div {
    padding: 10px 11px;
  }

  .intraday-summary > div:nth-child(3) {
    border-top: 1px solid #eceff1;
    border-left: 0;
  }

  .intraday-summary > div:nth-child(4) {
    border-top: 1px solid #eceff1;
  }

  .intraday-summary strong {
    font-size: 17px;
  }

  .intraday-source-filter {
    display: flex;
    width: calc(100% - 20px);
    margin: 10px 10px 2px;
    overflow-x: auto;
    border: 0;
    background: transparent;
    scrollbar-width: none;
  }

  .intraday-source-filter::-webkit-scrollbar {
    display: none;
  }

  .intraday-source-filter .account-filter-btn {
    flex: 0 0 auto;
    min-width: 70px;
  }

  .intraday-decision-list {
    gap: 8px;
    padding: 8px 10px 12px;
  }

  .intraday-decision-card {
    border-radius: 9px;
  }

  .intraday-decision-card > header {
    padding: 10px 11px 7px 13px;
  }

  .intraday-decision-title {
    align-items: flex-start;
    padding: 0 11px 8px 13px;
  }

  .intraday-decision-title strong {
    font-size: 15px;
  }

  .intraday-decision-title b {
    font-size: 13px;
  }

  .intraday-thesis {
    padding: 0 11px 10px 13px;
    font-size: 13px;
    line-height: 1.62;
  }

  .intraday-stage-flow {
    gap: 5px;
    padding: 8px 11px 8px 13px;
  }

  .intraday-detail summary {
    padding: 10px 13px;
  }

  .intraday-evidence-grid {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 0 11px 10px 13px;
  }

  .intraday-next {
    margin: 0 11px 10px 13px;
  }

  .intraday-notice {
    padding: 10px 12px 12px;
  }

  .section-action {
    -webkit-tap-highlight-color: transparent;
  }

  .intraday-filter-stack {
    gap: 9px;
    margin: 10px 10px 2px;
  }

  .intraday-filter-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .intraday-filter-row > strong {
    padding-left: 2px;
    font-size: 11px;
  }

  .intraday-filter-row .intraday-source-filter {
    width: 100%;
    margin: 0;
  }

  .intraday-filter-panel {
    margin: 10px 10px 0;
    border-color: #e7b4b8;
    padding: 11px;
    box-shadow: 0 4px 12px rgba(121, 24, 33, 0.06);
  }

  .intraday-filter-title {
    margin-bottom: 8px;
  }

  .intraday-filter-title strong {
    font-size: 14px;
  }

  .intraday-filter-controls {
    gap: 8px;
  }

  .intraday-filter-controls select {
    min-height: 40px;
    font-size: 13px;
  }
}
