:root{
  --primary:#2c3e50;
  --accent:#3f8efc;
  --light:#f5f7fa;
  --danger:#c0392b;
  --success:#2e7d32;
  --border:#e0e6ed;
  --text:#1f2937;
  --muted:#6b7280;
  --card:#ffffff;
  --shadow:0 10px 30px rgba(0,0,0,.06);
  --radius:10px;
}

/* Base */
*{box-sizing:border-box}
body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,system-ui,Arial,sans-serif;
  background:var(--light);
  color:#333;
}
a{color:inherit}
img{max-width:100%}

/* Header + nav */
header{
  background:var(--primary);
  color:#fff;
  padding:16px 24px;
  border-bottom:3px solid var(--accent);
}
header h1{
  margin:0;
  font-size:20px;
  font-weight:800;
}
nav{
  margin-top:10px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
nav a{
  text-decoration:none;
  padding:6px 12px;
  background:rgba(255,255,255,.1);
  color:rgba(255,255,255,.9);
  border:1px solid rgba(255,255,255,.15);
  border-radius:999px;
  font-size:13px;
  font-weight:500;
  transition:background .12s, color .12s;
}
nav a:hover{background:rgba(255,255,255,.22); color:#fff}
nav a.active{background:var(--accent); border-color:var(--accent); color:#fff}

/* Layout */
.container{
  max-width:1100px;
  margin:24px auto;
  padding:0 20px;
}

/* Cards */
.card{
  background:var(--card);
  padding:20px;
  border-radius:var(--radius);
  border:1px solid var(--border);
  box-shadow:var(--shadow);
  margin-bottom:20px;
}
.card-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.card-body{}

/* Page header helpers (optional) */
.page-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:14px;
  margin-bottom:14px;
}
.page-title{
  margin:0;
  font-size:22px;
  font-weight:900;
}
.page-subtitle{
  margin:6px 0 0 0;
  color:var(--muted);
  font-size:14px;
}

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:9px 16px;
  background:var(--accent);
  color:#fff;
  border-radius:8px;
  text-decoration:none;
  border:1px solid transparent;
  cursor:pointer;
  font-weight:600;
  font-size:14px;
  transition:filter .12s, transform .08s, box-shadow .12s;
}
.btn:hover{filter:brightness(.94); box-shadow:0 2px 8px rgba(0,0,0,.12)}
.btn:active{transform:translateY(1px); box-shadow:none}
.btn-primary{background:var(--accent); color:#fff; border-color:transparent;}
.btn-secondary{background:#fff; color:#111; border-color:var(--border);}
.btn-danger{background:var(--danger)}
.btn-success{background:var(--success)}
/* Some templates use .primary */
.primary{background:var(--accent)!important; color:#fff!important; border-color:transparent!important;}

/* Button rows / actions */
.btnrow, .actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.btnrow{justify-content:center}
.actions{justify-content:flex-start}
.wrap{flex-wrap:wrap}

/* Forms */
.field{margin-bottom:12px}
label{display:block; font-weight:700; margin-bottom:6px}
input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="datetime-local"],
input[type="password"], select, textarea{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:8px;
  background:#fff;
  font-size:14px;
  transition:border-color .15s, box-shadow .15s;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="number"]:focus,
input[type="date"]:focus, input[type="datetime-local"]:focus,
input[type="password"]:focus, select:focus, textarea:focus{
  outline:none;
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(63,142,252,.15);
}
textarea{min-height:110px}
.inline-form{display:flex; gap:10px; flex-wrap:wrap; align-items:end}
.inline-form > *{flex:0 0 auto}
.inline-form input[type="number"]{width:110px}
.inline-form select{min-width:220px}

/* Tables */
.table-wrap{overflow:auto}
table{
  width:100%;
  border-collapse:collapse;
  margin-top:10px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:12px;
  overflow:hidden;
}
th, td{
  border-bottom:1px solid var(--border);
  padding:10px;
  text-align:left;
  font-size:14px;
}
th{background:#eef2f7; font-weight:800}
tr:last-child td{border-bottom:none}

/* Messages */
.messages{margin-bottom:16px}
.message{
  padding:10px 12px;
  border-radius:10px;
  margin-bottom:8px;
  border:1px solid var(--border);
  background:#fff;
}
.message.success{background:#e6f4ea; border-color:#b7e0c2}
.message.error{background:#fdecea; border-color:#f5b7b1}
.message.info{background:#e8f0fe; border-color:#c7d2fe}
.message.warning{background:#fff4e5; border-color:#f2d19b}

/* Small UI bits */
.muted{color:var(--muted)}
.small{font-size:12px; color:var(--muted)}
.chip{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  background:#eef2f7;
  border:1px solid var(--border);
  font-size:12px;
  font-weight:700;
}
.empty{
  padding:14px;
  border:1px dashed var(--border);
  border-radius:12px;
  background:#fff;
  color:var(--muted);
}

/* Simple grid helper */
.grid{
  display:grid;
  gap:12px;
}
@media (min-width: 900px){
  .grid.cols-2{grid-template-columns:repeat(2, minmax(0, 1fr))}
  .grid.cols-3{grid-template-columns:repeat(3, minmax(0, 1fr))}
}

/* Footer */
footer{
  text-align:center;
  padding:20px;
  font-size:13px;
  color:#777;
}

/* =========================
   Enhanced tables (scroll + filter + sort)
   Expected structure:
   <div class="table-card card">
     <div class="table-controls">...</div>
     <div class="table-wrap">
       <table data-table>...</table>
     </div>
   </div>
   ========================= */

/* Controls row */
.table-controls{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  justify-content:flex-end;
  padding:12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  margin-bottom:12px;
}

/* Filter input + select */
.table-filter,
.table-select{
  height:40px;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#fff;
  font-size:14px;
}

.table-filter{
  width:min(420px, 100%);
  outline:none;
}

.table-filter:focus,
.table-select:focus{
  outline:none;
  border-color: rgba(63,142,252,.6);
  box-shadow: 0 0 0 3px rgba(63,142,252,.12);
}

/* Scroll wrapper owns border/radius */
.table-wrap{
  max-height:520px;          /* tweak per page if needed */
  overflow:auto;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
}

/* Table inside wrapper: no extra borders/radius */
.table-wrap table{
  width:100%;
  border-collapse:separate;  /* IMPORTANT for sticky header + radius */
  border-spacing:0;
  margin-top:0;
  border:0;
  background:transparent;
}

/* Cells */
.table-wrap th,
.table-wrap td{
  border-bottom:1px solid var(--border);
  padding:10px;
  text-align:left;
  font-size:14px;
  background:#fff;
}

.table-wrap th{
  background:#eef2f7;
  font-weight:800;
}

/* Sticky header */
.table-wrap thead th{
  position:sticky;
  top:0;
  z-index:2;
}

/* Remove last border */
.table-wrap tbody tr:last-child td{
  border-bottom:none;
}

/* Sorting indicators (JS toggles data-sort-dir on TH) */
.table-wrap th[data-sort]{
  user-select:none;
  cursor:pointer;
}

.table-wrap th[data-sort][data-sort-dir="asc"]::after{
  content:" ▲";
  font-size:12px;
  color:var(--muted);
}

.table-wrap th[data-sort][data-sort-dir="desc"]::after{
  content:" ▼";
  font-size:12px;
  color:var(--muted);
}

.table-wrap th[data-sort]:hover{
  filter:brightness(.98);
}

/* Secretary home polish */
.secretary-home{padding:22px}

/* Top bar */
.topbar{
  display:flex;
  gap:14px;
  align-items:flex-end;
  justify-content:space-between;
  margin-bottom:14px;
}
.topbar-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  justify-content:flex-end;
}
@media (max-width: 820px){
  .topbar{flex-direction:column; align-items:stretch}
  .topbar-actions{justify-content:flex-start}
}

/* Filters grid */
.filters-grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:12px;
}
@media (max-width: 1000px){
  .filters-grid{grid-template-columns: repeat(2, minmax(0, 1fr));}
}
@media (max-width: 560px){
  .filters-grid{grid-template-columns: 1fr;}
}

.filter-field{display:flex; flex-direction:column; gap:6px; min-width:0;}
.filter-label{
  font-size:12px;
  font-weight:800;
  color:var(--muted);
  margin:0;
}

/* Table tweaks */
.dockets-table .col-id{width:70px; white-space:nowrap;}
.dockets-table .col-size{width:120px; white-space:nowrap;}
.dockets-table .col-status{width:140px; white-space:nowrap;}
.dockets-table .col-created{width:170px; white-space:nowrap;}

.pet-link{
  font-weight:700;
  text-decoration:none;
  color:var(--accent);
}
.pet-link:hover{text-decoration:underline; color:#2563eb}

/* Status pill */
.status-pill{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  background:#eef2f7;
  border:1px solid var(--border);
  font-size:12px;
  font-weight:800;
}

/* Color-coded status variants — add class="status-pill status-{{ d.status|lower }}" in templates */
.status-pill.status-pending_collection  { background:#eff6ff; border-color:#bfdbfe; color:#1d4ed8; }
.status-pill.status-collected           { background:#fff7ed; border-color:#fed7aa; color:#c2410c; }
.status-pill.status-awaiting_extras     { background:#faf5ff; border-color:#e9d5ff; color:#7e22ce; }
.status-pill.status-awaiting_cremation  { background:#fff7ed; border-color:#fdba74; color:#9a3412; }
.status-pill.status-cremating           { background:#fff1f2; border-color:#fecdd3; color:#be123c; }
.status-pill.status-ready_for_return    { background:#f0fdf4; border-color:#bbf7d0; color:#15803d; }
.status-pill.status-returned            { background:#dcfce7; border-color:#86efac; color:#166534; }

/* Row hover */
.table-wrap tbody tr:hover td{
  background:#f8fafc;
}

/* Clinical Waste layout */
.cw-layout{margin-top:14px}
.cw-col{min-width:0}

/* Add row */
.cw-addrow{
  display:grid;
  grid-template-columns: 1fr 140px 130px;
  gap:12px;
  align-items:end;
}
@media (max-width: 720px){
  .cw-addrow{grid-template-columns: 1fr 1fr; }
  .cw-addbtn{grid-column: 1 / -1;}
}
.cw-field{min-width:0}
.cw-label-spacer{visibility:hidden}

/* Divider */
.cw-divider{
  height:1px;
  background:var(--border);
  margin:14px 0;
}

/* Tables: tighter and more readable */
.cw-table th, .cw-table td{padding:9px 10px}
.cw-num{text-align:right; white-space:nowrap}
.cw-date{white-space:nowrap}

/* Cart wrapper */
.cw-cartwrap{max-height:260px}

/* Smaller button for remove */
.cw-btn-sm{
  padding:7px 10px;
  font-size:13px;
  border-radius:10px;
}

/* Cycles */
.cw-cycles{display:flex; flex-direction:column; gap:12px}
.cw-cycle{
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px;
  background:#fff;
}
.cw-cyclehead{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
}
.cw-cycletable{max-height:220px}

/* Make tables less cramped on small screens */
@media (max-width: 520px){
  .cw-date{display:none;}
}

/* Ops Clinical Waste Dashboard polish */
.ops-dashboard .ops-card{
  padding:18px;
}

.ops-dashboard .section-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}

.ops-dashboard .section-title{
  margin:0;
  font-size:18px;
  font-weight:900;
}

.ops-dashboard .section-subtitle{
  margin:6px 0 0 0;
  font-size:13px;
}

.ops-dashboard .section-meta{
  display:flex;
  gap:8px;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
}

/* Make empty states look intentional */
.ops-dashboard .empty-state{
  padding:14px;
  border:1px dashed var(--border);
  border-radius:12px;
  background:#fff;
  color:var(--muted);
}

/* Tighten tables on this page */
.ops-dashboard table th,
.ops-dashboard table td{
  padding:9px 10px;
}

/* Better action bar */
.ops-dashboard .actions{
  margin-top:12px;
  gap:10px;
}

/* Buttons line up better on small screens */
@media (max-width: 720px){
  .ops-dashboard .section-head{align-items:flex-start; flex-direction:column}
  .ops-dashboard .section-meta{justify-content:flex-start}
}

/* Ops Dashboard layout + polish */
.ops-grid{gap:16px}
.ops-card{padding:18px}

.section-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.section-title{margin:0; font-size:18px; font-weight:900}
.section-subtitle{margin:6px 0 0 0; font-size:13px}
.section-meta{display:flex; gap:8px; flex-wrap:wrap; align-items:center}

.empty-state{
  padding:14px;
  border:1px dashed var(--border);
  border-radius:12px;
  background:#fff;
  color:var(--muted);
}

.ops-stack{display:flex; flex-direction:column; gap:12px}
.ops-block{
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px;
  background:#fff;
}
.ops-blockhead{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:10px;
}
.ops-title{font-weight:900; font-size:16px}
.ops-table-tight{max-height:260px}

.ops-detail td{
  background:#fafbfc;
}

@media (max-width: 900px){
  .section-head{flex-direction:column; align-items:flex-start}
}

.engraving-filterbar{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:12px 0 16px;
}

.engraving-chip{
  border:1px solid var(--border);
  background:#fff;
  padding:8px 10px;
  border-radius:999px;
  font-weight:800;
  font-size:13px;
  cursor:pointer;
}

.engraving-chip:hover{filter:brightness(.98)}

.engraving-chip.is-active{
  background:var(--accent);
  color:#fff;
  border-color:transparent;
}

.engraving-selected{
  margin-left:auto;
  font-size:13px;
}
@media (max-width: 720px){
  .engraving-selected{margin-left:0; width:100%;}
}

.inscription-cell{
  max-width: 520px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Technician dashboard v2 (list-based, faster to scan) */
.tech-dashboard .page-head{margin-bottom:10px}

.tech-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:10px 0 14px;
}

.tech-tab{
  border:1px solid var(--border);
  background:#fff;
  padding:10px 12px;
  border-radius:999px;
  font-weight:900;
  font-size:13px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:8px;
}

.tech-tab.is-active{
  background:var(--accent);
  color:#fff;
  border-color:transparent;
}

.tech-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:24px;
  height:20px;
  padding:0 8px;
  border-radius:999px;
  border:1px solid var(--border);
  background:#eef2f7;
  color:#111;
  font-weight:900;
  font-size:12px;
}
.tech-tab.is-active .tech-badge{
  background:rgba(255,255,255,.18);
  border-color:rgba(255,255,255,.25);
  color:#fff;
}

.tech-grid{align-items:start}
.tech-stage{min-width:0}

.tech-list{display:flex; flex-direction:column; gap:10px}

.tech-item{
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px;
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.tech-main{min-width:0}
.tech-title{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.tech-id{font-weight:900}
.tech-pet{font-weight:900}
.tech-sub{font-size:13px}

.tech-actions{display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end}
.tech-inline{display:flex; gap:10px; align-items:end; flex-wrap:wrap}

.tech-input{
  width:110px !important;
  height:40px;
}

.tech-select{
  min-width:90px;
  height:40px;
}

/* Mobile: tabs control visibility so you don't scroll forever */
@media (max-width: 900px){
  .tech-grid{grid-template-columns:1fr}
  .tech-stage{display:none}
  .tech-stage.is-visible{display:block}
}

/* ─── Technician Pipeline ─────────────────────────────────── */

/* Pipeline summary bar */
.pipeline-bar{
  display:flex;
  align-items:stretch;
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  padding:5px;
  margin-bottom:28px;
  box-shadow:0 2px 10px rgba(0,0,0,.07);
  gap:0;
}
.pipeline-step{
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  padding:13px 8px;
  border:none;
  border-radius:10px;
  background:transparent;
  cursor:pointer;
  font-family:inherit;
  color:var(--text);
  position:relative;
  transition:background .2s, color .2s, box-shadow .2s;
}
/* Divider between steps */
.pipeline-step + .pipeline-step::before{
  content:'';
  position:absolute;
  left:0; top:22%; height:56%; width:1px;
  background:var(--border);
  pointer-events:none;
}
.pipeline-step:hover{ background:#f0f5ff; }
.pipeline-step.is-active{
  background:linear-gradient(145deg, #3b82f6 0%, #1d4ed8 100%);
  color:#fff;
  box-shadow:0 4px 12px rgba(29,78,216,.3);
}
.pipeline-step.is-active::before,
.pipeline-step.is-active + .pipeline-step::before{ display:none; }
.pipeline-step:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
}
.pipeline-num{
  font-size:28px; font-weight:900; line-height:1;
  letter-spacing:-.03em;
}
.pipeline-label{
  font-size:11px; font-weight:600; white-space:nowrap;
  color:var(--muted);
}
.pipeline-step.is-active .pipeline-label{ color:rgba(255,255,255,.85); }

/* Stage sections */
.pipeline-stage{
  display:none;
  margin-bottom:32px;
}
/* Fade-in when entering (mobile only — JS adds/removes is-entering) */
@keyframes stageFadeIn{
  from{ opacity:0; transform:translateY(10px); }
  to  { opacity:1; transform:none; }
}
.pipeline-stage.is-entering{
  display:block;
  animation:stageFadeIn .2s ease both;
}
.pipeline-stage.is-visible{ display:block; }

/* Stage head — shared */
.pipeline-stage-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:#fff;
  border:1px solid var(--border);
  border-radius:12px 12px 0 0;
  border-bottom:2px solid var(--border);
  padding:14px 20px;
  border-left-width:4px;
}
/* Per-stage accent color on the left border */
#stage-collected  .pipeline-stage-head{ border-left-color:#f59e0b; }
#stage-awaiting   .pipeline-stage-head{ border-left-color:#3b82f6; }
#stage-cremating  .pipeline-stage-head{ border-left-color:#ea580c; }
#stage-return     .pipeline-stage-head{ border-left-color:#16a34a; }

.pipeline-stage-title{ display:flex; align-items:center; gap:10px; }
.pipeline-stage-title h2{ margin:0; font-size:16px; font-weight:700; letter-spacing:-.01em; }
.pipeline-dot{
  width:10px; height:10px; border-radius:50%; flex-shrink:0;
  box-shadow:0 0 0 3px rgba(0,0,0,.08);
}
.dot-amber { background:#f59e0b; }
.dot-blue  { background:#3b82f6; }
.dot-orange{ background:#ea580c; }
.dot-green { background:#16a34a; }

/* Stage body — the framed area below the head */
.stage-body{
  background:#f4f6f9;
  border:1px solid var(--border);
  border-top:none;
  border-radius:0 0 12px 12px;
  padding:16px;
}
.stage-hint{
  margin:0 0 14px;
  font-size:13px;
  color:var(--muted);
}
.stage-body > .empty{
  padding:36px 20px;
  color:var(--muted);
  text-align:center;
  font-size:14px;
  background:#fff;
  border-radius:8px;
  border:1px dashed var(--border);
}

/* Cards grid */
.pipeline-cards{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(300px,1fr));
  gap:14px;
}

/* ── Pet cremation card ──────────────────────────────── */
.pipeline-card{
  display:flex;
  flex-direction:column;
  border-radius:12px;
  overflow:hidden;
  border:1px solid #e2e8f0;
  box-shadow:0 2px 6px rgba(0,0,0,.06);
  transition:box-shadow .2s, transform .2s;
  background:#fff;
}
.pipeline-card:hover{
  box-shadow:0 8px 24px rgba(0,0,0,.11);
  transform:translateY(-2px);
}
.pipeline-card.has-extras{ border-top:3px solid #f59e0b; }
.pipeline-card.is-complete{ border-top:3px solid #16a34a; }

/* ── Card header: dark with pet name ─────────────────── */
.pcard-head{
  padding:14px 16px 12px;
  background:linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color:#fff;
}
.pcard-head-cremating{
  background:linear-gradient(135deg, #431407 0%, #7c2d12 100%);
}
.pcard-head-return{
  background:linear-gradient(135deg, #052e16 0%, #14532d 100%);
}
.pcard-name-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:5px;
}
.pcard-name{
  margin:0;
  font-size:19px; font-weight:900;
  letter-spacing:-.02em; line-height:1.1;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.pcard-size{
  flex-shrink:0;
  font-size:10px; font-weight:800; letter-spacing:.05em;
  padding:3px 9px; border-radius:20px;
  background:rgba(255,255,255,.15);
  color:#fff;
  border:1px solid rgba(255,255,255,.22);
  text-transform:uppercase;
}
.pcard-meta{
  display:flex; align-items:center; gap:5px;
  font-size:12px; color:rgba(255,255,255,.55);
  overflow:hidden;
}
.pcard-id{ font-weight:700; color:rgba(255,255,255,.75); flex-shrink:0; }
.pcard-sep{ opacity:.35; flex-shrink:0; }
.pcard-clinic{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ── Stats strip ─────────────────────────────────────── */
.pcard-stats{
  display:flex;
  background:#f8fafc;
  border-bottom:1px solid #eef2f7;
}
.pcard-stat{
  flex:1;
  display:flex; flex-direction:column; align-items:center;
  padding:10px 8px 8px;
  gap:2px;
  border-right:1px solid #eef2f7;
}
.pcard-stat:last-child{ border-right:none; }
.pcard-stat-val{
  font-size:20px; font-weight:900; color:var(--text);
  letter-spacing:-.03em; line-height:1;
}
.pcard-stat-lbl{
  font-size:10px; font-weight:700; color:#94a3b8;
  text-transform:uppercase; letter-spacing:.07em;
}
.pcard-stat-green{ color:#16a34a; }
.pcard-stat-amber{ color:#d97706; }

/* ── Card body: info rows ────────────────────────────── */
.pcard-body{
  padding:12px 14px;
  display:flex; flex-direction:column; gap:9px;
  flex:1;
}
.pcard-row{
  display:flex; align-items:flex-start; gap:10px;
}
.pcard-row-lbl{
  flex-shrink:0;
  min-width:64px;
  padding-top:3px;
  font-size:10px; font-weight:800; color:#94a3b8;
  text-transform:uppercase; letter-spacing:.07em;
  line-height:1.3;
}
.pcard-chips{
  display:flex; flex-wrap:wrap; gap:5px; flex:1;
  align-items:center;
}

/* Extras row: highlighted box */
.pcard-row-extras{
  padding:7px 9px;
  border-radius:8px;
  border:1px solid #fde68a;
  background:#fffbeb;
  margin:0 -2px;
}
.pcard-row-extras .pcard-row-lbl{ color:#92400e; }
.pcard-row-extras.is-done{
  border-color:#bbf7d0;
  background:#f0fdf4;
}
.pcard-row-extras.is-done .pcard-row-lbl{ color:#15803d; }

/* Mini status badges */
.pcard-badge{
  font-size:11px; font-weight:700;
  padding:2px 8px; border-radius:20px;
  flex-shrink:0;
}
.pcard-badge-done{
  background:#dcfce7; color:#15803d; border:1px solid #86efac;
}
.pcard-badge-warn{
  background:#fef3c7; color:#92400e; border:1px solid #fde68a;
}

/* Technician notes */
.pcard-notes{
  font-size:13px; color:#1e3a5f;
  background:#eff6ff;
  border-left:3px solid #3f8efc;
  padding:7px 11px; border-radius:0 6px 6px 0;
  display:block; line-height:1.5;
}

/* Inscription */
.pcard-inscription{
  font-size:13px; font-style:italic; color:#475569;
  background:#f5f7ff;
  border-left:3px solid #818cf8;
  padding:7px 11px; border-radius:0 6px 6px 0;
  line-height:1.55;
}

/* ── Card footer ─────────────────────────────────────── */
.pcard-footer{
  display:flex; flex-wrap:wrap; align-items:center; gap:8px;
  padding:11px 14px;
  background:#f8fafc;
  border-top:1px solid #eef2f7;
  margin-top:auto;
}

/* Weight form (stage 1) */
.pcard-weight-form{ flex-direction:column; gap:7px; }
.pcard-weight-lbl{
  font-size:10px; font-weight:800; color:#64748b;
  text-transform:uppercase; letter-spacing:.07em;
}
.pcard-weight-row{ display:flex; gap:8px; align-items:center; width:100%; }
.pcard-weight-input{
  flex:1; min-width:0;
  border:1.5px solid #cbd5e1; border-radius:8px;
  padding:9px 12px;
  font-size:16px; font-weight:700; font-family:inherit;
  transition:border-color .15s, box-shadow .15s;
}
.pcard-weight-input:focus{
  outline:none; border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(63,142,252,.15);
}

/* IC lane select + start button (stage 2) */
.pcard-inline-form{ display:flex; gap:8px; align-items:center; }
.pcard-select{
  border:1.5px solid #cbd5e1; border-radius:8px;
  padding:8px 10px;
  font-size:14px; font-weight:600; font-family:inherit;
  background:#fff; cursor:pointer;
  transition:border-color .15s;
}
.pcard-select:focus{ outline:none; border-color:var(--accent); }

/* Full-width button (stage 3) */
.pcard-full-btn{ width:100%; justify-content:center; }

/* Return status footer (stage 4) */
.pcard-footer-return{
  background:#f0fdf4;
  border-top-color:#bbf7d0;
  justify-content:center;
}
.pcard-return-status{
  font-size:13px; font-weight:600; color:#15803d;
}

/* Chip colours */
.chip-container{ background:#eff6ff; color:#1d4ed8; font-weight:600; border:1px solid #bfdbfe; }
.chip-extra    { background:#fef9c3; color:#92400e; font-weight:600; border:1px solid #fde68a; }
.chip-extra-done{ background:#dcfce7; color:#15803d; font-weight:600; border:1px solid #bbf7d0; }

/* Buttons inside cards */
.pipeline-card .btn{
  border-radius:8px; font-size:13px; padding:8px 16px;
}
.pipeline-card .btn-success{ background:#16a34a; border-color:#16a34a; }
.pipeline-card .btn-success:hover{ background:#15803d; border-color:#15803d; }

/* ── Cremating: IC lane blocks ───────────────────────── */
.lanes-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(280px,1fr));
  gap:20px;
}
.lane-block{ display:flex; flex-direction:column; }
.lane-header{
  display:flex; align-items:center; gap:10px;
  font-size:12px; font-weight:900; letter-spacing:.1em;
  text-transform:uppercase; color:#fff;
  background:var(--primary);
  border-radius:10px 10px 0 0;
  padding:10px 16px;
}
.lane-pulse{
  width:8px; height:8px; border-radius:50%; flex-shrink:0;
  background:#fb923c;
  animation:lanePulse 2s ease infinite;
}
@keyframes lanePulse{
  0%  { box-shadow:0 0 0 0 rgba(251,146,60,.7); }
  60% { box-shadow:0 0 0 7px rgba(251,146,60,0); }
  100%{ box-shadow:0 0 0 0 rgba(251,146,60,0); }
}
.lane-cards{
  display:flex; flex-direction:column; gap:12px;
  border:1.5px solid #cbd5e1;
  border-top:none;
  border-radius:0 0 10px 10px;
  padding:12px;
  background:#f1f5f9;
  flex:1;
}

/* ── Responsive ──────────────────────────────────────── */
@media(max-width:900px){
  .pipeline-bar{ border-radius:10px; padding:4px; }
  .pipeline-step{ padding:10px 6px; }
  .pipeline-step + .pipeline-step::before{ display:none; }
  .pipeline-num{ font-size:22px; }
  .pipeline-label{ font-size:10px; }
  .pipeline-stage-head{ padding:12px 14px; }
  .stage-body{ padding:12px; }
  .pipeline-cards{ grid-template-columns:1fr; }
  .lanes-grid{ grid-template-columns:1fr; gap:14px; }
  .pcard-name{ font-size:17px; }
}

/* Driver Home */
.driver-home{padding-top:6px}

.driver-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
  margin-top:12px;
}
@media (max-width: 900px){
  .driver-grid{grid-template-columns:1fr}
}

.driver-tile{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:14px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  text-decoration:none;
  box-shadow:0 8px 22px rgba(0,0,0,.04);
}
.driver-tile:hover{
  filter:brightness(.99);
  box-shadow:0 10px 28px rgba(0,0,0,.06);
}
.driver-tile:active{transform:translateY(1px)}

.driver-tile-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.driver-tile-title{
  font-weight:900;
  font-size:16px;
  color:var(--text);
}
.driver-tile-sub{
  color:var(--muted);
  font-size:13px;
  line-height:1.35;
  min-height:34px;
}

.driver-tile-action{margin-top:auto}
.driver-btn{
  width:100%;
  justify-content:center;
}

/* Driver Pickup - Select Vet */
.pickup-card{max-width:720px; margin:0 auto}
.pickup-form{margin-top:10px}

.pickup-fields p{margin:0 0 12px}
.pickup-fields label{
  display:block;
  font-weight:800;
  margin-bottom:6px;
  color:var(--text);
}

.pickup-fields select,
.pickup-fields input[type="text"],
.pickup-fields input[type="search"]{
  width:100%;
}

.pickup-actions{justify-content:flex-end}

/* Typeahead dropdown */
.typeahead-results{
  position:relative;
  margin-top:4px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  box-shadow:var(--shadow);
  max-height:240px;
  overflow:auto;
  display:none;
  z-index:20;
}

.typeahead-item{
  padding:10px 12px;
  cursor:pointer;
  font-size:14px;
}

.typeahead-item:hover{
  background:#eef2f7;
}

/* Typeahead wrapper so dropdown can anchor under input */
.typeahead-wrap{
  position:relative;
}

/* Make dropdown overlay under the input (not push layout down) */
.typeahead-results{
  position:absolute;
  left:0;
  right:0;
  top:calc(100% + 6px);
  margin-top:0;
}

/* Optional: subtle divider between items */
.typeahead-item + .typeahead-item{
  border-top:1px solid var(--border);
}

/* Invoice page */
.invoice-grid{align-items:start}
.invoice-page .cw-table td{vertical-align:top}

/* ── Vet Portal ─────────────────────────────────────────────── */
.vet-hero{
  display:flex;
  gap:16px;
  align-items:stretch;
  margin-bottom:18px;
  flex-wrap:wrap;
}
.vet-hero-left{
  flex:1;
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  padding:22px 24px;
  box-shadow:0 4px 16px rgba(0,0,0,.04);
  min-width:200px;
}
.vet-hero-title{
  font-size:21px;
  font-weight:900;
  color:var(--text);
  margin-bottom:4px;
}
.vet-hero-sub{
  font-size:13px;
  color:var(--muted);
  margin-bottom:14px;
}
.vet-hero-chips{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.vet-hero-right{
  min-width:210px;
  flex-shrink:0;
}
.vet-balance{
  height:100%;
  border-radius:14px;
  padding:20px 22px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  min-height:110px;
  box-sizing:border-box;
}
.vet-balance-due{
  background:linear-gradient(135deg,#fef2f2,#fee2e2);
  border:1px solid #fca5a5;
}
.vet-balance-clear{
  background:linear-gradient(135deg,#f0fdf4,#dcfce7);
  border:1px solid #86efac;
}
.vet-balance-label{
  font-size:11px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--muted);
  margin-bottom:6px;
}
.vet-balance-amount{
  font-size:30px;
  font-weight:900;
  color:var(--text);
  line-height:1;
  margin-bottom:6px;
}
.vet-balance-due  .vet-balance-amount{ color:var(--danger); }
.vet-balance-clear .vet-balance-amount{ color:#16a34a; }
.vet-balance-hint{ font-size:12px; color:var(--muted); }

/* Quick action tiles */
.vet-actions{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:14px;
  margin-bottom:20px;
}
@media(max-width:640px){
  .vet-actions{ grid-template-columns:1fr; }
}
.vet-action-tile{
  display:flex;
  align-items:center;
  gap:14px;
  padding:16px 18px;
  border-radius:14px;
  text-decoration:none;
  border:1px solid var(--border);
  background:#fff;
  box-shadow:0 4px 14px rgba(0,0,0,.04);
  transition:box-shadow .15s,transform .1s;
}
.vet-action-tile:hover{
  box-shadow:0 8px 24px rgba(0,0,0,.09);
  transform:translateY(-1px);
}
.vet-action-tile:active{ transform:translateY(0); }
.vet-action-primary{
  border-color:rgba(37,99,235,.28);
  background:linear-gradient(135deg,#eff6ff,#dbeafe);
}
.vet-action-waste{
  border-color:rgba(5,150,105,.28);
  background:linear-gradient(135deg,#f0fdf4,#dcfce7);
}
.vet-action-icon{ font-size:26px; line-height:1; flex-shrink:0; }
.vet-action-body{ flex:1; min-width:0; }
.vet-action-title{
  font-weight:800;
  font-size:14px;
  color:var(--text);
  margin-bottom:3px;
}
.vet-action-desc{ font-size:12px; color:var(--muted); line-height:1.35; }
.vet-action-arrow{
  font-size:18px;
  color:var(--muted);
  flex-shrink:0;
  transition:transform .15s;
}
.vet-action-tile:hover .vet-action-arrow{ transform:translateX(3px); }

/* Balance cell in invoice table */
.vet-balance-cell-due{ color:var(--danger); }

@media(max-width:720px){
  .vet-hero{ flex-direction:column; }
  .vet-hero-right{ min-width:0; }
  .vet-balance{ min-height:80px; }
}

/* Cremation docket form layout helpers */
.docket-card { max-width: 900px; margin: 0 auto; }

.form-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.form-section-head { margin-bottom: 10px; }
.form-section-title { margin: 0; font-size: 16px; font-weight: 900; }

.check-grid {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.check-grid label { display: flex; gap: 10px; align-items: center; font-weight: 700; margin: 0; }
.check-grid input[type="checkbox"] { width: 16px; height: 16px; }

/* On very small screens, give driver tiles more breathing room */
@media (max-width: 520px){
  .driver-tile{padding:16px;}
}

.form-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.field input,
.field select,
.field textarea{
  width:100%;
}

.field-errors{
  color:#dc2626;
  font-size:12px;
  font-weight:700;
}

@media (max-width: 860px){
  .form-grid{ grid-template-columns: 1fr; }
}

.auth-body{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
}

.auth-container{
  max-width: 520px;
  width:100%;
}

.auth-card{
  padding: 22px;
}

.auth-brand{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
}

.auth-logo{
  font-weight:900;
  letter-spacing:.2px;
}

.auth-alert{
  margin-top:12px;
  border:1px solid #fecaca;
  background:#fff1f2;
  color:#991b1b;
  padding:10px 12px;
  border-radius:10px;
  font-weight:700;
  font-size:13px;
}

.auth-form .field{
  margin-top:12px;
}

.auth-passrow{
  display:flex;
  gap:10px;
  align-items:center;
}

.auth-eye{
  white-space:nowrap;
}

.auth-submit{
  width:100%;
}

.auth-footer{
  margin-top:14px;
  text-align:center;
}

/* =============================================================================
   Driver app (Phase 1)
   Mobile-first styles for the driver pickup/return flow. Designed to work
   one-handed on a phone in patchy signal at a clinic in the rain.
   All classes are .drv- prefixed to avoid collision with the rest of app.css.
   ============================================================================= */

.drv-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 12px 48px 12px;
  background: #f0f4f8;
  min-height: 100vh;
}
.drv-shell h1 {
  margin: 6px 0 14px 0;
  font-size: 22px;
  font-weight: 700;
}
.drv-shell h2 {
  margin: 18px 0 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* The gradient header strip at the top of the driver screens. */
.drv-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8e 60%, #3f8efc 100%);
  color: #fff;
  margin: -16px -12px 16px -12px;
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
}
.drv-header::after {
  content: '';
  position: absolute;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  bottom: -60px; right: -20px;
  pointer-events: none;
}
.drv-header .drv-header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  position: relative;
}
.drv-header .drv-header-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.28);
  color: #fff;
  border-radius: 7px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s;
}
.drv-header .drv-header-back:hover { background: rgba(255,255,255,.28); }
.drv-header .drv-header-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.3px;
  position: relative;
}
.drv-header .drv-header-sub {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 4px;
  line-height: 1.5;
  position: relative;
}
.drv-header a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
}
.drv-header a:hover { color: #fff; }

/* The full-width buttons used everywhere — at least 48px tall for thumb
   accuracy, big readable labels, optional .sub line for context. */
.drv-btn {
  display: block;
  width: 100%;
  padding: 16px 18px;
  margin: 0 0 10px 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text, #1f2937);
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  line-height: 1.3;
  cursor: pointer;
  font-family: inherit;
}
.drv-btn:hover { background: var(--light); }
.drv-btn:active { transform: translateY(1px); }
.drv-btn .drv-btn-sub {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 400;
  opacity: 0.8;
}
.drv-btn.drv-btn-primary {
  background: linear-gradient(135deg, #1e3a5f, #3f8efc);
  color: #fff;
  border-color: transparent;
}
.drv-btn.drv-btn-primary:hover { filter: brightness(.92); }
.drv-btn.drv-btn-success {
  background: linear-gradient(135deg, #14532d, #16a34a);
  color: #fff;
  border-color: transparent;
}
.drv-btn.drv-btn-success:hover { filter: brightness(.92); }
.drv-btn.drv-btn-danger {
  background: linear-gradient(135deg, #7f1d1d, #dc2626);
  color: #fff;
  border-color: transparent;
}
.drv-btn.drv-btn-danger:hover { filter: brightness(.92); }

/* Stop row — clickable row in the route view and the clinic stop view */
.drv-stop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
  text-decoration: none;
  color: var(--text, #1f2937);
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  transition: box-shadow .15s, border-color .15s, background .1s;
}
.drv-stop-row:hover { background: #f8fafc; box-shadow: 0 4px 14px rgba(0,0,0,.09); border-color: #c7d7f5; }
.drv-stop-row .drv-stop-name {
  font-size: 15px;
  font-weight: 700;
}
.drv-stop-row .drv-stop-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}
.drv-stop-row .drv-counts {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Small status badges — pickup count, return count, etc.
   Distinct from .chip in the rest of app.css. */
.drv-badge {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--light);
  color: var(--muted);
  white-space: nowrap;
}
.drv-badge-pickup { background: #dbeafe; color: #1e3a8a; font-weight: 700; }
.drv-badge-return { background: #dcfce7; color: #14532d; font-weight: 700; }
.drv-badge-dim    { opacity: 0.4; }

/* Form fields — taller, bigger text. Override defaults for inputs inside
   the driver shell only. */
.drv-shell label {
  display: block;
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}
.drv-shell input[type=text],
.drv-shell input[type=number],
.drv-shell input[type=email],
.drv-shell input[type=tel],
.drv-shell select,
.drv-shell textarea {
  width: 100%;
  padding: 14px 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  box-sizing: border-box;
}
.drv-shell input:focus,
.drv-shell select:focus,
.drv-shell textarea:focus {
  border-color: var(--accent);
  outline: none;
}

/* Tap-to-select choice tiles for size/container/extras.
   These are bigger than .chip and behave more like radio/checkbox tiles. */
.drv-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.drv-choice {
  flex: 1 1 auto;
  min-width: 70px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  user-select: none;
  display: block;
}
.drv-choice input { display: none; }
.drv-choice:has(input:checked),
.drv-choice.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
a.drv-choice {
  text-decoration: none;
  color: var(--text);
}
.drv-select {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
}

/* The big yellow "write this on the tag" confirmation card */
.drv-tag-card {
  background: #fff8d6;
  border: 2px solid #f2d19b;
  color: #6b4d00;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  margin: 16px 0;
}
.drv-tag-card .drv-tag-label {
  font-size: 14px;
  font-weight: 600;
}
.drv-tag-card .drv-tag-number {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.1;
  margin: 6px 0;
  letter-spacing: 2px;
}
.drv-tag-card .drv-tag-hint {
  font-size: 13px;
  margin-top: 4px;
}

/* Reusable info card inside the driver shell */
.drv-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.drv-card p:last-child { margin-bottom: 0; }
.drv-card p:first-child { margin-top: 0; }

/* Section label — replaces plain <h2> for driver pages */
.drv-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 18px 0 8px;
  padding: 0 2px;
}

/* Footer/back link, small and unobtrusive */
.drv-back {
  display: inline-block;
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}
.drv-back:hover { color: var(--text, #1f2937); }