:root {
  --bg: #f5f8fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f6;
  --line: #e5eaf0;
  --line-strong: #d6dde7;
  --text: #101828;
  --muted: #667085;
  --muted-2: #8a8f9c;
  --green: #12b76a;
  --green-soft: #e8f8ef;
  --yellow: #b45309;
  --yellow-soft: #fff7ed;
  --red: #b42318;
  --red-soft: #fef3f2;
  --blue: #475467;
  --blue-soft: #f2f4f7;
  --mint-soft: #e9fbf4;
  --cyan-soft: #eefcfc;
  --shadow: 0 20px 60px rgba(16, 24, 40, 0.08);
  --premium-shadow: 0 18px 50px rgba(16, 24, 40, 0.1), 0 5px 14px rgba(16, 24, 40, 0.05);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 7%, rgba(198, 226, 255, 0.48), transparent 30%),
    radial-gradient(circle at 90% 10%, rgba(211, 245, 236, 0.55), transparent 32%),
    radial-gradient(circle at 74% 92%, rgba(255, 244, 214, 0.46), transparent 34%),
    linear-gradient(135deg, #f5f8fb 0%, #eef5f8 48%, #f7f9fc 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1880px, calc(100vw - 80px));
  min-height: calc(100vh - 80px);
  margin: 40px auto;
  padding: 40px 44px 52px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 32px;
  background: rgba(251, 252, 255, 0.72);
  box-shadow: 0 30px 90px rgba(16, 24, 40, 0.13);
  backdrop-filter: blur(28px);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.header-copy {
  display: grid;
  gap: 12px;
}

.header-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  margin-top: 0;
  padding: 0 12px;
  border: 1px solid rgba(229, 234, 240, 0.86);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.ready-pill {
  display: inline-flex;
  align-items: center;
  height: 30px;
  margin-top: 0;
  padding: 0 12px;
  border: 1px solid rgba(229, 234, 240, 0.86);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 8px;
}

.primary-pill,
.soft-pill {
  height: 44px;
  min-width: 0;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 760;
  cursor: pointer;
}

.primary-pill {
  background: #15171d;
  color: #ffffff;
  box-shadow: 0 16px 36px rgba(16, 24, 40, 0.18);
}

.soft-pill {
  background: #ffffff;
  color: #171920;
  box-shadow: 0 14px 36px rgba(35, 37, 45, 0.06);
}

.soft-pill:hover,
.primary-pill:hover {
  transform: translateY(-1px);
}

.muted-pill {
  color: #9a9aa2;
}

.health-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #c7d2e0;
  box-shadow: 0 0 0 4px rgba(199, 210, 224, 0.35);
  flex: 0 0 auto;
}

.health-dot.ok {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.health-dot.bad {
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}

.status-text {
  white-space: nowrap;
}

.status-sep {
  opacity: 0.65;
}

.notice {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 8px 24px rgba(37, 52, 75, 0.06);
  color: var(--muted);
}

.notice.warn {
  border-color: rgba(242, 184, 75, 0.45);
  background: var(--yellow-soft);
  color: #6b4f12;
}

.notice.bad {
  border-color: rgba(228, 91, 100, 0.35);
  background: var(--red-soft);
  color: #7a1a21;
}

.notice.hidden {
  display: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  color: #101828;
  font-size: clamp(40px, 3vw, 48px);
  font-weight: 780;
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  color: #111827;
  font-size: 24px;
  line-height: 1.1;
}

.payer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.payer-card {
  position: relative;
  min-height: 122px;
  padding: 22px 24px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px);
  cursor: pointer;
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.08), inset 0 0 0 1px rgba(16, 24, 40, 0.04);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.payer-card:hover,
.payer-card.active {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 70px rgba(16, 24, 40, 0.1), inset 0 0 0 1px rgba(16, 24, 40, 0.05);
}

.payer-card.active {
  background: rgba(255, 255, 255, 0.82);
}

.payer-card:nth-child(1) {
  background: rgba(255, 255, 255, 0.72);
}

.payer-card:nth-child(2) {
  background: rgba(255, 255, 255, 0.72);
}

.payer-card:nth-child(3) {
  background: rgba(255, 255, 255, 0.72);
}

.payer-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.payer-name h3 {
  margin-bottom: 0;
  color: #667085;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.08;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #12b76a;
  box-shadow: 0 0 0 5px rgba(18, 183, 106, 0.1);
  flex: 0 0 auto;
}

.metric-stack {
  display: grid;
  gap: 10px;
}

.metric {
  display: none;
}

.metric:first-child {
  display: block;
}

.metric:first-child span {
  display: none;
}

.metric strong {
  color: #101828;
  font-size: clamp(28px, 2vw, 34px);
  font-weight: 740;
  line-height: 1.05;
  letter-spacing: 0;
}

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

.panel {
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 0;
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 750;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.icon-button:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.table-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 300px 206px;
  gap: 14px;
  align-items: end;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.search-control,
.select-control {
  display: grid;
  gap: 10px;
}

.search-control input,
.select-control select {
  height: 56px;
  border-color: transparent;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 12px 34px rgba(35, 37, 45, 0.04);
}

.columns-pill {
  height: 56px;
  align-self: end;
}

.project-list {
  display: block;
  overflow-x: auto;
}

.project-panel.payments-mode {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.payment-list {
  display: grid;
  gap: 10px;
  overflow: visible;
}

.project-table {
  min-width: 1280px;
}

.project-table-head,
.project-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) 190px 150px 150px 150px 170px 150px 150px 180px;
}

.project-table-head {
  min-height: 66px;
  border-bottom: 1px solid var(--line);
  background: #f3f3f7;
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
}

.project-table-head > div,
.project-row > * {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 16px;
  border-right: 1px solid rgba(220, 222, 230, 0.62);
  overflow-wrap: anywhere;
}

.project-row,
.payment-row,
.request-row {
  border: 1px solid var(--line);
  background: var(--surface);
}

.project-row {
  min-height: 68px;
  border-width: 0 0 1px;
  border-radius: 0;
  cursor: pointer;
  transition: background 150ms ease, box-shadow 150ms ease;
}

.project-row:hover {
  background: #fbfcff;
  box-shadow: inset 4px 0 0 #dfff52;
}

.project-row strong {
  color: #171920;
  font-size: 20px;
  font-weight: 750;
}

.muted-value {
  color: #a47700;
  font-weight: 900;
}

.danger-value {
  background: #fff0eb;
  color: #d64d45;
  font-weight: 900;
}

.payment-row {
  display: grid;
  grid-template-columns: 64px 110px 220px 140px minmax(180px, 1fr) auto;
  align-items: center;
  gap: 14px;
  height: 92px;
  margin: 0;
  padding: 12px 18px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.68);
  box-shadow: 0 14px 34px rgba(16, 24, 40, 0.075), inset 0 0 0 1px rgba(16, 24, 40, 0.045);
  backdrop-filter: blur(18px);
  overflow: visible;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.payment-row::before {
  display: none;
}

.payment-row.tone-warn,
.payment-row.tone-bad {
  border-color: rgba(255, 255, 255, 0.78);
}

.payment-row.tone-bad {
  box-shadow: 0 14px 34px rgba(180, 35, 24, 0.075), inset 0 0 0 1px rgba(180, 35, 24, 0.08);
}

.payment-row:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 20px 48px rgba(16, 24, 40, 0.12), inset 0 0 0 1px rgba(16, 24, 40, 0.06);
}

.payment-row.is-checked {
  box-shadow: var(--premium-shadow), inset 0 0 0 1px rgba(16, 24, 40, 0.06);
}

.payment-file-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(16, 24, 40, 0.06);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.82);
  color: #667085;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.68);
}

.payment-row.tone-warn .payment-file-mark {
  background: rgba(255, 247, 237, 0.78);
  color: #b45309;
}

.payment-row.tone-bad .payment-file-mark {
  background: rgba(254, 242, 242, 0.82);
  color: #b42318;
}

.payment-file-mark svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.payment-cell {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
}

.payment-date-value {
  display: block;
  color: #101828;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: 0;
}

.payment-public-id {
  display: block;
  margin-top: 5px;
  color: #667085;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.payment-supplier strong,
.payment-purpose strong,
.payment-amount strong {
  color: #101828;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: 0;
}

.payment-supplier span {
  display: block;
  margin-top: 5px;
  color: #667085;
  font-size: 11px;
  font-weight: 720;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-purpose strong {
  color: #344054;
  font-size: 14px;
  font-weight: 680;
  line-height: 1.24;
}

.clamp-2,
.clamp-3 {
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
}

.clamp-2 {
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.clamp-3 {
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.payment-purpose {
  color: #101828;
}

.payment-row.tone-warn .payment-purpose,
.payment-row.tone-bad .payment-purpose {
  padding-right: 172px;
}

.payment-amount strong {
  font-size: 18px;
  font-weight: 760;
  white-space: nowrap;
}

.payment-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 6px;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.payment-status.paid {
  background: rgba(220, 252, 231, 0.72);
  color: #047857;
}

.payment-status.deferred {
  background: rgba(255, 247, 237, 0.82);
  color: #b45309;
}

.payment-status.unpaid {
  background: rgba(234, 236, 240, 0.76);
  color: #667085;
}

.payment-request {
  min-width: 0;
}

.payment-row strong {
  display: block;
}

.back-button,
.mini-button,
.delete-button,
button[type="submit"] {
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
}

.back-button {
  height: 34px;
  margin-right: 12px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.delete-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 0;
  margin-top: 0;
  padding: 0;
  border: 1px solid rgba(180, 35, 24, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  color: #b42318;
  font-size: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.48);
}

.risk-badge {
  position: absolute;
  top: 10px;
  right: 202px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 176px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(180, 35, 24, 0.12);
  border-radius: 999px;
  background: rgba(254, 242, 242, 0.84);
  color: #b42318;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(180, 35, 24, 0.08);
  z-index: 2;
}

.risk-badge.tone-warn {
  color: #b45309;
  border-color: rgba(180, 83, 9, 0.14);
  background: rgba(255, 247, 237, 0.88);
  box-shadow: 0 10px 22px rgba(180, 83, 9, 0.08);
}

.risk-badge:hover {
  transform: translateY(-1px);
}

.risk-badge:disabled,
.risk-badge.checked {
  cursor: default;
  transform: none;
  opacity: 0.82;
}

.risk-badge.is-loading {
  opacity: 0.7;
}

.risk-badge svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.risk-badge span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delete-button:hover {
  border-color: rgba(180, 35, 24, 0.22);
  background: rgba(254, 242, 242, 0.84);
}

.hidden {
  display: none !important;
}

.payment-actions,
.file-actions {
  display: grid;
  gap: 8px;
}

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

.gear-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #171920;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(35, 37, 45, 0.06);
}

.gear-button:hover {
  border-color: #cfd2dc;
  background: #f8f8fa;
}

.payment-actions {
  grid-template-columns: repeat(4, 36px);
  align-items: center;
  gap: 8px;
}

.file-actions {
  display: contents;
}

.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  width: 36px;
  min-width: 0;
  padding: 0;
  border: 1px solid rgba(16, 24, 40, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.52);
  color: #101828;
  font-size: 0;
  font-weight: 780;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.48);
}

.mini-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.mini-button svg,
.delete-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mini-button:not(:disabled):hover,
.back-button:hover {
  border-color: rgba(16, 24, 40, 0.14);
  background: rgba(255, 255, 255, 0.78);
  transform: translateY(-1px);
}

.link-button {
  text-decoration: none;
}

.file-count,
.file-empty {
  color: var(--muted);
  font-size: 13px;
}

.file-count {
  grid-column: 1 / -1;
  width: fit-content;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.cell-label {
  display: block;
  margin-bottom: 6px;
  color: #8a8f9c;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.progress {
  height: 9px;
  border-radius: 999px;
  background: #e8eef4;
  overflow: hidden;
}

.progress i {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--green);
}

.progress.warning i { background: var(--yellow); }
.progress.danger i { background: var(--red); }

.form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  outline: none;
}

textarea {
  width: 100%;
  min-height: 92px;
  padding: 12px 14px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(50, 111, 209, 0.11);
}

button[type="submit"] {
  height: 48px;
  border: 0;
  background: #171920;
  color: #ffffff;
}

button[type="submit"]:hover {
  background: #30323a;
}

.hint,
.empty {
  color: var(--muted);
  line-height: 1.5;
}

.hint {
  margin: 0 18px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.ghost {
  opacity: 0.72;
  background: var(--surface-2);
}

.detail-card {
  margin: 0;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.detail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.detail-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.detail-filters input[type="date"] {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.ghost-button {
  opacity: 0.8;
}

.detail-head h3 {
  margin: 0;
  color: #111827;
  font-size: 24px;
  line-height: 1.1;
}

.detail-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.detail-metrics div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.detail-metrics span,
.request-row span,
.request-meta {
  color: var(--muted);
  font-size: 12px;
}

.detail-metrics strong {
  display: block;
  margin-top: 4px;
  color: #111827;
  font-size: 20px;
}

.request-list {
  display: grid;
  gap: 8px;
  max-height: 410px;
  overflow: auto;
  padding-right: 4px;
}

.request-row {
  display: grid;
  gap: 6px;
  padding: 12px;
  background: var(--surface-2);
}

.request-row strong,
.request-row span {
  display: block;
}

.request-amount {
  color: #111827;
  font-size: 22px;
  font-weight: 900;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}

.preview-modal.open,
.edit-modal.open {
  display: block;
}

.edit-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}

.project-modal {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: none;
}

.project-modal.open {
  display: block;
}

.preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 30, 46, 0.46);
  backdrop-filter: blur(4px);
}

.preview-panel {
  position: absolute;
  inset: 28px;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(37, 52, 75, 0.24);
}

.edit-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(720px, calc(100vw - 28px));
  transform: translate(-50%, -50%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(37, 52, 75, 0.24);
}

.project-modal-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(560px, calc(100vw - 28px));
  transform: translate(-50%, -50%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(37, 52, 75, 0.24);
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.preview-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.preview-body {
  min-height: 0;
  background: #e9eef5;
}

.preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.preview-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #e9eef5;
}

.preview-fallback {
  display: grid;
  place-content: center;
  gap: 8px;
  height: 100%;
  color: var(--muted);
  text-align: center;
}

.preview-fallback strong {
  color: var(--text);
}

.edit-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 18px;
}

.edit-form .wide,
.edit-actions {
  grid-column: 1 / -1;
}

.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.project-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.project-modal-actions .project-delete {
  margin-right: auto;
}

@media (max-width: 1680px) {
  .payment-row {
    grid-template-columns: 58px 104px 210px 132px minmax(170px, 1fr) auto;
    gap: 12px;
  }

  .risk-badge {
    right: 194px;
  }
}

@media (max-width: 1360px) {
  .payment-row {
    grid-template-columns: 50px 96px 188px 122px minmax(140px, 1fr) auto;
    gap: 10px;
    height: 92px;
    padding: 12px 14px;
  }

  .payment-file-mark {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .payment-date-value,
  .payment-supplier strong,
  .payment-purpose strong {
    font-size: 14px;
  }

  .payment-amount strong {
    font-size: 16px;
  }

  .payment-purpose strong {
    font-size: 13px;
  }

  .payment-actions {
    gap: 8px;
  }

  .mini-button,
  .delete-button {
    width: 34px;
    height: 34px;
  }

  .mini-button svg,
  .delete-button svg {
    width: 16px;
    height: 16px;
  }

  .payment-actions {
    grid-template-columns: repeat(4, 34px);
  }

  .risk-badge {
    right: 184px;
    max-width: 148px;
  }
}

@media (max-width: 1100px) {
  .payer-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .payer-card {
    min-height: 164px;
  }

  .table-toolbar {
    grid-template-columns: 1fr;
  }

  .project-table-head,
  .project-row {
    grid-template-columns: minmax(260px, 1.35fr) 190px 150px 150px 150px 170px 150px 150px 180px;
  }

  .payment-row {
    grid-template-columns: 52px 104px minmax(190px, 1fr) 132px;
    align-items: center;
    gap: 12px;
    height: auto;
    min-height: 96px;
    padding: 14px 16px;
  }

  .payment-purpose,
  .payment-request {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .payment-actions {
    grid-template-columns: repeat(4, 36px);
    justify-content: end;
  }

  .risk-badge {
    top: 8px;
    right: 14px;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100vw - 18px, 1540px);
    margin: 9px auto;
    padding: 22px 16px 28px;
    border-radius: 24px;
  }

  h1 {
    font-size: 44px;
  }

  .header-actions {
    gap: 8px;
  }

  .primary-pill,
  .soft-pill {
    height: 44px;
    padding: 0 15px;
    font-size: 15px;
  }

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

  .project-table-head,
  .project-row {
    grid-template-columns: minmax(240px, 1.35fr) 180px 140px 140px 140px 160px 140px 140px 170px;
  }

  .payment-row {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px 14px;
    min-height: 0;
    padding: 16px;
    border-radius: 20px;
  }

  .payment-file-mark {
    width: 44px;
    height: 44px;
  }

  .payment-date-cell {
    grid-column: 2;
    border-left: 0;
    padding-left: 0;
  }

  .payment-amount {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-top: 14px;
    padding-left: 0;
    border-top: 1px solid rgba(16, 24, 40, 0.08);
    border-left: 0;
  }

  .payment-status {
    margin-top: 0;
  }

  .payment-supplier,
  .payment-purpose,
  .payment-request {
    grid-column: 1 / -1;
    padding-top: 10px;
    padding-left: 0;
    border-top: 1px solid rgba(16, 24, 40, 0.08);
    border-left: 0;
  }

  .payment-actions {
    grid-template-columns: repeat(4, 36px);
    justify-content: start;
  }

  .mini-button,
  .delete-button {
    width: 36px;
    height: 36px;
  }

  .risk-badge {
    position: static;
    grid-column: 1 / -1;
    width: fit-content;
    max-width: 100%;
    order: -1;
  }

  .preview-panel {
    inset: 10px;
  }

  .preview-head {
    align-items: stretch;
    flex-direction: column;
  }

  .edit-form {
    grid-template-columns: 1fr;
  }
}
