:root {
  --bg: #eef3f9;
  --ink: #0f172a;
  --muted: #475569;
  --brand: #1d4ed8;
  --brand-dark: #1e3a8a;
  --card: #ffffff;
  --line: #dbe3ef;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  font-family: "Segoe UI", "Avenir Next", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #c7d7ff 0%, transparent 55%),
    linear-gradient(180deg, #f7fafc 0%, var(--bg) 100%);
  min-height: 100vh;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.5rem;
  background: #0b1220;
  border-bottom: 1px solid #1e293b;
}
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.brand img {
  display: block;
  height: 36px;
  width: auto;
}
.top-right {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.org { color: #cbd5e1; font-size: .95rem; }
a.btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
a.btn.exit { white-space: nowrap; }
.top a.btn.secondary {
  background: #334155;
  color: #f8fafc;
}
.top a.btn.secondary:hover {
  background: #475569;
}

.wrap {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto 3rem;
  padding-top: 1.35rem;
}

.steps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  padding: 0;
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: .9rem;
}
.steps .is-current { color: var(--brand); font-weight: 600; }
.steps .is-done { color: #64748b; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  animation: rise .35s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

h1 { margin: 0 0 .4rem; font-size: 1.55rem; letter-spacing: -0.02em; }
.lead { margin: 0 0 1.25rem; color: var(--muted); }

.file {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  border: 1px dashed #93c5fd;
  background: #f8fbff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
}
.file input { display: none; }
.file span { color: var(--brand); font-weight: 600; }
.file-name { color: var(--muted); min-height: 1.25rem; }

.grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 760px) {
  .grid { grid-template-columns: 1fr 1fr; }
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0;
  padding: 1rem;
}
legend { padding: 0 .35rem; color: var(--muted); }
input, select {
  width: 100%;
  margin: .35rem 0;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: .7rem .8rem;
  font: inherit;
}
.row2, .row3 { display: grid; gap: .5rem; }
.row2 { grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 1.4fr .6fr .8fr; }
.field { display: block; margin-bottom: .75rem; color: var(--muted); }
.checks {
  display: grid;
  gap: .65rem;
  margin: 1rem 0 0;
}
.check {
  position: relative;
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 0;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.check:hover {
  border-color: #93c5fd;
  background: #f0f7ff;
}
.check:has(input:checked) {
  border-color: #60a5fa;
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.15);
}
.check input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.check-ui {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 7px;
  border: 2px solid #94a3b8;
  background: #fff;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.check-ui::after {
  content: "";
  width: .45rem;
  height: .75rem;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
  margin-top: -2px;
  transition: transform .12s ease;
}
.check input:checked + .check-ui {
  border-color: var(--brand);
  background: var(--brand);
}
.check input:checked + .check-ui::after {
  transform: rotate(45deg) scale(1);
}
.check input:focus-visible + .check-ui {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}
.check-label {
  color: var(--ink);
  font-weight: 500;
}

.actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}
.btn {
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: .7rem 1.2rem;
  cursor: pointer;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: #e2e8f0; color: var(--ink); }

.review {
  background: #f8fafc;
  border-radius: 12px;
  padding: 1rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.total { font-size: 1.15rem; }
.preview {
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 1rem;
}
.error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: .75rem 1rem;
}
.working {
  display: flex;
  align-items: center;
  gap: .65rem;
  background: #eff6ff;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: .75rem 1rem;
  margin: 0 0 1rem;
}
.working[hidden] {
  display: none !important;
}
.working::before {
  content: "";
  width: 1rem;
  height: 1rem;
  border: 2px solid #93c5fd;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: 0 0 auto;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.btn.is-busy {
  opacity: .85;
  cursor: wait;
}
.ach { margin-top: 1rem; }
.ach input { margin: .4rem 0 .75rem; }
.done-actions {
  justify-content: flex-start;
  margin-top: 1.5rem;
}
