:root {
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: #071542;
  background: #f5f7fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dde5f2;
  border-radius: 8px;
  box-shadow: 0 14px 40px rgba(28, 42, 82, 0.08);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 16px 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: #071542;
  font-size: 24px;
  letter-spacing: 0;
  line-height: 1.1;
}

.topbar p {
  color: #52627f;
  font-size: 14px;
  margin-top: 6px;
}

.top-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.preset-select {
  align-items: center;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  min-width: 280px;
  padding: 8px 12px;
}

.preset-select span {
  color: #53617d;
  font-size: 13px;
}

.preset-select select {
  background: transparent;
  border: 0;
  color: #071542;
  flex: 1;
  font-weight: 600;
  outline: 0;
}

.icon-button,
.ghost-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  color: #0c2c6d;
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  height: 43px;
  justify-content: center;
  transition: 160ms ease;
  width: 58px;
}

.icon-button:hover,
.ghost-button:hover {
  background: #f2f6ff;
  border-color: #b8cae8;
}

.workspace {
  display: grid;
  gap: 14px;
  grid-template-columns: 310px minmax(520px, 1fr) 340px;
}

.panel {
  background: #ffffff;
  border: 1px solid #dde5f2;
  border-radius: 8px;
  box-shadow: 0 10px 34px rgba(28, 42, 82, 0.06);
}

.left-panel,
.right-panel {
  padding: 14px;
}

.control-group {
  border-bottom: 1px solid #e5ebf4;
  padding: 12px 0 16px;
}

.control-group:first-child {
  padding-top: 4px;
}

.control-group:last-of-type {
  border-bottom: 0;
}

.group-title {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.group-title strong {
  color: #0b61d8;
  font-size: 19px;
  min-width: 16px;
}

.group-title span,
.group-title.plain {
  color: #071542;
  font-size: 14px;
  font-weight: 700;
}

.number-row,
.toggle-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 132px;
  margin: 9px 0;
}

.number-row span,
.toggle-row span {
  color: #28375f;
  font-size: 13px;
  font-weight: 600;
}

.number-row input,
.toggle-row input {
  accent-color: #1266e3;
}

.number-row input {
  background: #fbfcff;
  border: 1px solid #d7e1ee;
  border-radius: 7px;
  color: #071542;
  font-size: 14px;
  height: 38px;
  padding: 0 10px;
  width: 100%;
}

.toggle-row input {
  height: 18px;
  justify-self: end;
  width: 18px;
}

.button-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 66px;
  margin-top: 16px;
}

.primary-button {
  align-items: center;
  background: #0e5ed8;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  height: 46px;
  justify-content: center;
  transition: 160ms ease;
}

.primary-button:hover {
  background: #084fbc;
}

.map-panel {
  min-width: 0;
  padding: 14px;
}

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

h2 {
  color: #071542;
  font-size: 15px;
  line-height: 1.25;
}

.panel-title p {
  color: #62708d;
  font-size: 12px;
  margin-top: 4px;
}

.formula-chip {
  background: #f5f8ff;
  border: 1px solid #dce6f5;
  border-radius: 7px;
  color: #0b3b86;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
}

.canvas-wrap {
  aspect-ratio: 1 / 1;
  background: #08123a;
  border: 1px solid #cdd8e8;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.momentum-canvas {
  display: block;
  height: 100%;
  width: 100%;
}

.legend {
  align-items: center;
  background: rgba(7, 18, 61, 0.44);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 7px;
  bottom: 18px;
  color: #ffffff;
  display: flex;
  font-size: 12px;
  gap: 9px;
  padding: 7px 9px;
  position: absolute;
  right: 20px;
}

.legend div {
  background: linear-gradient(90deg, #081138, #1449a5, #25a0d8, #ffd340, #ff6347, #941c46);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  height: 9px;
  width: 120px;
}

.map-footer {
  align-items: center;
  color: #4f5f7a;
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 18px;
  padding: 12px 4px 0;
}

.inspector-section {
  border-bottom: 1px solid #e5ebf4;
  padding: 13px 0 15px;
}

.inspector-section:first-child {
  padding-top: 2px;
}

.inspector-section:last-child {
  border-bottom: 0;
}

.inspector-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.inspector-title span {
  background: #edf4ff;
  border-radius: 999px;
  color: #0e5ed8;
  font-size: 12px;
  font-weight: 800;
  min-width: 28px;
  padding: 4px 8px;
  text-align: center;
}

.bic-table {
  border: 1px solid #e1e8f2;
  border-radius: 8px;
  overflow: hidden;
}

.table-head,
.table-row {
  display: grid;
  grid-template-columns: 30px 1fr 1fr 64px;
}

.table-head {
  background: #f5f8fd;
  color: #5a6883;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 10px;
}

.table-row {
  align-items: center;
  border-top: 1px solid #e8eef6;
  color: #102252;
  font-size: 13px;
  min-height: 34px;
  padding: 0 10px;
}

.table-row strong {
  color: #0b3b86;
  text-align: right;
}

.dot {
  border-radius: 999px;
  height: 11px;
  width: 11px;
}

.dot.gamma {
  background: #ffffff;
  border: 2px solid #0e5ed8;
}

.dot.plus {
  background: #ffcf32;
  border: 2px solid #ee565d;
}

.dot.minus {
  background: #20d4ff;
  border: 2px solid #145bd7;
}

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

.summary-grid h2 {
  margin-bottom: 3px;
}

.summary-grid div {
  align-items: center;
  background: #f7f9fd;
  border: 1px solid #e3eaf4;
  border-radius: 7px;
  display: flex;
  justify-content: space-between;
  padding: 10px;
}

.summary-grid span,
.model-box p,
.note-box p {
  color: #56657f;
  font-size: 13px;
  line-height: 1.55;
}

.summary-grid strong {
  color: #081c55;
  font-size: 14px;
}

.equation {
  color: #0e5ed8 !important;
  font-size: 18px !important;
  font-weight: 700;
  margin: 12px 0 8px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 280px minmax(420px, 1fr);
  }

  .right-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 10px;
  }

  .topbar,
  .workspace {
    display: block;
  }

  .top-actions {
    flex-wrap: wrap;
    margin-top: 14px;
  }

  .preset-select {
    min-width: 100%;
  }

  .left-panel,
  .map-panel,
  .right-panel {
    margin-bottom: 12px;
  }

  .number-row,
  .toggle-row {
    gap: 6px;
    grid-template-columns: 1fr;
  }

  .number-row input {
    max-width: none;
    width: 100%;
  }

  .toggle-row input {
    justify-self: start;
  }

  .panel-title {
    align-items: flex-start;
    gap: 10px;
  }

  .formula-chip {
    font-size: 12px;
  }
}
