* {
  box-sizing: border-box;
}

:root {
  --bg: #eef2f3;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --line: #d7dee1;
  --line-soft: #e9eef0;
  --text: #172126;
  --muted: #65747b;
  --strong: #0d1113;
  --accent: #167f5f;
  --accent-strong: #0f624a;
  --danger: #c2413b;
  --warn: #b7791f;
  --shadow: 0 12px 28px rgba(20, 31, 36, 0.07);
  --shadow-soft: 0 6px 16px rgba(20, 31, 36, 0.045);
}

body {
  margin: 0;
  min-width: 1120px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: 0;
}

h1 {
  font-size: 19px;
  color: var(--strong);
}

h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

h3 {
  font-size: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 70px;
  padding: 11px 20px;
  background: rgba(255, 255, 255, 0.97);
  color: var(--text);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 5px 18px rgba(20, 31, 36, 0.045);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: center;
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
}

.brand .sub {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.top-right {
  display: grid;
  grid-template-columns: auto auto;
  gap: 10px 14px;
  align-items: center;
  justify-items: end;
}

.top-tags,
.top-actions {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-tags {
  grid-column: 1 / 2;
}

.top-actions {
  grid-column: 2 / 3;
}

.op-status {
  grid-column: 1 / 3;
  font-size: 12px;
  max-width: 760px;
  min-height: 16px;
  text-align: right;
}

.workspace {
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  min-height: calc(100vh - 70px);
}

.side-nav {
  position: sticky;
  top: 70px;
  align-self: start;
  height: calc(100vh - 70px);
  padding: 14px 12px;
  background: #fbfcfc;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.side-nav-btn {
  width: 100%;
  height: 38px;
  justify-content: flex-start;
  text-align: left;
  color: var(--text);
  background: transparent;
  border-color: transparent;
  border-radius: 6px;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.side-nav-btn:hover {
  background: #eef6f3;
  border-color: #d1e7df;
  color: var(--accent-strong);
}

.side-nav-btn.is-active {
  background: #dff3ec;
  border-color: #b8ded1;
  color: var(--accent-strong);
  box-shadow: inset 3px 0 0 var(--accent);
}

.bottom-nav {
  display: none;
}

.layout {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-content: start;
  gap: 14px;
}

.panel {
  grid-column: span 12;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  box-shadow: var(--shadow);
}

.panel.inset {
  border-color: var(--line-soft);
  background: var(--panel-soft);
  box-shadow: none;
}

[data-view].is-hidden {
  display: none !important;
}

#incomePanel {
  order: -3;
}

#balancePanel {
  order: -2;
}

#symbolsPanel {
  order: -1;
}

#strategyEditorPanel {
  grid-column: span 5;
}

#strategiesPanel {
  grid-column: span 7;
}

#positionsPanel,
#enginePanel,
#signalsPanel,
#orderLogsPanel,
#pnlReviewPanel {
  grid-column: span 12;
}

.panel-head,
.panel-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2,
.panel-subhead h3 {
  margin: 0;
}

.panel-actions {
  margin-bottom: 0;
  justify-content: flex-end;
}

.engine-status-grid {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(130px, 0.8fr) minmax(130px, 0.8fr) minmax(110px, 0.7fr) minmax(220px, 1.8fr);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 10px;
}

.engine-stat {
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--line-soft);
}

.engine-stat:last-child {
  border-right: 0;
}

.engine-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.engine-stat strong {
  display: block;
  min-width: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.engine-stat .tag {
  display: inline-flex;
  margin-bottom: 0;
}

.engine-status-text {
  display: none;
}

.engine-stat strong.is-danger {
  color: var(--danger);
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.row.wrap {
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
  gap: 10px;
}

#strategyEditorPanel .form-grid {
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}

.strategy-section-title {
  grid-column: 1 / -1;
  min-height: 28px;
  display: flex;
  align-items: center;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.strategy-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.strategy-preview {
  margin-top: 12px;
  border: 1px solid #bddbcf;
  border-radius: 8px;
  background: #f4fbf8;
  padding: 11px 12px;
}

.strategy-preview-title {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.strategy-preview-text {
  color: #24353b;
  font-size: 13px;
  line-height: 1.6;
}

.form-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.market-filter-box {
  margin: 8px 0 12px;
  border: 1px solid #dce8e4;
  border-radius: 8px;
  background: #f8fbfa;
}

.market-filter-box summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.market-filter-controls {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  padding: 0 12px 10px;
  align-items: end;
}

.market-filter-status {
  padding: 0 12px 10px;
  font-size: 12px;
}

.market-filter-table {
  margin: 0 12px 12px;
  max-height: 360px;
}

.market-filter-table table {
  min-width: 760px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span,
label {
  font-size: 12px;
  color: var(--muted);
}

input,
select,
button {
  height: 34px;
  border: 1px solid #c9d3d8;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
}

input,
select {
  background: #ffffff;
  color: var(--text);
}

.small-input {
  width: 76px;
}

input:focus,
select:focus,
.textarea:focus {
  outline: 2px solid rgba(22, 127, 95, 0.18);
  border-color: var(--accent);
}

.textarea {
  width: 100%;
  min-height: 90px;
  border: 1px solid #c9d3d8;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  resize: vertical;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #263238;
  color: #ffffff;
  border-color: #263238;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  background: #11191d;
  box-shadow: 0 6px 16px rgba(20, 31, 36, 0.12);
}

button.secondary {
  background: #ffffff;
  color: var(--text);
  border-color: #d4dcdf;
}

button.secondary:hover {
  background: #eef6f3;
  border-color: #b8ded1;
  color: var(--accent-strong);
  box-shadow: none;
}

.top-actions button {
  background: #ffffff;
  color: var(--text);
  border-color: #d4dcdf;
}

.top-actions button:hover {
  background: #eef6f3;
  border-color: #b8ded1;
  color: var(--accent-strong);
  box-shadow: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(20, 31, 36, 0.02);
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 8px;
}

.section-title-row h3 {
  margin: 0;
  font-size: 15px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #ffffff;
}

th,
td {
  border-top: 1px solid var(--line-soft);
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #f7faf9;
  z-index: 1;
  color: #46545a;
  font-size: 12px;
  font-weight: 650;
}

tbody tr:hover {
  background: #f8fcfa;
}

#strategiesTable {
  table-layout: fixed;
  min-width: 1180px;
}

#strategiesTable td:nth-child(5),
#strategiesTable td:nth-child(9),
#strategiesTable td:last-child {
  white-space: normal;
  word-break: break-word;
}

#strategiesTable td:last-child button {
  height: 30px;
  margin: 0 6px 6px 0;
}

.strategy-table-fallback {
  display: none;
}

.strategy-cards {
  display: grid;
  gap: 10px;
}

.strategy-bulk-toolbar {
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fbfa;
}

.strategy-bulk-toolbar button {
  height: 32px;
}

.strategy-empty {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #c9d3d8;
  border-radius: 8px;
  background: #fbfcfc;
  color: var(--muted);
  font-size: 13px;
}

.strategy-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-left: 4px solid #9aa8ae;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.strategy-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  align-self: start;
  white-space: nowrap;
}

.strategy-select input,
.check-line input,
input[data-strategy-select] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.strategy-card.is-running {
  border-left-color: var(--accent);
}

.strategy-card.is-stopped {
  border-left-color: #9aa8ae;
  background: #fbfcfc;
}

.strategy-card-main {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.strategy-card-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.strategy-card-title strong {
  color: var(--strong);
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-symbol {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.strategy-card-badges,
.strategy-card-metrics,
.strategy-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.strategy-card-trigger {
  color: #25343a;
  font-size: 13px;
  line-height: 1.45;
}

.strategy-card-metrics {
  color: var(--muted);
  font-size: 12px;
}

.strategy-card-metrics span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f4f6f7;
}

.strategy-card-actions {
  justify-content: flex-end;
  align-content: start;
}

.strategy-card-actions button {
  height: 30px;
}

.strategy-card-details {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}

.strategy-card-details summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

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

.strategy-detail-grid div {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #fbfcfc;
  padding: 8px;
}

.strategy-detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.strategy-detail-grid strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.tag {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid #d4dcdf;
  border-radius: 6px;
  background: #f9fbfb;
  color: #3c4a50;
  font-size: 12px;
  font-weight: 600;
}

.tag.is-danger {
  border-color: #efb2ae;
  background: #fff4f3;
  color: var(--danger);
  font-weight: 700;
}

.tag.is-ok {
  border-color: #b8ded1;
  background: #effaf6;
  color: var(--accent-strong);
  font-weight: 700;
}

.form-hint {
  min-height: 20px;
  font-size: 12px;
  line-height: 1.5;
}

.form-hint.is-error,
.op-status.is-error {
  color: var(--danger);
}

.form-hint.is-success,
.op-status.is-success {
  color: var(--accent-strong);
}

.advanced-settings {
  margin: 12px 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 10px;
}

.advanced-settings summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.advanced-settings .form-grid {
  margin-top: 10px;
}

.advanced-actions {
  margin: 10px 0 0;
}

.conn-light {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  display: inline-block;
  outline: 1px solid rgba(20, 31, 36, 0.16);
}

.conn-light.is-green {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.65);
}

.conn-light.is-yellow {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.65);
}

.conn-light.is-red {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.65);
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.inline-check input {
  width: 14px;
  height: 14px;
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 11px;
  line-height: 1.35;
}

.num-up {
  color: var(--accent-strong);
  font-weight: 700;
}

.num-down {
  color: var(--danger);
  font-weight: 700;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
}

.up {
  color: #16834f;
}

.down {
  color: var(--danger);
}

.income-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  font-size: 13px;
}

.income-grid > div {
  min-height: 76px;
  border: 1px solid #e1e7e9;
  border-radius: 8px;
  padding: 12px 13px;
  background: #ffffff;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-soft);
}

.income-grid strong {
  color: var(--strong);
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0;
}

.income-grid strong.num-up {
  color: var(--accent-strong);
}

.income-grid strong.num-down {
  color: var(--danger);
}

.balance-hint {
  margin: -4px 0 10px;
  font-size: 12px;
}

.balance-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
  font-size: 13px;
}

.balance-grid > div {
  min-height: 70px;
  border: 1px solid #e1e7e9;
  border-radius: 8px;
  padding: 12px 13px;
  background: #ffffff;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-soft);
}

.balance-grid strong {
  color: var(--strong);
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
}

.balance-grid strong.num-up {
  color: var(--accent-strong);
}

.balance-grid strong.num-down {
  color: var(--danger);
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0;
  font-size: 13px;
}

.review-grid > div {
  min-height: 70px;
  border: 1px solid #e1e7e9;
  border-radius: 8px;
  padding: 11px 12px;
  background: #fbfdfc;
  color: var(--muted);
}

.review-grid strong {
  display: block;
  margin-top: 8px;
  color: var(--strong);
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: 0;
}

.review-ai-notes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 10px;
}

.review-ai-notes span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #f6f9f8;
  color: #33444a;
  font-size: 12px;
}

.review-ai-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.review-ai-card {
  min-height: 150px;
  border: 1px solid var(--line-soft);
  border-left: 4px solid #91a0a6;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfc;
  display: grid;
  gap: 8px;
}

.review-ai-card.is-high {
  border-left-color: var(--danger);
}

.review-ai-card.is-medium {
  border-left-color: var(--warn);
}

.review-ai-card.is-low,
.review-ai-card.is-info {
  border-left-color: var(--accent);
}

.review-ai-card-head {
  display: flex;
  gap: 8px;
  align-items: center;
}

.review-ai-card-head strong {
  color: var(--strong);
  font-size: 14px;
}

.review-ai-badge {
  min-width: 42px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #e9f4f0;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.review-ai-card.is-high .review-ai-badge {
  background: #fae9e8;
  color: var(--danger);
}

.review-ai-card.is-medium .review-ai-badge {
  background: #fff4dc;
  color: var(--warn);
}

.review-ai-target,
.review-ai-evidence {
  color: var(--muted);
  font-size: 12px;
}

.review-ai-status {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
}

.review-ai-card p {
  margin: 0;
  color: #243238;
  font-size: 13px;
  line-height: 1.5;
}

.review-ai-actions {
  margin: 0;
  padding-left: 18px;
  color: #243238;
  font-size: 13px;
  line-height: 1.55;
}

.review-ai-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.review-ai-controls button {
  height: 30px;
}

.review-ai-empty {
  min-height: 72px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 12px;
  background: #fbfcfc;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 28, 0.52);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: min(620px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 18px 56px rgba(17, 24, 28, 0.22);
}

.modal-card.wide {
  width: min(1120px, 100%);
}

.auth-card {
  width: min(430px, 100%);
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.auth-intro {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #d8ece5;
  border-radius: 8px;
  background: #f3faf7;
  color: #33454b;
  font-size: 13px;
  line-height: 1.55;
}

.auth-intro strong {
  color: var(--accent-strong);
  font-size: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f7f9f9;
}

.auth-tab {
  height: 32px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  box-shadow: none;
}

.auth-tab:hover {
  background: #ffffff;
  color: var(--accent-strong);
  box-shadow: none;
}

.auth-tab.is-active {
  background: #ffffff;
  border-color: #d4e5df;
  color: var(--accent-strong);
  box-shadow: var(--shadow-soft);
}

.auth-form {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.auth-form input {
  height: 38px;
}

.auth-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.modal-body {
  display: grid;
  gap: 10px;
}

.codebox {
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid #172126;
  background: #10181b;
  color: #d8f3e8;
  border-radius: 6px;
  padding: 8px;
  min-height: 70px;
  margin: 0;
}

.pay-grid {
  display: grid;
  gap: 8px;
}

.qr-wrap img {
  width: 180px;
  height: 180px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
}

@media (max-width: 1180px) {
  body {
    min-width: 0;
  }

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

  .side-nav {
    position: sticky;
    top: 70px;
    z-index: 20;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    overflow-x: auto;
  }

  .side-nav-btn {
    width: auto;
    min-width: 86px;
    text-align: center;
    justify-content: center;
  }

  #strategyEditorPanel,
  #strategiesPanel {
    grid-column: span 12;
  }

  .strategy-card {
    grid-template-columns: 1fr;
  }

  .strategy-card-actions {
    justify-content: flex-start;
  }

  .income-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .balance-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .review-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .review-ai-cards {
    grid-template-columns: 1fr;
  }

  .engine-status-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .engine-stat {
    border-bottom: 1px solid var(--line-soft);
  }

  .engine-stat:nth-child(2n) {
    border-right: 0;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 74px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .top-right {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .top-tags,
  .top-actions,
  .op-status {
    grid-column: auto;
    justify-content: flex-start;
    text-align: left;
  }

  .layout {
    padding: 10px;
  }

  .side-nav {
    display: none;
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 22px rgba(20, 31, 36, 0.08);
  }

  .bottom-nav-btn {
    min-width: 0;
    height: 42px;
    padding: 0 4px;
    border-color: transparent;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    justify-content: center;
    text-align: center;
  }

  .bottom-nav-btn.is-active {
    background: #dff3ec;
    border-color: #b8ded1;
    color: var(--accent-strong);
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
  }

  .table-wrap table {
    min-width: 0;
    background: transparent;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tbody tr {
    margin-bottom: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(20, 31, 36, 0.05);
  }

  .table-wrap tbody tr:hover {
    background: #ffffff;
  }

  .table-wrap td {
    display: grid;
    grid-template-columns: minmax(86px, 38%) minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    border-top: 0;
    padding: 7px 0;
    word-break: break-word;
  }

  .table-wrap td + td {
    border-top: 1px solid var(--line-soft);
  }

  .table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
  }

  #strategiesTable {
    min-width: 0;
  }

  .income-grid {
    grid-template-columns: 1fr;
  }

  .balance-grid {
    grid-template-columns: 1fr;
  }

  .review-grid {
    grid-template-columns: 1fr;
  }

  .review-ai-cards {
    grid-template-columns: 1fr;
  }

  .strategy-detail-grid {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .panel-subhead {
    align-items: flex-start;
    flex-direction: column;
  }

  .engine-status-grid {
    grid-template-columns: 1fr;
  }

  .engine-stat {
    border-right: 0;
  }
}
