:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7f8;
  color: #142026;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid #b9c5ca;
  background: #ffffff;
  color: #142026;
  padding: 7px 11px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  background: #eef4f6;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: #ffffff;
  border-bottom: 1px solid #d9e2e6;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.topbar p {
  margin: 5px 0 0;
  color: #52656d;
  font-size: 13px;
}

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

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 78px);
}

.control-panel {
  border-right: 1px solid #d9e2e6;
  background: #fbfcfc;
  padding: 12px;
  overflow: auto;
}

.control-panel h2,
.section-title h2 {
  margin: 0;
  font-size: 16px;
}

.control-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.field {
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: #52656d;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 18px;
}

.field-label label {
  min-width: 0;
  line-height: 1.25;
}

.help-button {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  border-color: #adc6d0;
  color: #0f6c83;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.help-button:hover,
.help-button[aria-expanded="true"] {
  background: #e7f4f8;
  border-color: #6ba6b9;
}

.help-panel {
  padding: 8px 9px;
  border: 1px solid #c9dce3;
  border-radius: 6px;
  background: #f7fbfc;
  color: #33464d;
  font-size: 11px;
  line-height: 1.45;
}

.field input,
.field select,
.tradeTable input {
  width: 100%;
}

.field input,
.field select,
.data-table input {
  border: 1px solid #c9d4d9;
  border-radius: 5px;
  padding: 5px 6px;
  background: #ffffff;
  color: #142026;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #33464d;
}

.workspace {
  min-width: 0;
  padding: 16px;
  overflow: auto;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-label {
  margin: 2px 0 8px;
  color: #52656d;
  font-size: 13px;
  font-weight: 700;
}

.metric {
  padding: 11px 12px;
  background: #ffffff;
  border: 1px solid #d9e2e6;
  border-radius: 7px;
}

.metric span {
  display: block;
  color: #52656d;
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
  line-height: 1.2;
}

.metric.initial {
  border-color: #bed6df;
  background: #f8fdff;
}

.section-block {
  margin-top: 14px;
  background: #ffffff;
  border: 1px solid #d9e2e6;
  border-radius: 7px;
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #d9e2e6;
}

.muted {
  color: #52656d;
  font-size: 13px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

.data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0f6c83;
  color: #ffffff;
  text-align: left;
  white-space: nowrap;
  padding: 8px 9px;
  border-right: 1px solid rgba(255, 255, 255, 0.16);
}

.data-table td {
  padding: 6px 8px;
  border-top: 1px solid #edf1f3;
  border-right: 1px solid #edf1f3;
  white-space: nowrap;
  vertical-align: top;
}

.data-table input {
  min-width: 86px;
  padding: 5px 6px;
  font-size: 12px;
}

.data-table input[type="text"] {
  min-width: 110px;
}

.result-table tr.raised td {
  background: #e9f8ef;
}

.result-table tr.initial-row td {
  background: #eef7fb;
}

.result-table td.mismatch {
  background: #fee2e2 !important;
  color: #7f1d1d;
}

.result-table td.mismatch input {
  background: #fff1f2;
  border-color: #ef4444;
  color: #7f1d1d;
}

.result-volume-input {
  width: 96px;
}

.result-table td:last-child {
  min-width: 220px;
  white-space: normal;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid #d9e2e6;
  }

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