:root {
  color-scheme: dark;
  font: 100%/1.5 system-ui, sans-serif;
  --bg: #10140f;
  --card: #1b211a;
  --edge: rgba(255, 255, 255, 0.08);
  --ink: #edf1ea;
  --muted: #9fab9d;
  --accent: #8fd7a9;
  --accent-ink: #0d130e;
  --danger: #e2a69b;
  --radius: 1.1rem;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body {
  max-width: 52rem;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + .75rem)
           calc(env(safe-area-inset-right) + clamp(1rem, 4vw, 2rem))
           calc(env(safe-area-inset-bottom) + 3rem)
           calc(env(safe-area-inset-left) + clamp(1rem, 4vw, 2rem));
  -webkit-tap-highlight-color: transparent;
}
button, a { touch-action: manipulation; }

/* ---- Porch shell ---- */
.shell { margin-bottom: 1.5rem; }
.shell-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 2.75rem;
}
.brand {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: .8rem;
}
.shell h1 {
  margin: .75rem 0 .35rem;
  font: 500 clamp(2rem, 8vw, 3.25rem)/1.08 Georgia, serif;
  overflow-wrap: anywhere;
}
.shell-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}
.from { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.drop-source { margin-bottom: 1rem; }
.shell-actions { display: flex; align-items: center; gap: .6rem; }

.avatars { display: flex; }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: #2c3a2e;
  color: var(--ink);
  font-size: .8rem;
  font-weight: 600;
  border: 2px solid var(--bg);
}
.avatars .avatar + .avatar { margin-left: -.55rem; }
.avatar.agent { background: #233042; }
.avatar.more { background: transparent; border-color: var(--edge); color: var(--muted); }
.porch-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
}
.add { flex-shrink: 0; gap: .4rem; }
.add span { font-size: 1.35rem; line-height: 1; }
.add[hidden] { display: none; }
.menu-button, .account-button {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
/* The row reserves the menu's target while the button uses the viewport's safe edge. */
.shell > .shell-row { padding-left: 44px; justify-content: flex-end; }
.menu-button {
  position: absolute;
  left: env(safe-area-inset-left, 0px);
  width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
}
.menu-button:focus-visible { outline-offset: -3px; }
.menu-icon {
  display: grid;
  align-items: center;
  width: 21px;
  height: 16px;
  border-block: 2px solid currentColor;
}
.menu-icon::before { content: ""; border-top: 2px solid currentColor; }
.shell-actions, .account-button { min-width: 0; }
.account-button { padding: .25rem .5rem; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-initial {
  display: grid;
  place-items: center;
  flex: 0 0 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #2c3a2e;
  color: var(--accent);
  font-size: .8rem;
  font-weight: 700;
}
.skip-link { position: absolute; transform: translateY(-200%); }
.skip-link:focus { transform: none; z-index: 1; padding: .5rem; background: var(--card); color: var(--ink); }
#site-menu {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: hidden;
}
#site-menu[open] { background: rgb(0 0 0 / 60%); }
#site-menu::backdrop { background: transparent; }
.menu-panel {
  width: min(21rem, calc(100% - 3rem));
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--edge);
  background: var(--card);
  padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom))
           calc(1rem + env(safe-area-inset-left));
}
.menu-panel h2 { margin: 0; font: 500 1.6rem Georgia, serif; }
.menu-panel nav { display: grid; gap: .25rem; margin-top: 1rem; }
.menu-panel a {
  min-height: 44px;
  padding: .65rem .9rem;
  border-radius: .55rem;
  color: var(--ink);
  overflow-wrap: anywhere;
  display: block;
}
.menu-panel a[aria-current] {
  background: #2c3a2e;
  box-shadow: inset 3px 0 var(--accent);
  font-weight: 700;
  text-decoration: none;
}
/* How many prompts are waiting on whoever is reading, and the way to them. */
.waiting {
  min-width: 2.75rem;
  height: 2.75rem;
  padding: 0 .7rem;
  border-radius: 1.4rem;
  border: none;
  background: var(--danger);
  color: var(--accent-ink);
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  cursor: pointer;
}

.status { color: var(--muted); margin: .25rem 0 1rem; overflow-wrap: anywhere; }
.status:empty { display: none; margin: 0; }
.upload-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .65rem;
  margin-bottom: 1rem;
  padding: .65rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--card);
}
.upload-feedback p { flex: 1 1 14rem; margin: 0; overflow-wrap: anywhere; }
.upload-feedback [hidden] { display: none; }

/* Porch files use the same rows in both modes so opening details keeps one's place. */
.file-section {
  --row-height: 4rem;
  margin-bottom: 1rem;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
}
.file-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem 1rem;
}
.file-heading h2 { margin: 0; font-size: 1.15rem; }
.file-count { margin-left: .2rem; color: var(--muted); font-size: .9rem; font-weight: 500; }
.file-section .file-toggle { min-width: 6.5rem; padding-inline: .875rem; }
.file-section [hidden] { display: none; }
#porch-files {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: calc(4 * var(--row-height));
  overflow-y: auto;
  border-radius: 0 0 var(--radius) var(--radius);
}
.file-row {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  align-items: center;
  gap: .85rem;
  height: var(--row-height);
  padding: .5rem 1rem;
  border-top: 1px solid var(--edge);
}
.file-preview {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  width: 100%;
  height: 2.75rem;
  border-radius: .4rem;
  overflow: hidden;
  background: #2c3a2e;
}
.file-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.file-preview[data-kind="pdf"] img { background: #fff; }
.file-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
  padding-inline: .3rem;
  color: var(--ink);
  font: .65rem/1.25 system-ui, sans-serif;
}
.file-icon {
  display: grid;
  place-items: center;
  min-width: 2.15rem;
  height: 2rem;
  padding: .1rem;
  border: 1px solid currentColor;
  border-radius: .15rem .55rem .15rem .15rem;
  color: var(--muted);
  font: 650 .62rem/1 system-ui, sans-serif;
}
.file-name {
  display: block;
  align-content: center;
  min-height: 2.75rem;
  line-height: 2.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  text-decoration-color: var(--muted);
  text-underline-offset: .2em;
}
.file-detail, .file-actions { display: none; }
.file-empty { margin: 0; padding: .75rem 1rem 1rem; color: var(--muted); }
.expanded #porch-files { max-height: min(67vh, 38rem); }
.expanded .file-row {
  grid-template-columns: clamp(4.5rem, 15vw, 8rem) minmax(0, 1fr);
  height: auto;
  min-height: 7rem;
  padding-block: .65rem;
}
.expanded .file-preview { height: clamp(4.5rem, 14vw, 6rem); }
.expanded .file-name { line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.expanded .file-excerpt { -webkit-line-clamp: 4; font-size: .8rem; }
.expanded .file-detail { display: block; margin: .15rem 0; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.expanded .file-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.file-actions .action { padding-inline: .8rem; font-size: .9rem; }
.file-section .secondary { border-color: #72816f; }

/* ---- Card grid: one column at phone width, two from tablet up ---- */
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.cards.single { max-width: 36rem; }
@media (min-width: 640px) {
  .cards:not(.single) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.porch-empty, #porch-page .empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
}

.card {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card > .action { align-self: flex-start; margin: 0 1.1rem 1rem; }
.card .cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #0c100c;
  display: block;
}
.card-body {
  overflow-wrap: anywhere;
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 1;
}
.card h2 {
  margin: 0;
  font: 600 1.15rem/1.3 system-ui, sans-serif;
  overflow-wrap: anywhere;
}
.card-kind {
  margin: 0;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.meta { margin: 0; color: var(--muted); font-size: .95rem; overflow-wrap: anywhere; }
.note-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.byline { margin: auto 0 0; padding-top: .25rem; color: var(--muted); font-size: .85rem; }
.prompt-question { margin: 0; }
.amount { margin: 0; font: 600 1.6rem/1.2 Georgia, serif; }

/* ---- Buttons: every control at least 44pt tall ---- */
.action, .primary, .secondary, .ghost, .option, .sheet-action {
  min-height: 2.75rem;
  font-size: 1rem;
  border-radius: 999px;
  cursor: pointer;
}
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .5rem 1.25rem;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .5rem 1.25rem;
  border: 1px solid var(--edge);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
}
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .4rem .9rem;
  border: none;
  background: transparent;
  color: var(--accent);
  text-decoration: none;
}
button:disabled, .action:disabled { opacity: .45; cursor: default; }
.approve-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.approve-row .action { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* ---- Prompt option rows ---- */
.options { display: flex; flex-direction: column; gap: .5rem; }
.option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .1rem;
  position: relative;
  text-align: left;
  padding: .65rem 2.4rem .65rem .9rem;
  border: 1px solid var(--edge);
  border-radius: .8rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
}
.option-label { font-weight: 600; overflow-wrap: anywhere; }
.option-detail { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.option.chosen { border-color: var(--accent); background: rgba(143, 215, 169, 0.12); }
.option-check {
  position: absolute;
  right: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-weight: 700;
}
.answered { margin: 0; color: var(--accent); font-size: .95rem; overflow-wrap: anywhere; }
/* A request for alternatives: the question is still open, so it reads as a
   note on the card rather than as a settled answer. */
.requested {
  margin: 0;
  padding-left: .7rem;
  border-left: 2px solid var(--edge);
  color: var(--muted);
  font-size: .95rem;
  overflow-wrap: anywhere;
}

/* ---- Live drop ---- */
/* The status reads as a dot and a phrase. The dot takes its colour from the
   phrase, so one rule moves both, and it stays hidden from assistive
   technology because the phrase already says the same thing. */
.live-status {
  margin: 0;
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--muted);
}
.live-dot {
  flex: none;
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: currentColor;
}
.live-status.live { color: var(--danger); font-weight: 600; }

/* ---- Bottom sheet ---- */
.sheet-backdrop {
  inset: auto 0 0;
  margin: 0 auto;
  width: min(100%, 28rem);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 1.25rem 1.25rem 0 0;
  background: transparent;
  color: var(--ink);
}
.sheet-backdrop::backdrop { background: rgba(0, 0, 0, 0.55); }
.sheet {
  width: 100%;
  max-width: 28rem;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 1.25rem 1.25rem 0 0;
  padding: 1rem 1.25rem calc(env(safe-area-inset-bottom) + 1.25rem);
  display: flex;
  flex-direction: column;
  gap: .75rem;
  max-height: 85dvh;
  overflow-y: auto;
}
.sheet-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.sheet-top h2 { margin: 0; font-size: 1.2rem; overflow-wrap: anywhere; }
.sheet-action {
  display: flex;
  align-items: center;
  padding: .7rem 1rem;
  border: 1px solid var(--edge);
  border-radius: .9rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  text-align: left;
}
.sheet-form { display: flex; flex-direction: column; gap: .75rem; }
.sheet-form label { display: grid; gap: .25rem; }
.sheet-form label.checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: .6rem;
  min-height: 2.75rem;
}
.sheet-form label.checkbox input { width: 1.25rem; height: 1.25rem; }
.sheet-form label[hidden] { display: none; }
.camera-media {
  display: block;
  width: 100%;
  height: clamp(8rem, 38dvh, 22rem);
  object-fit: contain;
  border-radius: .8rem;
  background: #10140f;
}
.camera-modes { display: flex; gap: .5rem; }
.camera-modes button { flex: 1; border-color: var(--muted); }
.camera-modes [aria-pressed="true"] {
  border: 2px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.field {
  min-height: 2.75rem;
  width: 100%;
  padding: .7rem .9rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--edge);
  border-radius: .8rem;
}
.field:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sheet-problem { margin: 0; color: var(--danger); }
.google-slot { min-height: 2.75rem; display: flex; justify-content: center; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 1.25rem);
  background: #2c3a2e;
  color: var(--ink);
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: .6rem 1.2rem;
  max-width: calc(100vw - 2rem);
  overflow-wrap: anywhere;
  z-index: 20;
}
body:has(.sheet .camera-media) .toast {
  top: calc(env(safe-area-inset-top) + .75rem);
  bottom: auto;
  pointer-events: none;
}

@media (hover: hover) {
  button:enabled:hover, a.action:hover { box-shadow: inset 0 0 0 2px currentColor; }
}
button:enabled:active, a.action:active { filter: brightness(.85); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: rise .18s ease-out; }
  @keyframes rise { from { transform: translateY(1.5rem); opacity: .6; } }

  /* A closed dialog leaves the top layer immediately. Its inert panel can
     finish sliding over the page, or reverse if the reader reopens it. */
  #site-menu {
    display: block;
    z-index: 10;
    visibility: hidden;
    pointer-events: none;
    transition: background-color .18s ease-out, visibility 0s .18s;
  }
  #site-menu[open] {
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }
  .menu-panel { transform: translateX(-100%); transition: transform .18s ease-out; }
  #site-menu[open] .menu-panel { transform: none; }
}

/* ---- JavaScript-off fallback: the plain drop list ---- */
noscript .plain-header {
  display: block;
  border-bottom: 2px solid var(--accent);
  padding-bottom: .75rem;
  color: var(--accent);
  font-weight: 700;
}
.plain-note { color: var(--muted); }
.plain-drops { padding: 0; list-style: none; }
.plain-drops li {
  border-top: 1px solid var(--edge);
  padding: 1rem 0;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}
/* Owner's audience picker on a single-drop page. */
#share {
  max-width: 36rem;
  margin: 1.5rem 0 0;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--card);
  overflow-wrap: anywhere;
}
#share:not([hidden]), #share-result:not([hidden]), #link-options:not([hidden]) {
  display: grid;
  gap: .75rem;
}
#share h2 { margin: 0; font: 500 1.6rem/1.2 Georgia, serif; }
#share p { margin: 0; }
#share p[role="status"]:empty { position: absolute; }
#share .muted { color: var(--muted); font-size: .95rem; }
#share a { color: var(--accent); }
#share fieldset { min-width: 0; margin: .25rem 0 0; padding: 0; border: 0; }
#share legend { padding: 0; font-weight: 600; }
#share .checkbox { padding: .35rem 0; cursor: pointer; }
#share [hidden] { display: none; }
#share .checkbox input { margin: 0; accent-color: var(--accent); }
#share .field { min-width: 0; border-color: #637360; }
#share .field[aria-invalid="true"] { border-color: var(--danger); }
#share textarea { resize: vertical; }
#invite-options, #link-options { margin-top: .75rem; }
#invite-options label { margin-bottom: .25rem; }
#save { align-self: flex-start; }
#share-result { border-top: 1px solid var(--edge); padding-top: 1rem; }
#share-url { overflow-wrap: anywhere; }
#qr { background: white; max-width: 100%; height: auto; }

/* Signed-in porch directory */
.porch-list { list-style: none; margin: 0; padding: 0; }
.porch-list li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 .8rem;
  padding: .4rem 0;
  border-bottom: 1px solid var(--edge);
}
.porch-name {
  flex: 1 1 12rem;
  gap: .85rem;
  color: var(--ink);
  font-weight: 600;
  overflow-wrap: anywhere;
  text-decoration: none;
}
.porch-name > span:last-child { text-decoration: underline; text-underline-offset: .15em; }
.porch-stack {
  position: relative;
  flex: 0 0 4.9rem;
  height: 3.65rem;
  isolation: isolate;
}
.porch-stack porch-file, .empty-tray {
  position: absolute;
  left: 1px;
  bottom: 3px;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  width: 3.2rem;
  height: 2.6rem;
  overflow: hidden;
  border-radius: 5px;
}
.porch-stack porch-file {
  background: #344138;
  border: 2px solid #adb8ad;
  box-shadow: 0 1px 4px #0007;
  color: var(--ink);
  font-size: .65rem;
  letter-spacing: .025em;
  z-index: 4;
}
porch-file::part(thumbnail) { width: 100%; height: 100%; object-fit: cover; }
.porch-stack porch-file:nth-child(2) { transform: translate(7px, -4px) rotate(-3.5deg); z-index: 3; }
.porch-stack porch-file:nth-child(3) { transform: translate(14px, -8px) rotate(6deg); z-index: 2; }
.porch-stack porch-file:nth-child(4) { transform: translate(21px, -12px) rotate(-10.5deg); z-index: 1; }
.porch-stack small {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 0 .35em;
  border: 1px solid var(--muted);
  border-radius: 1em;
  background: var(--card);
  color: var(--ink);
  font-size: .65rem;
  font-variant-numeric: tabular-nums;
}
.empty-tray { border: 1px dashed var(--muted); }
.empty-tray::before {
  content: "";
  width: 1rem;
  height: .55rem;
  border: 1.5px solid var(--muted);
  border-radius: 2px 2px 4px 4px;
  transform: perspective(12px) rotateX(20deg);
  box-shadow: inset 0 -2px var(--muted);
}
@media (max-width: 36rem) {
  .porch-list li { display: grid; grid-template-columns: 4.9rem minmax(0, 1fr); column-gap: .85rem; }
  .porch-name { grid-column: 1 / -1; }
  .porch-list .syncing, .porch-list .attention { grid-column: 2; justify-self: start; }
}
.porch-list .syncing { color: var(--muted); }
#home-status:not(:empty) {
  margin: 1rem 0;
  padding-inline-start: .75rem;
  border-inline-start: 2px solid var(--danger);
  color: var(--ink);
}
#home-status:empty { margin: 0; }
#porch-page a, .home-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
}
.attention, #porch-page nav a, .home-link { color: var(--accent); }
#porch-page nav { display: flex; gap: 1rem; }
#porch-page .empty:empty, #porch-page nav:empty { display: none; }
#porch-page a:focus-visible, .home-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
