/* Wright & Ledger: brand sheet v1 (Ledger Navy, Wright Brass, Chalk; Fraunces + Inter) */
:root {
  --navy: #1B2A41; --brass: #B8862B; --deep-brass: #8A6418; --slate: #5B6270;
  --chalk: #FAF8F4; --mortar: #EDE8DF; --line: #E5DED1; --field: #C9CCD1;
  --green: #2E7D4F; --red: #B3261E; --tint: #F3EAD7; --tint-text: #6E4F12;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--chalk); color: var(--navy); font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--deep-brass); }
a:hover { color: var(--navy); }
h1, h2, h3, .serif { font-family: Fraunces, Georgia, serif; font-weight: 600; line-height: 1.15; margin: 0 0 12px; }
h1 { font-size: 28px; } h2 { font-size: 21px; margin-top: 4px; } h3 { font-size: 18px; }
p { margin: 0 0 12px; }
.muted { color: var(--slate); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.hide { display: none !important; }

/* Top bar and tab bar */
.top { position: sticky; top: 0; z-index: 10; background: var(--navy); color: var(--chalk); }
.top-in { max-width: 760px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--chalk); text-decoration: none; font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 19px; }
.brand:hover { color: var(--chalk); }
.brand .amp { color: var(--brass); }
.mono { width: 32px; height: 32px; border-radius: 8px; background: var(--chalk); color: var(--navy); display: inline-flex; flex-direction: column; align-items: center; justify-content: center; font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 18px; line-height: 1; }
.mono::after { content: ""; display: block; width: 16px; height: 2px; margin-top: 2px; background: var(--brass); border-radius: 1px; }
.top .spacer { flex: 1; }
.bell { position: relative; color: var(--chalk); display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 10px; }
.bell:hover { color: var(--chalk); background: rgba(255,255,255,.08); }
.bell .dot { position: absolute; top: 7px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brass); color: var(--navy); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs-in { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 9px; min-height: 56px; color: var(--slate); text-decoration: none; font-size: 11.5px; font-weight: 500; }
.tabs a svg { width: 24px; height: 24px; }
.tabs a.on { color: var(--navy); font-weight: 700; }
.tabs a.on svg { stroke: var(--navy); }
.tabs a.on::before { content: ""; position: absolute; }

main { max-width: 760px; margin: 0 auto; padding: 18px 16px 110px; }
.public main { padding-bottom: 40px; }

/* Cards and lists */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.navy { background: var(--navy); color: var(--chalk); border-color: var(--navy); }
.card.navy .muted { color: #C9CCD1; }
.card.green { background: var(--green); color: #fff; border-color: var(--green); }
.card.tint { background: var(--tint); border-color: #E6D6B3; color: var(--tint-text); }
.card.warn { background: #FBEBEB; border-color: #F0C9C7; color: #7A1A14; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.big { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 34px; line-height: 1.1; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.row + .row { margin-top: 8px; }
.list { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.list > li + li { border-top: 1px solid var(--mortar); }
.list a.item, .list .item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; color: var(--navy); text-decoration: none; min-height: 60px; }
.list a.item:hover { background: #FBFAF7; }
.item .t { font-weight: 600; }
.item .s { color: var(--slate); font-size: 14px; }
.empty { padding: 18px 16px; color: var(--slate); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 22px 0 10px; }
.section-head h2 { margin: 0; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--mortar); color: var(--navy); white-space: nowrap; }
.pill.late { background: #FBEBEB; color: var(--red); }
.pill.paid { background: #E5F4E4; color: var(--green); }
.pill.draft { background: var(--tint); color: var(--tint-text); }
.pill.opened { background: #E7F1FB; color: #1D4F86; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 12px; border: 2px solid var(--navy); background: var(--navy); color: #fff; font: 600 16px Inter, system-ui, sans-serif; text-decoration: none; cursor: pointer; }
.btn:hover { color: #fff; background: #24365A; }
.btn.secondary { background: #fff; color: var(--navy); }
.btn.secondary:hover { background: var(--chalk); color: var(--navy); }
.btn.green { background: var(--green); border-color: var(--green); }
.btn.danger { background: #fff; color: var(--red); border-color: #E5B5B2; }
.btn.block { width: 100%; }
.btn.huge { min-height: 60px; font-size: 19px; border-radius: 14px; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--deep-brass); text-decoration: underline; cursor: pointer; }

form .field { margin-bottom: 16px; }
label, .label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.hint { display: block; font-weight: 400; color: var(--slate); font-size: 13.5px; margin-top: 4px; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=month], select, textarea {
  width: 100%; min-height: 48px; padding: 11px 13px; font: 16px Inter, system-ui, sans-serif; color: var(--navy);
  background: #fff; border: 1.5px solid var(--field); border-radius: 10px; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--brass); outline-offset: 1px; }
.money { position: relative; }
.money::before { content: "£"; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--slate); }
.money input { padding-left: 28px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--field); border-radius: 10px; background: #fff; font-weight: 500; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--navy); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1.5px solid var(--navy); border-radius: 12px; overflow: hidden; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { margin: 0; padding: 12px 6px; text-align: center; font-weight: 600; cursor: pointer; min-height: 48px; display: flex; align-items: center; justify-content: center; }
.seg label + input + label, .seg input + label ~ label { border-left: 1.5px solid var(--navy); }
.seg input:checked + label { background: var(--navy); color: #fff; }
.seg input:focus-visible + label { outline: 3px solid var(--brass); outline-offset: -3px; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-weight: 600; font-size: 15px; margin-bottom: 6px; padding: 0; }

.flash { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-weight: 500; }
.flash.ok { background: #E5F4E4; color: #1E5A37; }
.flash.warn, .flash.error { background: #FBEBEB; color: #7A1A14; }

/* Calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cal-head h1 { margin: 0; font-size: 24px; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--navy); text-decoration: none; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; margin-bottom: 18px; }
.cal .dow { text-align: center; font-size: 12px; font-weight: 600; color: var(--slate); padding: 2px 0 4px; }
.cal a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 46px; border-radius: 10px; color: var(--navy); text-decoration: none; font-weight: 500; font-variant-numeric: tabular-nums; }
.cal a:hover { background: var(--chalk); }
.cal a.today { box-shadow: inset 0 0 0 2px var(--brass); }
.cal a.sel { background: var(--navy); color: #fff; }
.cal a .dots { display: flex; gap: 3px; height: 6px; margin-top: 3px; }
.cal a .dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--brass); }
.cal a.sel .dots i { background: var(--chalk); }

.job { display: flex; gap: 12px; align-items: center; padding: 14px 16px; min-height: 64px; color: var(--navy); text-decoration: none; }
.job .bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--brass); }
.job.done .bar { background: var(--slate); } .job.invoiced .bar { background: #1D4F86; } .job.paid .bar { background: var(--green); }
.job .grow { flex: 1; min-width: 0; }
.job .t { font-weight: 600; }
.job .s { color: var(--slate); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Invoice preview */
.inv-lines .row { padding: 4px 0; }
.inv-lines .total { border-top: 2px solid var(--navy); margin-top: 10px; padding-top: 10px; font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 22px; }
.rc-note { margin-top: 14px; padding: 10px 12px; background: var(--tint); color: var(--tint-text); border-radius: 8px; font-size: 14px; font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 26px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 11px; height: 11px; border-radius: 6px; background: var(--brass); }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 2px; background: var(--mortar); }
.timeline li:last-child::after { display: none; }
.timeline li.paid::before { background: var(--green); }
.copy { display: flex; gap: 8px; }
.copy input { flex: 1; font-size: 14px; }
table.plain { width: 100%; border-collapse: collapse; font-size: 15px; }
table.plain th, table.plain td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--mortar); vertical-align: top; }
table.plain th { font-size: 13px; color: var(--slate); font-weight: 600; }
table.plain td.num, table.plain th.num { text-align: right; }
.scroll { overflow-x: auto; }
details summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.disclaimer { font-size: 13px; color: var(--slate); margin-top: 18px; }

/* Auth and public pages */
.auth { max-width: 440px; margin: 0 auto; padding: 32px 16px 48px; }
.auth .brand { color: var(--navy); font-size: 24px; margin-bottom: 22px; }
.auth .mono { width: 40px; height: 40px; background: var(--navy); color: var(--chalk); font-size: 22px; }
.auth .tagline { font-family: Fraunces, Georgia, serif; font-size: 22px; font-weight: 600; margin-bottom: 18px; }
.pay-head { background: var(--navy); color: var(--chalk); }
.pay-head .in { max-width: 640px; margin: 0 auto; padding: 22px 16px; }
.public main { max-width: 640px; }
.bank div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--mortar); }
.bank div:last-child { border-bottom: 0; }
.bank b { font-variant-numeric: tabular-nums; }
@media print { .top, .tabs, .noprint { display: none !important; } main { padding: 0; } body { background: #fff; } }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.grid2 > *, .grid3 > * { min-width: 0; }
input, select, textarea { max-width: 100%; min-width: 0; }
input[type=date] { -webkit-appearance: none; appearance: none; }

/* Terms and Privacy */
.auth:has(.legal) { max-width: 720px; }
.legal h1 { font-family: Fraunces, Georgia, serif; font-size: 28px; margin: 0 0 4px; }
.legal h2 { font-size: 18px; margin: 26px 0 8px; }
.legal p, .legal li { line-height: 1.6; }
.legal ul { padding-left: 20px; }
.legal .updated { color: var(--slate); font-size: 14px; margin-bottom: 18px; }
.legal table { width: 100%; border-collapse: collapse; font-size: 15px; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 8px 6px; border-bottom: 1px solid #E5E1D8; }
.legal-links { font-size: 13px; color: var(--slate); margin-top: 18px; }
.legal-links a { color: inherit; }
