/* ─────────────────────────────────────────────────────────────
   CHAIN SEARCH — paste at bottom of style.css
   ─────────────────────────────────────────────────────────── */

#cs-view { width: 100%; }

.cs-form-wrap {
  max-width: 680px;
  padding: 2rem 2rem 1rem;
}

/* ── Date + hops row ──────────────────────────────────────── */
.cs-date-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.cs-hops-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cs-hops-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted, #6b7280);
}

.cs-hops-field select {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  font-size: 13.5px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23888780' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* ── Summary bar ──────────────────────────────────────────── */
.cs-summary {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--surface, #f9f8f5);
  border: 1px solid var(--border, #e5e2da);
  border-radius: 10px;
  padding: 14px 20px;
  margin: 0 2rem 1rem;
  flex-wrap: wrap;
}

.cs-summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.cs-summary-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary, #1a2e1a);
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1;
}

.cs-summary-label {
  font-size: 11px;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.cs-summary-note {
  flex: 1;
  font-size: 12.5px;
  color: var(--muted, #6b7280);
  margin-left: auto;
  text-align: right;
}

.cs-limit-badge {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
}

/* ── Timeline ─────────────────────────────────────────────── */
.cs-results {
  padding: 0 2rem 3rem;
}

.cs-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cs-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #6b7280);
  padding: 16px 0 8px 36px;
}

.cs-section-other { margin-top: 12px; opacity: 0.7; }

/* ── Node ─────────────────────────────────────────────────── */
.cs-node {
  display: flex;
  gap: 0;
  position: relative;
}

.cs-node-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 36px;
  flex-shrink: 0;
  padding-top: 16px;
}

.cs-node-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary, #1a2e1a);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary, #1a2e1a);
  flex-shrink: 0;
  z-index: 1;
}

.cs-node-dot-minor {
  background: var(--border, #d1d5db);
  box-shadow: 0 0 0 2px var(--border, #d1d5db);
}

.cs-node-line {
  width: 2px;
  flex: 1;
  background: var(--border, #e5e2da);
  margin-top: 4px;
  min-height: 20px;
}

/* ── Node card ────────────────────────────────────────────── */
.cs-node-card {
  flex: 1;
  border: 1px solid var(--border, #e5e2da);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 8px 0 8px 4px;
  background: #fff;
  transition: border-color 0.15s;
}

.cs-node-card:hover { border-color: var(--primary-muted, #4a7c59); }

.cs-node-card-minor {
  background: var(--surface, #f9f8f5);
  border-style: dashed;
}

.cs-node-card-minor:hover { border-color: var(--border, #d1d5db); }

.cs-node-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.cs-article-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--primary, #1a2e1a);
  color: #fff;
  border-radius: 5px;
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cs-article-badge-minor {
  background: var(--border, #d1d5db);
  color: var(--muted, #6b7280);
}

.cs-node-date {
  font-size: 12.5px;
  color: var(--muted, #6b7280);
  font-weight: 500;
}

.cs-amount {
  font-size: 13px;
  font-weight: 700;
  color: #166534;
  background: #dcfce7;
  border-radius: 5px;
  padding: 2px 8px;
  margin-left: auto;
}

/* ── Parties ──────────────────────────────────────────────── */
.cs-parties-row {
  display: grid;
  grid-template-columns: 1fr 28px 1fr;
  gap: 8px;
  align-items: start;
}

.cs-arrow-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 18px;
  color: var(--muted, #6b7280);
  font-size: 16px;
}

.cs-parties-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #6b7280);
  margin-bottom: 4px;
}

.cs-parties-names {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cs-party {
  font-size: 12.5px;
  color: var(--text, #1a1a18);
  line-height: 1.4;
}

.cs-party-seller { color: #7c2d12; }
.cs-party-buyer  { color: #14532d; }
.cs-unknown      { color: var(--muted, #6b7280); font-style: italic; }

.cs-doc-ref {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted, #6b7280);
  display: flex;
  align-items: center;
  gap: 4px;
  border-top: 1px solid var(--border, #f0ede6);
  padding-top: 8px;
}

.cs-schedule {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted, #6b7280);
  line-height: 1.5;
  font-style: italic;
}

@media (max-width: 768px) {
  .cs-date-row { grid-template-columns: 1fr 1fr; }
  .cs-hops-field { grid-column: span 2; }
  .cs-summary { gap: 16px; }
  .cs-results { padding: 0 1rem 3rem; }
  .cs-form-wrap { padding: 1.25rem 1rem; }
}

/* ── Read more button ─────────────────────────────────────────── */
.cs-readmore-btn {
  background: none;
  border: none;
  color: var(--primary, #1a2e1a);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  display: block;
  margin-top: 4px;
}

.cs-readmore-btn:hover { opacity: 0.75; }

.cs-schedule-wrap {
  margin-top: 6px;
  border-top: 1px solid var(--border, #f0ede6);
  padding-top: 8px;
}

/* Full text hidden by default, shown when expanded */
.cs-schedule-full {
  display: none !important;   /* hidden until expanded */
  font-size: 11.5px;
  color: var(--muted, #6b7280);
  line-height: 1.6;
  font-style: italic;
}

.cs-schedule-short {
  font-size: 11.5px;
  color: var(--muted, #6b7280);
  line-height: 1.6;
  font-style: italic;
}

/* When expanded — swap */
.cs-schedule-wrap.cs-expanded .cs-schedule-short { display: none !important; }
.cs-schedule-wrap.cs-expanded .cs-schedule-full  { display: block !important; }

/* ── Summary bar — right below form card ─────────────────────── */
#cs-summary-bar {
  margin: 0 0 0 0;
}

/* ── Loading spinner animation ────────────────────────────────── */
.status-msg.info .ti-loader {
  display: inline-block;
  animation: cs-spin 1s linear infinite;
}

@keyframes cs-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Filter rows ──────────────────────────────────────────────── */
.cs-filters-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 4px;
}

.cs-filters-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #1a1a18);
}

.cs-filters-hint {
  font-size: 11.5px;
  color: var(--muted, #6b7280);
}

.cs-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.cs-filter-row:last-child { margin-bottom: 0; }

.cs-filter-type {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23888780' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.cs-filter-type:focus { border-color: var(--primary, #1a2e1a); }

.cs-filter-value {
  height: 40px;
}

.cs-filter-remove {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted, #6b7280);
  flex-shrink: 0;
}

.cs-filter-remove:hover { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }

.cs-add-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--primary, #1a2e1a);
  background: none;
  border: 1px dashed var(--border, #d1d5db);
  border-radius: 7px;
  padding: 6px 12px;
  cursor: pointer;
  margin-top: 6px;
  font-family: inherit;
}

.cs-add-filter-btn:hover { border-color: var(--primary, #1a2e1a); background: var(--surface, #f9f8f5); }

/* ── Chain depth field ────────────────────────────────────────── */
.cs-depth-field {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cs-depth-field label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  margin: 0;
}

.cs-depth-field select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23888780' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* ── Direction badges ─────────────────────────────────────────── */
.cs-dir-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}

.cs-dir-bwd { background: #eff6ff; color: #1d4ed8; }
.cs-dir-fwd { background: #f0fdf4; color: #15803d; }

.cs-node-fwd .cs-node-dot { background: #15803d; box-shadow: 0 0 0 2px #15803d; }

/* ── Loader close button ──────────────────────────────────────── */
.loader-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border, #e5e2da);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted, #6b7280);
  font-size: 16px;
}

.loader-close-btn:hover { background: var(--surface, #f9f8f5); color: var(--text, #1a1a18); }

.loader-card-inner { position: relative; }

/* ── Mobile responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .cs-filter-row { grid-template-columns: 1fr 1fr auto; }
  .cs-filters-header { flex-direction: column; align-items: flex-start; }
  .cs-depth-field { flex-wrap: wrap; }
  .cs-form-wrap { padding: 1.25rem 1rem; }
  .cs-results { padding: 0 1rem 3rem; }
  .cs-summary { gap: 12px; padding: 12px 14px; }
  .cs-node-card { padding: 12px; }
  .cs-parties-row { grid-template-columns: 1fr 20px 1fr; gap: 4px; }
}

/* ── Dual chain layout ────────────────────────────────────────── */
.cs-dual-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 0 2rem 3rem;
}

.cs-dual-col {
  border: 1px solid var(--border, #e5e2da);
  border-radius: 12px;
  overflow: hidden;
}

.cs-dual-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface, #f9f8f5);
  border-bottom: 1px solid var(--border, #e5e2da);
}

.cs-dual-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #6b7280);
}

.cs-dual-propno {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary, #1a2e1a);
  background: #fff;
  border: 1px solid var(--border, #e5e2da);
  border-radius: 5px;
  padding: 2px 8px;
}

.cs-dual-count {
  font-size: 11.5px;
  color: var(--muted, #6b7280);
  margin-left: auto;
}

.cs-dual-col .cs-timeline { padding: 0 16px 16px; }
.cs-dual-col .cs-node-card { padding: 12px; }
.cs-dual-col .cs-section-title { padding: 12px 0 8px; }

.cs-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted, #6b7280);
  font-size: 13px;
}

/* Too many properties warning */
.status-msg.warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .cs-dual-wrap {
    grid-template-columns: 1fr;
    padding: 0 1rem 3rem;
  }
}

/* ── Mobile fixes ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  #cs-view { padding: 0; }

  .cs-form-wrap {
    padding: 1rem;
    margin: 0;
  }

  .cs-filter-row {
    grid-template-columns: 1fr 1fr auto;
    gap: 6px;
  }

  .cs-filter-type {
    font-size: 12px;
    padding: 0 6px;
    padding-right: 22px;
  }

  .cs-depth-field {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .cs-depth-field select { width: 100%; }

  .cs-filters-header {
    flex-direction: column;
    gap: 4px;
  }

  .cs-filters-hint { font-size: 11px; }

  .cs-node-card { padding: 10px; }

  .cs-parties-row {
    grid-template-columns: 1fr 16px 1fr;
    gap: 4px;
    font-size: 12px;
  }

  .cs-article-badge { font-size: 10px; }
  .cs-node-date     { font-size: 11px; }
  .cs-amount        { font-size: 11px; }

  .cs-summary {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
  }

  .cs-summary-num  { font-size: 18px; }

  .cs-dual-wrap {
    grid-template-columns: 1fr;
    padding: 0 0.75rem 2rem;
    gap: 16px;
  }

  .cs-results {
    padding: 0 0.75rem 2rem;
  }
}

/* ── Name highlight ───────────────────────────────────────────── */
.cs-name-highlight {
  background: #fff49f;
  color: #713f12;
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 600;
  font-style: normal;
}
/* ── Current owner badge ──────────────────────────────────────── */
.cs-current-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #1a5c2a;
  background: #e6f4ea;
  border: 1px solid #b7dfbf;
  border-radius: 20px;
  padding: 2px 9px;
  margin-left: auto;
}

.cs-current-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,0.3);
  animation: cs-dot-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes cs-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34,197,94,0.3); }
  50%       { box-shadow: 0 0 0 4px rgba(34,197,94,0.15); }
}

/* Current node card — subtle green left border */
.cs-node-card-current {
  border-left: 3px solid #22c55e;
}

/* Current node timeline dot */
.cs-node-dot-current {
  background: #22c55e !important;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.25) !important;
  width: 12px !important;
  height: 12px !important;
}

/* ── Amount row below parties ─────────────────────────────────── */
.cs-amount-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--cs-border, #f0ede8);
}

.cs-amount-val {
  font-size: 15px;
  font-weight: 700;
  color: #1a5c2a;
  letter-spacing: -0.01em;
}

.cs-amount-label {
  font-size: 11px;
  color: #888780;
  font-style: italic;
}

/* Amount nil state — dash shown in muted colour */
.cs-amount-nil {
  color: #b4b2a9 !important;
  font-weight: 500 !important;
  font-size: 13px !important;
}

/* ── Amount green highlight ───────────────────────────────────── */
.cs-amount-green {
  background: #dcfce7;
  color: #166534;
  padding: 2px 10px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 700;
}

/* ── Date lavender ────────────────────────────────────────────── */
.cs-node-date-lavender {
  color: #7c3aed;
  font-weight: 500;
}

/* ── Property type label in dual header ──────────────────────── */
.cs-dual-type-label {
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 1px 7px;
}

/* ── Single chain wrap — summary + timeline same width ───────── */
.cs-single-wrap {
  display: flex;
  flex-direction: column;
}

.cs-summary-box {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--surface, #f9f8f5);
  border: 1px solid var(--border, #e5e2da);
  border-radius: 10px 10px 0 0;
  border-bottom: none;
  padding: 14px 20px;
  flex-wrap: wrap;
}

.cs-summary-box .cs-summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.cs-summary-box .cs-summary-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary, #1a2e1a);
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1;
}

.cs-summary-box .cs-summary-label {
  font-size: 11px;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.cs-summary-box .cs-summary-note {
  flex: 1;
  font-size: 12.5px;
  color: var(--muted, #6b7280);
  margin-left: auto;
  text-align: right;
}

/* Timeline connects flush to summary box */
.cs-single-wrap .cs-timeline {
  border: 1px solid var(--border, #e5e2da);
  border-radius: 0 0 10px 10px;
  padding: 0 16px 16px;
}

/* ── Dual chain — override old header, use summary-box style ─── */
.cs-dual-col .cs-dual-header { display: none; }
.cs-dual-col .cs-single-wrap { height: 100%; }
.cs-dual-col .cs-summary-box {
  border-radius: 10px 10px 0 0;
  border: 1px solid var(--border, #e5e2da);
  border-bottom: none;
}