/* --- style.css (ALL STYLES CENTRALIZED) --- */

/* =========================
   Reset & base
   ========================= */
html {
  overflow-x: clip;
  max-width: 100%;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #b8c2d4;
  color: #111827;
}

main { padding: 20px; }

:root {
  --site-content-max: 1100px;
  --site-purple: #5514B4;
}

/* Global card look (restores yesterday evening style) */
.card,
.site-card,
.site-chart-box,
.distance-left,
.distance-middle,
.distance-right,
.distance-chart-box,
.alerts-card,
.admin-card,
.admin-card-solid,
.card-page,
.chart-box:not(.blog-card) {
  background: #ffffff !important;
  border: none !important;
  border-radius: 12px !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2) !important;
}

.wrap {
  width: 100%;
  max-width: var(--site-content-max);
  margin-left: auto;
  margin-right: auto;
}

.card {
  padding: 14px;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0;
}
.kv .k { color:#374151; font-weight:700; }
.kv .v { font-weight:700; }

.statusline {
  margin-top: 8px;
  font-size: 0.86rem;
  color: #374151;
}

.u-hidden{ display:none !important; }

/* Energy dashboard source badge + demo banner */
.source-center{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  min-height:76px;
}
.source-center-with-demo{
  width:100%;
}
.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:132px;
  padding:8px 14px;
  border-radius:999px;
  font-weight:900;
  letter-spacing:0.04em;
  border:2px solid #d1d5db;
  background:#f3f4f6;
  color:#374151;
}
.badge.solar{
  border-color:#d97706;
  background:#fff7ed;
  color:#9a3412;
}
.badge.wind{
  border-color:#0369a1;
  background:#eff6ff;
  color:#0c4a6e;
}
.energy-demo-bar{
  display:block;
  width:100%;
  box-sizing:border-box;
  margin-top:10px;
  padding:10px 14px;
  background:#b91c1c;
  color:#fff;
  text-align:center;
  font-weight:800;
  letter-spacing:0.12em;
  font-size:0.8rem;
  border-radius:4px;
  line-height:1.25;
  border:0;
}

/* Login page */
.site-login{
  max-width: 460px;
  margin: 18px auto 0 auto;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  padding: 18px 16px;
}
.site-login h2{
  margin: 0 0 12px 0;
  font-size: 1.35rem;
}
.site-login form{
  display: grid;
  gap: 12px;
}
.site-login .field{
  display: grid;
  gap: 6px;
}
.site-login label{
  font-weight: 700;
  color: #374151;
  font-size: 0.92rem;
}
.site-login .check-row{
  display:flex;
  align-items:center;
  gap:8px;
  color:#374151;
  font-size:0.92rem;
  font-weight:600;
  margin:2px 0;
}
.site-login .check-row input[type="checkbox"]{
  width:16px;
  height:16px;
}
.site-login input[type="text"],
.site-login input[type="password"]{
  width: 100%;
  border: 1px solid #cfd5df;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  padding: 10px 12px;
  font-size: 0.95rem;
}
.login-btn-full{
  width: 100%;
}
.site-login .muted{
  color:#6b7280;
  font-size:0.92rem;
  margin:0 0 12px 0;
  line-height:1.45;
}
.login-forgot-banner{
  margin:0 0 14px 0;
  padding:10px 12px;
  border-radius:10px;
  background:linear-gradient(135deg, rgba(37,99,235,0.08), rgba(85,20,180,0.06));
  border:1px solid rgba(37,99,235,0.25);
  font-size:0.95rem;
  line-height:1.4;
  text-align:center;
}
.login-forgot-banner a{
  color:#1d4ed8;
  font-weight:700;
  text-decoration:underline;
}
.login-footer-link{
  margin-top:14px;
  text-align:center;
  font-size:0.95rem;
}
.login-footer-link a{
  color:#2563eb;
  font-weight:600;
}
.flash-wrap-mb{
  margin-bottom: 8px;
}

/* Global form control containment + consistent button system */
.page-wrap input[type="text"],
.page-wrap input[type="email"],
.page-wrap input[type="password"],
.page-wrap input[type="number"],
.page-wrap input[type="search"],
.page-wrap input[type="url"],
.page-wrap input[type="tel"],
.page-wrap input[type="date"],
.page-wrap input[type="time"],
.page-wrap input[type="datetime-local"],
.page-wrap select,
.page-wrap textarea {
  box-sizing: border-box !important;
  max-width: 100% !important;
  border: 1px solid #94a3b8 !important;
  background: #ffffff !important;
  color: #111827 !important;
}

.page-wrap input[type="text"]:focus,
.page-wrap input[type="email"]:focus,
.page-wrap input[type="password"]:focus,
.page-wrap input[type="number"]:focus,
.page-wrap input[type="search"]:focus,
.page-wrap input[type="url"]:focus,
.page-wrap input[type="tel"]:focus,
.page-wrap input[type="date"]:focus,
.page-wrap input[type="time"]:focus,
.page-wrap input[type="datetime-local"]:focus,
.page-wrap select:focus,
.page-wrap textarea:focus {
  border-color: var(--site-purple) !important;
  outline: 2px solid rgba(85, 20, 180, 0.18) !important;
  outline-offset: 0;
}

/* Shared buttons: use .btn + optional .btn-primary | .btn-secondary | .btn-danger + optional .btn-sm */
.btn{
  border: 2px solid var(--site-purple);
  border-radius: 999px;
  color: var(--site-purple);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  min-height: 34px;
}
.btn-sm{
  padding: 5px 12px;
  min-height: 28px;
  font-size: 0.82rem;
}
.btn:hover{ background: rgba(85, 20, 180, 0.08); }
.btn.active{
  background: var(--site-purple);
  color: #fff;
}

.btn-secondary{
  background:#fff;
  color:var(--site-purple);
}
.btn-primary{
  background:var(--site-purple);
  color:#fff;
}
.btn-danger{
  border-color:#dc2626;
  background:#dc2626;
  color:#fff;
}
.btn-danger:hover{
  border-color:#b91c1c;
  background:#b91c1c;
}
.admin-link-danger,
.danger,
[data-action="delete"],
[data-variant="danger"]{
  border-color:#dc2626;
  background:#dc2626;
  color:#fff;
}

.grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.grid-row4,
.grid-row4-compact {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.chart-box {
  padding: 12px;
}

/* Shared admin/settings form look (used by distance settings and similar pages) */
.admin-wrap{
  max-width: var(--site-content-max);
}
.site-hint{
  color:#6b7280;
  line-height:1.45;
  margin: 0 0 12px 0;
}
.admin-form{
  display:grid;
  gap:12px;
}
.form-row-spaced{
  display:grid;
  gap:6px;
}
.label-admin{
  font-weight:700;
  color:#374151;
  font-size:0.92rem;
}
.input-admin{
  width:100%;
  max-width:100%;
  box-sizing:border-box;
  border:1px solid #cfd5df;
  border-radius:10px;
  background:#fff;
  color:#111827;
  padding:10px 12px;
  font-size:0.95rem;
}
.u-mb-8{
  margin-bottom:8px;
}
.hint-12{
  font-size:0.82rem;
  color:#6b7280;
}

/* Bin monitoring alerts pages */
.alerts-wrap{
  max-width: var(--site-content-max);
}
.alert-form{
  display:grid;
  gap:12px;
  padding:14px;
}
.alert-checks{
  display:grid;
  gap:8px;
}
.alert-checks label{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:600;
  color:#374151;
}
.alert-summary-form{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}
.alert-actions-cell{
  white-space:nowrap;
  display:flex;
  align-items:center;
  gap:6px;
}
.inline-form{
  display:inline;
}
.admin-table{
  width:100%;
  border-collapse:collapse;
}
.admin-table th,
.admin-table td{
  border-bottom:1px solid #e5e7eb;
  text-align:left;
  padding:10px 8px;
}
.admin-table th{
  font-size:0.82rem;
  color:#6b7280;
  text-transform:uppercase;
  letter-spacing:0.03em;
}

/* Platform admin compact table layout */
.platform-admin-table-wrap{
  overflow-x:auto;
}
.platform-admin-table{
  min-width:900px;
}
.platform-admin-table th,
.platform-admin-table td{
  text-align:center;
  vertical-align:middle;
  padding:8px 6px;
}
.platform-admin-table th:first-child,
.platform-admin-table td:first-child{
  text-align:left;
  min-width:170px;
}
.platform-admin-table th:nth-child(2),
.platform-admin-table td:nth-child(2){
  min-width:90px;
}
.platform-check-cell{
  display:flex;
  justify-content:center;
  align-items:center;
}
.platform-check-cell input[type="checkbox"]{
  width:16px;
  height:16px;
}
.platform-admin-actions{
  white-space:nowrap;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
}
.platform-admin-app-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:8px;
}
.platform-admin-editor-row{
  margin-bottom:10px;
}
.admin-subcard-link{
  display:block;
  text-decoration:none;
  color:inherit;
  padding:12px 14px;
  box-sizing:border-box;
}
.grid-auto-fit-220-12{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:12px;
  margin-top:12px;
}
.grid-auto-fit-220-10{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:10px;
}
.grid-auto-fit-180-8{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:8px;
}
.form-checkbox-grid-6{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:6px;
  margin-top:10px;
}
.label-check-13{
  display:block;
  font-size:13px;
}
.admin-subcard--left{
  text-align:left;
  padding:12px;
}
.platform-users-caption{
  padding:8px 8px 2px 8px;
  font-size:13px;
}
.admin-h4-heading{
  margin:0 0 8px 0;
  font-size:1rem;
  font-weight:800;
  color:#111827;
}
.form-grid-gap8{
  display:grid;
  gap:8px;
}
.flex-actions-end{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  flex-wrap:wrap;
}
.text-left{
  text-align:left;
}

/* AI overview (templates/ai/overview.html) */
.ai-overview-page .card > h3:first-child,
.sysctl-page .card > h3:first-child,
.ai-admin-page .card > h3:first-child{
  margin-top:0;
}
.ai-admin-page{
  max-width:980px;
}
.kv-align-center{
  align-items:center;
}
.input-hourly-limit{
  width:110px;
  padding:6px 8px;
  border-radius:8px;
  border:1px solid #e5e7eb;
  box-sizing:border-box;
  background:#fff;
  color:#111827;
}
.ai-lead{
  margin:0 0 10px 0;
  color:#4b5563;
}
.ai-row-actions{
  display:flex;
  gap:8px;
  align-items:center;
  margin-bottom:10px;
  flex-wrap:wrap;
}
.kv-mb-10{
  margin-bottom:10px;
}
.list-tight{
  margin:0;
  padding-left:18px;
}
.list-tight--mt8{
  margin-top:8px;
}
.ai-backend-os-footer{
  margin-top:12px;
  padding-top:12px;
  border-top:1px solid #e5e7eb;
  font-size:13px;
  color:#6b7280;
}
.ai-forecast-grid{
  display:grid;
  grid-template-columns:230px minmax(160px,1fr) 170px;
  gap:8px 12px;
  align-items:center;
}
.ai-forecast-label{
  font-weight:700;
  color:#374151;
}
.ai-forecast-value{
  font-weight:800;
  color:#111827;
  text-align:left;
}
.ai-forecast-badge-cell{
  text-align:right;
}
@media (max-width:860px){
  .ai-forecast-grid{
    grid-template-columns:1fr;
  }
  .ai-forecast-badge-cell{
    text-align:left;
  }
}
.ai-anomaly-detail{
  color:#4b5563;
}
.ai-anomaly-row,
.ai-backend-check-row{
  border:1px solid #e5e7eb;
  border-left:4px solid var(--row-accent, #374151);
  border-radius:8px;
  padding:8px 10px;
  margin-bottom:8px;
}
.ai-backend-check-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.ai-backend-check-row__body{
  flex:1;
  min-width:0;
}
.ai-backend-check-row__detail{
  color:#4b5563;
}
.btn-restart-compact{
  flex-shrink:0;
  margin-left:auto;
  font-size:11px;
  padding:4px 8px;
  min-height:auto;
  line-height:1.2;
}
#backendChecksSummary .v[data-status="error"]{
  color:#b91c1c;
}
#backendChecksSummary .v[data-status="warn"]{
  color:#b45309;
}
#backendChecksSummary .v[data-status="ok"],
#backendChecksSummary .v[data-status="unknown"]{
  color:#166534;
}
.ai-conf-badge{
  display:inline-block;
  padding:2px 8px;
  font-size:12px;
  font-weight:700;
  border-radius:999px;
  border:1px solid transparent;
}
.ai-conf-badge--high{
  background:#dcfce7;
  color:#166534;
  border-color:#86efac;
}
.ai-conf-badge--medium{
  background:#fef3c7;
  color:#92400e;
  border-color:#fcd34d;
}
.ai-conf-badge--low{
  background:#fee2e2;
  color:#991b1b;
  border-color:#fca5a5;
}

/* Admin AI bot demo */
.ai-bot-stack{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
}
.sh-ai-chatlog{
  height:360px;
  overflow:auto;
  width:100%;
  box-sizing:border-box;
  background:rgba(255,255,255,0.03);
  border:1px solid rgba(0,0,0,0.1);
  border-radius:12px;
  padding:12px;
}
.sh-ai-inputbar{
  display:flex;
  gap:10px;
  align-items:center;
  width:100%;
  min-width:0;
}
.sh-ai-inputbar .input-ai-bot{
  flex:1 1 auto;
  min-width:0;
  width:100%;
  box-sizing:border-box;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid rgba(0,0,0,0.12);
  background:rgba(255,255,255,0.92);
  color:#111827;
}
.ai-sample-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:8px;
}
@media (max-width:520px){
  .ai-sample-grid{
    grid-template-columns:1fr;
  }
}
.btn.ai-sample-prompt{
  width:100%;
  white-space:normal;
  word-break:break-word;
}
.ai-bot-msg{
  margin:8px 0;
}
.ai-bot-msg-role{
  font-size:12px;
  color:#9ca3af;
  margin-bottom:4px;
}
.ai-bot-msg-bubble{
  white-space:pre-wrap;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,0.08);
}
.ai-bot-msg-bubble--assistant{
  background:rgba(255,255,255,0.06);
  border-color:rgba(255,255,255,0.08);
}
.ai-bot-msg-bubble--user{
  background:rgba(0,0,0,0.25);
  border-color:rgba(0,0,0,0.12);
}

/* Bin monitoring optimize route page */
.optimize-controls{
  margin:16px 0;
  padding:16px;
}
.optimize-controls-row{
  display:flex;
  flex-wrap:wrap;
  gap:16px;
  align-items:center;
}
/* Mon–Fri day toggles — same as energy dashboard .btn / .btn.active (purple, not blue). */
.day-toggle-group{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.day-toggle-group--inline{
  display:inline-flex;
  gap:4px;
  margin-left:8px;
}
.day-toggle-btn{
  box-sizing:border-box;
  padding:6px 12px;
  min-height:34px;
  border:2px solid var(--site-purple);
  border-radius:999px;
  background:#fff;
  color:var(--site-purple);
  font:inherit;
  font-weight:700;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.day-toggle-btn:hover{
  background:rgba(85, 20, 180, 0.08);
  border-color:var(--site-purple);
  color:var(--site-purple);
}
/* Selected = same visual as .btn.active on energy dashboard */
.day-toggle-btn.day-toggle-selected,
.optimize-controls .day-toggle-btn.day-toggle-selected,
.sched-day-buttons .day-toggle-btn.day-toggle-selected,
.sched-day-row .day-toggle-btn.day-toggle-selected{
  border-color:var(--site-purple) !important;
  background:var(--site-purple) !important;
  color:#fff !important;
}
.day-toggle-btn.day-toggle-selected:hover,
.optimize-controls .day-toggle-btn.day-toggle-selected:hover,
.sched-day-buttons .day-toggle-btn.day-toggle-selected:hover{
  border-color:var(--site-purple) !important;
  background:var(--site-purple) !important;
  color:#fff !important;
}
.opt-route-mode-select{
  margin-left:8px;
  padding:6px 10px;
  border-radius:8px;
}
.opt-threshold-range{
  vertical-align:middle;
  margin:0 8px;
}
.opt-status{
  margin-left:8px;
}
.optimize-top-layout{
  display:grid;
  grid-template-columns:1fr 380px;
  gap:20px;
  align-items:stretch;
}
.optimize-map-card,
.optimize-plan-card{
  overflow:hidden;
  min-height:520px;
}
.opt-card-title{
  margin-top:0;
}
.opt-route-map{
  height:450px;
}
.opt-route-plan-body{
  height:450px;
  overflow:auto;
}
.opt-route-list{
  padding-left:20px;
}
.optimize-summary-card{
  margin-top:16px;
}
.opt-summary-copy{
  font-size:14px;
  color:#374151;
  line-height:1.6;
}
.opt-ai-loading{
  font-style:italic;
  color:#6b7280;
}
.opt-ai-summary-text{
  white-space:pre-wrap;
  line-height:1.5;
}
@media (max-width: 980px){
  .optimize-top-layout{
    grid-template-columns:1fr;
  }
  .optimize-map-card,
  .optimize-plan-card{
    min-height:unset;
  }
  .opt-route-map,
  .opt-route-plan-body{
    height:auto;
    min-height:320px;
  }
}

/* Bin monitoring overview layout */
.bin-overview-wrap{
  max-width:100%;
  margin:0;
  padding:0 12px;
}
.bin-overview-header{
  margin-bottom:16px;
}
.bin-overview-lead{
  margin-top:4px;
}
.bin-overview-top{
  display:grid;
  grid-template-columns:320px 1fr;
  gap:20px;
  align-items:stretch;
  height:450px;
}
.bin-list-card{
  background:#fff;
  border-radius:12px;
  padding:16px;
  border:1px solid #e5e7eb;
  box-shadow:0 4px 12px rgba(0,0,0,0.08);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-height:0;
}
.bin-list-card h3{
  margin:0 0 12px 0;
  flex-shrink:0;
}
.bin-list-scroll{
  flex:1;
  overflow-y:auto;
  min-height:0;
  -webkit-overflow-scrolling:touch;
}
.bin-list-item{
  display:block;
  padding:10px 12px;
  margin-bottom:6px;
  border-radius:8px;
  border:1px solid #e5e7eb;
  background:#f9fafb;
  text-decoration:none;
  color:inherit;
  transition:background 0.15s, border-color 0.15s;
}
.bin-list-item:hover{
  background:#f3f4f6;
  border-color:var(--site-purple);
}
.bin-list-item.bin-needs-empty{
  border-left:3px solid #dc2626;
}
.bin-list-item.bin-alert{
  border-left:3px solid #b45309;
}
.bin-list-item .bin-item-inner{
  display:flex;
  align-items:center;
  gap:12px;
  position:relative;
}
.bin-list-item .bin-name{
  font-weight:600;
  flex:1;
  min-width:0;
}
.bin-list-item .bin-pct-ring{
  flex-shrink:0;
  width:40px;
  height:40px;
  border-radius:50%;
  position:relative;
  background:conic-gradient(
    var(--ring-color, #3b82f6) 0deg,
    var(--ring-color, #3b82f6) calc(var(--pct, 0) * 3.6deg),
    #e5e7eb calc(var(--pct, 0) * 3.6deg)
  );
  display:flex;
  align-items:center;
  justify-content:center;
}
.bin-list-item .bin-pct-ring-inner{
  width:30px;
  height:30px;
  border-radius:50%;
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:10px;
  font-weight:700;
  color:#1f2937;
}
.bin-list-item .bin-alert-badge{
  position:absolute;
  top:-4px;
  right:-4px;
  font-size:14px;
  line-height:1;
  z-index:2;
  filter:drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
.bin-map-card{
  border-radius:12px;
  overflow:hidden;
  border:1px solid #e5e7eb;
  box-shadow:0 4px 12px rgba(0,0,0,0.08);
  background:#e5e7eb;
  position:relative;
  height:450px;
  min-height:0;
}
.bin-overview-map{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  z-index:1;
}
.bin-overview-section{
  margin-top:20px;
  padding:16px;
  border-radius:12px;
  border:1px solid #e5e7eb;
  background:#fff;
  box-shadow:0 4px 12px rgba(0,0,0,0.08);
}
.bin-overview-section h3{
  margin:0 0 12px 0;
}
.bin-overview-section .empty-msg{
  color:#6b7280;
  font-style:italic;
}
.bin-overview-section .bin-chip{
  display:inline-block;
  padding:6px 12px;
  margin:4px 6px 4px 0;
  border-radius:8px;
  background:#f3f4f6;
  border:1px solid #e5e7eb;
  font-size:14px;
}
.bin-overview-section .bin-chip a{
  text-decoration:none;
  color:inherit;
}
.bin-overview-section .bin-chip a:hover{
  text-decoration:underline;
}
.bin-overview-section .bin-chip.alert-fire{
  background:transparent;
  border-color:#fecaca;
}
.bin-overview-section .bin-chip.alert-vandalised{
  background:transparent;
  border-color:#fde68a;
}
.bin-overview-section .bin-chip.over-threshold{
  background:#fef2f2;
  border-color:#fecaca;
}
.bin-marker-icon{
  cursor:pointer !important;
  pointer-events:auto !important;
}
.bin-marker-box{
  width:42px;
  height:46px;
  border-radius:8px;
  border:2px solid #3b82f6;
  box-shadow:0 2px 8px rgba(0,0,0,0.35);
  overflow:visible;
  background:#fff;
  cursor:pointer;
  pointer-events:auto;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  position:relative;
}
.bin-marker-box--ok{ border-color:#3b82f6; }
.bin-marker-box--warn{ border-color:#dc2626; }
.bin-marker-box--fire{ border-color:#dc2626; }
.bin-marker-box--vandalised{ border-color:#b45309; }
.bin-marker-svg{
  width:32px;
  height:32px;
  pointer-events:none;
  margin-top:1px;
}
.bin-marker-label{
  position:absolute;
  bottom:1px;
  left:2px;
  right:2px;
  font-size:8px;
  font-weight:800;
  text-align:center;
  background:rgba(255,255,255,0.92);
  border-radius:5px;
  line-height:1.15;
}
.bin-marker-label--ok{ color:#3b82f6; }
.bin-marker-label--warn{ color:#dc2626; }
.bin-marker-badge{
  position:absolute;
  color:#fff;
  line-height:1;
  padding:2px;
  border-radius:6px;
  z-index:2;
}
.bin-marker-badge--fire{
  top:-4px;
  right:-4px;
  background:#dc2626;
  font-size:14px;
}
.bin-marker-badge--vandalised{
  top:-4px;
  left:-4px;
  background:#b45309;
  font-size:14px;
  font-weight:900;
  border:2px solid rgba(255,255,255,0.95);
  box-shadow:0 2px 6px rgba(0,0,0,0.4);
}
@media (max-width: 900px){
  .bin-overview-top{
    grid-template-columns:1fr;
    height:auto;
    min-height:450px;
  }
  .bin-list-card{
    max-height:280px;
  }
  .bin-map-card{
    height:450px;
  }
}

/* Bin placement page button consistency */
.bin-bins-wrap .bin-move-btn,
.bin-bins-wrap button[type="submit"]{
  border: 2px solid var(--site-purple);
  border-radius: 999px;
  background: #ffffff;
  color: var(--site-purple);
  font-weight: 700;
  min-height: 34px;
  padding: 8px 14px;
}

.bin-bins-wrap .bin-move-btn:hover,
.bin-bins-wrap button[type="submit"]:hover{
  background: rgba(85, 20, 180, 0.08);
  filter: none;
}

/* Depot & Disposal page button consistency */
.bin-locs-layout #saveDepot,
.bin-locs-layout #saveDisposal{
  border: 2px solid var(--site-purple);
  border-radius: 999px;
  background: #ffffff;
  color: var(--site-purple);
  font-weight: 700;
  min-height: 34px;
  padding: 8px 14px;
}

.bin-locs-layout #saveDepot:hover,
.bin-locs-layout #saveDisposal:hover{
  background: rgba(85, 20, 180, 0.08);
  filter: none;
}

/* Weekly schedule page consistency */
.sched-top-card{
  background:#ffffff;
  border-radius:12px;
  box-shadow:0 6px 20px rgba(0,0,0,0.2);
  padding:12px 14px;
  border:none;
}

/* Energy settings page: two cards side-by-side */
.energy-settings{
  max-width: var(--site-content-max);
}
.energy-settings .grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
  align-items:start;
}
.energy-settings .card{
  padding:14px;
}
.energy-settings .row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:8px 0;
  border-bottom:1px solid #eceff3;
}
.energy-settings .row.row-no-border{
  border-bottom:none;
}
.energy-settings .k{
  font-weight:700;
  color:#374151;
}
.energy-settings .energy-val{
  font-weight:800;
  color:#111827;
}
.energy-settings .section-title{
  font-weight:800;
  color:#111827;
  margin:8px 0;
}
.energy-settings .grid-2x3{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:8px;
}
.energy-settings .grid-row5{
  display:grid;
  grid-template-columns:repeat(5, minmax(0,1fr));
  gap:8px;
}
.energy-settings .grid-7cols{
  grid-template-columns:repeat(7, minmax(0,1fr));
}
.energy-settings .pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid #d1d5db;
  font-weight:800;
  font-size:0.82rem;
  background:#f3f4f6;
  color:#374151;
}
.energy-settings .pill.warn{
  background:#fff7ed;
  border-color:#fdba74;
  color:#9a3412;
}
.energy-settings .pill-tight{
  min-height:24px;
  padding:2px 8px;
}
.energy-settings .actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-top:10px;
}
.energy-settings .status{
  font-size:0.85rem;
  color:#374151;
}
.energy-settings .hint{
  color:#6b7280;
  font-size:0.9rem;
  line-height:1.4;
}
.energy-settings .hint-tight{
  margin:4px 0 8px 0;
}
.energy-settings .mono-inline{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:0.92em;
}
.energy-settings .flex-end-wrap{
  display:flex;
  align-items:center;
  gap:8px;
}
.energy-settings .u-mb-12{
  margin-bottom:12px;
}

/* Tapo smart plug pages: align to site-wide style */
.tapo-wrap{
  max-width: var(--site-content-max);
  margin: 0 auto;
}
.tapo-card{
  background:#fff;
  border-radius:12px;
  box-shadow:0 6px 20px rgba(0,0,0,0.2);
  padding:16px;
}
.tapo-h2{
  margin:0 0 12px 0;
}
.tapo-actions-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:12px;
}
.tapo-form{
  display:grid;
  gap:12px;
}
.tapo-grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
.tapo-field{
  display:grid;
  gap:6px;
}
.tapo-field label{
  font-weight:700;
  color:#374151;
  font-size:0.92rem;
}
.tapo-field input,
.tapo-field select,
.tapo-field textarea{
  width:100%;
  max-width:100%;
  box-sizing:border-box;
  border:1px solid #cfd5df;
  border-radius:10px;
  background:#fff;
  color:#111827;
  padding:10px 12px;
  font-size:0.95rem;
}
.tapo-help{
  color:#6b7280;
  font-size:0.82rem;
}
.tapo-muted{
  color:#6b7280;
  font-size:0.9rem;
}
.tapo-inline{
  display:inline-flex;
  align-items:center;
}
.tapo-inline-gap{
  gap:8px;
  flex-wrap:wrap;
}
.tapo-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border:1px solid #e5e7eb;
  background:#f9fafb;
  border-radius:999px;
  padding:5px 10px;
}
.tapo-chip-start{
  justify-content:flex-start;
}
.tapo-input-narrow{
  width:110px !important;
  min-width:110px;
  padding:6px 8px !important;
}
.tapo-input-octet{
  width:82px !important;
  min-width:82px;
  padding:6px 8px !important;
}
.tapo-hide{
  display:none !important;
}
.tapo-submit-row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
@media (max-width: 900px){
  .tapo-grid-2{
    grid-template-columns:1fr;
  }
}

/* Smart home icons admin page */
.admin-wrap-900{
  max-width: 900px;
}
.admin-card-pad20{
  padding: 20px;
}
.admin-h1-page{
  margin: 0 0 10px 0;
  font-size: 1.45rem;
  font-weight: 900;
}
.admin-h2-lg{
  margin: 0 0 6px 0;
  font-size: 1.1rem;
  font-weight: 800;
}
.admin-blurb{
  line-height: 1.5;
}
.admin-blurb-sm{
  line-height: 1.45;
}
.tip-box{
  margin: 0 0 16px 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d9dce3;
  background: #f8fafc;
  color: #374151;
}
.flex-col-gap20{
  display: grid;
  gap: 20px;
}
.subpanel-fa{
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
}
.flex-between-start{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.flex-row-wrap-8{
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-subcard{
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
  text-align: center;
}
.u-pad-8{ padding: 8px; }
.icon-preview-44{
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
}
.icon-preview-swatch{
  width:44px;
  height:44px;
  border-radius:10px;
  border:1px solid #ddd;
  background:var(--swatch-bg, #eee);
  box-sizing:border-box;
}
.text-muted-sm{
  font-size: 0.8rem;
  color: #6b7280;
}
.u-mt-6{ margin-top: 6px; }
.u-ml-10{ margin-left: 10px; }
.u-mb-20{ margin-bottom: 20px; }
.u-fw-700{ font-weight: 700; }

.form-mt14-gap12{
  margin-top: 14px;
  display: grid;
  gap: 12px;
}
.flex-col-label-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.flex-col-label{
  display: grid;
  gap: 6px;
}
.file-input-sm{
  font-size: 0.88rem;
}
.grid-form-220{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.icons-save-btn{
  border: 2px solid var(--site-purple);
  border-radius: 999px;
  background: var(--site-purple);
  color: #fff;
  font-weight: 800;
  min-height: 34px;
  padding: 8px 14px;
}
.icons-save-btn:hover{
  filter: brightness(1.05);
}

.advanced-details{
  margin-top: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
.details-p{ margin: 8px 0; color:#374151; }
.details-p0{ margin: 0; color:#374151; }

/* Smart Home admin + shared admin utilities (titles, grids, forms) */
.text-muted-09{
  color:#6b7280;
  font-size:0.95rem;
  line-height:1.45;
}
.admin-h2{
  margin:0 0 8px 0;
  font-size:1.25rem;
  font-weight:800;
  color:#111827;
  letter-spacing:-0.02em;
}
.admin-h3{
  margin:0 0 6px 0;
  font-size:1.05rem;
  font-weight:800;
  color:#111827;
}
.admin-lead-mb{
  margin-bottom:14px;
  line-height:1.5;
  color:#4b5563;
  font-size:0.95rem;
}
.hr-soft{
  border:0;
  border-top:1px solid #e5e7eb;
  margin:18px 0;
}
.minw0{ min-width:0; }
.flex-between{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.grid-2col{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:16px;
}
@media (max-width: 900px){
  .grid-2col{ grid-template-columns:1fr; }
}
.workflow-ol{
  margin:0;
  padding-left:1.25rem;
  color:#374151;
  line-height:1.6;
}
.workflow-ol li{ margin-bottom:6px; }
.admin-muted-block{
  margin-top:16px;
  padding:10px 12px;
  font-size:0.88rem;
  color:#6b7280;
  background:#f9fafb;
  border-radius:10px;
  border:1px solid #e5e7eb;
}
.admin-card-pad12{
  padding:12px;
}
/* Long house names on detail: truncate without fighting admin-h1-page */
.house-title-clip{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width:100%;
}
.house-card-title{
  font-size:1.1rem;
  font-weight:800;
  margin:0;
  line-height:1.25;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width:100%;
}
.houses-form-grid{
  display:grid;
  grid-template-columns:minmax(0, 1.2fr) auto auto;
  gap:12px;
  align-items:end;
}
@media (max-width: 700px){
  .houses-form-grid{ grid-template-columns:1fr; }
}
.houses-list-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:16px;
  margin-top:16px;
}
@media (max-width: 900px){
  .houses-list-grid{ grid-template-columns:1fr; }
}
.grid-span-full-muted{
  grid-column:1 / -1;
  text-align:center;
  padding:20px;
  color:#6b7280;
  font-size:0.95rem;
  border:1px dashed #d1d5db;
  border-radius:12px;
  background:#fafafa;
}
.input-max-420{ max-width:420px; }
.input-max-110{ max-width:110px; }
.floor-file-text{
  width:100%;
  max-width:280px;
  box-sizing:border-box;
  border:1px solid #cfd5df;
  border-radius:10px;
  padding:8px 10px;
  font-size:0.9rem;
  background:#fff;
  cursor:pointer;
  color:#111827;
}
.house-floor-empty{
  margin-top:12px;
  padding:14px;
  text-align:center;
  color:#6b7280;
  font-size:0.9rem;
  background:#f9fafb;
  border-radius:10px;
  border:1px dashed #e5e7eb;
}
.form-inline-center{
  display:inline-flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.form-m-0{ margin:0; }
.u-mt-8{ margin-top:8px; }
.u-mt-10{ margin-top:10px; }
.u-mt-12{ margin-top:12px; }
.u-mt-16{ margin-top:16px; }
.u-mt-20{ margin-top:20px; }
.u-mb-10{ margin-bottom:10px; }
.u-mb-12{ margin-bottom:12px; }
.u-mb-14{ margin-bottom:14px; }
.houses-form-submit{
  display:flex;
  justify-content:flex-end;
  align-items:flex-end;
}

@media (max-width: 900px){
  .flex-col-label-grid{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px){
  .energy-settings .grid{
    grid-template-columns:1fr;
  }
  .energy-settings .grid-7cols{
    grid-template-columns:repeat(4, minmax(0,1fr));
  }
  .energy-settings .grid-row5{
    grid-template-columns:repeat(3, minmax(0,1fr));
  }
}

/* Architecture pages */
.arch-wrap{
  max-width: var(--site-content-max);
  margin: 0 auto;
  display: grid;
  gap: 14px;
}
.arch-image{
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  padding: 10px;
}
.arch-image img{
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}
.arch-title{
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  padding: 12px 14px;
  font-weight: 800;
  color: #111827;
}
.arch-wrap .card{
  padding: 14px;
}
.arch-wrap .card h3{
  margin: 0 0 8px 0;
}
.arch-wrap .card p{
  margin: 0;
  line-height: 1.5;
}
.arch-spaced-p{
  margin-top: 10px !important;
}
.arch-wrap .kv{
  display: block;
  margin: 0;
}
.arch-wrap .row{
  margin: 6px 0;
}
.arch-wrap .fields{
  margin: 8px 0 0 18px;
}
.arch-wrap .fields li{
  margin: 6px 0;
}
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
}

/* Bin monitoring: manual fill levels table + toggles */
.bin-fill-table{
  min-width: 980px;
}
.bin-table-header,
.bin-row{
  display:grid;
  grid-template-columns: 1.2fr 1.7fr 1.7fr 0.8fr 0.7fr 0.8fr 0.7fr;
  gap:10px;
  align-items:center;
}
.bin-table-header{
  padding:8px 0 10px 0;
  font-size:0.82rem;
  font-weight:800;
  color:#6b7280;
  border-bottom:1px solid #e5e7eb;
}
.bin-row{
  padding:10px 0;
  border-bottom:1px solid #eceff3;
}
.bin-name{
  font-weight:700;
  color:#1f2937;
}
.bin-slider-wrap{
  display:flex;
  align-items:center;
  gap:10px;
}
.bin-slider,
.rate-slider{
  width:100%;
  min-width:140px;
}
.fill-val,
.rate-val{
  min-width:40px;
  text-align:right;
  font-weight:700;
  color:#374151;
}
.rate-unit{
  width:100%;
  min-width:92px;
  border:1px solid #d1d5db;
  border-radius:8px;
  padding:6px 8px;
  background:#fff;
  color:#111827;
}
.btn-bin-toggle{
  border:1px solid #cfd5df;
  border-radius:999px;
  background:#e5e7eb;
  color:#374151;
  font-weight:800;
  min-height:30px;
  padding:6px 10px;
  min-width:72px;
}
.btn-bin-fire-on{
  background:#dc2626;
  border-color:#dc2626;
  color:#fff;
}
.btn-bin-vandalised-on{
  background:#b45309;
  border-color:#b45309;
  color:#fff;
}
.btn-empty-bin{
  border:2px solid var(--site-purple);
  border-radius:999px;
  background:#fff;
  color:var(--site-purple);
  font-weight:800;
  min-height:30px;
  padding:6px 12px;
}
.btn-empty-bin:hover{
  background:rgba(85,20,180,0.08);
}
.status-muted{
  color:#6b7280;
  font-size:0.86rem;
}

/* Distance dashboard layout */
.distance-topbar{
  display:grid;
  grid-template-columns: 1.05fr 1.2fr 1fr;
  gap:14px;
  margin:6px 0 16px 0;
  align-items:stretch;
}
.distance-left,
.distance-middle,
.distance-right{
  padding:14px;
}
.distance-now-label{
  font-size:0.86rem;
  color:#6b7280;
  font-weight:700;
  margin-bottom:4px;
}
.distance-now{
  display:flex;
  align-items:flex-end;
  gap:6px;
  font-size:1.95rem;
  font-weight:900;
  color:#111827;
}
.distance-unit{
  font-size:0.95rem;
  color:#6b7280;
  font-weight:700;
  margin-bottom:4px;
}
.info-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:10px;
}
.info-item{
  border:1px solid #e5e7eb;
  border-radius:10px;
  padding:10px;
  background:#f8fafc;
}
.info-k{
  font-size:0.78rem;
  font-weight:800;
  color:#6b7280;
  text-transform:uppercase;
  letter-spacing:.02em;
}
.info-v{
  margin-top:5px;
  font-size:1rem;
  font-weight:800;
  color:#111827;
}
.range-label{
  font-size:0.86rem;
  color:#6b7280;
  font-weight:700;
  margin-bottom:8px;
}
.range-buttons{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:8px;
}
.range-btn{
  border:2px solid var(--site-purple);
  border-radius:999px;
  background:#fff;
  color:var(--site-purple);
  font-weight:800;
  font-size:0.82rem;
  min-height:32px;
  cursor:pointer;
}
.range-btn:hover{
  background:rgba(85,20,180,0.08);
}
.range-btn.active{
  background:var(--site-purple);
  color:#fff;
}
.distance-depth-input{
  width:100%;
  max-width:120px;
  border:1px solid #cfd5df;
  border-radius:10px;
  background:#fff;
  color:#111827;
  padding:8px 10px;
  font-weight:700;
}
.distance-chart-box{
  padding:14px;
}
.distance-chart-box h3{
  margin:0 0 10px 0;
  font-size:1rem;
}

@media (max-width: 980px){
  .distance-topbar{
    grid-template-columns:1fr;
  }
  .range-buttons{
    grid-template-columns:repeat(2, minmax(0,1fr));
  }
}

/* =========================
   Base layout / chrome (from base.html)
   ========================= */
header{
  display:flex;
  justify-content:center;
  align-items:center;
  padding:12px 16px;
  background:#f1f1f1;
  border-bottom:2px solid #ccc;
}
header h1{
  margin:0;
  font-size:clamp(1.2rem,3.5vw,1.7rem);
}

.page-wrap{
  max-width:1200px;
  margin:0 auto;
  padding:16px 14px;
}

/* Flash messages */
.flash-wrap{
  margin:10px 0 14px 0;
  display:grid;
  gap:10px;
}
.flash{
  border-radius:12px;
  padding:12px 14px;
  font-weight:700;
  border:1px solid rgba(0,0,0,0.12);
}
.flash.ok{ background:#e9fbf0; color:#0f5132; }
.flash.err,
.flash.error{ background:#fdecec; color:#842029; }

/* =========================
   NAV (scoped to nav to avoid clashes)
   ========================= */
nav{
  background:#5514B4;
  padding:10px 12px;
}

nav .nav-row{
  display:flex;
  align-items:center;
  gap:16px;
  max-width:1200px;
  margin:0 auto;
  flex-wrap:wrap;
}

nav .nav-spacer{ flex:1; }

/* Nav buttons/links (scoped!) */
nav .btn-link,
nav .dropbtn{
  background:transparent;
  border:2px solid rgba(255,255,255,0.65);
  color:#fff;
  font-size:0.95rem;
  font-weight:700;
  padding:8px 14px;
  border-radius:10px;
  text-decoration:none;
  cursor:pointer;
  white-space:nowrap;
}

nav .btn-link:hover,
nav .dropbtn:hover{
  background:rgba(255,255,255,0.14);
}

nav .btn-link.active{
  background:rgba(255,255,255,0.22);
}

/* Dropdowns (scoped!) */
nav .dropdown{ position:relative; }

nav .dropdown-content{
  display:none;
  position:absolute;
  right:0;
  top:calc(100% + 8px);
  min-width:220px;
  background:#fff;
  border-radius:12px;
  box-shadow:0 8px 20px rgba(0,0,0,0.18);
  padding:8px;
  z-index:999;
}

nav .dropdown-content a{
  display:block;
  padding:10px 12px;
  border-radius:10px;
  text-decoration:none;
  color:#222;
  font-weight:700;
  font-size:0.9rem;
}

nav .dropdown-content a:hover{ background:#f2effa; }

nav .dropdown.open > .dropdown-content{ display:block; }

/* IoT demos 3-level nav */
nav .dropdown-content.dropdown-level1{
  min-width:200px;
  background:#eef2f8;
  border:1px solid #b6c0d2;
}
nav .dropdown-sub{
  position:relative;
}
nav .dropdown-sub-trigger{
  display:block;
  width:100%;
  text-align:left;
  border:0;
  background:transparent;
  padding:10px 12px;
  border-radius:10px;
  color:#222;
  font-weight:700;
  font-size:0.9rem;
  cursor:pointer;
}
nav .dropdown-sub-trigger:hover{ background:#e5dcfb; }

nav .dropdown-content.dropdown-level2{
  display:none;
  position:absolute;
  left:100%;
  top:0;
  margin-left:4px;
  min-width:220px;
  max-height:70vh;
  overflow-y:auto;
  background:#eef2f8;
  border:1px solid #b6c0d2;
}
nav .dropdown-sub.open > .dropdown-content.dropdown-level2{
  display:block;
}

nav .dropdown-divider{
  height:1px;
  background:#e5e5e5;
  margin:6px 0;
}

/* Optional: small-screen nav wrap looks nicer */
@media (max-width: 768px){
  nav .nav-row{ gap:10px; }
  nav .btn-link,
  nav .dropbtn{ padding:8px 12px; }

  /* iPhone-safe submenu behavior */
  nav .dropdown-content.dropdown-level2{
    left:0;
    top:100%;
    margin-left:0;
    margin-top:4px;
    min-width:200px;
    max-width:min(88vw, 320px);
    z-index:1001;
  }
}

/* Header domain line (was inline in base.html) */
.header-domain-meta{
  font-size:12px;
  opacity:0.8;
  margin-top:4px;
}

/* Nav pills that are not links */
.nav-pill-muted{
  opacity:0.85;
  cursor:default;
}
.nav-pill-muted--strong{
  opacity:0.95;
  cursor:default;
}

nav .dropdown-content button.dropdown-menu-btn{
  display:block;
  width:100%;
  text-align:left;
  border:0;
  background:#fff;
  color:#5514B4;
  padding:10px 12px;
  border-radius:10px;
  font-weight:700;
  font-size:0.9rem;
  cursor:pointer;
  font-family:inherit;
}
nav .dropdown-content button.dropdown-menu-btn:hover{
  background:#f2effa;
}

@media (max-width: 420px){
  nav .btn-link,
  nav .dropbtn{
    white-space:normal;
  }
}

/* =========================
   Site modals (View as customer, reset password, etc.)
   ========================= */
.modal-site{
  display:none;
  position:fixed;
  inset:0;
  z-index:2000;
  align-items:flex-start;
  justify-content:center;
  padding:12px;
  box-sizing:border-box;
  background:rgba(0,0,0,0.45);
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
}
.modal-site.is-open{
  display:flex;
}
.modal-site__panel{
  width:100%;
  max-width:420px;
  margin:12vh auto 24px;
  background:#fff;
  border-radius:12px;
  padding:14px;
  border:1px solid #ddd;
  box-sizing:border-box;
}
.modal-site__panel > h3:first-child,
.modal-site__panel .admin-h3:first-child{
  margin-top:0;
}

/* =========================
   AI Assistant (base.html chrome — centralized)
   ========================= */
.ai-assist-toggle{
  position:fixed;
  right:0;
  bottom:24px;
  z-index:1100;
  border:1px solid var(--site-purple);
  border-right:none;
  background:var(--site-purple);
  color:#ffffff;
  border-radius:10px 0 0 10px;
  width:38px;
  height:min(520px, 70vh);
  padding:8px 6px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  letter-spacing:0.2px;
  writing-mode:vertical-rl;
  text-orientation:mixed;
  cursor:pointer;
  box-shadow:-6px 6px 18px rgba(76,29,149,0.3);
  transition:right 0.28s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.ai-assist-toggle:hover{
  background:#4a11a0;
}
.ai-assist-toggle[aria-expanded="true"]{
  right:min(380px, calc(100vw - 60px));
  background:#4a11a0;
  box-shadow:-8px 10px 22px rgba(76,29,149,0.38);
}
.ai-assist-panel{
  position:fixed;
  right:0;
  bottom:24px;
  width:min(380px, calc(100vw - 60px));
  height:min(520px, 70vh);
  background:#ffffff;
  border:1px solid #ddd6fe;
  border-radius:14px;
  box-shadow:-10px 14px 32px rgba(0,0,0,0.2);
  z-index:1200;
  transform:translateX(calc(100% + 56px));
  transition:transform 0.28s ease, opacity 0.28s ease;
  opacity:0;
  display:flex;
  flex-direction:column;
}
.ai-assist-panel.open{
  transform:translateX(0);
  opacity:1;
}
.ai-assist-log{
  flex:1;
  overflow:auto;
  padding:12px;
  background:#fafafa;
}
.ai-assist-msg{
  margin-bottom:10px;
  border:1px solid #e5e7eb;
  background:#fff;
  border-radius:10px;
  padding:8px 10px;
  white-space:pre-wrap;
  color:#111827;
  font-size:0.95rem;
}
.ai-assist-msg.user{
  border-color:#c7d2fe;
  background:#eef2ff;
}
.ai-assist-input-row{
  display:flex;
  gap:8px;
  padding:12px;
  border-top:1px solid #f1f5f9;
}
.ai-assist-input-row input{
  flex:1;
  min-width:0;
  border:1px solid #d1d5db;
  border-radius:10px;
  padding:10px 11px;
  box-sizing:border-box;
  max-width:100%;
}
@media (max-width: 800px){
  .ai-assist-toggle{
    bottom:16px;
    height:min(460px, 66vh);
    width:34px;
    padding:6px 4px;
  }
  .ai-assist-toggle[aria-expanded="true"]{
    right:min(360px, calc(100vw - 48px));
  }
  .ai-assist-panel{
    right:0;
    bottom:12px;
    height:min(460px, 66vh);
    width:min(360px, calc(100vw - 48px));
  }
}

/* =========================
   (Legacy) Header Top: Logos and Title
   =========================
   Safe to keep if used on any pages.
*/
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background-color: #fff;
  border-bottom: 1px solid #ccc;
}

.header-left,
.header-center,
.header-right { display: flex; align-items: center; }

.header-center {
  flex-grow: 1;
  justify-content: center;
  font-size: 1.5em;
  font-weight: bold;
  text-align: center;
}

/* Scoped logo */
.header-top .logo { height: 50px; }

.header-left img,
.header-right img { display: block; }

/* Responsive tweaks (header-top only) */
@media (max-width: 768px) {
  .header-top {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
  }
  .header-left, .header-right { justify-content: center; }
}

/* =========================
   BLOG (Public listing)
   ========================= */
.blog-hero {
  padding: 28px 16px;
  background: linear-gradient(180deg, rgba(85,20,180,0.10), rgba(0,0,0,0));
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.blog-hero-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.blog-hero-kicker {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 8px;
}

.blog-hero-title {
  font-size: 34px;
  margin: 0 0 8px 0;
}

.blog-hero-subtitle {
  margin: 0;
  max-width: 70ch;
  opacity: 0.8;
  line-height: 1.45;
}

.blog-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 28px 16px;
}

.blog-empty {
  padding: 18px;
  border: 1px dashed rgba(0,0,0,0.25);
  border-radius: 14px;
  background: rgba(0,0,0,0.02);
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 980px) { .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .blog-grid { grid-template-columns: 1fr; } }

.blog-card {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.10);
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.blog-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.10);
}

/* Tile image area */
.blog-card-media {
  height: 160px;
  position: relative;
  overflow: hidden;
  background: rgba(85,20,180,0.06);
}

/* FIT (no crop): show the whole image inside the tile */
.blog-card-media img.blog-card-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: center;
  display: block;
  background: rgba(255,255,255,0.65);
}

/* Placeholder */
.blog-card-img--placeholder {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.blog-card-placeholder { display: flex; gap: 8px; }

.blog-card-placeholder-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(85,20,180,0.55);
}

.blog-card-body { padding: 14px 14px 16px 14px; }

.blog-card-meta {
  font-size: 12px;
  opacity: 0.75;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.blog-dot { opacity: 0.5; }

.blog-card-title {
  margin: 0 0 8px 0;
  font-size: 18px;
  line-height: 1.25;
}

.blog-card-excerpt {
  margin: 0 0 12px 0;
  opacity: 0.85;
  line-height: 1.45;
}

.blog-card-cta {
  font-size: 13px;
  color: #5514B4;
  font-weight: 600;
}

/* =========================
   BLOG (Post page)
   ========================= */
.post {
  max-width: 900px;
  margin: 0 auto;
  padding: 18px 16px 36px 16px;
}

.post-breadcrumb-wrap{
  max-width: 900px;
  margin: 0 auto 6px auto;
}

.post-breadcrumb {
  font-size: 12px;
  opacity: 0.75;
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.post-breadcrumb a {
  color: inherit;
  text-decoration: none;
}

.post-backlink{
  text-decoration:none;
}
.post-backlink:hover{
  text-decoration:underline;
}

.post-date{
  opacity:0.85;
}

.post-title {
  font-size: 36px;
  line-height: 1.15;
  margin: 0 0 10px 0;
}

.post-excerpt {
  margin: 0 0 16px 0;
  opacity: 0.85;
  max-width: 75ch;
  line-height: 1.5;
  font-size: 16px;
}

.post-hero {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.10);
  margin: 14px 0 18px 0;
  background: rgba(85,20,180,0.06);
}

/* FIT (no crop): show the whole hero image */
.post-hero img {
  width: 100% !important;
  height: 360px !important;
  object-fit: contain !important;
  object-position: center;
  display: block;
  background: rgba(255,255,255,0.65);
}

/* Content body */
.post-content {
  line-height: 1.65;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.post-content h2 { margin-top: 22px; }
.post-content p  { margin: 12px 0; }

/* Post content images: scale down to container (fit width) */
.post-content img {
  max-width: 100% !important;
  height: auto !important;
  width: auto !important;
  display: block;
  margin: 16px auto;
  border-radius: 12px;
}

/* Word/Docs paste safety */
.post-content * {
  box-sizing: border-box;
  max-width: 100%;
}

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.10);
}

.post-content th,
.post-content td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  text-align: left;
  vertical-align: top;
}

.post-content thead th { background: rgba(0,0,0,0.03); }

.post-content pre,
.post-content code {
  white-space: pre-wrap;
  word-break: break-word;
}

.post-footer { margin-top: 24px; }

.post-back {
  text-decoration: none;
  color: #5514B4;
  font-weight: 600;
}

/* =========================
   BLOG (Admin)
   ========================= */
.admin-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

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

.admin-card {
  border: 1px solid rgba(0,0,0,0.10);
  background: #fff;
  border-radius: 16px;
  padding: 16px;
}

.admin-help {
  margin-top: -6px;
  opacity: 0.8;
  line-height: 1.45;
}

.admin-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.admin-label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
}

.admin-input,
.admin-textarea {
  width: 100%;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

.admin-textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               "Liberation Mono", "Courier New", monospace;
  line-height: 1.35;
}

.admin-check {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
}

.blog-admin-create-card{
  overflow:hidden;
}
.blog-admin-content-field{
  display:grid;
  gap:8px;
}
.blog-admin-field-label{
  font-weight:700;
  color:#374151;
  font-size:0.92rem;
}
.editor-wrap{
  border:1px solid rgba(0,0,0,0.12);
  border-radius:12px;
  overflow:hidden;
  background:#fff;
}
#toolbar{
  border:0;
  border-bottom:1px solid #e5e7eb;
  background:#f9fafb;
}
#editor{
  min-height:280px;
  max-height:58vh;
  overflow:auto;
}
.blog-admin-submit-wrap{
  display:flex;
  justify-content:flex-start;
}
.label-blog-check-hidden{
  display:none;
}
.blog-h2-posts{
  margin:0 0 10px 0;
}
.posts-table{
  width:100%;
  border-collapse:collapse;
}
.posts-table th,
.posts-table td{
  padding:10px 8px;
  border-bottom:1px solid #e5e7eb;
  text-align:left;
  vertical-align:top;
}
.th-w55{ width:55%; }
.th-w15{ width:15%; }
.th-w30{ width:30%; }
.u-fw-800{ font-weight:800; }
.posts-meta{
  margin-top:4px;
}
.posts-actions{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}
.inline-a{
  display:inline;
}

.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.admin-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 14px;
  background: rgba(0,0,0,0.02);
}

.admin-row-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.admin-row-meta {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-row-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-link {
  text-decoration: none;
  color: #5514B4;
  font-weight: 700;
  font-size: 13px;
  align-self: center;
}

.admin-link-danger {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #b00020;
  font-weight: 800;
  font-size: 13px;
}

/* =========================
   SMART HOME (Floor page UI)
   ========================= */

/* Header */
.sh-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  flex-wrap:wrap;
  padding-bottom:12px;
  border-bottom:1px solid #f3f4f6;
  margin-bottom:14px;
}

.sh-header-left{ min-width:260px; flex:1 1 auto; }

.sh-title-row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.sh-title{
  margin:0;
  font-size:1.35rem;
  font-weight:900;
  color:#111827;
}

.sh-subline{
  margin-top:6px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  font-size:0.95rem;
  color:#6b7280;
}

.sh-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:2px 10px;
  border-radius:999px;
  font-size:0.86rem;
  font-weight:900;
  border:1px solid #e5e7eb;
}

.sh-badge-on{
  background:#ecfdf5;
  border-color:#a7f3d0;
  color:#065f46;
}

.sh-badge-off{
  background:#f9fafb;
  color:#6b7280;
}

.sh-header-right{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.sh-live{
  font-size:0.9rem;
  color:#6b7280;
}

.sh-live strong{ font-weight:900; }

.sh-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid #e5e7eb;
  background:#fff;
  font-size:0.85rem;
  color:#111827;
  font-weight:800;
}

.sh-pill strong{ font-weight:900; }

.sh-pill-dot{
  width:8px;
  height:8px;
  border-radius:999px;
  display:inline-block;
}

/* Nav layout only (top nav uses .btn-link/.dropbtn) */
.sh-nav-row{
  margin-top:10px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.sh-floor-nav{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}

/* Main grid */
.sh-grid{
  margin-top:12px;
  display:grid;
  grid-template-columns: 1fr 340px;
  gap:14px;
}

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

/* MAP container */
.sh-map{ min-width:0; }

/* Floor plan: scroll + zoom (see floor.html initFloorplanViewport) */
.sh-floorplan-toolbar{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  margin-bottom:8px;
}
.sh-floorplan-zoompct{
  font-weight:700;
  font-size:0.9rem;
  color:#374151;
  min-width:3.2rem;
  text-align:center;
}
.sh-floorplan-zoomhint{
  margin-left:auto;
  font-size:0.78rem;
  color:#9ca3af;
}
@media (max-width: 520px){
  .sh-floorplan-zoomhint{ display:none; }
}

.sh-floorplan-viewport{
  position:relative;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
  max-height:min(78vh, 920px);
  border:1px solid #eee;
  border-radius:12px;
  background:#fafafa;
  touch-action:pan-x pan-y;
}

.sh-floorplan-zoom{
  display:block;
  width:100%;
  transform-origin:top left;
}

.sh-floorplan{
  position: relative;
  border:0;
  border-radius:0;
  overflow:hidden;
  background:transparent;
}

.sh-floorplan img{
  display:block;
  width:100%;
  height:auto;
}

/* overlay */
.sh-markers{
  position:absolute;
  inset:0;
  pointer-events:none;
}

/* Marker v2 */
.sh-marker{
  position:absolute;
  transform: translate(-50%, -50%);
  pointer-events:auto;
  cursor:pointer;
  user-select:none;
  left:var(--x-pct, 0%);
  top:var(--y-pct, 0%);
}

.sh-marker--v2{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
}

.sh-marker-dot{
  width:26px;
  height:26px;
  border-radius:999px;
  background:#fff;
  border:2px solid #9ca3af; /* ring becomes online/offline via JS */
  box-shadow: 0 2px 10px rgba(0,0,0,0.14);
  position:relative;
  display:grid;
  place-items:center;
  transition: opacity .18s ease, box-shadow .18s ease, transform .18s ease, filter .18s ease, outline .18s ease;
  opacity:0.95;
}

.sh-marker:hover .sh-marker-dot{
  filter:brightness(1.05);
  transform: translateY(-1px);
}

.sh-dot{
  position:absolute;
  inset:3px;
  border-radius:999px;
  background:transparent; /* filled via JS for on/motion */
  box-shadow:none;
  transition: background .18s ease, box-shadow .18s ease, filter .18s ease;
}

.sh-marker-letter{
  position:relative;
  z-index:1;
  font-weight:900;
  font-size:12px;
  color:#111827;
  line-height:1;
}

.sh-marker-label{
  max-width:160px;
  text-align:center;
  font-size:12px;
  font-weight:900;
  color:#111;
  background: rgba(255,255,255,0.92);
  border:1px solid rgba(0,0,0,0.10);
  padding:4px 8px;
  border-radius:999px;
  box-shadow:0 6px 14px rgba(0,0,0,0.08);
  line-height:1.2;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* Popover */
.sh-popover{
  position:absolute;
  display:none;
  min-width:240px;
  max-width:340px;
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:12px;
  box-shadow:0 10px 30px rgba(0,0,0,0.16);
  padding:10px;
  z-index:50;
}

.sh-pop-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}

.sh-pop-head-left{ min-width:0; }

.sh-pop-title{
  font-weight:900;
  color:#111827;
  line-height:1.1;
  word-break:break-word;
}

.sh-pop-sub{
  color:#6b7280;
  font-size:0.88rem;
  margin-top:3px;
  word-break:break-word;
}

.sh-pop-close{
  border:1px solid #e5e7eb;
  background:#fff;
  border-radius:10px;
  padding:3px 8px;
  cursor:pointer;
  font-weight:900;
  color:#374151;
}

.sh-pop-body{
  margin-top:10px;
  display:grid;
  gap:8px;
}

.sh-pop-pill-row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.sh-pop-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid #e5e7eb;
  background:#fff;
  font-size:0.85rem;
  color:#111827;
}

.sh-pop-dot{
  width:8px;
  height:8px;
  border-radius:999px;
  display:inline-block;
  background:#9ca3af;
}

.sh-pop-toggle-row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}

.sh-pop-hint{
  color:#6b7280;
  font-size:0.9rem;
}

.sh-pop-meta{
  border-top:1px solid #f3f4f6;
  padding-top:8px;
  color:#374151;
  font-size:0.92rem;
  display:grid;
  gap:4px;
}

.sh-pop-debug{
  border-top:1px solid #f3f4f6;
  padding-top:8px;
}

.sh-pop-debug summary{
  cursor:pointer;
  color:#6b7280;
  font-weight:800;
}

.sh-pop-raw{
  margin:8px 0 0 0;
  max-height:180px;
  overflow:auto;
  font-size:12px;
  background:#f9fafb;
  border:1px solid #eef2f7;
  border-radius:10px;
  padding:8px;
  white-space:pre-wrap;
}

/* Legend */
.sh-legend{
  margin-top:8px;
  color:#6b7280;
  font-size:0.9rem;
  display:flex;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.sh-legend-items{
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
}

.sh-legend-item{
  display:inline-flex;
  align-items:center;
  gap:6px;
}

.sh-legend-swatch{
  width:10px;
  height:10px;
  display:inline-block;
}

.sh-legend-swatch.ring{
  border-radius:50%;
  background:#fff;
  border:2px solid #9ca3af;
}

.sh-legend-swatch.dot{
  border-radius:999px;
}

/* Sidebar */
.sh-sidebar{
  border:1px solid #eee;
  border-radius:12px;
  background:#fff;
  padding:12px;
  height:fit-content;
}

.sh-sidebar-head{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:center;
}

.sh-sidebar-title{ font-weight:900; }

.sh-filter{
  margin-top:10px;
}

.sh-filter input{
  width:100%;
  border:1px solid #e5e7eb;
  border-radius:10px;
  padding:8px 10px;
  outline:none;
}

.sh-list{
  margin-top:10px;
  display:grid;
  gap:8px;
}

.sh-list-muted{
  color:#6b7280;
  font-size:0.92rem;
}

.sh-toast{
  display:none;
  margin-top:12px;
  border:1px solid #e5e7eb;
  background:#f9fafb;
  border-radius:12px;
  padding:10px;
  color:#374151;
  font-size:0.92rem;
}

.sh-tip{
  margin-top:12px;
  border-top:1px solid #f3f4f6;
  padding-top:10px;
  color:#6b7280;
  font-size:0.9rem;
}

/* List room groups + rows (used by JS rendering) */
.sh-room{
  border:1px solid #eef2f7;
  border-radius:12px;
  background:#fff;
  overflow:hidden;
}

.sh-room summary{
  list-style:none;
  cursor:pointer;
  padding:10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.sh-room-title{
  font-weight:900;
  color:#111827;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.sh-room-count{
  font-size:0.8rem;
  font-weight:900;
  color:#6b7280;
  border:1px solid #e5e7eb;
  background:#f9fafb;
  border-radius:999px;
  padding:2px 8px;
}

.sh-room-body{
  padding:10px;
  display:grid;
  gap:8px;
  border-top:1px solid #f3f4f6;
}

.sh-row{
  border:1px solid #eef2f7;
  border-radius:12px;
  padding:10px;
  display:flex;
  gap:10px;
  align-items:center;
  cursor:pointer;
}

.sh-row-dot{
  width:10px;
  height:10px;
  border-radius:999px;
  display:inline-block;
  flex:0 0 auto;
  background:var(--dot-bg, #94a3b8);
}

.sh-row-name{
  min-width:0;
  flex:1 1 auto;
  font-weight:900;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.sh-row-pill{
  font-size:0.75rem;
  font-weight:900;
  border:1px solid var(--pill-border, #e5e7eb);
  background:var(--pill-bg, #fff);
  padding:2px 8px;
  border-radius:999px;
  color:#374151;
  flex:0 0 auto;
}

.sh-placeholder{
  padding: 28px;
  text-align: center;
  color: #666;
  font-style: italic;
}

/* Smart Home admin — house floorplan upload preview (houses.html) */
.house-floor-preview{
  margin-top:12px;
  border:1px solid #e5e7eb;
  border-radius:12px;
  box-sizing:border-box;
  overflow:auto;
  max-height:min(70vh, 900px);
  background:#fafafa;
  text-align:center;
  line-height:0;
}
.house-floor-preview img{
  display:block;
  max-width:100%;
  width:auto;
  height:auto;
  margin:0 auto;
}

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

/* Smart Home floor editor — /admin/smarthome/drag (large images must fit the column) */
.sh-editor-wrap{
  max-width:100%;
}
.sh-editor-top{
  display:flex;
  flex-wrap:wrap;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.sh-editor-lead{
  margin:0.35rem 0 0;
  color:#4b5563;
  font-size:0.95rem;
}
.sh-top-actions{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
}
.sh-zoombar{
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.sh-zoomlabel{
  min-width:3rem;
  text-align:center;
  font-weight:700;
  font-size:0.9rem;
}
.sh-addbar{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:flex-end;
  margin-bottom:10px;
}
.sh-editor-grid{
  display:grid;
  grid-template-columns:minmax(0, 1fr) 380px;
  gap:16px;
  align-items:start;
}
@media (max-width: 1100px){
  .sh-editor-grid{
    grid-template-columns:1fr;
  }
}
.sh-canvas-wrap{
  width:100%;
  max-width:100%;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
  max-height:min(78vh, 920px);
  border:1px solid #e5e7eb;
  border-radius:12px;
  background:#fafafa;
}
.sh-canvas{
  position:relative;
  width:100%;
  min-height:80px;
}
.sh-viewport{
  position:relative;
  display:block;
  width:100%;
  max-width:100%;
  transform-origin:top center;
}
.sh-floorimg{
  display:block;
  width:100%;
  max-width:100%;
  height:auto;
  vertical-align:top;
}
.sh-markers-layer{
  position:absolute;
  left:0;
  top:0;
  right:0;
  bottom:0;
  pointer-events:none;
}
.sh-markers-layer .sh-marker{
  pointer-events:auto;
}
.sh-click-overlay{
  position:absolute;
  inset:0;
  z-index:5;
  cursor:crosshair;
}

/* Agriculture dashboard */
.agri-dashboard-layout{
  display:grid;
  gap:14px;
}

.agri-kpi-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:12px;
}

.agri-card{
  padding:12px;
}

.agri-card-title{
  margin:0;
}

#farmMap{
  height:520px;
  border-radius:10px;
}

.agri-row{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}

.agri-kpi{
  font-size:22px;
  font-weight:700;
  margin:0;
}

.agri-note{
  font-size:12px;
  color:#4b5563;
  margin-top:6px;
}

.agri-list{
  margin:8px 0 0;
  padding-left:16px;
}

.agri-mini-chart{
  width:100%;
  height:130px;
}

.agri-badge{
  display:inline-block;
  padding:3px 8px;
  border-radius:999px;
  font-size:12px;
}

.agri-badge.ok{
  background:#dcfce7;
  color:#166534;
}

.agri-badge.warn{
  background:#fef3c7;
  color:#92400e;
}

.agri-field-moisture{
  margin-top:8px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.agri-field-moisture .field-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:6px 8px;
  background:#f8fafc;
  border-radius:8px;
  font-size:13px;
}

.agri-field-moisture .field-name{
  font-weight:700;
}

.agri-field-moisture .field-moist{
  font-weight:700;
  color:#166534;
}

.agri-field-moisture .field-moist.low{
  color:#b91c1c;
}

.agri-field-moisture .field-moist.warn{
  color:#b45309;
}

@media (max-width: 980px){
  .agri-kpi-grid{
    grid-template-columns:1fr;
  }
  .agri-row{
    grid-template-columns:1fr;
  }
}

/* =========================
   System Control (admin/system_control.html)
   ========================= */
.sysctl-page{
  max-width:900px;
}
.sysctl-service{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
  border:1px solid #e5e7eb;
  border-radius:8px;
  margin-bottom:8px;
}
.sysctl-service.failed{ border-left:4px solid #b91c1c; }
.sysctl-service.inactive{ border-left:4px solid #b45309; }
.sysctl-service.active{ border-left:4px solid #166534; }
.sysctl-service.unknown{ border-left:4px solid #6b7280; }
.sysctl-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:12px;
  align-items:center;
}
.sysctl-service-main{
  flex:1;
  min-width:0;
}
.sysctl-service-detail{
  color:#6b7280;
  font-size:13px;
}
.sysctl-btn{
  width:auto !important;
  min-width:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  white-space:nowrap;
  padding:5px 12px;
  min-height:32px;
  line-height:1.2;
  font-size:13px;
  border-radius:999px;
}
.sysctl-actions .sysctl-btn{
  padding:6px 14px;
  min-height:34px;
}
.kv-stack{
  flex-direction:column;
  align-items:flex-start;
  justify-content:flex-start;
  gap:6px;
}
.text-error{
  color:#b91c1c;
}
.text-hint-sm{
  margin:0;
  color:#6b7280;
  font-size:14px;
}

/* =========================
   Device Lab (admin/device_lab.html)
   ========================= */
.device-lab-toolbar{
  display:flex;
  gap:8px;
  align-items:center;
  margin-bottom:10px;
  flex-wrap:wrap;
}
.input-max-w-300{
  max-width:300px;
  box-sizing:border-box;
}
.label-inline-check{
  display:flex;
  align-items:center;
  gap:6px;
}
.admin-subcard--p10-left{
  padding:10px;
  text-align:left;
}
.admin-subcard--p10-left-mt10{
  padding:10px;
  text-align:left;
  margin-top:10px;
}
.device-lab-pre{
  max-height:220px;
  overflow:auto;
  background:#111;
  color:#c8f3c8;
  padding:8px;
  border-radius:8px;
  margin-top:8px;
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size:0.85rem;
  box-sizing:border-box;
}
.form-flex-wrap-gap8{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.form-flex-wrap-gap8-mt8{
  margin-top:8px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.grid-auto-160-mt8{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
  gap:8px;
  margin-top:8px;
}

/* =========================
   Device Inventory (admin/device_inventory.html)
   ========================= */
.device-inventory-panel{
  padding:6px 8px !important;
  margin-top:8px !important;
  text-align:left;
  position:relative;
  overflow:visible;
}
.device-inventory-panel .admin-h3{
  margin:0 0 4px 0;
  font-size:1rem;
}
.inventory-table-wrap{
  overflow-x:auto;
  overflow-y:hidden;
  border:1px solid #64748b;
  border-radius:8px;
  background:#fff;
  -webkit-forced-color-adjust:none;
  forced-color-adjust:none;
}
.inventory-table{
  width:100%;
  min-width:1480px;
  border-collapse:collapse;
  border-spacing:0;
  font-size:11px;
  -webkit-forced-color-adjust:none;
  forced-color-adjust:none;
  --inv-cell-border:#64748b;
}
.inventory-table th,
.inventory-table td{
  border:1px solid var(--inv-cell-border);
  padding:3px 5px;
  vertical-align:middle;
  white-space:nowrap;
  -webkit-forced-color-adjust:none;
  forced-color-adjust:none;
}
table.admin-table.inventory-table th,
table.admin-table.inventory-table td{
  border:1px solid var(--inv-cell-border);
  padding:3px 5px;
}
.inventory-table thead th{
  background:#f1f5f9;
}
.inventory-actions{
  display:flex;
  align-items:center;
  gap:4px;
}
.inventory-actions .select-admin{
  min-width:130px;
}
.inventory-action-box{
  border:1px solid #64748b;
  border-radius:6px;
  padding:2px;
  width:138px;
  background:#fff;
  -webkit-forced-color-adjust:none;
  forced-color-adjust:none;
}
.inventory-action-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:2px;
}
.inventory-action-grid .btn{
  border-radius:4px;
  width:100%;
  font-size:9px;
  line-height:1.1;
  padding:2px 2px;
  min-height:18px;
}
.customer-select-compact{
  width:100%;
  min-width:110px;
  font-size:9px;
  padding:1px 3px;
  height:20px;
}
.inventory-toolbar{
  display:flex;
  align-items:center;
  gap:4px;
  flex-wrap:nowrap;
  white-space:nowrap;
  overflow-x:visible;
  padding-bottom:2px;
  margin-bottom:4px !important;
}
.inventory-dialog{
  border:1px solid #ddd;
  border-radius:10px;
  padding:10px;
  max-width:760px;
  width:90%;
}
.inventory-dialog::backdrop{
  background:rgba(0,0,0,0.25);
}
.inventory-toolbar-spacer{
  flex:1 1 auto;
}
.inventory-filter-dropdown{
  position:relative;
  display:inline-block;
}
.inventory-filter-dropdown > summary{
  list-style:none;
  cursor:pointer;
}
.inventory-filter-dropdown > summary::-webkit-details-marker{
  display:none;
}
.inventory-filter-panel{
  position:absolute;
  right:0;
  top:30px;
  z-index:9999;
  width:280px;
  max-height:62vh;
  overflow:auto;
  background:#fff;
  border:1px solid #0f3b58;
  border-radius:12px;
  box-shadow:0 8px 18px rgba(0,0,0,0.18);
  padding:8px;
}
.inventory-filter-form{
  display:grid;
  gap:6px;
  font-size:11px;
}
.inventory-filter-row{
  display:grid;
  grid-template-columns:62px 1fr;
  gap:5px;
  align-items:start;
  border:1px solid #ececec;
  border-radius:6px;
  padding:4px;
  background:#fff;
}
.inventory-filter-row > label{
  font-size:11px;
  font-weight:600;
  line-height:1;
}
.inventory-filter-row .input-admin,
.inventory-filter-row .select-admin{
  font-size:11px;
  padding:2px 4px;
  min-height:24px;
}
.inventory-filter-options{
  display:flex;
  gap:6px;
  align-items:flex-start;
  flex-wrap:wrap;
  font-size:11px;
  max-height:90px;
  overflow:auto;
}
.inventory-filter-option{
  display:inline-flex;
  align-items:center;
  gap:4px;
  border:1px solid #d4d4d4;
  border-radius:4px;
  padding:2px 5px;
  cursor:pointer;
  background:#fff;
}
.inventory-filter-option input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}
.inventory-filter-option .xbox{
  width:12px;
  height:12px;
  border:1px solid #0f3b58;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:10px;
  line-height:1;
}
.inventory-filter-option input:checked + .xbox::after{
  content:"x";
}
.inventory-filter-option input:checked ~ .opt-text{
  font-weight:600;
}
.inventory-filter-option .opt-text{
  margin:0;
  font-size:10px;
}
.inventory-filter-actions{
  display:flex;
  justify-content:center;
  gap:6px;
  margin-top:0;
}
.inventory-filter-actions .btn{
  font-size:10px;
  line-height:1.1;
  padding:3px 8px;
}
.inventory-grid-compact{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(150px, 1fr));
  gap:6px;
  font-size:12px;
}
.inventory-grid-compact .input-admin,
.inventory-grid-compact .select-admin,
.inventory-grid-compact textarea{
  font-size:12px;
  padding:5px 7px;
}
.inventory-filter-group{
  border:1px solid #eee;
  border-radius:8px;
  padding:6px;
}
.inventory-filter-group summary{
  cursor:pointer;
  font-weight:600;
}
.create-device-grid{
  display:grid;
  grid-template-columns:110px 1fr auto;
  gap:6px;
  align-items:center;
  font-size:12px;
}
.create-device-grid .input-admin,
.create-device-grid .select-admin{
  font-size:12px;
  padding:4px 6px;
}
.inventory-pagination-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-top:4px;
  font-size:11px;
  flex-wrap:wrap;
}
.inventory-pagination-nav{
  display:flex;
  gap:8px;
  align-items:center;
}
.inventory-type-apps-row,
.inventory-type-apps-card{
  margin:10px 0;
  padding:10px;
  border:1px solid #e5e7eb;
  border-radius:8px;
}
.inventory-app-checks-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:8px;
}
.label-nowrap{
  white-space:nowrap;
}
.inventory-apps-grid{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.inventory-dialog-hint{
  margin:6px 0;
}
.dialog-actions-row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.inventory-grid-span-full{
  grid-column:1 / -1;
}
@media (forced-colors: active){
  .inventory-table-wrap,
  .inventory-table,
  .inventory-table th,
  .inventory-table td,
  .inventory-action-box{
    -webkit-forced-color-adjust:auto;
    forced-color-adjust:auto;
  }
  .inventory-table-wrap{
    border-color:CanvasText;
  }
  .inventory-table{
    --inv-cell-border:CanvasText;
  }
  .inventory-action-box{
    border-color:CanvasText;
  }
}

/* ----- Site-wide inline migration (remaining templates) ----- */
.u-mt-4{ margin-top:4px; }
.u-mt-18{ margin-top:18px; }
.u-mb-1rem{ margin-bottom:1rem; }
.u-mt-1rem{ margin-top:1rem; }
.u-mt-neg6{ margin-top:-6px; }
.site-login--narrow{ max-width:420px; }
.access-denied-card{
  max-width:760px;
  margin-left:auto;
  margin-right:auto;
}
.flex-row-gap8-mt12{
  margin-top:12px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}
.distance-now-label--mt{ margin-top:12px; }
.distance-now--large{ font-size:1.65rem; }
.distance-depth-block{ margin-top:12px; }
.distance-range-label-mt{ margin-top:10px; }
.btn-distance-set{ padding:8px 10px; }

.platform-home-list-tight{ margin-top:-6px; }

.admin-h3-mt16{ margin-top:16px; }
.admin-h3-mt18{ margin-top:18px; }

.flex-between-baseline-wrap{
  display:flex;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:8px;
  align-items:baseline;
}
.text-muted-mt6{ margin-top:6px; }
.admin-card-mt14{ margin-top:14px; }
.admin-table-mt10{ margin-top:10px; }
.form-flex-gap6-wrap{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}
.form-flex-gap8-ac{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}
.text-muted-mt8{ margin-top:8px; }
.form-mt10{ margin-top:10px; }

.admin-users-min340{ min-width:340px; }
.admin-users-scroll-180{
  max-height:180px;
  overflow:auto;
  padding:8px;
}
.label-block-12{
  display:block;
  font-size:12px;
}
.overflow-x-auto{
  overflow-x:auto;
}
.admin-users-scroll-170{
  max-height:170px;
  overflow:auto;
  padding:8px;
}

.smarthome-fields-toolbar{
  display:flex;
  gap:8px;
  align-items:center;
  margin:8px 0 14px;
}
.select-min-320{ min-width:320px; }
.grid-auto-180-8{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:8px;
}
.label-flex-check{
  display:flex;
  align-items:center;
  gap:6px;
}

.bin-locs-layout{
  display:grid;
  grid-template-columns:1fr 360px;
  gap:20px;
  margin-top:20px;
}
@media (max-width:980px){
  .bin-locs-layout{
    grid-template-columns:1fr;
  }
}
.bin-map-viewport{
  overflow:hidden;
}
.bin-map-canvas{
  height:450px;
}
.bin-side-card{
  margin-bottom:16px;
}
.bin-side-h3{
  margin-top:0;
}
.bin-side-muted{
  color:#6b7280;
  font-size:14px;
}
.bin-loc-input{
  width:100%;
  padding:8px;
  margin-top:4px;
  box-sizing:border-box;
}
.bin-loc-label-block{
  display:block;
  margin-top:12px;
}
.bin-loc-label-block--t8{
  display:block;
  margin-top:8px;
}
.bin-sched-layout{
  display:grid;
  grid-template-columns:1fr 340px;
  gap:20px;
  margin-top:20px;
}
@media (max-width:980px){
  .bin-sched-layout{
    grid-template-columns:1fr;
  }
}
.sched-top-card-mb{ margin-bottom:8px; }
.sched-muted{
  color:#6b7280;
  font-style:italic;
}
.sched-bin{
  color:var(--site-purple, #5a3ec8);
  text-decoration:none;
}
.sched-bin:hover{
  text-decoration:underline;
}
.sched-fill{
  color:#6b7280;
  font-size:0.9em;
}
.sched-cards-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(200px, 1fr));
  gap:16px;
}
.sched-day-card{
  min-width:0;
}
.sched-day-list{
  margin:0;
  padding-left:20px;
  list-style:none;
}
.sched-day-list li{
  margin:6px 0;
}
.sched-day-list li::marker{
  content:none;
}
.sched-day-label{
  display:block;
  font-weight:600;
  font-size:0.9rem;
  margin-bottom:8px;
}
.sched-day-buttons{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.sched-day-row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.sched-order-input{
  width:80px;
  padding:6px;
  box-sizing:border-box;
}
.sched-label-order{
  display:block;
  margin-top:12px;
}
.sched-form-mt12{
  margin-top:12px;
}
.sched-h3{ margin-top:0; }
.sched-h4-day{
  margin:0 0 10px;
}
.u-hidden-force{
  display:none !important;
}

.bin-fill-demo-card{
  margin:16px 0;
  padding:16px;
  box-shadow:0 6px 20px rgba(0,0,0,0.15);
  border-radius:12px;
  border:1px solid #e5e7eb;
}
.bin-fill-demo-h3{
  margin:0 0 12px;
}
.bin-fill-demo-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  margin-bottom:12px;
}
.bin-fill-demo-row2{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:12px;
  padding-top:12px;
  border-top:1px solid #e5e7eb;
}
.bin-fill-range{
  vertical-align:middle;
  margin:0 8px;
}
.bin-fill-status{
  display:inline-block;
  margin-top:8px;
}
.bin-fill-threshold-label{
  font-size:14px;
}
.bin-fill-range{
  vertical-align:middle;
  margin:0 8px;
}
.bin-fill-table-card{
  margin:16px 0;
  padding:16px;
  box-shadow:0 6px 20px rgba(0,0,0,0.15);
  border-radius:12px;
  border:1px solid #e5e7eb;
  overflow-x:auto;
}
.bin-fill-table-h3{
  margin:0 0 16px;
}

.route-costs-card{
  max-width:520px;
  margin-top:20px;
}
.route-costs-h3{
  margin-top:0;
}
.route-costs-muted-t4{
  font-size:12px;
  margin-top:4px;
  margin-left:0;
}
.route-costs-h3-spaced{
  margin-top:20px;
  margin-bottom:8px;
}
.route-costs-p-mb{
  font-size:13px;
  margin-bottom:12px;
}
.route-costs-breaks{
  margin-top:12px;
}
.route-costs-result{
  margin-top:12px;
  font-weight:600;
  color:var(--site-purple, #5514B4);
}
.route-costs-submit{
  margin-top:16px;
}
.route-costs-status{
  margin-left:12px;
}

.plan-card-mt12{ margin-top:12px; }
.plan-h3{ margin-top:0; }
.plan-lead{
  margin:0 0 8px;
}
.plan-p-mt10{ margin-top:10px; }
.plan-canvas-mt10{
  margin-top:10px;
}

.agri-settings-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
}
@media (max-width:700px){
  .agri-settings-grid{
    grid-template-columns:1fr;
  }
}
.agri-settings-span{
  grid-column:1/-1;
}
.agri-settings-status{
  color:#374151;
}

.opt-summary-ok{
  color:#16a34a;
}
.opt-summary-bad{
  color:#dc2626;
}
.opt-summary-list{
  margin:4px 0 8px;
  padding-left:20px;
}
.opt-summary-p-mt0{
  color:#16a34a;
  margin-top:0;
}

.text-danger-tip{
  color:#dc2626;
}

.agri-map-pin{
  width:18px;
  height:18px;
  border:2px solid #fff;
  border-radius:50%;
  box-shadow:0 2px 6px rgba(0,0,0,0.35);
  cursor:grab;
  pointer-events:auto;
}
.agri-map-pin--water{ background:#0ea5e9; }
.agri-map-pin--indigo{ background:#6366f1; }
.agri-map-pin--amber{ background:#f59e0b; }
.agri-map-pin--purple{ background:#5514B4; }
.agri-map-pin--blue{ background:#2563eb; }
.agri-map-pin--sm{
  width:16px;
  height:16px;
  border-radius:999px;
  border:2px solid #fff;
  box-shadow:0 2px 6px rgba(0,0,0,0.35);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:11px;
  font-weight:bold;
  color:#fff;
  cursor:pointer;
}
.agri-map-pin--ring-purple{
  box-shadow:0 0 0 1px #3b0d7a;
}
.agri-map-pin--xs{
  width:14px;
  height:14px;
  border-radius:999px;
  border:2px solid #fff;
  box-shadow:0 0 0 1px #1d4ed8;
}
.agri-reservoir-badge{
  background:#0ea5e9;
  color:#fff;
  border-radius:8px;
  padding:2px 6px;
  font-size:12px;
  border:1px solid #0369a1;
}
.agri-cow-wrap{
  width:28px;
  height:28px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.agri-cow-img{
  width:26px;
  height:26px;
}

.object-max-w-full{
  max-width:100%;
}
.input-w-full{
  width:100%;
  box-sizing:border-box;
}

/* Agriculture sensor map (templates/admin/agriculture_sensor_map.html) */
.card.agri-map-card{
  padding:12px;
}
#sensorMap{
  height:640px;
  border-radius:10px;
}
.agri-map-card .muted{
  color:var(--site-muted);
  font-size:12px;
}
.agri-map-card .row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:8px;
}
.agri-map-toolbar{
  margin-top:10px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}
.agri-map-toolbar .btn{
  margin:0;
}
.agri-map-toolbar select{
  padding:6px 10px;
  border-radius:var(--site-btn-pill);
  border:var(--site-btn-border);
  font-family:inherit;
}
.agri-toolbar-label{
  font-size:11px;
  font-weight:700;
  color:var(--site-muted);
  text-transform:uppercase;
  letter-spacing:0.05em;
}
.agri-toolbar-sep{
  width:1px;
  height:20px;
  background:var(--site-border);
  margin:0 4px;
}
.agri-vertex-icon{
  background:transparent !important;
  border:none !important;
}
.agri-vertex-icon > div{
  pointer-events:auto !important;
}

/* Agriculture weather patterns */
.weather-profile-row{
  padding:10px;
  border:1px solid var(--site-border);
  border-radius:10px;
  margin-bottom:8px;
}
.weather-layout-preview-pre{
  white-space:pre-wrap;
  font-size:12px;
  background:#f9fafb;
  padding:10px;
  border-radius:8px;
  border:1px solid #e5e7eb;
}
.card-mt-12{
  margin-top:12px;
}

.card-h3-flush{ margin-top:0; }
.muted-12-t4{
  font-size:12px;
  margin-top:4px;
  color:var(--site-muted, #4b5563);
}

.bin-mon-sh-editor-lead{ margin-top:4px; }
.bin-detail-panel[hidden],
.bin-detail-hidden{
  display:none;
}
.bin-detail-panel:not([hidden]){
  display:block;
}

.form-inline-mr6{
  display:inline-block;
  margin-right:6px;
}

/* Agriculture planning page (templates/agriculture/planning.html) */
.plan-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
.plan-card{
  background:#fff;
  border:1px solid #d9dce3;
  border-radius:12px;
  padding:12px;
}
.plan-kpi{
  font-size:22px;
  font-weight:700;
  margin:6px 0;
}
.plan-card .muted{
  color:#4b5563;
  font-size:12px;
}
.plan-card .tag{
  display:inline-block;
  font-size:12px;
  border-radius:999px;
  padding:3px 8px;
}
.plan-card .tag.high{
  background:#fee2e2;
  color:#991b1b;
}
.plan-card .tag.medium{
  background:#fef3c7;
  color:#92400e;
}
.plan-card .tag.low{
  background:#dcfce7;
  color:#166534;
}
.plan-card table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}
.plan-card th,
.plan-card td{
  border-bottom:1px solid #e5e7eb;
  padding:8px;
  text-align:left;
}
.plan-card .btn-xs{
  font-size:12px;
  padding:4px 8px;
  border:1px solid #d1d5db;
  border-radius:8px;
  background:#fff;
  cursor:pointer;
}
.plan-card .btn-xs[disabled]{
  opacity:0.6;
  cursor:not-allowed;
}
.whatif-grid{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:10px;
  margin-top:10px;
}
.planning-line-canvas{
  width:100%;
  height:180px;
  border:1px solid #e5e7eb;
  border-radius:8px;
  background:#fff;
}
@media (max-width:980px){
  .plan-grid{
    grid-template-columns:1fr;
  }
  .whatif-grid{
    grid-template-columns:1fr 1fr;
  }
}

/* Bin placement admin (templates/admin/bin_monitoring_bins.html) */
.bin-bins-wrap{
  max-width:1200px;
}
.bin-bins-layout{
  display:grid;
  grid-template-columns:1fr 320px;
  gap:16px;
  margin-top:16px;
}
@media (max-width:900px){
  .bin-bins-layout{
    grid-template-columns:1fr;
  }
}
.bin-bins-map-wrapper{
  position:relative;
  min-height:500px;
  border-radius:12px;
  overflow:hidden;
  background:#e5e7eb;
}
.bin-bins-map{
  position:absolute !important;
  top:0;
  left:0;
  right:0;
  bottom:0;
  width:100% !important;
  height:100% !important;
  z-index:1;
}
.leaflet-marker-icon.bin-admin-marker{
  pointer-events:auto !important;
}
.bin-form-label{
  display:block;
  font-weight:600;
  font-size:0.9rem;
  margin-top:12px;
  margin-bottom:4px;
}
.bin-form-label:first-of-type{
  margin-top:0;
}
.bin-edit-panel .input-admin,
.bin-type-edit-panel .input-admin{
  width:100%;
  box-sizing:border-box;
  margin-bottom:4px;
  border:2px solid #c3ccd9;
  border-radius:10px;
  padding:8px 10px;
  background:#fff;
  color:#111827;
}
.bin-edit-panel .input-admin:focus,
.bin-type-edit-panel .input-admin:focus{
  outline:none;
  border-color:var(--site-purple, #5514B4);
  box-shadow:0 0 0 3px rgba(85,20,180,0.12);
}
.bin-coords-row{
  display:flex;
  gap:12px;
  margin-top:12px;
}
.bin-coord-group{
  flex:1;
  min-width:0;
}
.bin-coord-group .bin-form-label{
  margin-top:0;
}
.bin-drag-hint{
  font-size:0.85rem;
  margin:8px 0 8px;
}
.bin-move-btn{
  margin-top:4px;
}
.bin-move-btn.bin-move-btn-active{
  border-color:var(--site-purple, #5514B4);
  background:var(--site-purple, #5514B4);
  color:#fff;
}
.bin-check-label{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:12px;
  font-weight:500;
}
.bin-check-label input[type="checkbox"]{
  width:auto;
}
.bin-bins-toolbar{
  display:flex;
  gap:8px;
  align-items:center;
}
.bin-form-actions-row{
  margin-top:12px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.bin-placement-muted{
  color:#6b7280;
  font-style:italic;
}

/* Bin types admin */
.bin-type-list-mt20{
  margin-top:20px;
}
.bin-type-edit-panel{
  margin-top:20px;
  max-width:600px;
}
.bin-type-preview-box{
  margin:12px 0;
  min-height:80px;
  border:1px solid #e5e7eb;
  border-radius:8px;
  padding:8px;
  background:#f9fafb;
}
.bin-type-card{
  display:flex;
  align-items:center;
  gap:16px;
  padding:16px;
  border:1px solid #e5e7eb;
  border-radius:12px;
  margin-bottom:12px;
  background:#fff;
}
.bin-type-preview-thumb{
  width:60px;
  height:60px;
  border:1px solid #e5e7eb;
  border-radius:8px;
  overflow:hidden;
  flex-shrink:0;
}
.bin-type-card-body{
  flex:1;
  min-width:0;
}
.bin-type-sensor-meta{
  color:#6b7280;
}
.bin-type-actions{
  margin-top:12px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

/* ========== Hoisted from templates (single source: change layout here only) ========== */

/* Energy dashboard layout (templates/dashboard.html) */
#edash-layout{
  width:100% !important;
  max-width:var(--site-content-max, 1100px) !important;
  margin-left:auto !important;
  margin-right:auto !important;
  box-sizing:border-box !important;
  display:block !important;
}
#edash-cards-row{
  display:-webkit-box !important;
  display:-ms-flexbox !important;
  display:flex !important;
  -webkit-box-orient:horizontal !important;
  -webkit-box-direction:normal !important;
  -ms-flex-direction:row !important;
  flex-direction:row !important;
  width:100% !important;
  box-sizing:border-box !important;
  gap:14px !important;
  margin:6px 0 16px 0 !important;
  -webkit-box-align:stretch !important;
  -ms-flex-align:stretch !important;
  align-items:stretch !important;
}
#edash-cards-row > .edash-card-cell{
  -webkit-box-flex:1 !important;
  -ms-flex:1 1 0% !important;
  flex:1 1 0% !important;
  min-width:0 !important;
  width:0 !important;
  box-sizing:border-box !important;
  display:flex !important;
}
#edash-cards-row .card{
  width:100% !important;
  max-width:none !important;
  margin:0 !important;
  box-sizing:border-box !important;
  flex:1 !important;
  min-height:100% !important;
}
#edash-chart-wrap{
  width:100% !important;
  box-sizing:border-box !important;
}
#edash-chart-wrap .chart-box{
  max-width:none !important;
  width:100% !important;
  margin:0 !important;
}
@media (max-width:980px){
  #edash-cards-row{
    -ms-flex-wrap:wrap !important;
    flex-wrap:wrap !important;
  }
  #edash-cards-row > .edash-card-cell{
    -ms-flex:1 1 calc(50% - 8px) !important;
    flex:1 1 calc(50% - 8px) !important;
    width:auto !important;
    min-width:min(100%, 240px) !important;
  }
  #edash-cards-row > .edash-card-cell.edash-span-full{
    -ms-flex:1 1 100% !important;
    flex:1 1 100% !important;
  }
}
@media (max-width:560px){
  #edash-cards-row > .edash-card-cell{
    -ms-flex:1 1 100% !important;
    flex:1 1 100% !important;
    width:100% !important;
  }
}

/* Bin monitoring customer map (templates/bin_monitoring/index.html) */
.bin-monitoring-wrap{
  max-width:100%;
  margin:0;
  padding:0 12px;
}
.bin-monitoring-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  flex-wrap:wrap;
  gap:12px;
  margin-bottom:12px;
}
.bin-monitoring-layout{
  display:grid;
  grid-template-columns:1fr 300px;
  gap:16px;
  align-items:stretch;
  min-height:0;
}
@media (max-width:900px){
  .bin-monitoring-layout{
    grid-template-columns:1fr;
  }
}
.bin-map-wrapper{
  position:relative;
  min-height:520px;
  border-radius:12px;
  overflow:hidden;
  background:#e5e7eb;
  box-shadow:0 6px 20px rgba(0,0,0,0.15);
}
.bin-monitoring-map{
  position:absolute !important;
  top:0;
  left:0;
  right:0;
  bottom:0;
  width:100% !important;
  height:100% !important;
  z-index:1;
}
.bin-detail-card{
  background:#fff;
  border-radius:12px;
  padding:16px;
  border:1px solid #e5e7eb;
  box-shadow:0 6px 20px rgba(0,0,0,0.15);
  min-height:200px;
}
.bin-detail-name{
  font-weight:700;
  font-size:1.15rem;
  margin-bottom:12px;
  line-height:1.3;
}
.bin-detail-graphic{
  margin:12px 0;
  text-align:center;
}
.bin-detail-graphic-inner{
  position:relative;
  display:inline-block;
}
.bin-detail-alert-overlay{
  position:absolute;
  top:-8px;
  right:-8px;
  z-index:10;
  display:flex;
  gap:4px;
  flex-wrap:wrap;
  justify-content:flex-end;
  max-width:60%;
}
.bin-detail-alert-overlay .bin-alert-badge{
  font-size:28px;
  line-height:1;
  padding:4px;
  border-radius:10px;
  box-shadow:0 2px 8px rgba(0,0,0,0.35);
  background:#fff;
}
.bin-detail-alert-overlay .bin-alert-badge.fire{
  background:#dc2626;
  color:#fff;
}
.bin-detail-alert-overlay .bin-alert-badge.vandalised{
  background:#b45309;
  color:#fff;
}
.bin-detail-stat{
  margin:10px 0;
  font-size:0.95rem;
}
.bin-detail-stat .k{
  color:#6b7280;
  margin-right:6px;
}
.bin-detail-stat .v{
  font-weight:600;
}
.bin-detail-icons{
  margin-left:6px;
  vertical-align:middle;
}
.bin-detail-icons .bin-status-icon{
  display:inline-block;
  margin-left:4px;
  font-size:1.1em;
}
.bin-marker-icon{
  cursor:pointer !important;
  pointer-events:auto !important;
}
.leaflet-marker-icon.bin-marker{
  pointer-events:auto !important;
}
.bin-monitoring-wrap .muted{
  color:#6b7280;
  font-style:italic;
}

/* Smart Home floor markers (templates/smart_home/floor.html) */
.sh-marker--v3{
  width:var(--sh-marker-size, 30px) !important;
  height:var(--sh-marker-size, 30px) !important;
  border:0 !important;
  background:transparent !important;
  padding:0 !important;
}
.sh-marker--v3 .sh-marker-ring{
  display:none !important;
}
.sh-marker--v3 .sh-marker-icon,
.sh-marker--v3 .sh-marker-glyph{
  display:none;
  position:absolute !important;
  inset:12% !important;
  width:76% !important;
  height:76% !important;
  border-radius:999px !important;
  overflow:hidden !important;
  box-sizing:border-box !important;
}
.sh-marker--v3 .sh-marker-icon{
  display:block;
  object-fit:cover !important;
  object-position:center !important;
}
.sh-legend-swatch.sh-leg-outline-on{
  border-color:#16a34a !important;
}
.sh-legend-swatch.sh-leg-outline-off{
  border-color:#9ca3af !important;
}

/* Field moisture map (templates/agriculture/field_moisture.html) */
.agri-fm-card{
  padding:12px;
}
#fieldMoistureMap{
  height:560px;
  border-radius:10px;
}
.agri-fm-legend{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin-top:10px;
  padding:10px;
  background:var(--site-card-bg);
  border-radius:var(--site-radius-sm);
  border:1px solid var(--site-border);
}
.agri-fm-legend-bar{
  width:200px;
  height:16px;
  border-radius:4px;
  background:linear-gradient(to right, #b91c1c, #ea580c, #ca8a04, #16a34a, #0d9488);
}
.agri-fm-legend-labels{
  font-size:12px;
  color:var(--site-muted);
}
.agri-fm-note{
  font-size:12px;
  color:var(--site-muted);
  margin-top:8px;
}

/* Route costs form (templates/admin/bin_monitoring_route_costs.html) */
.cost-label{
  display:block;
  margin-top:12px;
  font-weight:500;
}
.cost-label input{
  margin-left:8px;
  width:120px;
  padding:6px 10px;
  border-radius:8px;
  border:2px solid #e5e7eb;
}
.cost-select{
  margin-left:8px;
  padding:6px 10px;
  border-radius:8px;
  border:2px solid #e5e7eb;
  min-width:90px;
}
.cost-row{
  display:flex;
  align-items:center;
  gap:16px;
  margin-top:8px;
}
.cost-row .cost-label{
  margin-top:0;
}
.route-costs-card .muted{
  color:#6b7280;
}

/* Agriculture settings — scoped (was global .card/.btn in template) */
.agriculture-settings-page .agri-settings-grid label{
  display:flex;
  flex-direction:column;
  gap:4px;
  font-size:13px;
}
.agriculture-settings-page .agri-settings-grid input{
  padding:8px;
  border:1px solid #d1d5db;
  border-radius:8px;
}
.agriculture-settings-page > p .btn{
  margin-right:8px;
  margin-top:6px;
}
