/* Warm / naturalist baseline. Fraunces lands in a later step. */
:root {
  color-scheme: light dark;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  --paper: #faf7f2;
  --ink: #1d1a16;
  --terracotta: #8b4a2b;
  --moss: #4a6b3a;
  --rule: #d9cbb4;
}

body {
  margin: 0;
  background: #faf7f2;
  color: #1d1a16;
}

.auth-shell {
  max-width: 26rem;
  margin: 4rem auto;
  padding: 2rem;
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.auth-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.auth-form label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.auth-form input {
  padding: 0.6rem 0.75rem;
  font: inherit;
  border: 1px solid #cbb7a0;
  border-radius: 0.25rem;
  background: #fff;
}

.auth-form button {
  padding: 0.7rem 1rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: #8b4a2b;
  border: 0;
  border-radius: 0.25rem;
  cursor: pointer;
}

.auth-form button:hover {
  background: #6e3a21;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 0.25rem;
  margin: 0 0 1rem;
}

.flash-error  { background: #fbe4de; color: #742016; }
.flash-info   { background: #e6efe6; color: #1f4a1f; }

.muted { color: #7a6a57; font-size: 0.9rem; }

/* App shell --------------------------------------------------------------- */

.app-shell {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.top-nav {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 1rem 0 0.75rem;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}

.top-nav__brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.top-nav__links {
  display: flex;
  gap: 1rem;
  flex: 1;
}

.top-nav__link {
  color: var(--ink);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.top-nav__link.is-active {
  border-bottom-color: var(--module-color, var(--terracotta));
  font-weight: 600;
}

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

.link-button {
  background: none;
  border: 0;
  color: var(--terracotta);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.link-button:hover { text-decoration: underline; }

.sub-nav {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0 1rem;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}

.sub-nav__link {
  color: var(--ink);
  opacity: 0.75;
  text-decoration: none;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sub-nav__link.is-active,
.sub-nav__link:hover { opacity: 1; }

.icon {
  width: 0.85em;
  height: 0.85em;
  flex: none;
  vertical-align: -0.1em;
}

.icon--lg { width: 1em; height: 1em; }

.app-main { padding-top: 1.5rem; }

.home-panel h1,
.capture-panel h1,
.timeline-panel h1,
.plants-panel h1,
.water-panel h1 {
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
}

.timeline-panel h2,
.plants-panel h2,
.water-panel h2 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.5rem;
}

/* Capture form ------------------------------------------------------------ */

.capture-form {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  max-width: 32rem;
}

.capture-form__field {
  display: grid;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.capture-form__field--inline {
  grid-auto-flow: column;
  justify-content: start;
  gap: 0.5rem;
  align-items: center;
}

.capture-form input[type="text"],
.capture-form input[type="number"],
.capture-form input[type="file"],
.capture-form textarea,
.water-form input[type="text"],
.water-form input[type="number"],
.water-form textarea {
  padding: 0.55rem 0.7rem;
  font: inherit;
  border: 1px solid #cbb7a0;
  border-radius: 0.25rem;
  background: #fff;
}

.capture-form__submit,
.water-form__submit {
  justify-self: start;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--terracotta);
  border: 0;
  border-radius: 0.25rem;
  cursor: pointer;
}

.capture-form__submit:hover,
.water-form__submit:hover { background: #6e3a21; }

.capture-status { margin-top: 1.25rem; min-height: 1.5em; }

.capture-status__row {
  padding: 0.55rem 0.75rem;
  border-radius: 0.25rem;
  background: #efe6d3;
  margin: 0;
}

.capture-status__row--done    { background: #e6efe6; color: #1f4a1f; }
.capture-status__row--needs_review { background: #fdf3d8; color: #6b4d10; }
.capture-status__row--processing,
.capture-status__row--received { background: #efe6d3; color: #5a4427; }
.capture-status__row--failed,
.capture-status__row--queued   { background: #fbe4de; color: #742016; }

/* Timeline ---------------------------------------------------------------- */

.timeline-list {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.obs-card {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 1rem;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 0.4rem;
  border-left: 4px solid var(--moss);
}

.obs-card--medium { border-left-color: #c0883a; }
.obs-card--low    { border-left-color: #b04b3a; }

.obs-card__thumb img {
  width: 100%;
  height: auto;
  border-radius: 0.25rem;
  display: block;
}

.obs-card__thumb--missing {
  display: grid;
  place-items: center;
  height: 6rem;
  color: #a89b86;
  background: #f1ebdf;
  border-radius: 0.25rem;
  font-size: 0.85rem;
}

.obs-card__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.obs-card__title { font-size: 1.05rem; margin: 0; }

.obs-card__when { font-size: 0.8rem; color: #7a6a57; white-space: nowrap; }

.obs-card__meta {
  display: flex;
  gap: 0.5rem;
  margin: 0.25rem 0 0.5rem;
  font-size: 0.85rem;
}

.obs-card__badge {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  border-radius: 0.2rem;
  background: var(--moss);
  color: #fff;
}

.obs-card__badge--medium { background: #c0883a; }
.obs-card__badge--low    { background: #b04b3a; }

.obs-card__stage {
  font-size: 0.8rem;
  color: #5a4427;
  background: #efe6d3;
  padding: 0.1rem 0.4rem;
  border-radius: 0.2rem;
}

.obs-card__summary { margin: 0 0 0.5rem; }

.obs-card__weather {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
}

/* Tables (plants, water) -------------------------------------------------- */

.plants-table,
.water-table {
  width: 100%;
  margin-top: 0.5rem;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--rule);
}

.plants-table th,
.plants-table td,
.water-table th,
.water-table td {
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  font-size: 0.92rem;
}

.plants-table th,
.water-table th {
  background: #f1ebdf;
  font-weight: 600;
}

.plants-table .num,
.water-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Water form -------------------------------------------------------------- */

.water-form {
  display: grid;
  gap: 0.75rem;
  margin: 0.5rem 0 1.5rem;
  max-width: 32rem;
}

.water-form__field {
  display: grid;
  gap: 0.25rem;
  font-size: 0.9rem;
}

/* Offline fallback page --------------------------------------------------- */

.offline-shell {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--ink);
}

.offline-panel {
  max-width: 28rem;
  padding: 2rem;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  text-align: center;
}
