:root {
  --app-scale: 1;
  --design-width: 1517px;
  --design-height: 984px;
  --bg: #050a10;
  --shell: #070d14;
  --panel: #0d151e;
  --panel-soft: #101a25;
  --panel-deep: #091119;
  --line: #223140;
  --line-soft: rgba(80, 113, 143, 0.28);
  --text: #e9f1f8;
  --muted: #8b9aaa;
  --blue: #198cff;
  --blue-2: #2d9dff;
  --green: #19d486;
  --red: #ff4e55;
  --amber: #ffc400;
  --orange: #ff812d;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  overflow: auto;
}

body {
  margin: 0;
  width: max(100vw, calc(var(--design-width) * var(--app-scale)));
  min-height: max(100vh, calc(var(--design-height) * var(--app-scale)));
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", Inter, Arial, sans-serif;
  font-size: 14px;
  overflow: auto;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  color: var(--text);
  background: linear-gradient(180deg, #101b26, #0b131c);
  border-radius: 4px;
  cursor: pointer;
}

input {
  width: 100%;
  height: 34px;
  min-width: 0;
  color: var(--text);
  background: #091119;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 11px;
  outline: none;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(25, 140, 255, 0.18);
}

.terminal-shell {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) 36px;
  width: var(--design-width);
  height: var(--design-height);
  min-height: 0;
  background:
    radial-gradient(circle at 60% 5%, rgba(28, 83, 130, 0.12), transparent 34%),
    linear-gradient(180deg, #071018 0%, #04090e 100%);
  transform: scale(var(--app-scale));
  transform-origin: top left;
}

.terminal-top {
  display: grid;
  grid-template-columns: 280px minmax(420px, 1fr) 500px;
  align-items: center;
  border-bottom: 1px solid #172533;
  background: rgba(4, 9, 14, 0.96);
  padding: 0 18px;
}

.brand-block,
.header-actions,
.index-strip {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 11px;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #00172b;
  background: #0f83ff;
  border-radius: 5px;
}

.brand-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.brand-block strong {
  font-size: 20px;
}

.edition {
  color: #62b9ff;
  border: 1px solid #166ab8;
  background: rgba(20, 102, 178, 0.3);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}

.index-strip {
  justify-content: center;
  gap: 44px;
  color: #c9d2dc;
  white-space: nowrap;
}

.index-strip strong,
.index-strip em {
  color: var(--green);
  margin-left: 8px;
  font-style: normal;
  font-weight: 700;
}

.header-actions {
  justify-content: flex-end;
  gap: 12px;
  color: #d6dee8;
}

.bell {
  position: relative;
  color: #c9d4df;
  font-size: 20px;
}

.bell i {
  position: absolute;
  top: -7px;
  right: -9px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: white;
  background: #da353a;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
}

.bell i[hidden] {
  display: none;
}

.header-button {
  height: 32px;
  padding: 0 12px;
  color: #ced8e3;
}

.header-button b {
  color: var(--green);
}

.account {
  color: #dfe8f0;
  cursor: pointer;
}

.account:hover {
  color: #6bb8ff;
}

.terminal-body {
  display: grid;
  grid-template-columns: 72px 254px minmax(610px, 1fr) 378px;
  height: 884px;
  min-height: 0;
  overflow: hidden;
}

.icon-rail {
  display: grid;
  grid-template-rows: repeat(5, 80px) 1fr 38px;
  justify-items: center;
  border-right: 1px solid #172533;
  background: #050b12;
  padding-top: 10px;
}

.rail-item {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 7px;
  width: 64px;
  height: 66px;
  border-color: transparent;
  color: #98a7b8;
  background: transparent;
}

.rail-item.active {
  color: #3ba5ff;
  background: linear-gradient(90deg, rgba(20, 116, 208, 0.32), rgba(20, 116, 208, 0.08));
  border-left: 3px solid var(--blue);
}

.rail-item span {
  font-size: 23px;
  line-height: 1;
}

.rail-item b {
  font-size: 14px;
  font-weight: 600;
}

.rail-help,
.rail-collapse {
  align-self: end;
  margin-bottom: 10px;
}

.rail-help {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: #a5b3c1;
  background: transparent;
}

.rail-collapse {
  width: 58px;
  height: 34px;
  color: #8d9aaa;
}

.watch-panel,
.right-panel,
.dashboard {
  min-height: 0;
  padding: 10px 8px;
}

.watch-panel {
  border-right: 1px solid #172533;
}

.watch-head,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.watch-head {
  height: 40px;
  padding: 0 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

.watch-head strong,
.section-title strong {
  font-size: 16px;
}

.watch-head span {
  color: var(--muted);
}

.add-form {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 0;
}

.add-actions {
  display: grid;
  grid-template-columns: 1fr 36px;
  gap: 8px;
}

.primary-add {
  height: 36px;
  border-color: #116fd0;
  background: linear-gradient(180deg, #178cff, #0e62c4);
  font-size: 15px;
  font-weight: 700;
}

.import-btn {
  height: 34px;
}

.watch-table-head {
  display: grid;
  grid-template-columns: 24px 1fr 66px 36px;
  align-items: center;
  height: 38px;
  padding: 0 12px;
  color: var(--muted);
  background: #0b141d;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.watchlist {
  height: 663px;
  overflow: auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.watch-item {
  display: grid;
  grid-template-columns: 24px 1fr 70px 28px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 6px 10px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.watch-item.selected {
  background: rgba(23, 140, 255, 0.11);
}

.watch-item .check {
  width: 14px;
  height: 14px;
  border: 1px solid #607081;
  border-radius: 3px;
}

.watch-item.selected .check {
  border-color: var(--blue);
  background: #0f70d8;
}

.watch-item strong,
.watch-item small,
.watch-item em {
  display: block;
  font-style: normal;
}

.watch-item strong {
  font-size: 15px;
}

.watch-item small {
  margin-top: 3px;
  color: #b4bfca;
}

.watch-item .price {
  text-align: right;
  color: var(--green);
  font-weight: 700;
}

.watch-item .price.red {
  color: var(--red);
}

.watch-item .price em {
  margin-top: 3px;
  font-weight: 500;
  font-size: 12px;
}

.watch-item .trash {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #9ba8b4;
  background: transparent;
  text-align: center;
  line-height: 1;
  text-decoration: none;
  transition: 0.16s ease;
}

.watch-tools {
  display: grid;
  grid-template-columns: 36px 36px 1fr;
  gap: 6px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 4px 4px;
}

.watch-tools button {
  height: 34px;
}

#deleteSelected:hover,
#clearList:hover,
.watch-delete:hover,
.table-action:hover,
.rule-actions .danger-action:hover {
  color: var(--red);
  border-color: rgba(255, 78, 85, 0.35);
  background: rgba(255, 78, 85, 0.08);
}

#clearList {
  grid-column: 1 / -1;
}

.dashboard {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 268px;
  gap: 8px;
}

.main-card,
.detail-card,
.rule-card,
.notice-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(16, 26, 37, 0.96), rgba(8, 15, 23, 0.98));
  box-shadow: var(--shadow);
}

.main-card {
  min-height: 0;
}

.tabs {
  display: flex;
  gap: 20px;
  height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-soft);
}

.tabs button {
  width: 112px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: #aab8c8;
  background: transparent;
  font-size: 16px;
}

.tabs button.active {
  color: #3ba5ff;
  border-bottom-color: #1d8cff;
}

.quote-summary {
  display: grid;
  grid-template-columns: 260px 1fr;
  padding: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.quote-main span {
  display: block;
  color: #f3f7fb;
  font-size: 20px;
  font-weight: 700;
}

.quote-main em {
  margin-left: 8px;
  color: #acb9c5;
  font-style: normal;
  font-weight: 500;
}

.quote-main strong {
  display: block;
  margin-top: 6px;
  color: var(--green);
  font-size: 30px;
  line-height: 1.1;
}

.quote-main p {
  margin: 8px 0 0;
  color: var(--green);
}

.quote-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 10px 26px;
  color: #96a5b5;
}

.quote-stats b {
  margin-left: 10px;
  color: #ecf2f7;
}

.quote-stats .red {
  color: var(--red);
}

.quote-stats .green {
  color: var(--green);
}

.update-time {
  grid-column: 2 / 4;
  justify-self: end;
  font-size: 12px;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 14px;
}

.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.segmented button,
.chart-actions button {
  height: 31px;
  min-width: 55px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  color: #b9c5d2;
  background: #0b141e;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented .active {
  color: #d9edff;
  background: #173453;
  box-shadow: inset 0 0 0 1px #255b8e;
}

.chart-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  position: relative;
  align-items: center;
}

.chart-actions button.active,
.chart-actions button[aria-expanded="true"] {
  color: #d9edff;
  background: #173453;
  box-shadow: inset 0 0 0 1px #255b8e;
}

.indicator-control {
  position: relative;
}

.indicator-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 8;
  display: grid;
  gap: 8px;
  min-width: 132px;
  padding: 10px;
  border: 1px solid #25506f;
  border-radius: 4px;
  background: #0a121b;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.indicator-menu[hidden] {
  display: none;
}

.indicator-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c6d2df;
  white-space: nowrap;
  cursor: pointer;
}

.indicator-menu input {
  accent-color: #1d8cff;
}

.main-card.chart-expanded {
  position: fixed;
  inset: 74px 18px 22px 90px;
  z-index: 20;
  display: grid;
  grid-template-rows: 48px auto auto minmax(0, 1fr) 42px 36px;
}

.main-card.chart-expanded canvas {
  height: auto;
  min-height: 520px;
}

canvas {
  display: block;
  width: calc(100% - 28px);
  height: 296px;
  margin: 0 14px;
  background: #09121b;
}

.range-bar {
  position: relative;
  height: 36px;
  margin: 0 66px 0 66px;
  border: 1px solid #506b85;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(59, 148, 255, 0.18), rgba(59, 148, 255, 0.04));
}

.range-bar span {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(65, 151, 255, 0.28), transparent);
}

.range-bar i {
  position: absolute;
  top: 4px;
  width: 8px;
  height: 26px;
  border: 1px solid #98b7d5;
  border-radius: 4px;
  background: rgba(145, 177, 211, 0.45);
}

.range-bar i:nth-child(2) {
  right: 18%;
}

.range-bar i:nth-child(3) {
  right: 0;
}

.legend {
  display: flex;
  justify-content: center;
  gap: 28px;
  height: 36px;
  align-items: center;
  color: #b8c4cf;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.line,
.band {
  width: 22px;
  height: 2px;
  border-radius: 999px;
}

.close { background: #2b85ff; }
.b33 { background: var(--amber); }
.b50 { background: var(--orange); }
.b75 { background: var(--red); }
.bHigh { background: #3aa2ff; border-top: 2px dashed #3aa2ff; background: transparent; }

.detail-card {
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  height: 39px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  white-space: nowrap;
}

th {
  color: #95a4b4;
  background: rgba(255, 255, 255, 0.02);
  font-weight: 600;
}

td {
  font-size: 15px;
}

.green { color: var(--green); }
.red { color: var(--red); }
.amber { color: var(--amber); }
.blue { color: #3ba5ff; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 62px;
  color: var(--green);
  font-weight: 700;
}

.tag::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
}

.tag.warning { color: var(--amber); }
.tag.danger { color: var(--orange); }
.tag.critical,
.tag.error { color: var(--red); }
.tag.near { color: #3ba5ff; }
.tag.pending { color: #96a5b5; }

.table-action {
  width: 28px;
  height: 28px;
  padding: 0;
  color: #aebdcb;
  border-color: transparent;
  background: transparent;
  font-size: 16px;
}

.table-action:hover {
  color: var(--red);
  border-color: rgba(255, 78, 85, 0.35);
  background: rgba(255, 78, 85, 0.08);
}

.right-panel {
  display: grid;
  grid-template-rows: 365px minmax(0, 1fr);
  gap: 8px;
  border-left: 1px solid #172533;
}

.rule-card,
.notice-card {
  padding: 14px;
}

.section-title {
  height: 32px;
}

.section-title button,
.all-notices {
  height: 30px;
  color: #1f9cff;
  border-color: #155895;
  background: #0a1520;
}

.rule-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.7fr 1fr 54px 48px;
  align-items: center;
  min-height: 51px;
  gap: 8px;
  border-bottom: 1px solid var(--line-soft);
}

.rule-actions {
  display: flex;
  gap: 6px;
}

.rule-actions button {
  width: 22px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: #a7b5c4;
  background: transparent;
  transition: 0.16s ease;
}

.rule-head {
  min-height: 42px;
  margin-top: 10px;
  padding: 0 8px;
  color: #9caaba;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 0;
}

.rule-grid b {
  font-weight: 700;
}

.switch {
  display: inline-flex;
}

.switch input {
  display: none;
}

.switch i {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #566575;
}

.switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: white;
}

.switch input:checked + i {
  background: #1fc987;
}

.switch input:checked + i::after {
  left: 17px;
}

.rule-note {
  margin: 12px 0 0;
  color: #8997a7;
  font-size: 13px;
}

.notifications {
  display: grid;
}

.notification {
  display: grid;
  grid-template-columns: 24px 1fr 58px;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}

.empty-notice {
  grid-template-columns: 1fr;
  color: #9aa7b6;
}

.notification-icon {
  color: var(--amber);
  font-size: 21px;
}

.notification-icon.blue { color: #319bff; }
.notification-icon.green { color: var(--green); }
.notification-icon.red { color: var(--red); }

.notification p {
  margin: 0;
  line-height: 1.45;
  color: #b6c3d0;
}

.notification strong {
  color: #e8f0f7;
  margin-right: 6px;
}

.notice-badge {
  display: inline-flex;
  margin-left: 6px;
  padding: 2px 6px;
  border: 1px solid rgba(255, 196, 0, 0.4);
  border-radius: 4px;
  color: var(--amber);
  background: rgba(255, 196, 0, 0.1);
  font-size: 12px;
}

.notification time {
  color: #9aa7b6;
  font-size: 12px;
  text-align: right;
}

.all-notices {
  width: 100%;
  margin-top: 10px;
}

.terminal-footer {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  align-items: center;
  padding: 0 18px;
  border-top: 1px solid #172533;
  color: #8897a6;
  background: #050b12;
}

.settings-dialog {
  width: 430px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65);
}

.settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
}

.settings-dialog form {
  display: grid;
  gap: 12px;
}

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

.dialog-head strong {
  font-size: 18px;
}

.dialog-head button {
  width: 30px;
  height: 30px;
}

.settings-dialog label {
  display: grid;
  gap: 6px;
  color: #b7c4d1;
  font-size: 13px;
}

.account-switcher {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid #203246;
  border-radius: 6px;
  background: #09131d;
}

.account-switcher select {
  width: 100%;
  height: 34px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0b151f;
  padding: 0 10px;
}

.account-switch-actions {
  display: grid;
  grid-template-columns: 88px 82px;
  gap: 6px;
  align-content: end;
}

.account-switch-actions button {
  height: 34px;
  padding: 0 10px;
}

.split {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
}

.save-settings {
  height: 38px;
  border-color: #116fd0;
  background: linear-gradient(180deg, #178cff, #0e62c4);
  font-weight: 700;
}

.mail-workflow {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #203246;
  border-radius: 6px;
  background: #0a121b;
}

.workflow-head,
.workflow-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.workflow-head strong {
  color: #e6edf5;
}

.workflow-head button,
.workflow-actions button,
.workflow-actions a {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #21405f;
  border-radius: 4px;
  color: #cfe2f4;
  background: #0d1a26;
  text-decoration: none;
}

.mail-status-grid {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 7px 10px;
  color: #97a8b9;
}

.mail-status-grid b.ok {
  color: var(--green);
}

.mail-status-grid b.bad {
  color: var(--red);
}

.workflow-steps {
  margin: 0;
  padding-left: 18px;
  color: #b9c6d3;
  line-height: 1.65;
}

.mail-workflow pre {
  overflow-x: auto;
  margin: 0;
  padding: 10px;
  color: #dbe8f5;
  background: #050b12;
  border: 1px solid #182737;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.55;
}

.workflow-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 42px;
  max-width: 360px;
  padding: 11px 14px;
  color: white;
  background: #0d74d7;
  border: 1px solid #37a1ff;
  border-radius: 4px;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.18s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1220px) {
  .terminal-top {
    grid-template-columns: 280px 1fr;
  }

  .header-actions {
    display: none;
  }

  .terminal-body {
    grid-template-columns: 72px 254px minmax(620px, 1fr);
  }

  .right-panel {
    grid-column: 2 / -1;
    grid-row: 2;
    border-left: 0;
    border-top: 1px solid #172533;
  }
}

.terminal-top {
  display: grid;
  grid-template-columns: 280px minmax(420px, 1fr) 500px;
}

.header-actions {
  display: flex;
}

.terminal-body {
  display: grid;
  grid-template-columns: 72px 254px minmax(610px, 1fr) 378px;
}

.right-panel {
  grid-column: auto;
  grid-row: auto;
  border-left: 1px solid #172533;
  border-top: 0;
}

@media (max-width: 860px) {
  .terminal-shell {
    grid-template-rows: auto auto 36px;
  }

  .terminal-top,
  .terminal-body {
    display: block;
  }

  .terminal-top {
    padding: 12px;
  }

  .index-strip {
    justify-content: flex-start;
    gap: 16px;
    overflow-x: auto;
    margin-top: 12px;
  }

  .icon-rail {
    display: none;
  }

  .watchlist {
    height: 360px;
  }

  .dashboard {
    display: block;
  }

  .detail-card,
  .right-panel {
    margin-top: 8px;
  }
}

.terminal-shell {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) 36px;
  width: var(--design-width);
  height: var(--design-height);
}

.terminal-top {
  display: grid;
  grid-template-columns: 280px minmax(420px, 1fr) 500px;
  padding: 0 18px;
}

.header-actions {
  display: flex;
}

.terminal-body {
  display: grid;
  grid-template-columns: 72px 254px minmax(610px, 1fr) 378px;
  height: 884px;
}

.icon-rail {
  display: grid;
}

.watchlist {
  height: 663px;
}

.dashboard {
  display: grid;
}

.right-panel {
  grid-column: auto;
  grid-row: auto;
  border-left: 1px solid #172533;
  border-top: 0;
  margin-top: 0;
}
