/* Exec Pets Operations — tablet-first, status-colour, large touch targets */
:root{
  --bg:#f4f6fb;
  --surface:#ffffff;
  --surface-2:#f8fafc;
  --ink:#0f172a;
  --muted:#64748b;
  --line:#e2e8f0;
  --accent:#2563eb;
  --accent-ink:#fff;
  --red:#ef4444;
  --red-soft:#fee2e2;
  --amber:#f59e0b;
  --amber-soft:#fef3c7;
  --green:#16a34a;
  --green-soft:#dcfce7;
  --blue:#2563eb;
  --blue-soft:#dbeafe;
  --violet:#7c3aed;
  --violet-soft:#ede9fe;
  --shadow:0 1px 2px rgba(15,23,42,.06),0 8px 24px rgba(15,23,42,.08);
  --radius:16px;
  --nav-h:76px;
  --top-h:64px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;height:100%}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg);color:var(--ink);
  -webkit-font-smoothing:antialiased;
  font-size:16px;line-height:1.45;
  overscroll-behavior:none;
}
button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit}
input,select,textarea{font-family:inherit;font-size:16px}

#app{max-width:1180px;margin:0 auto;min-height:100vh;display:flex;flex-direction:column}

/* ---------- top bar ---------- */
.topbar{
  position:sticky;top:0;z-index:30;height:var(--top-h);
  display:flex;align-items:center;justify-content:space-between;
  padding:0 18px;background:var(--surface);
  border-bottom:1px solid var(--line);box-shadow:var(--shadow);
}
.brand{display:flex;align-items:center;gap:12px}
.logo{font-size:30px;line-height:1}
.brand-text{display:flex;flex-direction:column;line-height:1.1}
.brand-text strong{font-size:19px}
.brand-text small{color:var(--muted);font-size:12px;letter-spacing:.04em;text-transform:uppercase}
.topbar-actions{display:flex;gap:8px}
.icon-btn{
  width:46px;height:46px;border-radius:12px;font-size:20px;
  display:grid;place-items:center;position:relative;background:var(--surface-2);
  border:1px solid var(--line);
}
.icon-btn:active{transform:scale(.96)}
.badge{
  position:absolute;top:4px;right:4px;background:var(--red);color:#fff;
  font-size:11px;font-weight:700;min-width:18px;height:18px;border-radius:9px;
  display:grid;place-items:center;padding:0 5px;
}

/* ---------- view ---------- */
.view{flex:1;padding:18px 18px calc(var(--nav-h) + 26px);overflow:auto}
.page-head{display:flex;align-items:center;justify-content:space-between;margin:6px 0 16px}
.page-head h1{font-size:26px;margin:0}
.page-head p{margin:2px 0 0;color:var(--muted);font-size:14px}

/* ---------- cards & grids ---------- */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}
.grid{display:grid;gap:14px}
.grid-2{grid-template-columns:repeat(2,1fr)}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-4{grid-template-columns:repeat(4,1fr)}
.stack{display:flex;flex-direction:column;gap:12px}

/* dashboard stat tiles */
.stat{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  padding:16px;display:flex;flex-direction:column;gap:6px;box-shadow:var(--shadow);
  position:relative;overflow:hidden;
}
.stat .k{font-size:34px;font-weight:800;letter-spacing:-.02em}
.stat .l{font-size:13.5px;color:var(--muted);font-weight:600}
.stat .dot{position:absolute;top:14px;right:14px;width:12px;height:12px;border-radius:50%}
.stat.warn .dot{background:var(--red)}
.stat.ok .dot{background:var(--green)}
.stat.info .dot{background:var(--blue)}
.stat.amber .dot{background:var(--amber)}
.stat .sub{font-size:12px;color:var(--muted)}

/* ---------- badges / chips ---------- */
.badge-inline{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;font-size:13px;font-weight:600}
.tl{display:inline-block;width:12px;height:12px;border-radius:50%}
.tl-red{background:var(--red)} .tl-amber{background:var(--amber)} .tl-green{background:var(--green)}
.chip{display:inline-flex;align-items:center;gap:6px;padding:5px 11px;border-radius:999px;font-size:13px;font-weight:600;border:1px solid var(--line);background:var(--surface-2)}
.chip.red{background:var(--red-soft);color:#991b1b;border-color:#fecaca}
.chip.amber{background:var(--amber-soft);color:#92400e;border-color:#fde68a}
.chip.green{background:var(--green-soft);color:#166534;border-color:#bbf7d0}
.chip.blue{background:var(--blue-soft);color:#1e40af;border-color:#bfdbfe}
.chip.violet{background:var(--violet-soft);color:#5b21b6;border-color:#ddd6fe}

/* ---------- buttons ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:13px 18px;border-radius:12px;font-size:15.5px;font-weight:700;
  background:var(--surface-2);color:var(--ink);border:1px solid var(--line);min-height:48px;
}
.btn:active{transform:scale(.98)}
.btn.primary{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.btn.danger{background:var(--red);color:#fff;border-color:var(--red)}
.btn.ok{background:var(--green);color:#fff;border-color:var(--green)}
.btn.ghost{background:transparent;border-color:var(--line)}
.btn.sm{padding:9px 13px;font-size:14px;min-height:40px}
.btn-row{display:flex;gap:10px;flex-wrap:wrap}

/* ---------- list rows ---------- */
.row{
  display:flex;align-items:center;gap:14px;padding:15px 16px;background:var(--surface);
  border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);
}
.row + .row{margin-top:10px}
.row .main{flex:1;min-width:0}
.row .title{font-size:16px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .meta{font-size:13px;color:var(--muted);margin-top:2px}
.row .right{display:flex;flex-direction:column;align-items:flex-end;gap:6px;flex-shrink:0}
.row .price{font-weight:800;font-size:16px}

/* ---------- timeline ---------- */
.timeline{list-style:none;margin:0;padding:0 0 0 4px;display:flex;flex-direction:column;gap:0}
.timeline li{position:relative;padding:0 0 18px 30px}
.timeline li:before{content:"";position:absolute;left:7px;top:4px;width:14px;height:14px;border-radius:50%;background:var(--accent);border:3px solid #fff;box-shadow:0 0 0 1px var(--line)}
.timeline li + li:before{background:var(--line)}
.timeline li .when{font-size:12px;color:var(--muted);font-weight:700;text-transform:uppercase;letter-spacing:.03em}
.timeline li .what{font-size:15px;margin-top:2px}
.timeline li.in:before{background:var(--green)}
.timeline li.out:before{background:var(--blue)}
.timeline li.note:before{background:var(--amber)}

/* ---------- forms ---------- */
.field{display:flex;flex-direction:column;gap:6px;margin-bottom:12px}
.field label{font-size:13px;font-weight:700;color:var(--muted)}
.field input,.field select,.field textarea{
  padding:13px 14px;border:1px solid var(--line);border-radius:12px;background:var(--surface-2);
  min-height:48px;width:100%;
}
.field textarea{min-height:96px;resize:vertical}
.field input:focus,.field select:focus,.field textarea:focus{outline:none;border-color:var(--accent);background:#fff}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 14px}
.form-grid .field.full{grid-column:1 / -1}

/* ---------- overlay / modal ---------- */
.overlay{position:fixed;inset:0;z-index:80;background:rgba(15,23,42,.5);display:flex;align-items:flex-start;justify-content:center;padding:16px;backdrop-filter:blur(2px)}
.overlay[style*="display:none"]{display:none}
.overlay-panel{background:var(--surface);width:100%;max-width:820px;border-radius:var(--radius);box-shadow:var(--shadow);margin-top:8vh;max-height:84vh;display:flex;flex-direction:column;overflow:hidden}
.overlay-head{display:flex;gap:10px;padding:16px;border-bottom:1px solid var(--line);align-items:center}
.overlay-head input{flex:1;padding:13px 14px;border:1px solid var(--line);border-radius:12px;min-height:48px}
.search-close-btn{width:56px;height:56px;min-width:56px;border-radius:12px;font-size:24px;background:var(--surface-2);border:2px solid var(--line);cursor:pointer;flex-shrink:0;display:flex;align-items:center;justify-content:center;color:var(--text);font-weight:700}
.search-close-btn:hover{background:var(--red);color:#fff;border-color:var(--red)}
.overlay-body{padding:14px 16px;overflow:auto}

.modal-host{position:fixed;inset:0;z-index:70;pointer-events:none}
.modal-host .modal{
  position:fixed;left:0;right:0;bottom:0;background:var(--surface);
  border-radius:22px 22px 0 0;box-shadow:0 -12px 40px rgba(15,23,42,.25);
  max-height:92vh;display:flex;flex-direction:column;overflow:hidden;pointer-events:auto;
  padding:0 16px 20px;animation:up .18s ease-out;
}
@keyframes up{from{transform:translateY(40px);opacity:.4}to{transform:translateY(0);opacity:1}}
.modal .m-head{display:flex;align-items:center;justify-content:space-between;padding:16px 0 12px;border-bottom:1px solid var(--line)}
.modal .m-head h2{font-size:20px;margin:0}
.modal .m-body{padding:16px 0;overflow:auto}
.modal .m-foot{display:flex;gap:10px;padding-top:14px}
.modal .m-foot .btn{flex:1}

/* ---------- bottom nav ---------- */
.bottomnav{
  position:fixed;bottom:0;left:0;right:0;z-index:40;height:var(--nav-h);
  background:var(--surface);border-top:1px solid var(--line);
  display:flex;align-items:stretch;justify-content:space-around;
  box-shadow:0 -4px 20px rgba(15,23,42,.08);
}
.bottomnav button{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  font-size:11.5px;font-weight:600;color:var(--muted);max-width:96px;
}
.bottomnav button span{font-size:23px;line-height:1}
.bottomnav button.active{color:var(--accent)}
.bottomnav button.active span{filter:saturate(1.4)}
@media (max-width:720px){
  .bottomnav button{max-width:70px}
  .bottomnav button small{font-size:10px}
  .grid-4{grid-template-columns:repeat(2,1fr)}
  .grid-3{grid-template-columns:repeat(2,1fr)}
}

/* ---------- toast ---------- */
.toast-host{position:fixed;top:calc(var(--top-h) + 12px);left:50%;transform:translateX(-50%);z-index:90;display:flex;flex-direction:column;gap:8px;width:min(92%,420px)}
.toast{background:var(--ink);color:#fff;padding:13px 16px;border-radius:12px;box-shadow:var(--shadow);font-size:14.5px;font-weight:600;display:flex;gap:10px;align-items:center;animation:fade .2s}
.toast.ok{background:var(--green)} .toast.warn{background:var(--amber);color:#3a2500}
@keyframes fade{from{opacity:0;transform:translateY(-6px)}to{opacity:1}}

/* ---------- calendar ---------- */
.cal{border:1px solid var(--line);border-radius:14px;overflow:hidden}
.cal-head,.cal-grid{display:grid;grid-template-columns:repeat(7,1fr)}
.cal-head div{padding:10px 4px;text-align:center;font-weight:700;font-size:12px;color:var(--muted);background:var(--surface-2);text-transform:uppercase}
.cal-day{min-height:96px;border-top:1px solid var(--line);border-left:1px solid var(--line);padding:6px 6px 4px;background:var(--surface);position:relative}
.cal-day:nth-child(7n+1){border-left:none}
.cal-day .dn{font-size:12px;font-weight:700;color:var(--muted);margin-bottom:4px}
.cal-day.out{background:var(--surface-2)}
.cal-day.out .dn{opacity:.4}
.cal-day.today{background:var(--blue-soft)}
.cal-day.today .dn{color:var(--blue)}
.cal-ev{font-size:11.5px;font-weight:700;padding:4px 6px;border-radius:7px;margin-bottom:4px;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#fff}
.cal-ev .ev-sub{display:block;font-weight:500;font-size:10.5px;opacity:.9}

/* driver colour swatches */
.swatch{display:inline-block;width:14px;height:14px;border-radius:4px;vertical-align:-2px;margin-right:6px}

/* section labels */
.sect{font-size:13px;font-weight:800;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin:20px 0 10px}
.muted{color:var(--muted)} .small{font-size:13px}
.mt{margin-top:14px}.mb{margin-bottom:14px}
.flex{display:flex;align-items:center;gap:10px}.between{justify-content:space-between}
.right{margin-left:auto}
.kv{display:flex;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px dashed var(--line)}
.kv:last-child{border-bottom:none}
.kv .k{color:var(--muted);font-size:14px}
.kv .v{font-weight:700;font-size:14px;text-align:right}
.empty{padding:40px 20px;text-align:center;color:var(--muted)}
.empty .big{font-size:40px;margin-bottom:8px}
.phase2{background:var(--violet-soft);border:1px dashed #c4b5fd;color:#5b21b6;padding:12px 14px;border-radius:12px;font-size:14px;font-weight:600}
.phase-row{display:flex;gap:14px;padding:14px 0;border-bottom:1px solid var(--line);align-items:flex-start}
.phase-row:last-of-type{border-bottom:0}
.phase-ico{width:44px;height:44px;border-radius:12px;background:var(--surface-2);display:flex;align-items:center;justify-content:center;font-size:22px;flex-shrink:0}
.phase-body{flex:1;min-width:0}
.phase-title{font-weight:600;margin-bottom:3px}
hr{border:none;border-top:1px solid var(--line);margin:18px 0}
.tag{font-size:12px;font-weight:700;padding:3px 8px;border-radius:8px;background:var(--surface-2);border:1px solid var(--line)}
