:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d8dde6;
  --blue: #1769e0;
  --green: #12805c;
  --amber: #b75f00;
  --red: #c43131;
  --violet: #6f4cc3;
  --shadow: 0 18px 50px rgba(23, 32, 42, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 250, 0.92);
  backdrop-filter: blur(12px);
}

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

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: white;
  font-weight: 700;
}

.brand small,
td small,
.panel-head span,
.muted {
  display: block;
  color: var(--muted);
}

.topnav a {
  color: var(--muted);
  font-weight: 600;
}

.topnav .donate-link {
  border: 1px solid #ffd7ad;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a4f00;
  padding: 8px 10px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topnav form {
  margin: 0;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  padding: 0;
}

.shell {
  width: min(1380px, calc(100% - 48px));
  margin: 28px auto 56px;
}

.page-head,
.panel-head,
.form-actions,
.pay-actions,
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-head {
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  font-weight: 650;
}

h3,
strong,
b {
  font-weight: 650;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

.primary,
.secondary,
.danger,
.secondary-link,
.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 650;
}

.primary {
  background: var(--blue);
  color: white;
}

.secondary,
.secondary-link,
.icon-link.ghost {
  border-color: var(--line);
  background: white;
  color: var(--text);
}

.secondary-link {
  min-height: 36px;
}

.danger {
  border-color: #ffd0d0;
  background: #fff2f2;
  color: var(--red);
}

.plain {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.disabled {
  pointer-events: none;
  opacity: 0.55;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stats div,
.panel,
.pay-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stats div {
  padding: 18px;
}

.stats span {
  color: var(--muted);
  font-size: 13px;
}

.stats strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.filter-bar {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}

.onboarding {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 16px;
}

.onboarding-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.onboarding-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.onboarding-item span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 999px;
  background: #f2f5f9;
  color: var(--muted);
  font-weight: 700;
}

.onboarding-item.done span {
  background: #e8f6f1;
  color: var(--green);
}

.filter-bar form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 170px auto auto;
  gap: 10px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.table-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  text-transform: uppercase;
}

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

td strong {
  display: block;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
}

.badge.ok {
  background: #e8f6f1;
  color: var(--green);
}

.badge.soon {
  background: #fff5de;
  color: var(--amber);
}

.badge.urgent,
.badge.overdue {
  background: #ffe9e9;
  color: var(--red);
}

.timeline {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
}

.timeline-item span {
  grid-row: span 2;
  color: var(--muted);
  font-weight: 650;
}

.timeline-item.soon {
  border-left-color: var(--amber);
}

.timeline-item.urgent,
.timeline-item.overdue {
  border-left-color: var(--red);
}

.empty {
  color: var(--muted);
  text-align: center;
}

.modal {
  width: min(760px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(23, 32, 42, 0.35);
}

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

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  padding: 11px 12px;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

textarea {
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.narrow {
  width: min(860px, 100%);
}

.split {
  justify-content: flex-start;
}

.pay-view {
  width: min(880px, 100%);
  margin: 0 auto;
}

.pay-view > .secondary-link {
  margin-bottom: 14px;
}

.pay-card {
  padding: 28px;
  border-top: 6px solid var(--green);
}

.pay-card.soon {
  border-top-color: var(--amber);
}

.pay-card.urgent,
.pay-card.overdue {
  border-top-color: var(--red);
}

.pay-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.pay-meta div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.pay-meta span,
dt {
  color: var(--muted);
  font-size: 13px;
}

.pay-meta strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}

dl div {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

dd {
  margin: 4px 0 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.notes {
  margin: 0 0 20px;
  border-radius: 8px;
  background: #f2f5f9;
  padding: 14px;
  color: #3a4655;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.compact {
  margin-top: 4px;
}

.account-summary {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.account-mini {
  display: block;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.account-mini strong,
.account-mini small {
  display: block;
}

.full {
  width: 100%;
  margin-top: 12px;
}

.notice {
  margin: 14px 0 0;
  border: 1px solid #ffe2a9;
  border-radius: 8px;
  background: #fff8e8;
  padding: 12px 14px;
  color: #745002;
  font-weight: 650;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.account-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.account-card dl {
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.account-card h2,
.account-card dd,
.account-mini strong,
td strong {
  overflow-wrap: anywhere;
  word-break: normal;
}

.account-provider {
  color: var(--blue);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

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

.provider-list {
  display: grid;
  gap: 0;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.provider-row {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(180px, 260px) auto;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.provider-main p {
  margin: 7px 0;
  color: #3a4655;
}

.provider-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.provider-actions {
  display: flex;
  gap: 8px;
}

.auth-box {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.pay-actions {
  flex-wrap: wrap;
}

.pay-actions form {
  display: inline-flex;
  gap: 8px;
}

.compact-input {
  width: 220px;
  min-height: 40px;
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.history-item strong,
.history-item span,
.history-item small {
  display: block;
}

.history-item p {
  margin: 8px 0 0;
  color: var(--muted);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.setup-wizard {
  margin-bottom: 18px;
}

.setup-steps {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.setup-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.setup-step > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: #f2f5f9;
  color: var(--muted);
  font-weight: 700;
}

.setup-step.done > span {
  background: #e8f6f1;
  color: var(--green);
}

.setup-step h3 {
  margin: 0;
  font-size: 16px;
}

.setup-step p {
  margin: 6px 0 10px;
}

.setup-step form,
.split-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.setup-step input {
  min-width: min(360px, 100%);
  flex: 1;
}

.settings-grid .panel:first-child {
  grid-row: span 3;
}

.settings-grid aside form + form {
  margin-top: 10px;
}

.version-box {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 12px 0;
}

.version-box div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.version-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.version-box strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.version-box.success div:first-child {
  border-color: #bce9d8;
  background: #effaf6;
}

.version-box.running div:first-child {
  border-color: #b8d3ff;
  background: #f2f7ff;
}

.version-box.failed div:first-child {
  border-color: #ffd0d0;
  background: #fff2f2;
}

.stack-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.success {
  border-color: #bce9d8;
  background: #effaf6;
  color: var(--green);
}

.code-block {
  display: block;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f5f9;
  padding: 12px;
  color: #3a4655;
  line-height: 1.6;
}

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

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

.login-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 30px;
}

.login-card p {
  margin: 0;
  color: var(--muted);
}

.form-error {
  border: 1px solid #ffd0d0;
  border-radius: 8px;
  background: #fff2f2;
  padding: 10px 12px;
  color: var(--red);
  font-weight: 700;
}

@media (max-width: 1100px) {
  .filter-bar form,
  .settings-grid,
  .provider-row {
    grid-template-columns: 1fr;
  }

  .provider-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    height: auto;
    padding-bottom: 14px;
    padding-top: 14px;
  }

  .topnav {
    flex-wrap: wrap;
  }

  .pay-actions form {
    flex-direction: column;
    width: 100%;
  }

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

@media (max-width: 980px) {
  .stats,
  .layout,
  .pay-meta,
  dl {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 28px, 1380px);
  }

  .topbar {
    padding: 0 16px;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 27px;
  }

  .page-head,
  .pay-actions,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .setup-step {
    grid-template-columns: 1fr;
  }

  .setup-step form,
  .split-actions {
    flex-direction: column;
  }

  .actions {
    min-width: 180px;
  }
}
