/* ── FormaPlan Editor UI ── */
:root {
  --bg-page: #f0efea;
  --bg-primary: #ffffff;
  --bg-secondary: #f7f6f3;
  --bg-tertiary: #ecebe6;
  --bg-info: #e6f1fb;
  --bg-info-strong: #378add;

  --text-primary: #1f1f1d;
  --text-secondary: #6b6b66;
  --text-tertiary: #9b9b94;
  --text-info: #185fa5;
  --text-success: #0f6e56;
  --text-danger: #c2410c;

  --border-light: #e8e6e0;
  --border-medium: #d3d1c7;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

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

/* ── Top Bar ── */
.fp-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
  z-index: 200;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
}
.fp-topbar.show { display: flex; }

.fp-tb-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 13px;
  background: var(--bg-primary);
  font-family: var(--font);
  transition: background 0.15s;
}
.fp-tb-back:hover { background: var(--bg-secondary); }
.fp-tb-back svg { width: 12px; height: 12px; }

.fp-tb-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  background: none; border: none;
  font-family: var(--font);
  transition: background 0.15s;
}
.fp-tb-icon:hover { background: var(--bg-secondary); color: var(--text-primary); }
.fp-tb-icon.disabled { opacity: 0.35; pointer-events: none; }
.fp-tb-icon svg { width: 16px; height: 16px; }

.fp-tb-grow { flex: 1; }

.fp-tb-proj {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}
.fp-tb-proj-label { font-size: 11px; color: var(--text-tertiary); }
.fp-tb-proj-name { font-size: 14px; font-weight: 500; }

.fp-tb-2d3d {
  display: flex;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.fp-tb-2d3d .fp-mode {
  padding: 6px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none; border: none;
  font-family: var(--font);
  transition: background 0.15s;
}
.fp-tb-2d3d .fp-mode:hover:not(.on) { background: var(--bg-secondary); color: var(--text-primary); }
.fp-tb-2d3d .fp-mode.on { background: var(--text-info); color: white; }

.fp-tb-export {
  padding: 7px 18px;
  background: var(--text-info);
  color: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border: none;
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.fp-tb-export:hover { background: #0f4d8c; }
.fp-tb-export svg { width: 14px; height: 14px; }

.fp-tb-more-wrap { position: relative; }
.fp-tb-more-menu {
  position: absolute;
  top: 100%; right: 0;
  margin-top: 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  display: none;
  min-width: 200px;
  z-index: 250;
}
.fp-tb-more-menu.open { display: block; }
.fp-tb-more-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.fp-tb-more-item:hover { background: var(--bg-secondary); }
.fp-tb-more-item svg { width: 14px; height: 14px; color: var(--text-secondary); }

/* ── Body Layout ── */
.fp-body {
  display: none;
  position: fixed;
  top: 52px; left: 0; bottom: 40px;
  z-index: 150;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
}
.fp-body.show { display: flex; }

/* ── Left Rail ── */
.fp-rail {
  width: 64px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  gap: 2px;
}

.fp-rl {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  cursor: pointer;
  gap: 4px;
  color: var(--text-secondary);
  position: relative;
  border: none;
  background: transparent;
  font-family: var(--font);
  transition: background 0.15s, color 0.15s;
}
.fp-rl:hover:not(.on) { background: var(--bg-secondary); color: var(--text-primary); }
.fp-rl.on { background: var(--bg-info); color: var(--text-info); }
.fp-rl.on::before {
  content: '';
  position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--text-info);
  border-radius: 0 2px 2px 0;
}
.fp-rl svg { width: 20px; height: 20px; }
.fp-rl span { font-size: 10px; font-weight: 500; }

/* Moisture Map rail button — keep the brand blue accent even when the button is on */
.fp-rl-moisture svg,
.fp-rl-moisture.on svg { color: #2f7be5; }

/* ── Moisture Map panel ── */
.fp-mm-actions {
  padding: 0 16px 12px;
}
.fp-mm-place-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: #2f7be5;
  color: white;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.fp-mm-place-btn:hover { background: #1f63c2; }
.fp-mm-place-btn:active { transform: scale(0.98); }
.fp-mm-place-btn svg { width: 16px; height: 16px; }
.fp-mm-place-btn.is-active {
  background: #f29c1e;
}
.fp-mm-place-btn.is-active::before {
  content: 'Click on the plan to drop a point';
  display: block;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.95;
}
.fp-mm-place-btn.is-active span,
.fp-mm-place-btn.is-active svg { display: none; }

.fp-mm-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 16px;
  gap: 6px;
}
.fp-mm-empty-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
}
.fp-mm-empty-sub {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  max-width: 220px;
}
.fp-mm-list {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 16px;
}
.fp-mm-list.populated { display: flex; }
.fp-mm-empty.hidden { display: none; }

.fp-mm-row {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background: white;
  transition: background 0.12s, border-color 0.12s;
}
.fp-mm-row:hover { background: var(--bg-secondary); border-color: var(--text-tertiary); }
.fp-mm-row.active { border-color: #2f7be5; background: #e8f0fc; }

.fp-mm-row-dot {
  width: 14px; height: 14px; border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  background: #6c6c70; /* unscored fallback */
}
.fp-mm-row-dot.red { background: #e2483b; }
.fp-mm-row-dot.amber { background: #f29c1e; }
.fp-mm-row-dot.green { background: #34c759; }

.fp-mm-row-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.fp-mm-row-label { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.fp-mm-row-material { font-size: 11px; font-weight: 600; color: #2f7be5; margin-top: 1px; }
.fp-mm-row-sub { font-size: 10px; color: var(--text-secondary); margin-top: 2px; }

.fp-mm-row-value {
  font-size: 16px; font-weight: 800; flex-shrink: 0;
  color: var(--text-primary);
}
.fp-mm-row-value.red { color: #e2483b; }
.fp-mm-row-value.amber { color: #f29c1e; }
.fp-mm-row-value.green { color: #34c759; }
.fp-mm-row-value-unit {
  font-size: 10px; font-weight: 600;
  color: var(--text-secondary);
  margin-left: 2px;
}

.fp-mm-row-status {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}
.fp-mm-row-status.red { color: #e2483b; }
.fp-mm-row-status.amber { color: #f29c1e; }
.fp-mm-row-status.green { color: #34c759; }

/* ── Moisture Point properties panel ── */
.fp-panel-content[data-panel="moisture-point-properties"] {
  padding-bottom: 24px;
}

/* Status pills used in card + summary */
.fp-mp-status-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #f0f0f3;
  color: #6c6c70;
  white-space: nowrap;
}
.fp-mp-status-pill.wet { background: #fceaea; color: #e2483b; }
.fp-mp-status-pill.drying { background: #fdefd9; color: #f29c1e; }
.fp-mp-status-pill.dry { background: #e6f7ea; color: #34c759; }

/* Point header card */
.fp-mp-card {
  margin: 0 16px 12px;
  background: #f5f5f7;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.fp-mp-card-info { flex: 1; min-width: 0; }
.fp-mp-card-label {
  font-size: 18px;
  font-weight: 800;
  color: #1c1c1e;
  line-height: 1.1;
}
.fp-mp-card-material {
  font-size: 13px;
  font-weight: 700;
  color: #2f7be5;
  margin-top: 4px;
}
.fp-mp-card-material.empty {
  color: #a8a8ad;
  font-style: italic;
  font-weight: 500;
}

/* Section blocks */
.fp-mp-section {
  padding: 4px 16px 12px;
}
.fp-mp-section.hidden { display: none; }
.fp-mp-section-label {
  font-size: 10px;
  font-weight: 700;
  color: #6c6c70;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

/* Material chips */
.fp-mp-mat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.fp-mp-mat-chip {
  border: 1px solid var(--border-light);
  background: white;
  border-radius: 8px;
  padding: 8px 4px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  text-align: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.fp-mp-mat-chip:hover { background: var(--bg-secondary); border-color: var(--text-tertiary); }
.fp-mp-mat-chip.on {
  background: #1c1c1e;
  border-color: #1c1c1e;
  color: white;
}

/* Trend section */
.fp-mp-trend { padding: 0 16px 12px; }
.fp-mp-trend-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  color: #6c6c70;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.fp-mp-trend-window {
  font-weight: 700;
  color: #1c1c1e;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 10px;
}
.fp-mp-trend-arrow { color: #a8a8ad; }
.fp-mp-trend-today { color: #2f7be5; font-weight: 700; margin-left: 4px; }

/* Start → Now summary pill */
.fp-mp-trend-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f5f7;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 11px;
}
.fp-mp-summary-side {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.fp-mp-summary-side.now { align-items: flex-end; text-align: right; }
.fp-mp-summary-label {
  font-size: 9px;
  color: #6c6c70;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
}
.fp-mp-summary-value {
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  color: #1c1c1e;
}
.fp-mp-summary-value .unit {
  font-size: 11px;
  font-weight: 600;
  color: #6c6c70;
  margin-left: 1px;
}
.fp-mp-summary-sub { font-size: 10px; color: #6c6c70; }
.fp-mp-summary-arrow {
  color: #a8a8ad;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.fp-mp-summary-drop {
  background: #e6f7ea;
  color: #34c759;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.fp-mp-summary-drop.up {
  background: #fceaea;
  color: #e2483b;
}

/* Bar chart — extra top margin gives the value labels (positioned -18px above
   each bar) breathing room under the Started/Now summary pill. */
.fp-mp-bars {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 92px;
  margin-top: 28px;
}
.fp-mp-bar {
  flex: 1;
  background: #e5e5ea;
  border-radius: 4px;
  min-height: 8px;
  position: relative;
}
.fp-mp-bar.last { background: #1c1c1e; }
.fp-mp-bar.future {
  background: #f0f0f3;
  border: 1px dashed #e5e5ea;
  opacity: 0.8;
  height: 100%;
}
.fp-mp-bar-val {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: #6c6c70;
  white-space: nowrap;
}
.fp-mp-bar.last .fp-mp-bar-val { color: #1c1c1e; font-size: 13px; }

.fp-mp-bar-dates {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.fp-mp-bar-date {
  flex: 1;
  text-align: center;
  font-size: 10px;
  color: #6c6c70;
  font-weight: 600;
  line-height: 1.4;
}
.fp-mp-bar-date.active { color: #2f7be5; font-weight: 700; }
.fp-mp-bar-date-today {
  display: block;
  font-size: 8px;
  font-weight: 700;
  color: #2f7be5;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 1px;
}
.fp-mp-bar-date-photos {
  display: block;
  font-size: 9px;
  color: #a8a8ad;
  margin-top: 1px;
  font-weight: 500;
}

.fp-mp-full-history-btn {
  width: 100%;
  background: white;
  border: 1px dashed var(--border-light);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: #2f7be5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  transition: background 0.15s, border-color 0.15s;
}
.fp-mp-full-history-btn:hover {
  background: #e8f0fc;
  border-color: #2f7be5;
  border-style: solid;
}

.fp-mp-threshold-line {
  font-size: 11px;
  color: #6c6c70;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.fp-mp-threshold-status.met { color: #34c759; font-weight: 700; }
.fp-mp-threshold-status.over { color: #f29c1e; font-weight: 700; }
.fp-mp-threshold-divider { color: #a8a8ad; }

/* Setup note */
.fp-mp-setup-note {
  margin: 0 16px 12px;
  background: #e8f0fc;
  border-radius: 10px;
  padding: 12px 14px;
}
.fp-mp-setup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}
.fp-mp-setup-label {
  color: #2f7be5;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.fp-mp-setup-edit {
  background: transparent;
  border: none;
  color: #a8a8ad;
  cursor: pointer;
  padding: 2px;
  display: flex;
}
.fp-mp-setup-edit svg { width: 14px; height: 14px; }
.fp-mp-setup-edit:hover { color: #2f7be5; }
.fp-mp-setup-attribution {
  font-size: 11px;
  color: #6c6c70;
  font-weight: 600;
  margin-bottom: 4px;
}
.fp-mp-setup-body {
  font-size: 12px;
  color: #1c1c1e;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.fp-mp-setup-body.empty {
  color: #a8a8ad;
  font-style: italic;
}

/* Inline edit mode swapped in for the body when the pencil is clicked. */
.fp-mp-setup-edit-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fp-mp-setup-textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 12px;
  background: white;
  color: var(--text-primary);
  resize: vertical;
  min-height: 60px;
}
.fp-mp-setup-textarea:focus { outline: none; border-color: #2f7be5; }
.fp-mp-setup-edit-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.fp-mp-setup-cancel,
.fp-mp-setup-save {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border-light);
  background: white;
  color: var(--text-primary);
}
.fp-mp-setup-cancel:hover { background: var(--bg-secondary); }
.fp-mp-setup-save {
  background: #2f7be5;
  border-color: #2f7be5;
  color: white;
}
.fp-mp-setup-save:hover { background: #1f63c2; border-color: #1f63c2; }

/* Optional label suffix shared by panels */
.fp-mp-optional {
  font-weight: 500;
  color: var(--text-tertiary);
  font-size: 10px;
  margin-left: 4px;
}

/* ── Add / Edit Reading panel ── */
.fp-panel-content[data-panel="moisture-point-add-reading"] {
  padding-bottom: 24px;
}
.fp-mp-ar-head {
  display: flex !important;
  align-items: center;
  gap: 10px;
}
.fp-mp-ar-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.fp-mp-ar-close svg { width: 18px; height: 18px; }
.fp-mp-ar-close:hover { background: var(--bg-secondary); color: var(--text-primary); }

.fp-mp-ar-breadcrumb {
  padding: 0 16px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.fp-mp-ar-breadcrumb .label,
.fp-mp-ar-breadcrumb .material { color: #2f7be5; font-weight: 700; }
.fp-mp-ar-breadcrumb .chevron { color: #a8a8ad; margin: 0 2px; font-weight: 700; }
.fp-mp-ar-breadcrumb .day { color: var(--text-primary); font-weight: 700; }

.fp-mp-ar-prev {
  box-sizing: border-box;
  margin: 0 16px 14px;
  background: #e8f0fc;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.fp-mp-ar-prev-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.fp-mp-ar-prev-tag {
  color: #2f7be5;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.fp-mp-ar-prev-val { font-weight: 700; color: var(--text-primary); }
.fp-mp-ar-prev-trend {
  font-size: 11px;
  font-weight: 700;
  color: #34c759;
  white-space: nowrap;
}
.fp-mp-ar-prev-trend.up { color: #e2483b; }

.fp-mp-ar-section { padding: 0 16px 16px; }
.fp-mp-ar-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

/* Photo upload placeholder (Phase D will make this functional) */
.fp-mp-ar-photo-drop {
  box-sizing: border-box;
  width: 100%;
  border: 2px dashed #e5e5ea;
  border-radius: 12px;
  padding: 16px 14px;
  text-align: center;
  background: white;
  position: relative;
}
.fp-mp-ar-photo-icon {
  position: absolute;
  top: 10px; right: 10px;
  color: #a8a8ad;
}
.fp-mp-ar-photo-icon svg { width: 20px; height: 20px; }
.fp-mp-ar-photo-badge {
  display: inline-block;
  background: #e2483b;
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.fp-mp-ar-photo-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.fp-mp-ar-photo-sub {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.fp-mp-ar-photos-hint {
  border: 1px dashed var(--border-light);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  font-size: 11px;
  color: var(--text-tertiary);
  font-style: italic;
  background: var(--bg-secondary);
}

/* Every form input in the Add Reading panel shares the same width math —
   width:100% counts padding + border so 100% is always the section's content width. */
.fp-mp-ar-section .fp-mp-ar-value-input,
.fp-mp-ar-section .fp-select,
.fp-mp-ar-section .fp-mp-ar-temp,
.fp-mp-ar-section textarea {
  box-sizing: border-box;
  display: block;
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  background: white;
  color: var(--text-primary);
}

/* Big value input — hide native spinner so the centred value isn't visually
   offset by up/down arrows. Mobile gets the decimal pad via inputmode anyway. */
.fp-mp-ar-value-input {
  border-radius: 10px !important;
  padding: 14px 14px !important;
  font-size: 26px !important;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.fp-mp-ar-value-input::-webkit-outer-spin-button,
.fp-mp-ar-value-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.fp-mp-ar-value-input:focus,
.fp-mp-ar-section .fp-mp-ar-temp:focus,
.fp-mp-ar-section textarea:focus {
  outline: none;
  border-color: #2f7be5;
}

.fp-mp-ar-section textarea { resize: vertical; min-height: 60px; }

.fp-mp-ar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 16px 0;
}
.fp-mp-ar-save,
.fp-mp-ar-cancel {
  box-sizing: border-box;
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
}
.fp-mp-ar-save {
  background: #2f7be5;
  color: white;
  border: 1px solid #2f7be5;
  padding: 13px;
  transition: background 0.15s;
}
.fp-mp-ar-save:hover { background: #1f63c2; border-color: #1f63c2; }
.fp-mp-ar-save:disabled { background: #c8d8ed; border-color: #c8d8ed; cursor: not-allowed; }
.fp-mp-ar-cancel {
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  padding: 12px;
}
.fp-mp-ar-cancel:hover { background: var(--bg-secondary); }

/* ── Reading detail panel (opened by clicking a bar on the trend chart) ── */
.fp-panel-content[data-panel="moisture-point-reading-detail"] {
  padding-bottom: 24px;
}

.fp-mp-rd-header {
  margin: 0 16px 14px;
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.fp-mp-rd-header-info { min-width: 0; flex: 1; }
.fp-mp-rd-header-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.fp-mp-rd-header-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 600;
}

/* Compact photo widget: attach button + up to 3 thumbnails, last shows "+N" overflow.
   Used by both the Reading Detail and Add Reading panels via id="fp-mp-photos-row". */
.fp-mp-photos-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}
.fp-mp-photo-attach {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 1.5px dashed var(--border-light);
  background: var(--bg-secondary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  padding: 0;
}
.fp-mp-photo-attach:hover {
  border-color: #2f7be5;
  color: #2f7be5;
  background: #e8f0fc;
}
.fp-mp-photo-attach svg { width: 18px; height: 18px; }
.fp-mp-photo-thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-tertiary);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.12s;
}
.fp-mp-photo-thumb:hover { transform: scale(1.04); }
.fp-mp-photo-thumb-more {
  background-color: rgba(0, 0, 0, 0.65);
  background-blend-mode: darken;
  color: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fp-mp-rd-photos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.fp-mp-rd-photo-tile {
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: monospace;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.fp-mp-rd-photo-tile:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
.fp-mp-rd-photo-tile.meter {
  background: linear-gradient(135deg, #2c2c2e, #4a4a4e);
  color: #4ad29c;
}
.fp-mp-rd-photo-tile.wide { background: linear-gradient(135deg, #2c4a3e, #3a6a5e); }
.fp-mp-rd-photo-tile.damage { background: linear-gradient(135deg, #3a2c2e, #5a3a3e); }
.fp-mp-rd-photo-tile.context { background: linear-gradient(135deg, #2c3a4e, #3a4a6e); }
/* Once a tile has a real photo, swap the gradient for the image and hide the
   centred placeholder value. The tag stays visible (positioned absolutely). */
.fp-mp-rd-photo-tile.has-photo {
  background-size: cover;
  background-position: center;
}
.fp-mp-rd-photo-tile.has-photo .fp-mp-rd-photo-caption { display: none; }
.fp-mp-rd-photo-tag {
  position: absolute;
  top: 5px; left: 5px;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 8px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-family: inherit;
}
.fp-mp-rd-photo-value { font-size: 20px; font-weight: 800; }
.fp-mp-rd-photo-caption {
  font-size: 10px;
  font-family: inherit;
  font-weight: 500;
  color: white;
}

.fp-mp-rd-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.fp-mp-rd-meta-item {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 9px 11px;
}
.fp-mp-rd-meta-label {
  font-size: 9px;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.fp-mp-rd-meta-val {
  font-size: 13px;
  font-weight: 700;
  margin-top: 3px;
  color: var(--text-primary);
}
.fp-mp-rd-meta-val-small {
  font-size: 11px;
  word-break: break-word;
}

.fp-mp-rd-note {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.45;
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.fp-mp-rd-note.empty {
  color: var(--text-tertiary);
  font-style: italic;
  border: 1px dashed var(--border-light);
  background: transparent;
}

/* Make trend bars clickable to drill into a single reading */
.fp-mp-bar:not(.future) {
  cursor: pointer;
  transition: filter 0.12s;
}
.fp-mp-bar:not(.future):hover { filter: brightness(0.92); }

/* ── Moisture Map filter chips overlay ──
   Floats over the Unity canvas just below the topbar, to the right of the side panel.
   Visible only while the Moisture Map tab (or its sub-panels) is active. */
.fp-mp-filter-bar {
  position: fixed;
  top: 62px;
  left: 338px; /* 64 rail + 264 panel + 10 gap */
  display: none;
  gap: 8px;
  z-index: 160;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(6px);
  font-family: var(--font);
}
.fp-mp-filter-bar.show { display: flex; }

.fp-mp-filter-chip {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.fp-mp-filter-chip:hover { background: var(--bg-secondary); }
.fp-mp-filter-chip.on {
  background: #1c1c1e;
  color: white;
  border-color: #1c1c1e;
}
.fp-mp-filter-chip.on:hover { background: #1c1c1e; }
.fp-mp-filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.fp-mp-filter-dot.wet { background: #e2483b; }
.fp-mp-filter-dot.drying { background: #f29c1e; }
.fp-mp-filter-dot.dry { background: #34c759; }

.fp-mp-filter-spacer { flex: 1; min-width: 12px; }

.fp-mp-layers-btn {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s, color 0.12s;
}
.fp-mp-layers-btn svg { width: 14px; height: 14px; }
.fp-mp-layers-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }
.fp-mp-layers-btn.on {
  background: #1c1c1e;
  color: white;
  border-color: #1c1c1e;
}

/* Slide-out panel anchored to the right of the canvas area */
.fp-mp-layers-panel {
  position: fixed;
  top: 110px; /* below topbar + filter bar */
  right: 16px;
  width: 280px;
  max-height: calc(100vh - 200px);
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  z-index: 170;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font);
}
.fp-mp-layers-panel.open { display: flex; }
.fp-mp-layers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
}
.fp-mp-layers-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}
.fp-mp-layers-close {
  width: 24px; height: 24px;
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fp-mp-layers-close:hover { background: var(--bg-secondary); color: var(--text-primary); }
.fp-mp-layers-body {
  padding: 12px;
  overflow-y: auto;
}
.fp-mp-layers-group { margin-bottom: 16px; }
.fp-mp-layers-group:last-child { margin-bottom: 0; }
.fp-mp-layers-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.fp-mp-layer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.fp-mp-layer-row:hover:not(.locked) { background: var(--bg-secondary); }
.fp-mp-layer-row.locked { cursor: default; }
.fp-mp-layer-row.off .fp-mp-layer-label,
.fp-mp-layer-row.off .fp-mp-layer-count { color: var(--text-tertiary); }
.fp-mp-layer-info { flex: 1; min-width: 0; }
.fp-mp-layer-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.fp-mp-layer-count {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Switch-style toggle */
.fp-mp-layer-toggle {
  width: 34px; height: 18px;
  background: #c8c8cc;
  border-radius: 9px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s;
}
.fp-mp-layer-toggle::before {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s;
}
.fp-mp-layer-toggle.on { background: #2f7be5; }
.fp-mp-layer-toggle.on::before { transform: translateX(16px); }
.fp-mp-layer-toggle.locked {
  background: #c8e1c4;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fp-mp-layer-toggle.locked::before { display: none; }
.fp-mp-layer-toggle.locked svg {
  width: 10px; height: 10px;
  color: #34c759;
}

.fp-mp-layers-actions { margin-top: 16px; }
.fp-mp-layers-reset {
  width: 100%;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.fp-mp-layers-reset:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ── Fullscreen photo viewer ── */
.fp-mp-photo-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  z-index: 400;
  display: none;
  flex-direction: column;
  font-family: var(--font);
}
.fp-mp-photo-viewer.open { display: flex; }
.fp-mp-photo-viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  gap: 14px;
  flex-shrink: 0;
}
.fp-mp-photo-viewer-info {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fp-mp-photo-viewer-actions {
  display: flex;
  gap: 8px;
}
.fp-mp-photo-viewer-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.fp-mp-photo-viewer-btn svg { width: 18px; height: 18px; }
.fp-mp-photo-viewer-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.25);
}
.fp-mp-photo-viewer-btn-danger:hover {
  background: rgba(226, 72, 59, 0.2);
  border-color: #e2483b;
  color: #ff7768;
}
/* Stage holds the image centred. The stage itself is the click target for "close
   on background"; the img sits inside at its natural aspect ratio so clicks on the
   dark area around it close the viewer while clicks on the actual photo don't. */
.fp-mp-photo-viewer-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px 24px;
  cursor: zoom-out;
}
.fp-mp-photo-viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: default;
}

/* ── MP photo gallery modal ── */
.fp-modal.fp-mp-gallery-modal-panel {
  max-width: 1000px;
  width: 90vw;
  height: 85vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
}
.fp-mp-gallery-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}
.fp-mp-gallery-filters {
  width: 220px;
  border-right: 1px solid var(--border-light);
  padding: 18px;
  overflow-y: auto;
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.fp-mp-gallery-filter-group { margin-bottom: 18px; }
.fp-mp-gallery-filter-group:last-child { margin-bottom: 0; }
.fp-mp-gallery-filter-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.fp-mp-gallery-filter-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fp-mp-gallery-filter-opt {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.12s, color 0.12s;
}
.fp-mp-gallery-filter-opt:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.fp-mp-gallery-filter-opt.on {
  background: #1c1c1e;
  color: white;
}
.fp-mp-gallery-filter-opt .fp-mp-gallery-filter-count {
  font-size: 10px;
  opacity: 0.7;
}

.fp-mp-gallery-grid {
  flex: 1;
  /* Outer padding compensates for the per-item margins so the visible inset stays
     uniform at every edge. Margins are used instead of `gap` for browser-version
     reliability. */
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
}
.fp-mp-gallery-photo {
  box-sizing: border-box;
  /* 160px minimum, but otherwise share the row equally. */
  flex: 1 1 160px;
  min-width: 0;
  height: 180px;
  margin: 8px;
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  background-color: var(--bg-tertiary);
  background-size: cover;
  background-position: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fp-mp-gallery-photo:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}
.fp-mp-gallery-photo-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 8px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  color: white;
  font-weight: 600;
  font-size: 11px;
  text-align: left;
  pointer-events: none;
}
.fp-mp-gallery-photo-caption-sub {
  font-size: 9px;
  opacity: 0.85;
  display: block;
  margin-top: 1px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 700;
}
.fp-mp-gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* ── Full drying history modal ──
   Compound selector to override the base .fp-modal { max-width: 360px } rule
   which appears later in the file. */
.fp-modal.fp-mp-history-modal-panel {
  max-width: 1100px;
  width: 90vw;
  height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
}
.fp-mp-history-head {
  flex-shrink: 0;
}
.fp-mp-history-head h2 {
  font-size: 18px;
  font-weight: 800;
}
.fp-mp-history-head .fp-mp-history-subtitle {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-secondary);
  margin-left: 8px;
}
.fp-mp-history-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}
.fp-mp-history-stats {
  width: 260px;
  border-right: 1px solid var(--border-light);
  padding: 18px;
  overflow-y: auto;
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.fp-mp-history-stat-group { margin-bottom: 20px; }
.fp-mp-history-stat-group:last-child { margin-bottom: 0; }
.fp-mp-history-stat-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.fp-mp-history-stat-row {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
}
.fp-mp-history-stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 600;
}
.fp-mp-history-stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 2px;
  line-height: 1;
}
.fp-mp-history-stat-value .unit {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 3px;
}
.fp-mp-history-stat-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.fp-mp-history-stat-value.dry { color: #34c759; }
.fp-mp-history-stat-value.drying { color: #f29c1e; }
.fp-mp-history-stat-value.wet { color: #e2483b; }

.fp-mp-history-chart-area {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.fp-mp-history-chart-head { margin-bottom: 18px; }
.fp-mp-history-chart-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.fp-mp-history-chart-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.fp-mp-history-chart-wrap {
  position: relative;
}
.fp-mp-history-chart {
  display: flex;
  gap: 5px;
  align-items: flex-end;
  height: 280px;
  margin-bottom: 8px;
  padding-top: 28px;
}
.fp-mp-history-bar {
  flex: 1;
  background: var(--border-light);
  border-radius: 4px;
  min-height: 6px;
  position: relative;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
}
.fp-mp-history-bar:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
}
.fp-mp-history-bar.dry { background: #34c759; opacity: 0.7; }
.fp-mp-history-bar.dry:hover { opacity: 1; }
.fp-mp-history-bar.drying { background: #f29c1e; opacity: 0.7; }
.fp-mp-history-bar.drying:hover { opacity: 1; }
.fp-mp-history-bar.wet { background: #e2483b; opacity: 0.7; }
.fp-mp-history-bar.wet:hover { opacity: 1; }
.fp-mp-history-bar.last { opacity: 1; }
.fp-mp-history-bar-val {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}
.fp-mp-history-bar.last .fp-mp-history-bar-val {
  color: var(--text-primary);
  font-size: 13px;
}

.fp-mp-history-threshold-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1.5px dashed var(--text-secondary);
  pointer-events: none;
  z-index: 1;
}
/* Threshold label sits in the top-right corner of the chart wrap so it never
   overlaps bars regardless of where the threshold line lands. */
.fp-mp-history-threshold-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--bg-primary);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  border-radius: 4px;
  border: 1px solid var(--border-light);
  z-index: 2;
}

.fp-mp-history-day-row {
  display: flex;
  gap: 5px;
  margin-top: 6px;
}
.fp-mp-history-day {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 9px;
  color: var(--text-tertiary);
  font-weight: 600;
  cursor: pointer;
  padding: 4px 1px;
  border-radius: 4px;
  line-height: 1.2;
  transition: background 0.15s, color 0.15s;
  overflow: hidden;
  white-space: nowrap;
}
.fp-mp-history-day:hover { background: var(--bg-secondary); color: var(--text-primary); }
.fp-mp-history-day.active { color: #2f7be5; font-weight: 800; }
.fp-mp-history-day-num { display: block; font-weight: 700; }
.fp-mp-history-day-date {
  display: block;
  font-size: 8px;
  color: var(--text-tertiary);
  font-weight: 400;
  margin-top: 1px;
}
.fp-mp-history-day.active .fp-mp-history-day-date { color: #2f7be5; }
.fp-mp-history-day-today {
  display: block;
  font-size: 8px;
  color: #2f7be5;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 1px;
}

.fp-mp-history-legend {
  display: flex;
  gap: 14px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
  font-size: 11px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.fp-mp-history-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.fp-mp-history-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.fp-mp-history-legend-swatch.dry { background: #34c759; }
.fp-mp-history-legend-swatch.drying { background: #f29c1e; }
.fp-mp-history-legend-swatch.wet { background: #e2483b; }
.fp-mp-history-legend-swatch.threshold {
  background: transparent;
  border-top: 1.5px dashed var(--text-secondary);
  height: 0;
  margin-top: 6px;
}

/* Bottom action buttons */
.fp-mp-bottom-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 16px 0;
}
.fp-mp-add-btn {
  width: 100%;
  background: #2f7be5;
  color: white;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.fp-mp-add-btn:hover { background: #1f63c2; }
.fp-mp-add-btn:disabled { background: #c8d8ed; cursor: not-allowed; }
.fp-mp-photos-btn {
  width: 100%;
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 11px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.fp-mp-photos-btn:hover:not(:disabled) {
  background: var(--bg-secondary);
  border-color: #a8a8ad;
}
.fp-mp-photos-btn:disabled {
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  cursor: not-allowed;
}
.fp-mp-delete-btn {
  width: 100%;
  background: white;
  color: #e2483b;
  border: 1px solid var(--border-light);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 11px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.fp-mp-delete-btn:hover {
  background: #fceaea;
  border-color: #e2483b;
}

/* ── Side Panel ── */
.fp-panel {
  width: 264px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.fp-panel-content { display: none; }
.fp-panel-content.active { display: block; }

.fp-panel-head {
  padding: 18px 20px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.fp-panel-head h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.fp-upload {
  margin: 0 16px 16px;
  padding: 18px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-primary);
  border: 1px dashed var(--border-medium);
  font-weight: 500;
  transition: background 0.15s;
}
.fp-upload:hover { background: var(--bg-tertiary); }
.fp-upload svg { width: 16px; height: 16px; }

.fp-bg-loading-box {
  margin: 0 16px 16px;
  padding: 18px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-tertiary);
  font-style: italic;
}
@keyframes fp-spin { to { transform: rotate(360deg); } }
.fp-spin { animation: fp-spin 1.5s linear infinite; }

.fp-bg-preview {
  margin: 0 16px 8px;
  height: 120px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.fp-bg-preview.fp-bg-no-url {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 12px;
  font-style: italic;
}
.fp-bg-actions {
  display: flex;
  gap: 6px;
  margin: 0 16px 16px;
}
.fp-bg-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  cursor: pointer;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s;
}
.fp-bg-action-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }
.fp-bg-action-btn.on { background: var(--bg-info); border-color: var(--text-info); color: var(--text-info); }
.fp-bg-action-btn svg { width: 16px; height: 16px; }
.fp-bg-action-danger { color: var(--text-danger); }
.fp-bg-action-danger:hover { background: rgba(194, 65, 12, 0.06); color: var(--text-danger); border-color: var(--text-danger); }

.fp-section-label {
  padding: 0 20px 8px;
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fp-btns { padding: 0 12px; }

.fp-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  transition: background 0.15s;
  margin-bottom: 2px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.fp-btn:hover:not(.on) { background: var(--bg-secondary); }
.fp-btn.on { background: var(--bg-info); color: var(--text-info); font-weight: 500; }

.fp-btn .fp-ico {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}
.fp-btn.on .fp-ico { background: rgba(55, 138, 221, 0.15); }
.fp-btn .fp-ico svg { width: 16px; height: 16px; }
.fp-btn .fp-lab { flex: 1; }
.fp-btn .fp-lab-title { display: block; line-height: 1.3; }
.fp-btn .fp-lab-sub { display: block; font-size: 11px; color: var(--text-tertiary); font-weight: 400; margin-top: 2px; }
.fp-btn.on .fp-lab-sub { color: var(--text-info); opacity: 0.75; }
.fp-btn .fp-chev { color: var(--text-tertiary); font-size: 14px; }
.fp-btn.on .fp-chev { color: var(--text-info); }

/* ── Shape Picker ── */
.fp-shape-picker {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 2px 12px 6px;
}
.fp-shape-picker.show { display: grid; }
.fp-shape-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 2px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s, border-color 0.15s;
}
.fp-shape-tile:hover:not(.on) { background: var(--bg-tertiary); border-color: var(--border-medium); }
.fp-shape-tile.on { background: var(--bg-info); border-color: var(--text-info); }
.fp-shape-tile svg { width: 22px; height: 22px; color: var(--text-secondary); }
.fp-shape-tile.on svg { color: var(--text-info); }
.fp-shape-tile span { font-size: 10px; font-weight: 500; color: var(--text-secondary); }
.fp-shape-tile.on span { color: var(--text-info); }

.fp-divider {
  height: 1px;
  background: var(--border-light);
  margin: 14px 20px;
}

/* ── Confirmation Modal ── */
.fp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 31, 29, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
.fp-modal-overlay.open { display: flex; }
/* The confirm prompt is the only modal that must outrank the photo viewer (z-400),
   so the "are you sure?" dialog never gets hidden when triggered from inside it. */
#fp-confirm-modal { z-index: 600; }
.fp-modal {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 360px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: fp-modal-in 0.15s ease-out;
  font-family: var(--font);
}
@keyframes fp-modal-in {
  from { opacity: 0; transform: scale(0.97) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.fp-modal-body {
  padding: 24px 22px 16px;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}
.fp-modal-footer {
  padding: 12px 22px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.fp-modal-btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border: none;
  transition: background 0.15s;
}
.fp-modal-cancel {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.fp-modal-cancel:hover { background: var(--bg-tertiary); }
.fp-modal-confirm {
  background: var(--text-danger);
  color: white;
}
.fp-modal-confirm:hover { background: #a33108; }

.fp-modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fp-modal-head h2 { font-size: 18px; font-weight: 600; margin: 0; }
.fp-modal-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  font-size: 18px;
  background: none; border: none;
  font-family: var(--font);
  transition: background 0.15s;
}
.fp-modal-close:hover { background: var(--bg-secondary); color: var(--text-primary); }

.fp-modal-section-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin: 0 0 10px;
}

.fp-layer-radio {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.fp-layer-opt {
  padding: 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: background 0.15s, border-color 0.15s;
}
.fp-layer-opt:hover { background: var(--bg-secondary); }
.fp-layer-opt.on {
  border-color: var(--text-info);
  background: var(--bg-info);
  color: var(--text-info);
}

.fp-modal-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  cursor: pointer;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font);
  color: var(--text-primary);
  transition: background 0.15s;
  box-sizing: border-box;
}
.fp-modal-toggle-row:hover { background: var(--bg-tertiary); }

.fp-modal-primary {
  padding: 8px 18px;
  background: var(--text-info);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  transition: background 0.15s;
}
.fp-modal-primary:hover { background: #0f4d8c; }

/* ── Floating Context Toolbar ── */
.fp-float-toolbar {
  position: fixed;
  display: none;
  align-items: center;
  gap: 1px;
  padding: 4px;
  background: var(--bg-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  z-index: 210;
  transform: translate(-50%, -100%);
  margin-top: -12px;
  font-family: var(--font);
}
.fp-float-toolbar.show { display: flex; }
.fp-float-toolbar::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px; height: 8px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-medium);
  border-bottom: 1px solid var(--border-medium);
}
.fp-ft-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  border: none;
  background: transparent;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.fp-ft-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }
.fp-ft-btn.fp-ft-danger:hover { background: rgba(194, 65, 12, 0.08); color: var(--text-danger); }
.fp-ft-btn svg { width: 16px; height: 16px; }
.fp-ft-btn[title]:hover::before {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background: rgba(31, 31, 29, 0.9);
  color: white;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 4px;
  margin-bottom: 6px;
  pointer-events: none;
  z-index: 220;
}
.fp-ft-divider {
  width: 1px; height: 18px;
  background: var(--border-light);
  margin: 0 3px;
}
.fp-float-toolbar [data-for] { display: none; }
.fp-float-toolbar.wall [data-for="wall"] { display: flex; }
.fp-float-toolbar.wall-furniture [data-for="wall-furniture"] { display: flex; }
.fp-float-toolbar.furniture [data-for="furniture"] { display: flex; }
.fp-float-toolbar.wall-corner [data-for="wall-corner"] { display: flex; }
.fp-float-toolbar.room [data-for="room"] { display: flex; }

/* ── Wall Elevation Panel ── */
.fp-elevation-panel {
  display: none;
  position: fixed;
  top: 60px;
  /* Center over Unity canvas area (starts at 328px from left) */
  left: calc(328px + (100% - 328px) / 2);
  transform: translateX(-50%);
  z-index: 120;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  font-family: var(--font);
}
.fp-elevation-panel.show { display: flex; }
.fp-elevation-info {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0 10px;
  white-space: nowrap;
}
.fp-elevation-nav,
.fp-elevation-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0;
}
.fp-elevation-nav:hover { background: var(--bg-secondary); }
.fp-elevation-close:hover { background: #fee2e2; color: #c2410c; }
.fp-elevation-nav svg,
.fp-elevation-close svg {
  width: 18px;
  height: 18px;
}
.fp-elevation-divider {
  width: 1px;
  height: 20px;
  background: var(--border-light);
  margin: 0 4px;
}

/* ── Settings ── */
.fp-settings-unit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.fp-settings-unit {
  padding: 10px 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  text-align: center;
  color: var(--text-primary);
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fp-settings-unit:hover { background: var(--bg-secondary); }
.fp-settings-unit.on { border-color: var(--text-info); background: var(--bg-info); color: var(--text-info); }
.fp-settings-unit-abbr { font-size: 11px; color: var(--text-tertiary); font-family: ui-monospace, monospace; }
.fp-settings-unit.on .fp-settings-unit-abbr { color: var(--text-info); }

/* ── Help Center ── */
.fp-help-body {
  padding: 16px 22px;
  max-height: 60vh;
  overflow-y: auto;
}
.fp-help-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}
.fp-help-row:last-child { border-bottom: none; }
.fp-help-row strong { display: block; margin-bottom: 2px; }
.fp-help-row span { color: var(--text-secondary); font-size: 12px; }
.fp-help-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  font-size: 16px;
}

/* ── Keyboard Shortcuts ── */
.fp-shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-primary);
}
.fp-shortcut-row:last-child { border-bottom: none; }
.fp-shortcut-keys {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-tertiary);
  font-size: 12px;
}
.fp-shortcut-keys kbd {
  display: inline-block;
  padding: 3px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: 0 1px 0 var(--border-medium);
}

/* ── Pan cursor ── */
#unity-canvas.fp-pan-cursor { cursor: grab !important; }
#unity-canvas.fp-pan-cursor:active { cursor: grabbing !important; }

/* ── Done Bar ── */
.fp-done-bar {
  display: none;
  position: fixed;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 210;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 18px;
  background: rgba(31, 31, 29, 0.92);
  color: white;
  border-radius: 20px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.fp-done-bar.show { display: flex; }
.fp-done-label { opacity: 0.9; }
.fp-done-btn {
  padding: 5px 16px;
  background: var(--text-info);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s;
}
.fp-done-btn:hover { background: #0f4d8c; }

/* ── Status Bar ── */
.fp-statusbar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 40px;
  align-items: center;
  padding: 0 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  gap: 10px;
  font-family: var(--font);
  font-size: 12px;
  color: var(--text-secondary);
  z-index: 200;
}
.fp-statusbar.show { display: flex; }

.fp-sb-grow { flex: 1; }

.fp-saved {
  color: var(--text-success);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
}
.fp-saved::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-success);
}

.fp-toggle-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px 4px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-primary);
  font-family: var(--font);
  transition: background 0.15s, color 0.15s;
}
.fp-toggle-btn:hover { background: var(--bg-tertiary); }
.fp-toggle-btn.on { color: var(--text-primary); }

.fp-switch {
  width: 24px; height: 14px;
  background: var(--border-medium);
  border-radius: 7px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.fp-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 10px; height: 10px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.fp-switch.on { background: var(--text-info); }
.fp-switch.on::after { transform: translateX(10px); }

.fp-sb-zoom {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Damage Panel ── */
.fp-damage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 16px 14px;
}
.fp-damage-tile {
  padding: 14px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  border: 1px solid var(--border-light);
  transition: background 0.15s, border-color 0.15s;
}
.fp-damage-tile:hover { background: var(--bg-tertiary); border-color: var(--border-medium); }
.fp-damage-tile .fp-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  margin: 0 auto 6px;
}
.fp-damage-tile.on { border-color: var(--text-info); background: var(--bg-info); }
.fp-damage-tile span { font-size: 12px; font-weight: 500; }

/* ── Draw Tools (Brush/Eraser/Pan) ── */
.fp-draw-tools {
  display: flex;
  gap: 6px;
  padding: 0 16px 14px;
}
.fp-draw-tool {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s, border-color 0.15s;
}
.fp-draw-tool:hover:not(.on) { background: var(--bg-tertiary); }
.fp-draw-tool.on { background: var(--bg-info); border-color: var(--text-info); color: var(--text-info); }
.fp-draw-tool svg { width: 20px; height: 20px; }
.fp-draw-tool.on svg { color: var(--text-info); }

/* ── Annotation Panel ── */
.fp-annot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 0 16px 14px;
}
.fp-annot-tile {
  padding: 10px 4px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  border: 1px solid var(--border-light);
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 64px;
  justify-content: center;
}
.fp-annot-tile:hover { background: var(--bg-tertiary); }
.fp-annot-tile.on { background: var(--bg-info); border-color: var(--text-info); }
.fp-annot-tile.on svg { color: var(--text-info); }
.fp-annot-tile.on span { color: var(--text-info); }
.fp-annot-tile svg { width: 22px; height: 22px; color: var(--text-secondary); }
.fp-annot-tile span { font-size: 10px; color: var(--text-primary); line-height: 1.2; }
.fp-annot-ind {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: white;
}

/* ── Properties Form ── */
.fp-panel-back {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  background: none; border: none;
  transition: background 0.15s;
}
.fp-panel-back:hover { background: var(--bg-secondary); color: var(--text-primary); }
.fp-panel-back svg { width: 14px; height: 14px; }

.fp-props-form { padding: 0 16px; }

.fp-field { margin-bottom: 14px; }
.fp-field label {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.fp-field input, .fp-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-primary);
  box-sizing: border-box;
}
.fp-field input:focus, .fp-field textarea:focus { outline: none; border-color: var(--text-info); }

.fp-select {
  width: 100%;
  padding: 8px 30px 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-primary);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b9b94' stroke-width='1.5'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
}
.fp-select:focus { outline: none; border-color: var(--text-info); }

.fp-dim-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: background 0.15s, border-color 0.15s;
  box-sizing: border-box;
}
.fp-dim-btn:hover { background: var(--bg-secondary); border-color: var(--border-medium); }
.fp-dim-btn:hover svg { color: var(--text-info) !important; }

.fp-color-input {
  width: 100%;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg-primary);
}
.fp-color-input::-webkit-color-swatch-wrapper { padding: 2px; }
.fp-color-input::-webkit-color-swatch { border-radius: 2px; border: none; }

.fp-annot-field { display: none; }
.fp-annot-field.show { display: block; }

.fp-slider-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  align-items: center;
  gap: 10px;
}
.fp-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-medium);
  border-radius: 3px;
  outline: none;
  margin: 0;
  padding: 0;
}
.fp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text-info);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.fp-slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text-info);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.fp-slider-num {
  width: 42px;
  padding: 5px 2px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12px;
  text-align: center;
  color: var(--text-primary);
  background: var(--bg-primary);
  box-sizing: border-box;
  -moz-appearance: textfield;
}
.fp-slider-num::-webkit-inner-spin-button,
.fp-slider-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.fp-slider-num:focus { outline: none; border-color: var(--text-info); }

.fp-field-readonly {
  padding: 8px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  font-family: ui-monospace, monospace;
}

.fp-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-primary);
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
}
.fp-textarea:focus { outline: none; border-color: var(--text-info); }

.fp-photos-count {
  display: inline-flex;
  align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 6px;
  background: var(--bg-tertiary);
  border-radius: 9px;
  font-size: 11px; font-weight: 500;
  color: var(--text-secondary);
  margin-left: 4px;
}

.fp-photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.fp-photo-add {
  aspect-ratio: 1;
  border: 1.5px dashed var(--border-medium);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  transition: background 0.15s, border-color 0.15s;
}
.fp-photo-add:hover { background: var(--bg-tertiary); border-color: var(--text-info); color: var(--text-info); }
.fp-photo-add svg { width: 22px; height: 22px; }

.fp-photo-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-light);
  background-size: cover;
  background-position: center;
}
.fp-photo-thumb:hover { transform: scale(1.03); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }

/* ── Catalog Grid ── */
.fp-catalog-dynamic { padding-bottom: 16px; }
.fp-catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 0 16px;
}
.fp-catalog-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  overflow: hidden;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  text-align: center;
}
.fp-catalog-item:hover {
  border-color: var(--border-medium);
  background: var(--bg-secondary);
  transform: scale(1.02);
}
.fp-catalog-item span {
  display: block;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}
.fp-catalog-thumb {
  width: 100%;
  aspect-ratio: 1;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: var(--bg-secondary);
}
.fp-catalog-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Search ── */
.fp-search-wrap {
  position: relative;
  margin: 0 16px 14px;
}
.fp-search-wrap .fp-search {
  margin: 0;
  width: 100%;
  padding-right: 28px;
}
.fp-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 16px;
  font-family: var(--font);
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}
.fp-search-clear:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.fp-search-clear.show { display: flex; }

.fp-search {
  padding: 9px 28px 9px 32px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
  display: block;
  width: 100%;
  box-sizing: border-box;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b9b94' stroke-width='1.5'><circle cx='11' cy='11' r='7'/><line x1='16' y1='16' x2='21' y2='21'/></svg>");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 14px;
}
.fp-search:focus { outline: none; border-color: var(--text-info); background-color: var(--bg-primary); }

/* ── Category rows ── */
.fp-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background 0.15s;
}
.fp-cat-row:hover { background: var(--bg-secondary); }
.fp-cat-row .fp-right { display: flex; align-items: center; gap: 8px; }
.fp-cat-row .fp-count { color: var(--text-tertiary); font-size: 12px; }
.fp-cat-row .fp-chev { color: var(--text-tertiary); font-size: 14px; }

/* ── Damage Summary ── */
.fp-summary {
  margin: 14px 16px 16px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}
.fp-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}
.fp-summary-row:last-child {
  margin-bottom: 0; margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border-light);
  font-weight: 500;
}
.fp-summary-row .fp-lbl { color: var(--text-secondary); }
.fp-summary-row .fp-val { color: var(--text-primary); font-family: ui-monospace, monospace; }

/* ── Action Buttons ── */
.fp-action-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 0 16px 14px;
}
.fp-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.fp-action-btn:hover { background: var(--bg-tertiary); border-color: var(--border-medium); color: var(--text-primary); }
.fp-action-btn svg { width: 18px; height: 18px; }

/* ── Danger button ── */
.fp-btn-danger {
  width: calc(100% - 32px);
  margin: 14px 16px;
  padding: 9px;
  background: transparent;
  color: var(--text-danger);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}
.fp-btn-danger:hover { background: rgba(194, 65, 12, 0.06); border-color: var(--text-danger); }

/* Wall damage draw button */
.fp-text-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  resize: vertical;
}
.fp-text-input:focus {
  outline: none;
  border-color: var(--text-primary);
  background: #fff;
}

.fp-btn-draw-damage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 32px);
  margin: 14px 16px;
  padding: 14px 20px;
  background: #1A1F2E;
  color: #FBF9F4;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.15s ease;
  box-shadow: 0 2px 8px rgba(26,31,46,0.15);
}
.fp-btn-draw-damage:hover { background: #2a2f3e; }
.fp-btn-draw-damage:active { transform: scale(0.97); }
.fp-btn-draw-damage.is-active {
  background: #C9613A;
}
.fp-btn-draw-damage.is-active::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #fff;
  margin-right: 8px;
  animation: fp-pulse 1.4s ease infinite;
}
@keyframes fp-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

/* ── Electrical Map ── */
/* Rail button — amber accent */
.fp-rl-electrical svg,
.fp-rl-electrical.on svg { color: #eab308; }

/* Add-item button + picker */
.fp-em-actions { padding: 0 16px 12px; position: relative; }
.fp-em-add-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #eab308;
  color: #1f1f1d;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.fp-em-add-btn:hover { background: #d49b08; }
.fp-em-add-btn:active { transform: scale(0.98); }
.fp-em-add-btn svg { width: 16px; height: 16px; }
.fp-em-add-btn span { flex: 1; text-align: left; }
.fp-em-add-chev { width: 14px !important; height: 14px !important; transition: transform 0.15s; }
.fp-em-add-btn.open .fp-em-add-chev { transform: rotate(180deg); }

.fp-em-picker {
  display: none;
  margin-top: 8px;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
  overflow: hidden;
  max-height: 60vh;
  flex-direction: column;
}
.fp-em-picker.open { display: flex; }
.fp-em-picker-head {
  padding: 10px;
  background: white;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 2;
}
.fp-em-picker-search {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.12s, background 0.12s;
}
.fp-em-picker-search:focus {
  border-color: #eab308;
  background: white;
}
.fp-em-picker-body {
  overflow-y: auto;
  padding: 6px 0 8px;
}
.fp-em-picker-group {
  padding: 10px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}
/* Grid: 2 columns of compact tiles for at-a-glance scanning */
.fp-em-picker-body {
  display: flex;
  flex-direction: column;
}
.fp-em-picker-group + .fp-em-picker-tile,
.fp-em-picker-tile + .fp-em-picker-tile {
  margin-top: 2px;
}
.fp-em-picker-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin: 0 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s;
}
.fp-em-picker-tile:hover {
  background: var(--bg-secondary);
}
.fp-em-picker-tile:active {
  transform: scale(0.98);
}
.fp-em-picker-ico {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.fp-em-picker-ico svg { width: 22px; height: 22px; color: white; display: block; }
.fp-em-picker-ico.amber { background: #eab308; }
.fp-em-picker-ico.red { background: #dc2626; }
.fp-em-picker-ico.blue { background: #2563eb; }
.fp-em-picker-ico.power { background: linear-gradient(135deg, #f59e0b, #eab308); }
.fp-em-picker-ico.lighting { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.fp-em-picker-ico.control { background: linear-gradient(135deg, #a78bfa, #8b5cf6); }
.fp-em-picker-ico.hardwired { background: linear-gradient(135deg, #ef4444, #dc2626); }
.fp-em-picker-ico.board { background: linear-gradient(135deg, #475569, #1f1f1d); }
.fp-em-picker-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.fp-em-picker-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Summary banner */
.fp-em-summary {
  display: flex;
  margin: 0 16px 12px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: 10px;
  border: 1px solid var(--border-light);
  gap: 8px;
}
.fp-em-summary-stat { flex: 1; text-align: center; }
.fp-em-summary-stat + .fp-em-summary-stat { border-left: 1px solid var(--border-light); }
.fp-em-summary-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}
.fp-em-summary-val { font-size: 18px; font-weight: 800; color: var(--text-primary); margin-top: 2px; }
.fp-em-summary-val.red { color: #dc2626; }
.fp-em-summary-val.green { color: #16a34a; }

/* Filter chips */
.fp-em-filter {
  display: flex;
  gap: 6px;
  padding: 0 16px 10px;
}
.fp-em-chip {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
}
.fp-em-chip:hover { background: white; border-color: var(--text-tertiary); }
.fp-em-chip.on { background: #1f1f1d; color: white; border-color: #1f1f1d; }

/* Empty state */
.fp-em-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 16px;
  gap: 6px;
}
.fp-em-empty.hidden { display: none; }
.fp-em-empty-title { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-top: 4px; }
.fp-em-empty-sub { font-size: 11px; color: var(--text-secondary); line-height: 1.4; max-width: 220px; }

/* List */
.fp-em-list {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 16px;
}
.fp-em-list.populated { display: flex; }
.fp-em-row {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background: white;
  transition: background 0.12s, border-color 0.12s;
}
.fp-em-row:hover { background: var(--bg-secondary); border-color: var(--text-tertiary); }
.fp-em-row.active { border-color: #eab308; background: #fef9e7; }
.fp-em-row-dot {
  width: 14px; height: 14px; border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  background: #eab308;
}
.fp-em-row-dot.red { background: #dc2626; }
.fp-em-row-dot.green { background: #16a34a; }
.fp-em-row-dot.blue { background: #2563eb; }
.fp-em-row-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fp-em-row-id-line { display: flex; align-items: center; gap: 6px; }
.fp-em-row-id {
  font-size: 10px;
  font-weight: 800;
  color: white;
  background: #1f1f1d;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.fp-em-row-label { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.fp-em-row-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.fp-em-row-chev {
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.fp-em-row-chev svg { width: 14px; height: 14px; }

/* Properties panel — card */
.fp-em-card {
  margin: 0 16px 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.fp-em-card-info { flex: 1; min-width: 0; }
.fp-em-card-id {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  color: white;
  background: #1f1f1d;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.fp-em-card-type { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-top: 6px; }

.fp-em-status-pill,
.fp-em-power-pill {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.fp-em-status-pill.status-cleared { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.fp-em-status-pill.status-reconnected { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.fp-em-power-pill.is-on { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.fp-em-power-pill.is-off { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

/* Power state row + toggle switch */
.fp-em-power-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
}
.fp-em-power-info { min-width: 0; flex: 1; }
.fp-em-power-state-label { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.fp-em-power-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.fp-em-toggle {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #dc2626;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.2s;
}
.fp-em-toggle[aria-pressed="true"] { background: #16a34a; }
.fp-em-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s;
}
.fp-em-toggle[aria-pressed="true"] .fp-em-toggle-knob { transform: translateX(18px); }

/* Sections */
.fp-em-section { padding: 0 16px 16px; }
.fp-em-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.fp-em-optional { color: var(--text-tertiary); font-weight: 600; text-transform: none; letter-spacing: 0; }
.fp-em-required { color: #dc2626; }
.fp-em-input,
.fp-em-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.12s;
}
.fp-em-input:focus,
.fp-em-textarea:focus { border-color: #eab308; }
.fp-em-textarea { resize: vertical; min-height: 64px; line-height: 1.4; }

/* Timeline */
.fp-em-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-left: 2px solid var(--border-light);
  padding-left: 12px;
  margin-left: 4px;
}
.fp-em-timeline-empty {
  font-size: 11px;
  color: var(--text-tertiary);
  font-style: italic;
}
.fp-em-tl-item {
  position: relative;
  font-size: 12px;
}
.fp-em-tl-item::before {
  content: '';
  position: absolute;
  left: -18px;
  top: 4px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #eab308;
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--border-light);
}
.fp-em-tl-item.action-cleared::before { background: #16a34a; }
.fp-em-tl-item.action-reconnected::before { background: #2563eb; }
.fp-em-tl-action {
  font-weight: 700;
  color: var(--text-primary);
  text-transform: capitalize;
}
.fp-em-tl-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.fp-em-tl-meta strong { color: var(--text-primary); font-weight: 700; }
.fp-em-tl-notes {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  padding: 6px 8px;
  background: var(--bg-secondary);
  border-radius: 6px;
  line-height: 1.4;
}

/* Bottom actions */
.fp-em-bottom-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 16px 16px;
}
.fp-em-clear-btn {
  padding: 10px 14px;
  background: #16a34a;
  color: white;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.fp-em-clear-btn:hover { background: #128039; }
.fp-em-clear-btn:disabled { background: var(--text-tertiary); cursor: default; }
.fp-em-delete-btn {
  padding: 10px 14px;
  background: white;
  color: #c2410c;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.fp-em-delete-btn:hover { background: #fff7ed; }

/* Clear modal */
.fp-em-modal { max-width: 420px; width: 90%; }
.fp-em-modal-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.fp-em-field { margin-bottom: 12px; }
.fp-em-field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.fp-em-modal-confirm { background: #16a34a; color: white; border-color: #16a34a; }
.fp-em-modal-confirm:hover { background: #128039; border-color: #128039; }

/* ── Electrical item photos ── */
.fp-em-photos-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}
.fp-em-photo-attach {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 1.5px dashed var(--border-light);
  background: var(--bg-secondary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  padding: 0;
}
.fp-em-photo-attach:hover {
  border-color: #eab308;
  color: #b45309;
  background: #fef9e7;
}
.fp-em-photo-attach svg { width: 18px; height: 18px; }
.fp-em-photo-thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-tertiary);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.12s;
}
.fp-em-photo-thumb:hover { transform: scale(1.04); }

/* ── Electrical floating bar + Layers panel ── */
.fp-em-bar {
  position: fixed;
  top: 62px;
  left: 338px; /* 64 rail + 264 panel + 10 gap */
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 160;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(6px);
  font-family: var(--font);
  min-width: 220px;
}
.fp-em-bar.show { display: flex; }
.fp-em-bar-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0 4px;
}
.fp-em-bar-spacer { flex: 1; min-width: 12px; }

.fp-em-layers-btn {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s, color 0.12s;
}
.fp-em-layers-btn svg { width: 14px; height: 14px; }
.fp-em-layers-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }
.fp-em-layers-btn.on {
  background: #eab308;
  color: #1f1f1d;
  border-color: #eab308;
}

.fp-em-layers-panel {
  position: fixed;
  top: 110px;
  right: 16px;
  width: 280px;
  max-height: calc(100vh - 200px);
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  z-index: 170;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font);
}
.fp-em-layers-panel.open { display: flex; }
.fp-em-layers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
}
.fp-em-layers-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}
.fp-em-layers-close {
  width: 24px; height: 24px;
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fp-em-layers-close:hover { background: var(--bg-secondary); color: var(--text-primary); }
.fp-em-layers-body { padding: 12px; overflow-y: auto; }
.fp-em-layers-group { margin-bottom: 16px; }
.fp-em-layers-group:last-child { margin-bottom: 0; }
.fp-em-layers-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.fp-em-layer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.fp-em-layer-row:hover:not(.locked) { background: var(--bg-secondary); }
.fp-em-layer-row.locked { cursor: default; }
.fp-em-layer-row.off .fp-em-layer-label,
.fp-em-layer-row.off .fp-em-layer-count { color: var(--text-tertiary); }
.fp-em-layer-info { flex: 1; min-width: 0; }
.fp-em-layer-label { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.fp-em-layer-count { font-size: 10px; font-weight: 500; color: var(--text-secondary); margin-top: 2px; }

.fp-em-layer-toggle {
  width: 34px; height: 18px;
  background: #c8c8cc;
  border-radius: 9px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s;
}
.fp-em-layer-toggle::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.15s;
}
.fp-em-layer-toggle.on { background: #16a34a; }
.fp-em-layer-toggle.on::before { transform: translateX(16px); }
.fp-em-layer-toggle.locked {
  background: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fp-em-layer-toggle.locked::before { display: none; }
.fp-em-layer-toggle.locked svg { width: 10px; height: 10px; color: white; }

.fp-em-layers-actions { margin-top: 12px; }
.fp-em-layers-reset {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s;
}
.fp-em-layers-reset:hover { background: white; color: var(--text-primary); }
