html.android-shell,
html.android-shell body {
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-x: none;
}

html.android-shell body {
  overflow-x: hidden;
}

html.android-shell .wrap {
  padding: 8px;
}

html.android-shell .layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

html.android-shell .main {
  order: 1;
  width: 100%;
  min-width: 0;
}

html.android-shell .sidebar {
  order: 2;
  position: static;
  width: 100%;
  max-height: none;
}

html.android-shell .sidebar-resize {
  display: none;
}

html.android-shell .table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

html.android-shell .table-wrap.android-cardified {
  overflow: visible;
}

html.android-shell #fundBoard .table-wrap.android-cardified > table,
html.android-shell #etfBoard .table-wrap.android-cardified > table {
  display: none;
}

html.android-shell .android-fund-cards,
html.android-shell .android-etf-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}

html.android-shell .android-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

html.android-shell .android-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

html.android-shell .android-card-title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
}

html.android-shell .android-card-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

html.android-shell .android-chip {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
}

html.android-shell .android-chip.up {
  color: var(--up);
  background: #fdeaea;
}

html.android-shell .android-chip.down {
  color: var(--down);
  background: #eaf6ef;
}

html.android-shell .android-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

html.android-shell .android-metric {
  min-width: 0;
  padding: 8px;
  border: 1px solid #e3ebf3;
  border-radius: 10px;
  background: color-mix(in srgb, var(--brand) 5%, var(--panel));
}

html.android-shell .android-metric-label {
  color: var(--muted);
  font-size: 11px;
}

html.android-shell .android-metric-value {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

html.android-shell .android-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

html.android-shell .fund-table .fund-live-cell {
  min-width: 132px;
  padding: 7px 9px;
}

html.android-shell .fund-live-main {
  font-size: 14px;
}

html.android-shell .fund-live-sub {
  font-size: 10px;
}

@media (max-width: 760px) {
  body {
    font-size: 14px;
  }

  .wrap {
    padding: 8px;
  }

  .layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .main {
    order: 1;
    width: 100%;
    min-width: 0;
  }

  .sidebar {
    order: 2;
    position: static;
    width: 100%;
    max-height: none;
  }

  .sidebar-resize {
    display: none;
  }

  .header {
    align-items: flex-start;
  }

  .brand-block {
    gap: 10px;
  }

  .brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  h1 {
    font-size: 19px;
    line-height: 1.2;
  }

  .meta {
    font-size: 11px;
    overflow-wrap: anywhere;
  }

  input,
  select,
  button {
    min-height: 44px;
    font-size: 13px;
  }

  .workspace-controls.controls {
    grid-template-columns: 1fr;
  }

  .workspace-controls .control-group,
  .workspace-controls .control-group-maintenance {
    width: 100%;
  }

  .controls,
  .etf-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .controls > *,
  .etf-toolbar > * {
    width: 100%;
    min-width: 0;
  }

  .tabs {
    top: 0;
    z-index: 60;
    padding: 6px 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  .tab-btn {
    flex: 0 0 auto;
    min-height: 44px;
    text-align: center;
    scroll-snap-align: start;
  }

  .tabs.workspace-nav .nav-group {
    flex: 0 0 auto;
    width: auto;
    overflow: visible;
  }

  .tabs.workspace-nav .nav-group-label {
    min-width: auto;
  }

  .panel {
    margin-top: 8px;
    border-radius: 10px;
  }

  .section {
    padding: 8px 10px;
    font-size: 12px;
  }

  .row,
  .editor,
  .inline-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
  }

  .inline-editor {
    display: grid;
  }

  .inline-editor .actions,
  .inline-editor .note {
    grid-column: 1 / -1;
  }

  .inline-editor .actions {
    grid-row: auto;
    order: -2;
    min-width: 0;
    padding-right: 0;
    padding-bottom: 8px;
    border-right: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--brand) 16%, var(--line));
  }

  .inline-editor .actions button {
    flex: 1 1 88px;
    min-height: 44px;
  }

  .summary,
  .capital-flow-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  .card {
    min-width: 0;
    padding: 8px;
  }

  .k {
    font-size: 11px;
  }

  .v {
    font-size: clamp(14px, 4.2vw, 18px);
    overflow-wrap: anywhere;
  }

  .mg-grid,
  .etf-theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .m-item,
  .etf-theme-card {
    min-width: 0;
    min-height: 116px;
    padding: 8px;
  }

  .m-price {
    font-size: 16px;
  }

  .chart-head {
    align-items: flex-start;
    padding: 9px 10px;
  }

  .chart-head > span:first-child {
    flex: 1 0 100%;
  }

  .flow-tools {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
  }

  .flow-tools > * {
    width: 100%;
    min-width: 0;
  }

  #chart,
  .flow-chart {
    height: clamp(260px, 66vh, 430px);
    min-height: 260px;
  }

  .chart-resize-handle {
    height: 24px;
  }

  .legend {
    max-height: 128px;
    overflow: auto;
    padding: 6px 8px;
  }

  .legend-item {
    font-size: 11px;
    line-height: 1.25;
  }

  .fund-detail-grid,
  .etf-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fund-history-chart,
  .etf-flow-chart,
  .etf-price-kline {
    height: 200px;
  }

  .treemap-panel,
  .fund-detail,
  .etf-detail {
    padding: 8px;
  }

  .treemap-wrap {
    min-height: 240px;
  }

  .calendar-grid {
    gap: 5px;
    padding: 8px;
  }

  .calendar-nav {
    width: 100%;
    justify-content: space-between;
  }

  .calendar-month-total {
    flex: 1 1 100%;
    justify-content: center;
  }

  .cal-day {
    min-height: 68px;
    padding: 5px;
  }

  .cal-date {
    font-size: clamp(9px, 2.5vw, 12px);
  }

  .cal-pnl {
    font-size: clamp(10px, 3.2vw, 13px);
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .cal-rate {
    font-size: clamp(9px, 2.6vw, 12px);
    line-height: 1.15;
  }

  .hot-toolbar {
    gap: 6px;
  }

  .hot-toolbar > * {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }

  .fund-table .fund-live-cell {
    min-width: 132px;
    padding: 7px 9px;
  }

  .fund-live-main {
    font-size: 14px;
  }

  .fund-live-sub {
    font-size: 10px;
  }
}

@media (max-width: 430px) {
  .controls,
  .etf-toolbar,
  .row,
  .editor,
  .inline-editor,
  .flow-tools,
  .fund-detail-grid,
  .etf-detail-grid {
    grid-template-columns: 1fr;
  }

  .summary,
  .capital-flow-summary,
  .mg-grid,
  .etf-theme-grid,
  html.android-shell .android-grid {
    grid-template-columns: 1fr !important;
  }

  #chart,
  .flow-chart {
    height: clamp(280px, 70vh, 460px);
  }
}

@media (max-width: 800px) {
  .tabs.workspace-nav {
    flex-wrap: wrap;
    overflow: visible;
    gap: 6px;
    padding: 6px 0 8px;
    max-height: min(56vh, 420px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-snap-type: none;
  }

  .tabs.workspace-nav .nav-group {
    width: 100%;
    flex: 1 0 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .tabs.workspace-nav .nav-group-label {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 42px;
    background: color-mix(in srgb, var(--bg) 94%, var(--panel));
  }

  .workspace-nav .control-group-refresh {
    flex: 1 0 100%;
    width: 100%;
    margin-left: 0;
    gap: 6px;
  }

  .workspace-nav .control-group-refresh .control-group-label {
    flex: 0 0 auto;
  }

  .workspace-nav .control-group-refresh label {
    display: none;
  }

  .workspace-nav .control-group-refresh select {
    flex: 1 1 96px;
    min-width: 84px;
  }

  .workspace-nav .control-group-refresh button {
    flex: 1 1 86px;
    min-height: 40px;
  }

}
