/* Cleva app: phone first, sidebar on wide screens. Brand tokens match cleva.co.uk. */
@font-face{font-family:"Fraunces";font-weight:600;font-display:swap;src:url(fonts/fraunces-latin-600-normal.woff2) format("woff2")}
@font-face{font-family:"IBM Plex Sans";font-weight:400;font-display:swap;src:url(fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2")}
@font-face{font-family:"IBM Plex Sans";font-weight:500;font-display:swap;src:url(fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2")}
@font-face{font-family:"IBM Plex Sans";font-weight:600;font-display:swap;src:url(fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2")}

:root{
  --bg:#F1F0EB; --surface:#FFFFFF; --surface-2:#F7F6F2; --ink:#1F2733; --muted:#5B6575; --line:#E2DFD6;
  --navy:#13233A; --navy-2:#1C2F4A; --teal:#0F6E5E; --teal-soft:#DCEDE8; --amber:#8A5300; --amber-soft:#FBEFD9;
  --red:#B42318; --red-soft:#FCE8E6; --focus:#0F6E5E; --shadow:0 1px 2px rgba(19,35,58,.06),0 4px 16px rgba(19,35,58,.06);
  --serif:"Fraunces",Georgia,serif; --sans:"IBM Plex Sans","Segoe UI",system-ui,-apple-system,sans-serif;
  --radius:16px; --tabbar:64px; --safe-b:env(safe-area-inset-bottom,0px); --safe-t:env(safe-area-inset-top,0px);
  color-scheme:light;
}
@media (prefers-color-scheme:dark){
  :root{--bg:#0E1726; --surface:#16233A; --surface-2:#1B2A44; --ink:#E9EDF3; --muted:#9AA6B8; --line:#26385A;
    --navy:#E9EDF3; --navy-2:#C9D3E2; --teal:#4FC3A8; --teal-soft:#123A35; --amber:#F2B45C; --amber-soft:#3A2C12;
    --red:#FF8A80; --red-soft:#3D1D1B; --focus:#4FC3A8; --shadow:0 1px 2px rgba(0,0,0,.3); color-scheme:dark}
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{background:var(--bg);color:var(--ink);font:400 16px/1.5 var(--sans);-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:3px solid var(--focus);outline-offset:2px;border-radius:8px}
h1,h2,h3{font-family:var(--serif);font-weight:600;color:var(--navy);margin:0;letter-spacing:-.01em}
h1{font-size:1.7rem;line-height:1.2} h2{font-size:1.25rem} h3{font-size:1.05rem;font-family:var(--sans)}
.muted{color:var(--muted)} .small{font-size:.875rem} .num{font-variant-numeric:tabular-nums}
[hidden]{display:none!important}

/* ---------- shell ---------- */
.shell{min-height:100%;display:flex}
.side{display:none}
.main{flex:1;min-width:0;padding:calc(12px + var(--safe-t)) 16px calc(var(--tabbar) + var(--safe-b) + 24px)}
.topbar{display:flex;align-items:center;gap:10px;margin-bottom:18px}
.brand{display:flex;align-items:center;gap:8px;font-family:var(--serif);font-weight:600;font-size:1.3rem;color:var(--navy);text-decoration:none}
.brand img{width:30px;height:30px;border-radius:8px}
.company-btn{margin-left:auto;display:flex;align-items:center;gap:6px;max-width:58%;border:1px solid var(--line);background:var(--surface);border-radius:999px;padding:6px 12px;cursor:pointer}
.company-btn span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500;font-size:.92rem}
.avatar-btn{width:36px;height:36px;border-radius:50%;border:0;background:var(--navy);color:var(--bg);font-weight:600;cursor:pointer;flex:none}
.page{max-width:1080px;margin:0 auto}
.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin:4px 0 16px}

/* bottom tab bar (phone) */
.tabbar{position:fixed;left:0;right:0;bottom:0;z-index:20;display:flex;justify-content:space-around;align-items:stretch;
  height:calc(var(--tabbar) + var(--safe-b));padding-bottom:var(--safe-b);background:var(--surface);border-top:1px solid var(--line)}
.tab{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;text-decoration:none;color:var(--muted);font-size:.72rem;font-weight:500;position:relative}
.tab svg{width:24px;height:24px}
.tab[aria-current=page]{color:var(--teal)}
.tab.capture .bubble{width:46px;height:46px;border-radius:50%;background:var(--navy);color:var(--bg);display:grid;place-items:center;margin-top:-18px;box-shadow:var(--shadow)}
.tab .badge{position:absolute;top:6px;left:calc(50% + 6px)}
.badge{min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:var(--red);color:#fff;font-size:.7rem;font-weight:600;display:inline-grid;place-items:center}

/* wide screens: sidebar instead of tab bar */
@media (min-width:900px){
  .side{display:flex;flex-direction:column;gap:6px;width:250px;flex:none;position:sticky;top:0;height:100vh;padding:22px 16px;border-right:1px solid var(--line);background:var(--surface)}
  .side .brand{margin:0 8px 18px}
  .side .company-btn{margin:0 0 14px;max-width:none;width:100%;border-radius:12px;padding:10px 12px}
  .side nav{display:flex;flex-direction:column;gap:2px}
  .side nav a{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:10px;color:var(--ink);text-decoration:none;font-weight:500}
  .side nav a svg{width:20px;height:20px;color:var(--muted)}
  .side nav a:hover{background:var(--surface-2)}
  .side nav a[aria-current=page]{background:var(--teal-soft);color:var(--teal)} .side nav a[aria-current=page] svg{color:var(--teal)}
  .side nav .badge{margin-left:auto}
  .side .side-foot{margin-top:auto;display:flex;align-items:center;gap:10px;padding:8px}
  .tabbar,.topbar{display:none}
  .main{padding:32px 40px 48px}
  h1{font-size:2rem}
}

/* ---------- building blocks ---------- */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:18px;box-shadow:var(--shadow)}
.grid{display:grid;gap:14px}
@media (min-width:640px){.grid.two{grid-template-columns:1fr 1fr}}
@media (min-width:1100px){.grid.three{grid-template-columns:repeat(3,1fr)}}
.stat{display:flex;flex-direction:column;gap:4px;text-decoration:none;color:inherit}
.stat .label{color:var(--muted);font-size:.85rem;font-weight:500;text-transform:uppercase;letter-spacing:.06em}
.stat .value{font-family:var(--serif);font-size:1.9rem;color:var(--navy);line-height:1.15}
.stat .sub{color:var(--muted);font-size:.9rem}
a.card.stat:hover{border-color:var(--teal)}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px;border-radius:999px;border:1.5px solid var(--navy);background:var(--navy);color:var(--bg);font-weight:600;cursor:pointer;text-decoration:none;white-space:nowrap}
.btn.secondary{background:transparent;color:var(--navy)}
.btn.ghost{border-color:transparent;background:transparent;color:var(--teal);padding:0 8px}
.btn.danger{background:transparent;color:var(--red);border-color:var(--red)}
.btn.block{width:100%}
.btn:disabled{opacity:.5;cursor:default}
.btn svg{width:18px;height:18px}
.chips{display:flex;gap:8px;overflow-x:auto;padding-bottom:4px;margin-bottom:14px;scrollbar-width:none}
.chip{flex:none;border:1px solid var(--line);background:var(--surface);border-radius:999px;padding:7px 14px;font-size:.9rem;font-weight:500;cursor:pointer;color:var(--ink)}
.chip[aria-pressed=true]{background:var(--navy);border-color:var(--navy);color:var(--bg)}
.pill{display:inline-block;font-size:.75rem;font-weight:600;padding:3px 9px;border-radius:999px;background:var(--surface-2);color:var(--muted);white-space:nowrap}
.pill.ok{background:var(--teal-soft);color:var(--teal)} .pill.warn{background:var(--amber-soft);color:var(--amber)} .pill.bad{background:var(--red-soft);color:var(--red)}
.meter{height:8px;border-radius:999px;background:var(--surface-2);overflow:hidden;margin-top:8px}
.meter i{display:block;height:100%;background:var(--teal);border-radius:999px}
.meter.warn i{background:var(--amber)} .meter.bad i{background:var(--red)}
.empty{text-align:center;padding:40px 16px;color:var(--muted)}
.empty svg{width:44px;height:44px;color:var(--teal);margin-bottom:8px}
.list{display:flex;flex-direction:column;gap:10px}
.row{display:flex;align-items:center;gap:12px;background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:14px;cursor:pointer;text-align:left;width:100%}
.row:hover{border-color:var(--teal)}
.row .grow{flex:1;min-width:0}
.row .title{font-weight:600;color:var(--navy);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .meta{color:var(--muted);font-size:.85rem}
.row .amount{font-weight:600;font-variant-numeric:tabular-nums;color:var(--navy);white-space:nowrap}
.check{width:24px;height:24px;border-radius:7px;border:2px solid var(--line);display:grid;place-items:center;flex:none;background:var(--surface)}
.check.on{background:var(--teal);border-color:var(--teal);color:#fff}
.check svg{width:16px;height:16px}

/* sticky action bar above the tab bar */
.actionbar{position:fixed;left:12px;right:12px;bottom:calc(var(--tabbar) + var(--safe-b) + 10px);z-index:25;display:flex;align-items:center;gap:10px;
  background:var(--navy);color:var(--bg);border-radius:16px;padding:10px 10px 10px 16px;box-shadow:0 8px 30px rgba(0,0,0,.25)}
.actionbar .grow{flex:1;font-weight:500}
.actionbar .btn{background:var(--bg);color:var(--navy);border-color:var(--bg);min-height:40px}
.actionbar .btn.danger{background:transparent;color:#FFB4AB;border-color:#FFB4AB}
@media (min-width:900px){.actionbar{left:290px;right:40px;bottom:24px;max-width:1000px;margin:0 auto}}

/* bottom sheet (phone) / dialog (desktop) */
.scrim{position:fixed;inset:0;background:rgba(10,18,30,.45);z-index:40;display:flex;align-items:flex-end;justify-content:center;animation:fade .15s}
.sheet{background:var(--surface);width:100%;max-height:92vh;overflow:auto;border-radius:20px 20px 0 0;padding:8px 18px calc(20px + var(--safe-b));animation:up .2s ease-out}
.sheet .grab{width:40px;height:5px;border-radius:5px;background:var(--line);margin:4px auto 14px}
@media (min-width:700px){.scrim{align-items:center}.sheet{max-width:560px;border-radius:20px;padding:24px}.sheet .grab{display:none}}
@keyframes up{from{transform:translateY(30px);opacity:.6}to{transform:none;opacity:1}}
@keyframes fade{from{opacity:0}to{opacity:1}}
.kv{display:grid;grid-template-columns:auto 1fr;gap:6px 16px;margin:14px 0}
.kv dt{color:var(--muted)} .kv dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}
.lines{border-top:1px solid var(--line);margin-top:8px}
.lines div{display:flex;justify-content:space-between;gap:12px;padding:8px 0;border-bottom:1px solid var(--line);font-size:.92rem}
.sheet-actions{display:flex;gap:10px;margin-top:18px}
.sheet-actions .btn{flex:1}

/* capture */
.drop{border:2px dashed var(--line);border-radius:var(--radius);padding:28px 18px;text-align:center;background:var(--surface)}
.drop.over{border-color:var(--teal);background:var(--teal-soft)}
.drop svg{width:48px;height:48px;color:var(--teal)}
.drop .btns{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;margin-top:16px}

/* report text */
.report{white-space:normal;line-height:1.6}
.report p{margin:0 0 10px} .report ul{margin:0 0 12px;padding-left:20px} .report strong{color:var(--navy)}
.report h3{margin:14px 0 4px;font-family:var(--serif)}

/* chase cards */
.cust{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:16px}
.cust .top{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}
.cust .contact{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0}
.cust .contact a{display:inline-flex;align-items:center;gap:6px;padding:7px 12px;border-radius:999px;background:var(--surface-2);text-decoration:none;color:var(--navy);font-size:.9rem;font-weight:500}
.cust .contact svg{width:16px;height:16px}
.cust table{width:100%;border-collapse:collapse;font-size:.88rem;margin-top:6px}
.cust td,.cust th{padding:6px 4px;border-bottom:1px solid var(--line);text-align:left}
.cust th{color:var(--muted);font-weight:500} .cust .r{text-align:right} .cust .late{color:var(--red)}
.cust .acts{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.cust .acts .btn{min-height:38px;padding:0 14px;font-size:.9rem}
.hist{margin:8px 0 0;padding-left:18px;color:var(--muted);font-size:.85rem}

/* login */
.login{min-height:100%;display:grid;place-items:center;padding:24px 16px calc(24px + var(--safe-b))}
.login .card{width:100%;max-width:420px;padding:28px}
.login .brand{justify-content:center;font-size:1.6rem;margin-bottom:6px}
.login h1{text-align:center;font-size:1.5rem;margin:8px 0 6px}
.steps{counter-reset:s;list-style:none;padding:0;margin:18px 0}
.steps li{counter-increment:s;display:flex;gap:12px;margin-bottom:12px}
.steps li::before{content:counter(s);flex:none;width:26px;height:26px;border-radius:50%;background:var(--teal-soft);color:var(--teal);font-weight:600;display:grid;place-items:center;font-size:.85rem}
label{display:block;font-weight:500;font-size:.9rem;margin:12px 0 6px}
input[type=tel],input[type=text],input[type=date],textarea{width:100%;min-height:46px;padding:10px 14px;border:1.5px solid var(--line);border-radius:12px;background:var(--surface);font-size:1rem}
input:focus,textarea:focus{outline:none;border-color:var(--teal)}
.code-input{letter-spacing:.4em;font-size:1.3rem!important;text-align:center;font-variant-numeric:tabular-nums}
.wa{background:#1F8F5F;border-color:#1F8F5F;color:#fff}

/* toast + spinner */
.toast{position:fixed;left:50%;bottom:calc(var(--tabbar) + var(--safe-b) + 18px);transform:translateX(-50%);z-index:60;background:var(--navy);color:var(--bg);padding:10px 16px;border-radius:12px;font-weight:500;box-shadow:var(--shadow);max-width:calc(100% - 32px)}
@media (min-width:900px){.toast{bottom:28px}}
.spin{width:18px;height:18px;border:2.5px solid currentColor;border-right-color:transparent;border-radius:50%;animation:rot .7s linear infinite;display:inline-block;vertical-align:-3px}
@keyframes rot{to{transform:rotate(360deg)}}
.skeleton{background:linear-gradient(90deg,var(--surface-2),var(--surface),var(--surface-2));background-size:200% 100%;animation:sh 1.2s infinite;border-radius:14px;height:72px}
@keyframes sh{to{background-position:-200% 0}}
@media (prefers-reduced-motion:reduce){*{animation:none!important}}

/* refinements after phone review */
.stats{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.stats .wide{grid-column:1/-1}
.stats .stat .value{font-size:1.7rem}
@media (min-width:1100px){.stats{grid-template-columns:1fr 1fr 1.4fr}.stats .wide{grid-column:auto}}
.desk-only{display:none!important}
@media (min-width:900px){.desk-only{display:inline-flex!important}}
.row>svg{width:20px;height:20px;flex:none}
.row .check svg{width:16px;height:16px}
.empty svg{display:block;margin:0 auto 8px}
.drop .btn svg{width:18px;height:18px;color:inherit}
.report h3:first-child{margin-top:0}
