/* ============================================
   RIGHT PANEL — Live Legend (Lionheart branded)
   ============================================ */

.panel-right {
  width: var(--panel-w);
  background: var(--lh-white);
  border-left: 1px solid var(--lh-gray-200);
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* Panel header */
.panel-header {
  position: relative;
  padding: 16px 18px;
  border-bottom: 1px solid var(--lh-gray-200);
  background: linear-gradient(180deg, var(--lh-cream) 0%, var(--lh-white) 100%);
}
.panel-header h3 {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--lh-navy);
  letter-spacing: .01em;
  padding-right: 105px;
}

/* Sections */
.panel-section {
  padding: 14px 18px;
  border-bottom: 1px solid var(--lh-gray-200);
}
.panel-section:last-child { border-bottom: none; }

.panel-section-title {
  font-family: var(--font-serif);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--lh-gold-dark);
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--lh-gold-pale);
}

.legend-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend-empty {
  font-size: 11px;
  color: var(--lh-gray-400);
  font-style: italic;
  padding: 6px 0;
}

/* ---- CONDUIT ROW ---- */
.legend-conduit {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 5px 4px;
  border-radius: var(--radius-sm);
  transition: background .12s;
  position: relative;
}
.legend-conduit:hover { background: var(--lh-gray-50); }
.legend-conduit.legend-editing,
.legend-equip.legend-editing,
.legend-note.legend-editing {
  background: var(--lh-gold-faint);
  border: 1.5px solid var(--lh-gold);
}

.legend-swatch {
  width: 26px;
  height: 7px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 0.5px rgba(0,0,0,.08);
}

.legend-conduit-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--lh-gray-800);
  line-height: 1.3;
}
.legend-cable-info {
  font-weight: 400;
  color: var(--lh-gray-500);
  font-size: 10px;
}
.legend-conduit-desc {
  font-size: 9px;
  color: var(--lh-gray-400);
  margin-top: 1px;
}
.legend-conduit-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--lh-navy);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.legend-conduit-value .unit {
  font-size: 9px;
  font-weight: 500;
  color: var(--lh-gray-400);
  margin-left: 2px;
}

/* ---- CABLE SUB-ITEM (indented under conduit) ---- */
.legend-cable-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px 2px 0;
  margin-left: 12px;
  border-left: 2px solid var(--lh-gray-200);
  padding-left: 10px;
}
.legend-cable-indent {
  width: 0;
}
.legend-cable-swatch {
  width: 16px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-cable-sub-info {
  flex: 1;
  min-width: 0;
}
.legend-cable-sub-name {
  font-size: 10px;
  color: var(--lh-gray-500);
}
.legend-cable-sub-value {
  font-size: 10px;
  font-weight: 600;
  color: var(--lh-gray-600);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.legend-cable-sub-value .unit {
  font-size: 8px;
  font-weight: 400;
  color: var(--lh-gray-400);
  margin-left: 1px;
}

/* ---- EQUIPMENT ROW ---- */
.legend-equip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px;
  border-radius: var(--radius-sm);
  transition: background .12s;
}
.legend-equip:hover { background: var(--lh-gray-50); }

.legend-equip-icon {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.legend-equip-svg {
  width: 26px;
  height: 26px;
  min-width: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.legend-equip-svg svg {
  width: 22px;
  height: 22px;
  display: block;
}
.legend-equip-name {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--lh-gray-800);
}
.legend-equip-desc {
  font-size: 9px;
  font-weight: 400;
  color: var(--lh-gray-400);
  margin-top: 1px;
}
.legend-equip-qty {
  font-size: 12px;
  font-weight: 700;
  color: var(--lh-navy);
  font-variant-numeric: tabular-nums;
}
.legend-equip-qty .unit {
  font-size: 9px;
  font-weight: 500;
  color: var(--lh-gray-400);
}

/* ---- NOTE ROW ---- */
.legend-note {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: start;
  gap: 10px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background .12s;
}
.legend-note:hover { background: var(--lh-gray-50); }

.legend-note-marker {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
}
.legend-note-text {
  font-size: 11px;
  color: var(--lh-gray-600);
  line-height: 1.45;
}
.legend-note-text strong {
  color: var(--lh-navy);
  font-weight: 700;
}

/* ---- EDIT & DELETE BUTTONS (on hover) ---- */
.legend-equip, .legend-note {
  position: relative;
}
.legend-edit {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--lh-gold);
  color: var(--lh-navy-deep);
  font-size: 10px;
  border: 1.5px solid var(--lh-white);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(197,165,90,.3);
  transition: transform .1s;
}
.legend-edit:hover { transform: translateY(-50%) scale(1.1); }
.legend-delete {
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--lh-red);
  color: #fff;
  font-size: 10px;
  border: 1.5px solid var(--lh-white);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(217,68,68,.3);
  transition: transform .1s;
}
.legend-delete:hover { transform: translateY(-50%) scale(1.1); }
.legend-conduit:hover .legend-edit,
.legend-conduit:hover .legend-delete,
.legend-equip:hover .legend-edit,
.legend-equip:hover .legend-delete,
.legend-note:hover .legend-edit,
.legend-note:hover .legend-delete,
.legend-conduit.legend-editing .legend-edit,
.legend-equip.legend-editing .legend-edit,
.legend-note.legend-editing .legend-edit {
  display: flex;
}

/* ---- LAYER Z-INDEX BUTTONS ---- */
.legend-layer-btn {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--lh-gray-100);
  color: var(--lh-gray-500);
  font-size: 10px;
  border: 1px solid var(--lh-gray-200);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: background .12s, color .12s;
}
.legend-layer-btn:hover {
  background: var(--lh-gold-pale);
  color: var(--lh-navy);
  border-color: var(--lh-gold);
}
.legend-layer-up {
  right: 54px;
  top: 50%;
  transform: translateY(-50%);
}
.legend-layer-down {
  right: 36px;
  top: 50%;
  transform: translateY(-50%);
}
.legend-conduit:hover .legend-layer-btn,
.legend-equip:hover .legend-layer-btn,
.legend-note:hover .legend-layer-btn {
  display: flex;
}

/* ---- TRENCH EDITOR ---- */
.trench-editor {
  padding: 8px 4px 8px 10px;
  border-left: 3px solid var(--lh-gold);
  margin: 4px 0 8px 0;
}
.trench-editor-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--lh-gray-400);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.trench-cable-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.trench-cable-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 10px;
  border: 1px solid var(--lh-gray-200);
  border-radius: 4px;
  background: var(--lh-cream);
  cursor: pointer;
  color: var(--lh-gray-800);
  font-weight: 500;
  transition: background .12s, border-color .12s;
}
.trench-cable-btn:hover {
  background: var(--lh-gold-pale);
  border-color: var(--lh-gold);
}
.cable-swatch {
  width: 14px;
  height: 5px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}
.trench-cable-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
}
.trench-cable-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  font-size: 11px;
  color: var(--lh-gray-800);
  border-radius: 3px;
  transition: background .12s;
}
.trench-cable-entry:hover {
  background: var(--lh-gray-50);
}
.trench-cable-entry .cable-name {
  flex: 1;
}
.trench-cable-delete {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--lh-red);
  color: #fff;
  font-size: 9px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0;
  transition: opacity .12s;
}
.trench-cable-entry:hover .trench-cable-delete {
  opacity: 1;
}
.trench-editor-props {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.trench-prop-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
}
.trench-prop-label {
  width: 42px;
  flex-shrink: 0;
  color: var(--lh-gray-400);
  font-weight: 500;
}
.trench-prop-input {
  flex: 1;
  padding: 2px 6px;
  font-size: 10px;
  border: 1px solid var(--lh-gray-200);
  border-radius: 3px;
  background: var(--lh-white);
  color: var(--lh-gray-800);
}
.trench-prop-slider {
  flex: 1;
  height: 4px;
}
.trench-prop-val {
  font-size: 9px;
  color: var(--lh-gray-400);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}
.trench-prop-color {
  width: 24px;
  height: 20px;
  border: 1px solid var(--lh-gray-200);
  border-radius: 3px;
  padding: 0;
  cursor: pointer;
}
.trench-editor-done {
  padding: 4px 14px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid var(--lh-gold);
  border-radius: 4px;
  background: var(--lh-gold);
  color: #fff;
  cursor: pointer;
  transition: background .12s;
}
.trench-editor-done:hover {
  background: var(--lh-gold-dark);
}

/* ---- LAYERS TOGGLE BUTTON ---- */
.layers-toggle-btn {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 5px;
  border: 1.5px solid var(--lh-gray-200);
  background: var(--lh-white);
  color: var(--lh-gray-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.layers-toggle-btn:hover {
  border-color: var(--lh-gold);
  color: var(--lh-navy);
  background: var(--lh-gold-faint);
}
.layers-toggle-btn.active {
  border-color: var(--lh-gold);
  background: var(--lh-gold);
  color: var(--lh-navy-deep);
}

/* ---- LAYERS PANEL ---- */
.layers-panel {
  padding: 14px 18px;
  flex: 1;
  overflow-y: auto;
}
.layers-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 11px;
  color: var(--lh-gray-800);
  cursor: grab;
  transition: background .12s, border-color .15s;
  border: 1.5px solid transparent;
  user-select: none;
}
.layer-item:hover {
  background: var(--lh-gray-50);
}
.layer-item.layer-dragging {
  opacity: 0.4;
}
.layer-item.layer-drag-over {
  border-color: var(--lh-gold);
  background: var(--lh-gold-faint);
}
.layer-handle {
  color: var(--lh-gray-300);
  font-size: 14px;
  cursor: grab;
  user-select: none;
  line-height: 1;
  flex-shrink: 0;
}
.layer-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.layer-type-tag {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--lh-gray-400);
  padding: 1px 5px;
  background: var(--lh-gray-100);
  border-radius: 3px;
  flex-shrink: 0;
}
.layers-empty {
  font-size: 11px;
  color: var(--lh-gray-400);
  font-style: italic;
  padding: 12px 0;
  text-align: center;
}

/* ---- SAVE INDICATOR + MANUAL SAVE ---- */
.manual-save-btn {
  background: none;
  border: 1px solid var(--lh-gray-600, #555);
  border-radius: 4px;
  color: var(--lh-gray-300, #ccc);
  cursor: pointer;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.manual-save-btn:hover {
  background: var(--lh-gray-700, #333);
  color: #fff;
  border-color: var(--lh-gray-400, #999);
}
.manual-save-btn:active {
  background: var(--lh-green, #22c55e);
  color: #fff;
  border-color: var(--lh-green, #22c55e);
}
.manual-save-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.save-indicator {
  font-family: var(--font-sans);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.save-indicator.si-saving  { color: var(--lh-gold); }
.save-indicator.si-saved   { color: #22c55e; }
.save-indicator.si-unsaved { color: #f59e0b; font-weight: 600; }
.save-indicator.si-error   { color: #ef4444; font-weight: 600; }

/* ---- USER MENU (topbar) ---- */
.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--lh-gold);
  object-fit: cover;
}
.user-name {
  font-size: 12px;
  color: var(--lh-gray-800);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- AUDIT PANEL ---- */
.audit-panel {
  padding: 14px 18px;
  flex: 1;
  overflow-y: auto;
}
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 500px;
  overflow-y: auto;
}
.audit-entry {
  padding: 10px 0;
  border-bottom: 1px solid var(--lh-gray-100);
}
.audit-entry:last-child { border-bottom: none; }
.audit-entry-user {
  font-weight: 600;
  font-size: 11px;
  color: var(--lh-navy);
}
.audit-entry-time {
  font-size: 10px;
  color: var(--lh-gray-400);
  margin-top: 1px;
}
.audit-entry-summary {
  font-size: 11px;
  color: var(--lh-gray-600);
  margin-top: 3px;
  line-height: 1.4;
}

/* ---- Audit toggle button position fix ---- */
#auditToggle {
  right: 52px;
}
#costSheetToggle {
  right: 86px;
}

/* ---- UTILITY SELECTOR (toolbar) ---- */
.utility-select {
  display: flex;
  gap: 4px;
}
.utility-select-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  font-size: 10px;
  font-weight: 600;
  border: 1.5px solid var(--lh-gray-200);
  border-radius: 5px;
  background: var(--lh-white);
  color: var(--lh-gray-500);
  cursor: pointer;
  transition: all .15s;
}
.utility-select-btn:hover {
  border-color: var(--lh-gold);
  color: var(--lh-navy);
  background: var(--lh-gold-faint);
}
.utility-select-btn.active {
  border-color: var(--lh-gold);
  background: var(--lh-gold);
  color: var(--lh-navy-deep);
}
.utility-abbr {
  font-weight: 800;
  font-size: 9px;
  letter-spacing: .04em;
}

/* ---- COST SHEET PANEL ---- */
/* Widen right panel when cost sheet is active */
.panel-right.cost-sheet-wide {
  width: 480px;
  transition: width 0.2s ease;
}

.cost-sheet-panel {
  padding: 10px 14px;
  flex: 1;
  overflow-y: auto;
}

/* Quick stats */
.cost-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-bottom: 10px;
}
.cost-stat {
  text-align: center;
  padding: 6px 2px;
  background: var(--lh-gray-50);
  border-radius: 5px;
  border: 1px solid var(--lh-gray-100);
}
.cost-stat-val {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--lh-navy);
  font-variant-numeric: tabular-nums;
}
.cost-stat-label {
  display: block;
  font-size: 8px;
  color: var(--lh-gray-400);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 1px;
}

/* Config options */
.cost-config {
  background: var(--lh-cream);
  border: 1px solid var(--lh-gray-200);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.specs-hint {
  font-size: 9px;
  color: var(--lh-gray-400);
  font-style: italic;
  margin-bottom: 6px;
}
.cost-config-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
}
.cost-config-label {
  width: 72px;
  flex-shrink: 0;
  font-weight: 500;
  color: var(--lh-gray-500);
}
.cost-config-select {
  flex: 1;
  padding: 2px 4px;
  font-size: 10px;
  border: 1px solid var(--lh-gray-200);
  border-radius: 3px;
  background: var(--lh-white);
  color: var(--lh-gray-800);
}
.cost-config-input {
  width: 48px;
  padding: 2px 4px;
  font-size: 10px;
  border: 1px solid var(--lh-gray-200);
  border-radius: 3px;
  background: var(--lh-white);
  color: var(--lh-gray-800);
  text-align: center;
}
.cost-config-check {
  font-size: 10px;
  color: var(--lh-gray-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.cost-config-check input {
  margin: 0;
  accent-color: var(--lh-gold);
}

/* Cost sections */
.cost-section {
  margin-bottom: 8px;
  border: 1px solid var(--lh-gray-100);
  border-radius: 5px;
  overflow: hidden;
}
.cost-section-title {
  display: flex;
  justify-content: space-between;
  padding: 5px 8px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--lh-gold-dark);
  background: var(--lh-cream);
  border-bottom: 1px solid var(--lh-gray-100);
}
.cost-line-item {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 8px;
  font-size: 10px;
  border-bottom: 1px solid var(--lh-gray-50);
  align-items: center;
}
.cost-line-item:last-of-type {
  border-bottom: none;
}
.cost-item-name {
  color: var(--lh-gray-700);
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
}
.cost-item-qty {
  color: var(--lh-gray-400);
  font-size: 9px;
  white-space: nowrap;
  text-align: right;
}
.cost-item-total {
  font-weight: 600;
  color: var(--lh-navy);
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 52px;
}
.cost-section-subtotal {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--lh-navy);
  background: var(--lh-gray-50);
  border-top: 1px solid var(--lh-gray-200);
}

/* Summary totals */
.cost-summary {
  margin-top: 8px;
  border: 1.5px solid var(--lh-gold);
  border-radius: 6px;
  overflow: hidden;
}
.cost-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 10px;
  font-size: 10px;
  color: var(--lh-gray-700);
  border-bottom: 1px solid var(--lh-gray-100);
}
.cost-summary-row:last-child {
  border-bottom: none;
}
.cost-summary-row span:last-child {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--lh-navy);
}
.cost-summary-eligible {
  background: var(--lh-cream);
  font-weight: 600;
}
.cost-summary-eligible span {
  color: var(--lh-navy) !important;
}
.cost-summary-grand {
  background: var(--lh-navy);
  padding: 6px 10px;
}
.cost-summary-grand span {
  color: #fff !important;
  font-weight: 700 !important;
  font-size: 11px;
}
.cost-summary-rebate {
  background: var(--lh-gold-faint);
}
.cost-summary-rebate span {
  color: var(--lh-gold-dark) !important;
  font-weight: 700 !important;
}

/* Cost sheet column headers (template-style) */
.cost-col-headers {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--lh-gray-400);
  border-bottom: 1.5px solid var(--lh-gray-200);
  margin-bottom: 4px;
}
.cost-col-vals, .cost-item-vals {
  display: flex;
  gap: 4px;
  text-align: right;
  flex-shrink: 0;
}
.cost-col-qty, .cost-col-mat, .cost-col-labor, .cost-col-total,
.cost-item-qty, .cost-item-mat, .cost-item-labor, .cost-item-total {
  width: 48px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cost-item-qty {
  color: var(--lh-gray-400);
  font-size: 9px;
}
.cost-item-mat, .cost-item-labor {
  color: var(--lh-gray-400);
  font-size: 9px;
}

/* ============================================
   CHANGE HISTORY FULL-PAGE MODAL
   ============================================ */
.history-modal {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: #f8f7f4;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-sans);
}
.history-modal.hidden { display: none; }

.history-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  height: 60px;
  background: var(--lh-navy);
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.history-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  flex: 1;
}
.history-project-label {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-modal-close {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.history-modal-close:hover { background: rgba(255,255,255,0.2); }

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}
.history-loading, .history-empty {
  text-align: center;
  padding: 48px 0;
  color: var(--lh-gray-400);
  font-size: 14px;
  line-height: 1.7;
}

.history-entry {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  align-items: start;
  gap: 20px;
  padding: 18px 20px;
  border-radius: 10px;
  background: #fff;
  border: 1.5px solid var(--lh-gray-100);
  margin-bottom: 10px;
  transition: border-color 0.15s;
}
.history-entry:hover { border-color: var(--lh-gold); }
.history-entry-current {
  border-color: var(--lh-gold);
  background: #fdfaf3;
}

.history-entry-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.history-entry-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--lh-navy);
}
.history-entry-user {
  font-size: 11px;
  color: var(--lh-gray-400);
}
.history-entry-summary {
  font-size: 12px;
  color: var(--lh-gray-700);
  line-height: 1.5;
  padding-top: 2px;
}
.history-entry-actions {
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
}
.history-revert-btn {
  background: var(--lh-navy);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.history-revert-btn:hover { background: #3d4560; }
.history-current-badge {
  background: var(--lh-gold);
  color: var(--lh-navy);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.history-no-snap {
  font-size: 10px;
  color: var(--lh-gray-300);
  font-style: italic;
}
