:root {
  --bg: #f6f5f1; --card: #fff; --ink: #1d2422; --muted: #66706d; --line: #e2e0d8; --brand: #1f5f5b; --brand-ink: #fff;
  --accent: #f2b950; --good: #2e7d4f; --warn: #b26b00; --bad: #b3261e; --soft: #eef3f2;
  --airbnb: #e0565b; --vrbo: #2459a8; --booking: #0b3c8c; --direct: #2e7d4f; --owner: #7a5c99; --other: #66706d; --block: #9aa09e;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141817; --card: #1d2321; --ink: #e8ecea; --muted: #9aa4a0; --line: #2f3734; --brand: #4fa59d; --brand-ink: #0d1211;
    --soft: #23302d; --shadow: none; color-scheme: dark; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pad { padding: 1rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

header#top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem;
  background: var(--brand); color: var(--brand-ink); flex-wrap: wrap; }
header#top a { color: var(--brand-ink); text-decoration: none; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.05rem; }
#nav { display: flex; gap: .15rem; flex-wrap: wrap; flex: 1; }
#nav a { padding: .35rem .6rem; border-radius: 6px; opacity: .9; }
#nav a.on, #nav a:hover { background: rgba(255,255,255,.16); opacity: 1; }
#who { display: flex; gap: .75rem; align-items: center; font-size: .9rem; }
#who .link { color: var(--brand-ink); }
#who a.on { text-decoration: underline; text-underline-offset: 3px; }
#menu-btn { display: none; color: var(--brand-ink); font-size: 1.3rem; border: 0; }
#help-btn { color: var(--brand-ink); border-color: rgba(255,255,255,.45); padding: .25rem .7rem; font-size: .9rem; }
#help-btn[aria-expanded=true] { background: rgba(255,255,255,.16); }
@media (max-width: 860px) {
  #menu-btn { display: block; order: 2; }
  #help-btn { order: 1; margin-left: auto; }
  #nav { display: none; order: 5; flex-basis: 100%; flex-direction: column; }
  #nav.open { display: flex; }
  #who { order: 6; flex-basis: 100%; justify-content: space-between; }
  #nav:not(.open) ~ #who { display: none; }
}

main { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: .5rem; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.head h1 { margin: 0; }

button, .button { font: inherit; padding: .45rem .85rem; border-radius: 7px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; }
button:hover, .button:hover { border-color: var(--muted); }
button.primary, .button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.danger { color: var(--bad); }
button.ghost { background: transparent; }
button.big { padding: .8rem 1.2rem; font-size: 1.05rem; width: 100%; justify-content: center; }
button.link { border: 0; background: none; padding: 0; color: var(--brand); text-decoration: underline; }
button.link.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }

label { display: block; font-size: .88rem; color: var(--muted); margin-bottom: .6rem; }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: .2rem; }
input, select, textarea { font: inherit; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--ink); }
textarea { min-height: 5rem; resize: vertical; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--brand); }
label.check { display: flex; gap: .5rem; align-items: center; color: var(--ink); font-size: .95rem; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 600; padding: 0 .3rem; }
.hint { font-size: .82rem; color: var(--muted); margin: -.3rem 0 .6rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--soft); }
tr.dim td { opacity: .55; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .45rem; border-radius: 999px; background: var(--soft); color: var(--ink); white-space: nowrap; }
.badge.ch-airbnb { background: var(--airbnb); color: #fff; } .badge.ch-vrbo { background: var(--vrbo); color: #fff; }
.badge.ch-booking { background: var(--booking); color: #fff; } .badge.ch-direct { background: var(--direct); color: #fff; }
.badge.ch-owner { background: var(--owner); color: #fff; } .badge.good { background: #dff0e5; color: var(--good); }
.badge.warn { background: #fbecd2; color: var(--warn); } .badge.bad { background: #f8dcda; color: var(--bad); }
@media (prefers-color-scheme: dark) { .badge.good { background: #1f3a2a; color: #8fd3a8; } .badge.warn { background: #3d2f15; color: #f2c46d; } .badge.bad { background: #44201d; color: #f3a29c; } }

.alert { border-left: 4px solid var(--warn); background: var(--card); padding: .7rem 1rem; border-radius: 6px; margin-bottom: .75rem; box-shadow: var(--shadow); }
.alert.bad { border-color: var(--bad); }
.alert.good { border-color: var(--good); }
.stat { font-size: 1.6rem; font-weight: 700; }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 1rem; }
.stats .card { margin: 0; padding: .75rem 1rem; }
.stats .label { font-size: .8rem; color: var(--muted); }
.stats.wide-nums { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stats.wide-nums .stat { font-size: 1.2rem; font-variant-numeric: tabular-nums; }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain > li { padding: .5rem 0; border-bottom: 1px solid var(--line); }
ul.plain > li:last-child { border-bottom: 0; }
.checklist li { display: flex; gap: .6rem; align-items: flex-start; }
.checklist li label { margin: 0; color: var(--ink); font-size: 1rem; display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; flex: 1; }
.checklist li.done label { color: var(--muted); text-decoration: line-through; }
.progress { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; margin: .3rem 0 .6rem; }
.progress > span { display: block; height: 100%; background: var(--brand); }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .5rem .8rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--brand); font-weight: 600; }

/* Multi-property calendar */
.cal-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.cal { display: grid; min-width: max-content; }
.cal .cell { height: 66px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); position: relative; font-size: .72rem; }
.cal .dayhead { height: 42px; text-align: center; font-size: .72rem; color: var(--muted); padding-top: 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal .dayhead.wknd, .cal .cell.wknd { background: var(--soft); }
.cal .dayhead.today { color: var(--brand); font-weight: 700; }
.cal .name { position: sticky; left: 0; z-index: 2; background: var(--card); padding: .4rem .6rem; font-weight: 600; font-size: .85rem;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); height: 66px; overflow: hidden; display: flex; align-items: center; }
.cal .rate { position: absolute; bottom: 3px; left: 0; right: 0; text-align: center; color: var(--muted); }
.cal .bar { position: absolute; top: 6px; height: 26px; border-radius: 6px; color: #fff; font-size: .75rem; padding: 4px 6px; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; cursor: pointer; z-index: 1; text-decoration: none; }
.cal .bar.ch-airbnb { background: var(--airbnb); } .cal .bar.ch-vrbo { background: var(--vrbo); } .cal .bar.ch-booking { background: var(--booking); }
.cal .bar.ch-direct { background: var(--direct); } .cal .bar.ch-owner { background: var(--owner); } .cal .bar.ch-other { background: var(--other); }
.cal .bar.block { background: repeating-linear-gradient(45deg, var(--block), var(--block) 6px, #b6bbb9 6px, #b6bbb9 12px); color: #222; }
.cal .turn { position: absolute; top: 34px; left: 2px; font-size: .68rem; }
.cal .empty-click { position: absolute; inset: 0; cursor: cell; }

/* Rate calendar */
.months { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.month table { table-layout: fixed; }
.month td { height: 52px; padding: 3px; font-size: .75rem; border: 1px solid var(--line); }
.month td .d { color: var(--muted); }
.month td .r { font-weight: 700; font-size: .85rem; }
.month td.booked { background: var(--soft); }
.month td.booked .r { color: var(--muted); font-weight: 400; text-decoration: line-through; }
.month td.past { opacity: .35; }

.photos { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; }
.photos figcaption { font-size: .75rem; color: var(--muted); }

.msg { white-space: pre-wrap; background: var(--soft); border-radius: 8px; padding: .75rem; font-size: .92rem; margin: .5rem 0; }
.signin { max-width: 380px; margin: 3rem auto; text-align: center; }
.signin form { text-align: left; margin-top: 1rem; }
.signin button { width: 100%; justify-content: center; margin-top: .5rem; }

.modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow-y: auto; }
.modal { background: var(--card); border-radius: 12px; padding: 1.25rem; width: 100%; max-width: 620px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal h2 { margin-top: 0; }
.modal .actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .75rem; }

#toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translate(-50%, 150%); background: var(--ink); color: var(--bg); padding: .6rem 1rem;
  border-radius: 8px; z-index: 100; transition: transform .2s; max-width: 90vw; }
#toast.show { transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }

/* Cleaner phone view */
.job { display: block; text-decoration: none; color: inherit; }
.job .when { font-weight: 700; }
.job.changed { border-color: var(--warn); }
.sameday { color: var(--bad); font-weight: 600; }
@media (max-width: 600px) { main { padding: .6rem; } .card { padding: .8rem; } h1 { font-size: 1.3rem; } }
.grid > .card, .grid-2 > .card, .months > .card { margin-bottom: 0; }
.grid + .grid, .grid + .card, .card + .grid { margin-top: 1rem; }
.center { text-align: center; }

/* Reports */
.field { margin-bottom: .8rem; }
.flabel { display: block; font-size: .88rem; color: var(--muted); margin-bottom: .3rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
label.chip { display: inline-flex; align-items: center; gap: .35rem; margin: 0; padding: .3rem .6rem; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink); font-size: .85rem; cursor: pointer; background: var(--card); }
label.chip:has(input:checked) { background: var(--soft); border-color: var(--brand); }
label.chip input { width: 1rem; height: 1rem; margin: 0; }
details.picker { border: 1px solid var(--line); border-radius: 7px; padding: .45rem .6rem; background: var(--card); }
details.picker summary { cursor: pointer; }
details.picker[open] summary { margin-bottom: .5rem; }
details.picker .link { margin-top: .5rem; }
.filter { margin-bottom: .5rem; align-items: flex-start; }
.filter details.picker { flex: 1; min-width: 200px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: .2rem 0 .9rem; }
.seg label { margin: 0; padding: .4rem .8rem; color: var(--ink); font-size: .9rem; cursor: pointer; display: flex; gap: .4rem; align-items: center; }
.seg label + label { border-left: 1px solid var(--line); }
.seg label:has(input:checked) { background: var(--brand); color: var(--brand-ink); }
.seg input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; margin: 0; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
label.inline { display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
label.inline select { width: auto; }
#rout.busy { opacity: .55; transition: opacity .15s; }
.report-meta { margin-top: 0; }
.report-table th { padding: 0; }
.report-table th button.sort { all: unset; display: block; padding: .5rem; cursor: pointer; font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; width: 100%; box-sizing: border-box; }
.report-table th.num button.sort { text-align: right; }
.report-table th button.sort:focus-visible { outline: 2px solid var(--brand); }
.report-table tfoot td { border-top: 2px solid var(--line); border-bottom: 0; }
.chart { margin: 0 0 1rem; }
.chart .bars { display: grid; gap: .3rem; margin-top: .6rem; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 220px) 1fr minmax(70px, auto); gap: .6rem; align-items: center; font-size: .85rem; }
.bar-row .l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { height: 14px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.bar-row .b { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.bar-row .v { text-align: right; font-variant-numeric: tabular-nums; }
.chart .cols { display: flex; align-items: stretch; gap: 4px; height: 190px; margin-top: .6rem; overflow-x: auto; padding-bottom: .2rem; }
.chart .col { flex: 1 0 34px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 34px; }
.chart .col .b { width: 70%; background: var(--brand); border-radius: 4px 4px 0 0; }
.chart .col .v { font-size: .68rem; color: var(--muted); margin-bottom: 2px; white-space: nowrap; }
.chart .col .l { font-size: .68rem; color: var(--muted); margin-top: 4px; white-space: nowrap; height: 1.1em; }
.chart .b.neg { background: var(--bad); }
@media print {
  header#top, .no-print, #toast, .head a.small { display: none !important; }
  body { background: #fff; color: #000; }
  main { max-width: none; padding: 0; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .report-table th button.sort { padding: .3rem; }
  th, td { padding: .3rem; }
  .chart .b, .bar-row .b { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* The books: statements and journal entries */
.tabs.sub { border-bottom: 0; margin-bottom: .5rem; }
.tabs.sub a { border: 1px solid var(--line); border-radius: 999px; padding: .3rem .8rem; }
.tabs.sub a.on { background: var(--soft); border-color: var(--brand); }
table.statement td, table.statement th { padding: .35rem .5rem; }
table.statement tr.sec td { font-weight: 700; padding-top: .9rem; border-bottom: 1px solid var(--line); }
table.statement td.indent { padding-left: 1.4rem; }
table.statement tr.total td { font-weight: 600; border-top: 1px solid var(--line); }
table.statement tr.grand td { font-weight: 700; border-top: 2px solid var(--ink); }
table.statement thead th.num { white-space: nowrap; }
.modal.wide { max-width: 960px; }
table.lines td { padding: .25rem .3rem; vertical-align: middle; }
table.lines select, table.lines input { width: 100%; min-width: 6rem; }
@media print {
  #top, #nav, .tabs, #rf, .head button, #toast, #help { display: none !important; }
  .card { box-shadow: none; border: 0; }
}
.print-only { display: none; }
/* On a phone, a .stack table shows each row as a small block instead of columns. */
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack tr { display: block; padding: .5rem 0; border-bottom: 1px solid var(--line); }
  table.stack td { display: block; border: 0; padding: .1rem 0; }
  table.stack td[data-label] { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
  table.stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .85em; }
}
@media print {
  body.print-worksheets * { visibility: hidden; }
  body.print-worksheets .print-only { display: block; position: absolute; left: 0; top: 0; width: 100%; }
  body.print-worksheets .print-only, body.print-worksheets .print-only * { visibility: visible; }
  .worksheet { break-after: page; padding: 1rem 0; }
}
table.statement.cols tr:not(.sec) > td:first-child, table.statement.cols th:first-child { white-space: nowrap; position: sticky; left: 0; background: var(--card); z-index: 1; }

/* The Help panel, beside the page. */
#help { position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; width: min(380px, 100vw); overflow-y: auto; background: var(--card);
  border-left: 1px solid var(--line); box-shadow: -4px 0 18px rgba(0,0,0,.12); padding: 0 1.1rem 2rem; }
#help .help-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; background: var(--card);
  padding: .8rem 0 .5rem; font-size: 1.05rem; }
#help .help-head button { border: 0; font-size: 1.1rem; padding: .2rem .5rem; }
#help-q { width: 100%; margin-bottom: .5rem; }
#help h2 { margin-top: .8rem; }
#help h3 { margin-top: 1.5rem; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
#help ol { padding-left: 1.3rem; margin: .4rem 0 .8rem; }
#help li { margin-bottom: .35rem; }
#help .help-tip { background: var(--soft); border-left: 4px solid var(--accent); padding: .55rem .75rem; border-radius: 6px; }
#help .help-list { list-style: none; padding: 0; margin: 0; }
#help .help-list li { margin-bottom: .45rem; }
#help .help-list button { text-align: left; }
@media (max-width: 520px) { #help { width: 100vw; border-left: 0; } }
@media (min-width: 1100px) { body:has(#help:not([hidden])) main { margin-right: 380px; } body:has(#help:not([hidden])) header#top { padding-right: calc(380px + 1rem); } }
