[hidden] { display: none !important; }
:root { --ink: #26272b; --sub: #62656d; --line: #dcdbd3; --hi: #f6c417; --hi-ink: #3d3000; --paper: #fff; --wash: #f3f2ec; --ok: #1c7c43; --warn: #b4530a; --bad: #b3261e; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--wash); color: var(--ink); font: 16px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 10px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }

.top { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 5; }
.top .in { max-width: 1100px; margin: 0 auto; padding: 8px 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.top img { height: 44px; background: #fff; border-radius: 8px; padding: 2px 6px; margin-right: 8px; }
.top button { background: none; border: 0; color: #d9d9d4; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.top button.on { background: var(--hi); color: var(--hi-ink); }
.top .sp { flex: 1; }
.badge { background: var(--bad); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 12px; margin-left: 4px; }

main { max-width: 1100px; margin: 0 auto; padding: 18px 14px 80px; }
.head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.head .sp { flex: 1; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; text-decoration: none; }
.btn.pri { background: var(--hi); border-color: var(--hi); color: var(--hi-ink); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.bad { color: var(--bad); }
.btn.sm { min-height: 36px; padding: 5px 11px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 12px; }
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--sub); }
label.f > input, label.f > select, label.f > textarea { display: block; width: 100%; margin-top: 3px; }
input, select, textarea { border: 1.5px solid var(--line); border-radius: 9px; padding: 10px 11px; background: #fff; min-height: 44px; font-weight: 400; color: var(--ink); }
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
input[type=checkbox] { min-height: 0; width: 22px; height: 22px; accent-color: var(--ink); flex: none; }
.money { position: relative; display: block; }
.money::before { content: "£"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--sub); }
.money input { padding-left: 24px; width: 100%; text-align: right; font-variant-numeric: tabular-nums; }
.hint { color: var(--sub); font-size: 13px; }
.err { color: var(--bad); font-weight: 600; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 7px 14px; cursor: pointer; font-weight: 600; font-size: 14px; min-height: 38px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.list { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.item { display: grid; grid-template-columns: 110px 1fr auto auto; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; text-decoration: none; }
.item:last-child { border-bottom: 0; }
.item:hover { background: #fbfaf5; }
.item .num { font-weight: 700; font-variant-numeric: tabular-nums; }
.item .amt { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.st { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 12px; background: #ecebe4; white-space: nowrap; }
.st.enquiry { background: #fde2df; color: var(--bad); }
.st.sent { background: #dfeaff; color: #1a4fa8; }
.st.accepted, .st.paid { background: #dcf2e4; color: var(--ok); }
.st.declined { background: #eee; color: var(--sub); }
.st.unpaid { background: #ffeccf; color: var(--warn); }
.empty { padding: 36px 16px; text-align: center; color: var(--sub); }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.side { position: sticky; top: 74px; }
.xrow { display: grid; grid-template-columns: 26px 1fr 130px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #efeee8; }
.xrow:last-child { border-bottom: 0; }
.xrow .lbl small { color: var(--sub); display: block; }
.crow { display: grid; grid-template-columns: 1fr 130px 44px; gap: 8px; margin-bottom: 8px; }
.srow { display: grid; grid-template-columns: 84px 1fr 44px; gap: 8px; margin-bottom: 8px; }
.tot { display: flex; justify-content: space-between; padding: 5px 0; font-variant-numeric: tabular-nums; }
.tot.big { font-size: 22px; font-weight: 700; border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 10px; }
.tot.sub { color: var(--sub); font-size: 14px; }
.stage { border-top: 1px solid var(--line); padding: 10px 0; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 20; max-width: 90vw; }
.toast.bad { background: var(--bad); }
.login { max-width: 400px; margin: 9vh auto; padding: 0 14px; }
.login img { height: 96px; display: block; margin: 0 auto 14px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl td { padding: 4px 4px 4px 0; vertical-align: top; }
.tbl input, .tbl select { width: 100%; }
.confirm { background: #fff3f1; border: 1px solid #f0b8b2; border-radius: 10px; padding: 12px; margin-top: 10px; }
code.url { display: block; background: var(--wash); padding: 10px; border-radius: 8px; word-break: break-all; font-size: 13px; }

@media (max-width: 860px) {
  .cols { grid-template-columns: 1fr; }
  .side { position: static; }
  .item { grid-template-columns: 1fr auto; }
  .item .num { grid-column: 1; }
  .xrow { grid-template-columns: 26px 1fr 112px; }
}

/* ---- phones ---- */
main, .card, .cols > *, .grid > *, .xrow > *, .crow > *, .srow > *, .item > * { min-width: 0; }
input, select, textarea { max-width: 100%; }
.xrow .lbl, .item span { overflow-wrap: anywhere; }
.savebar { display: none; }
@media (max-width: 600px) {
  body { font-size: 16px; }
  main { padding: 12px 10px 110px; }
  .card { padding: 13px 12px; }
  .grid { grid-template-columns: 1fr; }
  .top .in { padding: 6px 8px; gap: 2px; flex-wrap: nowrap; }
  .top img { height: 36px; margin-right: 2px; }
  .top button { padding: 9px 9px; font-size: 15px; }
  .head h1 { font-size: 21px; }
  .head #save { display: none; }
  .side .btn { flex: 1 1 100%; }
  .crow { grid-template-columns: 1fr 104px 44px; }
  .srow { grid-template-columns: 64px 1fr 44px; }
  .xrow { grid-template-columns: 26px 1fr 104px; }
  .tbl td { display: block; width: 100% !important; padding-right: 0; }
  .tbl tr { display: block; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .savebar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--ink); color: #fff; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); align-items: center; gap: 12px; }
  .savebar b { font-size: 19px; font-variant-numeric: tabular-nums; }
  .savebar small { display: block; color: #c9c9c4; font-size: 12px; }
  .savebar .btn { margin-left: auto; min-width: 120px; }
  .toast { bottom: 84px; }
}
html, body { overflow-x: hidden; }
@media (max-width: 600px) {
  .top img { display: none; }
  .top .in { overflow-x: auto; }
  .top button { padding: 9px 8px; font-size: 14.5px; white-space: nowrap; flex: none; }
}
@media (max-width: 600px) {
  .crow { grid-template-columns: 1fr 44px; padding-bottom: 8px; border-bottom: 1px solid #efeee8; }
  .crow > input:first-child { grid-column: 1 / -1; }
}

.leave { position: fixed; inset: 0; background: rgba(20,20,22,.55); z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; }
.leave .card { max-width: 420px; margin: 0; }
