:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f3f6fb;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #f3f6fb; }
.wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
main.wrap { padding-top: 34px; padding-bottom: 60px; }

.top {
  background: linear-gradient(115deg, #10243f, #173e69);
  color: #fff;
  box-shadow: 0 7px 24px rgba(12, 36, 66, .18);
}
.nav { min-height: 68px; display: flex; align-items: center; gap: 24px; }
.nav nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.nav a { color: #dceafe; text-decoration: none; padding: 9px 10px; border-radius: 8px; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.brand { color: #fff !important; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }

h1, h2 { color: #13233a; letter-spacing: -.025em; }
h1 { margin: 4px 0 8px; font-size: clamp(29px, 5vw, 43px); line-height: 1.08; }
h2 { margin: 0 0 14px; font-size: 21px; }
p { line-height: 1.55; }
.muted { color: #657187; }
.eyebrow { margin: 0; color: #247a78; text-transform: uppercase; letter-spacing: .13em; font-size: 12px; font-weight: 800; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 24px; }

.card {
  background: #fff;
  border: 1px solid #dce4ef;
  border-radius: 16px;
  padding: 22px;
  margin: 16px 0;
  box-shadow: 0 8px 26px rgba(24, 45, 78, .055);
}
.grid { display: grid; gap: 14px; }
.stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card { margin: 0; min-height: 126px; display: flex; flex-direction: column; justify-content: space-between; }
.stat-card strong { font-size: 31px; color: #173e69; }
.stat-card .small-stat { font-size: 20px; }
.danger-card { border-color: #efcaca; background: #fffafa; }
.two-col { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; margin-top: 16px; }
.two-col .card { margin: 0; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.narrow { max-width: 820px; }
.login-card { max-width: 430px; margin: 9vh auto; padding: 34px; }

label { display: block; color: #28374c; font-size: 14px; font-weight: 700; margin-bottom: 12px; }
input, select, textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid #cbd6e4;
  border-radius: 10px;
  padding: 11px 12px;
  color: #172033;
  background: #fff;
  font: inherit;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(36, 122, 120, .16); border-color: #247a78; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: #176f6c;
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}
.btn:hover { filter: brightness(.96); }
.btn.secondary { background: #173e69; }
.btn.portal { background: #2f64a0; }
.btn.light { background: #eaf0f7; color: #1d3552; }
.btn.danger { background: #a83d47; }
.btn.full { width: 100%; }
.btn:disabled { cursor: not-allowed; opacity: .5; filter: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions.compact .btn { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.top-gap { margin-top: 12px; }

.status, .pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}
.status.ready { background: #d8f3ea; color: #17634f; }
.status.pending { background: #fff0c8; color: #755913; }
.pill.email, .pill.sent { background: #d8f3ea; color: #17634f; }
.pill.portal, .pill.pending, .pill.retry { background: #dbeafb; color: #1e568f; }
.pill.failed { background: #fae0e2; color: #8b2e37; }

.flash { padding: 13px 15px; border-radius: 10px; margin-bottom: 14px; border: 1px solid transparent; }
.flash.ok { background: #dff5e9; color: #185f42; border-color: #b9e5ce; }
.flash.err { background: #fae3e5; color: #8a313a; border-color: #efc5c9; }
.flash.warn { background: #fff2cf; color: #745b19; border-color: #f2dfa9; }
.hint, .notice { font-size: 13px; color: #5f6d80; }
.notice { background: #edf5fb; border-left: 4px solid #247a78; border-radius: 8px; padding: 12px 14px; margin: 8px 0 18px; }
.notice a { color: #195d91; font-weight: 750; }
.compliance-notice { font-size: 14px; }

.workflow-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.workflow-step { position: relative; margin: 0; padding-top: 52px; }
.workflow-step h2 { margin-top: 0; }
.step-number {
  position: absolute;
  top: 18px;
  left: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #173e69;
  color: #fff;
  font-weight: 850;
}
.copy-list { display: grid; gap: 8px; margin-top: 14px; }
.copy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #e6ebf1;
}
.copy-row > div { min-width: 0; }
.copy-row span { display: block; color: #68758a; font-size: 12px; }
.copy-row strong { display: block; margin-top: 3px; white-space: pre-line; overflow-wrap: anywhere; }
.copy-feedback { min-height: 22px; color: #17634f; font-weight: 700; }
.status-line { padding: 12px 14px; border-radius: 10px; }
.status-line strong { display: block; margin-bottom: 3px; }
.success-line { background: #dff5e9; color: #185f42; }

.process-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 13px; }
.process-list li { display: flex; gap: 10px; align-items: flex-start; }
.process-list li strong { margin-right: 4px; }
.dot { flex: 0 0 9px; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: #247a78; }
.dot.portal { background: #3f74a8; }
.dot.email { background: #1c8d70; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; vertical-align: top; padding: 12px 10px; border-bottom: 1px solid #e6ebf1; }
th { color: #647187; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
td { font-size: 14px; }
.sub { display: block; color: #778296; font-size: 12px; margin-top: 4px; max-width: 300px; overflow-wrap: anywhere; }
.error-text { color: #8a313a; max-width: 280px; overflow-wrap: anywhere; }

@media (max-width: 850px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .workflow-grid { grid-template-columns: 1fr; }
  .nav { align-items: flex-start; padding-top: 14px; padding-bottom: 14px; flex-direction: column; gap: 8px; }
  .nav nav { margin-left: 0; }
}

@media (max-width: 620px) {
  .wrap { width: min(100% - 22px, 1180px); }
  main.wrap { padding-top: 24px; }
  .stats-grid, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .page-head { flex-direction: column; }
  .card { padding: 17px; border-radius: 13px; }
  .workflow-step { padding-top: 50px; }
  .step-number { left: 17px; }
  .copy-row { align-items: flex-start; }
  .login-card { margin-top: 5vh; }
  .nav nav { gap: 2px; }
  .nav nav a { padding: 7px 8px; font-size: 13px; }
}
