:root {
  --bg: #f5f8fc;
  --panel: #ffffff;
  --text: #0d2742;
  --muted: #53657b;
  --line: #dce6f2;
  --line-strong: #b9cbe0;
  --blue: #2257d6;
  --blue-soft: #e9efff;
  --green: #0d8f57;
  --green-soft: #e8f7ef;
  --red: #b42318;
  --red-soft: #ffebe8;
  --amber: #9a6700;
  --amber-soft: #fff5d6;
  --shadow: 0 18px 55px rgba(13, 39, 66, .08);
  --radius: 28px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 6%, rgba(34, 87, 214, .08), transparent 34%),
    radial-gradient(circle at 80% 20%, rgba(38, 174, 96, .08), transparent 30%),
    var(--bg);
  color: var(--text);
}

.product-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 44px auto;
}

.workspace-panel { display: grid; gap: 22px; }

.title-card,
.card,
.notice {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.workspace-header { padding: 42px 48px; }

.workspace-header h1 {
  margin: 8px 0 12px;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  line-height: .98;
  letter-spacing: -0.06em;
}

.workspace-header p {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.notice {
  padding: 18px 22px;
  color: #354960;
  line-height: 1.55;
}

.card { padding: 26px; }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.row-wrap { flex-wrap: wrap; }

h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -0.04em;
}

.muted {
  color: var(--muted);
  margin: 0 0 14px;
  line-height: 1.55;
}

label,
.participant-field label,
.participant-status-block label {
  display: block;
  margin-bottom: 7px;
  color: #172f4b;
  font-size: .9rem;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 13px 14px;
  outline: none;
}

textarea { resize: vertical; min-height: 145px; }

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(34, 87, 214, .12);
}

.button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 12px 18px;
  transition: transform .15s ease, opacity .15s ease;
}

.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button.primary { background: var(--blue); color: #fff; }
.button.secondary { background: var(--blue-soft); color: var(--blue); }
.button.ghost { background: #f2f5f9; color: #30465f; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.top-actions { margin-top: 8px; }

.participants-card { padding-bottom: 28px; }

.participants-list {
  display: grid;
  gap: 18px;
}

.participant-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(130px, .38fr) minmax(92px, .25fr);
  gap: 18px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fbfdff;
}

.participant-action-block { display: flex; align-items: center; min-height: 50px; }

.remove-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 10px 0;
  text-align: left;
}

.add-button {
  width: 46px;
  height: 46px;
  margin-top: 18px;
  border: 0;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
}

.participants-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.progress {
  height: 9px;
  overflow: hidden;
  background: #edf2f8;
  border-radius: 999px;
  margin: 18px 0 0;
}

.progress > div {
  height: 100%;
  width: 0;
  background: var(--blue);
  border-radius: inherit;
  transition: width .25s ease;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
  background: #fff;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
  font-size: .95rem;
}

th {
  background: #f6f9fd;
  color: #42566d;
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: 0; }
.empty-row td { color: var(--muted); text-align: center; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge.pending { background: #eef3f8; color: #42566d; }
.badge.running { background: var(--amber-soft); color: var(--amber); }
.badge.success { background: var(--green-soft); color: var(--green); }
.badge.danger,
.badge.error { background: var(--red-soft); color: var(--red); }

.result-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 18px;
}

.summary-box {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: #f9fbfe;
}

.summary-box span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.summary-box strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
  line-height: 1;
}

.summary-danger strong { color: var(--red); }
.summary-success strong { color: var(--green); }
.summary-error strong { color: var(--amber); }

.cell-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.35;
}

.form-message {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .86rem;
}

a { color: var(--blue); font-weight: 800; }

.footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 36px;
  color: var(--muted);
  font-size: .9rem;
}

.institutional-footer {
  text-align: center;
  line-height: 1.55;
}

.institutional-footer p {
  margin: 4px 0;
}

.institutional-footer a {
  color: var(--blue);
  text-decoration: none;
}

.institutional-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 960px) {
  .participant-row { grid-template-columns: 1fr 1fr; }
  .participant-status-block,
  .participant-action-block { align-self: start; }
}

@media (max-width: 780px) {
  .product-shell { margin: 22px auto; }
  .workspace-header { padding: 30px 24px; }
  .card { padding: 20px; }
  .result-summary { grid-template-columns: 1fr; }
  .participant-row { grid-template-columns: 1fr; }
  .participants-footer { align-items: stretch; flex-direction: column; }
  .participants-footer .button { width: 100%; }
}

@media print {
  body { background: #fff; }
  .participants-card,
  .notice,
  .title-card,
  .footer,
  .card-header .actions,
  .button,
  textarea,
  input,
  .progress { display: none !important; }
  .product-shell,
  .footer { width: 100%; margin: 0; }
  .card,
  .notice,
  .title-card { box-shadow: none; border-radius: 0; }
  table { min-width: 0; }
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 14px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0;
  text-decoration: underline;
}

.link-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  text-decoration: none;
}

[hidden] { display: none !important; }

.auth-card { padding: 30px; }

.auth-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.user-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbff;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
}

.usage-summary {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f9fbfe;
  color: var(--muted);
  line-height: 1.45;
}

.usage-summary strong {
  color: var(--text);
  white-space: nowrap;
}

@media (max-width: 780px) {
  .auth-row { grid-template-columns: 1fr; }
  .auth-row .button { width: 100%; }
  .usage-summary { align-items: flex-start; flex-direction: column; }
  .user-box { width: 100%; justify-content: space-between; border-radius: 16px; }
}

.loading-card {
  min-height: 240px;
  display: flex;
  align-items: center;
}

.result-actions {
  align-items: center;
  gap: 12px;
}

.report-status {
  min-height: 24px;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.35;
  text-align: right;
}

@media (max-width: 780px) {
  .result-actions { align-items: stretch; flex-direction: column; }
  .report-status { text-align: left; }
}
