:root {
  --ink: #1c1915;
  --muted: #5c564c;
  --paper: #f6f1e7;
  --card: #fffdf8;
  --line: #e3d9c8;
  --teal: #0e4f48;
  --teal-dark: #0a3833;
  --clay: #a33b24;
  --ok: #1f6b45;
  --focus: #c9852a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(14, 79, 72, 0.08), transparent 28rem),
    var(--paper);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

a { color: var(--teal); }

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--teal-dark);
  color: #f8f3ea;
}

.brand, .site-nav a, .linkish {
  color: inherit;
  text-decoration: none;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.brand small, .site-nav {
  color: #d5ebe6;
}

.brand strong, .brand small { display: block; }

.brand-mark {
  display: block;
  height: clamp(2.5rem, 9vw, 3.5rem);
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 0.45rem;
  background: var(--card);
  padding: 0.22rem 0.3rem;
  box-shadow: 0 0 0 1px rgba(255, 253, 248, 0.55);
}

.site-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.site-nav form { margin: 0; }

.linkish, .button-quiet {
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.site-main {
  width: min(42rem, calc(100% - 1.5rem));
  margin: 1.5rem auto 3rem;
}

.main-wide, .panel-wide, .panel-document {
  width: min(72rem, calc(100% - 1.5rem));
}

.site-main.main-wide { width: min(72rem, calc(100% - 1.5rem)); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 1.25rem;
  box-shadow: 0 12px 40px rgba(48, 32, 12, 0.05);
}

.panel-wide, .panel-document { width: auto; }

h1 { font-size: 1.8rem; line-height: 1.2; margin: 0 0 0.5rem; }

.lede { color: var(--muted); margin-top: 0; }

.eyebrow {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--teal);
}

.field { margin-bottom: 1rem; }
.field ul { list-style: none; padding: 0; margin: 0.2rem 0 0; }
.field li { margin: 0.35rem 0; }

label { display: block; font-weight: 600; margin-bottom: 0.35rem; }

.req { color: var(--clay); }

.control, input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="datetime-local"], select, textarea {
  width: 100%;
  padding: 0.75rem 0.8rem;
  border: 1px solid #cfc3af;
  border-radius: 0.55rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

textarea { resize: vertical; }

.control:focus, input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--focus);
  border-color: var(--focus);
}

.check {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-weight: 600;
}

.check input { margin-top: 0.25rem; }

ul { padding-left: 1.1rem; }

.button {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.8rem 1.1rem;
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  color: white;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.button:hover { background: var(--teal-dark); }

.button:disabled {
  background: #b7aea0;
  cursor: not-allowed;
}

.button-quiet {
  background: transparent;
  color: var(--teal);
  border: 1px solid var(--teal);
}

.button-danger { background: var(--clay); }

.hint { color: var(--muted); font-size: 0.92rem; }

.error, .message.error { color: var(--clay); font-weight: 650; }

.messages { list-style: none; padding: 0; }

.message {
  padding: 0.75rem 0.9rem;
  border-radius: 0.6rem;
  background: #e7f6ee;
  color: var(--ok);
}

.message.error { background: #fde8e4; }

.steps {
  display: flex;
  gap: 0.4rem;
  padding: 0;
  margin: 0 0 1rem;
  list-style: none;
  font-size: 0.82rem;
}

.steps li {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  color: var(--muted);
}

.steps span {
  display: grid;
  place-items: center;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: var(--line);
}

.steps .is-current { color: var(--ink); font-weight: 700; }
.steps .is-current span, .steps .is-done span { background: var(--teal); color: white; }

.grid {
  display: grid;
  gap: 0.8rem;
}

@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid .field:nth-child(3) { grid-column: auto; }
}

.inline-form { margin-top: 0.8rem; }

.document {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: #fff;
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
}

.document h1, .document h2 { font-family: Georgia, "Iowan Old Style", Palatino, serif; }

.signature-block {
  padding: 0.8rem 1rem;
  background: #f3eee4;
  border-left: 4px solid var(--teal);
}

.hash { word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; }

.section-head, .filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: end;
  justify-content: space-between;
}

.filters .field { flex: 1 1 10rem; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--line);
  font-size: 0.8rem;
}

.badge-sent, .badge-active { background: #d8f3e4; color: var(--ok); }
.badge-failed, .badge-expired, .badge-deleted { background: #fde8e4; color: var(--clay); }
.badge-pending, .badge-disabled { background: #f6e7c8; }

.facts {
  display: grid;
  gap: 0.8rem;
}

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

.facts div { margin: 0; }
.facts dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.facts dd { margin: 0.15rem 0 0; }

.id-preview {
  display: block;
  max-width: 16rem;
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
