@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --cream: #f4f2ea;
  --paper: #fbfaf6;
  --dark: #29312d;
  --darker: #202823;
  --ink: #263029;
  --line: #dde2d6;
  --muted: #5f6b63;
  --olive: #64755c;
  --sage: #a7b99a;
  --sage-soft: #c9d5bf;
  --orange: #e3592a;
  --orange-deep: #c94a1f;
  --on-dark: #e9ede5;
  --on-dark-muted: #b9c4b5;
  --danger: #b3261e;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.45 "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--dark); color: var(--on-dark);
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
}
.brand { color: var(--on-dark); text-decoration: none; font-weight: 800; font-size: 22px; letter-spacing: -0.035em; }
.brand span { color: var(--orange); }
.brand small { font-weight: 500; font-size: 14px; letter-spacing: 0; color: var(--on-dark-muted); margin-left: 4px; }
.who { font-size: 13px; color: var(--on-dark-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50%; }

main { max-width: 720px; margin: 0 auto; padding: 16px 16px 96px; }

h1 { font-size: 24px; letter-spacing: -0.025em; margin: 4px 0 4px; line-height: 1.2; }
h2 { font-size: 17px; margin: 24px 0 8px; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.search {
  flex: 1; min-width: 0;
  font: inherit; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
}
.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.tab {
  font: inherit; font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); white-space: nowrap; cursor: pointer;
}
.tab[aria-pressed="true"] { background: var(--dark); border-color: var(--dark); color: var(--on-dark); }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.card {
  display: block; text-decoration: none; color: inherit;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
a.card:active { background: #f0efe6; }
.card .row1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card .name { font-weight: 700; }
.card .meta { font-size: 14px; color: var(--muted); }

.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--sage-soft); color: var(--dark); white-space: nowrap; }
.pill.warn { background: #f6d9cd; color: var(--orange-deep); }
.pill.off { background: var(--line); color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; padding: 12px 18px; min-height: 48px; border-radius: var(--radius);
  border: 1px solid var(--dark); background: var(--paper); color: var(--dark); text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff8f3; }
.btn.primary:active { background: var(--orange-deep); }
.btn.dark { background: var(--dark); color: var(--on-dark); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.actions { display: grid; gap: 8px; margin: 16px 0; }
.actions.two { grid-template-columns: 1fr 1fr; }

.fab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 4;
  box-shadow: 0 6px 18px rgba(32, 40, 35, .25);
}

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
dl.facts dt { color: var(--muted); font-size: 14px; }
dl.facts dd { margin: 0; }

.contact { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.contact:first-child { border-top: 0; padding-top: 0; }
.contact:last-child { padding-bottom: 0; }
.contact a { color: var(--olive); }

form .field { display: grid; gap: 4px; margin-bottom: 12px; }
label { font-weight: 600; font-size: 14px; }
input[type=text], input[type=tel], input[type=email], select, textarea {
  font: inherit; width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, .search:focus { outline: 2px solid var(--sage); outline-offset: 1px; border-color: var(--olive); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.contact-edit { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: var(--paper); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--orange); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: var(--danger); text-decoration: underline; cursor: pointer; }

.photo-preview { width: 100%; border-radius: var(--radius); display: block; background: var(--line); }
.recipient { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.recipient:first-child { border-top: 0; }
.recipient input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--orange); flex: none; }

.status-line { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.status-line:first-child { border-top: 0; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }

.empty { text-align: center; padding: 32px 12px; color: var(--muted); }
.back { display: inline-block; margin-bottom: 8px; color: var(--olive); font-weight: 600; text-decoration: none; }
.error { color: var(--danger); font-weight: 600; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 10;
  max-width: 560px; margin: 0 auto; background: var(--darker); color: var(--on-dark);
  padding: 12px 16px; border-radius: var(--radius); box-shadow: 0 6px 18px rgba(0,0,0,.25);
}

@media (min-width: 560px) {
  .actions.row { grid-auto-flow: column; justify-content: start; }
}
