:root{
  --bg:#f5f5f5;
  --card:#ffffff;
  --text:#1f2937;
  --muted:#6b7280;
  --border:#d1d5db;
  --primary:#2563eb;
  --secondary:#6b7280;
  --shadow:0 0 8px rgba(0,0,0,.08);
  --radius:10px;
  --panel:#f8fafc;
}

*{box-sizing:border-box}
body{
  font-family: Arial, sans-serif;
  margin:0;
  background:var(--bg);
  color:var(--text);
}

.container{
  max-width: 980px;
  margin: 0 auto;
  padding: 18px;
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

h1,h2,h3{margin:0 0 12px}

.nav{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin: 10px 0 16px;
}
.nav a{
  display:inline-block;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  text-decoration:none;
  font-weight: 600;
}
.nav a.active{
  border-color: var(--primary);
  color: var(--primary);
}

/* generic row helper (Route Planner uses this) */
.row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

/* labels */
label{display:block;margin-top:10px;font-weight:700}

/* IMPORTANT: only style text-like inputs here (avoid messing up checkboxes) */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
input[type="tel"],
input[type="url"],
input[type="search"],
select,
textarea{
  width:100%;
  padding:10px;
  margin-top:6px;
  border:1px solid var(--border);
  border-radius:8px;
  font: inherit;
}

textarea{resize: vertical}

/* checkboxes/radios */
input[type="checkbox"],
input[type="radio"]{
  width:18px;
  height:18px;
  margin:0;
  padding:0;
}

.button-row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:center;
  margin-top: 14px;
}

.btn{
  border:none;
  border-radius:10px;
  padding: 10px 14px;
  font-size: 16px;
  cursor:pointer;
}
.btn-primary{background:var(--primary);color:white;}
.btn-secondary{background:var(--secondary);color:white;}

.small{font-size: 13px; color: var(--muted)}
hr{border:none;border-top:1px solid var(--border);margin:16px 0}

.codebox{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: pre-wrap;
}

/* Technicians multi-select */
.techs-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap:10px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--panel);
}
.tech-item{
  display:flex;
  align-items:center;
  gap:10px;
  margin:0;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  cursor:pointer;
  user-select:none;
}
.tech-item:hover{ background: #fafafa; }
.tech-item:focus-within{
  outline: 2px solid rgba(37,99,235,.25);
  outline-offset: 2px;
}
.tech-item input{
  width:18px;
  height:18px;
  margin:0;
}
.tech-name{
  font-weight:800;
  line-height:1.2;
}

/* --- Reborn Core Tool Kit: Home + Route Planner --- */
.home-header{
  display:flex;
  align-items:center;
  gap:14px;
  margin-bottom:14px;
}
.home-mark{
  width:48px;
  height:48px;
  border-radius:14px;
  display:grid;
  place-items:center;
  font-weight:900;
  letter-spacing:.5px;
  border:1px solid var(--border);
  background:var(--panel);
}

.tool-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap:12px;
  margin-top:14px;
}
.tool-card{
  display:block;
  padding:16px;
  border:1px solid var(--border);
  border-radius:16px;
  background:#fff;
  text-decoration:none;
  transition:transform .08s ease, box-shadow .08s ease;
}
.tool-card:hover{
  transform:translateY(-1px);
  box-shadow:0 10px 22px rgba(0,0,0,.06);
}
.tool-title{
  font-weight:900;
  font-size:16px;
  margin:0 0 6px;
  color:inherit;
}
.tool-sub{
  opacity:.75;
  margin:0;
}
.tool-card--admin{
  background:var(--panel);
}

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
@media (max-width: 980px){
  .grid2{ grid-template-columns: 1fr; }
}

.map-box{
  width:100%;
  height:460px;
  border:1px solid var(--border);
  border-radius:12px;
  overflow:hidden;
  background:var(--panel);
}

.table{
  width:100%;
  border-collapse:collapse;
  font-size:14px;
}
.table th, .table td{
  text-align:left;
  padding:10px 8px;
  border-bottom:1px solid var(--border);
  vertical-align:top;
}
.table thead th{
  font-weight:800;
  opacity:.9;
}

/* Route Planner: Stops header + toggles */
.rp-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}
.rp-title{ margin:0; }

.rp-toggles{
  display:flex;
  flex-direction:column;
  gap:10px;
  align-items:flex-end;
}
.rp-toggle{
  display:flex;
  align-items:center;
  gap:10px;
  margin:0;          /* overrides global label margin-top */
  font-weight:800;
}
.rp-toggle span{ line-height:1.1; }
.rp-help{ margin:8px 0 12px; opacity:.85; }
.rp-actions{ margin-top:12px; justify-content:flex-start; }
.rp-error{ margin-top:10px; color:#b91c1c; }

/* Route Planner: stop rows */
.stop-row{
  display:flex;
  gap:10px;
  align-items:center;
  margin:10px 0;
}
.stop-input{
  flex:1;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  margin-top:0; /* important: don't inherit the generic input margin */
}
.stop-actions{
  display:flex;
  gap:8px;
}
.icon-btn{
  width:36px;
  height:36px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#fff;
  cursor:pointer;
  font-weight:900;
}
.icon-btn:hover{
  background:var(--panel);
}

@media (max-width: 520px){
  .rp-head{ align-items:flex-start; }
  .rp-toggles{ align-items:flex-start; }
}