:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #162638;
  background: #f4f6f8;
  font-size: 1rem;
  line-height: 1.4;
  --ink: #162638;
  --muted: #4b5d70;
  --blue: #164e80;
  --line: #d4dee7;
  --paper: #fff;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
[hidden] {
  display: none;
}
:focus-visible {
  outline: 3px solid #2e7ec4;
  outline-offset: 3px;
}
button,
select,
textarea,
input {
  font: inherit;
}
p,
h1,
h2 {
  margin: 0;
}

.sr-only,
.mode-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 42rem;
  min-height: 3.35rem;
  padding: 0.14rem 1rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 730;
}
.brand img {
  border-radius: 0.38rem;
}
.workspace {
  width: min(100%, 42rem);
  padding: 1.2rem 1rem max(1.45rem, env(safe-area-inset-bottom));
  margin: 0 auto;
}
h1 {
  margin-bottom: 1.05rem;
  font-size: clamp(1.9rem, 6vw, 2.45rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}
h2,
legend {
  font-size: 1rem;
  font-weight: 720;
  letter-spacing: -0.01em;
}
.help {
  color: var(--muted);
  font-size: 0.84rem;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}
.capture {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 0.7rem;
  border-radius: 0.72rem;
}
.photo-actions {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 0.42rem;
}

.primary,
.secondary,
.capture-camera,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: 0.44rem;
  padding: 0.43rem 0.62rem;
  text-decoration: none;
  text-align: center;
  line-height: 1.25;
  font-weight: 680;
  cursor: pointer;
  touch-action: manipulation;
}
.primary {
  color: #fff;
  background: var(--blue);
}
.primary:hover {
  background: #113c63;
}
.secondary,
.capture-camera {
  color: var(--blue);
  background: var(--paper);
  border-color: #b8c7d5;
}
.capture-camera {
  background: #eaf3fa;
  border-color: #b9cddd;
}
.secondary:hover,
.capture-camera:hover,
.text-button:hover {
  background: #e3eef6;
}
.text-button {
  color: var(--blue);
  background: transparent;
  font-size: 0.9rem;
}
.topbar .text-button {
  padding-inline: 0.3rem;
}
.text-button.remove {
  color: #922633;
}
button:disabled {
  opacity: 0.58;
  cursor: default;
}
.camera {
  width: 0.92rem;
  height: 0.67rem;
  border-radius: 0.12rem;
  border: 1.5px solid currentColor;
  position: relative;
  flex: 0 0 auto;
}
.camera::before {
  content: "";
  position: absolute;
  width: 0.32rem;
  height: 0.32rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  inset: 0;
  margin: auto;
}
.camera::after {
  content: "";
  position: absolute;
  height: 0.1rem;
  width: 0.32rem;
  left: 0.11rem;
  top: -0.2rem;
  background: currentColor;
}

.photo-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
.photo-list:not(:empty) {
  margin-top: 0.53rem;
}
.photo-tile {
  width: 100%;
  min-height: 2.75rem;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.21rem;
  padding: 0.23rem;
  background: #f3f6fa;
  border: 1px solid #d8e2eb;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 660;
  border-radius: 0.4rem;
  cursor: pointer;
}
.photo-tile:hover {
  background: #e8f1f8;
}
.photo-tile img {
  width: 100%;
  height: 2.1rem;
  object-fit: contain;
}

.mode-picker {
  border: 0;
  min-width: 0;
  padding: 0;
  margin: 1rem 0 0.82rem;
}
.mode-picker legend {
  padding: 0;
  margin-bottom: 0.38rem;
}
.modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid #c4d0dc;
  border-radius: 0.61rem;
  background: var(--paper);
}
.mode-option {
  position: relative;
  cursor: pointer;
}
.mode-option + .mode-option {
  border-left: 1px solid #d5dfe8;
}
.mode-option span {
  display: flex;
  min-height: 3.35rem;
  align-items: center;
  justify-content: center;
  padding: 0.36rem 0.2rem;
  text-align: center;
  color: #314961;
  font-size: clamp(0.73rem, 3.3vw, 0.88rem);
  font-weight: 680;
  line-height: 1.2;
}
.mode-option:first-child span {
  border-radius: 0.55rem 0 0 0.55rem;
}
.mode-option:last-child span {
  border-radius: 0 0.55rem 0.55rem 0;
}
.mode-option input:checked + span {
  color: #fff;
  background: var(--blue);
  box-shadow: inset 0 -3px #0d365a;
}
.mode-option input:focus-visible + span {
  outline: 3px solid #2e7ec4;
  outline-offset: 2px;
  position: relative;
  z-index: 1;
}
#mode-description {
  margin-top: 0.41rem;
  line-height: 1.35;
  min-height: 2.1em;
}

.folds {
  border: 1px solid var(--line);
  border-radius: 0.66rem;
  background: var(--paper);
}
.folds details + details {
  border-top: 1px solid var(--line);
}
.folds summary {
  list-style: none;
  cursor: pointer;
  min-height: 2.75rem;
  padding: 0.45rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.48rem;
  font-size: 0.94rem;
  font-weight: 670;
}
.folds summary::-webkit-details-marker {
  display: none;
}
.folds summary::after {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border: solid #415971;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  flex: 0 0 auto;
  margin: -0.18rem 0.09rem 0 0.19rem;
}
.folds details[open] summary::after {
  transform: rotate(225deg);
  margin-top: 0.17rem;
}
.summary-value {
  margin-left: auto;
  text-align: right;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 540;
  overflow-wrap: anywhere;
}
.fold-body {
  padding: 0.11rem 0.7rem 0.73rem;
}
.fold-body label {
  display: block;
  font-size: 0.86rem;
  font-weight: 670;
  margin-bottom: 0.22rem;
}
.fold-body :is(textarea, select, input) {
  display: block;
  width: 100%;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #b4c5d4;
  border-radius: 0.41rem;
  padding: 0.5rem 0.53rem;
  min-height: 2.75rem;
}
.fold-body textarea {
  resize: vertical;
}
.fold-body textarea::placeholder {
  color: #5b6c7e;
}
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.55rem;
  margin-bottom: 0.56rem;
}
.address {
  margin-top: 0.28rem;
  overflow-wrap: anywhere;
}
.custom-address {
  margin-top: 0.48rem;
}

.submission {
  margin-top: 0.72rem;
}
.send {
  width: 100%;
  min-height: 2.95rem;
}
.send-help {
  font-size: 0.75rem;
  text-align: center;
  margin-top: 0.37rem;
}
.notice {
  margin: 0 0 0.52rem;
  padding: 0.55rem 0.65rem;
  background: #e5eff8;
  color: #193b59;
  border-radius: 0.43rem;
  font-size: 0.9rem;
}
.notice[data-state="sent"] {
  background: #dfeee5;
  color: #154732;
}
.notice.error,
.notice[data-state="failed"],
.notice[data-state="uncertain"] {
  background: #fae7e9;
  color: #81272e;
}
.error-text {
  margin-top: 0.35rem;
  color: #8c2931;
  font-size: 0.88rem;
}

.sign-in {
  padding-top: 2.4rem;
}
.login-card {
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--paper);
  padding: clamp(1rem, 5vw, 1.7rem);
}
.login-card p {
  color: var(--muted);
}
.login-card .primary {
  margin-top: 0.8rem;
}
.login-card .login-remember {
  margin-top: 0.52rem;
  font-size: 0.88rem;
}
.login-card .notice {
  margin-top: 0.65rem;
}

.photo-editor {
  width: min(calc(100% - 1.05rem), 39rem);
  max-height: 92dvh;
  border: 1px solid #c1cfdd;
  border-radius: 0.7rem;
  padding: 0.75rem;
  color: var(--ink);
}
.photo-editor::backdrop {
  background: #122b40a3;
}
.photo-editor h2 {
  margin-bottom: 0.28rem;
}
.photo-editor-image {
  display: flex;
  justify-content: center;
  margin: 0.52rem 0;
  background: #eef3f7;
}
.photo-editor canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 47dvh;
  touch-action: none;
  cursor: crosshair;
}
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.36rem;
}
.editor-save {
  justify-content: flex-end;
  margin-top: 0.48rem;
}

@media (max-width: 22rem) {
  .workspace {
    padding-inline: 0.72rem;
  }
  .photo-actions button {
    font-size: 0.89rem;
  }
  .summary-value {
    font-size: 0.7rem;
  }
}
