[hidden] {
  display: none !important;
}

body.signup {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(14, 107, 91, 0.1), transparent 62%),
    radial-gradient(720px 480px at 100% 2%, rgba(185, 107, 63, 0.09), transparent 58%),
    var(--paper);
}

body.signup .toast {
  top: calc(74px + env(safe-area-inset-top));
}

.shell {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(10px + env(safe-area-inset-top)) 0 10px;
  border-bottom: 1px solid rgba(230, 224, 212, 0.8);
  background: rgba(245, 242, 234, 0.86);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(145deg, #14806c, #0b5448);
  color: #eafff8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 6px 14px -8px rgba(14, 107, 91, 0.7);
  flex: none;
}

.brand-mark svg {
  width: 23px;
  height: 23px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-copy strong {
  font-size: 15px;
  letter-spacing: 0.01em;
}

.brand-copy small {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.08em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid #cbe8d7;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(27, 122, 75, 0.14);
}

.status-pill.closed {
  border-color: var(--line);
  background: var(--surface-3);
  color: var(--muted);
}

.status-pill.closed .dot {
  box-shadow: none;
}

main {
  flex: 1 0 auto;
  padding: 30px 0 56px;
}

.page-intro {
  margin-bottom: 26px;
}

.page-intro h1,
.form-head h1 {
  margin: 7px 0 8px;
  font-size: clamp(27px, 6vw, 35px);
  line-height: 1.16;
  letter-spacing: -0.025em;
}

.lede {
  max-width: 54ch;
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}

.required-note {
  color: var(--accent);
}

.list-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.list-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.list-sub {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.count-chip {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.cards {
  display: grid;
  gap: 11px;
}

.record-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.16s var(--ease);
}

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

.record-card:active {
  transform: none;
}

.record-avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 18px;
  font-weight: 700;
  overflow: hidden;
  flex: none;
}

.record-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.18s var(--ease);
}

.record-avatar img.is-loaded {
  opacity: 1;
}

.record-body {
  flex: 1;
  min-width: 0;
}

.record-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.record-name {
  font-size: 16px;
  font-weight: 700;
}

.record-code {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
}

.chevron {
  margin-left: auto;
  color: var(--faint);
  font-size: 22px;
  line-height: 1;
  flex: none;
}

.hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.list-hint {
  margin-top: 16px;
}

.trust {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.trust-item svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
  flex: none;
}

.empty {
  padding: 38px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xl);
  background: rgba(255, 253, 249, 0.72);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: var(--primary-soft);
  color: var(--primary);
}

.empty-icon svg {
  width: 27px;
  height: 27px;
}

.empty h2 {
  margin: 0 0 5px;
  font-size: 17px;
}

.empty p {
  max-width: 340px;
  margin: 0 auto 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.banner {
  margin-bottom: 18px;
  font-size: 13px;
}

/* Form */
.form-head {
  position: relative;
  margin-bottom: 24px;
}

.back-btn {
  margin: 0 0 14px -10px;
}

.form-card {
  margin-bottom: 15px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.form-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.step {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  flex: none;
}

.form-card-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.form-card-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.field-grid {
  display: grid;
  gap: 17px;
}

.custom-fields {
  margin-top: 17px;
}

.optional {
  color: var(--faint);
  font-weight: 400;
}

.id-wrap {
  position: relative;
}

.id-wrap .input {
  padding-right: 52px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.id-x {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transform: translateY(-50%);
}

.id-x:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.id-x:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.char-count {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.photo-grid {
  display: grid;
  gap: 14px;
}

.photo-card {
  min-width: 0;
}

.photo-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-3);
  color: var(--muted);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
}

.photo-frame:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.photo-frame:disabled {
  cursor: not-allowed;
  opacity: 0.82;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-card[data-kind="id_front"] .photo-frame img,
.photo-card[data-kind="id_back"] .photo-frame img {
  object-fit: contain;
  background: var(--surface-3);
}

.photo-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
}

.photo-placeholder svg {
  width: 23px;
  height: 23px;
}

.photo-chip {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(14, 107, 91, 0.92);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  backdrop-filter: blur(6px);
}

.photo-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: rgba(255, 253, 249, 0.88);
  color: var(--ink-2);
  font-size: 12px;
  backdrop-filter: blur(2px);
}

.photo-card.changed .photo-frame {
  border-style: solid;
  border-color: var(--primary);
}

.photo-card.invalid .photo-frame {
  border-style: solid;
  border-color: var(--danger);
  background: var(--danger-soft);
}

.photo-card.processing .photo-frame {
  cursor: progress;
}

.photo-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 2px 0;
}

.photo-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.photo-copy strong {
  font-size: 13px;
  font-weight: 600;
}

.photo-hint {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.photo-size {
  margin-top: 1px;
  color: var(--faint);
  font-size: 10.5px;
  white-space: nowrap;
  flex: none;
}

.photo-error {
  margin-top: 6px;
}

.photo-tip {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.consent-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.65;
  cursor: pointer;
}

.consent-card input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--primary);
  flex: none;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.form-error {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #efc9c5;
  border-radius: 10px;
  background: var(--danger-soft);
}

.meta-card {
  display: block;
  margin-bottom: 15px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.meta-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-label {
  color: var(--muted);
  font-size: 12px;
}

.meta-code {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.meta-delete {
  margin-left: auto;
}

.meta-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.submit-dock {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.submit-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.submit-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.submit-copy strong {
  font-size: 14px;
}

.submit-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.submit-dock .btn {
  min-width: 150px;
  flex: none;
}

.progress {
  display: block;
  width: 100%;
  height: 6px;
  margin: 0 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  appearance: none;
}

.progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--line);
}

.progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.2s var(--ease);
}

.progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--primary);
}

.is-readonly .form-card {
  opacity: 0.92;
}

.is-readonly .submit-dock {
  display: none;
}

.is-readonly .photo-frame,
.is-readonly .consent-card {
  cursor: default;
}

.site-foot {
  padding: 0 0 calc(28px + env(safe-area-inset-bottom));
  color: var(--faint);
  font-size: 11px;
}

.site-foot .shell {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Privacy document */
.doc-dialog .dialog-body {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.75;
}

.doc-dialog .dialog-body h3 {
  margin: 18px 0 6px;
  color: var(--ink);
  font-size: 14px;
}

.doc-dialog .dialog-body ul {
  margin: 8px 0;
  padding-left: 20px;
}

.doc-dialog .dialog-body p {
  margin: 0 0 10px;
}

.doc-note {
  margin-top: 16px !important;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
}

@media (min-width: 600px) {
  .field-grid {
    grid-template-columns: 1fr 1fr;
  }

  .field-grid .span-2 {
    grid-column: 1 / -1;
  }
}

@media (min-width: 700px) {
  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 699px) {
  .form-card {
    padding: 18px;
  }

  .photo-grid {
    gap: 10px;
  }

  .photo-card {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
  }

  .photo-frame {
    aspect-ratio: 4 / 3;
    border-radius: 10px;
  }

  .photo-meta {
    display: block;
    padding: 0;
  }

  .photo-size {
    display: block;
    margin-top: 3px;
  }

  .photo-error {
    grid-column: 2;
    margin-top: 0;
  }

  .photo-tip {
    margin-top: 14px;
  }
}

@media (max-width: 719px) {
  body.is-form {
    padding-bottom: calc(102px + env(safe-area-inset-bottom));
  }

  body.is-form.is-readonly {
    padding-bottom: 0;
  }

  body.is-form .site-foot {
    display: none;
  }

  .submit-dock {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    margin: 0;
    padding: 11px 20px calc(11px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
    background: rgba(255, 253, 249, 0.95);
    box-shadow: 0 -10px 34px -24px rgba(23, 33, 31, 0.55);
    backdrop-filter: blur(14px);
  }

  .submit-inner {
    width: 100%;
    max-width: 780px;
    margin: 0 auto;
    gap: 12px;
  }

  .submit-copy strong {
    font-size: 13px;
  }

  .submit-hint {
    font-size: 11px;
  }

  .submit-dock .btn {
    min-width: 132px;
    padding: 12px 16px;
  }

  .progress {
    margin-bottom: 9px;
  }
}

@media (max-width: 420px) {
  .shell {
    padding: 0 16px;
  }

  main {
    padding-top: 24px;
  }

  .brand-copy small {
    display: none;
  }

  .list-head {
    align-items: center;
  }

  .list-sub {
    display: none;
  }

  .record-avatar {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }

  .record-meta {
    gap: 2px 10px;
  }

  .photo-card {
    grid-template-columns: 104px minmax(0, 1fr);
    padding: 9px;
  }

  .submit-hint {
    display: none;
  }
}
