* { box-sizing: border-box; }
:root {
  --il-orange: #FF5F05;
  --il-blue: #13294B;
  --il-industrial: #1D58A7;
  --il-storm: #707372;
  --il-storm-95: #F4F4F4;
  --il-storm-80: #C6C7C6;
  --surface: #FFFFFF;
  --surface-muted: #F8FAFC;
  --border: #E5E7EB;
  --text: #1F2937;
  --text-strong: #111827;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, #f8fafc 0%, var(--il-storm-95) 100%);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--il-industrial); }
a:hover { color: var(--il-blue); }

.header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(255,255,255,0.96);
  border-bottom: 1px solid rgba(19,41,75,0.08);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}
.header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--il-orange);
}
.header__brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.header__icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(19,41,75,0.12);
  flex: 0 0 auto;
}
.header__brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.header__brand {
  font-weight: 800;
  font-size: 18px;
  color: var(--il-blue);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.header__subtitle {
  color: var(--il-storm);
  font-size: 13px;
  line-height: 1.2;
}
.header__nav {
  margin-left: auto;
}
.header__nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(19,41,75,0.10);
  background: #f8fafc;
  color: var(--il-blue);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.header__nav-link:hover {
  background: #eef4fb;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}
.sidebar {
  background: rgba(255,255,255,0.95);
  border-right: 1px solid rgba(19,41,75,0.08);
  padding: 18px 14px 22px;
  position: sticky;
  top: 64px;
  align-self: start;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}
.sidebar__section { margin-bottom: 20px; }
.sidebar__title {
  font-weight: 800;
  font-size: 12px;
  color: var(--il-blue);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.sidebar__link {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-strong);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.sidebar__link:hover {
  background: #eef4fb;
  color: var(--il-blue);
  transform: translateX(1px);
}
.sidebar details {
  border: 1px solid rgba(19,41,75,0.08);
  border-radius: 14px;
  background: #fbfcfe;
  padding: 8px 10px;
}
.sidebar summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--text-strong);
  list-style: none;
}
.sidebar summary::-webkit-details-marker { display: none; }

.tree__link { color: var(--text-strong); text-decoration: none; }
.tree__link:hover { text-decoration: underline; color: var(--il-industrial); }
.tree__children { margin-left: 10px; margin-top: 6px; }
.tree__item { margin: 4px 0; }

.inline-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.checkbox-grid label {
  font-weight: 700;
  font-size: 12px;
  color: #374151;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  padding: 6px 10px;
  border-radius: 999px;
  line-height: 1;
}
.checkbox-grid input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
}

.columns-details {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
}
.columns-details summary {
  cursor: pointer;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
  font-size: 12px;
  color: #374151;
}
.columns-details summary:hover { background: #f9fafb; }
.columns-details summary::-webkit-details-marker { display: none; }
.columns-panel {
  padding: 10px;
  border-top: 1px solid #e5e7eb;
}
.badge {
  font-size: 11px;
  font-weight: 900;
  color: #111827;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  padding: 3px 8px;
  border-radius: 999px;
}
.columns-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.link-btn {
  background: transparent;
  border: 0;
  padding: 0;
  font-weight: 900;
  font-size: 12px;
  color: #111827;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 12px;
  flex-wrap: wrap;
}
.pagination a {
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 10px;
  text-decoration: none;
  color: #111827;
  font-weight: 700;
  font-size: 12px;
}
.pagination a:hover { background: #f9fafb; }
.pagination .disabled { opacity: 0.4; pointer-events: none; }
.pagination .pageinfo { font-size: 12px; color: #6b7280; margin-right: 6px; }

.content {
  padding: 24px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.card {
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(19,41,75,0.08);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(15,23,42,0.05), 0 1px 2px rgba(15,23,42,0.04);
}
.card__title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 12px 0;
  color: var(--il-blue);
  letter-spacing: -0.01em;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-stack .form-row { margin-top: 10px; }
.form-stack .form-row:first-of-type { margin-top: 0; }
.form-stack .field { min-width: 0; }

.field label {
  display: block;
  font-size: 12px;
  color: #374151;
  font-weight: 800;
  margin-bottom: 6px;
}
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  background: white;
  outline: none;
  color: var(--text-strong);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.field textarea {
  resize: vertical;
}
.field input:not([type="checkbox"]):not([type="radio"]):focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(19,41,75,0.35);
  box-shadow: 0 0 0 3px rgba(19,41,75,0.08);
}

.input-with-clear {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.input-with-clear input,
.input-with-clear textarea,
.input-with-clear select {
  min-width: 0;
}
.input-clear-btn {
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #111827;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.textarea-with-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}
.textarea-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
button,
.btn-primary,
.btn-secondary {
  border: 0;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
button:hover,
.btn-primary:hover,
.btn-secondary:hover {
  transform: translateY(-1px);
}
button:disabled,
.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn-primary {
  background: var(--il-blue);
  color: white;
  box-shadow: 0 10px 24px rgba(19,41,75,0.14);
}
.btn-primary:hover { background: #0f223f; }
.btn-secondary {
  background: #f3f4f6;
  color: #111827;
  border: 1px solid rgba(19,41,75,0.08);
}
.btn-secondary:hover { background: #e8edf4; color: var(--il-blue); }

.table-wrap {
  overflow-x: auto;
  border-radius: 16px;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}
th, td {
  padding: 10px 10px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
  text-align: left;
  vertical-align: top;
}
th {
  background: #f8fafc;
  font-weight: 900;
  color: var(--il-blue);
}
tbody tr:nth-child(even) td {
  background: #fcfdff;
}
tr:hover td { background: #f6f9fd; }
.muted { color: #6b7280; }

details:not(.columns-details) > summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--text-strong);
}

a.btn-secondary,
a.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.pill {
  font-size: 12px;
  font-weight: 700;
  color: #111827;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  padding: 6px 10px;
  border-radius: 999px;
}
.fc-pos-strong { background: #86efac; }
.fc-pos-med { background: #bbf7d0; }
.fc-pos-light { background: #dcfce7; }
.fc-neg-strong { background: #ea580c; color: white; }
.fc-neg-med { background: #fb923c; }
.fc-neg-light { background: #fed7aa; }
.fc-neutral { background: transparent; }

.log2fc-cell { transition: background-color 0.15s ease-in-out; }
.log2fc-cell.fc-pos-strong { background: #22c55e !important; color: #052e16; }
.log2fc-cell.fc-pos-med { background: #86efac !important; color: #14532d; }
.log2fc-cell.fc-pos-light { background: #dcfce7 !important; color: #166534; }
.log2fc-cell.fc-neg-strong { background: #dc2626 !important; color: #ffffff; }
.log2fc-cell.fc-neg-med { background: #fb923c !important; color: #7c2d12; }
.log2fc-cell.fc-neg-light { background: #ffedd5 !important; color: #9a3412; }
.log2fc-cell.fc-neutral { background: transparent !important; color: inherit; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.summary-metric {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px;
  background: #f9fafb;
}
.summary-metric__label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #6b7280;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.summary-metric__value {
  display: block;
  font-size: 20px;
  font-weight: 900;
  color: var(--il-blue);
}
.network-embed {
  margin-top: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #ffffff;
  overflow: auto;
  padding: 10px;
  min-height: 420px;
  max-width: 100%;
  width: 100%;
  min-width: 0;
}
.network-embed--wide {
  min-height: 520px;
}
.network-embed--ppi {
  height: 560px;
  min-height: 0;
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
}
.network-embed svg {
  width: 100%;
  height: auto;
  display: block;
}
.network-embed--ppi svg {
  display: block;
  width: auto;
  height: auto;
  min-width: 1800px;
  max-width: none;
}
.scroll-frame__hint {
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
}
.download-buffer {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.profile-grid-table th,
.profile-grid-table td {
  white-space: nowrap;
  text-align: center;
}
.profile-grid-table th:first-child,
.profile-grid-table td:first-child {
  text-align: left;
  white-space: normal;
  position: sticky;
  left: 0;
  background: #ffffff;
  z-index: 1;
}
.profile-grid-table thead th:first-child {
  background: #f9fafb;
  z-index: 2;
}


@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .header {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 14px 16px;
  }
  .header__nav {
    width: 100%;
    margin-left: 0;
  }
  .header__nav-link {
    width: 100%;
    justify-content: center;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    top: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid rgba(19,41,75,0.08);
  }
  .content {
    padding: 16px;
  }
  .form-row {
    grid-template-columns: 1fr !important;
  }
  .textarea-with-actions,
  .input-with-clear {
    grid-template-columns: 1fr;
  }
  .textarea-actions {
    flex-direction: row;
  }
  .network-embed--ppi {
    height: 480px;
  }
}
