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

/* =========================
   Reset & base
   ========================= */
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%;
}
.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 used on dashboard + other pages */
.btn,
.btn-small {
  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;
}
.btn { padding: 8px 14px; min-height: 34px; }
.btn-small { padding: 5px 12px; min-height: 28px; font-size: 0.82rem; }
.btn:hover,
.btn-small:hover { background: rgba(85, 20, 180, 0.08); }
.btn.active,
.btn-small.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;
}

/* 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;
}
.opt-day-buttons{
  display:inline-flex;
  gap:4px;
  margin-left:8px;
}
.opt-day-btn{
  padding:6px 12px;
  border:2px solid #e5e7eb;
  border-radius:8px;
  background:#fff;
  cursor:pointer;
  font-weight:500;
}
.opt-day-btn:hover{
  border-color:var(--site-purple);
}
.opt-day-btn.opt-day-selected{
  border-color:var(--site-purple);
  background:var(--site-purple);
  color:#fff;
}
.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;
}

#createScheduleBtn,
#schedForm 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;
}
#createScheduleBtn:hover,
#schedForm button[type="submit"]:hover{
  background:rgba(85,20,180,0.08);
  filter:none;
}

.sched-day-btn{
  border:2px solid var(--site-purple) !important;
  border-radius:999px !important;
  background:#fff !important;
  color:var(--site-purple) !important;
  font-weight:700 !important;
  min-height:32px;
  padding:6px 12px;
}
.sched-day-btn:hover{
  background:rgba(85,20,180,0.08) !important;
}
.sched-day-btn.sched-day-selected{
  background:var(--site-purple) !important;
  color:#fff !important;
  border-color:var(--site-purple) !important;
}

/* 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;
}
.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; }

@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;
}
.btn-sm{
  min-height:32px;
  padding:6px 10px;
  font-size:0.82rem;
}
.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;
  }
}

/* =========================
   (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; }

.sh-floorplan{
  position: relative;
  border:1px solid #eee;
  border-radius:12px;
  overflow:hidden;
  background:#fafafa;
}

.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;
}

.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;
}

.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 #e5e7eb;
  background:#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;
}

/* 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;
  }
}
