:root {
  --bg: #f2f0e8;
  --paper: #faf9f5;
  --ink: #11100d;
  --muted: #6b675e;
  --line: #dcd8cb;
  --gold: #d8a725;
  --red: #b3321f;
  --green: #2f6b3a;
  --serif: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* top bar / tabs */
.bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px; height: calc(58px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 20px 0; background: rgba(242,240,232,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--ink); }
.logo { font: 500 12px/1 var(--mono); letter-spacing: .16em; text-decoration: none; white-space: nowrap; }
.logo b { font-weight: 500; color: #8a6a12; }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tabs a { text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 500; color: var(--muted); }
.tabs a.on { color: var(--ink); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.tabs a.hot { background: var(--ink); color: var(--bg); }
.badge { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--gold); color: var(--ink); font: 600 11px/18px var(--mono); text-align: center; }
@media (max-width: 720px) {
  /* backdrop-filter would trap the fixed tab bar inside the header, so the phone bar is solid */
  .bar { justify-content: center; height: calc(48px + env(safe-area-inset-top)); background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: rgba(250,249,245,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); justify-content: space-around; }
  .tabs a { flex: 1; text-align: center; padding: 10px 2px; font-size: 13px; }
  .tabs a.on { box-shadow: none; background: var(--bg); }
  #frames iframe { height: calc(100dvh - 48px - env(safe-area-inset-top) - 60px - env(safe-area-inset-bottom)); }
  .view { padding-bottom: 96px !important; }
}

.view { max-width: 1180px; margin: 0 auto; padding: 22px 16px 60px; }
/* portfolio + links editors, framed under the bar */
#frames iframe { display: block; width: 100%; height: calc(100dvh - 58px - env(safe-area-inset-top)); border: 0; background: #0a0606; }
body.editing .view { display: none; }
body:not(.editing) #frames { display: none; }
.view.wide { max-width: none; }

/* type */
h1 { font: 500 clamp(32px, 7vw, 48px)/1.02 var(--serif); letter-spacing: -.035em; margin: 6px 0 18px; }
h2 { font: 500 21px/1.15 var(--serif); letter-spacing: -.01em; margin: 0 0 14px; }
.small { font-size: 13px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.page-head h1 { margin: 0; }
.label, .f > span { display: block; font: 500 11px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--ink); background: var(--ink); color: var(--bg); font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--red); border-color: #e5c3bc; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.f { display: block; margin-bottom: 14px; min-width: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; outline: none; font-size: 16px; -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 0 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.chip input + span, button.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: 14px; cursor: pointer; user-select: none; }
.chip input:checked + span, button.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
button.chip .n { font: 11px/1 var(--mono); opacity: .6; }

/* cards & panels */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; }
.panel h2 { display: flex; align-items: baseline; gap: 10px; }
.panel h2 small { margin-left: auto; font: 11px/1 var(--mono); color: var(--muted); letter-spacing: .04em; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.stat .label { margin: 0; }
.stat b { display: block; font: 500 28px/1.05 var(--serif); letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat.alert b { color: var(--red); }
.stat.gold { border-color: #e6cf8a; background: #fbf4dc; }
.stat.gold b { color: #6b5108; }
.stat-note { margin: 0 0 12px; }

/* "I sent it" notes from clients */
.claim { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 14px; margin-bottom: 10px; border-radius: 12px; background: #fbf4dc; border: 1px solid #e6cf8a; color: #4a3806; text-decoration: none; font-size: 14px; }
.claim-go { font-weight: 600; white-space: nowrap; }
.claim.static { margin: 0 0 14px; }

.toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
.toolbar input { flex: 1; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .chip { flex: none; }

.list { display: grid; gap: 8px; }
.card { display: grid; gap: 4px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; transition: border-color .15s; min-width: 0; }
.card:hover { border-color: var(--ink); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.card strong { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { display: flex; align-items: center; gap: 8px; }
.card .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.card .tags:empty { display: none; }
.money-line { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.owes { color: #6b5108; }
.money-line .owes { font-weight: 600; }
.track { display: block; height: 4px; border-radius: 2px; background: var(--bg); overflow: hidden; }
.track i { display: block; height: 100%; background: var(--green); border-radius: 2px; }
.track.big { height: 8px; border-radius: 4px; margin: 14px 0 10px; }
.tag { font: 11px/1 var(--mono); padding: 5px 8px; border-radius: 6px; background: var(--bg); color: var(--muted); }
.tag.gold { background: #f3e4b4; color: #5c4508; }
.tag.red { background: #f5d9d3; color: var(--red); }
.money { font: 500 13px/1 var(--mono); font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 6px; font: 500 11px/1 var(--mono); letter-spacing: .03em; padding: 6px 9px; border-radius: 999px; background: var(--bg); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--muted)); }
.s-lead { --c: #9a958a; } .s-quoted { --c: #4f7fbf; } .s-awaiting_deposit { --c: var(--gold); } .s-in_progress { --c: #d86a25; }
.s-on_hold { --c: #8b5cc4; } .s-complete { --c: var(--green); } .s-lost { --c: #c9c4b8; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h2 { color: var(--ink); }

/* client detail */
.back { display: inline-block; font: 13px/1 var(--mono); color: var(--muted); text-decoration: none; margin-bottom: 8px; }
.client-head h1 { margin: 0 0 4px; overflow-wrap: anywhere; }
.client-head p { margin: 0 0 16px; }
.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.stepper button { min-height: 40px; padding: 4px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.15; cursor: pointer; }
.stepper button.past { color: var(--ink); }
.stepper button.on { background: var(--ink); color: var(--bg); }
.side-steps { margin: 8px 0 16px; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 6px; margin-bottom: 16px; }
.quick:empty { display: none; }
.quick .btn { padding: 0 8px; }
.money-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.money-grid .label { margin: 0; }
.money-grid b { display: block; font: 500 26px/1.1 var(--serif); letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.payments { display: grid; border-top: 1px solid var(--line); }
.pay-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.pay-row .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-row .x { width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--bg); cursor: pointer; color: var(--muted); }
.gold-chip { border-color: var(--gold) !important; }
.foot { margin: 6px 2px 20px; }
.linkish { border: 0; padding: 0; background: none; color: var(--red); cursor: pointer; font: inherit; text-decoration: underline; }
.cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 880px) { .cols { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 8px 14px; margin: 0; }
.kv dt { font: 500 11px/1.6 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 12px; }
.file { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.file img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file .doc { display: grid; place-items: center; height: 100%; padding: 6px; font: 11px/1.3 var(--mono); text-align: center; word-break: break-all; text-decoration: none; }
.file .k { position: absolute; left: 4px; top: 4px; font: 10px/1 var(--mono); background: rgba(17,16,13,.75); color: #fff; padding: 4px 6px; border-radius: 5px; border: 0; cursor: pointer; }
.file .x { position: absolute; right: 4px; top: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(17,16,13,.75); color: #fff; cursor: pointer; line-height: 1; }
.upload { position: relative; overflow: hidden; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.saved { font: 11px/1 var(--mono); color: var(--green); opacity: 0; transition: opacity .3s; }
.saved.on { opacity: 1; }

/* site editor */
.editor { display: grid; grid-template-columns: minmax(340px, 460px) 1fr; gap: 16px; align-items: start; }
.editor .form { max-height: calc(100vh - 96px); overflow-y: auto; padding-right: 4px; position: sticky; top: 74px; }
.preview { position: sticky; top: 74px; height: calc(100vh - 96px); border: 1px solid var(--ink); border-radius: 14px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.preview .chrome { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--paper); font: 12px/1 var(--mono); }
.preview .chrome a { margin-left: auto; }
.preview .frame { flex: 1; display: grid; place-items: center; background: #e7e4da; overflow: hidden; }
.preview iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview.phone iframe { width: 390px; height: min(844px, 100%); border-radius: 22px; box-shadow: 0 0 0 8px var(--ink); }
@media (max-width: 960px) {
  .editor { grid-template-columns: 1fr; }
  .editor .form { max-height: none; overflow: visible; position: static; }
  .preview { position: static; height: 70vh; }
}
.rep { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: var(--bg); }
.rep .grid2 { gap: 0 8px; }
.rep .f { margin-bottom: 8px; }
.rep-tools { display: flex; gap: 4px; justify-content: flex-end; }
.icon { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; line-height: 1; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; margin-bottom: 8px; }
.pick { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 2px solid transparent; padding: 0; background: var(--bg); cursor: pointer; }
.pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--gold); }
.pick .num { position: absolute; right: 3px; top: 3px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--ink); color: #fff; font: 10px/18px var(--mono); text-align: center; }
.pick.none { display: grid; place-items: center; font: 11px/1 var(--mono); color: var(--muted); border: 1px dashed var(--line); }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.theme { border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; text-align: left; background: var(--paper); }
.theme.on { border-color: var(--ink); }
.theme i { display: block; height: 34px; border-radius: 6px; margin-bottom: 8px; }
.switch { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--ink); }
details.sec { border-top: 1px solid var(--line); padding: 4px 0; }
details.sec > summary { cursor: pointer; list-style: none; padding: 12px 0; font: 500 22px/1 var(--serif); display: flex; align-items: center; }
details.sec > summary::after { content: '+'; margin-left: auto; font: 18px/1 var(--mono); color: var(--muted); }
details.sec[open] > summary::after { content: '–'; }
details.sec > summary::-webkit-details-marker { display: none; }

/* kit */
.qr { display: grid; place-items: center; padding: 16px; background: #fff; border-radius: 12px; width: fit-content; margin: 0 auto 12px; }
.qr img, .qr canvas { display: block; }
.link-box { display: flex; gap: 6px; }
.link-box input { font-family: var(--mono); }

/* login */
.login { min-height: 100svh; display: grid; place-items: center; padding: 20px; }
.login form { width: min(380px, 100%); }
.login h1 { font-size: 56px; }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 721px) { .toast { bottom: 28px; } }

dialog { border: 0; border-radius: 18px; padding: 22px; background: var(--paper); color: var(--ink); width: min(420px, calc(100% - 32px)); text-align: center; max-height: calc(100dvh - 40px); overflow-y: auto; }
dialog .pay-form { text-align: left; }
dialog .pay-form h2 { margin-bottom: 2px; }
dialog::backdrop { background: rgba(17,16,13,.5); }
dialog .btn { width: 100%; margin-top: 10px; }

/* Phone: tighter type and spacing so a screen holds more. Inputs stay 16px or iPhone zooms in on tap. */
@media (max-width: 720px) {
  body { font-size: 14px; }
  .view { padding: 14px 12px 60px; }
  h1 { font-size: 28px; margin-bottom: 12px; }
  .page-head { margin: 0 0 12px; }
  h2 { font-size: 18px; margin-bottom: 10px; }
  .panel { padding: 14px; border-radius: 12px; margin-bottom: 10px; }
  .btn { min-height: 38px; padding: 0 14px; font-size: 14px; }
  .btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; }
  .chip input + span, button.chip { min-height: 32px; padding: 0 11px; font-size: 13px; }
  .stat { padding: 10px 12px; border-radius: 12px; }
  .stat b { font-size: 22px; margin-top: 4px; }
  .label, .f > span { font-size: 10.5px; margin-bottom: 4px; }
  .f { margin-bottom: 10px; }
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), select { min-height: 40px; padding: 8px 11px; }
  .card { padding: 12px 14px; border-radius: 12px; }
  .card strong { font-size: 16px; }
  .client-head p { margin-bottom: 12px; font-size: 13px; }
  .stepper button { min-height: 36px; font-size: 12px; }
  .side-steps { margin: 6px 0 12px; }
  .quick { margin-bottom: 10px; }
  .money-grid b { font-size: 21px; }
  .claim { padding: 10px 12px; font-size: 13px; }
}
