/* Campus Market, the only stylesheet.
   Nobody styles their own page. If you need something new, add a class here. */

:root {
  --accent: #0A66E8;
  --accent-soft: rgba(10, 102, 232, 0.09);
  --perf: rgba(0, 0, 0, 0.16);   /* the tear line on a ticket */
  --bg: #F4F4F6;
  --card: #FFFFFF;
  --ink: #0B0B0F;
  --ink-2: #1F1F24;
  --muted: #5E5E66;
  --faint: #9A9AA2;
  --fill: #E6E6EA;
  --fill-2: #EFEFF2;
  --line: rgba(0, 0, 0, 0.07);
  --bad: #B3271B;
  --hair: rgba(0, 0, 0, 0.05);
  --tint: rgba(0, 0, 0, 0.05);

  --app: 430px;
  --top: max(env(safe-area-inset-top), 20px);
  --foot: max(env(safe-area-inset-bottom), 14px);
  --tabbar: calc(60px + max(env(safe-area-inset-bottom), 14px));

  --r-card: 16px;
  --r-tile: 12px;
  --r-sheet: 22px;
  --r-btn: 14px;
}

* { box-sizing: border-box; }

/* A class that sets display beats the browser's own rule for the hidden
   attribute, so say it once here and nothing we hide can come back. */
[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

a { text-decoration: none; color: inherit; }
button { font: inherit; }
img { display: block; max-width: 100%; }

.sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; white-space: nowrap; clip-path: inset(50%);
}

/* ------------------------------------------------------------- the frame */

.app {
  width: 100%;
  max-width: var(--app);
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
}

.app--tabs { padding-bottom: calc(var(--tabbar) + 8px); }

.screen {
  padding: var(--top) 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --------------------------------------------------------------- the head */

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.head h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.8px;
  line-height: 1.1;
}

.head-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.avatar {
  width: 44px; height: 44px; flex: none;
  border-radius: 999px;
  background: var(--fill);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: var(--muted);
}

.avatar--lg { width: 60px; height: 60px; font-size: 21px; }
.avatar--md { width: 44px; height: 44px; font-size: 15px; }
.avatar--sm { width: 34px; height: 34px; font-size: 13px; }
.avatar--xl { width: 96px; height: 96px; font-size: 32px; }

.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.plus {
  width: 44px; height: 44px; flex: none;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  color: var(--accent);
}

.plus:active { background: #F2F2F5; }

/* ------------------------------------------------------------- the search */

.search {
  display: flex; align-items: center; gap: 8px;
  height: 44px; flex: none;
  padding: 0 12px;
  border-radius: var(--r-tile);
  background: var(--tint);
  position: relative;
}

.search svg { flex: none; color: var(--muted); }

.search input {
  flex: 1; min-width: 0;
  border: none; background: transparent;
  font: inherit; font-size: 15px; color: var(--ink);
  outline: none;
}

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

.list { display: flex; flex-direction: column; gap: 10px; }

.card {
  display: flex; gap: 12px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--r-card);
  color: inherit;
}

.card:active { background: #FAFAFC; }

.thumb {
  width: 76px; height: 76px; flex: none;
  border-radius: var(--r-tile);
  background: var(--fill);
  display: flex; align-items: center; justify-content: center;
  color: var(--faint);
  overflow: hidden;
}

.thumb img { width: 100%; height: 100%; object-fit: cover; }

.tile {
  width: 68px; height: 68px; flex: none;
  border-radius: var(--r-tile);
  background: var(--fill-2);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px;
}

.tile .cap {
  font-size: 10px; font-weight: 600; letter-spacing: 0.6px; color: var(--muted);
}

.tile .big { font-size: 21px; font-weight: 700; line-height: 1; }

.card-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
}

.card-top { display: flex; align-items: baseline; gap: 8px; }

.card-title {
  flex: 1; min-width: 0;
  font-size: 15px; font-weight: 600; line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-price { flex: none; font-size: 15px; font-weight: 700; }

.card-info { font-size: 13px; color: var(--muted); }

.card-owner { font-size: 12px; color: var(--muted); }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------- the rows */

.rows {
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--r-card);
  overflow: hidden;
}

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  color: inherit;
}

.row:active { background: #FAFAFC; }

.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.row-top { display: flex; align-items: baseline; gap: 8px; }

.row-name {
  flex: 1; min-width: 0;
  font-size: 15px; font-weight: 600;
}

.row-time { flex: none; font-size: 12px; color: var(--muted); }

.row-sub { font-size: 12px; font-weight: 600; color: var(--muted); }

.row-last { font-size: 13px; color: var(--muted); }

.row-meta { font-size: 12px; color: var(--muted); }

.divider { height: 1px; background: var(--line); margin-left: 70px; }
.divider--tight { margin-left: 64px; }

.dot {
  width: 9px; height: 9px; flex: none;
  border-radius: 999px; background: var(--accent);
}

.mini {
  width: 38px; height: 38px; flex: none;
  border-radius: 10px;
  background: var(--fill-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  overflow: hidden;
}

.mini img { width: 100%; height: 100%; object-fit: cover; }

/* -------------------------------------------------------------- the badge */

.badge {
  flex: none;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 11px; font-weight: 700;
}

.badge--off { background: var(--fill); color: var(--muted); }

.pill {
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--tint);
  font-size: 12px; font-weight: 600;
}

.verified {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--accent);
}

/* ------------------------------------------------------------ the tab bar */

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--app);
  height: var(--tabbar);
  padding: 8px 4px var(--foot);
  display: flex;
  background: rgba(246, 246, 248, 0.72);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border-top: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  z-index: 20;
}

.tab {
  flex: 1;
  min-height: 48px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  font-size: 10px; font-weight: 600;
  color: var(--muted);
  position: relative;
}

.tab[aria-current="page"] { color: var(--accent); }

.tab .pip {
  position: absolute;
  top: 4px;
  margin-left: 18px;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: #E8462F;
  border: 1.5px solid rgba(246, 246, 248, 0.95);
}

/* -------------------------------------------------------------- the sheet */

.sheet-head {
  display: flex; align-items: center; gap: 8px;
  padding-top: var(--top);
}

.sheet-head .side { width: 76px; min-height: 44px; display: flex; align-items: center; }
.sheet-head .side--right { justify-content: flex-end; }
.sheet-head .mid { flex: 1; text-align: center; font-size: 17px; font-weight: 600; }

.link {
  min-height: 44px; padding: 0 2px;
  border: none; background: transparent;
  font: inherit; font-size: 15px; font-weight: 600; color: var(--accent);
  display: inline-flex; align-items: center;
  cursor: pointer;
}

.link--plain { font-weight: 400; }
.link--quiet { color: var(--muted); font-weight: 400; }
.link--danger { color: #C0392B; }

/* A link inside a line of small print. The ordinary one is 15px and 44px
   tall so a thumb can hit it, which is right on its own line and far too
   loud in the middle of a sentence. */
.link--tiny {
  min-height: 0;
  font-size: inherit; font-weight: 600;
  text-decoration: underline;
}

@media (prefers-color-scheme: dark) {
  .link--danger { color: #FF6B5A; }
}

.grab {
  width: 36px; height: 5px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  margin: 10px auto 6px;
}

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

.form { display: flex; flex-direction: column; padding: 0 16px; }

.label {
  margin: 18px 0 6px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}

.label:first-of-type { margin-top: 20px; }

.input, .textarea {
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
  background: var(--card);
  font: inherit; font-size: 15px; color: var(--ink);
  outline: none;
  width: 100%;
}

.input:focus, .textarea:focus { border-color: var(--accent); }

/* A field the browser has decided against, which it only does once you
   have been in it or have tried to send the form. The ring is there
   because a one pixel border on a white card is easy to miss on the one
   occasion it matters, the moment the page refuses to go. The textarea is
   in here too, which it was not, so an empty description said nothing. */
.input:user-invalid, .textarea:user-invalid, .input--bad {
  border-color: var(--bad);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 16%, transparent);
}

.input:user-invalid:focus, .textarea:user-invalid:focus, .input--bad:focus {
  border-color: var(--bad);
}

/* The line under the password that says what is still missing. */
.rules {
  margin: 8px 2px 0;
  font-size: 12px; line-height: 1.55;
  color: var(--muted);
}

.rules--bad { color: var(--bad); font-weight: 600; }

.note--big { font-size: 13px; }

.textarea {
  height: 92px;
  padding: 12px 14px;
  line-height: 1.45;
  resize: none;
}

.prefixed {
  display: flex; align-items: center;
  height: 48px; padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
  background: var(--card);
}

.prefixed:focus-within { border-color: var(--accent); }

/* A money box with nothing to put in it. Greyed rather than hidden, so
   the row keeps its shape and you can see what is not being asked. */
.prefixed--off {
  background: var(--fill-2);
  border-color: transparent;
}

.prefixed--off span,
.prefixed--off input { color: var(--faint); }
.prefixed--off input { cursor: not-allowed; }
.prefixed--off input::placeholder { color: var(--faint); }


.prefixed span { font-size: 15px; color: var(--muted); margin-right: 6px; }

.prefixed input {
  flex: 1; min-width: 0;
  border: none; background: transparent;
  font: inherit; font-size: 15px; color: var(--ink);
  outline: none;
}

.pair { display: flex; gap: 10px; }
.pair > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pair .label { margin-top: 14px; }

.btn {
  height: 52px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: var(--r-btn);
  background: var(--accent);
  color: #FFFFFF;
  font-size: 17px; font-weight: 600;
  width: 100%;
  cursor: pointer;
}

.btn:active { filter: brightness(0.94); }

.btn--quiet {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn--danger { background: var(--card); color: #C0392B; border: 1px solid var(--line); }

.note {
  margin: 12px 0 0;
  font-size: 12px; line-height: 1.55; color: var(--muted);
  text-align: center;
}

/* The same box as .error, for something that went right. */
.said {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: var(--r-tile);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px; font-weight: 600;
}

.error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: var(--r-tile);
  background: rgba(224, 62, 45, 0.08);
  color: #B3271B;
  font-size: 13px; font-weight: 600;
}

/* ------------------------------------------------------------ the picture */

.photo-pick {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin-top: 18px;
}

.photo-slot { cursor: pointer; display: block; position: relative; }

.photo-slot .avatar { border: 1px solid var(--line); }

.photo-pick .link { cursor: pointer; }

/* --------------------------------------------------------------- the pics */

.pics { display: flex; gap: 8px; flex-wrap: wrap; }

.pic-add {
  width: 88px; height: 88px;
  border: 1.5px dashed rgba(0, 0, 0, 0.18);
  border-radius: var(--r-tile);
  background: transparent;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  cursor: pointer;
}

.pic {
  width: 88px; height: 88px;
  border-radius: var(--r-tile);
  background: var(--fill);
  display: flex; align-items: center; justify-content: center;
  color: var(--faint);
  overflow: hidden;
}

.pic img { width: 100%; height: 100%; object-fit: cover; }

/* ------------------------------------------------------------- the verify */

.gate {
  min-height: 100dvh;
  padding: calc(var(--top) + 56px) 32px calc(var(--foot) + 24px);
  display: flex; flex-direction: column;
}

.mark {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #FFFFFF;
}

.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.brand span {
  font-size: 13px; font-weight: 600; letter-spacing: 0.4px; color: var(--muted);
}

.gate h1 {
  margin: 40px 0 0;
  font-size: 28px; font-weight: 700; letter-spacing: -0.6px; line-height: 1.15;
}

.gate p.lead {
  margin: 10px 0 0;
  font-size: 15px; line-height: 1.5; color: var(--muted);
}

.gate p.lead strong { color: var(--ink); font-weight: 600; }

.gate .cap {
  margin: 32px 0 10px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}

.code { display: flex; gap: 8px; }

.code input {
  width: 100%; max-width: 47px; height: 58px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--r-tile);
  background: var(--card);
  font: inherit; font-size: 22px; font-weight: 600; text-align: center;
  color: var(--ink);
  outline: none;
}

.code input:focus { border: 2px solid var(--accent); }

.again { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.again span { font-size: 13px; color: var(--muted); }
.again button { font-size: 13px; }

/* The air between a gate's content and its buttons. It is flex: 1 so it
   eats whatever room is left on a short page, and min-height so that on a
   long one it still keeps the buttons off the last field instead of
   collapsing to nothing. */
.grow { flex: 1; min-height: 24px; }

/* ------------------------------------------------------------- the detail */

.detail {
  background: var(--card);
  padding-bottom: calc(96px + var(--foot));
}

.hero {
  position: relative;
  height: 310px;
  background: var(--fill);
  display: flex; align-items: center; justify-content: center;
  color: var(--faint);
  overflow: hidden;
}

.hero img { width: 100%; height: 100%; object-fit: cover; }

.back {
  position: absolute; left: 16px; top: var(--top);
  width: 44px; height: 44px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  color: var(--ink);
  z-index: 5;
}

.count {
  position: absolute; right: 16px; bottom: 32px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  color: #FFFFFF;
  font-size: 12px; font-weight: 600;
  z-index: 5;
}

/* A ticket has no photo, so the top of the page is a coloured block with a
   paper stub on it. The bite marks and the dotted line are what make the eye
   read it as a ticket. */
.ticket-head {
  background: var(--accent);
  padding: var(--top) 16px 46px;
}

.ticket-back {
  width: 44px; height: 44px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  color: #0B0B0F;
}

/* STUB_SPLIT is where the perforation sits. The two notches are centred on
   the same number, so the line and the bite marks always line up. */
.stub {
  --split: 96px;
  --split-right: 46px;
  position: relative;
  display: flex;
  margin-top: 22px;
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
}

.stub-day {
  width: var(--split); flex: none;
  padding: 16px 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-right: 2px dashed var(--perf);
  color: var(--ink);
}

.stub-day span {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px; letter-spacing: 2px;
  color: var(--muted);
}

.stub-day b {
  font-size: 42px; font-weight: 700; line-height: 1.1; letter-spacing: -1.2px;
}

.notch {
  position: absolute;
  left: calc(var(--split) - 9px);
  width: 18px; height: 18px;
  border-radius: 999px;
  background: var(--accent);
}

.notch--top { top: -9px; }
.notch--bottom { bottom: -9px; }
.notch--right { left: auto; right: calc(var(--split-right) - 9px); }

.stub-no {
  width: var(--split-right); flex: none;
  border-left: 2px dashed var(--perf);
  display: flex; align-items: center; justify-content: center;
}

.stub-no span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px; letter-spacing: 2px;
  color: var(--muted);
}

.stub-main {
  flex: 1; min-width: 0;
  padding: 15px 16px;
  display: flex; flex-direction: column; gap: 12px;
  color: var(--ink);
}

.stub-fields { display: flex; gap: 22px; }

/* Small printed label, value underneath. The same way a real ticket sets
   out what it is for. */
.field { min-width: 0; display: flex; flex-direction: column; gap: 1px; }

.field span {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10px; letter-spacing: 1.4px;
  color: var(--faint);
}

.field b { font-size: 26px; font-weight: 700; letter-spacing: -0.6px; line-height: 1.15; }

.field--wide b {
  font-size: 17px; letter-spacing: -0.2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.pill--on { background: var(--accent-soft); color: var(--accent); }

.detail-body {
  position: relative;
  margin-top: -20px;
  padding: 22px 16px 24px;
  background: var(--card);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
}

.detail-body h1 {
  margin: 0;
  font-size: 22px; font-weight: 700; letter-spacing: -0.4px; line-height: 1.25;
}

.detail-body .sub { margin: 6px 0 0; font-size: 15px; color: var(--muted); }

/* The price of a thing for sale, which is what the eye goes to first and
   the one place the number appears. */
.detail-body .sub--price {
  margin-top: 8px;
  font-size: 24px; font-weight: 700; letter-spacing: -0.5px;
  color: var(--ink);
}

.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

.text { margin: 16px 0 0; font-size: 15px; line-height: 1.55; color: var(--ink-2); }

.rule { height: 1px; background: var(--line); margin: 20px 0; }

/* The address, handed over to whatever map the phone already has. */
.where {
  display: flex; align-items: center; gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  color: inherit;
}

.where:active { background: #FAFAFC; }

.where-pin { flex: none; color: var(--accent); display: flex; }

.where-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.where-text b { font-size: 15px; font-weight: 600; }
.where-text span { font-size: 13px; color: var(--muted); }

.where-go { flex: none; font-size: 13px; font-weight: 600; color: var(--accent); }

.owner { display: flex; align-items: center; gap: 12px; }

/* The picture and the name are one target, because they are one thing to
   press and the gap between them should not be a hole you can miss. */
.owner-who {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 12px;
  color: inherit;
}

.owner-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.owner-name { font-size: 15px; font-weight: 600; }
.owner-course { font-size: 13px; color: var(--muted); }

.posted { margin: 14px 0 0; font-size: 12px; color: var(--muted); }

.actionbar {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: 0;
  width: 100%; max-width: var(--app);
  padding: 12px 16px calc(var(--foot) + 14px);
  display: flex; align-items: center; gap: 14px;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border-top: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  z-index: 20;
}

.actionbar form { flex: 1; display: flex; }

/* The owner has two things to do with an entry, and the bar is a row, so
   without this the second button lands beside the first instead of under it. */
.actionbar-stack {
  flex: 1;
  display: flex; flex-direction: column; gap: 10px;
}

.actionbar-stack form { flex: none; }

/* --------------------------------------------------------------- the chat */

.chat-page { background: var(--bg); }

.chat-head {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  top: 0;
  width: 100%; max-width: var(--app);
  padding: var(--top) 10px 8px;
  display: flex; align-items: center; gap: 6px;
  background: rgba(246, 246, 248, 0.74);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border-bottom: 1px solid var(--line);
  z-index: 20;
}

.chat-head .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head .who b { font-size: 15px; font-weight: 600; }
.chat-head .who span { font-size: 12px; color: var(--muted); }

.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  border: none; background: transparent; cursor: pointer;
}

.thread {
  padding: calc(var(--top) + 60px) 16px calc(var(--foot) + 78px);
  display: flex; flex-direction: column; gap: 8px;
  min-height: 100dvh;
}

.day { align-self: center; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px; line-height: 1.4;
  overflow-wrap: anywhere;
}

.bubble--me { align-self: flex-end; background: var(--accent); color: #FFFFFF; }

.bubble--them {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--hair);
}

.stamp { align-self: flex-end; font-size: 11px; color: var(--muted); margin-top: 2px; }

.composer {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: 0;
  width: 100%; max-width: var(--app);
  padding: 10px 12px calc(var(--foot) + 14px);
  display: flex; align-items: center; gap: 8px;
  background: rgba(246, 246, 248, 0.74);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border-top: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  z-index: 20;
}

.composer input {
  flex: 1; min-width: 0;
  height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: var(--card);
  font: inherit; font-size: 15px; color: var(--ink);
  outline: none;
}

.send {
  width: 44px; height: 44px; flex: none;
  border: none; border-radius: 999px;
  background: var(--accent); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* ------------------------------------------------------------ the profile */

.panel {
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: 18px;
}

.panel-top { display: flex; align-items: center; gap: 14px; }

.panel-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.panel-id b { font-size: 18px; font-weight: 700; letter-spacing: -0.2px; }
.panel-id .course { font-size: 13px; color: var(--muted); }

.stats {
  display: flex;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--line);
}

.stat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat b { font-size: 17px; font-weight: 700; }
.stat span { font-size: 11px; color: var(--muted); }

.section {
  margin: 22px 0 8px 2px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.7px; color: var(--muted);
}

/* -------------------------------------------------------------- the chips */

/* Every category at once, on a second line where they do not fit on one.
   Scrolling sideways hides half of them behind an edge, and a category you
   cannot see is a category nobody picks. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: none;
  padding-bottom: 2px;
}

.chip {
  flex: none;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--tint);
  font-size: 13px; font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.chip--on { background: var(--accent); color: #FFFFFF; }

/* Six of them have to share one line of a phone, so they are set tighter
   than a pill anywhere else in the app. Below 375 even that is not enough,
   and then the row slides rather than wrapping, because a second line that
   holds one word is the worst of both. */
.chips--fit {
  flex-wrap: nowrap;
  gap: 5px;
  margin: 0 -16px;
  padding: 0 16px 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chips--fit::-webkit-scrollbar { display: none; }
.chips--fit .chip { padding: 7px 8px; }

/* ------------------------------------------------------------- the by day */

.day-block { display: flex; flex-direction: column; }

.day-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  margin: 10px 0 8px;
  padding: 8px 0 8px 2px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  text-transform: none;
  color: var(--ink);
}

.more {
  align-self: flex-start;
  margin: 8px 0 2px 2px;
  min-height: 36px;
  display: inline-flex; align-items: center;
  font-size: 14px; font-weight: 600;
  color: var(--accent);
}

.card-price .from {
  font-size: 11px; font-weight: 600; color: var(--muted);
}

.tile .time {
  font-size: 15px; font-weight: 700; letter-spacing: -0.2px;
}

/* -------------------------------------------------------------- the scope */

.segment {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 10px;
  background: var(--tint);
  flex: none;
}

.segment a {
  flex: 1;
  min-height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--muted);
}

.segment a[aria-current="true"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.course-line {
  font-size: 12px; font-weight: 600; color: var(--accent);
}

/* --------------------------------------------------------------- the chats */

.ch-list { display: flex; flex-direction: column; gap: 10px; }

/* A block is one card. position so the hidden box below stays inside it. */
.ch-block {
  position: relative;
  border-radius: var(--r-card);
  background: var(--card);
  overflow: hidden;
}

/* The head carries no field of colour. The colour sits on the symbol at the
   left and on the counter at the right, where it says something. */
.ch-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
}

.ch-head { cursor: pointer; }

.ch-title {
  flex: 1; min-width: 0;
  font-size: 14px; font-weight: 700; color: var(--ink);
}

.ch-price { flex: none; font-size: 13px; font-weight: 600; color: var(--ink); }

.ch-count {
  flex: none;
  min-width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--k-soft);
  font-size: 11px; font-weight: 600; color: var(--k);
}

.ch-new {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--k, var(--accent));
  color: #FFFFFF;
  font-size: 11px; font-weight: 600;
}

.ch-chev {
  flex: none;
  display: flex;
  color: var(--faint);
  transition: transform 0.18s ease;
}

.ch-block > input:checked ~ .ch-head .ch-chev { transform: rotate(180deg); }

/* Shut until the box is ticked. The server ticks it for a block that should
   greet you open, which is one with something unread or one holding a single
   chat. From then on the box is yours. */
.ch-rows { display: none; }
.ch-block > input:checked ~ .ch-rows { display: block; }

/* The chats step in from the heading, far enough that the indent reads as
   belonging rather than as a rounding error. The line between them starts at
   the same place, so the whole left edge lines up. */
.ch-row {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 10px 26px;
  color: inherit;
}

.ch-row::before {
  content: "";
  position: absolute;
  left: 26px; right: 12px; top: 0;
  height: 1px;
  background: var(--hair);
}

.ch-row:active { background: #FAFAFC; }

/* A chat with nothing to group it with, standing on its own. */
.ch-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-card);
  background: var(--card);
  color: inherit;
}

.ch-card:active { background: #FAFAFC; }

.ch-thumb {
  width: 36px; height: 36px; flex: none;
  border-radius: 10px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}

.ch-thumb svg { width: 100%; height: 100%; }

/* The two kinds whose drawn cover does not survive being this small. */
.ch-thumb--sign { background: var(--k-soft); color: var(--k); }
.ch-thumb--sign svg { width: auto; height: auto; }

/* The picture, with the unread mark sitting on it. On the picture and not
   out at the edge of the row, where it had nothing to belong to. */
.ch-face { position: relative; flex: none; display: flex; }

.ch-face .avatar { width: 36px; height: 36px; font-size: 13px; }

.ch-face--new::after {
  content: "";
  position: absolute;
  top: -2px; right: -2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--card);
}

.ch-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.ch-who { font-size: 14px; font-weight: 600; color: var(--ink); }

.ch-when { flex: none; align-self: flex-start; padding-top: 2px;
           font-size: 11px; color: var(--faint); }

/* The right hand end of a card. The time, and under it the word on an entry
   that has been closed, so you know before you open anything. */
.ch-side {
  flex: none;
  display: flex; flex-direction: column; align-items: flex-end; gap: 5px;
}

.ch-side .ch-when { align-self: auto; }

.note-pill--mini { padding: 3px 9px; font-size: 10px; }

.ch-last { font-size: 12px; color: var(--muted); }

/* The chats a long block keeps behind one line. They are not moved
   anywhere, only hidden where they stand, so opening the line never
   shuffles anybody out of the order of the clock. */
.ch-row--more { display: none; }
.ch-rows > input:checked ~ .ch-row--more { display: flex; }

.ch-more {
  display: block;
  padding: 10px 12px 10px 26px;
  font-size: 13px; font-weight: 600; color: var(--accent);
  cursor: pointer;
}

.ch-more-off { display: none; }
.ch-rows > input:checked ~ .ch-more .ch-more-on { display: none; }
.ch-rows > input:checked ~ .ch-more .ch-more-off { display: inline; }

/* The app saying something rather than one of you, so it sits in the middle
   of the thread and takes neither side's shape. Blue in all four tabs. The
   tab colours say which tab a thing belongs to, and this belongs to none of
   them, it is the app speaking. Blue is what it speaks in. */
.note-pill {
  align-self: center;
  margin: 4px 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px; font-weight: 600;
  text-align: center;
}

/* In the thread the notice is bigger than in the list. There it sits in a
   row of small print, here it is the one thing between two messages. */
.thread .note-pill { padding: 7px 16px; font-size: 13px; }

/* The sign while it is on. A disc rather than a filled square, so a button
   that is doing something looks pressed and not broken. */
.icon-disc {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
}

/* The same sign in a row of small print. The box is only as tall as the
   line, so the button is grown past it to stay easy to hit. */
.row-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  margin: -6px -4px -6px 0;
  padding: 0; border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

/* The same line over an entry of yours that you closed, with the button
   that puts the whole entry away. Outside the fold on purpose, so it does
   not disappear along with the chats under it. */
.ch-closed {
  display: flex; align-items: center; gap: 10px;
  /* Pulled up into the heading's own bottom padding and lined up with the
     title above it, not with the chats below. It belongs to the entry, so
     it starts where the entry's name starts, which is past the picture:
     12 of padding, a 36 picture and the 10 between them. */
  margin-top: -9px;
  padding: 0 12px 9px 58px;
  font-size: 12px;
}

.ch-closed .note-pill { align-self: auto; margin: 0; }

/* Over at the right, so it ends under the count and the arrow instead of
   trailing after the words on the left. */
.ch-closed-do { margin-left: auto; display: flex; }



/* The way into the archive, at the foot of the list and nowhere else. Grey,
   because it is the last thing on the screen and the least urgent. */
.ch-archive {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px;
  padding: 13px 12px;
  border-radius: var(--r-card);
  background: var(--card);
  font-size: 13px; font-weight: 600; color: var(--accent);
}

.ch-archive > svg { flex: none; }
.ch-archive > span:first-of-type { flex: 1; min-width: 0; }
.ch-archive .ch-count { background: var(--accent-soft); color: var(--accent); }
.ch-archive .ch-chev { color: var(--accent); }
.ch-archive:active { background: #FAFAFC; }

/* Pointing the way out of the screen instead of down into a fold. */
.ch-chev--go { transform: rotate(-90deg); }

/* Nothing in the list, so the way in to the archive drops to the foot of
   the screen rather than hanging a few pixels under the empty line. The
   app is the whole height and is positioned, so this lands just over the
   bar whatever the screen is. */
.ch-archive--low {
  position: absolute;
  left: 16px; right: 16px;
  bottom: calc(var(--tabbar) + 16px);
  margin-top: 0;
}

/* The mark on the side of the switch that has something unread. */
.seg-dot {
  display: inline-block;
  width: 6px; height: 6px;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

/* A category pill carries the colour of its tab, so the row of them reads
   as the four tabs and not as four grey buttons. */
.chip--kind { color: var(--k); }
.chip--kind.chip--on { background: var(--k); color: #FFFFFF; }

/* The row of tabs stays one line and slides sideways when it runs out of
   room, instead of wrapping and shoving whatever is under it down the page. */
.chips--one {
  flex-wrap: nowrap;
  margin: 0 -16px;
  padding: 0 16px 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chips--one::-webkit-scrollbar { display: none; }

/* How many chats are behind a bundle pill. */
.chip-count {
  margin-left: 2px;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

/* Something in that bundle is waiting for you. White once the pill is
   filled, because blue on the tab colour would be hard to make out. */
.chip-dot {
  display: inline-block;
  width: 7px; height: 7px;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
}

.chip--on .chip-dot { background: #FFFFFF; }

/* ------------------------------------------------------------- the picking */

.pick {
  position: relative;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.pick.last { border-bottom: none; }

.pick .tick { flex: none; color: var(--fill); }

.pick input:checked ~ .tick { color: var(--accent); }

.pick input:focus-visible ~ .row-body .row-name { text-decoration: underline; }

.count-inline {
  float: right;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  color: var(--accent);
}

.scroller {
  position: relative;
  max-height: 265px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.22) transparent;
  background:
    linear-gradient(var(--card) 40%, rgba(255, 255, 255, 0)) top / 100% 22px no-repeat local,
    linear-gradient(rgba(255, 255, 255, 0), var(--card) 60%) bottom / 100% 22px no-repeat local,
    radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.11), rgba(0, 0, 0, 0)) top / 100% 8px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.11), rgba(0, 0, 0, 0)) bottom / 100% 8px no-repeat scroll;
  background-color: var(--card);
}

/* A bar that is always there. The one the system draws only appears
   while a finger is moving, which is no use to somebody wondering whether
   the list moves at all. */
.scroller::-webkit-scrollbar { width: 10px; }
.scroller::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.26);
  background-clip: content-box;
}
.scroller::-webkit-scrollbar-track { background: transparent; }

.empty-filter {
  margin: 16px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

/* ---------------------------------------------------------------- nothing */

.empty {
  margin-top: 56px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center;
  color: var(--muted);
}

.empty b { font-size: 16px; color: var(--ink); font-weight: 600; }
.empty p { margin: 0; font-size: 14px; line-height: 1.5; max-width: 260px; }

/* ------------------------------------------------------------- dark mode */

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C0C0F;
    --card: #17171B;
    --ink: #F4F4F6;
    --ink-2: #DCDCE2;
    --muted: #96969F;
    --faint: #6A6A73;
    --fill: #26262C;
    --fill-2: #1F1F25;
    --line: rgba(255, 255, 255, 0.09);
    --hair: rgba(255, 255, 255, 0.07);
    --tint: rgba(255, 255, 255, 0.07);
    --accent: #4E97FF;
    --accent-soft: rgba(78, 151, 255, 0.16);
    --perf: rgba(255, 255, 255, 0.22);
  }

  .tabbar, .chat-head, .composer { background: rgba(18, 18, 22, 0.78); box-shadow: none; }
  .actionbar { background: rgba(18, 18, 22, 0.82); box-shadow: none; }
  .back { background: rgba(28, 28, 33, 0.72); color: var(--ink); }
  .grab { background: rgba(255, 255, 255, 0.22); }
  .pic-add { border-color: rgba(255, 255, 255, 0.2); }
  .tab .pip { border-color: rgba(18, 18, 22, 0.95); }
  .card:active, .row:active, .where:active { background: #1D1D22; }
}

/* ============================================================ design layer
   Added on top of everything above, so the original rules stay readable.
   1. Every kind of entry has its own colour. A page takes the colour of its
      tab, so buttons, chips and the + follow it without any extra class.
   2. Entries without a photo get a drawn cover instead of a grey box.
   3. Small moments in the journey: first screen, toasts, empty states. */

:root {
  --c-housing: #12998A;
  --c-ticket:  #E5492F;
  --c-item:    #7A5AF0;
  --c-group:   #C8810E;
}

[data-kind="housing"] { --k: var(--c-housing); }
[data-kind="ticket"]  { --k: var(--c-ticket); }
[data-kind="item"]    { --k: var(--c-item); }
[data-kind="group"]   { --k: var(--c-group); }
[data-kind] { --k-soft: color-mix(in srgb, var(--k) 13%, transparent); }

/* The page takes its tab's colour: every rule above that says var(--accent)
   now follows the tab you are in. */
.app[data-kind] { --accent: var(--k); --accent-soft: var(--k-soft); }

/* ----------------------------------------------------------- the colours */

.tab[data-kind][aria-current="page"] { color: var(--k); }

.tile { background: var(--k-soft, var(--fill-2)); }
.tile .big, .tile .time { color: var(--k, var(--ink)); }
.tile .cap { color: var(--k, var(--muted)); opacity: 0.8; }

/* A ticket in a list looks like the stub it is: a dotted tear line and two
   bites out of the edge. */
.tile--ticket {
  position: relative;
  border-right: 2px dashed color-mix(in srgb, var(--k) 35%, transparent);
  border-radius: var(--r-tile) 6px 6px var(--r-tile);
}
.tile--ticket::before, .tile--ticket::after {
  content: "";
  position: absolute; right: -7px;
  width: 12px; height: 12px;
  border-radius: 999px;
  background: var(--card);
}
.tile--ticket::before { top: -6px; }
.tile--ticket::after { bottom: -6px; }

/* --------------------------------------------------------------- covers */

.cover { display: block; width: 100%; height: 100%; }
.thumb:has(.cover), .hero:has(.cover) { background: none; }

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

.card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.03);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card:active { transform: scale(0.985); }
.btn, .plus, .chip { transition: transform 0.12s ease; }
.btn:active, .plus:active, .chip:active { transform: scale(0.97); }

/* ---------------------------------------------------------- empty states */

.empty > svg:first-child {
  box-sizing: content-box;
  padding: 18px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 6px;
}

/* ------------------------------------------------------------- the toast */

.toast {
  position: fixed;
  left: 50%; top: calc(var(--top) + 8px);
  transform: translate(-50%, 0);
  width: calc(100% - 32px); max-width: calc(var(--app) - 32px);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px; font-weight: 600; line-height: 1.35;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  z-index: 50;
  animation: toast-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.toast svg { flex: none; color: #3DDC97; }
.toast--out { animation: toast-out 0.3s ease forwards; }

@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -16px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, -16px); } }

/* ---------------------------------------------------------- chats context */

.who-pic { position: relative; flex: none; display: flex; }
.kind-badge {
  position: absolute; right: -4px; bottom: -4px;
  width: 22px; height: 22px;
  border-radius: 999px;
  background: var(--k);
  color: #FFFFFF;
  border: 2px solid var(--card);
  display: flex; align-items: center; justify-content: center;
}

/* ------------------------------------------------------- the first screen */

/* The two front doors, the start page and logging in. The tile is the dark
   plate the mark is drawn on, so what you see here is the same thing that
   ends up on the home screen. The gates further in keep the plain house. */
.mark--brand {
  width: 92px; height: 92px;
  border-radius: 23px;
  background: #0B0B0F;
  box-shadow: 0 8px 22px rgba(11, 11, 15, 0.26);
}

.gate--start {
  padding-top: calc(var(--top) + 26px);
  padding-left: 20px; padding-right: 20px;
}
.gate--start h1 { margin-top: 16px; text-align: center; font-size: 26px; }
.gate--start p.lead { text-align: center; }

.kinds {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 24px;
}

.kind {
  padding: 12px;
  border-radius: var(--r-card);
  background: var(--card);
  border: 1px solid var(--hair);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  display: flex; flex-direction: column; gap: 8px;
  animation: rise 0.5s ease both;
}
.kind:nth-child(2) { animation-delay: 0.06s; }
.kind:nth-child(3) { animation-delay: 0.12s; }
.kind:nth-child(4) { animation-delay: 0.18s; }

/* The icon stands on its own, no tile behind it. A tinted box around a
   tinted icon washes the colour out twice over.

   Written as .kind .kind-icon and not .kind-icon on purpose. The icon is a
   span, so the rule for the grey subtitle below it, .kind span, is more
   specific than a single class and would win. That is why these icons were
   grey all along, the tile behind them only made them look coloured. */
.kind .kind-icon {
  display: flex;
  color: var(--k);
}
.kind b { font-size: 15px; font-weight: 700; }
.kind span { font-size: 12px; line-height: 1.35; color: var(--muted); }

/* How it works, as a line you follow from left to right. The line runs a
   little past the first and the last ball, so it reads as a route and not
   as three circles that happen to be in a row. The balls punch through it
   with a border in the colour of the page behind them. */
.way { position: relative; margin-top: 22px; }

.way-line {
  position: absolute;
  left: 10px; right: 10px; top: 16px;
  height: 2px;
  background: var(--line);
}

.way ol {
  position: relative;
  list-style: none; margin: 0; padding: 0;
  display: flex;
}

.way li {
  flex: 1; min-width: 0;
  padding: 0 3px;
  text-align: center;
  font-size: 12px; line-height: 1.35;
  color: var(--muted);
}

.ball {
  width: 34px; height: 34px;
  margin: 0 auto 9px;
  border: 3px solid var(--bg);
  border-radius: 999px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

@media (prefers-reduced-motion: reduce) {
  .kind, .toast, .toast--out { animation: none; }
}

/* ------------------------------------------------------------- dark mode */

@media (prefers-color-scheme: dark) {
  :root {
    --c-housing: #2EC4B0;
    --c-ticket:  #FF735B;
    --c-item:    #A28DFF;
    --c-group:   #E8A33D;
  }
  [data-kind] { --k-soft: color-mix(in srgb, var(--k) 20%, transparent); }
  .cover { filter: brightness(0.82) saturate(0.95); }
  .card { box-shadow: none; }
  .toast { background: #F4F4F6; color: #0B0B0F; }
  .toast svg { color: #12A86B; }
}

/* Light category colours are bright in the dark, so text on them turns dark. */
@media (prefers-color-scheme: dark) {
  .app[data-kind] .btn:not(.btn--quiet):not(.btn--danger),
  .app[data-kind] .chip--on,
  .app[data-kind] .fpill--on { color: #0B0B0F; }
}

/* Your own entries on the profile carry their tab's colour too. */
.mini[data-kind] { background: var(--k-soft); color: var(--k); }

/* ------------------------------------------------- sorting and filtering */

/* Market has no date to read it by, so this one line is what puts it in an
   order. Three controls, all of them visible, and no second page to go to.
   Everything they do stands in the address, so a filtered list can be sent
   to somebody and the back button does what you expect. */

/* The three pickers, in a row of their own under the categories. */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: none;
  margin-top: 8px;
  padding-bottom: 2px;
}

/* Four of them do not fit across a phone, and wrapping would put the row
   back to the two lines this was meant to replace, so it slides instead. */
.filters--one {
  flex-wrap: nowrap;
  margin: 8px -16px 0;
  padding: 0 16px 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filters--one::-webkit-scrollbar { display: none; }

/* Four pills are 28 pixels wider than a phone, so this row is set a little
   tighter than the housing one, which only ever holds two. It still slides
   on anything narrower than 375. */
.filters--one .fpill { padding: 6px 8px 6px 9px; gap: 5px; }

/* Same shape and height as a chip, so the two rows belong together. White
   with a line around it rather than filled, because these open something
   and a category does not. */
.fpill {
  position: relative;
  flex: none;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 10px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px; font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

/* The select lies invisible over the whole pill and opens the phone's own
   picker. That is the only way the pill can be as wide as the word it shows
   instead of as wide as its longest option, which is what pushed the row
   onto a third line. */
.fpill select {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0; padding: 0; border: 0;
  opacity: 0;
  appearance: none; -webkit-appearance: none;
  font: inherit;
}

/* The little chevron, drawn with two borders rather than an image. */
.fpill--pick::after {
  content: "";
  width: 6px; height: 6px;
  margin: -4px 0 0 0;
  border-right: 1.7px solid var(--muted);
  border-bottom: 1.7px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}

/* A filter that is doing something says so in the colour of the tab, the
   same way a chosen chip does. */
.fpill--on {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.fpill--on.fpill--pick::after { border-color: #FFFFFF; }

/* Sits under the filter row rather than in it, so the row stays one line
   and this stays reachable. Pulled up against the gap the screen puts
   between its children, because it belongs to the row above it. */
.clear {
  flex: none;
  align-self: flex-start;
  margin-top: -6px;
  display: inline-flex; align-items: center;
  /* The same side padding as a filter pill in the row above, which puts
     this word directly under the first one up there instead of a few
     pixels to the left of it. */
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 12px; font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  white-space: nowrap;
}

/* The same pill at the head of the housing panel, where it sits in a row
   instead of under one and needs none of the placing above. */
.clear--top { align-self: center; margin-top: 0; }

.fpill:active { transform: scale(0.97); }

/* ---------------------------------------------- the row you swipe along */

.strip {
  display: flex;
  gap: 10px;
  flex: none;
  margin: 0 -16px;
  padding: 0 16px 4px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  /* Without this the snap would pull the first card past the 16px gutter and
     it would sit flush against the edge of the screen. */
  scroll-padding: 0 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.strip::-webkit-scrollbar { display: none; }

.scard {
  flex: none;
  width: 124px;
  scroll-snap-align: start;
  display: flex; flex-direction: column; gap: 1px;
  transition: transform 0.12s ease;
}

.scard:active { transform: scale(0.98); }

.scard-pic {
  width: 124px; height: 124px;
  margin-bottom: 7px;
  border-radius: var(--r-card);
  background: var(--fill);
  overflow: hidden;
}

.scard-pic:has(.cover) { background: none; }
.scard-pic img { width: 100%; height: 100%; object-fit: cover; }

.scard-title { font-size: 13px; font-weight: 600; letter-spacing: -0.1px; }
.scard-price { font-size: 13px; font-weight: 700; color: var(--muted); }

/* --------------------------------------------------------- the heart */

/* Top right of every entry, opposite the way back. Your own entries have
   none, because saving your own thing says nothing. */

.save-form--hero { position: absolute; right: 16px; top: var(--top); z-index: 5; }

.ticket-top { display: flex; align-items: center; justify-content: space-between; }

.save {
  width: 44px; height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  color: var(--ink);
  transition: transform 0.12s ease;
}

/* On the blue ticket block there is no picture to blur, so it is solid. */
.save--head {
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  color: #0B0B0F;
}

/* A filled heart is red wherever it sits. The tab colour would say nothing,
   a red heart says saved in any language. */
.save--on { color: #EA4C35; }

.save:active { transform: scale(0.94); }

@keyframes pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.save--pop { animation: pop 0.26s ease; }

@media (prefers-color-scheme: dark) {
  .save { background: rgba(28, 28, 33, 0.72); color: var(--ink); }
  .save--head { background: rgba(255, 255, 255, 0.88); color: #0B0B0F; }
  .save--on { color: #FF6B55; }
}

/* --------------------------------------------- the notice on the board */

/* Groups has no photo, and a ticket stub would be the wrong object. What a
   group entry really is, is the notice somebody pinned to the board when
   they were one person short. The header is the board, the paper is pinned
   to it, and the tabs along the bottom are the free spots. Where one has
   been torn off you see the board through the gap. */

:root {
  --paper: #FFFDF8;
  --paper-edge: #DACFB4;   /* the torn edge, so a rip has thickness */
  --paper-line: #DED8C8;   /* the cuts between the tabs */
  --paper-ink: #0B0B0F;
  --paper-sub: #5E5E66;
  --paper-faint: #9A9AA2;
}

.board {
  background: var(--accent);
  padding: var(--top) 10px 46px;
}

.notice { position: relative; margin-top: 16px; }

/* A second sheet behind it. Without this it is one page floating in colour,
   with it you are looking at a board that has things on it. */
.notice-behind {
  position: absolute;
  left: 5px; right: 5px; top: -10px;
  height: 58px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.62);
  transform: rotate(2.6deg);
}

.notice-sheet { position: relative; transform: rotate(-0.7deg); }

.pin {
  position: absolute;
  left: 50%; top: -9px;
  transform: translateX(-50%);
  width: 16px; height: 16px;
  border-radius: 999px;
  background: #B33B22;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.2);
  z-index: 3;
}

.notice-stamp {
  position: absolute;
  right: 14px; top: 13px;
  z-index: 2;
  padding: 3px 6px;
  border: 1.4px solid var(--accent);
  border-radius: 3px;
  transform: rotate(3deg);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px; letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--accent);
}

/* The paper stops at the cut line. Everything below belongs to the tabs.
   The cut is drawn as a repeating gradient rather than a dashed border, so
   the dashes are long enough to read as a line somebody is meant to cut. */
.notice-paper {
  background-color: var(--paper);
  background-image: repeating-linear-gradient(to right,
    var(--accent) 0 7px, transparent 7px 13px);
  background-size: 100% 2px;
  background-position: left bottom;
  background-repeat: repeat-x;
  border-radius: 3px 3px 0 0;
  padding: 15px 17px 15px;
  text-align: center;
}

.kicker {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px; letter-spacing: 2.6px;
  color: var(--paper-faint);
}

/* Set between two rules, thick over thin, the way a printed notice is set. */
.notice-date {
  margin-top: 7px;
  padding: 6px 0 7px;
  border-top: 2px solid var(--paper-ink);
  border-bottom: 1px solid var(--paper-ink);
  font-size: 32px; font-weight: 700; letter-spacing: -1.1px; line-height: 1;
  color: var(--paper-ink);
}

.notice-sub {
  display: block;
  margin-top: 7px;
  font-size: 13px;
  color: var(--paper-sub);
}

.tear { display: flex; height: 84px; }

.tear-tab {
  flex: 1;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  background-color: var(--paper);
  border-radius: 0 0 2px 2px;
}

/* The cut between two tabs, same gradient standing up. */
.tear-tab:not(:first-child),
.tear-tab--torn:not(:first-child) i:last-child {
  background-image: repeating-linear-gradient(to bottom,
    var(--accent) 0 6px, transparent 6px 12px);
  background-size: 2px 100%;
  background-position: left top;
  background-repeat: repeat-y;
}

.tear-tab b {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px; font-weight: 400; letter-spacing: 1.4px; line-height: 1.6;
  text-align: center;
  color: var(--accent);
}

/* A tab somebody already took. It has no paper of its own, so the board
   shows through the gap. The two layers are the torn edge and the paper two
   pixels above it, which is what gives the rip its thickness. */
.tear-tab--torn { background-color: transparent; border-radius: 0; }
/* The line over the date on a notice. It carries the colour of the tab, so
   it reads as a label and not as a stray word above the headline. */
.kicker--k { color: var(--k); }

.tear-tab--torn i { position: absolute; inset: 0; }
/* The edge drops two pixels instead of the paper rising two pixels, so that
   the cut line printed along the bottom of the sheet stays visible. */
.tear-tab--torn i:first-child {
  background-color: var(--paper-edge);
  transform: translateY(2.5px);
}
.tear-tab--torn i:last-child { background-color: var(--paper); }

/* Six ragged edges. Which one a tab gets comes from the id of the entry, so
   a notice always tears the same way and two of them never look alike. */
.tear-tab--torn[data-shape="0"] i { clip-path: polygon(0 0,100% 0,100% 38%,92% 30%,84% 44%,76% 33%,67% 46%,58% 31%,49% 43%,40% 29%,31% 41%,22% 32%,13% 45%,5% 34%,0 42%); }
.tear-tab--torn[data-shape="1"] i { clip-path: polygon(0 0,100% 0,100% 29%,90% 41%,81% 28%,72% 40%,63% 27%,54% 38%,45% 26%,36% 39%,27% 30%,18% 42%,9% 31%,0 38%); }
.tear-tab--torn[data-shape="2"] i { clip-path: polygon(0 0,100% 0,100% 45%,91% 33%,82% 47%,73% 35%,64% 48%,55% 34%,46% 46%,37% 32%,28% 44%,19% 35%,10% 47%,0 36%); }
.tear-tab--torn[data-shape="3"] i { clip-path: polygon(0 0,100% 0,100% 33%,90% 25%,80% 40%,70% 28%,60% 42%,50% 27%,40% 39%,30% 26%,20% 38%,10% 29%,0 40%); }
.tear-tab--torn[data-shape="4"] i { clip-path: polygon(0 0,100% 0,100% 44%,89% 31%,78% 46%,67% 33%,56% 45%,45% 30%,34% 43%,23% 32%,12% 46%,0 34%); }
.tear-tab--torn[data-shape="5"] i { clip-path: polygon(0 0,100% 0,100% 27%,88% 39%,77% 26%,66% 38%,55% 25%,44% 37%,33% 28%,22% 40%,11% 29%,0 36%); }

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1C1C21;
    --paper-edge: #0C0C0F;
    --paper-line: rgba(255, 255, 255, 0.16);
    --paper-ink: #F4F4F6;
    --paper-sub: #96969F;
    --paper-faint: #6A6A73;
  }
  .notice-behind { background: rgba(255, 255, 255, 0.4); }
}

/* ------------------------------------------------- the Housing filter panel */

/* Housing asks about ten things, which is far too many for a row of pills.
   They live behind one button instead. The checkbox that opens the panel is
   invisible and sits just above it, so the whole thing works with no
   JavaScript, and the page comes back with the panel open whenever
   something is already set. */

.hsearch { margin-top: 10px; }

.hbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.fbtn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px; font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.fbtn--on { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }

.fcount {
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--accent);
  font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
}

.hpanel { display: none; }
#openfilters:checked ~ .hpanel { display: block; }

.hpanel {
  margin-top: 10px;
  padding: 14px 15px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.hpanel-top { display: flex; justify-content: space-between; align-items: baseline; }
/* Lifted with the questions below it, so the three sizes still read as
   three steps. The panel heading, the question, the answers. */
.hpanel-top b { font-size: 18px; }

.hpanel .input { height: 40px; font-size: 14px; }
.hpanel .input + .flabel { margin-top: 15px; }

/* The heading over each group of choices. It used to be set in a tiny
   pale monospace with wide letter spacing, which read as decoration
   rather than as the question it is asking. */
.flabel {
  display: block;
  margin: 18px 0 8px;
  font-size: 15px; font-weight: 600;
  color: var(--ink);
}

.opts { display: flex; flex-wrap: wrap; gap: 5px; }

/* The box itself is invisible and the word next to it is the button. It is
   called opt and not pick, because pick already belongs to the rows in the
   course list, and two meanings for one name is how a page breaks. */
.opt span {
  display: inline-block;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--tint);
  font-size: 12px; font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.opt input:checked + span { background: var(--accent); color: #FFFFFF; }
.opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.pair--tight { gap: 8px; margin-top: 8px; }
.opts + .input { margin-top: 8px; }

.found { margin: 9px 2px 0; font-size: 12px; color: var(--muted); }

/* ------------------------------------------------ what a place really costs */

.card-key { font-size: 13px; font-weight: 600; color: var(--accent); }

.costs {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.cost { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 14px; }
.cost--quiet { color: var(--muted); }
.cost-rule { height: 1px; background: var(--line); margin: 8px 0; }
.cost--sum { font-size: 16px; font-weight: 700; }
/* The deposit. Read as loudly as the bills above, because it is the one
   number that decides whether somebody can afford to move at all. Set
   apart from the monthly sum, since it is paid once. */
.cost--note {
  margin-top: 8px; padding-top: 9px;
  border-top: 1px solid var(--hair);
  font-size: 14px; color: var(--muted);
}

.facts { margin-top: 16px; }

.fact {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--hair);
  font-size: 14px;
}

.fact:last-child { border-bottom: 0; }
.fact svg { flex: none; color: var(--accent); }
.fact > span { flex: 1; min-width: 0; color: var(--muted); }
.fact b { font-weight: 600; }

.block-head { display: block; margin-top: 18px; font-size: 14px; font-weight: 600; }
.text--flush { margin-top: 8px; }

@media (prefers-color-scheme: dark) {
  .app[data-kind] .fbtn--on,
  .app[data-kind] .opt input:checked + span { color: #0B0B0F; }

  /* The logo sits on near black, and so does the page, so the tile needs a
     line around it or it stops being a tile and the four shapes just float. */
  .mark--brand {
    border: 1px solid rgba(255, 255, 255, 0.11);
    box-shadow: none;
  }
}

/* ------------------------------------------- the capsule under the tab bar */

/* The active tab sits in a pane of frosted glass that slides across when you
   move to another one. The colour stays on the icon where it belongs, so the
   glass itself is neutral and only says where you are. */

.glide {
  position: absolute;
  z-index: 0;
  left: 4px; top: 8px;
  width: calc((100% - 8px) / 5);
  height: 48px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 4px rgba(0, 0, 0, 0.1);
  /* Where it sits before any script has run, so it is never in the wrong
     place even for a frame. app.js then measures the real tab and plays the
     travel itself, which is why there is no transition here. One would
     fire on every load as the measured pixels replace this calculation. */
  transform: translateX(calc(var(--n, 0) * 100%));
  pointer-events: none;
}

.tab { z-index: 1; }

.tab svg { transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1); }
.tab[aria-current="page"] svg { transform: translateY(-1px) scale(1.06); }

@media (prefers-color-scheme: dark) {
  .glide {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
}

/* Somebody who asked their phone for less movement gets none. */
@media (prefers-reduced-motion: reduce) {
  .tab svg { transition: none; }
}
