:root {
  --ink: #1a1a1a;
  --ink2: #444444;
  --muted: #5a5a5a;
  --line: #e7e2d6;
  --bg: #f8f4eb;
  --card: #ffffff;
  --chip: #f0e9d6;
  --mustard: #ebbd06;
  --mustard-d: #8a6d00;
  --ok: #2f6b45;
  --ok-bg: #e6f0e8;
  --warn: #9a5b00;
  --warn-bg: #fdf1d6;
  --err: #b42318;
  --err-bg: #fbe9e7;
  --side: #1a1a1a;
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Lexend Deca', system-ui, sans-serif; font-weight: 400; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; font-size: 15px; }
h1, h2, h3, .t { font-family: Archivo, 'Helvetica Neue', Arial, sans-serif; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100dvh; }
.side { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; background: var(--side); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; }
.content { flex: 1; padding: 20px 16px 110px; max-width: 1180px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 10px; font-size: 11px; font-weight: 500; text-decoration: none; color: var(--muted); min-height: 56px; }
.tabbar a.on { color: var(--ink); font-weight: 600; }
.tabbar a.on svg { stroke: var(--ink); }
.tabbar a .badge { position: absolute; margin-left: 22px; margin-top: -2px; }
@media (min-width: 900px) {
  .side { display: flex; flex-direction: column; gap: 4px; width: 256px; flex-shrink: 0; background: var(--side); color: #fff; padding: 22px 14px; position: sticky; top: 0; height: 100dvh; }
  .side nav { display: flex; flex-direction: column; gap: 2px; margin-top: 22px; }
  .side nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #d6d6d6; text-decoration: none; font-weight: 500; }
  .side nav a svg { stroke: #d6d6d6; }
  .side nav a:hover { background: #2a2a2a; }
  .side nav a.on { background: #2f2f2f; color: #fff; }
  .side nav a.on svg { stroke: var(--mustard); }
  .side .foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: #bdbdbd; }
  .top, .tabbar { display: none; }
  .content { padding: 28px 32px 48px; }
}

/* ---------- logo ---------- */
.lockup { display: inline-grid; grid-template-columns: auto auto auto; align-items: center; column-gap: 10px; row-gap: 4px; text-decoration: none; color: #fff; }
.lockup img { height: 22px; width: auto; }
.lockup .rule { width: 1px; height: 22px; background: rgba(255,255,255,0.25); }
.lockup .word { display: inline-flex; align-items: center; gap: 6px; font-family: Archivo, sans-serif; font-weight: 600; font-size: 17px; letter-spacing: -0.015em; }
.lockup .by { grid-column: 3; font-family: Archivo, sans-serif; font-size: 7px; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.5); white-space: nowrap; }
.lockup.light { color: var(--ink); }
.lockup.light .rule { background: rgba(26,26,26,0.2); }
.lockup.light .by { color: rgba(90,90,90,0.8); }

/* ---------- pieces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.tight { padding: 0; gap: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-h a, .more { font-size: 13px; font-weight: 600; color: var(--ink2); text-decoration: underline; text-underline-offset: 3px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr; }
.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g21 { grid-template-columns: 2fr 1fr; } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi .v { font-family: Archivo, sans-serif; font-weight: 800; font-size: 26px; letter-spacing: -0.02em; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi .s { font-size: 12px; color: var(--muted); }
.sub { font-size: 13px; color: var(--muted); }
.label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list > * + * { border-top: 1px solid var(--line); }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; color: inherit; min-width: 0; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; }
a.li:hover, button.li:hover { background: #fcfaf5; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.crumb { font-size: 13px; color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: none; background: var(--ink); color: #fff; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.ghost { background: var(--chip); color: var(--ink); }
.btn.line { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.mustard { background: var(--mustard); color: var(--ink); }
.btn.danger { background: var(--err-bg); color: var(--err); }
.btn.block { width: 100%; min-height: 52px; }
.btn[disabled] { opacity: 0.45; cursor: default; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 18px; background: #fff; border: 1px solid var(--line); font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .sw { width: 10px; height: 10px; border-radius: 5px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs a { padding: 10px 12px; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--mustard); }

.bar { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
.bar.big { height: 12px; border-radius: 6px; }
.bar.done > i { background: var(--ok); }
.pct { font-family: Archivo, sans-serif; font-weight: 800; }

.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--chip); color: var(--ink2); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); }
.pill.dark { background: var(--ink); color: #fff; }
.pill.mus { background: var(--mustard); color: var(--ink); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--err); color: #fff; font-size: 11px; font-weight: 700; }

.av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-family: Archivo, sans-serif; font-weight: 700; flex-shrink: 0; }
.ic { width: 42px; height: 42px; border-radius: 10px; background: var(--chip); display: flex; align-items: center; justify-content: center; font-family: Archivo, sans-serif; font-size: 10px; font-weight: 800; flex-shrink: 0; letter-spacing: 0.02em; }

/* person-coloured to-do */
.todo { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-left: 5px solid var(--c, #999); background: #fff; }
.todo + .todo { border-top: 1px solid var(--line); }
.todo .tick { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--c, #999); background: #fff; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; padding: 0; margin-top: 1px; }
.todo .tick:hover { background: var(--chip); }
.todo .tx { font-weight: 500; }
.todo .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 3px; align-items: center; }
.todo .meta a { color: var(--muted); }
.phead { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: color-mix(in srgb, var(--c) 10%, #fff); border-bottom: 1px solid var(--line); }

/* forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.f label, .f .lab { font-size: 13px; font-weight: 600; color: var(--ink2); }
.f input, .f select, .f textarea { min-height: 46px; border-radius: 10px; border: 1px solid #d9d2c1; background: #fff; padding: 10px 12px; font-size: 16px; width: 100%; }
.f textarea { min-height: 90px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(235,189,6,0.35); }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 700px) { .checks { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.check { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.err { color: var(--err); font-size: 14px; font-weight: 600; min-height: 18px; }

/* service picker */
.svcs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 700px) { .svcs { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.svc { min-height: 72px; border-radius: 12px; background: #fff; border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 6px; cursor: pointer; text-align: center; font-size: 13px; font-weight: 600; line-height: 1.2; }
.svc .s { font-size: 11px; font-weight: 500; color: var(--muted); }
.svc.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.svc.on .s { color: #cfcfcf; }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; cursor: pointer; text-align: left; width: 100%; }
.opt.on { border-color: var(--ink); }

/* money */
.money .mrow { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.money .mrow:last-child { border-bottom: 0; }
.money .mrow.total { font-weight: 700; font-size: 17px; }
.money .mrow b { font-family: Archivo, sans-serif; }

/* photos */
.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 700px) { .photos { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.photos button { padding: 0; border: 0; background: var(--chip); border-radius: 10px; overflow: hidden; aspect-ratio: 1; cursor: pointer; position: relative; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .cap { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,0.65)); color: #fff; font-size: 11px; padding: 14px 6px 5px; text-align: left; }
.drop { border: 2px dashed #c9bfa6; border-radius: var(--r); background: #fffdf8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 22px; cursor: pointer; text-align: center; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.88); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; color: #fff; }
.lightbox img { max-width: 100%; max-height: 78vh; border-radius: 8px; }

/* timeline */
.when { width: 54px; flex-shrink: 0; text-align: center; border-radius: 10px; background: var(--chip); padding: 6px 0; line-height: 1.1; }
.when b { display: block; font-family: Archivo, sans-serif; font-size: 18px; }
.when span { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.when.urgent { background: var(--err-bg); }
.when.today { background: var(--mustard); }

/* map */
.map { height: 62vh; min-height: 380px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); z-index: 0; }
.mpin { width: 46px; height: 46px; border-radius: 50%; background: #fff; border: 4px solid var(--c); display: flex; align-items: center; justify-content: center; font-family: Archivo, sans-serif; font-weight: 800; font-size: 13px; color: var(--ink); box-shadow: 0 3px 10px rgba(0,0,0,0.3); }
.leaflet-popup-content { font-family: 'Lexend Deca', sans-serif; margin: 12px 14px; min-width: 200px; }

/* stage strip */
.stages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 900px) { .stages { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stage { display: flex; flex-direction: column; gap: 6px; }
.stage .n { font-size: 13px; font-weight: 600; }

/* misc */
.banner { background: var(--warn-bg); color: #5b3a00; font-size: 12px; font-weight: 500; padding: 7px 16px; text-align: center; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 200; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,0.25); }
@media (min-width: 900px) { .toast { bottom: 28px; } }
.empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.note { background: #fffaf0; border: 1px solid #f1e3b5; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.update { white-space: pre-wrap; font-size: 14px; line-height: 1.55; background: #fffdf8; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.sr { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.auth .hero { background: var(--side); color: #fff; padding: 36px 24px 30px; display: flex; flex-direction: column; gap: 14px; justify-content: flex-end; }
.auth .hero .tag { font-family: Archivo, sans-serif; font-weight: 800; font-size: 34px; line-height: 1.05; letter-spacing: -0.02em; }
.auth .hero .tag em { font-style: normal; color: var(--mustard); }
.auth form { padding: 28px 24px; max-width: 440px; width: 100%; margin: 0 auto; }
@media (min-width: 900px) { .auth { grid-template-columns: 1fr 1fr; } .auth .hero { padding: 56px; } .auth .hero .tag { font-size: 52px; } .auth form { align-self: center; } }
.hide-m { display: none; }
@media (min-width: 900px) { .hide-m { display: initial; } .hide-d { display: none; } }
