/* FreshCare register — Urban Valley
   Palette: warm paper background, pine green for "pass/done", rust for "due/fail/attention",
   mushroom-tan accent. Display face for headings, mono for data + the stamp badges. */

:root {
  --bg: #f2efe9;
  --surface: #ffffff;
  --surface-2: #fbf9f5;
  --ink: #232220;
  --muted: #7d7868;
  --line: #ddd7c9;

  --green: #2f5c46;
  --green-soft: #e2ebe5;
  --rust: #a4431f;
  --rust-soft: #f5e3da;
  --tan: #c9a876;
  --tan-soft: #f1e8d8;

  --radius: 10px;
  --radius-sm: 6px;

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", monospace;

  --max-width: 640px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: 48px;
}

a { color: var(--green); text-decoration: none; }

button, input, select, textarea {
  font-family: inherit;
  font-size: 16px;
}

/* ---------- layout shell ---------- */

.shell {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.app-header .bar {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 12px;
}

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand .name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.01em;
}

.brand .sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.menu-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}

.menu-btn svg { width: 18px; height: 18px; stroke: var(--ink); }

/* drawer */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(35, 34, 32, 0.35);
  z-index: 30;
  display: none;
}

.drawer-backdrop.open { display: block; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(280px, 80vw);
  background: var(--surface);
  z-index: 31;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  padding: 18px;
  box-shadow: -4px 0 24px rgba(0,0,0,0.08);
}

.drawer.open { transform: translateX(0); }

.drawer h2 {
  font-family: var(--font-display);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 4px 0 14px;
}

.drawer nav a {
  display: block;
  padding: 11px 8px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 500;
  font-size: 15px;
}

.drawer nav a:hover, .drawer nav a.active {
  background: var(--green-soft);
  color: var(--green);
}

/* ---------- main content ---------- */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 16px 40px;
}

h1.page-title {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 4px 0 4px;
}

.page-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.card h3 {
  font-family: var(--font-display);
  font-size: 15px;
  margin: 0 0 10px;
}

/* ---------- stamps (signature status badges) ---------- */

.stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 2px solid currentColor;
  border-radius: 6px;
  padding: 4px 10px;
  transform: rotate(-2deg);
  white-space: nowrap;
}

.stamp.pass, .stamp.done, .stamp.logged { color: var(--green); }
.stamp.fail, .stamp.due, .stamp.overdue, .stamp.attention { color: var(--rust); }
.stamp.pending, .stamp.open { color: var(--tan); border-color: var(--tan); }

/* ---------- home: status grid ---------- */

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.status-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 88px;
}

.status-card .status-label {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}

.status-card .status-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.stamp-pair {
  display: flex;
  gap: 6px;
}

.stamp-pair .stamp { flex: 1; }

.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 0 8px;
}

.section-label:first-child { margin-top: 0; }

/* nav tiles */

.tile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-weight: 500;
  color: var(--ink);
}

.tile .arrow { color: var(--muted); font-family: var(--font-mono); }

/* ---------- forms ---------- */

.field {
  margin-bottom: 14px;
}

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

.field .hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="month"],
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
}

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

input:focus, select:focus, textarea:focus, button:focus, a:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

.toggle-row {
  display: flex;
  gap: 8px;
}

.toggle-btn {
  flex: 1;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  font-weight: 500;
  text-align: center;
}

.toggle-btn.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.toggle-btn.active.warn {
  border-color: var(--rust);
  background: var(--rust-soft);
  color: var(--rust);
}

button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

button.btn:active { opacity: 0.85; }

button.btn.secondary {
  background: var(--surface);
  color: var(--green);
  border: 1px solid var(--green);
}

button.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

button.btn.small {
  width: auto;
  padding: 8px 12px;
  font-size: 13px;
}

/* ---------- history / records lists ---------- */

.hist-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.hist-row:first-of-type { border-top: none; }

.hist-main { flex: 1; min-width: 0; }

.hist-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.hist-title { font-weight: 500; font-size: 14px; margin-top: 2px; }

.hist-notes {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

/* ---------- records filters ---------- */

.filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filter-row select, .filter-row input { flex: 1; min-width: 110px; }

/* ---------- action list ---------- */

.action-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.action-row:first-of-type { border-top: none; }

.action-check {
  flex: none;
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  border-radius: 5px;
  margin-top: 1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  background: var(--surface);
}

.action-check.checked { border-color: var(--green); background: var(--green-soft); }

.action-body { flex: 1; }

.action-desc { font-weight: 500; font-size: 14px; }
.action-desc.done { text-decoration: line-through; color: var(--muted); }

.action-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- misc ---------- */

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 24px 0;
}

.loading { text-align: center; color: var(--muted); padding: 40px 0; font-size: 13px; }

.error-box {
  background: var(--rust-soft);
  color: var(--rust);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  z-index: 40;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.toast.show { opacity: 1; }

@media (max-width: 380px) {
  .status-grid { grid-template-columns: 1fr; }
}
