/* gift-draft -- plain, familiar, and readable on a phone next to a Zoom call.
   Deliberately unfashionable: white cards on grey, blue links, system fonts.
   Seven people who mostly use Facebook should not have to learn a new visual
   language to take part in this. Mobile-first -- base rules target a narrow
   screen and widen from there. */

:root {
  --ink: #1c1e21;
  --ink-soft: #65676b;
  --ink-faint: #8a8d91;
  --paper: #f0f2f5;
  --card: #ffffff;
  --line: #dadde1;
  --accent: #1565d8;
  --accent-dark: #0f56bd;
  --accent-soft: #e7f3ff;
  --good: #1e7e34;
  --warn: #b26a00;
  --bad: #d93025;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .08);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e4e6eb;
    --ink-soft: #b0b3b8;
    --ink-faint: #8a8d91;
    --paper: #18191a;
    --card: #242526;
    --line: #3e4042;
    --accent: #4599ff;
    --accent-dark: #5aa5ff;
    --accent-soft: #263951;
    --good: #45bd62;
    --warn: #f0a03c;
    --bad: #ff7b72;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 {
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 .5rem;
  letter-spacing: -.01em;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; margin-top: 1.75rem; }

a { color: var(--accent); }
p { margin: 0 0 1rem; }

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
}

/* ---- header ---- */

header.site {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
header.site .bar {
  max-width: 46rem;
  margin: 0 auto;
  padding: .7rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
header.site .brand {
  font-family: var(--sans);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
header.site nav { display: flex; gap: .9rem; align-items: center; }
header.site nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .92rem;
}
header.site nav a:hover, header.site nav a.on { color: var(--accent); }

/* ---- banners ---- */

.banner {
  padding: .55rem 1rem;
  font-size: .88rem;
  text-align: center;
  background: var(--accent-soft);
  color: var(--warn);
  border-bottom: 1px solid var(--line);
}

/* ---- cards ---- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); font-size: .85rem; }
.center { text-align: center; }

/* ---- points ---- */

.points {
  font-family: var(--sans);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.points-label {
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

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

label { display: block; font-size: .9rem; color: var(--ink-soft); margin-bottom: .3rem; }

input[type=text], input[type=password], input[type=email],
input[type=number], textarea, select {
  width: 100%;
  padding: .7rem .75rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.field { margin-bottom: 1rem; }

button, .btn {
  font: inherit;
  font-weight: 500;
  padding: .7rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  /* Comfortable for a thumb; most of this runs on phones. */
  min-height: 44px;
}
button:hover, .btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button.ghost:hover, .btn.ghost:hover { background: var(--accent-soft); }
button.ghost, .btn.ghost {
  background: transparent;
  color: var(--accent);
}
button.full { width: 100%; }

.error {
  background: #fde8e6;
  border: 1px solid #f5c6c2;
  color: var(--bad);
  padding: .7rem .85rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .92rem;
}
@media (prefers-color-scheme: dark) {
  .error { background: #3b2321; border-color: #5c3330; }
}

/* ---- ledger ---- */

.entries { list-style: none; margin: 0; padding: 0; }
.entries li {
  padding: .7rem 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: .75rem;
  align-items: baseline;
  flex-wrap: wrap;
}
.entries li:last-child { border-bottom: 0; }
.entries .what { flex: 1 1 16rem; }
.entries .stamp {
  font-size: .82rem;
  color: var(--ink-faint);
  white-space: nowrap;
}
.entries li.redacted { opacity: .55; }
.entries li.redacted .what { text-decoration: line-through; }

.tag {
  display: inline-block;
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .12rem .4rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--warn);
}

footer.site {
  text-align: center;
  color: var(--ink-faint);
  font-size: .82rem;
  padding: 2rem 1rem;
}

/* ---- item grid ---------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .9rem;
}
@media (min-width: 34rem) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.tile:hover { border-color: var(--accent); }
.tile .shot {
  aspect-ratio: 4 / 3;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.tile .shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .shot .nophoto { color: var(--ink-faint); font-size: .8rem; }
.tile .meta { padding: .6rem .7rem .7rem; display: flex; flex-direction: column; gap: .2rem; }
.tile .name { font-weight: 600; line-height: 1.3; }
.tile .cost { color: var(--accent); font-weight: 600; font-size: .95rem; }
.tile.gone { opacity: .62; }
.tile.gone .shot img { filter: grayscale(.75); }
.tile .taken { font-size: .8rem; color: var(--ink-soft); }

/* ---- toolbar ------------------------------------------------------------ */

.toolbar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}
.toolbar input[type=text] { flex: 1 1 10rem; min-width: 0; }
.toolbar select { flex: 0 0 auto; width: auto; }

.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip {
  font-size: .85rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  text-decoration: none;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.stats { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.stats div { display: flex; flex-direction: column; }
.stats .n { font-family: var(--sans); font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.stats .l { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); }

/* ---- capture form ------------------------------------------------------- */

.capture-drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1rem;
  text-align: center;
  background: var(--paper);
}
.capture-drop label.btn { margin-bottom: .4rem; }
.capture-drop input[type=file] {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; overflow: hidden;
}
.capture-status { font-size: .88rem; color: var(--ink-soft); margin-top: .6rem; min-height: 1.2em; }
.capture-status.bad { color: var(--bad); }
.capture-preview { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .7rem; }
.capture-preview img {
  width: 70px; height: 70px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--line);
}

.shots { display: flex; gap: .6rem; flex-wrap: wrap; }
.shots figure { margin: 0; width: 110px; }
.shots img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.shots figcaption { display: flex; gap: .3rem; margin-top: .25rem; }
.shots figcaption button {
  font-size: .72rem; padding: .2rem .4rem; min-height: auto;
  background: transparent; color: var(--ink-soft); border: 1px solid var(--line);
}
.shots figcaption button:hover { color: var(--accent); border-color: var(--accent); }

/* ---- tables ------------------------------------------------------------- */

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); font-weight: 600; }
td.num, th.num { text-align: right; }
tr.locked td { background: var(--accent-soft); }
td input[type=number] { width: 6rem; padding: .4rem .5rem; }
.rowerr { color: var(--bad); font-size: .82rem; }

.inline { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.inline button { padding: .4rem .7rem; min-height: 38px; font-size: .88rem; }

.invite-box {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .8rem;
  margin-bottom: 1rem;
  word-break: break-all;
  font-size: .85rem;
}
