:root {
  color-scheme: light;
  --paper: #f3efe6;
  --card: #fffdf8;
  --ink: #1d1a16;
  --muted: #5e584e;
  --line: #ddd4c4;
  --accent: #1f4d3a;
  --accent-ink: #f4f1ea;
  --danger: #8c2f2f;
  --shadow: 0 1px 2px rgba(29, 26, 22, 0.06);
}

* { box-sizing: border-box; }

html { font-size: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

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

.skip {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  background: var(--ink);
  color: var(--card);
  padding: 0.4rem 0.7rem;
}

.skip:focus { top: 0.5rem; }

.topbar, .auth {
  padding: 1rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  background: var(--ink);
  color: var(--accent-ink);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.4rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.brand-name, .brand-sub { margin: 0; }
.brand-name { font-weight: 700; letter-spacing: 0.01em; }
.brand-sub, .session p, .lede { color: var(--muted); }
.topbar .brand-sub, .topbar .session p { color: #d9d1c3; margin: 0; }

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

.shell {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  min-width: 0;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}

.site-nav a[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

main {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1.4rem;
  min-width: 0;
}

.page-head { margin-bottom: 0.35rem; }
.page-head h1, .auth h1 { margin: 0 0 0.45rem; font-size: 1.6rem; overflow-wrap: break-word; }
.page-head p { margin: 0 0 0.35rem; color: var(--muted); max-width: 42rem; overflow-wrap: break-word; }

.stats {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.7rem;
}

.stats a {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.8rem;
  min-height: 5.5rem;
  background: var(--paper);
}

.stats span {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.table-wrap { overflow-x: auto; max-width: 100%; }

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

.table-wrap table { width: max-content; min-width: 100%; }

.table-wrap button, .table-wrap a { white-space: nowrap; }

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

td.wrap {
  white-space: normal;
  overflow-wrap: break-word;
  min-width: 10rem;
  max-width: 28rem;
}

th { font-size: 0.85rem; color: var(--muted); font-weight: 650; }

.empty { color: var(--muted); }
.error { color: var(--danger); }

.messages { padding-left: 1.1rem; }

form.stack-form, .auth form { display: grid; gap: 0.35rem; max-width: 24rem; }

label { font-weight: 650; margin-top: 0.4rem; }

input, button, select, textarea {
  font: inherit;
  min-height: 2.75rem;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.45rem 0.6rem;
  background: white;
}

textarea { min-height: 6rem; resize: vertical; }

input[type="checkbox"] { width: 1.25rem; min-height: 1.25rem; }

button, .text-link {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 0.5rem;
  padding: 0.45rem 0.9rem;
  text-decoration: none;
  cursor: pointer;
}

.text-link { display: inline-flex; align-items: center; min-height: 2.75rem; }

.topbar button { background: transparent; color: var(--accent-ink); border: 1px solid #8d867a; }

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

a.quiet {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.45rem 0.8rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  text-decoration: none;
}

.toolbar, .actions, .panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: end;
  margin: 0.5rem 0 1rem;
}

.toolbar input[type="search"] { max-width: 18rem; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  margin: 0 0 1.15rem;
  padding: 0 0 0.9rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.45;
  min-width: 0;
  position: static;
}

.crumbs a, .crumbs span {
  overflow-wrap: anywhere;
  min-width: 0;
}

.crumbs a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.panel { margin-top: 1.75rem; }
.panel h2 { margin: 0 0 0.7rem; }
.panel-head { align-items: center; justify-content: space-between; }
.note { color: var(--muted); margin-top: 0; }
.helptext { color: var(--muted); font-weight: 400; font-size: 0.9rem; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: #e5f0ea;
  color: var(--accent);
  font-size: 0.85rem;
}

.file-list, .link-list { padding-left: 1.1rem; }
.file-list li, .link-list li { margin: 0.85rem 0 1.1rem; overflow-wrap: break-word; }
.file-list span { color: var(--muted); margin: 0 0.4rem; }
.link-list p { margin: 0.35rem 0 0.55rem; overflow-wrap: anywhere; }

.stack-form p { margin: 0.15rem 0 0.45rem; }
.stack-form .actions { margin-top: 0.6rem; }

table button { min-height: 2.4rem; }

.facts { display: grid; gap: 1rem; margin: 1.15rem 0 0.25rem; }
.facts div { border-top: 1px solid var(--line); padding-top: 0.85rem; min-width: 0; }
.facts dt { color: var(--muted); font-size: 0.85rem; }
.facts dd { margin: 0.2rem 0 0; overflow-wrap: anywhere; }

.auth { max-width: 32rem; margin: 2rem auto; }

.errorlist { color: var(--danger); padding-left: 1.1rem; margin: 0.2rem 0 0.4rem; }

:focus-visible {
  outline: 3px solid #2f6f55;
  outline-offset: 2px;
}

.field-label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.offer-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.offer-card {
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.9rem 0.95rem 0.75rem;
  background: var(--paper);
  min-width: 0;
  max-width: 100%;
}

.offer-card p { margin: 0.15rem 0 0.55rem; overflow-wrap: anywhere; }
.offer-name { font-weight: 700; font-size: 1.05rem; }
.offer-card form { margin: 0.35rem 0 0.6rem; }
.offer-card button {
  white-space: normal;
  max-width: 100%;
  height: auto;
}
.offer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 0.35rem;
}

.offer-table { display: none; }
.offer-table-always { display: block; }
.offer-table-always table { width: 100%; }

.inline-form { display: inline; }
button.linkish {
  background: transparent;
  color: var(--accent);
  border: 0;
  padding: 0;
  min-height: 0;
  text-decoration: underline;
  cursor: pointer;
}
.row-actions { white-space: nowrap; }
.row-actions a, .row-actions form { margin-right: 0.55rem; }
.muted { color: var(--muted); }
.wrap { overflow-wrap: anywhere; }
.costing-cards { display: grid; }

@media (max-width: 400px) {
  .shell { padding: 0.65rem; }
  main { padding: 0.85rem 0.75rem 1.1rem; }
  .topbar, .auth { padding: 0.75rem; }
}

@media (min-width: 800px) {
  .shell {
    grid-template-columns: 14rem 1fr;
    align-items: start;
    padding: 1.25rem;
  }

  .site-nav { flex-direction: column; position: sticky; top: 1rem; }
  .site-nav a { border-radius: 0.6rem; }
  .offer-cards { display: none; }
  .offer-table { display: block; }
}
