:root {
  --bg: #f3efe6;
  --card: #ffffff;
  --ink: #1b2130;
  --muted: #5d6676;
  --line: #e7e3da;
  --chip: #eef0f4;
  --food: #d9661f;
  --general: #262b38;
  --recycling: #2f7d54;
  --garden: #7a5a2f;
  --other: #3d5a8a;
  --ok: #24693f;
  --ok-bg: #e5f2ea;
  --warn: #a14a08;
  --warn-bg: #fbeedd;
  --danger: #a8261d;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: inherit; text-underline-offset: 2px; }
h1, h2 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h2.big { font-size: 1.5rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }

.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1040px; }
main.wrap { padding-top: 20px; padding-bottom: 48px; }

/* Header */
.top { padding: 14px 0 0; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; letter-spacing: -0.02em; }
.brand span { color: var(--food); }
.top nav { display: flex; align-items: center; gap: 16px; font-size: .95rem; }
.top nav form { margin: 0; }

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 0 16px;
  display: block;
}
.card > :last-child { margin-bottom: 0; }
.card.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.card.attention { outline: 3px solid var(--food); }
.card h2:not(:first-child) { margin-top: 1.2em; }
.card .eyebrow + h2 { margin-top: 0; }
.house-name { font-weight: 600; color: var(--muted); margin: 0 0 10px; }
.eyebrow { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; }
.eyebrow-badge {
  display: inline-block; background: var(--ink); color: #fff; font-size: .75rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; padding: 4px 10px; border-radius: 6px; margin: 0 0 10px;
}
.poster-title { font-size: 2rem; margin-bottom: .2em; }
.lead { font-size: 1.1rem; color: var(--muted); }

.hero h1 { margin-bottom: .25em; }
.hero.mine { background: var(--ink); color: #fff; }
.hero.mine .eyebrow { color: #c3c9d6; }

.num {
  display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; flex: none;
  border-radius: 50%; background: var(--ink); color: #fff; font-size: .85em; font-weight: 700; margin-right: .35em;
}

/* Rota order strip */
.chain { display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 0 0 12px; }
.chip {
  position: relative; background: var(--chip); border-radius: 10px; padding: 8px 14px;
  display: flex; flex-direction: column; align-items: center; min-width: 92px; flex: 1;
}
.chip span { font-size: .85rem; color: var(--muted); min-height: 1.3em; }
.chip.on { background: var(--ink); color: #fff; }
.chip.on span { color: #c3c9d6; }
.chip:not(:last-child)::after {
  content: ""; position: absolute; right: -19px; top: 50%; translate: 0 -50%;
  border: 7px solid transparent; border-left: 10px solid #9aa1ae; border-right: 0;
}

/* Bin colours */
.bin-food { background: var(--food); }
.bin-general { background: var(--general); }
.bin-recycling { background: var(--recycling); }
.bin-garden { background: var(--garden); }
.bin-other { background: var(--other); }
.pill {
  display: inline-block; color: #fff; font-size: .8rem; font-weight: 700; line-height: 1;
  padding: 5px 9px; border-radius: 999px; white-space: nowrap; vertical-align: middle; margin-right: 4px;
}
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 12px; }
.tile { color: #fff; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; }
.tile strong { font-size: 1.1rem; }
.tile span { font-size: .9rem; opacity: .95; }

/* Lists */
.steps, .rules { margin: 0 0 .8em; padding-left: 1.3em; }
.steps li, .rules li { margin: 0 0 .35em; }
ul.plain { list-style: none; padding: 0; margin: .8em 0 0; }
ul.plain li { padding: 6px 0; border-top: 1px solid var(--line); }

/* Tables */
.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.rota { width: 100%; border-collapse: collapse; }
.rota th {
  text-align: left; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line);
}
.rota td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rota tr:last-child td { border-bottom: 0; }
.rota tr.now td { background: #faf7f0; }
.rota tr.mine td:first-child { box-shadow: inset 3px 0 0 var(--food); }
.rota .day + .day { margin-top: 4px; }
.report td { font-size: .9rem; }

.tag {
  display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 5px; background: var(--chip); color: var(--muted); vertical-align: middle;
}
.tag.you { background: var(--food); color: #fff; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }

/* This week's bin days */
.task { border-top: 1px solid var(--line); padding: 12px 0; }
.task:first-of-type { border-top: 0; padding-top: 0; }
.task-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.task form { margin: 6px 0 0; }
.state { margin: 0 0 4px; color: var(--muted); }
.state.ok { color: var(--ok); font-weight: 600; }
.state.ok::before { content: "✓ "; }
.state.warn { color: var(--warn); font-weight: 600; }
.inline-state { display: inline; }
.flags { margin: 0 0 .8em; padding: 0; list-style: none; }
.flags li { background: var(--warn-bg); color: var(--warn); font-weight: 600; border-radius: 8px; padding: 8px 12px; margin: 0 0 6px; }

/* Buttons */
.btn {
  display: inline-block; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  background: var(--chip); color: var(--ink); border: 0; border-radius: 10px; padding: 11px 18px; min-height: 44px;
}
.btn:hover { filter: brightness(.96); }
.btn.primary { background: var(--food); color: #fff; }
.btn.quiet { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.danger { background: #fbe9e7; color: var(--danger); }
.btn.small { padding: 7px 12px; min-height: 36px; font-size: .9rem; }
.btn.big { padding: 14px 26px; font-size: 1.05rem; }
.btn:disabled { opacity: .4; cursor: default; }
.task .btn.primary { width: 100%; padding: 15px 18px; font-size: 1.05rem; }
button.link { font: inherit; background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; }
.link.danger { color: var(--danger); }
:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 12px; }
input, select, textarea {
  display: block; width: 100%; font: inherit; color: inherit; background: #fff;
  border: 1.5px solid #cfd3db; border-radius: 9px; padding: 10px 12px; margin-top: 4px; min-height: 44px;
}
input[type=file] { border-style: dashed; padding: 9px; }
input[readonly] { background: var(--chip); color: var(--muted); }
textarea { resize: vertical; }
.stack > * { margin-bottom: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { margin-left: auto; }
.row.wrap { flex-wrap: wrap; margin: 10px 0; }
.row form { margin: 0; }
.row input { margin-top: 0; }
label > .row { margin-top: 4px; }
.inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 12px 0; }
.inline label { flex: 1 1 150px; margin: 0; }
.inline-form { display: inline; margin-left: 8px; }
.bin-row, .tenant-row {
  display: grid; gap: 10px; align-items: end; padding: 12px 0; border-top: 1px solid var(--line);
  grid-template-columns: 1.3fr 1fr 1fr 1fr auto;
}
.tenant-row { grid-template-columns: 1fr .7fr 1.3fr auto; }
.bin-row label, .tenant-row label { margin: 0; min-width: 0; }
.bin-row .link, .tenant-row .link { justify-self: start; padding: 10px 0; }
[data-rows] { container-type: inline-size; }
@container (max-width: 700px) {
  .bin-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .bin-row, .tenant-row { grid-template-columns: 1fr 1fr; }
}
.form-status { color: var(--muted); min-height: 1.4em; margin: 0; }
details { margin: 10px 0; }
summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
details[open] > summary { margin-bottom: 8px; }

.flash { border-radius: 10px; padding: 12px 16px; font-weight: 600; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--warn-bg); color: var(--warn); }

/* Log */
.events { list-style: none; margin: 0; padding: 0; }
.ev { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.ev:first-child { border-top: 0; }
.ev .note { margin-top: 2px; }
.ev details { margin: 0; width: 100%; }
.ev-issue strong:first-child { color: var(--warn); }
.thumb img { display: block; width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.msg { white-space: pre-wrap; font: inherit; background: var(--chip); border-radius: 8px; padding: 12px; margin: 0 0 10px; overflow-wrap: anywhere; }

/* Landlord */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.grid .card { margin: 0; }
.house { text-decoration: none; }
.house:hover { box-shadow: 0 0 0 2px var(--ink); }
.house p { margin-bottom: .5em; }
.label { display: inline-block; min-width: 4.6em; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 16px; padding-bottom: 2px; }
.tabs a { text-decoration: none; font-weight: 600; padding: 9px 14px; border-radius: 999px; white-space: nowrap; color: var(--muted); }
.tabs a[aria-current] { background: var(--ink); color: #fff; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.two .card { margin: 0; }
.three { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tenants { list-style: none; margin: 0; padding: 0; }
.tenant { border-top: 1px solid var(--line); padding: 14px 0; }
.tenant:first-child { border-top: 0; padding-top: 0; }
.tenant-main { display: flex; align-items: center; gap: 8px; }
.copy input { font-size: .85rem; }
.landing-hero { padding: 40px 0 24px; max-width: 640px; }
.landing-hero h1 { font-size: clamp(2.2rem, 7vw, 3.4rem); }
.foot { color: var(--muted); font-size: .875rem; text-align: center; margin-top: 24px; }

.center { text-align: center; }

@media (max-width: 520px) {
  .card { padding: 16px; }
  .chip:not(:last-child)::after { display: none; }
  .chain { gap: 8px; }
  /* Rota rows stack: week and name on one line, bins underneath. */
  .rota:not(.report) thead { display: none; }
  .rota:not(.report) tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 8px; border-bottom: 1px solid var(--line); }
  .rota:not(.report) tr:last-child { border-bottom: 0; }
  .rota:not(.report) td { padding: 0; border: 0; background: none; }
  .rota:not(.report) td:nth-child(3) { grid-column: 1 / -1; }
  .rota:not(.report) tr.now { background: #faf7f0; border-radius: 8px; }
  .rota:not(.report) tr.mine { box-shadow: inset 3px 0 0 var(--food); }
  .rota tr.now td, .rota tr.mine td:first-child { background: none; box-shadow: none; }
}

@media print {
  body { background: #fff; }
  .top, .no-print, .flash { display: none; }
  .card { padding: 0; margin-bottom: 24px; break-inside: avoid-page; }
  .pill, .tile, .eyebrow-badge, .chip.on, .num { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .events .ev { break-inside: avoid; }
  .thumb img { width: 160px; height: 120px; }
}
