:root {
  color-scheme: light;
  --ink: #111318;
  --muted: #66707c;
  --canvas: #f5f7f9;
  --card: #ffffff;
  --line: #e2e6ea;
  --line-strong: #cbd1d8;
  --accent: #2457e6;
  --accent-dark: #1944bd;
  --accent-soft: #edf2ff;
  --success: #157347;
  --success-soft: #eaf7f0;
  --warning: #946200;
  --warning-soft: #fff5d9;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 36px rgba(16, 24, 40, .07);
}

* { box-sizing: border-box; }

html {
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(180deg, #fff 0, var(--canvas) 320px);
}

.site-header {
  position: relative;
  display: flex;
  height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 64px);
  border-bottom: 1px solid rgba(17, 19, 24, .08);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 720;
  letter-spacing: -.02em;
  text-decoration: none;
}

.mark {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
}

.secure-pill,
.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .08em;
  text-transform: uppercase;
}

main { min-height: calc(100vh - 130px); }

footer {
  padding: 24px;
  color: #8a929d;
  font-size: 11px;
  text-align: center;
}

.request-shell,
.login-shell,
.message-shell {
  width: min(100% - 36px, 600px);
  margin: 0 auto;
  padding: 72px 0;
}

.eyebrow {
  margin-bottom: 13px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 780;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: -.04em;
}

h1 {
  font-size: clamp(40px, 7vw, 60px);
  line-height: 1.02;
}

h2 {
  font-size: 25px;
  line-height: 1.15;
}

.lead {
  margin: 19px 0 30px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.card,
.event-card,
.table-card,
.share-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.upload-card,
.login-card,
.dialog-card {
  display: grid;
  gap: 22px;
  padding: clamp(22px, 5vw, 34px);
}

.dropzone {
  display: flex;
  height: 178px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #fafbfc;
  cursor: pointer;
  text-align: center;
  transition: border-color .16s, background .16s, transform .16s;
}

.dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.dropzone.has-file {
  min-height: 210px;
  height: auto;
  padding: 16px;
  border-style: solid;
  border-color: #a9bdf8;
  background: var(--accent-soft);
}

.selected-preview {
  width: min(100%, 260px);
  height: 128px;
  margin-bottom: 12px;
  border: 1px solid #d7ddea;
  border-radius: 9px;
  background: #fff;
  object-fit: contain;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop-icon {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 10px;
  place-items: center;
  border: 1px solid #d8e1ff;
  border-radius: 10px;
  background: #fff;
  color: var(--accent);
  font-size: 21px;
  box-shadow: 0 2px 8px rgba(36, 87, 230, .08);
}

.dropzone strong { font-size: 14px; }

.dropzone small,
label span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

label:not(.dropzone) {
  display: grid;
  gap: 8px;
}

label span b { color: var(--accent); }

input,
select {
  width: 100%;
  min-height: 44px;
  appearance: none;
  outline: none;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 87, 230, .12);
}

button,
.button-link,
.actions a { font: inherit; }

button { cursor: pointer; }

.primary,
.button-link {
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 720;
  padding: 12px 17px;
  text-align: center;
  text-decoration: none;
  transition: background .15s, box-shadow .15s, transform .15s;
}

.primary:hover,
.button-link:hover {
  background: var(--accent-dark);
  box-shadow: 0 5px 15px rgba(36, 87, 230, .2);
  transform: translateY(-1px);
}

.primary:disabled {
  cursor: wait;
  opacity: .65;
  transform: none;
}

.secondary {
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: #28323d;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 12px;
}

.secondary:hover { background: #f6f8fa; }

.quiet {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.privacy {
  margin: 20px 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.privacy summary {
  color: #323a44;
  cursor: pointer;
  font-weight: 680;
}

.message-shell {
  padding-top: 110px;
  text-align: center;
}

.spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto 28px;
  border: 4px solid #dfe6f8;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.review-shell {
  width: min(100% - 40px, 1080px);
  margin: 0 auto;
  padding: 64px 0 84px;
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.review-image-card {
  position: sticky;
  top: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  box-shadow: var(--shadow);
}

.review-image-card img {
  display: block;
  width: 100%;
  max-height: 440px;
  border-radius: 9px;
  object-fit: contain;
}

.review-form { display: grid; gap: 28px; padding: clamp(22px, 4vw, 32px); }
.form-section { display: grid; gap: 16px; }
.form-section + .form-section { padding-top: 24px; border-top: 1px solid var(--line); }
.form-section h2 { font-size: 18px; letter-spacing: -.025em; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.success-check,
.error-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-size: 25px;
}

.error-mark {
  background: var(--danger-soft);
  color: var(--danger);
}

.login-shell { max-width: 440px; }
.login-card { margin-top: 28px; }

.alert {
  border: 1px solid #ffd6d1;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  padding: 11px 13px;
}

.admin-shell {
  width: min(100% - 40px, 1120px);
  margin: 0 auto;
  padding: 52px 0 80px;
}

.admin-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.admin-heading h1 { font-size: clamp(36px, 5vw, 52px); }
.compact { padding: 10px 15px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 28px 0 34px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.metrics div {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 20px;
  border-right: 1px solid var(--line);
}

.metrics div:last-child { border-right: 0; }

.metrics strong {
  font-size: 29px;
  font-weight: 720;
  letter-spacing: -.04em;
}

.metrics span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.event-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.event-card {
  padding: 22px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}

.event-card:hover {
  border-color: #ccd5e1;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.event-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.event-card h2 { margin: 13px 0 7px; }

.event-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.status.closed,
.status.failed {
  background: #f0f2f4;
  color: #646c75;
}

.status.pending,
.status.processing {
  background: var(--warning-soft);
  color: var(--warning);
}

.status.completed,
.status.live {
  background: var(--success-soft);
  color: var(--success);
}

.icon-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 11px;
  font-weight: 700;
  padding: 8px 10px;
}

.url-row {
  margin: 20px 0 13px;
  overflow: hidden;
  border: 1px solid #eceff2;
  border-radius: 8px;
  background: #f7f8fa;
  padding: 9px 10px;
}

.url-row code,
.share-card code {
  color: var(--muted);
  font: 11px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.actions a {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-underline-offset: 3px;
}

.top-actions { align-items: center; }
.top-actions .button-link { color: #fff; text-decoration: none; }

.back {
  display: inline-block;
  margin-bottom: 23px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.share-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
  padding: 17px 19px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}

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

.share-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.inline {
  margin-bottom: 18px;
  padding: 9px 0;
}

.admin-controls {
  display: grid;
  grid-template-columns: auto minmax(340px, 1fr);
  align-items: start;
  gap: 24px;
  margin-bottom: 20px;
}

.retention-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: end;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.retention-form .hint,
.retention-warning {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
}

.retention-warning { color: var(--danger); font-weight: 650; }

.selection-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: #fafbfc;
  color: var(--muted);
  font-size: 11px;
}

.selection-bar label { display: flex; align-items: center; gap: 8px; font-weight: 680; color: #343c46; }
.selection-bar input,
.select-cell input { width: 16px; height: 16px; min-height: 16px; accent-color: var(--accent); }
.selection-bar + .table-card { border-radius: 0 0 16px 16px; }

.submission-table { min-width: 1180px !important; }
.select-cell { width: 38px; }

.passport-thumb-link {
  display: block;
  width: 88px;
  height: 62px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f5f7;
}

.passport-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .16s;
}

.passport-thumb-link:hover .passport-thumb { transform: scale(1.04); }

.duplicate-badge {
  display: block;
  width: fit-content;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 9px;
  font-weight: 720;
  padding: 4px 7px;
}

.requested-values { display: grid; gap: 6px; min-width: 150px; }
.requested-values span { display: grid; gap: 2px; }
.requested-values b { color: var(--muted); font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }

.danger-button {
  border: 1px solid #f0c3bf;
  border-radius: 8px;
  background: #fff;
  color: var(--danger);
  font-size: 10px;
  font-weight: 700;
  padding: 7px 9px;
  white-space: nowrap;
}

.danger-button:hover { background: var(--danger-soft); }
.danger-button.tiny { padding: 4px 7px; font-size: 9px; }

.versions { margin-top: 7px; }
.versions summary { color: var(--accent); cursor: pointer; font-size: 10px; font-weight: 700; }
.versions ul { display: grid; gap: 6px; min-width: 230px; margin: 8px 0 0; padding: 0; list-style: none; }
.versions li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.table-card {
  overflow: auto;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.table-card table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.table-card th,
.table-card td {
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  text-align: left;
  vertical-align: top;
}

.table-card th {
  background: #fafbfc;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.table-card tr:last-child td { border-bottom: 0; }

td small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.empty {
  padding: 38px !important;
  color: var(--muted);
  text-align: center !important;
}

dialog {
  width: min(94vw, 560px);
  border: 0;
  background: transparent;
  padding: 0;
}

dialog::backdrop {
  background: rgba(15, 19, 26, .58);
  backdrop-filter: blur(4px);
}

.dialog-card {
  max-height: 90vh;
  overflow: auto;
  border-radius: 16px;
  background: var(--card);
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
}

.dialog-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 25px;
}

fieldset {
  display: grid;
  gap: 12px;
  margin: 0;
  border: 0;
  padding: 0;
}

legend {
  font-size: 13px;
  font-weight: 720;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 130px 34px;
  gap: 8px;
  margin-bottom: 8px;
}

.field-row button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 19px;
}

@media (max-width: 740px) {
  .site-header { height: 62px; }
  .secure-pill { display: none; }
  .request-shell { padding-top: 46px; }
  .event-list { grid-template-columns: 1fr; }
  .metrics div { display: grid; gap: 3px; padding: 15px; }
  .metrics span { font-size: 8px; }
  .admin-heading { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; }
  .share-card { align-items: flex-start; flex-direction: column; }
  .field-row { grid-template-columns: 1fr 105px 28px; }
  .review-layout { grid-template-columns: 1fr; }
  .review-image-card { position: static; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-controls { grid-template-columns: 1fr; }
  .retention-form { grid-template-columns: 1fr 1fr; }
  .retention-form label { grid-column: 1 / -1; }
}
