/* ══════════════════════════════════════════════════════════════════════
   ACTIVITY INSPECTOR — professional light side panel (redesign)
   Docked to the right edge, full height, clean & compact. Class names match
   the markup in 007-gantt-activity-inspector-compact-override.js.
   ══════════════════════════════════════════════════════════════════════ */

#gap-panel {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  left: auto !important;
  bottom: 0 !important;
  z-index: 2147483002;
  width: 472px;
  max-width: calc(100vw - 12px);
  max-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  background: #FFFFFF;
  border: none;
  border-left: 1px solid #E6E1D6;
  border-radius: 0;
  box-shadow: -18px 0 48px rgba(27, 26, 23, .12);
  color: #1B1A17;
  font-family: 'DM Sans', system-ui, sans-serif;
  animation: gapSlideIn .22s cubic-bezier(.22, .61, .36, 1);
  scrollbar-width: thin;
  scrollbar-color: #D7D0C2 transparent;
}
@keyframes gapSlideIn {
  from { transform: translateX(28px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ─── Header ─────────────────────────────────────────────────────────── */
#gap-panel .gap-hdr {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid #EEEAE0;
  background: #FCFAF5;
  flex-shrink: 0;
}
#gap-panel .gap-id {
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  letter-spacing: .02em;
  color: #6B665C;
  background: #F1EDE3;
  border: 1px solid #E6E1D6;
  padding: 3px 9px;
  border-radius: 7px;
  flex-shrink: 0;
}
#gap-panel .gap-namewrap { flex: 1; min-width: 0; }
#gap-panel .gap-name {
  display: block;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: #1B1A17;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#gap-panel .gap-subttl {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: #8A8579;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#gap-panel .gap-x {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #F1EDE3;
  border: 1px solid #E6E1D6;
  color: #6B665C;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  transition: background .14s, color .14s;
  flex-shrink: 0;
}
#gap-panel .gap-x:hover { background: #E9E3D6; color: #1B1A17; }

/* ─── Summary stat cards ─────────────────────────────────────────────── */
#gap-panel .gap-top { padding: 14px 18px 0; flex-shrink: 0; }
#gap-panel .gap-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
#gap-panel .gap-card {
  background: #FAF8F3;
  border: 1px solid #ECE7DC;
  border-radius: 10px;
  padding: 9px 9px 8px;
  min-width: 0;
}
#gap-panel .gap-card-v {
  font-size: 14.5px;
  font-weight: 800;
  color: #1B1A17;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#gap-panel .gap-card-l {
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #9A9488;
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Tabs ───────────────────────────────────────────────────────────── */
#gap-panel .gap-tabs {
  display: flex;
  gap: 6px;
  padding: 14px 18px 10px;
  flex-shrink: 0;
}
#gap-panel .gap-tab {
  flex: 1;
  height: 34px;
  border-radius: 9px;
  border: 1px solid #E6E1D6;
  background: #FFFFFF;
  color: #6B665C;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
#gap-panel .gap-tab:hover { background: #FAF8F3; }
#gap-panel .gap-tab.active {
  background: #1B1A17;
  color: #FFFFFF;
  border-color: #1B1A17;
}

/* ─── Body ───────────────────────────────────────────────────────────── */
#gap-panel .gap-body {
  padding: 4px 18px 20px;
  overflow: auto;
  flex: 1;
}
#gap-panel .gap-pane[hidden] { display: none !important; }

/* ─── Activity edit card (name / duration / type) — its own section,
       separate from the relations tab ───────────────────────────────── */
#gap-panel .gap-act-edit {
  background: #FBF9F4;
  border: 1px solid #ECE7DC;
  border-radius: 12px;
  padding: 12px;
  margin: 14px 18px 2px;
  flex-shrink: 0;
}
#gap-panel .gap-act-head { margin-bottom: 9px; }
#gap-panel .gap-act-head-t {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #1B1A17;
}
#gap-panel .gap-field--full { width: 100%; margin-bottom: 9px; }
#gap-panel .gap-act-grid {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 8px;
  align-items: end;
}
#gap-panel .gap-act-grid .gap-btn.save { height: 32px; align-self: end; }
#gap-panel .gap-act-hint {
  font-size: 10px;
  color: #9A9488;
  line-height: 1.5;
  margin-top: 9px;
}

/* Relations: side by side — predecessors (left) / successors (right) */
#gap-panel .gap-rel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
#gap-panel .gap-col {
  background: #FBF9F4;
  border: 1px solid #ECE7DC;
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
}
#gap-panel .gap-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
#gap-panel .gap-col-title {
  font-size: 10.5px;
  font-weight: 800;
  color: #1B1A17;
  text-transform: uppercase;
  letter-spacing: .07em;
}
#gap-panel .gap-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #1B1A17;
  border: none;
  font-size: 10.5px;
  font-weight: 800;
  color: #FFFFFF;
}
#gap-panel .gap-rel-list,
#gap-panel .gap-res-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#gap-panel .gap-rel-card {
  background: #FFFFFF;
  border: 1px solid #E8E3D8;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#gap-panel .gap-rel-name {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  color: #1B1A17;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  /* Show the FULL activity name (wraps to multiple lines instead of clipping). */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
#gap-panel .gap-rel-name:hover { color: #8A6D3B; text-decoration: underline; }
#gap-panel .gap-rel-sub {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: #9A9488;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Wrap so the relation controls stay readable inside narrow side-by-side
   columns: type on its own row, then lag · Save · X on the next row. */
#gap-panel .gap-edit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
#gap-panel .gap-edit-row select.gap-sel { flex: 1 1 100%; }
#gap-panel .gap-edit-row input.gap-inp { flex: 1 1 44px; min-width: 44px; }
#gap-panel .gap-edit-row .gap-btn.ok { flex: 1 1 auto; }
#gap-panel .gap-edit-row .gap-btn.rm { flex: 0 0 32px; min-width: 32px; }

/* ─── Inputs & buttons ───────────────────────────────────────────────── */
#gap-panel select.gap-sel,
#gap-panel input.gap-inp {
  width: 100%;
  height: 32px;
  background: #FFFFFF;
  border: 1px solid #E0DACD;
  border-radius: 8px;
  color: #1B1A17;
  font-size: 12px;
  font-weight: 600;
  padding: 0 9px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#gap-panel select.gap-sel:focus,
#gap-panel input.gap-inp:focus {
  border-color: #B79B6A;
  box-shadow: 0 0 0 3px rgba(183, 155, 106, .16);
}
#gap-panel input.gap-inp[type=number] { text-align: center; }
#gap-panel .gap-btn {
  height: 32px;
  border-radius: 8px;
  border: 1px solid #E0DACD;
  background: #FFFFFF;
  color: #4B463C;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .1s;
}
#gap-panel .gap-btn:hover { background: #FAF8F3; }
#gap-panel .gap-btn:active { transform: translateY(1px); }
#gap-panel .gap-btn.ok,
#gap-panel .gap-btn.save {
  background: #1F9B50;
  border-color: #1A8746;
  color: #FFFFFF;
}
#gap-panel .gap-btn.ok:hover,
#gap-panel .gap-btn.save:hover { background: #1A8746; }
#gap-panel .gap-btn.save { min-width: 60px; }
#gap-panel .gap-btn.rm {
  background: #FFF1F0;
  border-color: #F3C9C5;
  color: #C0392B;
}
#gap-panel .gap-btn.rm:hover { background: #FCE3E0; }

#gap-panel .gap-empty {
  padding: 16px 12px;
  border: 1px dashed #DCD6C8;
  border-radius: 10px;
  font-size: 11px;
  color: #9A9488;
  text-align: center;
  background: #FBF9F4;
}

/* ─── Resources tab ──────────────────────────────────────────────────── */
#gap-panel .gap-res-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
#gap-panel .gap-hero-main {
  grid-column: 1 / -1;
  background: #FAF8F3;
  border: 1px solid #ECE7DC;
  border-radius: 11px;
  padding: 11px 13px;
  min-width: 0;
}
#gap-panel .gap-hero-title {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #9A9488;
}
#gap-panel .gap-hero-value {
  font-size: 13.5px;
  font-weight: 800;
  color: #1B1A17;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#gap-panel .gap-res-card {
  background: #FBF9F4;
  border: 1px solid #ECE7DC;
  border-radius: 12px;
  padding: 12px;
}
#gap-panel .gap-res-head {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}
#gap-panel .gap-res-title { flex: 1; min-width: 0; }
#gap-panel .gap-lbl {
  display: block;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #9A9488;
  margin-bottom: 5px;
}
#gap-panel .gap-res-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
#gap-panel .gap-field { display: flex; flex-direction: column; gap: 5px; }
#gap-panel .gap-field span {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #9A9488;
}
#gap-panel .gap-res-meta,
#gap-panel .gap-footnote {
  font-size: 10px;
  color: #9A9488;
  line-height: 1.55;
}
#gap-panel .gap-res-meta { margin-top: 8px; }
#gap-panel .gap-footnote {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #FBF9F4;
  border: 1px solid #ECE7DC;
}

/* Slim scrollbar */
#gap-panel .gap-body::-webkit-scrollbar { width: 8px; }
#gap-panel .gap-body::-webkit-scrollbar-thumb {
  background: #DCD6C8; border-radius: 999px; border: 2px solid #FFFFFF;
}

/* Narrow screens: panel becomes full-width sheet */
@media (max-width: 540px) {
  #gap-panel { width: 100vw; border-left: none; }
  #gap-panel .gap-res-grid { grid-template-columns: 1fr; }
  #gap-panel .gap-rel-grid { grid-template-columns: 1fr; }
}
