/* ============================================================================
   Jal Sanchay Mitra — design system. Hand-written (no Node/Tailwind build step
   needed on the server — Mitra Playbook: prefer zero-dependency solutions),
   compiled once, shipped static. A "water & soil" palette: deep teal (water),
   warm earth accent, calm neutrals. Built mobile-first and BIG on touch
   targets — the primary users are non-technical field enumerators on phones.
   ========================================================================== */

:root{
  --brand:#0e6e62;      --brand-600:#0b5a50;   --brand-50:#e6f3f1;   --brand-100:#c7e6e1;
  --accent:#b3701f;     --accent-50:#faf1e6;
  --ink:#1a2b28;        --muted:#5b6b68;       --line:#dde5e3;       --paper:#f4f8f7;
  --card:#ffffff;
  --good:#16794f;       --good-bg:#e5f5ec;
  --warn:#a15c00;       --warn-bg:#fff3df;
  --bad:#b3261e;        --bad-bg:#fde8e6;
  --info:#155c9c;       --info-bg:#e6f0fa;
  --radius:14px;        --radius-sm:9px;
  --shadow:0 1px 2px rgba(20,40,35,.06), 0 4px 14px rgba(20,40,35,.06);
  --shadow-pop:0 12px 40px rgba(10,30,25,.22);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:'Segoe UI',system-ui,-apple-system,sans-serif;
  background:var(--paper); color:var(--ink); font-size:15px; line-height:1.5;
  -webkit-tap-highlight-color:transparent;
}
h1,h2,h3{margin:0}
a{color:var(--brand); text-decoration:none}
a:hover{text-decoration:underline}

/* ---------- layout utilities (the small subset actually used) ---------- */
.flex{display:flex} .inline-flex{display:inline-flex} .grid{display:grid} .hidden{display:none!important}
.items-center{align-items:center} .items-start{align-items:flex-start} .items-end{align-items:flex-end}
.justify-between{justify-content:space-between} .justify-center{justify-content:center} .justify-end{justify-content:end}
.flex-1{flex:1 1 0%} .flex-wrap{flex-wrap:wrap} .flex-col{flex-direction:column} .shrink-0{flex-shrink:0} .min-w-0{min-width:0}
.gap-1{gap:.25rem} .gap-2{gap:.5rem} .gap-3{gap:.75rem} .gap-4{gap:1rem}
.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))} .grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.col-span-2{grid-column:span 2} .col-span-3{grid-column:span 3}
.w-full{width:100%} .max-w-sm{max-width:24rem} .max-w-md{max-width:28rem} .max-w-4xl{max-width:56rem} .mx-auto{margin-left:auto;margin-right:auto}
.p-2{padding:.5rem} .p-3{padding:.75rem} .p-4{padding:1rem} .p-5{padding:1.25rem} .p-6{padding:1.5rem} .p-8{padding:2rem}
.px-2{padding-left:.5rem;padding-right:.5rem} .px-3{padding-left:.75rem;padding-right:.75rem} .px-4{padding-left:1rem;padding-right:1rem}
.py-1{padding-top:.25rem;padding-bottom:.25rem} .py-1\.5{padding-top:.375rem;padding-bottom:.375rem}
.py-2{padding-top:.5rem;padding-bottom:.5rem} .py-3{padding-top:.75rem;padding-bottom:.75rem}
.mt-1{margin-top:.25rem} .mt-2{margin-top:.5rem} .mt-3{margin-top:.75rem} .mt-4{margin-top:1rem} .mt-6{margin-top:1.5rem}
.mb-1{margin-bottom:.25rem} .mb-3{margin-bottom:.75rem} .mb-4{margin-bottom:1rem} .ml-auto{margin-left:auto}
.space-y-1>*+*{margin-top:.25rem} .space-y-3>*+*{margin-top:.75rem} .space-y-4>*+*{margin-top:1rem}
.divide-y>*+*{border-top:1px solid var(--line)}
.rounded-lg{border-radius:var(--radius-sm)} .rounded-xl{border-radius:var(--radius)}
.overflow-x-auto{overflow-x:auto} .overflow-y-auto{overflow-y:auto} .whitespace-nowrap{white-space:nowrap} .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.text-xs{font-size:11.5px} .text-sm{font-size:13px} .text-lg{font-size:18px} .text-xl{font-size:20px} .text-2xl{font-size:24px} .text-3xl{font-size:28px}
.font-medium{font-weight:600} .font-bold{font-weight:700}
.text-center{text-align:center} .text-right{text-align:right}
.text-slate-400{color:#94a3ac} .text-slate-500{color:var(--muted)} .text-slate-600{color:#3f524e} .text-slate-700{color:#233330} .text-slate-800{color:var(--ink)}
.text-brand-600,.text-brand-700{color:var(--brand)}
.bg-slate-100{background:#eef2f1} .bg-white{background:#fff}
.min-h-screen{min-height:100vh}
.sticky{position:sticky} .fixed{position:fixed} .relative{position:relative} .inset-0{inset:0} .z-30{z-index:30} .z-50{z-index:50}

/* ---------- components ---------- */
header.topbar{background:linear-gradient(135deg,var(--brand),var(--brand-600)); color:#fff; padding:16px 22px}
.card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow)}
.label{display:block; font-size:12.5px; font-weight:600; color:var(--muted); margin:0 0 5px}

.input, select.input, textarea.input{
  width:100%; font:inherit; font-size:15px; padding:11px 13px; border:1px solid var(--line);
  border-radius:10px; background:#fff; color:var(--ink);
}
.input:focus{outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-50)}
textarea.input{resize:vertical; min-height:70px}

.btn-primary,.btn-ghost,.btn-danger{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  font:inherit; font-size:14.5px; font-weight:600; padding:11px 18px; border-radius:11px;
  cursor:pointer; border:1px solid transparent; transition:filter .12s, background .12s;
}
.btn-primary{background:var(--brand); color:#fff}
.btn-primary:hover{filter:brightness(1.08)}
.btn-primary:disabled{opacity:.5; cursor:not-allowed}
.btn-ghost{background:#fff; color:var(--brand); border-color:var(--brand-100)}
.btn-ghost:hover{background:var(--brand-50)}
.btn-danger{background:var(--bad-bg); color:var(--bad); border-color:#f4c6c2}
.btn-danger:hover{filter:brightness(.97)}

.badge{display:inline-flex; align-items:center; gap:5px; font-size:11.5px; font-weight:700; padding:3px 10px; border-radius:20px}
.badge::before{content:''; width:6px; height:6px; border-radius:50%}
.badge-p{background:var(--good-bg); color:var(--good)} .badge-p::before{background:var(--good)}
.badge-a{background:var(--bad-bg); color:var(--bad)} .badge-a::before{background:var(--bad)}
.badge-h{background:var(--info-bg); color:var(--info)} .badge-h::before{background:var(--info)}
.badge-l{background:var(--warn-bg); color:var(--warn)} .badge-l::before{background:var(--warn)}
.badge-off{background:#eef2f1; color:var(--muted)} .badge-off::before{background:var(--muted)}

table{width:100%; border-collapse:collapse; font-size:13.5px}
th,td{text-align:left; padding:9px 10px; border-bottom:1px solid var(--line)}
th{font-size:11px; text-transform:uppercase; letter-spacing:.4px; color:var(--muted); font-weight:700}

.pill{display:inline-block; padding:4px 12px; border-radius:20px; font-size:12px; font-weight:600}
.pill.on{background:var(--good-bg); color:var(--good)} .pill.off{background:var(--bad-bg); color:var(--bad)}

/* nav */
.nav{background:#fff; border-bottom:1px solid var(--line)}
.nav-link{padding:9px 14px; border-radius:10px; font-size:14px; font-weight:600; color:var(--muted)}
.nav-link:hover{background:var(--brand-50); text-decoration:none}
.nav-link-active{background:var(--brand-50); color:var(--brand)}

/* ---------- form-engine specific ---------- */
.step-track{display:flex; gap:6px; overflow-x:auto; padding:2px}
.step-dot{flex:none; padding:7px 13px; border-radius:20px; font-size:12.5px; font-weight:700; background:#eef2f1; color:var(--muted); white-space:nowrap; cursor:pointer; border:2px solid transparent}
.step-dot.on{background:var(--brand); color:#fff}
.step-dot.done{background:var(--brand-50); color:var(--brand); border-color:var(--brand-100)}
.field{margin-bottom:18px}
.field .unit{color:var(--muted); font-weight:500; font-size:12.5px}
.field.computed .input{background:#f1f5f4; color:var(--muted); font-weight:700; cursor:not-allowed}
.field.computed .badge{margin-left:6px}
.help-text{font-size:12.5px; color:var(--muted); margin:4px 0 0; line-height:1.5}
.checklist-item{display:flex; align-items:center; gap:11px; padding:11px 4px; border-bottom:1px solid var(--line); font-size:14.5px}
.checklist-item:last-child{border-bottom:0}
.checklist-item input[type=checkbox]{width:20px; height:20px; accent-color:var(--brand); flex:none}
.month-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:8px}
@media (min-width:520px){ .month-grid{grid-template-columns:repeat(4,1fr)} }
.month-chip{padding:10px 6px; border:1.5px solid var(--line); border-radius:10px; text-align:center; font-size:13px; font-weight:600; cursor:pointer; color:var(--muted)}
.month-chip.on{background:var(--brand); border-color:var(--brand); color:#fff}
.gps-row{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
.gps-btn{flex:none; width:46px; height:46px; border-radius:12px; border:1.5px solid var(--brand-100); background:var(--brand-50); color:var(--brand); font-size:20px; cursor:pointer; display:flex; align-items:center; justify-content:center}
.gps-btn.busy{opacity:.6}
.gps-fields{display:flex; gap:8px; flex:1; min-width:200px}

.toast{position:fixed; left:50%; transform:translateX(-50%); bottom:24px; z-index:80; background:var(--ink); color:#fff; padding:11px 18px; border-radius:10px; font-size:14px; box-shadow:var(--shadow-pop)}
.toast.error{background:var(--bad)} .toast.warn{background:var(--warn)}

.modal-backdrop{position:fixed; inset:0; background:rgba(15,30,27,.45); backdrop-filter:blur(2px); z-index:60; display:flex; align-items:center; justify-content:center; padding:16px}
.modal{background:#fff; border-radius:18px; box-shadow:var(--shadow-pop); width:100%; max-width:460px; max-height:88vh; overflow-y:auto; padding:22px}

.dup-banner{background:var(--warn-bg); border:1px solid #f1d7a6; color:var(--warn); border-radius:12px; padding:12px 14px; font-size:13.5px; margin-bottom:16px}
.draft-banner{background:var(--info-bg); border:1px solid #bcd6ef; color:var(--info); border-radius:12px; padding:12px 14px; font-size:13.5px; margin-bottom:16px; display:flex; align-items:center; gap:10px; flex-wrap:wrap}

::-webkit-scrollbar{height:8px; width:8px} ::-webkit-scrollbar-thumb{background:#c9d3d1; border-radius:8px}

@media (max-width:640px){
  .grid-cols-2,.grid-cols-3{grid-template-columns:1fr}
  .col-span-2,.col-span-3{grid-column:auto}
}
