: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;
  --duplicate: #c1151b;
  --duplicate-soft: #fff1f0;
  --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: 0;
  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);
}

.expense-upload-trigger {
  max-width: 260px;
  color: #101828;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 248, 255, 0.86));
  border: 1px solid rgba(209, 217, 232, 0.88);
  box-shadow: 0 14px 34px rgba(16, 24, 40, 0.08);
  white-space: normal;
  line-height: 1.05;
}

.expense-upload-trigger:disabled {
  cursor: progress;
  opacity: 0.72;
  transform: none;
}

.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-delete-button {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(180, 35, 24, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: #b42318;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(16, 24, 40, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.payer-delete-button:hover {
  border-color: rgba(180, 35, 24, 0.22);
  background: rgba(254, 242, 242, 0.9);
  transform: translateY(-1px);
}

.payer-card.deletable .status-dot {
  margin-right: 36px;
}

.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;
}

.payer-new-count {
  width: fit-content;
  padding: 5px 9px;
  border: 1px solid rgba(4, 120, 87, 0.12);
  border-radius: 999px;
  background: rgba(232, 248, 239, 0.72);
  color: #047857;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.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: 18px;
  padding-top: 8px;
  overflow: visible;
}

.payment-sortbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  margin-bottom: 2px;
  padding: 10px 12px 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.68);
  box-shadow: 0 14px 34px rgba(16, 24, 40, 0.07), inset 0 0 0 1px rgba(16, 24, 40, 0.045);
  backdrop-filter: blur(18px);
}

.payment-sort-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.payment-sort-title span {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.payment-sort-title strong {
  color: #101828;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.payment-sort-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.payment-select-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(16, 24, 40, 0.09);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: #475467;
  font-size: 12px;
  font-weight: 820;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.52);
}

.payment-select-all input,
.payment-select-cell input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #15171d;
  cursor: pointer;
}

.payment-select-all:has(input:disabled) {
  cursor: default;
  opacity: 0.58;
}

.payment-bulk-delete,
.payment-bulk-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 820;
  line-height: 1;
  cursor: pointer;
}

.payment-bulk-delete {
  border: 1px solid rgba(180, 35, 24, 0.18);
  background: rgba(254, 242, 242, 0.78);
  color: #b42318;
}

.payment-bulk-clear {
  border: 1px solid rgba(16, 24, 40, 0.09);
  background: rgba(255, 255, 255, 0.56);
  color: #475467;
}

.payment-bulk-delete:hover,
.payment-bulk-clear:hover,
.payment-select-all:hover {
  transform: translateY(-1px);
}

.payment-bulk-delete:disabled,
.payment-bulk-clear:disabled {
  cursor: default;
  opacity: 0.5;
  transform: none;
}

.payment-items-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.payment-sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(16, 24, 40, 0.09);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: #475467;
  font-size: 12px;
  font-weight: 820;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.52);
}

.payment-sort-button:hover {
  border-color: rgba(16, 24, 40, 0.14);
  background: rgba(255, 255, 255, 0.82);
  color: #101828;
  transform: translateY(-1px);
}

.payment-sort-button.active {
  border-color: #101828;
  background: #101828;
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(16, 24, 40, 0.16);
}

.payment-sort-button i {
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

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

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

.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;
}

.project-name-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.project-name-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.project-title-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.project-name-main strong {
  min-width: 0;
}

.project-inline-delete {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-left: 8px;
  padding: 0;
  border: 1px solid rgba(180, 35, 24, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: #b42318;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.06), inset 0 0 0 1px rgba(255, 255, 255, 0.58);
}

.project-inline-delete:hover {
  border-color: rgba(180, 35, 24, 0.22);
  background: rgba(254, 242, 242, 0.9);
  transform: translateY(-1px);
}

.project-new-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #101828;
  color: #ffffff;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.16);
}

.project-alias {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  color: #667085;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-panel-trigger {
  border: 1px solid rgba(16, 24, 40, 0.08);
  background: rgba(255, 255, 255, 0.76);
}

.admin-login-trigger {
  border: 1px solid rgba(16, 24, 40, 0.08);
  background: rgba(255, 255, 255, 0.76);
  color: #667085;
}

.admin-list {
  background: rgba(255, 255, 255, 0.84);
}

.admin-shell {
  min-width: 2940px;
}

.admin-toolbar {
  position: sticky;
  left: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: 190px 260px 300px 190px 160px 130px;
  gap: 12px;
  align-items: end;
  width: min(1320px, calc(100vw - 132px));
  padding: 16px;
  border-bottom: 1px solid rgba(229, 234, 240, 0.82);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(248, 251, 252, 0.82)),
    rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

.admin-title {
  display: grid;
  gap: 5px;
  align-self: center;
}

.admin-title span,
.admin-toolbar label,
.admin-filter-field {
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.03em;
}

.admin-title span {
  text-transform: uppercase;
}

.admin-title strong {
  color: #101828;
  font-size: 18px;
  font-weight: 780;
  line-height: 1.1;
}

.admin-toolbar label,
.admin-filter-field {
  display: grid;
  gap: 7px;
}

.admin-toolbar input,
.admin-toolbar select {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid rgba(213, 219, 229, 0.78);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  color: #101828;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  outline: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.52);
}

.admin-toolbar input:focus,
.admin-toolbar select:focus {
  border-color: rgba(16, 24, 40, 0.22);
  background: #ffffff;
}

.admin-payer-multi {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 6px;
  border: 1px solid rgba(213, 219, 229, 0.78);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.52);
  overflow-x: auto;
}

.admin-payer-choice {
  display: inline-flex !important;
  align-items: center;
  gap: 6px !important;
  height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 999px;
  background: rgba(247, 249, 252, 0.86);
  color: #475467;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  white-space: nowrap;
  cursor: pointer;
}

.admin-payer-choice input {
  width: 12px;
  height: 12px;
  margin: 0;
  padding: 0;
  box-shadow: none;
  accent-color: #101828;
}

.admin-payer-choice:has(input:checked) {
  border-color: rgba(4, 120, 87, 0.18);
  background: rgba(232, 248, 239, 0.82);
  color: #047857;
}

.admin-payer-multi button {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.admin-payer-multi button:hover {
  background: rgba(16, 24, 40, 0.05);
  color: #101828;
}

.admin-back {
  width: auto;
  height: 42px;
  padding: 0 14px;
}

.admin-table {
  min-width: 2940px;
}

.admin-summary {
  position: sticky;
  left: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(8, minmax(136px, 1fr));
  gap: 10px;
  width: min(1220px, calc(100vw - 132px));
  padding: 14px 16px;
  border-bottom: 1px solid rgba(229, 234, 240, 0.82);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(248, 251, 252, 0.78)),
    rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
}

.admin-summary-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid rgba(229, 234, 240, 0.82);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.045);
}

.admin-summary-card span {
  overflow: hidden;
  color: #8a8f9c;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-summary-card strong {
  overflow: hidden;
  color: #101828;
  font-size: 15px;
  font-weight: 820;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-table-head,
.admin-row {
  display: grid;
  grid-template-columns: 250px 190px 160px 145px 170px 190px 180px 145px 160px 150px 145px 135px 165px 130px 165px 145px 155px 190px;
}

.admin-table-head {
  min-height: 58px;
  border-bottom: 1px solid rgba(229, 234, 240, 0.88);
  background: rgba(243, 246, 250, 0.9);
  color: #667085;
  font-size: 13px;
  font-weight: 850;
}

.admin-table-head > div,
.admin-row > div {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid rgba(229, 234, 240, 0.72);
}

.admin-table-head > div:last-child,
.admin-row > div:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  border-left: 1px solid rgba(229, 234, 240, 0.82);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  box-shadow: -18px 0 28px rgba(248, 251, 253, 0.78);
}

.admin-table-head > div:last-child {
  z-index: 3;
  background: rgba(243, 246, 250, 0.98);
}

.admin-row {
  min-height: 68px;
  border-bottom: 1px solid rgba(229, 234, 240, 0.78);
  background: rgba(255, 255, 255, 0.76);
  color: #101828;
  transition: background 150ms ease, box-shadow 150ms ease;
}

.admin-row:nth-child(odd) {
  background: rgba(249, 251, 253, 0.7);
}

.admin-row:nth-child(odd) > div:last-child {
  background: rgba(249, 251, 253, 0.96);
}

.admin-row:hover {
  background: #ffffff;
  box-shadow: inset 4px 0 0 rgba(18, 183, 106, 0.28);
}

.admin-row:hover > div:last-child {
  background: #ffffff;
}

.admin-row.ghost {
  box-shadow: inset 3px 0 0 rgba(180, 83, 9, 0.28);
}

.admin-project-cell {
  display: grid !important;
  gap: 4px;
  align-content: center;
}

.admin-project-cell strong {
  overflow: hidden;
  color: #101828;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-project-cell span {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(232, 248, 239, 0.78);
  color: #047857;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.admin-project-cell .project-alias {
  max-width: 190px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #667085;
  font-size: 11px;
  font-weight: 750;
}

.admin-manager-cell {
  overflow: hidden;
  color: #475467;
  font-size: 14px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-manager-cell.empty {
  color: #98a2b3;
  font-weight: 700;
}

.admin-money,
.admin-percent {
  color: #101828;
  font-size: 14px;
  font-weight: 760;
  white-space: nowrap;
}

.admin-money.empty {
  color: #98a2b3;
  font-weight: 700;
}

.admin-money.warn {
  color: #a47700;
}

.admin-money.negative {
  color: #b42318;
}

.admin-money.positive {
  color: #047857;
}

.admin-percent {
  display: grid !important;
  gap: 4px;
  align-content: center;
}

.admin-percent strong {
  font-size: 14px;
  font-weight: 820;
  line-height: 1;
}

.admin-percent span {
  color: #98a2b3;
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

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

.admin-actions .settings-button {
  color: #101828;
}

.admin-actions .limit-button {
  color: #047857;
}

.admin-actions .mini-button,
.admin-actions .delete-button {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.admin-empty {
  position: sticky;
  left: 0;
  width: min(100vw - 120px, 720px);
  padding: 22px;
  color: #667085;
  font-size: 15px;
  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: 40px 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.is-selected {
  border-color: rgba(16, 24, 40, 0.32);
  box-shadow:
    0 20px 54px rgba(16, 24, 40, 0.13),
    inset 0 0 0 1px rgba(16, 24, 40, 0.16);
}

.payment-load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px dashed rgba(16, 24, 40, 0.15);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.payment-load-more .mini-button {
  width: auto;
  min-width: 128px;
  padding: 0 16px;
  font-size: 12px;
}

.payment-select-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
}

.payment-select-cell:hover {
  background: rgba(255, 255, 255, 0.86);
}

.payment-select-cell.is-empty {
  visibility: hidden;
  pointer-events: none;
}

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

.payment-row.is-duplicate {
  border-color: rgba(193, 21, 27, 0.48);
  background:
    linear-gradient(90deg, rgba(255, 241, 240, 0.96) 0%, rgba(255, 247, 246, 0.88) 18%, rgba(255, 255, 255, 0.7) 56%),
    rgba(255, 255, 255, 0.72);
  box-shadow:
    0 20px 58px rgba(193, 21, 27, 0.18),
    inset 0 0 0 1px rgba(193, 21, 27, 0.16);
}

.payment-row.is-duplicate::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  display: block;
  width: 5px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, #e11d48, #b42318);
  content: "";
}

.payment-row.is-duplicate:hover {
  border-color: rgba(193, 21, 27, 0.62);
  box-shadow:
    0 24px 66px rgba(193, 21, 27, 0.22),
    inset 0 0 0 1px rgba(193, 21, 27, 0.2);
}

.payment-row.is-duplicate .payment-file-mark {
  border-color: rgba(193, 21, 27, 0.18);
  background: rgba(255, 241, 240, 0.92);
  color: var(--duplicate);
}

.duplicate-alert {
  position: absolute;
  top: -12px;
  left: 72px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(420px, calc(100% - 72px));
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(193, 21, 27, 0.18);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(193, 21, 27, 0.98), rgba(180, 35, 24, 0.94));
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(193, 21, 27, 0.18);
}

.duplicate-alert-title {
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
}

.duplicate-alert-meta {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.88);
  font-size: 11px;
  font-weight: 760;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.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-row.is-new {
  border-color: rgba(255, 255, 255, 0.82);
  box-shadow: 0 16px 42px rgba(16, 24, 40, 0.09), inset 0 0 0 1px rgba(4, 120, 87, 0.06);
}

.payment-row.is-expense {
  border-color: rgba(4, 120, 87, 0.14);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(236, 253, 245, 0.54)),
    rgba(255, 255, 255, 0.72);
}

.payment-row.is-expense .payment-file-mark {
  border-color: rgba(4, 120, 87, 0.12);
  background: rgba(236, 253, 245, 0.86);
  color: #047857;
}

.payment-row.is-duplicate,
.payment-row.is-duplicate.is-new,
.payment-row.is-duplicate.is-checked,
.payment-row.is-duplicate.tone-warn,
.payment-row.is-duplicate.tone-bad {
  border-color: rgba(193, 21, 27, 0.48);
  box-shadow:
    0 20px 58px rgba(193, 21, 27, 0.18),
    inset 0 0 0 1px rgba(193, 21, 27, 0.16);
}

.payment-file-cell {
  display: grid;
  place-items: center;
  gap: 4px;
  min-width: 0;
}

.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-new-marker {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border: 1px solid rgba(4, 120, 87, 0.12);
  border-radius: 999px;
  background: rgba(232, 248, 239, 0.78);
  color: #047857;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
}

.payment-source-marker {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border: 1px solid rgba(4, 120, 87, 0.12);
  border-radius: 999px;
  background: rgba(236, 253, 245, 0.82);
  color: #047857;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
}

.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;
}

.expense-row-meta {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: #667085;
  font-size: 11px;
  font-weight: 720;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.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 {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  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: 326px;
  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;
}

.payment-row.is-checked .risk-badge {
  right: 202px;
}

.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.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(5, 36px);
  align-items: center;
  gap: 8px;
}

.payment-actions.expense-actions {
  grid-template-columns: auto;
}

.expense-source-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(4, 120, 87, 0.15);
  border-radius: 12px;
  background: rgba(236, 253, 245, 0.72);
  color: #047857;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.manual-check-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 126px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(4, 120, 87, 0.16);
  border-radius: 12px;
  background: rgba(232, 248, 239, 0.56);
  color: #047857;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.manual-check-button:hover {
  border-color: rgba(4, 120, 87, 0.24);
  background: rgba(232, 248, 239, 0.82);
  transform: translateY(-1px);
}

.manual-check-button:disabled,
.manual-check-button.is-loading {
  opacity: 0.68;
  cursor: default;
  transform: none;
}

.manual-check-button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.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);
}

.admin-toolbar .admin-back {
  width: 130px;
  height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.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;
}

.payment-expenses-empty {
  display: grid;
  gap: 10px;
  max-width: 520px;
  padding: 24px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.92), rgba(255, 255, 255, 0.9));
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

.payment-expenses-empty span {
  color: #0f766e;
  font-size: 14px;
  font-weight: 900;
}

.payment-expenses-empty strong {
  color: #111827;
  font-size: 34px;
  line-height: 1;
}

.payment-expenses-empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.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,
.admin-settings-modal.open {
  display: block;
}

.edit-modal,
.admin-settings-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 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);
}

.admin-settings-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  transform: translate(-50%, -50%);
  overflow: hidden;
  border: 1px solid rgba(229, 234, 240, 0.9);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 253, 0.94)),
    #ffffff;
  box-shadow: 0 30px 90px rgba(37, 52, 75, 0.28);
}

.admin-limit-panel {
  width: min(520px, calc(100vw - 28px));
}

.admin-login-panel {
  width: min(420px, calc(100vw - 28px));
}

.line-items-panel {
  width: min(1180px, calc(100vw - 32px));
}

.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-vat {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  font-size: 14px;
  line-height: 1.3;
}

.preview-vat[hidden] {
  display: none;
}

.preview-vat-label {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 6px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.preview-vat-main {
  flex: 0 0 auto;
  font-weight: 900;
}

.preview-vat-details {
  min-width: 0;
  color: #374151;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-vat-muted {
  color: var(--muted);
  white-space: nowrap;
}

.preview-vat.tone-ok .preview-vat-label {
  background: #e7f8ef;
  color: #047857;
}

.preview-vat.tone-neutral .preview-vat-label {
  background: #eef2f7;
  color: #475569;
}

.preview-vat.tone-warn .preview-vat-label,
.preview-vat.is-loading .preview-vat-label {
  background: #fff4d6;
  color: #a16207;
}

.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);
}

.line-items-body {
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 18px;
}

.line-items-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 170px;
  gap: 12px;
}

.request-line-items-summary {
  grid-template-columns: minmax(420px, 1fr) 180px 170px;
}

.line-items-summary > div {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid rgba(229, 234, 240, 0.84);
  border-radius: 16px;
  background: rgba(248, 251, 253, 0.86);
}

.line-items-summary > .line-items-context-card {
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
}

.line-items-context-card > div {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.line-items-summary span {
  color: #8a8f9c;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.line-items-summary strong {
  overflow: hidden;
  color: #101828;
  font-size: 16px;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-items-summary .link-button {
  width: fit-content;
  padding: 0 14px;
  font-size: 13px;
}

.line-items-table {
  overflow: auto;
  border: 1px solid rgba(229, 234, 240, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.line-items-head,
.line-item-edit-row,
.project-line-item-row {
  display: grid;
  align-items: center;
  min-width: 860px;
}

.line-items-head,
.line-item-edit-row {
  grid-template-columns: minmax(280px, 1fr) 105px 80px 128px 128px 48px;
}

.project-line-items-head,
.project-line-item-row {
  grid-template-columns: 130px 110px minmax(320px, 1fr) 120px 130px 130px;
}

.line-items-head {
  min-height: 44px;
  border-bottom: 1px solid rgba(229, 234, 240, 0.9);
  background: rgba(245, 248, 251, 0.9);
  color: #667085;
  font-size: 12px;
  font-weight: 850;
}

.line-items-head > div,
.line-item-edit-row > *,
.project-line-item-row > div {
  min-width: 0;
  padding: 10px 12px;
}

.line-item-edit-row,
.project-line-item-row {
  min-height: 58px;
  border-bottom: 1px solid rgba(229, 234, 240, 0.64);
}

.line-item-edit-row:last-child,
.project-line-item-row:last-child {
  border-bottom: 0;
}

.line-item-edit-row input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(213, 219, 229, 0.9);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: #101828;
  font-size: 13px;
  font-weight: 700;
}

.line-item-name {
  overflow: hidden;
  color: #101828;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-line-item-row strong,
.project-line-item-row span {
  display: block;
}

.project-line-item-row span {
  color: #8a8f9c;
  font-size: 11px;
  font-weight: 760;
}

.line-check {
  display: inline-flex !important;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px !important;
  font-weight: 850 !important;
}

.line-check.ok {
  background: #e8f8ef;
  color: #067647 !important;
}

.line-check.new {
  background: #fff7ed;
  color: #b45309 !important;
}

.line-items-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.line-items-total {
  margin-right: auto;
  color: #667085;
  font-size: 13px;
  font-weight: 780;
}

.line-items-total strong {
  color: #101828;
  font-size: 18px;
  font-weight: 850;
}

.compact-pill {
  height: 38px;
  padding: 0 16px;
  font-size: 13px;
}

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

.admin-settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding: 18px;
}

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

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

.admin-settings-form .wide {
  grid-column: 1 / -1;
}

.limit-current {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid rgba(229, 234, 240, 0.82);
  border-radius: 18px;
  background: rgba(248, 251, 253, 0.86);
}

.limit-current span,
.limit-note {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.limit-current strong {
  color: #101828;
  font-size: 24px;
  font-weight: 850;
  line-height: 1;
}

.limit-note {
  margin: 0;
  line-height: 1.35;
}

.admin-login-error {
  min-height: 18px;
  margin: -4px 0 0;
  color: #b42318;
  font-size: 12px;
  font-weight: 800;
}

.admin-settings-form label {
  color: #667085;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.admin-settings-form input,
.admin-settings-form select {
  height: 44px;
  border-color: rgba(213, 219, 229, 0.86);
  border-radius: 14px;
  background: rgba(248, 251, 253, 0.9);
  color: #101828;
  font-size: 14px;
  font-weight: 760;
}

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

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

.admin-settings-actions {
  grid-column: 1 / -1;
}

.admin-settings-actions .text-button {
  width: auto;
  padding: 0 16px;
}

.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: 38px 58px 104px 210px 132px minmax(170px, 1fr) auto;
    gap: 12px;
  }

  .risk-badge {
    right: 318px;
  }

  .payment-row.is-checked .risk-badge {
    right: 194px;
  }
}

@media (max-width: 1360px) {
  .payment-row {
    grid-template-columns: 36px 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(5, 34px);
  }

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

  .payment-row.is-checked .risk-badge {
    right: 184px;
  }

  .manual-check-button {
    width: 112px;
    padding: 0 10px;
    font-size: 11px;
  }
}

@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 150px 170px 150px 150px;
  }

  .payment-row {
    grid-template-columns: 40px 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(5, 36px);
    justify-content: end;
  }

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

  .payment-row.is-checked .risk-badge {
    right: 14px;
  }

  .payment-sortbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .payment-sort-controls {
    justify-content: flex-start;
  }
}

@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;
  }

  .expense-upload-trigger {
    max-width: none;
    flex-basis: 100%;
  }

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

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

  .payment-row {
    grid-template-columns: 36px 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: 3;
    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(5, 36px);
    justify-content: start;
  }

  .payment-request {
    align-items: flex-start;
    flex-direction: column;
  }

  .payment-sortbar {
    padding: 12px;
    border-radius: 16px;
  }

  .payment-sort-title {
    width: 100%;
    justify-content: space-between;
  }

  .payment-sort-controls {
    width: 100%;
  }

  .payment-sort-button {
    flex: 1 1 92px;
    padding: 0 10px;
  }

  .manual-check-button {
    width: 100%;
    max-width: 220px;
  }

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

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

  .duplicate-alert {
    position: static;
    grid-column: 1 / -1;
    width: fit-content;
    max-width: 100%;
    margin-bottom: -2px;
  }

  .preview-panel {
    inset: 10px;
  }

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

  .preview-vat {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .preview-vat-details,
  .preview-vat-muted {
    white-space: normal;
  }

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