:root {
  color-scheme: light;
  --cream: #faf5eb;
  --surface: #fffcf6;
  --ink: #163d29;
  --green: #28543a;
  --gold: #c79b5e;
  --line: #e7dfcf;
  --sage: #e9ebde;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--cream);
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
main {
  max-width: 720px;
  margin: auto;
  padding: 28px 20px max(28px, env(safe-area-inset-bottom));
  padding-top: max(28px, env(safe-area-inset-top));
}
header {
  text-align: center;
  margin-bottom: 32px;
}
header img {
  object-fit: contain;
}
.wordmark {
  font-size: 30px;
  letter-spacing: 0.4px;
  margin: 6px 0 16px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  margin-top: 28px;
}
h1 {
  font-weight: 600;
  font-size: 32px;
  letter-spacing: -0.7px;
  margin: 12px 0;
}
h2 {
  font-weight: 600;
  font-size: 21px;
  margin: 0 0 12px;
}
p,
small {
  line-height: 1.65;
}
header p,
small,
.hint {
  color: #59685d;
}
small {
  display: block;
  font-size: 12px;
}
.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  margin: 20px 0;
}
form {
  display: grid;
  gap: 16px;
}
label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}
input,
textarea,
button {
  font: inherit;
  border-radius: 14px;
  min-height: 48px;
}
input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #bac9bc;
  background: #fffefb;
  padding: 14px;
  color: var(--ink);
}
textarea {
  resize: vertical;
  line-height: 1.7;
}
button {
  border: 1px solid transparent;
  padding: 12px 16px;
  background: var(--green);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: normal;
}
button:hover {
  filter: brightness(0.96);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
.secondary {
  background: var(--sage);
  color: var(--ink);
}
.quiet {
  background: transparent;
  color: var(--green);
  border-color: var(--line);
}
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}
.toolbar button {
  flex-grow: 1;
}
.toolbar h2 {
  margin: 0;
}
.badge {
  font-size: 11px;
  padding: 6px 10px;
  background: var(--sage);
  border-radius: 20px;
}
.hint {
  font-size: 12px;
  margin-bottom: 0;
}
#status:empty {
  display: none;
}
#status {
  padding: 14px;
  border-radius: 14px;
  background: var(--sage);
}
#status.error {
  background: #f6e9df;
  color: #873f2f;
}
#messages {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}
.message-row {
  display: grid;
  gap: 8px;
  text-align: left;
  background: var(--cream);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 400;
  overflow-wrap: anywhere;
}
.message-row strong {
  font-size: 12px;
}
footer {
  text-align: center;
  margin: 36px 0 8px;
  font-size: 14px;
}
footer small {
  margin-top: 8px;
}
dialog {
  max-width: 560px;
  width: calc(100% - 32px);
  max-height: 90dvh;
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 0;
  color: var(--ink);
  background: var(--cream);
}
dialog::backdrop {
  background: #163d2988;
}
.preview-content {
  padding: 28px;
  display: grid;
  gap: 12px;
}
.preview-content img {
  object-fit: contain;
}
.preview-content .wordmark {
  margin: 0;
}
.preview-content h2 {
  font-size: 28px;
  line-height: 1.25;
  margin: 20px 0;
}
.original {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 20px;
  line-height: 1.65;
  margin: 12px 0 24px;
}
.signature {
  font-size: 21px;
  font-weight: 600;
  margin: 0;
}
#preview-date {
  color: #59685d;
  margin: 0 0 20px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 400px) {
  main {
    padding-left: 14px;
    padding-right: 14px;
  }
  .card {
    padding: 20px;
  }
}
.filter-grid,
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  gap: 0.75rem;
}
.metrics div,
.activity {
  background: #f7f2e9;
  padding: 0.8rem;
  border-radius: 0.75rem;
}
.metrics dt,
.activity p {
  font-size: 0.85rem;
}
.metrics dd {
  font-size: 1.1rem;
  margin: 0.3rem 0 0;
  font-weight: 650;
}
.activity {
  margin-block: 0.45rem;
}
summary {
  cursor: pointer;
  font-weight: 600;
}
select {
  font: inherit;
  color: inherit;
  background: #fffdf7;
  padding: 0.7rem;
  border-radius: 0.6rem;
  border: 1px solid #ccc9b9;
}
#receipt-details {
  overflow-wrap: anywhere;
}
