:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #18242b;
  background: #f7f6f2;
  line-height: 1.5;
  font-synthesis: none;

  --accent: #116466;
  --muted: #53626b;
  --border: #d4dcda;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

:where(.error-summary) a {
  display: inline-block;
  min-height: 44px;
  padding-top: 8px;
  color: #942d21;
}

button, input, select, textarea {
  font: inherit;
}

a, button, input, select, textarea, summary {
  scroll-margin-block: 48px;
}

button, .button, input, select, textarea {
  min-height: 44px;
}

button, .button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  text-decoration: none;
  font-weight: 600;
}

button:hover, .button:hover {
  background: #0c4b4d;
}

.secondary {
  background: #fff;
  color: var(--accent);
}

.secondary:hover {
  background: #edf5f3;
}

.danger {
  background: #fff;
  color: #942d21;
  border-color: #942d21;
}

.danger:hover {
  background: #fff0eb;
}

:focus-visible {
  outline: 3px solid #8b4f08;
  outline-offset: 3px;
}

[hidden] {
  display: none;
}

h1, h2, h3, p {
  margin: 0 0 12px;
}

h1 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  line-height: 1.2;
}

h2 {
  font-size: 1.2rem;
  line-height: 1.35;
}

small, .muted {
  color: var(--muted);
}

small {
  display: block;
}

.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.app-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 16px;
}

.brand {
  display: block;
  color: #18242b;
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
}

.brand span {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
}

.app-header nav {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

:where(.app-header nav) a {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding: 8px 12px;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
}

:where(.app-header nav) a[aria-current="page"] {
  background: #e7f2ef;
  color: #0c4b4d;
}

.nav-note {
  display: none;
}

main {
  max-width: 1440px;
  padding: 24px;
  margin: auto;
  min-width: 0;
}

.page-heading {
  margin-bottom: 20px;
}

.page-heading .muted {
  max-width: 70ch;
}

.surface, .context {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 24px;
  margin-bottom: 20px;
}

.context {
  border-left: 4px solid var(--accent);
}


.editor {
  max-width: 960px;
}

.editor > section {
  margin-bottom: 24px;
}

.editor h2 {
  margin-top: 8px;
}

.fields, .filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  min-width: 0;
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

input:not([type="radio"], [type="checkbox"], [type="hidden"]), select, textarea {
  width: 100%;
  border: 1px solid #83948e;
  border-radius: 6px;
  color: #18242b;
  background: #fff;
  padding: 10px 12px;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 24px;
}

legend {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  cursor: pointer;
}

.choice:has(input:checked) {
  background: #edf5f3;
  border-color: var(--accent);
}

.choice input {
  accent-color: var(--accent);
  width: 20px;
  flex-shrink: 0;
  margin: 0;
}

.tabs, .actions, .pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tabs a {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  text-decoration: none;
}

.tabs a[aria-current="page"] {
  background: #116466;
  color: #fff;
  border-color: #116466;
}

.pagination {
  margin-top: 20px;
}

:where(.pagination) p {
  margin: 0 auto 0 0;
}

.table-shell {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th, td {
  padding: 16px;
  text-align: left;
  overflow-wrap: anywhere;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-size: 0.85rem;
  background: #edf1ed;
  color: #334a46;
}


td {
  font-variant-numeric: tabular-nums;
}

td p {
  margin: 4px 0 0;
}

th:first-child {
  width: 28%;
}

tr:last-child td {
  border-bottom: 0;
}

.empty {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 32px;
}

.back-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  margin-bottom: 8px;
}

.save-bar {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.save-bar p {
  color: var(--muted);
}

.notice, .calculation {
  background: #e7f2ef;
  color: #214941;
  padding: 16px;
  border-radius: 8px;
}

.error-summary {
  border: 2px solid #942d21;
  background: #fff;
  padding: 20px;
  margin-bottom: 20px;
}

 .field-error {
  color: #942d21;
}

.error-summary li {
  margin-bottom: 8px;
}

input[aria-invalid="true"] {
  border: 2px solid #942d21;
}

.selection {
  padding: 12px;
  background: #edf5f3;
  border-radius: 8px;
  font-weight: 600;
}

.picker {
  position: relative;
}

.picker ul {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  border: 1px solid #83948e;
  border-radius: 6px;
  max-height: 320px;
  overflow: auto;
}

.picker li {
  padding: 12px;
  min-height: 44px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.picker li[aria-selected="true"] {
  background: #e7f2ef;
  color: #0c4b4d;
}

.picker li small {
  display: block;
  font-weight: 400;
}

summary {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 0;
  font-weight: 600;
}

details .table-shell {
  margin-top: 12px;
}

.review-list {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr);
  gap: 12px 24px;
}

.review-list dt {
  color: var(--muted);
}

.review-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
}

.login {
  max-width: 440px;
}

.app-footer {
  padding: 24px;
  color: var(--muted);
  font-size: 0.8rem;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  padding: 12px;
  background: #fff;
  z-index: 2;
}

.skip-link:focus {
  top: 12px;
}

@media (min-width: 1024px) {
  .app-header {
  position: fixed;
  inset: 0 auto 0 0;
  width: 224px;
  padding: 32px 20px;
  border-right: 1px solid var(--border);
  border-bottom: 0;
}

  .app-header nav {
  flex-direction: column;
  margin-top: 40px;
  gap: 8px;
}

  .nav-note {
  display: block;
  margin-top: 48px;
  color: var(--muted);
  font-size: 0.8rem;
}

  main {
  margin-left: 224px;
  padding: 32px 40px;
}

  .app-footer {
  margin-left: 224px;
  padding-left: 40px;
}
}

@media (max-width: 767px) {
  main {
  padding: 16px;
}

  .page-heading {
  margin-bottom: 16px;
}

  .eyebrow {
  display: none;
}

  .surface, .context {
  padding: 16px;
}

  .fields, .filters {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

  .table-shell {
  border: 0;
  background: transparent;
}

  table, tbody {
  display: block;
}

  thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

  tr {
  display: block;
  background: #fff;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
}

  td {
  display: block;
  border: 0;
  padding: 4px 0;
}

  td::before {
  content: attr(data-label) ": ";
  color: var(--muted);
  font-size: 0.85rem;
}

  td:first-child {
  font-weight: 600;
}

  .review-list {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

  .review-list dd {
  margin-bottom: 12px;
}

  .save-bar button {
  width: 100%;
}

  .tabs {
  gap: 4px;
}

  .tabs a {
  padding: 10px;
}

  .filters .field {
  margin-bottom: 8px;
}
}
