/* Light only, by Jo's choice (Nov 2). Brand tokens from design-system/, with lighter type (Gilda Display + Jost) per Jo. */
:root {
  --red: #8A0303; --red-deep: #6F0202; --tint: #F2E3E3; --tint-farm: #EFE7D6;
  --paper: #F5F1EA; --card: #FFFFFF; --ink: #242424; --ink-2: #4A463F; --muted: #6E675C;
  --gold: #A0895B; --gold-rule: #C2B394; --line: #E4DDD1; --rule: #D8CFBF;
  --on-red: #FFFFFF; --on-red-2: rgba(255,255,255,.82); --on-red-line: rgba(255,255,255,.28);
  --serif: 'Gilda Display', 'Iowan Old Style', Georgia, serif;
  --sans: 'Jost', -apple-system, 'Helvetica Neue', system-ui, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --pad: max(20px, env(safe-area-inset-left, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: light; } }

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-weight: 400; font-size: 16px; line-height: 1.5; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; caret-color: var(--red); accent-color: var(--red); }
::selection { background: var(--tint); color: var(--red-deep); }
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- Shell ---------- */
.screen { display: none; padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
.screen.on { display: block; animation: settle .32s var(--ease); }
@keyframes settle { from { opacity: .55; } to { opacity: 1; } }
.wrap { max-width: 480px; margin: 0 auto; padding-inline: var(--pad); }

/* The signature: a Barn Red band (logo, date, title) with a white "ticket" card overlapping its foot.
   Each tab's one headline fact sits in the ticket as labeled fields. */
.band { background: var(--red); color: var(--on-red); padding-top: max(18px, env(safe-area-inset-top, 0px)); }
.band .wrap { padding-bottom: 64px; }
.band-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.mark { display: block; height: 52px; width: auto; }
.mark.lockup { height: 54px; margin-left: -2px; }
.band-date { font-size: 14px; font-weight: 400; letter-spacing: .04em; color: var(--on-red-2); text-align: right; }
.band h1 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.15; margin-top: 20px; text-wrap: balance; }

.ticket { margin-top: -40px; position: relative; padding: 16px 18px 16px; }
.ticket-h { font-size: 12px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: var(--red); }
.ticket-title { margin-top: 6px; font-family: var(--serif); font-size: 22px; line-height: 1.25; color: var(--ink); text-wrap: balance; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); margin: 12px 0 0; border-top: 1px solid var(--line); }
.fields div { padding: 10px 0 0; }
.fields div + div { padding-left: 14px; margin-left: 0; border-left: 1px solid var(--line); }
.fields dt { font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.fields dd { margin: 2px 0 0; font-size: 17px; font-weight: 500; color: var(--ink); }
.ticket-note { margin-top: 12px; font-size: 14.5px; color: var(--ink-2); }
.ticket-note.first { margin-top: 8px; }
.ticket.quiet .ticket-title { color: var(--ink-2); }


.ticket-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ticket-in { font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

/* Appointments: one small card each, time in its own slot */
.appts { display: grid; gap: 8px; }
.appt { display: grid; grid-template-columns: 78px 1fr; background: var(--card); border: 1px solid var(--line); border-radius: 2px; transition: border-color .15s ease, opacity .15s ease; }
.appt-t { padding: 12px 0 12px 14px; border-right: 1.5px dashed var(--rule); }
.appt-k { display: block; font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.appt-t b { display: block; font-family: var(--serif); font-weight: 400; font-size: 20px; line-height: 1.2; }
.appt-d { padding: 12px 14px; min-width: 0; }
.appt-d b { display: block; font-weight: 500; font-size: 16px; line-height: 1.3; }
.appt-d span { display: block; margin-top: 2px; font-size: 14px; color: var(--ink-2); }
.appt.past { opacity: .55; }
.appt.now { border-color: var(--red); }
.appt.now .appt-k { color: var(--red); }

/* Count strip: each cell jumps to its tab. */
.counts { margin-top: 12px; display: grid; grid-template-columns: repeat(3, 1fr); }
.count { background: none; border: 0; border-left: 1px solid var(--line); padding: 12px 6px 11px; text-align: center; transition: background-color .15s ease; }
.count:first-child { border-left: 0; }
.count:hover { background: #FBF8F4; }
.count b { display: block; font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.1; color: var(--red); }
.count span { display: block; margin-top: 2px; font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }

/* ---------- Sections ---------- */
.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-family: var(--serif); font-weight: 400; font-size: 23px; line-height: 1.2; }
.section-head .aside { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.lead { margin-top: 22px; color: var(--ink-2); font-size: 15.5px; font-weight: 300; max-width: 40ch; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 2px; }
.rows > * + * { border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 62px 1fr; gap: 14px; padding: 13px 16px; align-items: start; transition: background-color .15s ease; }
.row.tickrow { grid-template-columns: 26px 1fr; cursor: pointer; }
.row.billrow { grid-template-columns: 26px 1fr auto; cursor: pointer; }
.when { font-family: var(--serif); font-size: 19px; line-height: 1.2; color: var(--ink); }
.when small { display: block; font-family: var(--sans); font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 1px; }
.what { min-width: 0; }
.what b { display: block; font-weight: 500; font-size: 16px; line-height: 1.35; }
.what .meta { display: block; margin-top: 2px; }
.meta { font-size: 14px; color: var(--ink-2); font-weight: 400; }
.cal { display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.cal.work { color: var(--red); }
.row.now { background: #FBF8F4; }
.row.past .when, .row.past .what b { color: var(--muted); }
.row.past .what .meta, .row.past .cal { color: var(--muted); }
.now-tag { color: var(--red); }
[hidden] { display: none !important; }

.chip { display: inline-block; margin-top: 8px; font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; padding: 4px 8px 3px; border-radius: 2px; background: var(--tint); color: var(--red); white-space: nowrap; }
.chip.soft { background: var(--tint-farm); color: var(--ink-2); }
.chip.plain { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); }
.chip.ok { background: transparent; box-shadow: inset 0 0 0 1px var(--gold-rule); color: var(--ink-2); }

/* Tick boxes */
.tick { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; margin: 1px 0 0; border: 1.5px solid var(--rule); border-radius: 2px; background: var(--card); cursor: pointer; display: grid; place-content: center; transition: border-color .15s ease, background-color .15s ease; }
.tick:hover { border-color: var(--gold); }
.tick:checked { background: var(--red); border-color: var(--red); }
.tick:checked::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.done .what b { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--rule); text-decoration-thickness: 1px; }
.done .what .meta, .done .amount { color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; font-size: 12px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; padding: 0 18px; border-radius: 2px; border: 1px solid var(--red); background: var(--red); color: #fff; transition: background-color .15s ease, color .15s ease, border-color .15s ease; }
.btn:hover { background: var(--red-deep); border-color: var(--red-deep); }
.btn.ghost { background: transparent; color: var(--red); }
.btn.ghost:hover { background: var(--tint); }
.btn:disabled { opacity: .4; cursor: default; }

.add { display: flex; gap: 8px; margin-top: 12px; }
.add input, textarea { flex: 1; min-width: 0; font-size: 16px; padding: 11px 14px; min-height: 44px; border: 1px solid var(--line); border-radius: 2px; background: var(--card); transition: border-color .15s ease; }
.add input:hover, textarea:hover { border-color: var(--rule); }
.add input:focus, textarea:focus { border-color: var(--red); outline: none; }
::placeholder { color: var(--muted); opacity: 1; }

.divider { display: flex; align-items: center; gap: 12px; margin: 34px auto 0; max-width: 200px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--gold-rule); }
.divider i { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.sample { margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--muted); }

/* Listings */
.listing { padding: 18px 18px 6px; }
.listing + .listing { margin-top: 14px; }
.biz { display: inline-block; font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; padding: 4px 11px 3px; border-radius: 999px; color: var(--red); background: var(--tint); }
.biz.commercial { background: transparent; box-shadow: inset 0 0 0 1px var(--rule); color: var(--ink-2); }
.biz.farm { background: var(--tint-farm); color: var(--ink-2); }
.addr { margin-top: 12px; font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.2; }
.town { font-size: 14.5px; color: var(--ink-2); margin-top: 2px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 16px -18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats div { padding: 12px 6px; text-align: center; }
.stats div + div { border-left: 1px solid var(--line); }
.stats strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 1.15; }
.stats strong.warn { color: var(--red); }
.stats span { display: block; margin-top: 2px; font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sub-h { font-family: var(--serif); font-weight: 400; font-size: 18px; line-height: 1.25; color: var(--ink); margin: 18px 0 4px; }
.notes { list-style: none; margin: 0; padding: 0 0 12px; }
.notes li { font-size: 14.5px; color: var(--ink-2); padding: 7px 0; line-height: 1.45; }
.notes li + li { border-top: 1px solid var(--line); }
.notes li.none { color: var(--muted); }

/* Segmented control */
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: #EDE7DC; border-radius: 2px; margin-top: 20px; }
.seg button { border: 0; border-radius: 2px; background: transparent; min-height: 40px; font-size: 12px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); transition: background-color .15s ease, color .15s ease; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--red); box-shadow: 0 0 0 1px var(--line); }
.month { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 12px; }
.month h2 { font-family: var(--serif); font-weight: 400; font-size: 23px; }
.month .btn { min-height: 40px; padding: 0 14px; border-color: var(--rule); color: var(--ink-2); letter-spacing: .14em; }
.month .btn:hover { background: var(--card); border-color: var(--gold-rule); }

/* Rent and lease cards */
.prop { padding: 16px; display: grid; gap: 12px; }
.prop + .prop { margin-top: 12px; }
.prop.late { border-color: var(--red); }
.prop-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.prop-top h3 { font-family: var(--serif); font-weight: 400; font-size: 20px; line-height: 1.25; }
.prop-top .people { font-size: 14px; color: var(--ink-2); margin-top: 3px; }
.amt { font-family: var(--serif); font-size: 22px; white-space: nowrap; }
.prop .chip { margin-top: 0; justify-self: start; }
.extra { font-size: 14px; color: var(--ink-2); background: var(--tint-farm); padding: 8px 12px; border-radius: 2px; }
.pay { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 2px; cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.pay label:hover { border-color: var(--gold-rule); }
.pay label:has(.tick:checked) { background: #FBF8F4; }
.pay span { display: block; font-size: 14.5px; font-weight: 500; line-height: 1.3; }
.pay small { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.draft { background: var(--paper); border: 1px solid var(--line); border-radius: 2px; padding: 12px 14px; font-size: 15px; line-height: 1.55; color: var(--ink); }
.draft .meta { display: block; margin-top: 8px; font-size: 13px; color: var(--muted); }
.dates { display: grid; gap: 0; margin: 0; }
.dates div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.dates div:first-child { border-top: 0; padding-top: 0; }
.dates dt { color: var(--ink-2); }
.dates dd { margin: 0; font-weight: 500; text-align: right; }
.prop .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Rentals: one quiet list, no boxes inside boxes */
.rents > .rent + .rent { border-top: 1px solid var(--line); }
.rent { padding: 16px 18px; }
.rent-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.rent-top h3 { font-family: var(--serif); font-weight: 400; font-size: 20px; line-height: 1.25; }
.rent .people { margin-top: 2px; font-size: 14px; color: var(--muted); }
.rent .status { margin-top: 8px; font-size: 15px; color: var(--ink-2); }
.rent .status + .status { margin-top: 2px; }
.rent .status.late { color: var(--red); font-weight: 500; }
.rent .status.muted { color: var(--muted); }
.rent.vacant .amt, .rent.vacant h3 { color: var(--muted); }
.ticks { display: flex; gap: 24px; margin-top: 12px; }
.ticks label { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; min-height: 32px; }
.ticks .tick { margin: 0; }
.link { background: none; border: 0; padding: 8px 0 0; font-size: 15px; font-weight: 500; color: var(--red); text-decoration: underline; text-decoration-color: var(--tint); text-underline-offset: 4px; text-decoration-thickness: 2px; transition: text-decoration-color .15s ease; }
.link:hover { text-decoration-color: var(--red); }
.link:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.links { display: flex; gap: 22px; }
.rent .draft { margin-top: 10px; }
.month .link { padding: 0; font-size: 14px; }
.lfields { margin-top: 14px; }
.lfields dd.warn { color: var(--red); }


/* Listings: two quiet rows instead of sub-headed lists */
.listing { padding: 18px 18px 4px; }
.l-rows { margin-top: 14px; }
.l-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.l-k { font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.l-v { font-size: 15.5px; font-weight: 500; text-align: right; }
.l-v .muted, .l-v.muted { color: var(--muted); font-weight: 400; }
.l-mail { display: block; }
.l-mail summary { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; list-style: none; cursor: pointer; }
.l-mail summary::-webkit-details-marker { display: none; }
.l-show { margin-left: 10px; font-size: 14px; color: var(--red); text-decoration: underline; text-decoration-color: var(--tint); text-underline-offset: 4px; text-decoration-thickness: 2px; }
.l-mail[open] .l-show { font-size: 0; }
.l-mail[open] .l-show::after { content: "Hide"; font-size: 14px; }
.l-mail .notes { margin-top: 8px; padding-bottom: 0; }
.l-mail .notes li { font-size: 15px; }

/* Calls */
.compose { padding: 16px; display: grid; gap: 12px; }
.compose label { font-family: var(--serif); font-size: 20px; }
textarea { min-height: 128px; resize: vertical; line-height: 1.5; }
.filed { padding: 16px; margin-top: 12px; }
.filed h2 { font-family: var(--serif); font-weight: 400; font-size: 19px; margin-bottom: 4px; }
.filed ul { list-style: none; margin: 0; padding: 0; }
.filed li { font-size: 14.5px; color: var(--ink-2); padding: 7px 0; }
.filed li + li { border-top: 1px solid var(--line); }
.filed li b { font-weight: 500; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.chips .chip { margin-top: 6px; }

/* Bills */
.amount { font-family: var(--serif); font-size: 19px; white-space: nowrap; padding-top: 1px; }

/* ---------- Tabs: text only, no icons ---------- */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--card); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom, 0px); padding-inline: max(2px, env(safe-area-inset-left, 0px)); }
nav.tabs .in { max-width: 480px; margin: 0 auto; display: flex; justify-content: space-between; padding-inline: 6px; }
nav.tabs button { position: relative; flex: 0 1 auto; white-space: nowrap; background: transparent; border: 0; min-height: 56px; padding: 0 4px; font-size: 13px; font-weight: 400; letter-spacing: .01em; color: var(--muted); transition: color .15s ease; }
nav.tabs button::before { content: ""; position: absolute; top: -1px; left: 4px; right: 4px; height: 2px; background: var(--red); transform: scaleX(0); transition: transform .25s var(--ease); }
nav.tabs button:hover { color: var(--ink); }
nav.tabs button[aria-current="page"] { color: var(--red); font-weight: 500; }
nav.tabs button[aria-current="page"]::before { transform: scaleX(1); }

@media (max-width: 380px) { nav.tabs button { font-size: 12px; padding: 0 2px; } }
@media (max-width: 359px) { nav.tabs button { font-size: 11px; } .fields dd { font-size: 15.5px; } }
@media (prefers-reduced-motion: reduce) { *, *::before { transition: none !important; animation: none !important; } }

/* ---------- Offline / load notes (app only) ---------- */
.offline-note { margin-top: 10px; font-size: 13px; letter-spacing: .02em; color: var(--on-red-2); }
.load-error { padding: 40px 0; color: var(--ink-2); text-align: center; }

/* ---------- Computer layout (Windows app window or a wide browser) ----------
   Tabs move to a left sidebar; content spreads into two columns. Phones are unchanged. */
@media (min-width: 960px) {
  body { padding-left: 232px; }
  nav.tabs { top: 0; bottom: 0; left: 0; right: auto; width: 232px; border-top: 0; border-right: 1px solid var(--rule); padding: 28px 0 0; }
  nav.tabs .in { flex-direction: column; justify-content: flex-start; gap: 2px; max-width: none; padding: 0 16px; }
  nav.tabs button { text-align: left; min-height: 44px; padding: 0 14px; font-size: 15.5px; border-radius: 2px; transition: color .15s ease, background-color .15s ease; }
  nav.tabs button::before { display: none; }
  nav.tabs button:hover { background: #FBF8F4; }
  nav.tabs button[aria-current="page"] { background: var(--tint); }

  .screen { padding-bottom: 64px; }
  .wrap { max-width: 1080px; padding-inline: 40px; }
  .band { padding-top: 24px; }
  .band .wrap { padding-bottom: 72px; }
  .band h1 { font-size: 36px; margin-top: 22px; }
  .mark.lockup { height: 64px; }

  /* Today: Up next and the counts side by side */
  .home-top { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; align-items: stretch; }
  .home-top .counts { margin-top: -40px; position: relative; }
  .home-top .count { display: flex; flex-direction: column; justify-content: center; }
  .home-top .count b { font-size: 32px; }

  /* Two columns of sections */
  #s-home > .wrap:last-child, #s-calls > .wrap:last-child, #s-bills > .wrap:last-child, #s-jm > .wrap:last-child {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; align-items: start;
  }
  #s-home > .wrap:last-child > .section:first-child { grid-row: span 2; }
  .wrap > .divider, .wrap > .sample, .wrap > .offline-note { grid-column: 1 / -1; }

  /* Listings as a grid of cards */
  #s-listings > .wrap:last-child > .section { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
  .listing + .listing { margin-top: 0; }

  /* Rentals and To-do read best at a comfortable width */
  #s-rentals > .wrap, #s-todo > .wrap { max-width: 820px; margin-left: max(0px, calc((100% - 1080px) / 2)); margin-right: auto; }
}

/* ---------- Sign-in helper ---------- */
a.btn, a.link { text-decoration: none; }
a.link { display: inline-block; text-decoration: underline; text-decoration-color: var(--tint); text-underline-offset: 4px; text-decoration-thickness: 2px; }
a.link:hover { text-decoration-color: var(--red); }
.signin-card .btn { margin-top: 18px; }
body.signin nav.tabs { display: none; }
body.signin .screen { padding-bottom: 40px; }
@media (min-width: 960px) { body.signin { padding-left: 0; } }
.save-error { margin: 0 auto; max-width: 480px; padding: 10px var(--pad) 0; font-size: 14px; color: var(--ink-2); }
.signout { margin-top: 28px; text-align: center; }
.signout .link { font-size: 14px; color: var(--muted); padding-top: 0; }
@media (min-width: 960px) { .save-error { max-width: 1080px; padding-inline: 40px; } .signout { grid-column: 1 / -1; } }

