:root {
  color-scheme: light;
  --paper: #f2f4f7;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --ink: #111827;
  --muted: #657083;
  --faint: #8b95a5;
  --line: #dfe4ea;
  --line-strong: #c7ced8;
  --budget: #4147a8;
  --budget-soft: #ececf8;
  --tether: #087f62;
  --tether-soft: #e1f2ec;
  --fee: #9a6717;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --focus: #2563eb;
  --placeholder: #667085;
  --shadow: 0 18px 50px rgba(16, 24, 40, 0.12);
  --font: 'Manrope', ui-sans-serif, system-ui, sans-serif;
  --numbers: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  background: var(--paper);
  overflow-x: hidden;
}
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.material-symbols-outlined {
  font-size: 20px;
  font-variation-settings:
    'FILL' 0,
    'wght' 450,
    'GRAD' 0,
    'opsz' 20;
}

.desk-shell {
  min-height: 100vh;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
  padding: 10px clamp(18px, 4vw, 64px);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.brand img {
  width: 82px;
  height: auto;
  object-fit: contain;
}
.brand-rule {
  width: 1px;
  height: 26px;
  background: var(--line-strong);
}
.topbar-actions,
.command-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-actions {
  min-width: 0;
}
.operator-identity {
  display: flex;
  min-width: 0;
  max-width: 280px;
  align-items: center;
  gap: 9px;
  padding-right: 10px;
  border-right: 1px solid var(--line);
}
.operator-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 50%;
  color: var(--budget);
  background: var(--budget-soft);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
}
.operator-copy {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}
.operator-copy strong,
.operator-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.operator-copy strong {
  color: var(--ink);
  font-size: 13px;
}
.operator-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.integrity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.integrity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}
.integrity.ready .integrity-dot {
  background: var(--tether);
  box-shadow: 0 2px 9px color-mix(in srgb, var(--tether) 35%, transparent);
}
.integrity.error .integrity-dot {
  background: var(--danger);
}

main {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 64px) 32px;
}
.balance-band {
  display: grid;
  grid-template-columns:
    minmax(220px, 0.8fr) minmax(360px, 1.45fr)
    minmax(360px, 1.2fr);
  gap: clamp(28px, 3.5vw, 58px);
  align-items: center;
  min-height: 210px;
  padding: clamp(28px, 3vw, 42px);
  color: #f8fafc;
  background: #151c2b;
  border-radius: 16px;
  box-shadow: 0 20px 54px rgba(15, 23, 42, 0.2);
  overflow: hidden;
  position: relative;
}
.balance-band::after {
  content: '';
  position: absolute;
  inset: auto -8% -52% 42%;
  height: 170%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(65, 71, 168, 0.52),
    rgba(8, 127, 98, 0.2) 44%,
    transparent 69%
  );
  pointer-events: none;
}
.balance-band > * {
  position: relative;
  z-index: 1;
}
.balance-copy h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1;
  letter-spacing: -0.04em;
}
.balance-copy p {
  max-width: 42ch;
  margin: 14px 0 0;
  color: #b7c0d0;
  font-size: 14px;
  line-height: 1.65;
}
.available-balance > span {
  display: block;
  color: #aeb8c9;
  font-size: 12px;
  font-weight: 700;
}
.available-balance {
  min-width: 0;
  container-type: inline-size;
  text-align: center;
}
.available-balance strong {
  display: block;
  margin-top: 7px;
  font-family: var(--numbers);
  font-size: clamp(28px, calc(150cqi / var(--amount-characters, 10)), 68px);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.available-balance strong > span {
  display: block;
  max-width: 100%;
}
.available-balance strong small {
  display: block;
  margin-top: 10px;
  color: #aeb8c9;
  font-family: var(--font);
  font-size: 15px;
  letter-spacing: 0;
}
.available-balance.over strong {
  color: #ffaaa4;
}
.balance-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 30px;
  margin: 0;
  padding-left: clamp(26px, 3vw, 44px);
  border-left: 1px solid rgba(255, 255, 255, 0.13);
}
.balance-totals div {
  min-width: 0;
}
.balance-totals dt {
  color: #aeb8c9;
  font-size: 12px;
  font-weight: 700;
}
.balance-totals dd {
  margin: 7px 0 0;
  color: #fff;
  font: 500 18px/1.3 var(--numbers);
  font-variant-numeric: tabular-nums;
  white-space: normal;
}

.status-banner {
  margin: 0 0 16px;
  padding: 13px 15px;
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
}
.status-banner.error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}
.status-banner.success {
  color: var(--tether);
  background: var(--tether-soft);
  border-color: color-mix(in srgb, var(--tether) 25%, transparent);
}
.command-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0 18px;
}
.command-copy h2,
.section-heading h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.025em;
}
.command-copy p,
.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.primary-button,
.secondary-button,
.quiet-button,
.danger-button,
.icon-button,
.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 13px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}
.primary-button {
  color: white;
  background: #38409a;
  border-color: #38409a;
}
.primary-button:hover {
  background: #2f3584;
  transform: translateY(-1px);
}
.secondary-button {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}
.secondary-button:hover,
.quiet-button:hover,
.icon-button:hover,
.row-action:hover {
  background: var(--surface-subtle);
  border-color: var(--line-strong);
}
.quiet-button {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}
.danger-button {
  color: white;
  background: #b42318;
  border-color: #b42318;
}
.icon-button,
.row-action {
  width: 40px;
  padding: 8px;
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}
.row-action {
  width: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
}
button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none !important;
}

.ledger-section {
  margin-top: 18px;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
  padding: 12px 2px;
}
.section-copy {
  flex: 0 0 auto;
}
.section-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  min-width: 0;
}
.count-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.search-field {
  position: relative;
  display: flex;
  align-items: center;
  width: clamp(220px, 22vw, 320px);
  min-height: 42px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}
.search-field:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 14%, transparent);
}
.search-field > .material-symbols-outlined {
  flex: 0 0 auto;
  margin-left: 11px;
  font-size: 19px;
}
.search-field input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 9px 38px 9px 8px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 14px;
}
.search-field input::placeholder {
  color: var(--placeholder);
}
.search-field input::-webkit-search-cancel-button {
  appearance: none;
}
.search-clear {
  position: absolute;
  right: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}
.search-clear:hover {
  color: var(--ink);
  background: var(--surface-subtle);
}
.search-clear .material-symbols-outlined {
  font-size: 18px;
}
.date-filter {
  position: relative;
  flex: 0 0 auto;
}
.date-filter summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style: none;
  white-space: nowrap;
}
.date-filter summary::-webkit-details-marker {
  display: none;
}
.date-filter summary:hover {
  color: var(--ink);
  background: var(--surface-subtle);
}
.date-filter summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.date-filter.active summary,
.date-filter[open] summary {
  color: var(--budget);
  background: var(--budget-soft);
  border-color: color-mix(in srgb, var(--budget) 42%, var(--line));
}
.date-filter summary .material-symbols-outlined {
  font-size: 18px;
}
.date-chevron {
  transition: transform 160ms ease;
}
.date-filter[open] .date-chevron {
  transform: rotate(180deg);
}
.date-popover {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 15;
  width: min(360px, calc(100vw - 32px));
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.date-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.date-field-grid label {
  display: grid;
  gap: 7px;
}
.date-field-grid label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}
.date-field-grid input {
  width: 100%;
  min-height: 40px;
  padding: 8px 9px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-size: 12px;
}
.date-field-grid input[aria-invalid='true'] {
  border-color: var(--danger);
}
.filter-error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 11px;
  line-height: 1.45;
}
.date-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.date-actions button {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 12px;
}
.filter-clear {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 8px;
  color: var(--budget);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}
.filter-clear:hover {
  background: var(--budget-soft);
}
.table-frame {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.table-frame.loading::after {
  content: '';
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 8;
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--budget);
  border-radius: 50%;
  animation: ledger-spin 700ms linear infinite;
}
@keyframes ledger-spin {
  to {
    transform: rotate(360deg);
  }
}
.allocation-table-frame {
  max-height: min(390px, 42vh);
}
.conversion-table-frame {
  max-height: min(300px, 34vh);
}
.table-frame:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.table-frame {
  scrollbar-color: var(--line-strong) var(--surface-subtle);
  scrollbar-width: thin;
}
.table-frame::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.table-frame::-webkit-scrollbar-track {
  background: var(--surface-subtle);
}
.table-frame::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 2px solid var(--surface-subtle);
  border-radius: 999px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 12px 14px;
  color: var(--muted);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.03);
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.035em;
  font-weight: 750;
  text-transform: uppercase;
  white-space: nowrap;
}
td {
  min-height: 50px;
  padding: 15px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th:first-child,
td:first-child {
  left: 0;
}
th:last-child,
td:last-child {
  right: 0;
}
th:first-child,
th:last-child {
  z-index: 6;
}
td:first-child,
td:last-child {
  position: sticky;
  z-index: 2;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: color-mix(in srgb, var(--surface-subtle) 70%, transparent);
}
tbody tr:hover td {
  background: color-mix(in srgb, var(--surface-subtle) 72%, var(--surface));
}
.number {
  font-family: var(--numbers);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.budget-number {
  color: var(--budget);
  font-weight: 700;
}
.tether-number {
  color: var(--tether);
  font-weight: 700;
}
.fee-number {
  color: var(--fee);
}
.negative {
  color: var(--danger);
}
.record-title {
  color: var(--ink);
  font-weight: 750;
  white-space: nowrap;
}
.record-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}
.actor-cell {
  max-width: 220px;
  color: var(--muted);
  font-family: var(--numbers);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.note-cell {
  max-width: 260px;
  color: var(--muted);
  line-height: 1.45;
  word-break: break-word;
}
.wallet {
  display: block;
  max-width: 190px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--numbers);
  font-size: 11px;
}
.network-badge {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 7px;
  color: var(--tether);
  background: var(--tether-soft);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 8px 2px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.table-pagination p {
  margin: 0;
  font-family: var(--numbers);
  font-variant-numeric: tabular-nums;
}
.pagination-controls,
.pagination-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pagination-controls select {
  min-height: 34px;
  padding: 5px 28px 5px 9px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}
.pagination-controls > span {
  min-width: 86px;
  text-align: center;
  white-space: nowrap;
}
.page-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
}
.page-button:hover:not(:disabled) {
  color: var(--ink);
  background: var(--surface-subtle);
}
.page-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.usdt-desk-page .flatpickr-calendar.fp-modern {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-family: var(--font);
}
.usdt-desk-page .flatpickr-calendar.fp-modern .flatpickr-months {
  padding: 10px 12px 7px;
  border-bottom-color: var(--line);
}
.usdt-desk-page .flatpickr-calendar.fp-modern .flatpickr-day {
  color: var(--ink);
  border-radius: 7px;
  font-weight: 600;
}
.usdt-desk-page .flatpickr-calendar.fp-modern .flatpickr-day:hover,
.usdt-desk-page .flatpickr-calendar.fp-modern .flatpickr-day:focus {
  background: var(--surface-subtle);
  border-color: var(--line-strong);
}
.usdt-desk-page .flatpickr-calendar.fp-modern .flatpickr-day.inRange {
  color: var(--budget);
  background: var(--budget-soft);
  border-color: transparent;
  box-shadow: none;
}
.usdt-desk-page .flatpickr-calendar.fp-modern .flatpickr-day.selected,
.usdt-desk-page .flatpickr-calendar.fp-modern .flatpickr-day.startRange,
.usdt-desk-page .flatpickr-calendar.fp-modern .flatpickr-day.endRange {
  color: var(--surface);
  background: var(--budget);
  border-color: var(--budget);
  box-shadow: none;
}
.usdt-desk-page .flatpickr-calendar.fp-modern .flatpickr-day.today {
  border-color: var(--budget);
}
.usdt-desk-page .flatpickr-calendar.fp-modern .flatpickr-footer {
  background: var(--surface-subtle);
  border-top-color: var(--line);
}
.usdt-desk-page .flatpickr-calendar.fp-modern .fp-pill {
  color: var(--muted);
  background: var(--surface);
  border-color: var(--line-strong);
  border-radius: 8px;
  box-shadow: none;
}
.usdt-desk-page .flatpickr-calendar.fp-modern .fp-pill:hover {
  color: var(--budget);
  background: var(--budget-soft);
  border-color: color-mix(in srgb, var(--budget) 42%, var(--line));
  box-shadow: none;
}
.table-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--tether);
  font-weight: 700;
  text-decoration: none;
}
.table-link:hover {
  text-decoration: underline;
}
.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}
.empty-state {
  padding: 52px 18px;
  text-align: center;
}
.empty-state .material-symbols-outlined {
  color: var(--faint);
  font-size: 28px;
}
.empty-state h3 {
  margin: 12px 0 0;
  font-size: 15px;
}
.empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.empty-clear {
  margin-top: 16px;
}
.ledger-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 11px;
}
.ledger-footer p {
  margin: 0;
}
.ledger-footer code {
  max-width: 55%;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desk-dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.desk-dialog.wide {
  width: min(680px, calc(100vw - 28px));
}
.desk-dialog.compact {
  width: min(440px, calc(100vw - 28px));
}
.desk-dialog::backdrop {
  background: rgba(9, 14, 23, 0.62);
  backdrop-filter: blur(3px);
}
.desk-dialog form {
  display: grid;
  gap: 17px;
  padding: 22px;
}
.desk-dialog form > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 2px;
}
.desk-dialog h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.025em;
}
.desk-dialog header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.dialog-close:hover {
  background: var(--surface-subtle);
}
.field-grid {
  display: grid;
  gap: 13px;
}
.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.desk-dialog label {
  display: grid;
  gap: 7px;
}
.desk-dialog label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}
.desk-dialog label em {
  color: var(--muted);
  font-style: normal;
  font-weight: 500;
}
.desk-dialog input,
.desk-dialog select,
.desk-dialog textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-size: 13px;
}
.desk-dialog textarea {
  resize: vertical;
  line-height: 1.5;
}
.desk-dialog input::placeholder,
.desk-dialog textarea::placeholder {
  color: var(--placeholder);
}
.input-suffix {
  position: relative;
}
.input-suffix input {
  padding-right: 48px;
  font-family: var(--numbers);
}
.input-suffix b {
  position: absolute;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  color: var(--faint);
  font-size: 10px;
}
.conversion-preview {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 11px;
}
.conversion-preview strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font: 600 13px var(--numbers);
}
.form-status {
  min-height: 18px;
  color: var(--danger);
  font-size: 11px;
}
.desk-dialog form > footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 3px;
}

@media (max-width: 1180px) {
  .balance-band {
    grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.5fr);
  }
  .balance-totals {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 22px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.13);
    border-left: 0;
  }
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding-top: 16px;
  }
  .section-tools {
    width: 100%;
    justify-content: flex-start;
  }
  .search-field {
    width: min(360px, 100%);
  }
  table {
    min-width: 980px;
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 60px;
  }
  .brand img {
    width: 68px;
  }
  .brand-rule,
  .brand > span:last-child,
  .integrity {
    display: none;
  }
  .topbar-actions .quiet-button {
    width: 40px;
    padding: 8px;
    font-size: 0;
  }
  .operator-identity {
    max-width: min(46vw, 190px);
    padding-right: 8px;
  }
  .operator-copy span {
    display: none;
  }
  .operator-copy strong {
    display: block;
  }
  main {
    padding-bottom: 24px;
  }
  .balance-band {
    grid-template-columns: 1fr;
    gap: 20px;
    min-height: 0;
    padding: 22px;
  }
  .balance-copy h1 {
    font-size: 32px;
  }
  .balance-copy p {
    font-size: 13px;
  }
  .balance-totals {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px 18px;
    padding-top: 18px;
  }
  .balance-totals dt {
    font-size: 11px;
  }
  .balance-totals dd {
    font-size: 14px;
  }
  .command-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .command-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
  }
  .command-actions .primary-button {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  .command-actions button {
    width: 100%;
  }
  .section-heading {
    min-height: 0;
  }
  .section-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
  }
  .search-field {
    grid-column: 1 / -1;
    width: 100%;
  }
  .filter-clear {
    justify-self: start;
  }
  .count-badge {
    align-self: center;
    justify-self: end;
  }
  .date-popover {
    right: auto;
    left: 0;
  }
  .allocation-table-frame,
  .conversion-table-frame {
    max-height: min(430px, 56vh);
  }
  .ledger-footer {
    flex-direction: column;
  }
  .ledger-footer code {
    max-width: 100%;
  }
  .field-grid.two {
    grid-template-columns: 1fr;
  }
  .desk-dialog {
    max-height: calc(100vh - 12px);
  }
  .desk-dialog form {
    padding: 18px;
  }
  .conversion-preview {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .table-pagination {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }
  .pagination-controls {
    justify-content: space-between;
  }
  .pagination-controls > span {
    min-width: 0;
  }
}

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