@font-face { font-family: "Caslon"; src: url(/fonts/caslon-display.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Albert"; src: url(/fonts/albert-sans.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --paper: #FCFBF9; --stone: #F2EEE7; --ink: #131211; --mute: #6B665E; --line: #E2DCD1; --red: #A8131B; --ok: #2E6B3A; --card: #fff;
  --tabh: 62px; --serif: "Caslon", Georgia, "Times New Roman", serif; --sans: "Albert", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16.5px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
body.noscroll { overflow: hidden; }
bdi { unicode-bidi: isolate; }
a { color: inherit; text-underline-offset: 3px; }
img { max-width: 100%; }
h1 { font: 400 clamp(30px, 7vw, 40px)/1.08 var(--serif); margin: 6px 0 6px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
h2 { font: 400 23px/1.2 var(--serif); margin: 30px 0 12px; }
h3 { font-size: 15px; font-weight: 650; margin: 16px 0 8px; letter-spacing: 0.01em; }
h3.sub { margin-top: 20px; }
p { margin: 0 0 12px; }
ul.plain { margin: 0 0 12px; padding-inline-start: 20px; }
.muted { color: var(--mute); }
.small { font-size: 14px; }
.red { color: var(--red); }
.pre { white-space: pre-line; }
.big { font: 400 28px/1.2 var(--serif); }
.top-gap { margin-top: 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.msg-body, .pre, .clamp2, .note-line, .summary, .linkbox { unicode-bidi: plaintext; text-align: start; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Shell */
.banner { background: var(--stone); border-bottom: 1px solid var(--line); text-align: center; padding: 6px 12px; font-size: 13px; letter-spacing: 0.02em; }
.shell { min-height: 100dvh; padding-bottom: calc(var(--tabh) + env(safe-area-inset-bottom) + 28px); }
body.with-bar .shell { padding-bottom: calc(var(--tabh) + env(safe-area-inset-bottom) + 96px); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 760px; margin: 0 auto; padding: 10px 18px 2px; }
.top img { height: 44px; width: auto; display: block; }
main { max-width: 760px; margin: 0 auto; padding: 4px 18px 24px; outline: none; }
.tabs { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(252, 251, 249, 0.97); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: var(--tabh); text-decoration: none; color: var(--mute); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.tabs svg { width: 23px; height: 23px; }
.tabs a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 2px 0 var(--red); }
@media (min-width: 900px) {
  .tabs { position: sticky; top: 0; bottom: auto; display: flex; justify-content: center; gap: 6px; border-top: 0; border-bottom: 1px solid var(--line); padding: 0; }
  .tabs a { flex-direction: row; gap: 8px; min-height: 50px; padding: 0 18px; font-size: 14.5px; }
  .tabs svg { width: 19px; height: 19px; }
  .tabs a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--red); }
  .shell, body.with-bar .shell { padding-bottom: 40px; }
  body.with-bar .shell { padding-bottom: 110px; }
  #app { display: flex; flex-direction: column; }
  #app > .banner { order: 0; } #app > .tabs { order: 2; } #app > .shell { order: 3; }
  .top { padding-top: 14px; }
}

/* Buttons and links */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 1px solid var(--ink); background: var(--ink); color: #fff;
  font: 600 15.5px/1.2 var(--sans); border-radius: 3px; text-decoration: none; cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.red { background: var(--red); border-color: var(--red); }
.btn.block { width: 100%; }
.btn.sm { min-height: 44px; padding: 0 13px; font-size: 14.5px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.link { background: none; border: 0; padding: 10px 2px; min-height: 44px; color: var(--mute); font: 500 15px var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.backlink { display: inline-flex; align-items: center; min-height: 44px; color: var(--mute); font-size: 15px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.strong { font-weight: 650; text-decoration: none; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn { position: relative; }

/* Pills, tags, chips */
.pill { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--stone); white-space: nowrap; line-height: 1.5; }
.pill.us { background: #fff; box-shadow: inset 0 0 0 1px var(--ink); }
.pill.ok { background: #E8F0E6; color: var(--ok); }
.pill.soft { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--mute); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 4px; }
.tag-test { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; color: var(--red); border: 1px solid var(--red); border-radius: 3px; padding: 0 5px; margin-inline-start: 8px; vertical-align: 3px; line-height: 1.6; font-family: var(--sans); }
.flags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.flag { font-size: 12px; color: var(--mute); border: 1px solid var(--line); border-radius: 3px; padding: 0 6px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; padding-bottom: 6px; }
.chip { flex: none; min-height: 42px; padding: 0 15px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 99px; font: 500 14.5px var(--sans); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.count { font: 500 14px var(--sans); color: var(--mute); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); display: inline-block; flex: none; margin-top: 7px; }
.dot.off { background: var(--line); }

/* Cards, lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 16px; margin: 0 0 12px; }
.card-title { margin: 0 0 12px; }
.nums { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0 4px; }
@media (min-width: 640px) { .nums { grid-template-columns: repeat(4, 1fr); } }
.num { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 14px 14px 12px; }
.num b { display: block; font: 400 36px/1 var(--serif); margin-bottom: 6px; }
.num span { font-size: 13px; color: var(--mute); }
.row-list { list-style: none; margin: 0 0 8px; padding: 0; border-top: 1px solid var(--line); }
.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line); text-decoration: none; min-height: 58px; }
.row:hover { background: rgba(242, 238, 231, 0.45); }
.row-main { min-width: 0; flex: 1; }
.row-title { overflow-wrap: anywhere; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; text-align: end; }
.group { display: flex; align-items: baseline; gap: 8px; }
.empty { color: var(--mute); padding: 10px 0; margin: 0; }
.todos { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.todo { display: flex; gap: 12px; align-items: flex-start; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.todo-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.todo-main a { text-decoration: none; }
.todos.compact { margin: 10px 0 0; }
.visit .visit-top { display: flex; gap: 8px; align-items: center; margin-bottom: 2px; }
.vtime { font: 400 26px/1.1 var(--serif); }
.note-line { margin-top: 6px; }
.items { list-style: none; margin: 0 0 8px; padding: 0; }
.line-item { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line-item.q { justify-content: space-between; flex-wrap: nowrap; }
.line-item.q > span { white-space: nowrap; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: minmax(104px, 34%) 1fr; gap: 8px 14px; margin: 0 0 8px; }
.kv dt { color: var(--mute); font-size: 14.5px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; margin: 10px 0; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); display: block; background: var(--stone); }
.summary { margin: 14px 0 0; }
.linkbox { background: var(--stone); padding: 10px 12px; border-radius: 4px; font-size: 14px; overflow-wrap: anywhere; direction: ltr; text-align: start; }

/* Next step */
.next { background: #fff; border: 1px solid var(--ink); border-radius: 6px; padding: 16px; margin: 18px 0 8px; }
.next h2 { margin: 2px 0 8px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--red); }
[dir="rtl"] .eyebrow { letter-spacing: 0; }
.appt { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }

/* Sections */
details.sec { border-top: 1px solid var(--line); }
details.sec > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 16px 0 14px; font: 400 22px/1.2 var(--serif); min-height: 52px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: "+"; font: 400 22px var(--sans); color: var(--mute); margin-inline-start: auto; }
details.sec[open] > summary::after { content: "\2212"; }
details.sec > summary .count { font-size: 14px; }
.timeline { list-style: none; padding: 0; margin: 0 0 14px; }
.timeline li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.timeline time { color: var(--mute); font-size: 13px; }
.msgs { list-style: none; padding: 0; margin: 0 0 14px; }
.msg { border-bottom: 1px solid var(--line); padding: 12px 0; cursor: pointer; }
.msg-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.msg-body { white-space: pre-line; font-size: 14.5px; margin-top: 6px; color: #33302B; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.msg.open .msg-body { display: block; -webkit-line-clamp: unset; }

/* Forms */
.field { display: block; margin: 0 0 13px; font-weight: 550; font-size: 15px; }
.field input, .field select, .field textarea, .colour-row input, .punch-row input:not([type=checkbox]) {
  display: block; width: 100%; margin-top: 6px; font: 16px/1.4 var(--sans); padding: 11px 12px; border: 1px solid var(--line); border-radius: 3px; background: #fff; color: var(--ink); min-height: 46px; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 1px var(--ink); }
.field input[aria-invalid="true"] { border-color: var(--red); }
.field input:disabled, .field textarea:disabled { background: var(--stone); color: var(--mute); }
.field .muted { font-weight: 400; display: block; margin-top: 4px; }
.search input { margin-top: 10px; }
.check { display: flex; gap: 11px; align-items: flex-start; margin: 0 0 13px; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--ink); margin: 1px 0 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 10px; }
@media (max-width: 420px) { .grid2.stack-sm { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .grid3.qmeta { grid-template-columns: 1fr 1fr; } .grid3.qmeta > :last-child { grid-column: 1 / -1; } }
.err { background: #FBEDEE; color: var(--red); border-radius: 4px; padding: 10px 12px; margin: 0 0 12px; font-size: 14.5px; }
.err ul, .note ul { margin: 6px 0 0; padding-inline-start: 20px; }
.note { background: var(--stone); border-inline-start: 3px solid var(--red); padding: 11px 13px; border-radius: 4px; margin: 0 0 12px; font-size: 15px; }
.note.soft { border-inline-start-color: var(--line); }
.note.ok { border-inline-start-color: var(--ok); background: #EEF4EC; }
.note.warn { border-inline-start-color: var(--red); }
.colour-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.colour-row input { margin: 0; }
.colour-row .link { justify-self: start; }
@media (min-width: 640px) { .colour-row { grid-template-columns: repeat(4, 1fr) auto; } }
.punch-row { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.punch-row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--ink); flex: none; }
.punch-row input:not([type=checkbox]) { margin: 0; }

/* Visit sheet */
.area-card h3 { margin-top: 14px; }
.coats-row { display: flex; align-items: center; justify-content: space-between; margin: 14px 0; font-weight: 550; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.stepper button { width: 48px; height: 46px; border: 0; background: none; font: 500 22px var(--sans); cursor: pointer; color: var(--ink); }
.stepper span { min-width: 34px; text-align: center; font: 600 17px var(--sans); }
.add-area { margin-top: 4px; }
.bar { position: fixed; inset-inline: 0; bottom: calc(var(--tabh) + env(safe-area-inset-bottom)); z-index: 26; display: flex; gap: 12px; align-items: center;
  padding: 10px 18px; background: rgba(252, 251, 249, 0.97); border-top: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.bar .status { flex: 1; font-size: 13.5px; color: var(--mute); }
@media (min-width: 900px) { .bar { bottom: 0; justify-content: flex-end; padding-inline: max(18px, calc((100vw - 760px) / 2 + 18px)); } }

/* Quote */
.qline { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 12px 12px 4px; margin-bottom: 10px; }
.qline-top { display: grid; grid-template-columns: 1fr 140px; gap: 10px; }
.qline-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.qline-foot .check { margin: 0; }
.price input { font-variant-numeric: tabular-nums; text-align: end; direction: ltr; }
.bad-price { color: var(--red); font-size: 13px; font-weight: 500; }
.total { display: flex; justify-content: space-between; font: 400 28px var(--serif); border-top: 2px solid var(--ink); padding-top: 12px; margin-top: 14px; }

/* Calendar */
.cal-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.cal-nav .btn:last-child { margin-inline-start: auto; }
.cal-day { border-top: 1px solid var(--line); padding: 4px 0 10px; }
.cal-day.is-today .day-title { color: var(--red); }
.day-title { font-size: 20px; margin: 14px 0 8px; }
.cal-item > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.cal-item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 10px; padding: 10px 12px; margin: 0 0 6px; border-radius: 4px; background: #fff; border: 1px solid var(--line); text-decoration: none; min-height: 46px; }
.cal-item.blocked { background: var(--stone); border-style: dashed; }
.cal-item.job { border-inline-start: 3px solid var(--ink); }
.cal-item.visit.done { opacity: 0.6; }
.tagline { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--mute); }

/* Agents, settings */
.agent-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.agent-head h3 { margin: 0; font: 400 20px var(--serif); }
.agent.off { background: var(--stone); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; font-weight: 600; min-height: 44px; }
.switch input { appearance: none; -webkit-appearance: none; width: 48px; height: 28px; border-radius: 99px; background: var(--line); position: relative; margin: 0; cursor: pointer; transition: background 0.2s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s; }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(20px); }
[dir="rtl"] .switch input:checked::after { transform: translateX(-20px); }
.ticks { list-style: none; margin: 0; padding: 0; }
.ticks li { display: flex; gap: 11px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.tick { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex: none; margin-top: 2px; position: relative; }
.tick.on { background: var(--ok); border-color: var(--ok); }
.tick.on::after { content: ""; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.menu { display: flex; flex-direction: column; }
.menu-item { text-align: start; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 15px 4px; font: 500 16.5px var(--sans); color: var(--ink); cursor: pointer; min-height: 52px; }
.menu-item:hover { background: var(--stone); }

/* Floating button, sheets, toast */
.fab { position: fixed; inset-inline-end: 18px; bottom: calc(var(--tabh) + env(safe-area-inset-bottom) + 16px); z-index: 25; border-radius: 99px; box-shadow: 0 6px 18px rgba(19, 18, 17, 0.2); padding: 0 22px; }
@media (min-width: 900px) { .fab { bottom: 28px; inset-inline-end: max(18px, calc((100vw - 760px) / 2)); } }
.sheet-back { position: fixed; inset: 0; z-index: 50; background: rgba(19, 18, 17, 0.38); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.15s ease-out; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; display: flex; flex-direction: column; background: var(--paper); border-radius: 14px 14px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.14); animation: rise 0.2s cubic-bezier(0.22, 1, 0.36, 1); }
@media (min-width: 700px) { .sheet-back { align-items: center; } .sheet { border-radius: 10px; } }
.sheet header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.sheet header h2 { margin: 0; font-size: 22px; outline: none; }
.sheet .body { overflow: auto; padding: 16px 18px 8px; flex: 1; -webkit-overflow-scrolling: touch; }
.sheet footer { display: flex; gap: 10px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sheet footer .btn { flex: 1; }
.dayhead { font-weight: 650; margin: 14px 0 8px; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot { min-width: 96px; min-height: 46px; padding: 0 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 3px; font: 550 15px var(--sans); cursor: pointer; }
.slot[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.toast { position: fixed; inset-inline: 16px; bottom: calc(var(--tabh) + env(safe-area-inset-bottom) + 16px); margin: 0 auto; max-width: 480px; z-index: 70;
  background: var(--ink); color: #fff; padding: 13px 16px; border-radius: 6px; font-size: 15px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22); animation: rise 0.2s ease-out; }
.toast.bad { background: var(--red); }
body.with-bar .toast { bottom: calc(var(--tabh) + env(safe-area-inset-bottom) + 84px); }
@media (min-width: 900px) { .toast { bottom: 28px; } body.with-bar .toast { bottom: 96px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet-back, .sheet, .toast { animation: none; } }

/* Sign-in */
.signin { max-width: 380px; margin: 10vh auto 0; padding: 24px 22px; text-align: center; }
.signin img { width: 200px; height: auto; }
.signin h1 { margin-bottom: 18px; }
.signin .field { text-align: start; }
.signin input { text-align: center; font-size: 26px !important; letter-spacing: 0.32em; direction: ltr; }
.boot { padding: 30vh 0 0; text-align: center; color: var(--mute); }
