/* ============================================================
   SeedSage Facility Builder — styles.css
   Pan/zoom SVG property + equipment + inspection + connectivity.
   Palette: seed-green #2E7D32 / #6FBF44 · harvest-gold #C9952A / #F0C24B
            soil #14281D · field off-white #F7FBF2
   Mobile-first, iPhone Safari + desktop. No build step.
   ============================================================ */

:root {
  --seed-green: #2E7D32;
  --leaf-green: #6FBF44;
  --green-deep: #1F5D24;
  --gold:       #C9952A;
  --gold-light: #F0C24B;
  --soil:       #14281D;
  --field:      #F7FBF2;
  --field-2:    #ECF4E4;

  --ink:        #14281D;
  --ink-soft:   #4C5E50;
  --ink-faint:  #7F9184;
  --line:       #DDE7D2;
  --card-bg:    #FFFFFF;

  /* connection system colors */
  --sys-electrical:    #C9952A;
  --sys-plumbing:      #2F7BD6;
  --sys-air:           #19B6C9;
  --sys-material-flow: #3FA34D;

  --danger:     #D24B3E;
  --danger-bg:  #FDECEA;

  --shadow-sm: 0 1px 3px rgba(20,40,29,.08), 0 1px 2px rgba(20,40,29,.06);
  --shadow-md: 0 4px 16px rgba(20,40,29,.12);
  --shadow-lg: 0 12px 34px rgba(20,40,29,.20);

  --radius:    16px;
  --radius-sm: 12px;
  --radius-lg: 22px;

  --header-h: 56px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  overflow: hidden;                 /* the canvas owns the viewport */
  overscroll-behavior: none;
}
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--field);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: fixed; inset: 0;        /* lock body so only canvas pans on iOS */
}

button { font-family: inherit; cursor: pointer; color: inherit; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ============ APP SHELL ============ */
.app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  padding-top: var(--sat);
  padding-left: var(--sal);
  padding-right: var(--sar);
}

/* ============ HEADER ============ */
.app-header {
  flex: 0 0 auto;
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  z-index: 40;
}
.hdr-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px 7px 8px; border-radius: 999px;
  background: var(--field-2); border: 1.5px solid var(--line);
  color: var(--green-deep); font-weight: 700; font-size: 13.5px;
  text-decoration: none;
}
.hdr-back:active { background: var(--field); }
.hdr-back svg { width: 16px; height: 16px; }
.hdr-mark { width: 30px; height: 30px; flex: 0 0 auto; }
.hdr-titles { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.hdr-title { font-size: 15px; font-weight: 800; color: var(--soil); letter-spacing: -.2px; }
.hdr-sub {
  font-size: 11px; color: var(--ink-faint); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw;
}
.hdr-spacer { flex: 1 1 auto; }

/* save indicator */
.save-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; color: var(--ink-faint);
  padding: 6px 11px; border-radius: 999px; background: var(--field-2);
  border: 1.5px solid var(--line); white-space: nowrap;
  transition: color .2s, background .2s, border-color .2s;
}
.save-pill .save-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint);
  flex: 0 0 auto; transition: background .2s;
}
.save-pill.is-saved   { color: var(--green-deep); border-color: rgba(63,163,77,.4); background: rgba(63,163,77,.1); }
.save-pill.is-saved   .save-dot { background: var(--leaf-green); }
.save-pill.is-saving  { color: var(--gold); border-color: rgba(201,149,42,.4); background: rgba(240,194,75,.14); }
.save-pill.is-saving  .save-dot { background: var(--gold); animation: pulseDot 1s ease-in-out infinite; }
.save-pill.is-dirty   { color: var(--gold); }
.save-pill.is-dirty   .save-dot { background: var(--gold); }
.save-pill.is-error   { color: var(--danger); border-color: rgba(210,75,62,.4); background: var(--danger-bg); }
.save-pill.is-error   .save-dot { background: var(--danger); }
.save-pill.is-offline { color: var(--ink-soft); }
@keyframes pulseDot { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* verify counter (header) — "X of Y structures verified" */
.verify-count {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--gold);
  padding: 6px 10px; border-radius: 999px;
  background: rgba(201,149,42,.12); border: 1.5px solid rgba(201,149,42,.32);
  white-space: nowrap; margin-right: 8px;
  transition: color .2s, background .2s, border-color .2s;
}
.verify-count[hidden] { display: none; }
.verify-count .vct-ico { font-size: 12px; line-height: 1; }
.verify-count.is-complete {
  color: var(--green-deep); background: rgba(63,163,77,.12); border-color: rgba(63,163,77,.4);
}
@media (max-width: 540px) { .verify-count .vct-ico { display: none; } .verify-count { padding: 6px 9px; } }

/* ============ STAGE (the canvas region) ============ */
.stage-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--field-2);
  touch-action: none;               /* we own all gestures */
}
#stage {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  user-select: none; -webkit-user-select: none;
  cursor: grab;
}
#stage.is-panning { cursor: grabbing; }
#stage.mode-connect, #stage.mode-add-building, #stage.mode-bridge { cursor: crosshair; }

/* svg primitives styled via classes on elements */
.grid-line { stroke: rgba(20,40,29,.06); stroke-width: 1; }
.grid-line.major { stroke: rgba(20,40,29,.10); }

/* building footprint (rect, round silo, bin cluster, tall headhouse, strip) */
.bld-rect, .bld-shape {
  fill: rgba(255,255,255,.82);
  stroke: var(--green-deep);
  stroke-width: 2;
}
.bld-rect.is-selected, .bld-shape.is-selected { stroke: var(--gold); stroke-width: 3; }
.bld-label {
  font: 700 13px var(--font);
  fill: var(--soil);
  paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 3px;
}
.bld-type-tag { font: 600 10px var(--font); fill: var(--ink-faint); text-transform: uppercase; letter-spacing: .5px; }
.bld-handle { fill: var(--gold); stroke: #fff; stroke-width: 1.5; }
.bld-rot-handle { fill: var(--seed-green); stroke: #fff; stroke-width: 1.5; }
.bld-rot-line { stroke: var(--seed-green); stroke-width: 1.5; stroke-dasharray: 3 3; }
.bld-enter-hint { font: 700 10px var(--font); fill: var(--seed-green); }

/* headhouse reads as a tall, emphasized block */
.bld-tall { stroke-width: 3; stroke: var(--green-deep); fill: rgba(46,125,50,.18); }
.bld-tall.is-selected { stroke: var(--gold); }

/* silo: a single round footprint + a roof ring */
.bld-silo-roof { fill: none; stroke: var(--green-deep); stroke-width: 1.4; opacity: .55; }
/* bin farm: cluster base is nearly invisible (the circles carry the look) */
.bld-cluster-base { fill: rgba(255,255,255,.10); stroke: rgba(31,93,36,.28); stroke-width: 1.5; stroke-dasharray: 4 4; }
.bld-cluster-base.is-selected { stroke: var(--gold); stroke-dasharray: none; }
/* the "big round things" — steel bins */
.bld-bin { fill: rgba(201,149,42,.30); stroke: var(--gold); stroke-width: 1.4; }

/* satellite-estimate badge on a building footprint */
.bld-est-badge { cursor: pointer; }
.bld-est-dot { fill: var(--gold); stroke: #fff; stroke-width: 1.5; }
.bld-est-q { font: 800 11px var(--font); fill: #fff; }

/* building type fills (subtle) — seed-plant vocabulary */
.bldtype-headhouse   { fill: rgba(46,125,50,.18); }
.bldtype-silo        { fill: rgba(201,149,42,.16); }
.bldtype-bin-farm    { fill: rgba(201,149,42,.12); }
.bldtype-dryer       { fill: rgba(210,75,62,.12); }
.bldtype-scale-house { fill: rgba(47,123,214,.12); }
.bldtype-warehouse   { fill: rgba(201,149,42,.12); }
.bldtype-bridgeway   { fill: rgba(25,182,201,.18); stroke: var(--sys-air); }
.bldtype-gallery     { fill: rgba(25,182,201,.18); stroke: var(--sys-air); }
/* legacy / generic types (kept) */
.bldtype-production { fill: rgba(63,163,77,.12); }
.bldtype-cleaning   { fill: rgba(25,182,201,.12); }
.bldtype-storage    { fill: rgba(201,149,42,.12); }
.bldtype-treating   { fill: rgba(47,123,214,.12); }
.bldtype-bagging    { fill: rgba(240,194,75,.16); }
.bldtype-office     { fill: rgba(127,145,132,.14); }
.bldtype-bins       { fill: rgba(201,149,42,.12); }

/* bridge-pick highlight while choosing the second building */
.bld-node.is-bridge-pick .bld-shape,
.bld-node.is-bridge-pick .bld-cluster-base { stroke: var(--sys-air); stroke-width: 3; }

/* building<->building bridgeway connector */
.bridge-group { cursor: pointer; }
.bridge-strip { stroke: var(--sys-air); stroke-width: 9; stroke-linecap: round; opacity: .35; }
.bridge-rail  { stroke: var(--sys-air); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 7 5; opacity: .95; }
.bridge-group.is-selected .bridge-strip { opacity: .55; stroke-width: 11; }
.bridge-group.is-selected .bridge-rail  { stroke: var(--gold); stroke-dasharray: none; }
.bridge-label {
  font: 700 10px var(--font); fill: var(--green-deep);
  paint-order: stroke; stroke: rgba(247,251,242,.92); stroke-width: 3px;
}

.equip-node { cursor: pointer; }
.equip-bg {
  fill: #fff; stroke: var(--line); stroke-width: 1.5;
}
.equip-node.is-selected .equip-bg { stroke: var(--gold); stroke-width: 2.5; }
.equip-node.is-connect-pick .equip-bg { stroke: var(--seed-green); stroke-width: 2.5; }
.equip-overdue-ring {
  fill: none; stroke: var(--danger); stroke-width: 2.5;
  opacity: .9;
  animation: overduePulse 1.8s ease-in-out infinite;
}
@keyframes overduePulse { 0%,100% { opacity: .85; } 50% { opacity: .35; } }
.equip-label {
  font: 600 10px var(--font); fill: var(--soil);
  paint-order: stroke; stroke: rgba(255,255,255,.9); stroke-width: 2.5px;
}
.equip-glyph { fill: var(--green-deep); stroke: var(--green-deep); }
.equip-glyph-fill { fill: var(--green-deep); }

/* status dot on equipment */
.equip-status { stroke: #fff; stroke-width: 1; }
.equip-status.s-ok        { fill: var(--leaf-green); }
.equip-status.s-watch     { fill: var(--gold); }
.equip-status.s-down      { fill: var(--danger); }
.equip-status.s-unknown   { fill: var(--ink-faint); }

.conn-line { stroke-width: 2.5; fill: none; stroke-linecap: round; opacity: .85; }
.conn-line.is-selected { stroke-width: 4.5; opacity: 1; }
.conn-electrical    { stroke: var(--sys-electrical); }
.conn-plumbing      { stroke: var(--sys-plumbing); }
.conn-air           { stroke: var(--sys-air); }
.conn-material-flow { stroke: var(--sys-material-flow); }
.conn-temp { stroke: var(--seed-green); stroke-width: 2.5; stroke-dasharray: 6 5; fill: none; opacity: .8; }

/* ============ EMPTY STATE ============ */
.empty-state {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; gap: 12px;
  pointer-events: none;
  z-index: 5;
}
.empty-state .es-card {
  pointer-events: auto;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(3px);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 26px 22px; max-width: 340px;
}
.es-mark { width: 56px; height: 56px; margin: 0 auto 12px; }
.es-title { font-size: 20px; font-weight: 800; color: var(--soil); margin: 0 0 8px; letter-spacing: -.3px; }
.es-text { font-size: 14px; color: var(--ink-soft); line-height: 1.5; margin: 0 0 18px; }
.es-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--leaf-green), var(--seed-green));
  color: #fff; border: none; font-weight: 800; font-size: 15px;
  padding: 13px 22px; border-radius: 999px; box-shadow: var(--shadow-sm);
}
.es-btn:active { transform: translateY(1px); }
.es-btn svg { width: 18px; height: 18px; }

/* ============ TOOLBAR (floating, bottom) ============ */
.toolbar {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  bottom: calc(12px + var(--sab));
  display: flex; align-items: center; gap: 4px;
  padding: 6px;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  z-index: 30;
  max-width: calc(100vw - 20px);
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.toolbar::-webkit-scrollbar { display: none; }
.tool-btn {
  flex: 0 0 auto;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  min-width: 52px; height: 50px; padding: 4px 8px;
  border: none; background: transparent; border-radius: 14px;
  color: var(--ink-soft); font-size: 10px; font-weight: 700;
  transition: background .15s, color .15s;
}
.tool-btn svg { width: 22px; height: 22px; }
.tool-btn:active { background: var(--field-2); }
.tool-btn.is-active { background: var(--soil); color: #fff; }
.tool-btn.is-active .tool-ico { color: var(--gold-light); }
.tool-btn:disabled { opacity: .35; pointer-events: none; }
.tool-sep { flex: 0 0 auto; width: 1px; height: 30px; background: var(--line); margin: 0 3px; }
.tool-btn.tool-danger.is-armable { color: var(--danger); }

/* zoom controls (right side, vertical) */
.zoom-ctl {
  position: absolute; right: calc(12px + var(--sar)); bottom: calc(74px + var(--sab));
  display: flex; flex-direction: column; gap: 6px; z-index: 28;
}
.zoom-btn {
  width: 42px; height: 42px; border-radius: 12px;
  background: rgba(255,255,255,.96); border: 1.5px solid var(--line);
  box-shadow: var(--shadow-sm); color: var(--soil);
  font-size: 22px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.zoom-btn:active { background: var(--field-2); }
.zoom-btn svg { width: 20px; height: 20px; }

/* context breadcrumb (which building you're "in") */
.context-bar {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: rgba(20,40,29,.92); color: #fff;
  padding: 7px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-md); z-index: 26; max-width: calc(100vw - 24px);
}
.context-bar .ctx-mode { color: var(--gold-light); }
.context-bar .ctx-exit {
  margin-left: 2px; background: rgba(255,255,255,.16); border: none; color: #fff;
  border-radius: 999px; width: 22px; height: 22px; font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.context-bar.is-hidden { display: none; }

/* hint banner (transient instruction at top) */
.hint-banner {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: var(--seed-green); color: #fff;
  padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-md); z-index: 27; text-align: center;
  max-width: calc(100vw - 24px);
  animation: hintIn .2s ease;
}
@keyframes hintIn { from { opacity: 0; transform: translateX(-50%) translateY(-6px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.hint-banner.is-hidden { display: none; }

/* ============ LEGEND (systems toggles) ============ */
.legend {
  position: absolute; left: calc(12px + var(--sal)); bottom: calc(74px + var(--sab));
  background: rgba(255,255,255,.96); backdrop-filter: blur(6px);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); padding: 8px; z-index: 28;
  max-width: 172px;
}
.legend-title {
  font-size: 10px; font-weight: 800; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: .6px; margin: 0 2px 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.legend-collapse { background: none; border: none; color: var(--ink-faint); font-size: 14px; line-height: 1; padding: 0 2px; }
.legend-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 4px; border-radius: 8px; width: 100%;
  background: none; border: none; text-align: left;
  font-size: 12px; font-weight: 700; color: var(--soil);
}
.legend-row:active { background: var(--field-2); }
.legend-row.is-off { opacity: .4; }
.legend-swatch { width: 18px; height: 4px; border-radius: 999px; flex: 0 0 auto; }
.legend-swatch-bridge {
  height: 6px; background: var(--sys-air);
  background-image: repeating-linear-gradient(90deg, var(--sys-air) 0 5px, transparent 5px 9px);
}
.legend-row.is-off .legend-swatch { background: var(--ink-faint) !important; }
.legend-count { margin-left: auto; font-size: 11px; color: var(--ink-faint); font-weight: 600; }
.legend.is-collapsed .legend-body { display: none; }

/* ============ SLIDE-OVER PANELS ============ */
.scrim {
  position: fixed; inset: 0; background: rgba(20,40,29,.42);
  z-index: 50; opacity: 0; pointer-events: none; transition: opacity .22s;
}
.scrim.is-open { opacity: 1; pointer-events: auto; }

.panel {
  position: fixed; z-index: 60;
  background: var(--card-bg);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  transition: transform .26s cubic-bezier(.4,0,.2,1);
}
/* phone: bottom sheet */
.panel {
  left: 0; right: 0; bottom: 0;
  max-height: 86vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transform: translateY(102%);
  padding-bottom: var(--sab);
}
.panel.is-open { transform: translateY(0); }

.panel-grip { width: 40px; height: 5px; border-radius: 999px; background: var(--line); margin: 9px auto 2px; flex: 0 0 auto; }
.panel-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 8px 16px 12px; border-bottom: 1px solid var(--line);
}
.panel-head .ph-ico {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--field-2); color: var(--green-deep);
}
.panel-head .ph-ico svg { width: 20px; height: 20px; }
.panel-titles { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.panel-title { font-size: 17px; font-weight: 800; color: var(--soil); letter-spacing: -.2px; }
.panel-sub { font-size: 12px; color: var(--ink-faint); font-weight: 600; }
.panel-close {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  background: var(--field-2); border: none; color: var(--ink-soft);
  font-size: 20px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.panel-close:active { background: var(--field); }
.panel-body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 16px 18px; }

/* form fields inside panels */
.field-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin: 12px 0 6px; }
.field-label:first-child { margin-top: 0; }
.field-optional { color: var(--ink-faint); font-weight: 600; }
.field-input, .field-select, .field-textarea {
  width: 100%; font-family: inherit; font-size: 16px; /* >=16px stops iOS zoom */
  color: var(--ink); background: var(--field);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field-input:focus, .field-select:focus, .field-textarea:focus {
  border-color: var(--leaf-green); box-shadow: 0 0 0 3px rgba(111,191,68,.18);
}
.field-textarea { resize: vertical; min-height: 64px; line-height: 1.4; }
.field-select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237F9184' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px;
}
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1 1 0; min-width: 0; }

/* verify-and-correct banner inside the building panel */
.verify-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px; border-radius: var(--radius-sm); margin: 12px 0 2px;
  border: 1.5px solid var(--line); background: var(--field-2);
}
.verify-card[hidden] { display: none; }
.verify-card .vc-ico {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800;
}
.verify-card .vc-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.verify-card .vc-text strong { font-size: 13.5px; font-weight: 800; }
.verify-card .vc-sub { font-size: 11.5px; color: var(--ink-soft); line-height: 1.4; }
.verify-card .vc-btn {
  flex: 0 0 auto; align-self: center;
  border: none; border-radius: 999px; padding: 9px 13px;
  font-size: 12.5px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--leaf-green), var(--seed-green));
}
.verify-card .vc-btn:active { transform: translateY(1px); }
.verify-card.is-estimate { border-color: rgba(201,149,42,.4); background: rgba(201,149,42,.1); }
.verify-card.is-estimate .vc-ico { background: rgba(201,149,42,.18); color: var(--gold); }
.verify-card.is-estimate strong { color: var(--gold); }
.verify-card.is-verified { border-color: rgba(63,163,77,.4); background: rgba(63,163,77,.1); }
.verify-card.is-verified .vc-ico { background: rgba(63,163,77,.18); color: var(--green-deep); }
.verify-card.is-verified strong { color: var(--green-deep); }

/* chip selectors (building type, system) */
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1.5px solid var(--line); background: var(--field);
  border-radius: 999px; padding: 8px 13px; font-size: 13px; font-weight: 700;
  color: var(--ink-soft); display: inline-flex; align-items: center; gap: 6px;
}
.chip:active { background: var(--field-2); }
.chip.is-active { background: var(--soil); color: #fff; border-color: var(--soil); }
.chip .chip-swatch { width: 12px; height: 12px; border-radius: 4px; }
.chip.is-active .chip-dot { color: var(--gold-light); }

/* buttons */
.btn-primary {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--leaf-green), var(--seed-green));
  color: #fff; border: none; font-weight: 800; font-size: 15.5px;
  padding: 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  margin-top: 18px;
}
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .5; pointer-events: none; }
.btn-secondary {
  width: 100%; background: var(--field-2); border: 1.5px solid var(--line);
  color: var(--green-deep); font-weight: 700; font-size: 14.5px;
  padding: 12px; border-radius: var(--radius-sm); margin-top: 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-secondary:active { background: var(--field); }
.btn-danger-ghost {
  width: 100%; background: var(--danger-bg); border: 1.5px solid rgba(210,75,62,.3);
  color: var(--danger); font-weight: 700; font-size: 14px;
  padding: 11px; border-radius: var(--radius-sm); margin-top: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-danger-ghost:active { background: #fbe0dc; }

/* equipment palette grid */
.palette-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.palette-group-title {
  font-size: 11px; font-weight: 800; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: .6px; margin: 16px 0 8px;
}
.palette-group-title:first-child { margin-top: 0; }
.palette-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 11px 6px 9px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--field); text-align: center;
}
.palette-item:active { background: var(--field-2); border-color: var(--leaf-green); transform: translateY(1px); }
.palette-item .pi-ico { width: 30px; height: 30px; color: var(--green-deep); display: flex; align-items: center; justify-content: center; }
.palette-item .pi-ico svg { width: 100%; height: 100%; }
/* emoji glyphs (catalog default icons) in palette / panels / pick lists */
.glyph-emoji { font-size: 24px; line-height: 1; display: inline-block; }
.pi-ico .glyph-emoji { font-size: 26px; }
.pick-ico .glyph-emoji { font-size: 22px; }
.ph-ico .glyph-emoji { font-size: 20px; }
.palette-item .pi-name { font-size: 11px; font-weight: 700; color: var(--soil); line-height: 1.2; }
.palette-item .pi-int { font-size: 9.5px; color: var(--ink-faint); font-weight: 600; }

/* detail rows / meta */
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.meta-pill {
  font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 999px;
  background: var(--field-2); color: var(--green-deep);
}
.meta-pill.is-overdue { background: var(--danger-bg); color: var(--danger); }
.meta-pill.is-due-soon { background: rgba(240,194,75,.2); color: var(--gold); }

.section-h {
  font-size: 13px; font-weight: 800; color: var(--soil);
  margin: 18px 0 8px; display: flex; align-items: center; justify-content: space-between;
}
.section-h .sh-add {
  font-size: 12px; font-weight: 800; color: var(--seed-green);
  background: rgba(63,163,77,.1); border: 1px solid rgba(63,163,77,.25);
  border-radius: 999px; padding: 4px 11px;
}
.section-h .sh-add:active { background: rgba(63,163,77,.18); }

/* inspection point cards */
.insp-list { display: flex; flex-direction: column; gap: 8px; }
.insp-card {
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 12px; background: var(--field);
}
.insp-card.is-overdue { border-color: rgba(210,75,62,.4); background: var(--danger-bg); }
.insp-card-top { display: flex; align-items: flex-start; gap: 8px; }
.insp-name { font-size: 14px; font-weight: 800; color: var(--soil); flex: 1 1 auto; }
.insp-what { font-size: 12.5px; color: var(--ink-soft); margin: 3px 0 0; line-height: 1.4; }
.insp-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.insp-last { font-size: 11.5px; color: var(--ink-faint); font-weight: 600; }
.insp-btn {
  font-size: 12px; font-weight: 800; padding: 6px 12px; border-radius: 999px;
  border: none; background: var(--seed-green); color: #fff;
}
.insp-btn:active { transform: translateY(1px); }
.insp-btn.is-secondary { background: var(--field-2); color: var(--ink-soft); }
.insp-del { margin-left: auto; background: none; border: none; color: var(--ink-faint); font-size: 12px; font-weight: 700; padding: 4px; }
.insp-del:active { color: var(--danger); }

/* connection list (inside equipment detail) */
.conn-list { display: flex; flex-direction: column; gap: 7px; }
.conn-item { display: flex; align-items: center; gap: 9px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.conn-item:last-child { border-bottom: none; }
.conn-dot { width: 14px; height: 4px; border-radius: 999px; flex: 0 0 auto; }
.conn-item-label { font-size: 13px; font-weight: 600; color: var(--soil); flex: 1 1 auto; min-width: 0; }
.conn-item-sys { font-size: 11px; color: var(--ink-faint); font-weight: 700; text-transform: capitalize; }
.conn-item-del { background: none; border: none; color: var(--ink-faint); font-size: 13px; padding: 4px; }
.conn-item-del:active { color: var(--danger); }

/* empty hint inside panels */
.panel-empty { text-align: center; color: var(--ink-faint); font-size: 13px; padding: 18px 6px; line-height: 1.5; }

/* picker list (connect: pick second item) */
.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--field); font-size: 14px; font-weight: 700; color: var(--soil);
}
.pick-item:active { background: var(--field-2); }
.pick-item .pick-ico { width: 24px; height: 24px; color: var(--green-deep); flex: 0 0 auto; }
.pick-item .pick-bld { font-size: 11px; color: var(--ink-faint); font-weight: 600; margin-left: auto; }

/* ============ OVERLAYS: loading / gate / error ============ */
.overlay {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 28px; gap: 14px;
  background: var(--field);
  background-image:
    radial-gradient(1100px 460px at 50% -8%, rgba(111,191,68,.14), transparent 60%),
    radial-gradient(900px 380px at 100% 110%, rgba(201,149,42,.10), transparent 60%);
}
.overlay[hidden] { display: none; }
.ov-mark { width: 84px; height: 84px; }
.ov-mark.spin { animation: bob 2.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.ov-title { font-size: 21px; font-weight: 800; color: var(--soil); margin: 4px 0 0; letter-spacing: -.3px; }
.ov-text { font-size: 14.5px; color: var(--ink-soft); line-height: 1.55; max-width: 330px; margin: 0; }
.ov-tagline { font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--gold); font-weight: 700; margin: 4px 0 0; }
.ov-link {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 6px;
  background: linear-gradient(135deg, var(--leaf-green), var(--seed-green));
  color: #fff; text-decoration: none; font-weight: 800; font-size: 15px;
  padding: 13px 24px; border-radius: 999px; box-shadow: var(--shadow-sm);
}
.ov-link:active { transform: translateY(1px); }
.ov-btn {
  margin-top: 4px; background: var(--field-2); border: 1.5px solid var(--line);
  color: var(--green-deep); font-weight: 700; font-size: 14px;
  padding: 11px 22px; border-radius: 999px;
}

/* offline banner */
.offline-banner {
  position: absolute; top: calc(10px); left: 50%; transform: translateX(-50%);
  background: var(--soil); color: #fff; font-size: 12.5px; font-weight: 700;
  padding: 7px 15px; border-radius: 999px; z-index: 35; box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 7px;
}
.offline-banner[hidden] { display: none; }
.offline-banner .ob-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold-light); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(86px + var(--sab));
  transform: translateX(-50%) translateY(14px);
  background: var(--soil); color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 11px 18px; border-radius: 999px; box-shadow: var(--shadow-lg);
  z-index: 95; opacity: 0; transition: opacity .22s, transform .22s;
  max-width: calc(100vw - 28px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-success { background: var(--green-deep); }
.toast.is-error { background: var(--danger); }
.toast[hidden] { display: none; }

/* ============ DESKTOP / WIDE ============ */
@media (min-width: 860px) {
  .hdr-sub { max-width: none; }
  /* panels become a right-docked rail */
  .panel {
    left: auto; right: 0; top: 0; bottom: 0;
    width: 380px; max-height: none;
    border-radius: 0; transform: translateX(102%);
    padding-bottom: 0;
    border-left: 1px solid var(--line);
  }
  .panel.is-open { transform: translateX(0); }
  .panel-grip { display: none; }
  .scrim { background: rgba(20,40,29,.18); }
  .palette-grid { grid-template-columns: repeat(3, 1fr); }
  .toolbar { bottom: 16px; }
  .zoom-ctl { bottom: 78px; }
  #stage { cursor: grab; }
}

/* ============ a11y: reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
