/* ---- Homepage layout, built on the shared theme ---- */
#app { max-width: 1200px; margin: 0 auto; padding: 0 16px 40px; }

.page-heading {
  font-size: 1.4rem;
  margin: 18px 0 14px;
}

/* Card panels for the control groups */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.panel-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.panel-row label { color: var(--text); font-weight: 500; }
.field-hint { color: var(--text-muted); font-style: italic; font-size: 0.82rem; }

.api-input { width: 260px; }

/* Inline check labels */
.check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  cursor: pointer;
}

/* Tabs */
.tabs { display: flex; gap: 4px; margin: 16px 0 0; flex-wrap: wrap; }
.tab {
  padding: 7px 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  list-style: none;
  transition: background 0.15s, color 0.15s;
}
.tab:hover { background: var(--surface-3); color: var(--text); }
.tab.active { background: var(--surface-3); color: var(--primary); border-color: var(--primary-dim); border-bottom-color: var(--surface-3); }
.tab.disabled { opacity: 0.5; pointer-events: none; }

/* Table */
#dataTableWrapper { margin-top: 0; }
#dataTableScroll { overflow-x: auto; border-radius: 0 var(--radius) var(--radius) var(--radius); }
#dataTable { margin: 0; }
th.sort-asc::after  { content: '▲'; position: absolute; right: 10px; color: var(--text-muted); font-size: 0.7em; }
th.sort-desc::after { content: '▼'; position: absolute; right: 10px; color: var(--text-muted); font-size: 0.7em; }
th { position: relative; cursor: pointer; }

/* Profile links in the data table */
.profile-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.profile-link:hover { text-decoration: underline; }

/* Tooltip */
.tooltip { position: relative; display: inline-block; }
.tooltip-icon { font-size: 1.1em; color: var(--primary); line-height: 1; cursor: help; }
.tooltip .tooltiptext {
  visibility: hidden; opacity: 0; transition: opacity 0.2s ease-in-out;
  position: absolute; top: 130%; left: 50%; transform: translateX(-50%); margin-top: 0.25rem;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: var(--radius-sm); white-space: nowrap; z-index: 1000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5); font-size: 0.82rem; font-style: normal;
}
.tooltip:hover .tooltiptext { visibility: visible; opacity: 1; }
@media (max-width: 300px) { .tooltip .tooltiptext { left: 0; transform: none; } }

/* Custom field picker */
#customControls { margin: 14px 0; }
#customToggle {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 8px 12px; text-align: center; cursor: pointer; border-radius: var(--radius);
  font-weight: 600;
}
#customContent {
  position: relative; border: 1px solid var(--border); border-top: none;
  padding: 16px; background: var(--surface); border-radius: 0 0 var(--radius) var(--radius);
}
.field-box { flex: 1; min-width: 160px; }
.field-box strong { color: var(--primary); display: block; margin-bottom: 6px; font-size: 0.85rem; }
.field-list {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  max-height: 250px; overflow-y: auto; background: var(--bg);
}
.field-row { padding: 6px 10px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 0.85rem; }
.field-row:last-child { border-bottom: none; }
.field-row:hover { background: var(--surface-2); }
.field-row.selected { background: var(--primary); color: #000; font-weight: 600; }
.field-list hr { border: none; border-top: 1px solid var(--border); margin: 0; }

/* Footer */
footer { margin-top: 3rem; padding: 1.5rem; font-size: 0.85rem; line-height: 1.6; }
footer p { margin: 0.5rem 0; }
footer ul { margin: 0.5rem 0; padding-left: 1.5rem; }

@media (max-width: 768px) {
  .panel-row { flex-direction: column; align-items: stretch; }
  .api-input { width: 100%; }
}

