:root {
  color: #172033;
  background: #f4f6f8;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  font-synthesis: none;
  --border: #d6dce5;
  --muted: #66758b;
  --surface: #ffffff;
  --surface-muted: #f7f9fb;
  --primary: #1859a9;
  --primary-dark: #114783;
  --success: #197146;
  --success-bg: #eaf6ef;
  --warning: #8a5a00;
  --warning-bg: #fff4d8;
  --danger: #a83232;
  --danger-bg: #fdecec;
  --info: #285f91;
  --info-bg: #eaf3fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: #f4f6f8;
  color: #172033;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(24 89 169 / 22%);
  outline-offset: 1px;
}

.topbar {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar h1,
.section-heading h2,
.dialog-header h2,
.confirm-shell h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 22px;
  line-height: 1.25;
}

.topbar-tools {
  display: grid;
  min-width: 0;
  justify-items: end;
  gap: 8px;
}

.service-status-panel {
  position: relative;
  width: min(100%, 640px);
  min-width: 0;
}

.service-status-list {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(5, minmax(104px, 1fr));
  gap: 6px;
}

.service-status {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 58px;
  align-content: center;
  gap: 2px;
  padding: 6px 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-muted);
  color: #172033;
  text-align: left;
}

.service-status:hover,
.service-status[aria-expanded="true"] {
  border-color: #8fa7c2;
  background: #f1f6fb;
}

.service-status-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.service-status-heading strong,
.service-status-label,
.service-status-activity,
.service-status-time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-status-heading strong { font-size: 11px; }

.service-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #8995a6;
}

.service-status-label {
  min-width: 0;
  color: #46566d;
  font-size: 10px;
  font-weight: 700;
}

.service-status-state {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.service-status-activity {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 3px;
  color: var(--info);
  font-size: 9px;
  font-weight: 700;
}

.service-status-spinner {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border: 1px solid #a9bfd6;
  border-top-color: var(--info);
  border-radius: 50%;
  animation: service-status-spin 0.8s linear infinite;
}

@keyframes service-status-spin {
  to { transform: rotate(360deg); }
}

.service-status-time {
  color: var(--muted);
  font-size: 9px;
}

.service-status.tone-success .service-status-dot { background: var(--success); }
.service-status.tone-checking .service-status-dot { background: var(--info); }
.service-status.tone-warning .service-status-dot { background: #c48616; }
.service-status.tone-danger .service-status-dot { background: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  .service-status-spinner,
  .row-refresh-button.is-pending::before { animation: none; }
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.runtime-context {
  display: grid;
  width: min(100%, 760px);
  min-width: 0;
  gap: 5px;
}

.runtime-context-primary,
.interface-refresh-context,
.runtime-context-actions,
.runtime-context-details {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.runtime-context-primary {
  justify-content: flex-end;
}

.interface-refresh-context {
  flex: 0 0 auto;
}

.runtime-context-actions {
  flex: 1 1 auto;
  justify-content: flex-end;
}

.runtime-context-actions a.button {
  text-decoration: none;
}

.communication-attention-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.communication-attention-trigger[hidden],
.notification-count[hidden] {
  display: none;
}

.notification-center-trigger {
  position: relative;
  flex: 0 0 36px;
}

.notification-bell {
  position: relative;
  display: block;
  width: 14px;
  height: 15px;
  margin: 0 auto;
  border: 2px solid currentColor;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  border-bottom: 0;
}

.notification-bell::before {
  position: absolute;
  right: -4px;
  bottom: -3px;
  left: -4px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  content: "";
}

.notification-bell::after {
  position: absolute;
  bottom: -7px;
  left: 4px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.notification-center-trigger .notification-count {
  position: absolute;
  top: -6px;
  right: -7px;
}

.notification-count {
  display: inline-grid;
  min-width: 18px;
  min-height: 18px;
  place-items: center;
  padding: 1px 5px;
  border-radius: 9px;
  background: #a53636;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.runtime-context-details {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  justify-content: flex-end;
  white-space: nowrap;
}

.connection-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #a7b0bd;
}

.connection-dot.online {
  background: #2b8a57;
}

.connection-dot.offline {
  background: #c13d3d;
}

.context-separator {
  width: 1px;
  height: 18px;
  background: var(--border);
}

.workspace {
  --workspace-bottom-padding: 40px;
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: 18px 24px 40px;
}

.state-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #e1c473;
  border-radius: 6px;
  background: var(--warning-bg);
  color: #5f470d;
}

.state-banner > div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.state-banner.danger {
  border-color: #e0a1a1;
  background: var(--danger-bg);
  color: #772626;
}

.interface-refresh {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  color: #466178;
  font-size: 19px;
  line-height: 1;
}

.interface-refresh[data-pending="true"] {
  border-color: #c48616;
  color: #8a5a00;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.workspace-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.workspace-tabs button {
  min-height: 36px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #4c5b70;
  font-weight: 700;
}

.workspace-tabs button[aria-selected="true"] {
  border-bottom-color: var(--primary);
  color: var(--primary-dark);
}

.uat-remark-marker {
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 8px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 11px;
  font-weight: 700;
}

.uat-remarks-panel {
  border: 1px solid var(--border);
  background: var(--surface);
}

.uat-remarks-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.uat-remark-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.uat-remark-create-form label,
.uat-remark-filter {
  display: grid;
  gap: 5px;
  color: #4c5b70;
  font-size: 11px;
  font-weight: 700;
}

.uat-remarks-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.uat-remarks-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid #e4e8ee;
}

.uat-remark-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 12px;
}

.uat-remark-status {
  align-self: start;
}

.payment-uat-remark-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

.metric {
  --metric-border: var(--border);
  --metric-accent: var(--primary);
  --metric-background: var(--surface);
  display: grid;
  height: 88px;
  min-height: 88px;
  grid-template-columns: minmax(0, 1fr) minmax(54px, 0.9fr);
  align-items: start;
  gap: 6px 12px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--metric-border);
  border-radius: 6px;
  background: var(--metric-background);
  text-align: left;
}

.metric:hover,
.metric.active {
  border-color: var(--metric-accent);
  background: var(--metric-background);
  box-shadow: inset 0 0 0 1px var(--metric-accent);
}

.metric.tone-neutral {
  --metric-border: var(--border);
  --metric-accent: var(--primary);
  --metric-background: var(--surface);
}

.metric.tone-info {
  --metric-border: var(--info);
  --metric-accent: var(--info);
  --metric-background: var(--info-bg);
}

.metric.tone-warning {
  --metric-border: var(--warning);
  --metric-accent: var(--warning);
  --metric-background: var(--warning-bg);
}

.metric.tone-success {
  --metric-border: var(--success);
  --metric-accent: var(--success);
  --metric-background: var(--success-bg);
}

.metric-value,
.metric-all-value {
  width: fit-content;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.metric-value {
  display: grid;
  width: 100%;
  max-width: 100%;
  grid-row: 1 / span 2;
  grid-column: 2;
  justify-items: end;
  gap: 2px;
  overflow: hidden;
  white-space: nowrap;
}

.metric-all-value {
  width: 100%;
  grid-column: 1 / -1;
  overflow: hidden;
}

.metric-all-value small {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
}

.metric-all-value small > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-value:hover strong,
.metric-value:focus-visible strong,
.metric-all-value:hover small,
.metric-all-value:focus-visible small {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.metric-label {
  color: #3d4d64;
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  color: #162c49;
  font-size: 26px;
  line-height: 1;
}

.metric small,
.metric-amount,
.metric-all-amount {
  color: var(--muted);
  font-size: 11px;
}

.metric-amount,
.metric-all-amount {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-all-amount {
  min-width: 0;
  flex: 0 1 auto;
}

.filters {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) repeat(4, minmax(120px, 0.65fr)) minmax(200px, 1fr) auto;
  align-items: start;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.filters label {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: #4c5b70;
  font-size: 11px;
  font-weight: 700;
  line-height: 13px;
}

input,
select,
textarea,
output {
  width: 100%;
  min-height: 36px;
  padding: 8px 9px;
  border: 1px solid #bcc6d3;
  border-radius: 4px;
  background: #fff;
}

output {
  display: block;
  background: #f3f5f7;
}

textarea {
  min-height: 72px;
  resize: vertical;
}

.period-filter {
  display: grid;
  gap: 6px;
}

.date-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
}

.quick-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.quick-periods button {
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  color: #4b5c72;
  font-size: 11px;
}

.quick-periods button.active {
  border-color: #7e9ec6;
  background: #edf5fd;
  color: #164f91;
}

.filter-reset-wrap {
  display: grid;
  gap: 5px;
}

.filter-label-spacer {
  height: 13px;
}

.button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-weight: 700;
}

.button.primary {
  background: var(--primary);
  color: #fff;
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.secondary {
  border-color: #b7c2d0;
  background: #fff;
  color: #2d4666;
}

.button.compact {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.registry {
  border: 1px solid var(--border);
  background: var(--surface);
}

.section-heading {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.section-heading h2 {
  font-size: 16px;
}

.section-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.section-actions {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 8px;
}

.section-action-buttons,
.import-period {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-action-buttons {
  justify-content: flex-end;
  min-width: 0;
}

.sync-status,
.interface-refresh-status {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.sync-status {
  min-width: 0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-status[data-attention="true"] {
  color: var(--warning);
  font-weight: 700;
}

.interface-refresh-status {
  white-space: nowrap;
}

.column-picker {
  position: relative;
}

.column-picker summary {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.column-picker summary::-webkit-details-marker {
  display: none;
}

.column-picker-menu {
  position: absolute;
  z-index: 12;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  width: 250px;
  max-height: min(420px, calc(100vh - 140px));
  gap: 2px;
  padding: 8px;
  overflow-y: auto;
  border: 1px solid #bcc6d3;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 12px 30px rgb(27 42 63 / 20%);
}

.column-picker-menu label {
  display: flex;
  min-height: 32px;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  color: #34445a;
  font-size: 12px;
  font-weight: 600;
}

.column-picker-menu label:hover {
  background: #f3f6f9;
}

.column-picker-menu input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
}

.import-period label {
  display: grid;
  flex: 1 1 0;
  gap: 6px;
}

.import-period input {
  width: 100%;
}

.data-table-frame {
  position: relative;
  max-width: 100%;
}

.data-table-scroll {
  max-width: 100%;
  max-height: min(70dvh, 720px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.data-table-mobile-head {
  position: sticky;
  z-index: 6;
  top: 0;
  display: none;
  width: 100%;
  box-sizing: border-box;
  gap: 4px 8px;
  padding: 8px 11px;
  background: #eef2f6;
  box-shadow: 0 2px 5px rgb(30 46 66 / 14%);
  color: #44546b;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

[data-column][hidden],
[data-column-group][hidden] {
  display: none !important;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.registry-data-table {
  --registry-sticky-status-width: 132px;
  --registry-sticky-action-width: 188px;

  min-width: 1180px;
}

.data-table th,
.data-table td {
  padding: 10px;
  border-right: 1px solid #e4e8ee;
  border-bottom: 1px solid #e4e8ee;
  background: #fff;
  vertical-align: top;
  text-align: left;
}

.data-table th {
  position: sticky;
  z-index: 3;
  top: 0;
  background: #eef2f6;
  color: #44546b;
  font-size: 11px;
  text-transform: uppercase;
}

.column-groups th {
  top: 0;
  height: 28px;
  min-width: 0;
  padding: 6px 10px;
  text-align: center;
}

.column-labels th {
  top: 28px;
}

[data-column-group="control"] {
  background: #e8edf3;
}

[data-column-group="bank"],
.bank-column {
  background: #edf4fb;
}

[data-column-group="amicus"],
.amicus-column {
  background: #eef7f1;
}

[data-column-group="actions"] {
  background: #f0f1f4;
}

.data-table tbody tr:hover td {
  background: #f8fbfe;
}

.sticky-control {
  position: sticky;
  z-index: 2;
}

th.sticky-control {
  z-index: 4;
}

.status-column {
  left: 0;
  width: 132px;
  min-width: 132px;
  max-width: 132px;
}

.action-column {
  left: var(--registry-sticky-status-width);
  width: 188px;
  min-width: 188px;
  max-width: 188px;
}

.check-column {
  left: calc(var(--registry-sticky-status-width) + var(--registry-sticky-action-width));
  width: 170px;
  min-width: 170px;
  max-width: 170px;
  box-shadow: 4px 0 8px rgb(44 57 75 / 8%);
}

.registry-data-table [data-column] {
  overflow-wrap: anywhere;
}

.registry-data-table [data-column="selection"] {
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  padding-right: 8px;
  padding-left: 8px;
}

.registry-data-table [data-column="bank-date"] {
  width: 112px;
  min-width: 112px;
  max-width: 112px;
}

.registry-data-table [data-column="bank-source"] {
  width: 120px;
  min-width: 120px;
  max-width: 120px;
}

.amount-column {
  width: 124px;
  min-width: 124px;
  max-width: 124px;
  text-align: right;
}

.document-number-column {
  width: 132px;
  min-width: 132px;
  max-width: 132px;
}

.payment-details-column {
  width: 280px;
  min-width: 280px;
  max-width: 280px;
}

.payer-column {
  width: 210px;
  min-width: 210px;
  max-width: 210px;
}

.registry-data-table [data-column="amicus-direction"] {
  width: 108px;
  min-width: 108px;
  max-width: 108px;
}

.amicus-client-column {
  width: 200px;
  min-width: 200px;
  max-width: 200px;
}

.amicus-order-column {
  width: 176px;
  min-width: 176px;
  max-width: 176px;
}

.bank-reference {
  color: #315f88;
}

.payment-details {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-height: 1.35;
  white-space: normal;
}

.row-actions {
  position: sticky;
  z-index: 2;
  right: 0;
  width: 148px;
  min-width: 148px;
  max-width: 148px;
  box-shadow: -4px 0 8px rgb(44 57 75 / 8%);
}

.row-action-stack {
  display: grid;
  gap: 6px;
}

.row-action-stack .button {
  width: 100%;
}

.row-refresh-button.is-pending::before {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border: 2px solid currentcolor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: row-refresh-spin 0.8s linear infinite;
  content: "";
}

@keyframes row-refresh-spin {
  to { transform: rotate(360deg); }
}

.row-refresh-feedback {
  display: block;
  padding: 4px 5px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.row-refresh-feedback[hidden] {
  display: none;
}

.payment-status {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.status-secondary {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

th.row-actions {
  z-index: 4;
}

.status-pill,
.check-token,
.claim-pill {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.tone-success {
  border-color: #a9d7bc;
  background: var(--success-bg);
  color: var(--success);
}

.tone-warning {
  border-color: #e3ca86;
  background: var(--warning-bg);
  color: var(--warning);
}

.tone-danger {
  border-color: #e4aaaa;
  background: var(--danger-bg);
  color: var(--danger);
}

.tone-info {
  border-color: #afd0e8;
  background: var(--info-bg);
  color: var(--info);
}

.tone-neutral {
  border-color: #cbd3de;
  background: #f1f3f6;
  color: #59677a;
}

.next-action {
  display: grid;
  gap: 4px;
}

.next-action strong {
  font-size: 12px;
}

.next-action small,
.cell-secondary {
  color: var(--muted);
  font-size: 11px;
}

.communication-attention-line {
  width: fit-content;
  max-width: 100%;
  padding: 3px 6px;
  border: 1px solid #c9a74e;
  border-radius: 3px;
  background: #fff8e8;
  color: #6c4b08;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  overflow-wrap: anywhere;
}

.communication-attention-line:hover,
.communication-attention-line:focus-visible {
  border-color: #9c7619;
  background: #fff1c7;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cell-stack {
  display: grid;
  gap: 3px;
  overflow-wrap: anywhere;
}

.candidate-cell {
  gap: 6px;
}

.candidate-count {
  color: #7a5400;
}

.candidate-summary {
  display: grid;
  min-width: 0;
  gap: 2px;
  text-align: left;
}

.candidate-primary {
  color: #1f2c3e;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.candidate-secondary {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.order-summary {
  display: grid;
  min-width: 0;
  gap: 4px;
  text-align: left;
}

.order-summary-title {
  color: #1f2c3e;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.order-status,
.history-count {
  width: fit-content;
  padding: 2px 5px;
  border: 1px solid #cbd3de;
  border-radius: 3px;
  background: #f1f3f6;
  color: #59677a;
  font-size: 10px;
  font-weight: 700;
}

.candidate-warning {
  color: #8a5a00;
  font-size: 11px;
  line-height: 1.3;
}

.candidate-list {
  display: grid;
  max-height: 190px;
  gap: 5px;
  overflow-y: auto;
  padding-right: 3px;
}

.candidate-option {
  width: 100%;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid #b7c4d4;
  border-radius: 4px;
  background: #fff;
  color: inherit;
}

button.candidate-option:hover:not(:disabled),
button.candidate-option:focus-visible {
  border-color: #2c6fb7;
  background: #edf5ff;
}

button.candidate-option[data-proposal-action] {
  cursor: pointer;
}

.candidate-option.proposal-readonly {
  cursor: default;
  background: #f7f9fb;
}

.candidate-option.selected {
  border-color: #2d7f52;
  background: #eaf7ef;
  box-shadow: inset 3px 0 0 #2d7f52;
}

.manager-confirmed-order {
  border-color: #2d7f52;
  background: #eaf7ef;
}

.manager-confirmation {
  display: block;
  margin-top: 4px;
  color: #236442;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
}

.manager-alternatives {
  margin-top: 2px;
}

.telegram-candidate-list {
  max-height: 220px;
}

.proposal-base-value {
  padding: 2px 1px 5px;
  color: #435268;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.telegram-candidate-status {
  color: #236442;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
}

.candidate-result {
  display: block;
  background: #f7f9fb;
}

.candidate-history {
  border-top: 1px solid #dfe5ec;
  padding-top: 6px;
}

.candidate-history summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.candidate-history-list {
  display: grid;
  gap: 8px;
  padding: 8px 2px 2px 12px;
}

.candidate-option:disabled {
  cursor: default;
  opacity: 0.72;
}

.open-card {
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  border: 1px solid #9fb2c9;
  border-radius: 4px;
  background: #fff;
  color: #1f4e82;
  font-weight: 700;
}

.table-state {
  display: flex;
  min-height: 220px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
}

.table-state[hidden],
.state-banner[hidden],
.tab-panel[hidden],
.toast[hidden] {
  display: none;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #d5dce5;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

dialog {
  padding: 0;
  border: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgb(20 29 42 / 58%);
}

.payment-dialog {
  width: min(1180px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.dialog-shell {
  display: grid;
  max-height: calc(100vh - 32px);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #c9d1dc;
  border-radius: 6px;
  background: #fff;
}

.card-summary-region {
  min-width: 0;
  max-height: min(34vh, 280px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.card-summary-region > [hidden],
.action-summary > [hidden] {
  display: none;
}

.dialog-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.dialog-header h2 {
  font-size: 17px;
}

.card-meta-line {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.card-meta-line .eyebrow {
  margin: 0;
}

.card-version {
  color: var(--muted);
  font-size: 11px;
}

.icon-button {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  font-size: 22px;
  line-height: 1;
}

.card-notice {
  margin: 10px 16px 0;
  padding: 8px 10px;
  border: 1px solid #e2c87c;
  border-radius: 4px;
  background: var(--warning-bg);
  color: #674d0c;
  font-size: 12px;
}

.card-overview {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.tabs {
  display: flex;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  background: #f7f9fb;
  scrollbar-width: thin;
}

.card-tabs {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
}

.tabs button {
  min-height: 42px;
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #526176;
  font-weight: 700;
}

.tabs button[aria-selected="true"] {
  border-bottom-color: var(--primary);
  color: #184f8d;
}

.dialog-content {
  min-width: 0;
  overflow: auto;
  padding: 14px 16px 18px;
}

.working-grid {
  display: grid;
  min-width: 0;
  gap: 0;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.field-row,
.field-legend {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(130px, 0.75fr) repeat(3, minmax(0, 1fr));
}

.field-row > *,
.field-legend > * {
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 8px;
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  overflow-wrap: anywhere;
}

.field-row > span {
  background: #f3f6f9;
  color: #536176;
  font-size: 12px;
  font-weight: 700;
}

.source-value {
  color: #2f3c50;
  font-size: 12px;
}

.working-field {
  display: grid;
  align-content: start;
  gap: 5px;
  background: #fffdf4;
}

.working-field > input,
.working-field > select,
.working-field > textarea,
.working-field > output {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border: 1px solid #bcc6d3;
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
}

.working-field > output {
  display: flex;
  align-items: center;
  padding: 7px 9px;
  background: #f3f5f7;
  color: #2f3c50;
}

.working-field > textarea {
  min-height: 72px;
  resize: vertical;
}

.working-order-control {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: stretch;
  gap: 6px;
}

.working-order-control.is-composite {
  grid-template-columns: minmax(0, 1fr);
}

.working-order-control > input,
.working-order-control > .allocation-summary {
  width: 100%;
  min-width: 0;
  min-height: 34px;
}

.allocation-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid #bcc6d3;
  border-radius: 4px;
  background: #fff;
  color: #2f3c50;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
}

.allocation-summary:hover:not(:disabled) {
  border-color: #7397b9;
  background: #f7fbff;
}

.allocation-summary:focus-visible {
  outline: 2px solid #2d6f9f;
  outline-offset: 2px;
}

.allocation-summary:disabled,
.allocation-summary[aria-disabled="true"] {
  background: #f3f5f7;
  color: #2f3c50;
  cursor: default;
  opacity: 1;
}

.allocation-summary-orders,
.allocation-summary-row {
  display: grid;
  min-width: 0;
}

.allocation-summary-orders {
  gap: 8px;
}

.allocation-summary-row {
  gap: 2px;
}

.allocation-summary-row + .allocation-summary-row {
  padding-top: 8px;
  border-top: 1px solid #dde3ea;
}

.allocation-summary-order,
.allocation-summary-detail,
.allocation-summary-status,
.allocation-summary-remainder {
  min-width: 0;
  overflow-wrap: anywhere;
}

.allocation-summary-order {
  color: #213249;
  font-size: 12px;
}

.allocation-summary-detail,
.allocation-summary-status {
  color: #586a80;
  font-size: 11px;
}

.allocation-summary-status {
  font-weight: 600;
}

.allocation-summary-remainder {
  padding-top: 7px;
  border-top: 1px solid #ead8a8;
  color: #8a5c00;
  font-size: 11px;
  font-weight: 700;
}

.allocation-summary-edit {
  align-self: center;
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
  text-align: center;
}

.allocation-summary:disabled .allocation-summary-edit,
.allocation-summary[aria-disabled="true"] .allocation-summary-edit {
  color: #7d8998;
}

.working-add-order {
  width: 32px;
  height: auto;
  min-height: 34px;
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
}

.field-row .candidate-option {
  font-weight: 400;
}

.field-row .order-summary-title {
  font-weight: 600;
}

.allocation-summary[hidden] {
  display: none;
}

.working-context {
  color: #586a80;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.working-context[hidden] {
  display: none;
}

.field-legend {
  order: -1;
  background: #eef2f6;
  color: #526176;
  font-size: 11px;
  text-transform: uppercase;
}

.field-legend > * {
  min-height: 34px;
}

.form-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 12px;
}

.action-confirmation-detail {
  width: 100%;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.uat-review-panel {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid #b9c7d8;
  border-radius: 5px;
  background: #f7f9fb;
}

.uat-review-panel[hidden] {
  display: none;
}

.uat-review-heading {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.uat-review-heading > div {
  display: grid;
  gap: 2px;
}

.uat-review-heading strong {
  font-size: 12px;
}

.uat-review-heading small,
.uat-latest-review {
  color: var(--muted);
  font-size: 11px;
}

.uat-latest-review {
  max-width: 55%;
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.uat-review-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.5fr) auto;
  align-items: end;
  gap: 8px;
}

.uat-review-form label {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: #4c5b70;
  font-size: 11px;
  font-weight: 700;
}

.uat-review-form input,
.uat-review-form select {
  min-height: 34px;
}

.comparison-list {
  display: grid;
  gap: 8px;
}

.comparison-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.7fr) repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border);
}

.comparison-row > * {
  min-width: 0;
  padding: 9px;
  border-right: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.comparison-row > *:last-child {
  border-right: 0;
}

.comparison-row strong {
  background: #f4f6f8;
}

.action-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.payment-uat-remark-history {
  display: grid;
  gap: 3px;
  margin: 8px 0 12px;
}

.payment-uat-remark-history p {
  margin: 0;
  white-space: pre-wrap;
}

.payment-uat-remark-history small {
  color: var(--muted);
}

.action-summary.is-terminal {
  display: flex;
}

.action-summary > div {
  display: inline-flex;
  min-height: 0;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid #cbd6e3;
  border-radius: 4px;
  background: #f7f9fb;
}

.action-summary > div[data-tone="success"] {
  border-color: #a9d7bc;
  background: var(--success-bg);
}

.action-summary > div[data-tone="warning"] {
  border-color: #e3ca86;
  background: var(--warning-bg);
}

.action-summary > div[data-tone="danger"] {
  border-color: #e4aaaa;
  background: var(--danger-bg);
}

.action-summary > div[data-tone="info"] {
  border-color: #afd0e8;
  background: var(--info-bg);
}

.action-summary > div[data-responsibility="administrator"] {
  border-style: dashed;
}

.action-summary span {
  color: var(--muted);
  font-size: 10px;
}

.action-summary strong {
  font-size: 12px;
}

.action-summary strong.is-link {
  color: var(--accent, #165dab);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.action-summary strong.is-link:focus-visible {
  outline: 2px solid var(--accent, #165dab);
  outline-offset: 3px;
}

.action-summary strong .status-secondary {
  margin-top: 2px;
}

.final-snapshot-panel {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #b9d8c7;
  background: #f2faf5;
}

.final-snapshot-panel[hidden] {
  display: none;
}

.final-snapshot-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.final-snapshot-heading > div {
  display: grid;
  gap: 2px;
}

.final-snapshot-form {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.final-snapshot-values {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
}

.final-snapshot-values div {
  display: grid;
  gap: 2px;
}

.final-snapshot-values dt {
  color: var(--muted);
  font-size: 10px;
}

.final-snapshot-values dd {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}

.amicus-refresh-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  background: #f7f9fb;
  color: #526176;
  font-size: 12px;
}

.amicus-refresh-summary[hidden] {
  display: none;
}

.amicus-refresh-summary.is-secondary {
  padding-block: 6px;
  border-bottom: 0;
  font-size: 11px;
}

.amicus-refresh-summary.is-attention {
  border-left: 3px solid #b87816;
  background: #fff8e8;
  color: #674d0c;
}

.amicus-refresh-summary.is-attention span {
  color: inherit;
}

.amicus-refresh-summary span {
  min-width: 0;
  color: #526176;
  overflow-wrap: anywhere;
}

.action-buttons {
  display: flex;
  width: 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
}

.action-buttons > .button {
  max-width: 100%;
  flex: 0 1 auto;
}

.audit-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.audit-list li {
  display: grid;
  grid-template-columns: minmax(130px, 0.5fr) minmax(180px, 1fr) minmax(220px, 1.5fr);
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
}

.audit-list time,
.audit-list small {
  color: var(--muted);
}

.audit-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.audit-main strong {
  overflow-wrap: anywhere;
}

.audit-main small {
  overflow-wrap: anywhere;
}

.audit-details {
  grid-column: 1 / -1;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.audit-details summary {
  width: fit-content;
  cursor: pointer;
}

.audit-details pre {
  max-height: 220px;
  margin: 7px 0 0;
  padding: 8px;
  overflow: auto;
  border: 1px solid var(--border);
  background: #f7f9fb;
  color: #49596d;
  font: 11px/1.45 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.communication-state {
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  background: #f7f9fb;
  color: var(--muted);
  font-size: 12px;
}

.communication-state[hidden],
.communication-toolbar[hidden] {
  display: none;
}

.communication-state[data-state="loading"] {
  border-style: dashed;
  background: #fff;
}

.communication-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: #f7f9fb;
  font-size: 12px;
}

.communication-toolbar > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.communication-toolbar span {
  color: var(--muted);
}

.communication-state strong {
  color: var(--text);
  font-size: 13px;
}

.communication-list {
  display: grid;
  min-width: 0;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.communication-item {
  display: grid;
  min-width: 0;
  gap: 7px;
  padding: 10px 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-left: 3px solid #4d7da8;
  background: #fff;
  font-size: 12px;
}

.communication-item.direction-outgoing {
  border-left-color: #287a53;
  background: #f6fbf8;
}

.communication-item.is-unread {
  border-left-color: #b87816;
  background: #fffdf6;
}

.communication-header,
.communication-identity,
.communication-metadata,
.communication-attachment {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.communication-header {
  justify-content: space-between;
}

.communication-header time,
.communication-attachment span {
  flex: 0 0 auto;
  color: var(--muted);
}

.communication-identity strong,
.communication-attachment span {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.communication-direction,
.communication-chip {
  max-width: 100%;
  padding: 2px 6px;
  border: 1px solid #c5d5e4;
  border-radius: 3px;
  background: #eef5fb;
  color: #315d82;
  font-size: 10px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.communication-direction.direction-outgoing {
  border-color: #b8d8c7;
  background: #eaf6ef;
  color: #236442;
}

.communication-body {
  min-width: 0;
  margin: 0;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.communication-body strong {
  font-weight: 700;
}

.communication-body code {
  padding: 1px 3px;
  border-radius: 3px;
  background: #eef2f6;
  font: 0.95em/1.4 Consolas, "Courier New", monospace;
}

.communication-result {
  margin: 0;
  color: #526176;
  font-size: 11px;
}

.communication-result.requires-action {
  padding: 6px 8px;
  border-left: 3px solid #b87816;
  background: #fff8e8;
  color: #674d0c;
}

.business-neutral {
  color: var(--muted);
  font-weight: 400;
}

.business-neutral strong {
  font-weight: 400;
}

.communication-metadata {
  flex-wrap: wrap;
}

.communication-attachments {
  display: grid;
  min-width: 0;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.communication-attachment {
  justify-content: space-between;
  padding: 5px 7px;
  border: 1px solid #dbe2ea;
  background: #f8fafc;
}

.communication-attachment strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.communication-extraction {
  display: grid;
  min-width: 0;
  gap: 4px;
  margin: 0;
}

.communication-extraction-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(110px, 0.6fr) minmax(150px, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border: 1px solid #dbe2ea;
  background: #f8fafc;
}

.communication-extraction dt,
.communication-extraction dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.communication-extraction dt {
  color: var(--muted);
}

.communication-proposal-mark {
  color: #236442;
  font-size: 10px;
  font-weight: 700;
}

.communication-missing {
  margin: 0;
  padding: 6px 8px;
  border-left: 3px solid #b87816;
  background: #fff8e8;
  color: #714b10;
}

@media (max-width: 640px) {
  .communication-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .communication-extraction-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

.confirm-dialog {
  width: min(520px, calc(100vw - 32px));
  box-sizing: border-box;
  overflow-x: hidden;
}

.one-c-export-dialog {
  width: min(620px, calc(100vw - 32px));
  max-width: none;
}

.one-c-export-dialog .confirm-shell {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.one-c-export-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 16px 0;
  padding: 1px;
  background: var(--border);
}

.one-c-export-summary div {
  min-width: 0;
  padding: 12px;
  background: var(--surface);
}

.one-c-export-summary dt {
  color: var(--muted);
  font-size: 12px;
}

.one-c-export-summary dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.one-c-export-reasons {
  max-height: 180px;
  margin: 0 0 16px;
  padding-left: 20px;
  overflow: auto;
  color: var(--muted);
  font-size: 13px;
}

.one-c-export-actions {
  flex-wrap: wrap;
}

.allocation-dialog {
  width: min(680px, calc(100vw - 32px));
  max-width: none;
}

.allocation-shell {
  display: grid;
  max-height: calc(100dvh - 32px);
  gap: 14px;
  overflow: hidden;
}

.allocation-shell > p {
  margin: 0;
}

.allocation-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.allocation-header .eyebrow {
  margin: 0 0 2px;
}

.allocation-table-frame {
  min-height: 0;
  border: 1px solid var(--border);
}

.allocation-table-scroll {
  max-height: min(42dvh, 360px);
}

.allocation-table {
  table-layout: fixed;
}

.allocation-table th:nth-child(2),
.allocation-table td:nth-child(2) {
  width: 170px;
}

.allocation-table th:last-child,
.allocation-table td:last-child {
  width: 54px;
  text-align: center;
}

.allocation-table input,
.allocation-table select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
}

.allocation-balance-label {
  display: block;
  padding: 8px 0;
}

.allocation-delete {
  width: 30px;
  height: 30px;
}

.allocation-add-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.allocation-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.allocation-totals > div {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  background: #f7f9fb;
}

.allocation-totals dt {
  color: var(--muted);
  font-size: 11px;
}

.allocation-totals dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

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

.connection-dialog {
  width: min(440px, calc(100vw - 32px));
}

.connection-shell {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid #c9d1dc;
  border-radius: 6px;
  background: #fff;
}

.connection-shell h2,
.connection-shell p {
  margin: 0;
}

.connection-shell > p {
  color: var(--muted);
  line-height: 1.45;
}

.connection-shell label {
  font-size: 12px;
  font-weight: 700;
}

.connection-shell input {
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid #aeb9c8;
  border-radius: 4px;
}

.connection-error {
  color: var(--danger) !important;
  font-weight: 700;
}

.confirm-shell {
  padding: 18px;
  border-radius: 6px;
  background: #fff;
}

.confirm-shell h2 {
  font-size: 17px;
}

.confirm-shell p {
  color: #526176;
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.incomplete-posting-dialog {
  width: min(92vw, 520px);
}

.incomplete-posting-summary {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--border);
  background: #f7f9fb;
}

.incomplete-posting-missing {
  margin: 0;
  padding-left: 22px;
}

.incomplete-posting-warning {
  margin: 0;
  padding: 9px 10px;
  border-left: 3px solid #b87900;
  background: #fff8e8;
}

.incomplete-posting-check {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-weight: 700;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  max-width: min(380px, calc(100vw - 40px));
  padding: 10px 12px;
  border: 1px solid #90b9a2;
  border-radius: 5px;
  background: #ecf8f1;
  box-shadow: 0 8px 24px rgb(30 49 72 / 18%);
  color: #1e6542;
  font-weight: 700;
}

.posting-progress-zone {
  position: fixed;
  z-index: 19;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  justify-content: flex-end;
  max-height: 40vh;
  max-height: 40dvh;
  padding: 12px 20px 20px;
  background: #f4f6f8;
  border-top: 1px solid var(--border);
}

.posting-progress-zone[hidden],
.posting-progress-panel[hidden],
.posting-progress-list[hidden],
.posting-progress-controls .icon-button[hidden] {
  display: none;
}

.posting-progress-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  max-height: calc(40vh - 33px);
  max-height: calc(40dvh - 33px);
  width: min(360px, calc(100vw - 40px));
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #98a8ba;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(30 49 72 / 18%);
}

.posting-progress-panel.expanded {
  width: min(480px, calc(100vw - 40px));
}

.posting-progress-header,
.posting-progress-controls,
.posting-progress-item-heading,
.posting-progress-item-details {
  display: flex;
  min-width: 0;
  align-items: center;
}

.posting-progress-header,
.posting-progress-item-heading {
  justify-content: space-between;
  gap: 10px;
}

.posting-progress-heading {
  display: grid;
  min-width: 0;
  gap: 2px;
  overflow-wrap: anywhere;
}

.posting-progress-heading strong {
  font-size: 13px;
}

.posting-progress-heading span,
.posting-progress-payment-id {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.posting-progress-controls {
  flex: 0 0 auto;
  gap: 4px;
}

.posting-progress-controls .icon-button {
  width: 28px;
  height: 28px;
  font-size: 18px;
}

.posting-progress-panel progress {
  width: 100%;
  height: 7px;
  accent-color: var(--primary);
}

.posting-progress-list {
  display: grid;
  min-height: 0;
  min-width: 0;
  gap: 7px;
  overflow-y: auto;
}

.posting-progress-item {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.posting-progress-item-heading strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.posting-progress-item-details {
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.posting-progress-stage {
  color: var(--info);
  font-size: 12px;
  font-weight: 700;
}

.posting-progress-stage[data-tone="success"] {
  color: var(--success);
}

.posting-progress-stage[data-tone="danger"],
.posting-progress-error {
  color: var(--danger);
}

.posting-progress-error {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 11px;
}

.posting-progress-item-details .button {
  flex: 0 0 auto;
}

body:has(.posting-progress-panel:not([hidden])) .toast {
  bottom: calc(var(--registry-bottom-reserve, 0px) + 20px);
}

.selection-column {
  width: 64px;
  text-align: center;
}

.selection-column input {
  width: 16px;
  height: 16px;
}

.bulk-approval-bar {
  position: fixed;
  z-index: 15;
  right: 20px;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 920px;
  margin: 0 auto;
  padding: 10px 12px;
  border: 1px solid #98a8ba;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 30px rgb(30 49 72 / 22%);
}

.bulk-approval-bar[hidden] {
  display: none;
}

.bulk-approval-bar > div {
  display: flex;
  gap: 8px;
}

body.posting-progress-scroll-context .workspace {
  padding-bottom: calc(var(--workspace-bottom-padding) + var(--registry-bottom-reserve, 0px));
}

body.posting-progress-scroll-context #table-wrap .data-table-scroll {
  max-height: max(120px, calc(min(70vh, 720px) - var(--registry-bottom-reserve, 0px)));
  max-height: max(120px, calc(min(70dvh, 720px) - var(--registry-bottom-reserve, 0px)));
  overflow: auto;
  scrollbar-gutter: stable;
}

body.posting-progress-visible .bulk-approval-bar {
  bottom: calc(var(--posting-zone-height, 0px) + 20px);
}

@media (max-width: 1100px) {
  .filters {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .period-filter,
  .search-filter {
    grid-column: span 2;
  }

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

  .uat-review-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .uat-review-form .button {
    grid-column: 2;
  }
}

@media (max-width: 760px) {
  .section-heading,
  .import-period {
    align-items: stretch;
    flex-direction: column;
  }

  .section-actions {
    align-items: stretch;
  }

  .section-action-buttons {
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .sync-status {
    max-width: 100%;
  }

  .topbar {
    align-items: flex-start;
    padding: 12px 14px;
  }

  .topbar {
    display: grid;
  }

  .topbar-tools,
  .service-status-panel {
    width: 100%;
    justify-items: stretch;
  }

  .service-status-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: thin;
  }

  .service-status {
    width: 112px;
    flex: 0 0 112px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .runtime-context {
    width: 100%;
    gap: 6px;
    white-space: normal;
  }

  .runtime-context-primary,
  .runtime-context-actions,
  .runtime-context-details {
    width: 100%;
  }

  .runtime-context-primary {
    align-items: flex-start;
  }

  .runtime-context-actions {
    flex-wrap: wrap;
  }

  .runtime-context-details {
    flex-wrap: wrap;
    justify-content: flex-start;
    white-space: normal;
  }

  .context-separator {
    display: none;
  }

  .workspace {
    --workspace-bottom-padding: 12px;
    padding: 12px;
  }

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

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .period-filter,
  .search-filter {
    grid-column: 1 / -1;
  }

  .filter-reset {
    width: 100%;
  }

  .data-table-scroll {
    max-height: none;
    overflow: visible;
    scrollbar-gutter: auto;
  }

  .registry-mobile-table-head {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .registry-data-table,
  .registry-data-table thead,
  .registry-data-table tbody,
  .registry-data-table tr,
  .registry-data-table th,
  .registry-data-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .registry-data-table {
    min-width: 0;
  }

  .registry-data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .registry-data-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
    background: #eef2f6;
  }

  .registry-data-table tbody tr {
    border: 1px solid var(--border);
    background: #fff;
  }

  .registry-data-table tbody td,
  .selection-column,
  .status-column,
  .action-column,
  .check-column,
  .document-number-column,
  .payment-details-column,
  .row-actions {
    position: static;
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 8px;
    border-right: 0;
    box-shadow: none;
  }

  .registry-data-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .registry-data-table [data-column] {
    max-width: none;
  }

  .amount-column {
    text-align: left;
  }

  .payment-details {
    display: block;
    overflow: visible;
  }

  .payment-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
  }

  .allocation-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
  }

  .allocation-shell {
    max-height: 100dvh;
    overflow-y: auto;
    border-radius: 0;
  }

  .allocation-table-scroll {
    max-height: none;
    overflow: visible;
  }

  .allocation-table,
  .allocation-table tbody,
  .allocation-table tr,
  .allocation-table td {
    display: block;
    width: 100%;
  }

  .allocation-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .allocation-table tbody {
    display: grid;
    gap: 8px;
    padding: 8px;
    background: #eef2f6;
  }

  .allocation-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    border: 1px solid var(--border);
    background: #fff;
  }

  .allocation-table td {
    min-width: 0;
    border-right: 0;
  }

  .allocation-table td::before {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .allocation-order-cell,
  .allocation-amount-cell {
    grid-column: 1 / -1;
  }

  .allocation-delete-cell {
    grid-column: 2;
  }

  .allocation-table th:nth-child(2),
  .allocation-table td:nth-child(2),
  .allocation-table th:last-child,
  .allocation-table td:last-child {
    width: 100%;
  }

  .allocation-totals {
    grid-template-columns: 1fr;
  }

  .dialog-shell {
    width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }

  .dialog-content {
    overflow-x: hidden;
    overflow-y: auto;
    padding: 10px;
  }

  .card-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow-x: hidden;
    padding: 0;
  }

  .card-tabs button {
    min-width: 0;
    padding-inline: 4px;
    font-size: 11px;
    white-space: normal;
  }

  .field-legend {
    display: none;
  }

  .field-row {
    grid-template-columns: minmax(104px, 0.4fr) minmax(0, 1fr);
  }

  .field-row > span:first-child {
    grid-column: 1;
    grid-row: 1 / span 3;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }

  .field-row > :nth-child(n + 2) {
    grid-column: 2;
  }

  .field-row > :nth-child(2)::before,
  .field-row > :nth-child(3)::before,
  .field-row > :nth-child(4)::before {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .field-row > :nth-child(2)::before {
    content: "Банк";
  }

  .field-row > :nth-child(3)::before {
    content: "Предложение";
  }

  .field-row > :nth-child(4)::before {
    content: "Итог";
  }

  .working-grid {
    overflow-x: hidden;
  }

  .comparison-row {
    grid-template-columns: 1fr;
  }

  .comparison-row > * {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .comparison-row > *:last-child {
    border-bottom: 0;
  }

  .action-summary,
  .uat-review-form {
    grid-template-columns: 1fr;
  }

  .working-order-control {
    grid-template-columns: minmax(0, 1fr) 32px;
  }

  .order-field-row > .working-field {
    grid-column: 2;
  }

  .uat-review-heading {
    display: grid;
  }

  .uat-latest-review {
    max-width: none;
    text-align: left;
  }

  .uat-review-form .button {
    grid-column: auto;
  }

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

  .amicus-refresh-summary {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .communication-header,
  .communication-attachment {
    align-items: flex-start;
    flex-direction: column;
  }

  .bulk-approval-bar {
    right: 12px;
    bottom: 12px;
    left: 12px;
    align-items: stretch;
    flex-direction: column;
  }

  .bulk-approval-bar > div {
    display: grid;
    grid-template-columns: 1fr;
  }
}

.unlinked-communication-dialog {
  width: min(620px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
}

.unlinked-communication-shell {
  display: grid;
  width: 100%;
  min-width: 0;
  max-height: calc(100dvh - 32px);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  box-sizing: border-box;
}

.unlinked-communication-list {
  display: grid;
  min-width: 0;
  min-height: 0;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.unlinked-communication-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
}

.unlinked-communication-item p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.unlinked-communication-heading {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.unlinked-communication-heading strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.unlinked-communication-actions {
  display: flex;
  justify-content: flex-end;
}

.notification-dialog {
  width: min(460px, 100vw);
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
}

.notification-dialog::backdrop {
  background: rgba(20, 32, 48, 0.28);
}

.notification-shell {
  display: grid;
  height: 100%;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  background: var(--surface);
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.notification-header h2 {
  margin: 0;
  font-size: 18px;
}

.notification-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.notification-tabs button {
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.notification-tabs button[aria-selected="true"] {
  border-color: #9db7d5;
  background: #eef5fc;
  color: #173f6d;
}

.notification-state {
  margin: 0;
  padding: 8px 14px;
  color: var(--muted);
  font-size: 12px;
}

.notification-list {
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.notification-item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.notification-item.is-unread {
  border-left: 3px solid #2867a9;
  background: #f5f9fd;
}

.notification-item header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.notification-item p {
  margin: 0;
  color: #425268;
  font-size: 13px;
}

.notification-item time {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.notification-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 560px) {
  .posting-progress-zone {
    padding: 8px 12px 12px;
  }

  .posting-progress-panel,
  .posting-progress-panel.expanded {
    width: calc(100vw - 24px);
    max-height: calc(40vh - 21px);
    max-height: calc(40dvh - 21px);
  }

  .notification-dialog {
    width: 100vw;
  }

  .unlinked-communication-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .unlinked-communication-shell {
    max-height: calc(100dvh - 16px);
    padding: 14px;
  }

  .unlinked-communication-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

@media (max-width: 480px) {
  .topbar {
    display: grid;
  }

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

  .period-filter,
  .search-filter {
    grid-column: auto;
  }

  .date-range {
    grid-template-columns: 1fr;
  }

  .date-range > span {
    display: none;
  }

  .section-heading,
  .state-banner,
  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .field-row {
    grid-template-columns: minmax(80px, 0.34fr) minmax(0, 1fr);
  }
}
