:root {
  --canvas: #f3f4f1;
  --canvas-deep: #e8eae5;
  --surface: #ffffff;
  --surface-soft: #f8f9f7;
  --ink: #18201f;
  --muted: #687371;
  --faint: #919b98;
  --line: #dfe4e1;
  --line-strong: #cbd3cf;
  --brand: #136f68;
  --brand-deep: #0c5752;
  --brand-soft: #e7f3f1;
  --positive: #177357;
  --positive-soft: #e7f5ef;
  --negative: #b6493f;
  --negative-soft: #faece9;
  --warning: #9a6815;
  --warning-soft: #fff5dc;
  --shadow: 0 12px 30px rgba(25, 40, 37, 0.06);
  --shadow-dialog: 0 28px 72px rgba(14, 29, 27, 0.22);
  --radius: 16px;
  --radius-small: 10px;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  font-family: var(--font-sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 86% 0%, rgba(19, 111, 104, 0.07), transparent 28rem),
    var(--canvas);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.current-user {
  color: var(--ink);
  font-weight: 650;
}

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(430px, 100%);
}

.login-card {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-dialog);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 38px;
}

.login-brand > div {
  display: grid;
}

.login-brand strong {
  font-size: 16px;
}

.login-brand small {
  color: var(--muted);
}

.login-card h1 {
  margin: 4px 0 8px;
  font-size: 26px;
}

.login-intro,
.login-security-note {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 26px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.login-form input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
}

.login-security-note {
  margin: 28px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  text-align: center;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
summary,
input[type="month"],
input[type="date"],
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(19, 111, 104, 0.2);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(203, 211, 207, 0.85);
  background: rgba(248, 249, 247, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand > span:last-child {
  display: grid;
  line-height: 1.15;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0.03em;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.brand-mark {
  position: relative;
  width: 31px;
  height: 31px;
  border-radius: 9px;
  background: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  position: absolute;
  left: 8px;
  width: 15px;
  height: 2px;
  border-radius: 3px;
  background: #fff;
  content: "";
}

.brand-mark::before { top: 9px; }
.brand-mark span { top: 14px; width: 11px; }
.brand-mark::after { top: 19px; width: 7px; }

.header-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
}

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.connection-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 4px var(--warning-soft);
}

.connection-state.is-online i {
  background: var(--positive);
  box-shadow: 0 0 0 4px var(--positive-soft);
}

.connection-state.is-offline i {
  background: var(--negative);
  box-shadow: 0 0 0 4px var(--negative-soft);
}

.today-label {
  padding-left: 18px;
  border-left: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.page-shell {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.section-block {
  margin-bottom: 26px;
}

.section-heading,
.panel-header,
.detail-header,
.subsection-heading,
.statement-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h1,
.panel-header h2,
.detail-header h2 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.compact-heading {
  margin-bottom: 15px;
}

.compact-heading h1 {
  font-size: 25px;
}

.eyebrow {
  margin: 0;
  color: var(--brand);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1.15fr repeat(3, 1fr);
  gap: 13px;
}

.metric-card {
  position: relative;
  min-height: 139px;
  padding: 23px 23px 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 6px 20px rgba(25, 40, 37, 0.035);
}

.metric-card::after {
  position: absolute;
  right: -35px;
  bottom: -55px;
  width: 125px;
  height: 125px;
  border: 18px solid rgba(19, 111, 104, 0.035);
  border-radius: 50%;
  content: "";
}

.metric-primary {
  border-color: transparent;
  background: var(--brand-deep);
  color: #fff;
}

.metric-primary::after {
  border-color: rgba(255, 255, 255, 0.06);
}

.metric-label,
.metric-note {
  position: relative;
  z-index: 1;
  display: block;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.metric-primary .metric-label,
.metric-primary .metric-note {
  color: rgba(255, 255, 255, 0.68);
}

.metric-value {
  position: relative;
  z-index: 1;
  display: block;
  margin: 13px 0 8px;
  font-size: clamp(21px, 2vw, 29px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
  line-height: 1.1;
  white-space: nowrap;
}

.metric-note {
  color: var(--faint);
  font-size: 11px;
}

.metric-value.is-positive { color: var(--positive); }
.metric-value.is-negative { color: var(--negative); }
.metric-primary .metric-value { color: #fff; }

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(270px, 0.78fr) minmax(0, 2.22fr);
  gap: 16px;
  margin-bottom: 16px;
}

.operations-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.object-browser {
  min-height: 532px;
  padding: 23px 20px;
}

.panel-header {
  min-height: 45px;
  margin-bottom: 20px;
}

.panel-header h2 {
  font-size: 18px;
}

.icon-button,
.modal-close {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--brand-deep);
  font-size: 21px;
  line-height: 1;
}

.icon-button:hover,
.modal-close:hover {
  border-color: var(--line-strong);
  background: var(--brand-soft);
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field input {
  width: 100%;
  height: 44px;
  padding: 0 48px 0 39px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--ink);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.search-field input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(19, 111, 104, 0.1);
}

.search-field kbd {
  position: absolute;
  right: 9px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--faint);
  font: 10px var(--font-sans);
}

.search-glyph {
  position: absolute;
  z-index: 1;
  left: 15px;
  width: 13px;
  height: 13px;
  border: 1.8px solid var(--muted);
  border-radius: 50%;
}

.search-glyph::after {
  position: absolute;
  right: -4px;
  bottom: -3px;
  width: 6px;
  height: 1.8px;
  border-radius: 2px;
  background: var(--muted);
  content: "";
  transform: rotate(45deg);
}

.field-hint {
  margin: 7px 2px 15px;
  color: var(--faint);
  font-size: 11px;
}

.result-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  color: var(--muted);
  font-size: 11px;
}

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 12px;
  font-weight: 650;
}

.text-button:hover {
  text-decoration: underline;
}

.object-list {
  display: grid;
  gap: 6px;
  max-height: 365px;
  padding: 0;
  margin: 7px 0 0;
  overflow: auto;
  list-style: none;
  scrollbar-width: thin;
}

.object-item-button {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  text-align: left;
  transition: background 150ms ease, border-color 150ms ease;
}

.object-item-button:hover {
  background: var(--surface-soft);
}

.object-item-button.is-active {
  border-color: #cde1de;
  background: var(--brand-soft);
}

.object-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #edf0ed;
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.is-active .object-avatar {
  background: var(--brand);
  color: #fff;
}

.object-copy {
  min-width: 0;
}

.object-copy strong,
.object-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.object-copy strong {
  font-size: 13px;
}

.object-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.object-balance {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.empty-search {
  display: grid;
  justify-items: center;
  padding: 32px 12px 8px;
  color: var(--muted);
  text-align: center;
}

.empty-search strong {
  color: var(--ink);
}

.empty-search p {
  margin: 5px 0 16px;
  font-size: 12px;
}

.empty-symbol {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 11px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 24px;
}

.object-detail {
  min-height: 532px;
  padding: 27px 28px 23px;
}

.detail-empty {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 470px;
  text-align: center;
}

.detail-empty h2 {
  margin: 17px 0 5px;
  font-size: 18px;
}

.detail-empty p {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.detail-empty-mark {
  display: flex;
  align-items: end;
  gap: 4px;
  width: 54px;
  height: 54px;
  padding: 13px;
  border: 1px solid #cae0dc;
  border-radius: 16px;
  background: var(--brand-soft);
}

.detail-empty-mark i {
  width: 6px;
  border-radius: 3px 3px 1px 1px;
  background: var(--brand);
}

.detail-empty-mark i:nth-child(1) { height: 12px; }
.detail-empty-mark i:nth-child(2) { height: 24px; }
.detail-empty-mark i:nth-child(3) { height: 17px; }

.detail-header {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.detail-identity {
  min-width: 0;
}

.detail-identity h2 {
  margin: 5px 0 4px;
  font-size: 23px;
}

.detail-identity p {
  max-width: 600px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.object-code {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.funding-type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  margin-left: 5px;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 750;
  vertical-align: middle;
  white-space: nowrap;
}

.funding-type-long {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.funding-type-temporary {
  background: var(--warning-soft);
  color: var(--warning);
}

.funding-type-pill + .status-pill {
  margin-left: 6px;
}

.detail-actions,
.header-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, opacity 120ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.button-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 5px 13px rgba(19, 111, 104, 0.16);
}

.button-primary:hover:not(:disabled) {
  background: var(--brand-deep);
}

.button-secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--brand-deep);
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
  border-color: #bfd5d1;
  background: var(--brand-soft);
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.button-small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 11px;
}

.button-block {
  width: 100%;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.detail-metrics div {
  padding: 17px 19px;
  border-right: 1px solid var(--line);
}

.detail-metrics div:last-child {
  border-right: 0;
}

.detail-metrics dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
}

.detail-metrics dd {
  margin: 0;
  font-size: 16px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.subsection-heading {
  margin-bottom: 11px;
}

.subsection-heading-spaced,
.table-wrap + .subsection-heading {
  margin-top: 24px;
}

.subsection-heading h3 {
  margin: 0 0 2px;
  font-size: 14px;
}

.subsection-heading p,
.record-count {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

th,
td {
  height: 43px;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.025em;
}

tbody tr:last-child td,
tfoot tr:last-child th {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fbfcfb;
}

.align-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.empty-cell {
  height: 108px;
  color: var(--faint);
  text-align: center;
}

.type-pill,
.status-pill,
.rate-layer-pill {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 750;
}

.type-in,
.status-ready,
.status-paid,
.status-success {
  background: var(--positive-soft);
  color: var(--positive);
}

.type-out,
.status-failed {
  background: var(--negative-soft);
  color: var(--negative);
}

.status-draft,
.status-running,
.status-pending,
.status-partial {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-muted {
  background: #edf0ef;
  color: var(--muted);
}

.money-positive { color: var(--positive); }
.money-negative { color: var(--negative); }

.rate-layer-pill {
  margin-right: 7px;
}

.rate-layer-default {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.rate-layer-fixed {
  background: var(--warning-soft);
  color: var(--warning);
}

.rate-layer-value {
  color: var(--muted);
  font-size: 11px;
}

.lot-principal strong,
.lot-principal small,
.lot-accrual strong,
.lot-principal small,
.lot-accrual small,
.cell-subcopy {
  display: block;
}

.lot-accrual small,
.cell-subcopy {
  margin-top: 2px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 400;
}

.statement-panel,
.snapshot-panel {
  min-height: 400px;
  padding: 23px;
}

.operation-header {
  align-items: end;
}

.compact-control input {
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 11px;
}

.statement-summary {
  min-height: 35px;
  margin-top: -5px;
  color: var(--muted);
  font-size: 11px;
}

.statement-batch {
  margin: 7px 0 18px;
  padding: 20px;
  border: 1px solid #cfe0dd;
  border-radius: 13px;
  background: linear-gradient(145deg, #f8fbfa 0%, var(--brand-soft) 100%);
}

.statement-batch-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.statement-batch-heading > div:first-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.statement-batch-heading h3 {
  width: 100%;
  margin: 2px 0 5px;
  font-size: 18px;
}

.statement-version {
  color: var(--brand-deep);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.current-version-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 8px;
  border: 1px solid #b8d3ce;
  border-radius: 99px;
  color: var(--brand-deep);
  font-size: 10px;
  font-weight: 750;
}

.statement-batch-total {
  min-width: 220px;
  text-align: right;
}

.statement-batch-total span,
.statement-batch-total small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.statement-batch-total strong {
  display: block;
  margin: 5px 0 3px;
  color: var(--brand-deep);
  font-size: clamp(24px, 3vw, 34px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.statement-batch-metrics,
.statement-audit-meta {
  display: grid;
  margin: 18px 0 0;
}

.statement-batch-metrics {
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.statement-batch-metrics div {
  padding: 11px 13px;
  border-right: 1px solid var(--line);
}

.statement-batch-metrics div:last-child { border-right: 0; }

.statement-batch-metrics dt,
.statement-audit-meta dt {
  color: var(--faint);
  font-size: 9px;
}

.statement-batch-metrics dd,
.statement-audit-meta dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.statement-audit-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.statement-audit-meta div {
  min-width: 0;
  padding-left: 9px;
  border-left: 2px solid #d9e5e2;
}

.statement-audit-meta dd {
  overflow-wrap: anywhere;
  font-weight: 550;
}

.statement-action-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.statement-action-section p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.statement-action-bar {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.statement-digest {
  margin: 13px 0 0;
  color: var(--faint);
  font-size: 9px;
}

.statement-digest code {
  display: inline-block;
  max-width: min(580px, 75vw);
  margin-left: 5px;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.statement-empty {
  min-height: 112px;
  margin: 7px 0 18px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  color: var(--muted);
  text-align: center;
}

.statement-empty strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
}

.statement-empty p { margin: 0; font-size: 11px; }

.statement-history-grid {
  display: grid;
  grid-template-columns: minmax(190px, 0.65fr) minmax(260px, 1.35fr);
  gap: 20px;
  margin-top: 24px;
  padding-top: 21px;
  border-top: 1px solid var(--line);
}

.statement-history-grid .subsection-heading { margin-bottom: 10px; }

.statement-version-list {
  display: grid;
  gap: 7px;
}

.statement-version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
}

.statement-version-item:hover,
.statement-version-item.is-selected {
  border-color: #b8d3ce;
  background: var(--brand-soft);
}

.statement-version-item span:first-child { display: grid; gap: 2px; }
.statement-version-item small { color: var(--faint); font-size: 9px; }

.statement-action-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.statement-action-list li {
  position: relative;
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 8px;
  padding-bottom: 13px;
}

.statement-action-list li:not(:last-child)::before {
  position: absolute;
  top: 12px;
  bottom: -1px;
  left: 5px;
  width: 1px;
  background: #cbdcd8;
  content: "";
}

.statement-action-dot {
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  margin-top: 2px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 1px #b8d3ce;
}

.statement-action-list strong,
.statement-action-list small {
  display: block;
}

.statement-action-list strong { font-size: 11px; }
.statement-action-list small { margin-top: 2px; color: var(--faint); font-size: 9px; }

.statement-action-list p {
  margin: 6px 0 0;
  padding: 7px 9px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
}

.statement-action-empty { color: var(--faint); font-size: 10px; }

tfoot th {
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 11px;
}

.snapshot-list {
  display: grid;
  gap: 9px;
}

.snapshot-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.snapshot-date {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--brand-deep);
  font-size: 10px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  text-align: center;
}

.snapshot-copy {
  min-width: 0;
}

.snapshot-copy strong,
.snapshot-copy small {
  display: block;
}

.snapshot-copy strong {
  margin-bottom: 3px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.snapshot-copy small {
  color: var(--muted);
  font-size: 10px;
}

.snapshot-amount {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.snapshot-row > span:last-child {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.snapshot-date small {
  color: var(--muted);
  font-size: 9px;
}

.empty-list {
  display: grid;
  place-items: center;
  min-height: 230px;
  padding: 30px;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

.inline-message,
.form-error,
.form-note {
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 11px;
}

.inline-message {
  margin: 11px 0 0;
  background: var(--warning-soft);
  color: #77500e;
}

.error-message,
.form-error {
  background: var(--negative-soft);
  color: #8d362f;
}

.form-error {
  margin: 15px 0 0;
}

.form-note {
  margin: 15px 0 0;
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.modal {
  width: min(620px, calc(100% - 28px));
  max-height: calc(100vh - 36px);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 17px;
  background: transparent;
  box-shadow: var(--shadow-dialog);
}

.modal::backdrop {
  background: rgba(18, 29, 27, 0.48);
  backdrop-filter: blur(3px);
}

.modal-card {
  max-height: calc(100vh - 36px);
  padding: 25px;
  overflow-y: auto;
  border-radius: 17px;
  background: var(--surface);
}

.modal-card-narrow {
  max-width: 530px;
  margin: auto;
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.modal-header h2 {
  margin: 3px 0 0;
  font-size: 21px;
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
}

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

.field {
  display: grid;
  align-content: start;
  gap: 6px;
}

.field-full {
  grid-column: 1 / -1;
}

.field > span,
.direction-picker legend {
  color: #48524f;
  font-size: 11px;
  font-weight: 700;
}

.field b {
  color: var(--negative);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 130ms ease, box-shadow 130ms ease;
}

.field input,
.field select {
  height: 41px;
  padding: 0 11px;
}

.field textarea {
  min-height: 66px;
  padding: 9px 11px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(19, 111, 104, 0.1);
}

.field small {
  color: var(--faint);
  font-size: 10px;
}

.field input[readonly] {
  cursor: not-allowed;
  background: var(--surface-soft);
  color: var(--muted);
}

.optional-fields {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.optional-fields summary {
  color: var(--brand-deep);
  font-size: 11px;
  font-weight: 700;
}

.opening-fields-title {
  color: var(--brand-deep);
  font-size: 11px;
}

.optional-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.direction-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  padding: 0;
  margin: 0 0 18px;
  border: 0;
}

.direction-picker legend {
  margin-bottom: 7px;
}

.direction-picker label {
  position: relative;
  cursor: pointer;
}

.direction-picker input {
  position: absolute;
  opacity: 0;
}

.direction-picker span {
  display: grid;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.direction-picker strong {
  font-size: 12px;
}

.direction-picker small {
  color: var(--muted);
  font-size: 10px;
}

.direction-picker input:checked + span {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-deep);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.rate-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  margin-bottom: 17px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
}

.rate-current strong {
  color: var(--ink);
  font-size: 17px;
}

.entry-rate-editor {
  padding: 14px;
  margin-top: 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.entry-rate-editor .field input,
.entry-rate-editor .field select {
  background: #fff;
}

.settlement-rule-note {
  margin: -5px 0 18px;
}

.settlement-form-grid {
  margin-bottom: 16px;
}

.settlement-preview {
  min-height: 116px;
  padding: 14px;
  margin-bottom: 17px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
}

.settlement-preview-loading {
  display: grid;
  min-height: 86px;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}

.settlement-preview dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  margin: 0;
  overflow: hidden;
  border-radius: 9px;
  background: var(--line);
}

.settlement-preview dl > div {
  min-width: 0;
  padding: 11px 12px;
  background: #fff;
}

.settlement-preview dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
}

.settlement-preview dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.settlement-preview .settlement-payable {
  background: var(--brand-soft);
}

.settlement-preview .settlement-payable dd {
  color: var(--brand-deep);
  font-size: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 8px;
  width: min(390px, calc(100% - 36px));
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(18, 29, 27, 0.16);
  pointer-events: auto;
  animation: toast-in 180ms ease-out both;
}

.toast::before {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--brand);
  content: "";
}

.toast.toast-error::before { background: var(--negative); }
.toast.toast-success::before { background: var(--positive); }

.toast strong,
.toast span {
  display: block;
}

.toast strong {
  font-size: 12px;
}

.toast span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.toast button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
}

.noscript {
  position: fixed;
  inset: auto 20px 20px;
  padding: 12px;
  border-radius: 8px;
  background: var(--negative-soft);
  color: var(--negative);
  text-align: center;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

@media (max-width: 1120px) {
  .overview-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .operations-grid {
    grid-template-columns: 1fr;
  }

  .snapshot-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 820px) {
  .app-header {
    padding: 0 19px;
  }

  .page-shell {
    width: min(100% - 28px, 720px);
    padding-top: 23px;
  }

  .today-label {
    display: none;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .object-browser {
    min-height: auto;
  }

  .object-list {
    max-height: 260px;
  }

  .object-detail {
    min-height: 450px;
  }

  .detail-empty {
    min-height: 380px;
  }

  .detail-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-metrics div:nth-child(2) {
    border-right: 0;
  }

  .detail-metrics div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .statement-batch-heading,
  .statement-action-section {
    align-items: stretch;
    flex-direction: column;
  }

  .statement-batch-total { text-align: left; }
  .statement-action-bar { justify-content: flex-start; }
  .statement-audit-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .app-header {
    min-height: 59px;
  }

  .brand small,
  .connection-state {
    display: none;
  }

  .page-shell {
    width: calc(100% - 20px);
    padding: 18px 0 34px;
  }

  .section-heading h1 {
    font-size: 22px;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 113px;
    padding: 18px;
  }

  .metric-value {
    margin: 9px 0 5px;
    font-size: 24px;
  }

  .object-browser,
  .object-detail,
  .statement-panel,
  .snapshot-panel {
    padding: 18px;
  }

  .detail-header,
  .operation-header {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-actions,
  .header-controls {
    width: 100%;
  }

  .detail-actions .button,
  .header-controls .button,
  .compact-control {
    flex: 1;
  }

  .compact-control input {
    width: 100%;
  }

  .detail-metrics {
    grid-template-columns: 1fr;
  }

  .detail-metrics div,
  .detail-metrics div:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .detail-metrics div:last-child {
    border-bottom: 0;
  }

  .snapshot-list {
    grid-template-columns: 1fr;
  }

  .statement-batch { padding: 16px; }

  .statement-batch-metrics,
  .statement-audit-meta,
  .statement-history-grid {
    grid-template-columns: 1fr;
  }

  .statement-batch-metrics div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .statement-batch-metrics div:last-child { border-bottom: 0; }

  .statement-action-bar .button { flex: 1 1 100%; }

  .form-grid,
  .optional-grid,
  .direction-picker {
    grid-template-columns: 1fr;
  }

  .settlement-preview dl {
    grid-template-columns: 1fr;
  }

  .modal-card {
    padding: 20px;
  }

  .toast-region {
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
