/* Open House — mobile-first. Designed for a thumb on a phone, nothing else. */

:root {
  --green:      #1d6f5c;
  --green-dark: #14513f;
  --green-soft: #e6f2ee;
  --amber:      #b46b16;
  --red:        #b3261e;

  --bg:      #f6f5f2;
  --surface: #ffffff;
  --border:  #e2e0da;
  --text:    #1a1a18;
  --muted:   #6b6a64;

  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 14px rgb(0 0 0 / 4%);

  /* Notch / home-indicator insets. */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height:  62px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --green:      #4bbf9f;
    --green-dark: #2f9a7e;
    --green-soft: #16302a;
    --amber:      #e0a250;
    --red:        #f2857d;

    --bg:      #16171a;
    --surface: #202226;
    --border:  #33363c;
    --text:    #ecebe8;
    --muted:   #9b9a95;
    --shadow:  0 1px 2px rgb(0 0 0 / 40%);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Stops iOS bouncing the whole page when a list is scrolled. */
  overscroll-behavior-y: none;
}

h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; }
h2 { font-size: 1.25rem; }
p { margin: 0 0 .8em; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(var(--safe-top) + 14px) 16px 14px;
  background: var(--green);
  color: #fff;
}

.topbar__title { margin: 0; font-size: 1.1rem; font-weight: 600; }

.page {
  padding: 16px;
  /* Never let the bottom nav sit on top of the last row. */
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 24px);
  max-width: 720px;
  margin: 0 auto;
}

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

.card--welcome { text-align: center; }

/* --- flashes ----------------------------------------------------------- */

.flashes { margin-bottom: 14px; }

.flash {
  margin: 0 0 8px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: .95rem;
}

.flash--success { border-color: var(--green);  background: var(--green-soft); }
.flash--error   { border-color: var(--red);    color: var(--red); }
.flash--warning { border-color: var(--amber);  color: var(--amber); }

/* --- controls ---------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* 48px: comfortably above the 44px minimum touch target. */
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { background: var(--green-dark); }
.btn--block { width: 100%; }

.btn--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn--danger { background: var(--red); }

input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  /* 16px minimum, or iOS Safari zooms the viewport on focus. */
  font: inherit;
  font-size: 16px;
}

input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .9rem; }

.field { margin-bottom: 16px; }
.field__hint { margin: 6px 0 0; }

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

.btn-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}

.mt    { margin-top: 12px; }
.mt-sm { margin-top: 6px; }

/* --- sign-in ----------------------------------------------------------- */

.auth {
  max-width: 380px;
  margin: 0 auto;
  padding-top: 6vh;
}

.auth__brand { text-align: center; margin-bottom: 20px; }
.auth__brand img { border-radius: 20px; }
.auth__brand h1 { margin: 12px 0 4px; font-size: 1.5rem; }
.auth__card { margin-bottom: 12px; }
.auth__help { text-align: center; }

/* Wide-spaced digits so a 4-digit PIN reads as a PIN, not a password. */
.input--pin {
  text-align: center;
  font-size: 28px;
  letter-spacing: .5em;
  /* letter-spacing pads the right of the last glyph; nudge it back so the
     dots look centred rather than sitting left. */
  text-indent: .5em;
  font-weight: 600;
}

/* --- rows / lists ------------------------------------------------------ */

.card--list { padding: 0; overflow: hidden; }
.card--dim  { opacity: .72; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  min-height: 60px;
}

.row:last-child { border-bottom: 0; }
.row:active { background: var(--green-soft); }

.row__body { flex: 1; min-width: 0; }
.row__title { display: block; font-weight: 600; }
.row__meta  { display: block; }
.row__chevron { color: var(--muted); font-size: 1.4rem; line-height: 1; }

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 700;
  font-size: .85rem;
}

.avatar--lg { width: 56px; height: 56px; flex-basis: 56px; font-size: 1.1rem; }

/* A photo occupies the same box as the initials it replaces, so a list of
   members stays aligned whether or not people have uploaded one. */
.avatar--photo {
  object-fit: cover;
  padding: 0;
  background: var(--border);
}

@media (prefers-color-scheme: dark) {
  .avatar { color: var(--green); }
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  vertical-align: middle;
}

.tag--admin { background: var(--green-soft); color: var(--green-dark); }
.tag--warn  { background: var(--red); color: #fff; }

/* --- issues ------------------------------------------------------------ */

.tag--open      { background: var(--amber); color: #fff; }
.tag--discussed { background: var(--green-soft); color: var(--green-dark); }
.tag--resolved  { background: var(--green); color: #fff; }

.issue-head { display: flex; gap: 6px; margin-bottom: 10px; }

.issue-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

/* Members write these on a phone; keep their line breaks and never let a
   pasted URL push the layout sideways. */
.issue-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.revision {
  border-left: 3px solid var(--border);
  padding: 2px 0 2px 12px;
  margin: 12px 0;
}

.revision--now { border-left-color: var(--green); }
.revision__when { margin: 0 0 2px; }
.revision__title { margin: 0 0 2px; font-weight: 600; }
.revision p:last-child { margin-bottom: 0; }

@media (prefers-color-scheme: dark) {
  .tag--admin { color: var(--green); }
  .tag--warn  { color: #2a1210; }
}

.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 8px; }
.section-title:first-child { margin-top: 0; }

.empty { text-align: center; padding: 32px 18px; }

.profile { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.profile__name { margin: 0 0 2px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline__what { display: block; }

.version { text-align: center; margin-top: 20px; }

/* --- one-time PIN reveal ----------------------------------------------- */

.pin-reveal { text-align: center; }
.pin-reveal__lead { margin-bottom: 4px; }

.pin-reveal__pin {
  margin: 12px 0;
  padding: 18px 12px;
  border: 2px dashed var(--green);
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: .35em;
  text-indent: .35em;
  /* Tabular figures so the digits do not jiggle between PINs. */
  font-variant-numeric: tabular-nums;
}

@media (prefers-color-scheme: dark) {
  .pin-reveal__pin { color: var(--green); }
}

.pin-reveal__warn { font-size: .9rem; }
.pin-reveal__steps { text-align: left; margin: 0 0 18px; padding-left: 20px; }
.pin-reveal__steps li { margin-bottom: 4px; }

/* --- bottom navigation -------------------------------------------------- */

.topbar__action {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  padding: 8px 4px;
}

.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-around;
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--nav-height);
  padding: 8px 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: .7rem;
  -webkit-tap-highlight-color: transparent;
}

.nav__item.is-active { color: var(--green); }
.nav__glyph { font-size: 1.25rem; line-height: 1; }

@media (prefers-reduced-motion: no-preference) {
  .row, .btn, .nav__item { transition: background-color .12s ease, color .12s ease; }
}

/* --- amount entry ------------------------------------------------------- */

.amount-card { padding-bottom: 20px; }

.amount-input {
  display: flex;
  align-items: baseline;
  gap: 6px;
  border-bottom: 2px solid var(--green);
  padding-bottom: 6px;
}

.amount-input__symbol { font-size: 1.8rem; color: var(--muted); }

.amount-input input {
  border: 0;
  background: none;
  padding: 0;
  font-size: 2.4rem;
  font-weight: 700;
  min-height: 52px;
  font-variant-numeric: tabular-nums;
}

.amount-input input:focus-visible { outline: none; }

.btn--lg { min-height: 56px; font-size: 1.05rem; }

/* --- category chips ----------------------------------------------------- */

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

.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }

.chip__body {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: .9rem;
  cursor: pointer;
}

.chip input:checked + .chip__body {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 600;
}

.chip input:focus-visible + .chip__body { outline: 3px solid var(--green); outline-offset: 2px; }

@media (prefers-color-scheme: dark) {
  .chip input:checked + .chip__body { color: var(--green); }
}

/* --- participant checklist ---------------------------------------------- */

.split-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.split-head__hint { margin: 0; }

.checklist { list-style: none; margin: 10px 0 0; padding: 0; }
.checklist li { border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  margin: 0;
  font-weight: 400;
  cursor: pointer;
}

.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__name { flex: 1; }

.check__avatar {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}

.check__box {
  width: 26px; height: 26px;
  flex: 0 0 26px;
  border: 2px solid var(--border);
  border-radius: 8px;
}

.check input:checked ~ .check__box {
  border-color: var(--green);
  background: var(--green);
  /* Tick drawn in CSS so there is no icon font or SVG request. */
  background-image: linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%),
                    linear-gradient(-45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
  background-size: 60% 3px, 60% 3px;
  background-position: 20% 62%, 42% 62%;
  background-repeat: no-repeat;
}

.check input:checked ~ .check__avatar { background: var(--green-soft); color: var(--green-dark); }
.check input:focus-visible ~ .check__box { outline: 3px solid var(--green); outline-offset: 2px; }

.checklist--weighted li { display: flex; align-items: center; gap: 10px; }
.checklist--weighted .check { flex: 1; }
.weight { margin: 0; }
.weight select { min-height: 40px; width: auto; padding: 6px 8px; font-size: .85rem; }

/* --- expense list / detail ---------------------------------------------- */

.cat-icon {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  background: var(--green-soft);
  font-size: 1.15rem;
}

.row__amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row--voided { opacity: .55; }
.row--voided .row__amount { text-decoration: line-through; }
.row--compact { min-height: 48px; padding: 10px 0; border-bottom: 0; }

.list-total { text-align: right; margin: 0 0 8px; }

.filters { padding: 12px; }
.filters__row { display: flex; gap: 8px; margin-bottom: 8px; }
.filters__row > * { flex: 1; min-width: 0; }
.filters__row:last-of-type { margin-bottom: 0; }
.inline-form { display: block; margin-top: 4px; }
.inline-form select { min-height: 38px; font-size: .82rem; padding: 4px 8px; }

.pager { display: flex; gap: 10px; justify-content: space-between; margin-top: 8px; }

.expense-head { text-align: center; }
.expense-head.is-voided { opacity: .6; }
.expense-head__amount {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.expense-head__category { margin: 2px 0 6px; font-weight: 600; }
.expense-head__note { margin-top: 10px; font-style: italic; }

.receipt {
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.splits { list-style: none; margin: 0; padding: 0; }

.split {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.split:last-child { border-bottom: 0; }
.split__body { flex: 1; min-width: 0; }
.split__name { display: block; }
.split__amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.split--waived .split__amount { text-decoration: line-through; opacity: .6; }
.split__action { margin: 0; }

.void-details summary { list-style: none; cursor: pointer; }
.void-details summary::-webkit-details-marker { display: none; }

/* --- balances / reports -------------------------------------------------- */

.balance-card { text-align: center; }
.balance-card__label { margin: 0 0 4px; color: var(--muted); font-size: .9rem; }
.balance-card__amount {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.balance-card--owing { border-left: 4px solid var(--amber); }
.balance-card--owing .balance-card__amount { color: var(--amber); }
.balance-card--owed  { border-left: 4px solid var(--green); }
.balance-card--owed .balance-card__amount { color: var(--green); }
.balance-card--clear .balance-card__amount { font-size: 1.6rem; color: var(--green); }

.total-card { text-align: center; }
.total-card__label { margin: 0; color: var(--muted); }
.total-card__amount { margin: 4px 0 0; font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.month-total { margin: 0; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.bars { list-style: none; margin: 0; padding: 0; }
.bar { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 0; }
.bar__label { min-width: 0; }
.bar__amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.bar__track {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.bar__fill { display: block; height: 100%; background: var(--green); border-radius: 999px; }

.stat-list { list-style: none; margin: 0; padding: 0; }
.stat-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.stat-list li:last-child { border-bottom: 0; }
.stat-list__value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- issue photos and voice --------------------------------------------- */

/* auto-fill rather than a fixed count: three across on a phone, more on a
   wider screen, without a media query. */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.photo-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--border);
  display: block;
}

.photo-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-cell__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  /* 28px is small for a target, so the padding below pads the hit area out
     to roughly 40px without making the badge itself look heavy. */
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 62%);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.photo-cell--removed { opacity: .38; }
.photo-cell--removed img { filter: grayscale(1); }

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

.photo-actions .btn { flex: 1 1 46%; }

.row__marks { white-space: nowrap; padding-left: 6px; }

.voice-player, .voice-existing audio { width: 100%; margin: 6px 0; }

[data-record].is-recording {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

[data-record-timer] { text-align: center; margin: 6px 0 0; }

/* --- photo viewer ------------------------------------------------------- */

body.has-lightbox { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  background: rgb(0 0 0 / 92%);
  /* Clear of the notch and the home indicator. */
  padding: calc(var(--safe-top) + 8px) 4px calc(var(--safe-bottom) + 8px);
}

.lightbox[hidden] { display: none; }

.lightbox__stage {
  grid-column: 2;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.lightbox__stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  /* Stops the browser hijacking a horizontal drag as a page gesture, so the
     swipe reaches the handler. */
  touch-action: pan-y;
}

.lightbox__close,
.lightbox__nav {
  border: 0;
  background: rgb(255 255 255 / 12%);
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lightbox__close {
  position: absolute;
  top: calc(var(--safe-top) + 8px);
  right: 10px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
}

.lightbox__nav {
  width: 44px;
  height: 72px;
  border-radius: 10px;
  font-size: 30px;
  line-height: 1;
}

.lightbox__nav--prev { grid-column: 1; }
.lightbox__nav--next { grid-column: 3; }

.lightbox__counter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-bottom) + 12px);
  margin: 0;
  text-align: center;
  color: rgb(255 255 255 / 78%);
  font-size: .85rem;
}

/* A phone has no room for side buttons next to the photo; swiping is the
   gesture there, and the arrows would only cover the image. */
@media (max-width: 520px) {
  .lightbox__nav { display: none; }
}

/* --- balance statement -------------------------------------------------- */

.balance-card__more { margin: 6px 0 0; }
a.balance-card { display: block; text-decoration: none; color: inherit; }

.statement-row__figures { text-align: right; white-space: nowrap; }
.statement-row__delta { display: block; font-weight: 600; }
.statement-row__delta.is-up   { color: var(--red); }
.statement-row__delta.is-down { color: var(--green); }

/* --- issue chat --------------------------------------------------------- */

.chat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px 2px 8px;
  margin-bottom: 10px;
  /* Keeps a flick inside the thread instead of dragging the whole page. */
  overscroll-behavior: contain;
}

.chat__empty { text-align: center; padding: 18px 8px; }

.chat__day { text-align: center; margin: 12px 0 6px; }
.chat__day span {
  background: var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: .72rem;
  font-weight: 600;
}

.bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin-bottom: 4px;
}

.bubble-row--mine { flex-direction: row-reverse; }
.bubble-row .avatar { width: 28px; height: 28px; flex-basis: 28px; font-size: .65rem; }

.bubble {
  position: relative;
  max-width: 78%;
  padding: 7px 10px 18px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  /* A pasted link must not stretch the bubble off the screen. */
  overflow-wrap: anywhere;
}

.bubble--mine {
  background: var(--green-soft);
  border-color: transparent;
}

@media (prefers-color-scheme: dark) {
  .bubble--mine { background: var(--green-soft); }
}

.bubble__who {
  margin: 0 0 2px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--green-dark);
}

@media (prefers-color-scheme: dark) {
  .bubble__who { color: var(--green); }
}

/* Typed on a phone: keep the line breaks people put in. */
.bubble__text { margin: 0; white-space: pre-wrap; }
.bubble__gone { margin: 0; color: var(--muted); font-style: italic; }

.bubble__photo { display: block; margin-bottom: 4px; }
.bubble__photo img {
  display: block;
  max-width: 100%;
  width: 220px;
  border-radius: 8px;
}

.bubble__voice audio { width: 210px; max-width: 100%; margin: 2px 0; }

/* Sits in the padding reserved at the foot of the bubble, so a short
   message stays one line high instead of two. */
.bubble__time {
  position: absolute;
  right: 10px;
  bottom: 4px;
  font-size: .68rem;
  color: var(--muted);
}

.bubble__remove {
  position: absolute;
  top: 2px;
  right: 4px;
  opacity: 0;
  transition: opacity .15s;
}

.bubble:hover .bubble__remove,
.bubble:focus-within .bubble__remove { opacity: 1; }

.bubble__remove button {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: .8rem;
  cursor: pointer;
  padding: 2px 4px;
}

/* --- composer ------------------------------------------------------------ */

.composer { padding: 0; border: 0; box-shadow: none; margin: 0; background: none; }

.composer__row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.composer__input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 11px 14px;
  border-radius: 22px;
  resize: none;
  overflow-y: auto;
}

.composer__icon,
.composer__send {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
}

.composer__icon { background: var(--border); color: var(--text); }
.composer__send { background: var(--green); color: #fff; }
.composer__send.is-recording { background: var(--red); }

.composer__preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.composer__preview img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.composer__voicechip { font-size: .9rem; }
.composer__drop {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 6px 8px;
}

.composer__recording { margin: 0 0 6px; color: var(--red); font-size: .85rem; font-weight: 600; }

.attach-sheet {
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

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

.points-badge {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--amber);
  color: #fff;
  font-weight: 700;
}

.points-badge.is-clear { background: var(--border); color: var(--muted); }

.row--me { background: var(--green-soft); }

.points-head { display: flex; align-items: center; gap: 16px; }
.points-head__total { margin: 0; font-size: 2.4rem; font-weight: 700; line-height: 1; }

.blame-card { border-left: 4px solid var(--amber); }
.blame-card--approved { border-left-color: var(--red); }
.blame-card--rejected { border-left-color: var(--border); }

.blame-list { list-style: none; margin: 0 0 8px; padding: 0; }
.blame-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
}

.blame-picker .check { display: flex; align-items: center; gap: 10px; }
.blame-picker .check label { flex: 1; margin: 0; display: flex; align-items: center; gap: 8px; }
.blame-points { width: 72px; min-height: 40px; text-align: center; }

[data-blame-sum].is-bad { color: var(--red); font-weight: 600; }

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

.blame-label { margin: 0; }

.points-help {
  border-left: 3px solid var(--green);
  background: var(--green-soft);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0;
  font-size: .88rem;
}

.points-help p { margin: 0 0 8px; }
.points-help p:last-child { margin-bottom: 0; }

.blame-picker li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.blame-picker .check { flex: 1; min-width: 0; }
.blame-picker li.is-blamed .check__name { font-weight: 600; }

.blame-points { display: flex; align-items: center; gap: 4px; }

.blame-points input {
  width: 46px;
  min-height: 38px;
  padding: 4px;
  text-align: center;
  font-weight: 700;
  /* The spinners are unusable on a phone and the ± buttons replace them. */
  appearance: textfield;
  -moz-appearance: textfield;
}

.blame-points input::-webkit-outer-spin-button,
.blame-points input::-webkit-inner-spin-button { appearance: none; margin: 0; }

.stepper {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.severity-field { margin-top: 14px; }
.severity { display: flex; align-items: center; gap: 12px; }
.severity input[type="range"] { flex: 1; min-height: 0; padding: 0; }

.severity__value {
  flex: 0 0 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--amber);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
}

.blame-sum { margin: 10px 0 0; font-size: .88rem; font-weight: 600; }
.blame-sum.is-bad  { color: var(--red); }
.blame-sum.is-good { color: var(--green-dark); }

@media (prefers-color-scheme: dark) {
  .blame-sum.is-good { color: var(--green); }
}
