:root {
  --deep: #004448;
  --deep-600: #003a3d;
  --deep-500: #1a5557;
  --green: #73D895;
  --green-600: #59c47b;
  --sand: #F5F3EA;
  --sand-deep: #ebe7d8;
  --line: #e1dccd;
  --line-soft: #f0ecdf;
  --white: #ffffff;
  --ink: #1c2826;
  --muted: #5f6e6c;
  --faint: #8a9897;
  --red: #d36a6a;
  --r-input: 12px;
  --r-card: 16px;
  --ease: cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--sand);
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: 'Syne', 'Inter', sans-serif;
  color: var(--deep);
  font-weight: 700;
  margin: 0;
  line-height: 1.15;
}
h1 { font-size: clamp(28px, 3.4vw, 40px); }
h2 { font-size: 22px; margin: 0 0 8px 0; }
h3 { font-size: 17px; }
p { margin: 0; }
a { color: var(--deep); }
code {
  font-family: ui-monospace, monospace;
  font-size: 13.5px;
  background: var(--white);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 32px;
  background: var(--deep);
  color: #fff;
}
.topbar .brand {
  color: #fff;
  font-weight: 500;
  text-decoration: none;
  font-size: 16px;
  letter-spacing: .02em;
}
.topbar .brand b { font-weight: 700; }
.topbar .brand-sub {
  color: rgba(255,255,255,.65);
  font-size: 13px;
  border-left: 1px solid rgba(255,255,255,.2);
  padding-left: 14px;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  background: none;
  border: none;
  padding: 0;
  box-shadow: none;
}
.page-head .overline,
.form-hero .overline {
  color: var(--green-600);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 8px;
}
.page-head .lede {
  color: var(--muted);
  margin-top: 8px;
  max-width: 56ch;
}
.breadcrumb {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  margin-bottom: 12px;
}
.breadcrumb:hover { color: var(--deep); }

section {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 24px 28px;
  margin-bottom: 22px;
}
section > header { margin-bottom: 16px; }
section > header h2 + p { color: var(--muted); margin-top: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
  border-radius: var(--r-input);
  padding: 11px 20px;
  cursor: pointer;
  text-decoration: none;
  transition: background .14s var(--ease), color .14s var(--ease), border-color .14s var(--ease);
}
.btn.primary { background: var(--green); color: var(--deep); }
.btn.primary:hover { background: var(--green-600); }
.btn.ghost { background: transparent; color: var(--deep); border-color: var(--line); }
.btn.ghost:hover { background: var(--sand); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 9px; }

table.list {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.list th, table.list td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
table.list th {
  font-weight: 600;
  color: var(--muted);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--sand);
}
table.list tr:last-child td { border-bottom: none; }
table.list td a.btn { margin-right: 6px; }
.empty {
  color: var(--faint);
  font-style: italic;
  padding: 16px 0;
}

form fieldset {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 22px 24px;
  margin: 0 0 18px 0;
  background: var(--white);
}
form > fieldset:first-of-type { margin-top: 0; }
form legend {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--deep);
  padding: 0 8px;
}

form label {
  display: block;
  margin-bottom: 14px;
  font-weight: 500;
  color: var(--ink);
  font-size: 14px;
}
form label.inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin-top: 6px;
}
form label.inline input { width: auto; margin: 0; }
form label:last-child { margin-bottom: 0; }

input[type=text], input[type=email], input[type=number], input[type=date],
input:not([type]), select, textarea {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  padding: 11px 14px;
  margin-top: 6px;
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--deep-500);
  box-shadow: 0 0 0 3px rgba(0,68,72,.10);
}
.req { color: var(--red); margin-left: 4px; }
.hint {
  font-size: 13px;
  color: var(--muted);
  margin: -2px 0 8px 0;
}

.input-unit {
  display: flex;
  align-items: stretch;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  background: var(--white);
  overflow: hidden;
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.input-unit:focus-within {
  border-color: var(--deep-500);
  box-shadow: 0 0 0 3px rgba(0,68,72,.10);
}
.input-unit input {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 11px 14px;
  background: transparent;
}
.input-unit input:focus { outline: none; box-shadow: none; }
.input-unit .unit {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  background: var(--sand);
  border-left: 1px solid var(--line);
  white-space: nowrap;
}
.input-unit input[type=number]::-webkit-inner-spin-button,
.input-unit input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input-unit input[type=number] { -moz-appearance: textfield; appearance: textfield; }

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  padding: 9px 14px;
  border-radius: var(--r-input);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  background: var(--white);
  margin: 0;
}
.choice:has(input:checked) {
  border-color: var(--deep);
  background: rgba(0,68,72,.05);
  color: var(--deep);
  font-weight: 600;
}
.choice input { width: auto; margin: 0; }

#fields {
  list-style: none;
  padding: 0;
  margin: 0 0 14px 0;
}
#fields li {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 18px 20px;
  margin-bottom: 14px;
  background: var(--sand);
}
#fields li header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
#fields li header .row-num {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}
.btn-icon {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}
.btn-icon:hover { color: var(--red); border-color: var(--red); }
.hidden { display: none; }
.form-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  margin-top: 4px;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-form {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.inline-form label {
  flex: 1;
  min-width: 240px;
  margin: 0;
}

.form-hero {
  background: var(--deep);
  color: #fff;
  padding: 40px 36px;
  border: none;
}
.form-hero h1 { color: #fff; }
.form-hero .lede { color: rgba(255,255,255,.85); margin-top: 12px; max-width: 56ch; }
.form-hero .for { color: rgba(255,255,255,.7); margin-top: 16px; font-size: 14px; }
.form-hero .for strong { color: #fff; }

.banner {
  background: rgba(115,216,149,.18);
  border: 1px solid var(--green);
  color: var(--deep);
  border-radius: var(--r-card);
  padding: 18px 22px;
  margin-bottom: 22px;
}
.banner .link-url { margin-top: 8px; word-break: break-all; }
.banner code { background: var(--white); }

.thanks { text-align: center; padding: 60px 32px; }
.thanks article { max-width: 30ch; margin: 0 auto; }
.thanks h1 { color: var(--deep); margin-bottom: 14px; }
.thanks p { color: var(--muted); margin-bottom: 6px; }

.pivot-wrap {
  margin: 6px 0 0 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
table.pivot {
  border-collapse: collapse;
  font-size: 13.5px;
  background: var(--white);
  min-width: 100%;
}
table.pivot thead th {
  background: var(--sand);
  text-align: left;
  vertical-align: top;
  padding: 14px 16px;
  border-bottom: 2px solid var(--line);
  border-right: 1px solid var(--line-soft);
  min-width: 220px;
  max-width: 320px;
  white-space: normal;
}
table.pivot thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--sand-deep);
  min-width: 240px;
  max-width: 280px;
  box-shadow: 1px 0 0 var(--line);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
table.pivot thead th strong {
  display: block;
  color: var(--deep);
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 6px;
  white-space: normal;
}
table.pivot thead th .pill {
  font-size: 11px;
  padding: 3px 8px;
}
table.pivot thead th small {
  display: block;
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 500;
  margin-top: 6px;
}
table.pivot tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--sand);
  text-align: left;
  font-weight: 600;
  color: var(--deep);
  font-size: 13px;
  padding: 12px 16px;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line);
  min-width: 240px;
  max-width: 280px;
  white-space: normal;
  line-height: 1.4;
  box-shadow: 1px 0 0 var(--line-soft);
}
table.pivot tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  vertical-align: top;
  min-width: 220px;
  max-width: 320px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}
table.pivot tbody tr:hover th, table.pivot tbody tr:hover td { background: rgba(115,216,149,.06); }
table.pivot tbody tr:hover th { background: var(--sand-deep); }
table.pivot tr:last-child th, table.pivot tr:last-child td { border-bottom: none; }
table.pivot tbody td a { color: var(--deep); }
table.pivot tbody td a + a { display: inline-block; margin-top: 2px; }
table.pivot .empty { color: var(--faint); font-style: italic; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: .02em;
  border: 1px solid transparent;
}
.pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: .9;
}
.pill.submitted { background: rgba(115,216,149,.18); color: #1d6b3a; border-color: rgba(115,216,149,.4); }
.pill.draft { background: rgba(255,184,76,.18); color: #8a5a00; border-color: rgba(255,184,76,.45); }
.pill.empty { background: var(--sand-deep); color: var(--muted); border-color: var(--line); }

.file-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.file-list li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--sand);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
}
.file-list li a { text-decoration: none; color: var(--deep); font-weight: 500; }
.file-list li a:hover { text-decoration: underline; }
.file-list li small { color: var(--faint); }
.file-list li button {
  margin-left: auto;
  width: 24px; height: 24px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.file-list li button:hover { color: var(--red); border-color: var(--red); }

input[type=file] {
  font: inherit;
  padding: 8px 0;
  margin-top: 6px;
}

.save-status {
  flex: 1;
  font-size: 13px;
  color: var(--muted);
  transition: color .15s var(--ease);
}
.save-status[data-ok="0"] { color: var(--red); font-weight: 600; }
.form-foot .save-status { margin-right: 12px; }

.table-wrap {
  margin: 6px 0 0 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
table.form-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--white);
}
table.form-table th, table.form-table td {
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  padding: 0;
  text-align: left;
  vertical-align: top;
}
table.form-table thead th {
  background: var(--sand);
  font-weight: 700;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--deep);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
table.form-table thead th small {
  display: block;
  font-weight: 500;
  color: var(--faint);
  text-transform: none;
  letter-spacing: 0;
  font-size: 11.5px;
  margin-top: 2px;
}
table.form-table tbody th[scope="row"] {
  background: var(--sand);
  font-weight: 600;
  font-size: 13px;
  color: var(--deep);
  padding: 10px 12px;
  white-space: nowrap;
}
table.form-table tbody td input,
table.form-table tbody td select {
  width: 100%;
  border: none;
  border-radius: 0;
  padding: 10px 12px;
  margin: 0;
  background: transparent;
  font-size: 14px;
}
table.form-table tbody td input:focus,
table.form-table tbody td select:focus {
  outline: none;
  background: rgba(115,216,149,.10);
  box-shadow: inset 0 0 0 2px var(--deep-500);
}
table.form-table tr:last-child th, table.form-table tr:last-child td { border-bottom: none; }
table.form-table th:last-child, table.form-table td:last-child { border-right: none; }

#fields fieldset.row-columns {
  margin: 10px 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
#fields fieldset.row-columns legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--deep);
}
#fields [data-col-list] {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
}
#fields li.col-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 2fr auto;
  gap: 8px;
  align-items: start;
  background: var(--sand);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
#fields li.col-row input,
#fields li.col-row select,
#fields li.col-row textarea {
  margin-top: 0;
  font-size: 14px;
  padding: 8px 10px;
}
#fields li.col-row textarea { min-height: 38px; }
#fields li.col-row .hidden { display: none; }

.preset-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.preset-list li {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 16px 18px;
  background: var(--sand);
}
.preset-list article { flex: 1; }
.preset-list article strong {
  display: block;
  color: var(--deep);
  font-size: 16px;
  margin-bottom: 4px;
}
.preset-list article small.overline {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green-600);
  font-weight: 700;
  margin-bottom: 6px;
}
.preset-list article p {
  color: var(--muted);
  font-size: 13.5px;
  margin: 4px 0;
}
.preset-list article p.count { color: var(--faint); font-size: 12px; }
.preset-list form { margin: 0; }

.key-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 0 0;
}
.key-chips code {
  background: rgba(115,216,149,.18);
  border-color: rgba(115,216,149,.5);
  color: var(--deep);
}

@media (max-width: 720px) {
  main { padding: 24px 16px 60px; }
  .topbar { padding: 14px 16px; }
  .form-hero { padding: 28px 20px; }
  section { padding: 18px 18px; }
}
