.fl-research-shell {
  --fl-research-accent: #22d3a7;
  --fl-research-blue: #63b3ed;
  --fl-research-warning: #f5b942;
  display: grid;
  grid-template-columns: minmax(230px, 290px) minmax(0, 1fr);
  width: 100%;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 8px;
  background: var(--panel-bg, #151b23);
  color: var(--text-main, #dbe4ee);
}

.fl-research-rail {
  min-width: 0;
  border-right: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  background: rgba(7, 11, 17, 0.34);
}

.fl-research-rail__head,
.fl-research-main__head,
.fl-research-section__head,
.fl-research-actions,
.fl-research-head-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fl-research-rail__head,
.fl-research-main__head {
  padding: 17px 18px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
}

.fl-research-rail__head h2,
.fl-research-main__head h2,
.fl-research-section h3 {
  margin: 0;
  letter-spacing: 0;
}

.fl-research-rail__head h2 { font-size: 18px; }
.fl-research-main__head h2 { margin-top: 3px; font-size: 20px; }
.fl-research-section h3 { font-size: 15px; }
.fl-research-rail__head p,
.fl-research-main__head p,
.fl-research-section__head p,
.fl-research-main__head span,
.fl-research-footnote {
  margin: 3px 0 0;
  color: var(--text-muted, #8793a1);
  font-size: 12px;
  line-height: 1.5;
}

.fl-research-list {
  display: flex;
  flex-direction: column;
  max-height: 690px;
  overflow-y: auto;
}

.fl-research-list__item {
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.fl-research-list__item:hover,
.fl-research-list__item.is-active { background: rgba(34, 211, 167, 0.08); }
.fl-research-list__item.is-active { box-shadow: inset 3px 0 0 var(--fl-research-accent); }
.fl-research-list__item strong,
.fl-research-list__item span,
.fl-research-list__item small { display: block; overflow-wrap: anywhere; }
.fl-research-list__item strong { color: #f1f5f8; font-size: 14px; }
.fl-research-list__item span { margin-top: 5px; color: #aeb9c3; font-size: 12px; }
.fl-research-list__item small { margin-top: 4px; color: #758290; font-size: 11px; }

.fl-research-main {
  min-width: 0;
  max-height: 760px;
  overflow-y: auto;
}

.fl-research-main__head {
  position: sticky;
  top: 0;
  z-index: 3;
  align-items: flex-start;
  background: #161d26;
}

.fl-research-main__head > div:first-child { min-width: 0; }
.fl-research-main__head span { display: block; max-width: 760px; overflow-wrap: anywhere; }
.fl-research-head-actions { flex: 0 0 auto; }

.fl-research-btn,
.fl-research-form input,
.fl-research-form textarea,
.fl-research-form select,
.fl-research-inline-form input,
.fl-research-inline-form textarea,
.fl-research-inline-form select,
.fl-research-head-actions select {
  border: 1px solid #3d4a58;
  border-radius: 6px;
  background: #1c2530;
  color: #e5edf3;
  font: inherit;
}

.fl-research-btn {
  min-height: 36px;
  padding: 7px 12px;
  cursor: pointer;
}
.fl-research-btn:hover,
.fl-research-btn:focus-visible { border-color: var(--fl-research-blue); outline: none; }
.fl-research-btn--primary { border-color: #159a79; background: #16866d; color: #fff; font-weight: 700; }

.fl-research-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
}
.fl-research-metrics > div { padding: 16px 18px; border-right: 1px solid var(--border, rgba(255, 255, 255, 0.08)); }
.fl-research-metrics strong,
.fl-research-metrics span { display: block; }
.fl-research-metrics strong { color: var(--fl-research-blue); font-size: 24px; }
.fl-research-metrics span { margin-top: 2px; color: #7f8c99; font-size: 11px; }

.fl-research-comparison {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 16px 18px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  background: rgba(245, 185, 66, 0.06);
}
.fl-research-comparison.is-ready { background: rgba(34, 211, 167, 0.06); }
.fl-research-comparison > div { min-width: 0; padding-right: 14px; }
.fl-research-comparison small,
.fl-research-comparison strong { display: block; }
.fl-research-comparison small { color: #7f8c99; font-size: 11px; }
.fl-research-comparison strong { margin-top: 4px; color: #f4f7f9; font-size: 17px; overflow-wrap: anywhere; }
.fl-research-comparison p { grid-column: 1 / -1; margin: 12px 0 0; color: #8f9ba7; font-size: 11px; }

.fl-research-section {
  padding: 18px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
}
.fl-research-section__head { align-items: flex-start; margin-bottom: 13px; }
.fl-research-table-wrap { overflow-x: auto; }
.fl-research-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.fl-research-table th,
.fl-research-table td { padding: 9px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); text-align: left; white-space: nowrap; }
.fl-research-table th { color: #7f8c99; font-weight: 600; }
.fl-research-table td { color: #cbd5dd; }

.fl-research-form,
.fl-research-inline-form { color: #cdd7df; font-size: 12px; }
.fl-research-form label,
.fl-research-inline-form label { display: grid; gap: 5px; min-width: 0; }
.fl-research-form input,
.fl-research-form textarea,
.fl-research-form select,
.fl-research-inline-form input,
.fl-research-inline-form textarea,
.fl-research-inline-form select,
.fl-research-head-actions select { width: 100%; min-height: 36px; padding: 7px 9px; }
.fl-research-form textarea,
.fl-research-inline-form textarea { resize: vertical; line-height: 1.5; }
.fl-research-form input:focus,
.fl-research-form textarea:focus,
.fl-research-form select:focus,
.fl-research-inline-form input:focus,
.fl-research-inline-form textarea:focus,
.fl-research-inline-form select:focus { border-color: var(--fl-research-blue); outline: none; }

.fl-research-create { padding: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.fl-research-create > label + label,
.fl-research-dbr-form > label + label { margin-top: 10px; }
.fl-research-form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.fl-research-actions { justify-content: flex-end; margin-top: 12px; }
.fl-research-inline-form { display: grid; grid-template-columns: minmax(150px, 0.7fr) minmax(260px, 1.8fr) minmax(170px, 0.8fr) auto; gap: 12px; align-items: end; padding-top: 4px; }
.fl-research-inline-form__wide { min-width: 0; }
.fl-research-score-form { margin-top: 15px; grid-template-columns: minmax(170px, 0.7fr) minmax(300px, 2fr) auto; }
.fl-research-footnote { margin-top: 10px; }

.fl-research-dbr-list { margin: 0; padding: 0; list-style: none; }
.fl-research-dbr-list li { padding: 13px 0; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.fl-research-dbr-list li > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fl-research-dbr-list strong { color: #edf3f7; }
.fl-research-dbr-list span { color: var(--fl-research-accent); font-size: 11px; }
.fl-research-dbr-list p { margin: 7px 0 0; color: #aeb9c3; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.fl-research-dbr-form { margin-top: 15px; padding-top: 15px; border-top: 1px solid rgba(255, 255, 255, 0.09); }
.fl-research-dbr-form textarea { min-height: 76px; }

.fl-research-empty,
.fl-research-loading,
.fl-research-error { padding: 30px 16px; color: #7f8c99; text-align: center; }
.fl-research-error { color: #ff7b86; }

@media (max-width: 920px) {
  #admin-overlay .admin-h {
    display: block !important;
    min-width: 0;
  }

  #admin-overlay .admin-h > h2 {
    width: auto !important;
    white-space: nowrap;
  }

  #admin-overlay .admin-h > div {
    display: flex !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    overscroll-behavior-x: contain;
    padding-bottom: 8px !important;
  }

  #admin-overlay .admin-h .btn-k,
  #admin-overlay .admin-h form,
  #admin-overlay .admin-h select {
    width: auto !important;
    min-width: max-content;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    word-break: keep-all;
    writing-mode: horizontal-tb !important;
  }

  .fl-research-shell { grid-template-columns: minmax(200px, 240px) minmax(0, 1fr); }
  .fl-research-inline-form,
  .fl-research-score-form { grid-template-columns: 1fr 1fr; }
  .fl-research-inline-form__wide { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .fl-research-shell { display: block; min-height: 0; }
  .fl-research-rail { border-right: 0; border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1)); }
  .fl-research-list { max-height: 220px; }
  .fl-research-main { max-height: none; }
  .fl-research-main__head { position: static; display: block; }
  .fl-research-head-actions { margin-top: 12px; }
  .fl-research-metrics,
  .fl-research-comparison { grid-template-columns: 1fr 1fr; }
  .fl-research-comparison p { grid-column: 1 / -1; }
  .fl-research-inline-form,
  .fl-research-score-form,
  .fl-research-form__grid { grid-template-columns: 1fr; }
  .fl-research-inline-form__wide { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .fl-research-btn,
  .fl-research-list__item { scroll-behavior: auto; }
}
