:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #243139;
  background: #f5f7f8;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { overflow-x: clip; }
body { min-width: 320px; margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
input { color: #26353a; }
input:focus-visible, button:focus-visible { outline: 2px solid #247e70; outline-offset: 2px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 max(28px, calc((100vw - 1440px) / 2));
  border-bottom: 1px solid #e1e8e9;
  background: #fff;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 5px;
  background: #17655b;
  color: #fff;
  font: 22px Georgia, serif;
}
.topbar strong { font-size: 15px; white-space: nowrap; }
.brand-context { font-size: 12px; color: #90a0a5; }
.local-status { display: flex; align-items: center; gap: 7px; margin-left: auto; color: #7a898e; font-size: 12px; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #379d77; }
.workspace { max-width: 1440px; margin: 0 auto; padding: 39px 28px 28px; }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 41px; }
.eyebrow { margin: 0 0 9px; color: #418377; font-size: 10px; font-weight: 800; }
h1 { margin: 0; font-size: 27px; line-height: 1.2; }
.page-subtitle { margin: 10px 0 0; color: #7f8f95; font-size: 13px; }
.heading-actions { display: flex; align-items: end; gap: 10px; }
.exchange-control { display: flex; flex-direction: column; gap: 6px; color: #687a80; font-size: 11px; font-weight: 700; }
.exchange-input { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 11px; border: 1px solid #d6e0e2; border-radius: 5px; background: #fff; color: #77878d; font-size: 12px; white-space: nowrap; }
.exchange-input input { width: 65px; padding: 0; border: 0; outline: 0; background: transparent; font-size: 14px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.exchange-input:focus-within { border-color: #278472; box-shadow: 0 0 0 2px #2784721a; }
.exchange-input:has([aria-invalid="true"]) { border-color: #c55b49; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 38px; padding: 0 15px; border-radius: 5px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.button-primary { border: 1px solid #176259; background: #176259; color: #fff; }
.button-primary:hover { background: #105148; }
.button-secondary { border: 1px solid #d6e0e2; background: #fff; color: #3d5056; }
.button-secondary:hover { background: #f9fbfb; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.section-heading h2 { margin: 0; font-size: 18px; line-height: 1.3; }
.section-heading p { margin: 6px 0 0; color: #8b999f; font-size: 12px; line-height: 1.5; }
.table-frame { overflow: hidden; border: 1px solid #d9e3e5; border-radius: 6px; background: #fff; }
.table-scroll { overflow-x: auto; scrollbar-color: #c9d5d7 transparent; }
table { width: 100%; min-width: 1220px; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 13px 10px; border-bottom: 1px solid #e7edef; white-space: nowrap; }
th { height: 51px; background: #f8faf9; color: #66777e; font-size: 11px; font-weight: 700; }
th small { color: #a2afb3; font-size: 10px; font-weight: 500; }
th.input-heading { color: #216e5f; background: #f0f8f4; }
td { height: 66px; font-size: 12px; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background-color: #fbfdfc; }
.numeric { text-align: right; }
th:nth-child(1) { width: 110px; }
th:nth-child(2) { width: 130px; }
th:nth-child(3) { width: 160px; }
th:nth-child(4) { width: 120px; }
th:nth-child(5) { width: 115px; }
th:nth-child(6) { width: 112px; }
th:nth-child(7) { width: 112px; }
th:nth-child(8) { width: 105px; }
th:nth-child(9) { width: 130px; }
th:nth-child(10) { width: 83px; }
th:nth-child(11) { width: 65px; }
th:first-child, td:first-child { position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 #e7edef; }
th:first-child { z-index: 2; background: #f8faf9; }
.account-name { overflow: hidden; color: #2b3e45; font-weight: 700; text-overflow: ellipsis; }
.input-cell { background: #fbfdfb; }
.editable-field { display: flex; align-items: center; gap: 3px; width: 100%; height: 38px; padding: 0 9px; border: 1px solid #b7d9cc; border-radius: 4px; background: #f2faf5; color: #4d7e6d; }
.editable-field:focus-within { border-color: #26826c; background: #fff; box-shadow: 0 0 0 2px #26826c26; }
.editable-field:has([aria-invalid="true"]) { border-color: #c55b49; background: #fff6f3; }
.editable-field input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: #1e5549; font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.editable-field span { font-size: 11px; font-weight: 700; }
.result-cell { color: #35464c; }
.profit-positive { color: #14775c; font-weight: 700; }
.profit-negative { color: #bc5545; font-weight: 700; }
.row-action { padding: 5px 0; border: 0; background: transparent; color: #327b6a; font-size: 11px; font-weight: 700; }
.row-action:hover, .text-button:hover { text-decoration: underline; }
.empty-state { padding: 50px 20px; color: #8a999e; font-size: 13px; text-align: center; }
.source-note { display: flex; align-items: start; gap: 8px; margin: 12px 0 0; color: #8e7659; font-size: 11px; line-height: 1.6; }
.note-marker { display: inline-grid; flex: none; place-items: center; width: 15px; height: 15px; margin-top: 1px; border: 1px solid #e9d8b9; border-radius: 50%; background: #fff5e5; color: #9e703a; font-size: 10px; font-weight: 800; }

.definitions-section { margin-top: 45px; padding-top: 22px; border-top: 1px solid #dce5e7; }
.definitions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 30px; margin: 3px 0 0; }
.definitions div { min-width: 0; padding: 13px 0; border-bottom: 1px solid #e1e9eb; }
.definitions dt { margin-bottom: 5px; color: #51676d; font-size: 12px; font-weight: 700; }
.definitions dd { margin: 0; color: #84949a; font-size: 12px; line-height: 1.5; }
.formula-footnote { margin: 16px 0 0; color: #8a999e; font-size: 11px; line-height: 1.6; }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 35px; padding-top: 16px; border-top: 1px solid #e1e9eb; color: #a0adb1; font-size: 11px; }
.text-button { padding: 6px 0; border: 0; background: transparent; color: #287267; font-size: 11px; font-weight: 700; white-space: nowrap; }
.sr-only { position: absolute; overflow: hidden; width: 1px; height: 1px; clip: rect(0, 0, 0, 0); white-space: nowrap; }

dialog { width: min(450px, calc(100% - 28px)); padding: 0; border: 1px solid #d7e1e3; border-radius: 7px; box-shadow: 0 20px 65px #17303940; color: #26363c; }
dialog::backdrop { background: #172c357d; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 23px; border-bottom: 1px solid #e5ecee; }
.dialog-header h2 { margin: 0; font-size: 18px; }
.close-button { width: 28px; height: 28px; border: 0; background: transparent; color: #788c91; font-size: 24px; line-height: 1; }
.dialog-body { padding: 21px 23px 25px; }
.field { display: flex; flex-direction: column; gap: 8px; color: #56686e; font-size: 12px; font-weight: 700; }
.field input { width: 100%; height: 40px; padding: 0 11px; border: 1px solid #d5e0e2; border-radius: 5px; background: #fff; font-size: 13px; outline: 0; }
.field input:focus { border-color: #27826f; box-shadow: 0 0 0 2px #27826f24; }
.dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 23px; border-top: 1px solid #e5ecee; }
.dialog-footer-actions { display: flex; gap: 9px; margin-left: auto; }
.delete-button { color: #bb5545; }

@media (max-width: 650px) {
  .topbar { height: 59px; padding: 0 16px; }
  .brand-context { display: none; }
  .topbar strong { font-size: 14px; }
  .local-status { font-size: 10px; }
  .workspace { padding: 28px 16px; }
  .page-heading { align-items: start; flex-direction: column; gap: 19px; margin-bottom: 31px; }
  h1 { font-size: 24px; }
  .heading-actions { justify-content: space-between; width: 100%; }
  .section-heading h2 { font-size: 16px; }
  .section-heading p { font-size: 11px; }
  .table-frame { overflow: visible; border: 0; background: transparent; }
  .table-scroll { overflow: visible; }
  table { display: block; width: 100%; min-width: 0; }
  thead { display: none; }
  tbody { display: grid; gap: 12px; }
  tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; padding: 13px 14px 12px; border: 1px solid #d9e3e5; border-radius: 6px; background: #fff; }
  td { display: flex; flex-direction: column; justify-content: center; min-width: 0; height: auto; min-height: 48px; padding: 7px 0; border-bottom: 1px solid #e7edef; white-space: normal; }
  td.numeric { text-align: left; }
  td:first-child { position: static; grid-column: 1 / -1; min-height: 40px; padding: 0 0 9px; box-shadow: none; font-size: 14px; }
  td:last-child { align-items: flex-start; grid-column: 1 / -1; min-height: 28px; padding: 7px 0 0; border: 0; }
  td:nth-child(2), td:nth-child(3), td:nth-child(4) { background: transparent; }
  td:nth-child(4) { grid-column: 1 / -1; }
  td:not(:first-child):not(:last-child)::before { display: block; margin-bottom: 6px; color: #819197; font-size: 10px; font-weight: 700; content: attr(data-label); }
  td:nth-child(4) .editable-field { max-width: 100%; }
  .editable-field { height: 36px; }
  .row-action { padding: 4px 0; }
  .definitions-section { margin-top: 34px; }
  .definitions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 15px; }
  .definitions dd { font-size: 11px; }
}

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