/* Brand colors from the site (src/styles/tokens.css); system font; mobile first. */
:root {
  --forest: #2e5d3c;
  --forest-deep: #21422c;
  --gold: #e0a62b;
  --cream: #f6f1e6;
  --charcoal: #111111;
  --line: #d9d1bf;
  --field: #857f6b; /* 3.6:1 on white: fields stay visible in sunlight */
  --error: #a1261b;
  --tabs-height: 3.5rem;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--charcoal);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(var(--tabs-height) + 1.5rem + env(safe-area-inset-bottom));
}

h1 { font-size: 1.5rem; line-height: 1.2; margin: 0.5rem 0 1rem; color: var(--forest-deep); }

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

:focus-visible { outline: 3px solid var(--forest-deep); outline-offset: 2px; }
.tabs :focus-visible { outline-color: var(--gold); }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1rem;
}

.narrow { max-width: 24rem; margin: 2rem auto 0; }

.stack { display: grid; gap: 0.75rem; }
.stack > * { margin: 0; }

.error { color: var(--error); font-weight: 600; }

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

input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--field);
  background: #fff;
  color: var(--charcoal);
}

#code { font-size: 1.5rem; letter-spacing: 0.3em; text-align: center; }

button {
  border: 0;
  padding: 0.5rem 1rem;
  background: var(--forest);
  color: var(--cream);
  font-weight: 600;
  cursor: pointer;
}

button:active { background: var(--forest-deep); }
button:disabled { opacity: 0.6; cursor: progress; }
/* a button with data-busy shows that text while its form is being sent */
.htmx-request [data-busy] { font-size: 0; }
.htmx-request [data-busy]::after { content: attr(data-busy); font-size: 1rem; }
button.send { margin-top: 0.75rem; }
/* links that are tapped on a phone */
.tap { display: inline-block; min-height: 2.75rem; padding-block: 0.6rem; }
a.button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: 0.5rem 1rem;
  border-radius: 0.5rem; background: var(--forest); color: var(--cream); font-weight: 600; text-decoration: none; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.pair > div { display: grid; gap: 0.75rem; align-content: start; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.history { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.5rem; }
.history small { color: #555; display: block; }

/* Bottom tab bar */
.tabs {
  position: fixed;
  inset: auto 0 0 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabs-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--forest-deep);
}

.tabs > a, .tabs summary {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cream);
  text-decoration: none;
  font-size: 0.95rem;
  cursor: pointer;
}

.tabs [aria-current="page"] { color: var(--gold); font-weight: 700; box-shadow: inset 0 3px 0 var(--gold); }

.more { position: relative; display: grid; }
.more summary { list-style: none; height: var(--tabs-height); }
.more summary::-webkit-details-marker { display: none; }

.more .menu {
  position: absolute;
  right: 0.5rem;
  bottom: calc(100% + 0.5rem);
  min-width: 11rem;
  display: grid;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.15);
}

.more .menu a, .more .menu button {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: left;
  color: var(--charcoal);
  text-decoration: none;
  background: none;
  border-radius: 0;
  font-weight: 400;
}

.more .menu form { margin: 0; border-top: 1px solid var(--line); }

/* Inbox and request */
.week-title { margin: 0 0 0.25rem; font-size: 0.85rem; color: #555; font-weight: 600; }
.week { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; text-align: center; font-size: 0.85rem; margin-bottom: 1rem; }
.week strong { display: block; font-size: 1.4rem; color: var(--forest-deep); }
.list { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.list a { display: grid; gap: 0.15rem; color: inherit; text-decoration: none; }
.list small { color: #555; }
h2 { font-size: 1rem; margin: 0; color: var(--forest-deep); }
.message { white-space: pre-wrap; overflow-wrap: anywhere; }
.banner.bad { background: #fbe4e1; color: var(--error); }
.banner { background: var(--gold); padding: 0.75rem 1rem; border-radius: 0.5rem; font-weight: 600; }
textarea { border-radius: 0.5rem; }
button.secondary { background: none; color: var(--forest); border: 1px solid var(--forest); }
form + form, p + form { margin-top: 0.75rem; }
.shortcuts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.75rem; }
a.button.secondary { background: none; color: var(--forest); border: 1px solid var(--forest); }
/* nothing may push the page wider than the phone: long addresses wrap, date fields can shrink in a grid cell */
main p, main h1 { overflow-wrap: anywhere; }
.pair > div, input, select, textarea { min-width: 0; }
/* report: aligned digits, one product per block, totals set apart */
.num { font-variant-numeric: tabular-nums; }
.row { display: grid; gap: 0.15rem; }
.total { display: grid; gap: 0.15rem; margin-top: 0.25rem; padding-top: 0.75rem; border-top: 2px solid var(--forest); font-size: 1.1rem; }
