:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --panel-soft: #eef3ef;
  --ink: #202522;
  --muted: #68716b;
  --line: #dfe5df;
  --green: #137a57;
  --blue: #2f63c7;
  --amber: #b66a00;
  --rose: #c53f52;
  --shadow: 0 1px 3px rgba(31, 38, 35, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 20px;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

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

h2 {
  font-size: 17px;
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 8px;
}

.segment button,
.icon-button {
  border: 0;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
}

.segment button {
  min-width: 74px;
  height: 34px;
  border-radius: 6px;
}

.segment button.active {
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.symbol-input {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.symbol-input span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.symbol-input input {
  width: 170px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  text-transform: uppercase;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 18px;
}

.status-grid,
.data-grid {
  display: grid;
  gap: 14px;
}

.status-grid {
  grid-template-columns: minmax(0, 1fr) 180px 180px;
  margin-bottom: 14px;
}

.price-panel,
.mini-panel,
.card,
.errors {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.price-panel {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.price-panel strong {
  display: block;
  margin-top: 6px;
  font-size: 38px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

#modeBadge {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--green);
  background: #e6f4ed;
}

.mini-panel {
  padding: 18px;
}

.mini-panel strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.mini-panel small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.card {
  min-height: 330px;
  padding: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.card-head span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.list,
.table-list {
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.row,
.table-row {
  display: grid;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0ec;
}

.row {
  grid-template-columns: 92px minmax(120px, 1fr) 100px;
}

.table-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tag {
  width: fit-content;
  min-width: 52px;
  padding: 5px 8px;
  border-radius: 999px;
  color: #fff;
  text-align: center;
  font-size: 13px;
}

.tag-open-long {
  background: var(--green);
}

.tag-close-long {
  background: var(--blue);
}

.tag-open-short {
  background: var(--rose);
}

.tag-close-short {
  background: var(--amber);
}

.mono {
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 28px 0;
  color: var(--muted);
  text-align: center;
}

.errors {
  margin-top: 14px;
  padding: 14px 16px;
  color: #8a2d38;
  background: #fff5f6;
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 24px, 1180px);
    padding: 16px 0 28px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
  }

  h1 {
    font-size: 26px;
  }

  .controls {
    display: grid;
    grid-template-columns: 1fr 44px;
    justify-content: stretch;
    gap: 8px;
  }

  .segment {
    grid-column: 1 / -1;
  }

  .segment button {
    min-width: 0;
    height: 38px;
  }

  .symbol-input {
    min-width: 0;
    min-height: 44px;
  }

  .symbol-input input {
    width: 100%;
    min-width: 0;
  }

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

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

  .price-panel {
    grid-column: 1 / -1;
    align-items: flex-start;
    padding: 14px;
  }

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

  .price-panel strong {
    font-size: 34px;
  }

  .mini-panel {
    padding: 12px 14px;
  }

  .mini-panel strong {
    margin-top: 4px;
    font-size: 18px;
  }

  .card {
    min-height: 0;
    padding: 14px;
  }

  .list,
  .table-list {
    gap: 0;
    padding-top: 8px;
  }

  .row {
    grid-template-columns: 58px minmax(132px, 1fr) 72px;
    gap: 8px;
    min-height: 42px;
    padding: 9px 0;
  }

  .table-row {
    display: grid;
    grid-template-columns: minmax(52px, 0.8fr) minmax(86px, 1fr) minmax(46px, 0.7fr);
    gap: 8px;
    min-height: 44px;
    padding: 10px 0;
  }

  .table-row > div {
    min-width: 0;
  }

  .tag {
    min-width: 48px;
    padding: 4px 7px;
    font-size: 12px;
  }

  .row .mono,
  .table-row .mono {
    font-size: 15px;
    word-break: break-word;
  }

  .empty {
    padding: 22px 0;
  }

  .errors {
    padding: 12px 14px;
    font-size: 14px;
  }
}

@media (max-width: 380px) {
  .shell {
    width: min(100% - 16px, 1180px);
  }

  h1 {
    font-size: 24px;
  }

  .row {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 6px;
  }

  .row > .tag {
    grid-column: 1;
    grid-row: 1;
  }

  .row > span.mono {
    grid-column: 1 / -1;
    grid-row: 2;
    color: var(--muted);
    font-size: 12px;
  }

  .row > strong.mono {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .table-row {
    grid-template-columns: 1fr;
  }

  .symbol-input span,
  .label,
  .mini-panel small {
    font-size: 12px;
  }

  .row .mono,
  .table-row .mono {
    font-size: 14px;
  }
}
