  :root{
    --navy:#0f2740; --navy2:#16324f; --amber:#ffb020; --amber-d:#e69500;
    --ink:#12202e; --muted:#6b7d8f; --line:#e7edf2; --bg:#f4f7fa;
    --green:#1f9d57; --blue:#2f7de1; --red:#e0533d; --purple:#7a5cd6;
    --card:#ffffff;
  }
  *{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
  html,body{margin:0; padding:0;}
  body{
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
    background:#0d1f34;
    color:var(--ink);
    min-height:100vh;
    display:flex; flex-direction:column; align-items:center;
    padding:14px 10px 40px;
  }
  .banner{
    color:#cfe0f0; text-align:center; max-width:420px; margin:4px auto 12px;
    font-size:13px; line-height:1.4;
  }
  .banner b{color:#fff;}
  .rolebar{
    display:flex; gap:6px; background:#0a1725; padding:5px; border-radius:12px;
    margin:0 auto 12px; width:max-content; border:1px solid #24405f;
  }
  .rolebar button{
    border:0; background:transparent; color:#9fb4c9; font-size:13px; font-weight:600;
    padding:7px 16px; border-radius:9px; cursor:pointer;
  }
  .rolebar button.on{background:var(--amber); color:#3a2600;}
  .appbar{
    background:linear-gradient(125deg,#2f6df0 0%,#6b46e5 60%,#8b3fd6 100%);
    color:#fff; padding:6px 16px 16px; flex:none;
    display:flex; align-items:center; gap:10px;
  }
  .appbar .back{font-size:22px; cursor:pointer; width:26px; opacity:.9;}
  .appbar h1{font-size:18px; margin:0; font-weight:700; flex:1;}
  .appbar .sub{font-size:12px; color:#a9c0d6; font-weight:500;}
  .logo{
    display:flex; align-items:center; gap:9px; font-weight:800; font-size:19px; letter-spacing:.3px;
  }
  .logo .spark{color:var(--amber);}


  .card{background:var(--card); border:1px solid var(--line); border-radius:16px; padding:14px; margin-bottom:12px;}
  .row{display:flex; align-items:center; gap:12px;}
  .between{justify-content:space-between;}
  .muted{color:var(--muted); font-size:13px;}
  .tiny{font-size:11px;}
  h2.sec{font-size:14px; text-transform:uppercase; letter-spacing:.6px; color:var(--muted); margin:18px 4px 8px;}
  .big{font-size:22px; font-weight:800;}

  .pill{display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:700;
    padding:4px 9px; border-radius:20px;}
  .p-booked{background:#eaf2fd; color:var(--blue);}
  .p-prog{background:#fff2dd; color:var(--amber-d);}
  .p-done{background:#e5f6ed; color:var(--green);}
  .p-quote{background:#f0ebfb; color:var(--purple);}
  .p-com{background:#eef1f4; color:#5a6b7b;}
  .p-res{background:#e5f6ed; color:var(--green);}
  .p-build{background:#fdeeea; color:var(--red);}

  .jobcard{cursor:pointer;}
  .jobcard .id{font-size:12px; color:var(--muted); font-weight:600;}
  .jobcard .title{font-weight:700; font-size:15px; margin:2px 0 4px;}
  .avatar{width:30px; height:30px; border-radius:50%; background:var(--navy2); color:#fff;
    display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; flex:none;}
  .avatar.amber{background:var(--amber); color:#3a2600;}
  .avatar.blue{background:var(--blue);}
  .avatar.green{background:var(--green);}

  .kpis{display:flex; gap:10px; margin-bottom:4px;}
  .kpi{flex:1; background:var(--card); border:1px solid var(--line); border-radius:14px; padding:12px; color:#fff; position:relative; overflow:hidden;}
  .kpi.k1{background:linear-gradient(135deg,#2f7de1,#4aa3ff);}
  .kpi.k2{background:linear-gradient(135deg,#7a5cd6,#a17bff);}
  .kpi.k3{background:linear-gradient(135deg,#e69500,#ffb020);}
  .kpi.k4{background:linear-gradient(135deg,#1f9d57,#37c777);}
  .kpi .n{font-size:22px; font-weight:800;}
  .kpi .l{font-size:11px; opacity:.9;}

  .btn{display:block; width:100%; text-align:center; background:var(--amber); color:#3a2600;
    font-weight:800; border:0; border-radius:12px; padding:14px; font-size:15px; cursor:pointer; margin-top:6px;}
  .btn.ghost{background:#fff; color:var(--navy); border:1.5px solid var(--line);}
  .btn.navy{background:var(--navy); color:#fff;}

  .bottomnav a{flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
    gap:3px; font-size:10.5px; color:var(--muted); cursor:pointer; font-weight:600;}
  .bottomnav a.on{color:var(--navy);}
  .bottomnav a.on .ic{color:var(--amber-d);}
  .ic{width:22px; height:22px;}
  .owner-only{}
  body.worker .owner-only{display:none !important;}

  .addr{display:flex; gap:10px; padding:10px 0; border-top:1px solid var(--line);}
  .addr:first-of-type{border-top:0;}
  .dot{width:9px; height:9px; border-radius:50%; margin-top:5px; flex:none;}

  .cal{display:flex; gap:6px; overflow-x:auto; padding-bottom:6px;}
  .day{min-width:52px; text-align:center; border:1px solid var(--line); border-radius:12px; padding:8px 0; background:#fff; cursor:pointer;}
  .day.on{background:var(--navy); color:#fff; border-color:var(--navy);}
  .day .dn{font-size:11px; opacity:.7;} .day .dd{font-size:17px; font-weight:800;}
  .slot{display:flex; gap:10px; padding:10px 0; border-bottom:1px solid var(--line);}
  .slot .time{width:56px; font-size:12px; font-weight:700; color:var(--muted);}
  .slot .body{flex:1; background:#fff; border:1px solid var(--line); border-radius:12px; padding:10px;}
  .slot .body.sam{border-left:4px solid var(--blue);}
  .slot .body.ali{border-left:4px solid var(--green);}
  .slot .body.zeno{border-left:4px solid var(--amber);}

  .mcell{position:relative; aspect-ratio:1; border:1px solid var(--line); border-radius:9px; background:#fff;
    font-size:13px; font-weight:600; padding:5px 0 0 6px; color:var(--ink); display:flex; gap:2px;}
  .mcell.off{color:#c3ccd4; background:#fafbfc;}
  .mcell.today{background:var(--navy); color:#fff; border-color:var(--navy);}
  .mcell i{position:absolute; bottom:6px; width:6px; height:6px; border-radius:50%;}
  .mcell i{left:6px; background:transparent;}
  .mcell i.b{background:var(--blue); left:6px;}
  .mcell i.g{background:var(--green); left:15px;}
  .mcell i.a{background:var(--amber); left:6px;}
  .mcell i.am{background:var(--amber); left:24px;}
  .mcell.today i.b{left:6px;} .mcell.today i.a{left:15px;} .mcell.today i.am{left:24px;}

  .field{margin-bottom:12px;}
  .field label{display:block; font-size:12px; font-weight:700; color:var(--muted); margin-bottom:5px;}
  .inp{width:100%; border:1.5px solid var(--line); border-radius:10px; padding:11px; font-size:14px; background:#fff;}
  .check{display:flex; align-items:flex-start; gap:10px; padding:10px; border:1px solid var(--line);
    border-radius:10px; margin-bottom:8px; cursor:pointer; background:#fff;}
  .check .box{width:22px; height:22px; border-radius:6px; border:2px solid var(--muted); flex:none; display:flex; align-items:center; justify-content:center; font-size:14px; color:#fff;}
  .check.on{background:#fbfff4; border-color:var(--green);}
  .check.on .box{background:var(--green); border-color:var(--green);}
  .check .h{font-weight:700; font-size:14px;}
  .check .c{font-size:12px; color:var(--muted);}
  .sig{height:90px; border:2px dashed var(--line); border-radius:12px; display:flex; align-items:center; justify-content:center; color:var(--muted); font-style:italic; background:#fff;}
  .lock{display:flex; gap:10px; align-items:center; background:#fff6e6; border:1px solid #ffe0a6; color:#8a5a00; border-radius:12px; padding:12px; font-size:13px;}

  .fab{position:absolute; right:16px; bottom:82px; width:56px; height:56px; border-radius:50%;
    background:var(--amber); color:#3a2600; font-size:30px; display:flex; align-items:center; justify-content:center;
    box-shadow:0 8px 20px rgba(255,176,32,.5); cursor:pointer; z-index:5;}
  .note{font-size:12px; color:var(--muted); text-align:center; margin-top:14px;}

/* ---- additions for the real app (the mockup had no live data to style) ---- */

/* The shell renders one screen at a time into #screen, so it's always active. */
#screen{ display:block; }

/* Mockup styled a nested <label>; the app wraps the control instead. */
.field{ display:block; }
.field > span{ display:block; font-size:12px; font-weight:700; color:var(--muted); margin-bottom:5px; }

/* Real checkboxes rather than the mockup's decorative .box divs. */
.check input[type="checkbox"]{ width:22px; height:22px; accent-color:var(--green); flex:none; margin:0; }
.check span{ font-size:14px; line-height:1.35; }
.check:has(input:checked) span{ color:var(--muted); text-decoration:line-through; }
.check:has(input:checked){ background:#fbfff4; border-color:var(--green); }

/* Job and customer cards are links now, so kill the default anchor styling. */
a.jobcard{ display:block; text-decoration:none; color:inherit; }
a.jobcard:active{ transform:scale(.995); }

h3{ font-size:14px; font-weight:800; color:var(--ink); margin:18px 0 8px; }

.thumb{ width:84px; height:84px; object-fit:cover; border-radius:12px; border:1px solid var(--line); }

select.inp{ appearance:none; background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),
  linear-gradient(135deg,var(--muted) 50%,transparent 50%);
  background-position:calc(100% - 18px) 19px, calc(100% - 13px) 19px;
  background-size:5px 5px, 5px 5px; background-repeat:no-repeat; }

.btn.tiny{ display:inline-block; width:auto; padding:7px 12px; font-size:12px; margin:0; border-radius:9px; }
.lock{ background:#eef1f4; color:#5a6b7b; border-radius:10px; padding:8px 10px; margin-top:8px; }

/* Workers don't see pricing, so they don't get the Money tab either. The role
   lives on <body>, same as the mockup did it. */
body.worker .owner-only{ display:none; }


/* ====================================================================
   Layout — one responsive app that fills whatever it's opened on.
   Phone: top bar, scrolling content, bottom tab bar.
   Tablet and up: the tab bar becomes a side rail and content gets a
   comfortable measure instead of stretching to the window width.
   ==================================================================== */

html, body{ height:100%; }
body{
  margin:0; padding:0; display:block; background:var(--bg);
  min-height:100dvh;
}

.app{
  display:grid;
  grid-template-rows:auto 1fr auto;
  min-height:100dvh;
  min-height:100svh;
}

.appbar{
  position:sticky; top:0; z-index:20;
  padding-top:calc(10px + env(safe-area-inset-top));
}

#screen{
  overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding:14px 14px calc(18px + env(safe-area-inset-bottom));
  width:100%; max-width:720px; margin:0 auto;
}

.bottomnav{
  position:sticky; bottom:0; z-index:20;
  height:auto; min-height:62px;
  background:#fff; border-top:1px solid var(--line);
  display:flex; padding-bottom:env(safe-area-inset-bottom);
}

/* Lists breathe into the extra width rather than becoming very wide lines. */
@media (min-width:640px){
  #screen{ padding:20px 20px calc(24px + env(safe-area-inset-bottom)); }
  .cards{ display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:12px; }
  .cards > .card{ margin-bottom:0; }
}

@media (min-width:900px){
  .app{
    grid-template-columns:232px 1fr;
    grid-template-rows:auto 1fr;
    grid-template-areas:"nav bar" "nav main";
  }
  .appbar{ grid-area:bar; }
  #screen{ grid-area:main; max-width:900px; margin:0; padding:24px 28px; }

  /* The tab bar becomes a vertical rail. */
  .bottomnav{
    grid-area:nav; position:sticky; top:0; align-self:start;
    flex-direction:column; height:100dvh; min-height:0;
    border-top:0; border-right:1px solid var(--line);
    padding:18px 10px; gap:4px;
  }
  .bottomnav a{
    flex:none; flex-direction:row; justify-content:flex-start; gap:12px;
    font-size:14px; padding:11px 14px; border-radius:11px;
  }
  .bottomnav a.on{ background:var(--bg); }
  .bottomnav .ic{ width:20px; height:20px; font-size:18px; }
}

/* Wider screens can show two KPI rows worth of tiles comfortably. */
@media (min-width:480px){
  .kpi .n{ font-size:24px; }
}

/* ---- month grid (the mockup had cells styled but never a grid to sit in) --- */
.mhead{
  display:grid; grid-template-columns:repeat(7,1fr); gap:5px;
  margin-bottom:6px; text-align:center;
  font-size:11px; font-weight:700; color:var(--muted);
}
.mgrid{ display:grid; grid-template-columns:repeat(7,1fr); gap:5px; }
.mcell{ cursor:pointer; }
.mcell.sel{ border-color:var(--amber); box-shadow:0 0 0 2px var(--amber) inset; }
.mcell i.p{ background:var(--purple); }

/* Week strip: the day chips carry a job count under the date. */
.cal{ margin-bottom:4px; }
.day{ flex:1; }

/* Week/month switch reuses the role-pill styling from the mockup. */
.rolebar{ margin:0; }
