/* Mobile-first styles: designed for phones, and they stretch nicely on computers. */
:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #646b73;
  --line: #dedbd2;
  --brand: #2f6b3f;
  --brand-dark: #24532f;
  --warn-bg: #fff4d6;
  --warn: #8a5a00;
  --bad-bg: #fde7e7;
  --bad: #a32020;
  --good-bg: #e3f3e6;
  --good: #1e6b31;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}
main { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.6rem; margin: 0.4em 0; }
h2 { font-size: 1.2rem; margin: 1.6em 0 0.5em; }
a { color: var(--brand); }

/* Top bar */
.top { background: var(--brand); color: #fff; padding: 10px 16px; }
.top a, .top .linklike { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 1.15rem; display: inline-block; padding: 4px 0; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; }
.top nav a, .top nav .linklike { padding: 6px 0; font-size: 0.95rem; }

/* Buttons: big enough to tap with a thumb */
button, .button {
  display: inline-block;
  font: inherit;
  padding: 10px 16px;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}
button:hover, .button:hover { background: var(--brand-dark); }
.big { width: 100%; font-weight: 600; }
.secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.secondary:hover { background: var(--good-bg); }
.danger { background: #fff; color: var(--bad); border: 1px solid var(--bad); margin-top: 8px; }
.danger:hover { background: var(--bad-bg); }
.linklike { background: none; border: 0; padding: 0; min-height: 0; color: var(--brand); text-decoration: underline; }
.linklike:hover { background: none; }
.danger-text { color: var(--bad); }
form.inline { display: inline; }

/* Forms */
input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
label { display: block; font-weight: 600; }
label input, label select, label textarea { margin-top: 4px; font-weight: 400; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: auto; margin: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.filters select { width: auto; flex: 1; min-width: 180px; }

/* Layout pieces */
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.cards { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: inherit;
  text-decoration: none;
}
a.card:hover { border-color: var(--brand); }
.card-overdue { border-left: 5px solid var(--bad); }
.card.inactive { opacity: 0.6; }
.card form.row { margin-bottom: 6px; }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 14px 0;
}
.panel form + form { margin-top: 12px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 12px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.description { white-space: pre-line; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

/* Status labels */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.available { background: var(--good-bg); color: var(--good); }
.badge.out { background: #e6eefb; color: #24497f; }
.badge.overdue, .badge.late { background: var(--bad-bg); color: var(--bad); }
.badge.unavailable { background: #ececec; color: #555; }
.badge.admin { background: var(--warn-bg); color: var(--warn); }

/* Messages */
.flash { background: var(--good-bg); color: var(--good); padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px; }
.flash.error { background: var(--bad-bg); color: var(--bad); }
.flash ul { margin: 6px 0 0; padding-left: 20px; }
.notice { background: var(--warn-bg); color: var(--warn); padding: 12px 14px; border-radius: var(--radius); margin: 12px 0; }
.devbox { border: 2px dashed var(--warn); background: var(--warn-bg); }

/* Contact box: call / text the other person */
.contact { background: var(--bg); border-radius: var(--radius); padding: 10px 12px; margin: 10px 0; }
.contact .buttons { display: flex; gap: 8px; margin-top: 8px; }
.contact .buttons .button { flex: 1; }

/* Photos */
.photo-picker { margin: 0; }
.photo-picker input[type=file] { padding: 8px; background: var(--bg); }
.photo-preview, .tool-photo {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #eee;
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.photo-preview[hidden] { display: none; }
.ai-filled { background: #fffbe8; border-color: #e7c65a; }
.card.with-thumb { display: flex; gap: 12px; align-items: center; }
.card-body { flex: 1; min-width: 0; }
.thumb {
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
}
.thumb-empty { display: flex; align-items: center; justify-content: center; font-size: 1.6rem; opacity: 0.5; }
button:disabled { opacity: 0.6; cursor: wait; }

/* Notifications */
.count {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ffcf4a;
  color: #3a2a00;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}
.card.unread { border-left: 5px solid var(--brand); background: #f3faf4; }

/* History */
.history { list-style: none; padding: 0; margin: 0; }
.history li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 8px; }
.note { margin-top: 6px; padding: 6px 10px; background: var(--warn-bg); border-radius: 6px; font-size: 0.92rem; }
.code-big { font: 700 2rem/1.2 ui-monospace, Consolas, monospace; letter-spacing: 0.08em; margin: 8px 0; }
