/* ============================================================================
   IPPRA KPI Tool — Screen-level components
   auth · dashboard/stats · charts · report form panels · reports table ·
   report show · admin tables. Depends on tokens.css + base.css.
   ========================================================================= */

/* ============================================================================
   AUTH (Devise sign-in / account) — centered card
   ========================================================================= */
.auth-shell {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
}
.auth-container {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  padding: var(--space-10);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.auth-container .auth-mark {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-md);
  background: var(--brand);
  color: var(--brand-contrast);
  font-family: var(--font-heading);
  font-weight: var(--weight-black);
  font-size: var(--text-lg);
}
.auth-container h2 {
  color: var(--text-heading);
  font-size: var(--text-2xl);
  margin: 0 0 var(--space-2);
  text-align: center;
}
.auth-container .auth-sub { text-align: center; color: var(--text-muted); font-size: var(--text-sm); margin-bottom: var(--space-6); }
.auth-container .field { margin-bottom: var(--space-4); }
.auth-container input[type="text"],
.auth-container input[type="email"],
.auth-container input[type="password"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-heading);
  padding: var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.auth-container input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus-ring); }
.auth-container .field em { font-size: var(--text-xs); color: var(--text-muted); font-style: normal; }
.auth-remember { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-body); }
.auth-remember input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); }
.auth-container .actions { margin-top: var(--space-6); }
.auth-container input[type="submit"] {
  width: 100%;
  background-color: var(--brand);
  color: var(--brand-contrast);
  border: none;
  padding: var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}
.auth-container input[type="submit"]:hover { background-color: var(--brand-dark); }
.auth-links { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--border); text-align: center; }
.auth-links a { color: var(--brand); font-size: var(--text-sm); font-weight: var(--weight-semibold); display: block; margin: var(--space-2) 0; }

/* ============================================================================
   DASHBOARD — hero, reminders, stat tiles, chart frame, quick actions
   ========================================================================= */
.dash-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-10) var(--space-8);
  text-align: center;
  margin-bottom: var(--space-5);
  position: relative;
  overflow: hidden;
}
.dash-hero::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--accent-soft));
}
.dash-hero h1 { font-size: var(--text-3xl); color: var(--brand); margin-bottom: var(--space-2); }
.dash-hero .eyebrow {
  font-size: var(--text-xs); font-weight: var(--weight-bold); letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--accent-soft); margin-bottom: var(--space-2);
}
.dash-hero .welcome { color: var(--text-muted); font-size: var(--text-md); }

/* Reminder banners (review / drafts) */
.reminder-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-bottom: var(--space-6); }
.reminder {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid;
}
.reminder .r-icon { font-size: var(--text-2xl); line-height: 1; flex: 0 0 auto; }
.reminder .r-body { flex: 1 1 auto; }
.reminder .r-title { font-family: var(--font-heading); font-weight: var(--weight-bold); font-size: var(--text-md); color: var(--text-heading); }
.reminder .r-sub { font-size: var(--text-sm); color: var(--text-muted); }
.reminder-warning { background: var(--certified-bg); border-color: color-mix(in srgb, var(--certified-fg) 30%, transparent); }
.reminder-info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info-fg) 28%, transparent); }

/* Stat tiles */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.stat-card {
  display: block;
  background: var(--surface);
  padding: var(--space-5);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
/* Cards that are links keep the card look (no underline / inherited color). */
a.stat-card { color: inherit; text-decoration: none; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card h3 {
  font-family: var(--font-body);
  font-size: var(--text-xs); color: var(--text-muted);
  margin: 0 0 var(--space-2); font-weight: var(--weight-bold);
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
}
.stat-card .stat-value {
  font-family: var(--font-heading);
  font-size: var(--text-3xl); color: var(--brand);
  font-weight: var(--weight-black); margin: 0; line-height: 1;
}
.stat-card .stat-label { font-size: var(--text-xs); color: var(--text-faint); margin-top: var(--space-2); }

/* Slim progress bar inside a stat card (e.g. Completion) */
.progress-mini { height: 6px; background: var(--surface-inset); border-radius: var(--radius-pill); overflow: hidden; margin-top: var(--space-2); }
.progress-mini span { display: block; height: 100%; background: var(--reviewed-dot); border-radius: var(--radius-pill); transition: width var(--dur) var(--ease); }

/* Dashboard stat tile with leading icon chip (home page variant) */
.metric-tile {
  display: flex; align-items: center; gap: var(--space-4);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}
.metric-tile .m-icon {
  width: 44px; height: 44px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md); font-size: 20px;
  background: var(--brand-tint); color: var(--brand);
}
.metric-tile .m-num { font-family: var(--font-heading); font-size: var(--text-2xl); font-weight: var(--weight-black); color: var(--text-heading); line-height: 1; }
.metric-tile .m-label { font-size: var(--text-xs); font-weight: var(--weight-bold); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-muted); margin-top: var(--space-1); }

/* Card / panel container */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}
.card > h2 { font-size: var(--text-lg); margin-bottom: var(--space-5); }

/* Chart frame */
.chart-frame { width: 100%; }
.chart-frame .chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.chart-frame canvas { max-width: 100%; }

/* Quick actions */
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.quick-action {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-3);
  padding: var(--space-8) var(--space-5);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  font-size: var(--text-md);
  border: 1px solid transparent;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.quick-action .qa-icon { font-size: 24px; }
.quick-action:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; }
.quick-action.primary { background: var(--brand); color: var(--brand-contrast); }
.quick-action.primary:hover { background: var(--brand-dark); color: var(--brand-contrast); }
.quick-action.neutral { background: var(--surface); color: var(--text-heading); border-color: var(--border-strong); }
.quick-action.neutral:hover { background: var(--surface-hover); }
.quick-action.dark { background: var(--brand-darker); color: var(--brand-contrast); }
.quick-action.dark:hover { filter: brightness(1.12); color: var(--brand-contrast); }

/* ============================================================================
   REPORT FORM — category panels + item cards (the heart of the app)
   ========================================================================= */
.report-member-bar {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  align-items: start;
}
.kpi-column { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }

.category-section {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  transition: border-color var(--dur) var(--ease);
}
.category-section.has-items { background: var(--surface); }

.category-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--brand);
  margin-bottom: var(--space-4);
}
.category-section.collapsed .category-header { margin-bottom: 0; }
.category-title {
  font-family: var(--font-heading);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--brand);
  margin: 0;
  display: flex; align-items: center; gap: var(--space-2);
}
.category-title .count {
  font-family: var(--font-body);
  font-size: var(--text-2xs); font-weight: var(--weight-bold);
  background: var(--brand-tint); color: var(--brand-dark);
  padding: 1px var(--space-2); border-radius: var(--radius-pill);
}

/* Item card */
.item-form {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}
.item-form + .item-form { margin-top: 0; }
.btn-remove {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn-remove:hover { background: var(--danger); color: #fff; }
.item-actions { display: flex; justify-content: flex-end; margin-top: var(--space-3); }

/* form footer — sticky action bar */
.form-footer {
  display: flex; gap: var(--space-4); justify-content: center; align-items: center;
  padding: var(--space-4);
  margin: var(--space-8) calc(var(--space-6) * -1) 0;
  position: sticky; bottom: 0;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 18px color-mix(in srgb, var(--text-heading) 7%, transparent);
}

/* ============================================================================
   REPORTS INDEX — filter bar + item table
   ========================================================================= */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
}
.filter-bar .filters { display: flex; flex-wrap: wrap; gap: var(--space-3); flex: 1 1 auto; }
.filter-bar select.form-control { width: auto; min-width: 150px; }
.filter-bar .filter-actions { display: flex; gap: var(--space-3); }

.data-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--brand);
  background: var(--surface-2);
  padding: var(--space-3) var(--space-5);
  border-bottom: 2px solid var(--border);
}
.data-table td { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-body); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background-color var(--dur) var(--ease); }
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table .t-date { font-weight: var(--weight-bold); color: var(--text-heading); white-space: nowrap; }
.data-table .t-sub { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.data-table .t-person { font-weight: var(--weight-bold); color: var(--brand); }
.data-table .t-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ============================================================================
   REPORT SHOW / DETAIL
   ========================================================================= */
.cert-banner {
  display: flex; align-items: center; gap: var(--space-4);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  padding: var(--space-5); margin-bottom: var(--space-5);
}
.cert-banner .c-check {
  width: 40px; height: 40px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--reviewed-bg); color: var(--reviewed-fg);
  font-size: 20px; font-weight: var(--weight-bold);
}
.cert-banner .c-title { font-family: var(--font-heading); font-weight: var(--weight-bold); font-size: var(--text-md); color: var(--text-heading); }
.cert-banner .c-sub { font-size: var(--text-sm); color: var(--text-muted); }

.detail-toolbar { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-5); }

.detail-group { margin-bottom: var(--space-6); }
.detail-group > h3 {
  font-family: var(--font-heading);
  font-size: var(--text-lg); color: var(--brand);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
}
.detail-item {
  background: var(--surface-2);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-3);
}
.detail-item .d-date { font-family: var(--font-heading); font-weight: var(--weight-bold); font-size: var(--text-sm); color: var(--brand-dark); margin-bottom: var(--space-2); }
.detail-item .d-label { font-weight: var(--weight-bold); color: var(--text-heading); font-size: var(--text-sm); }
.detail-item .d-text { color: var(--text-body); font-size: var(--text-base); margin-top: var(--space-1); }
.detail-meta { text-align: center; color: var(--text-faint); font-size: var(--text-xs); padding: var(--space-4); }

/* ============================================================================
   ADMIN — content shell, header, stat grid, tables
   ========================================================================= */
.admin-body { background-color: var(--page-bg); }
.admin-content { max-width: var(--maxw-admin); margin: 0 auto; padding: var(--space-8) var(--space-6); }
.admin-header { margin-bottom: var(--space-6); }
.admin-header h1 { font-size: var(--text-2xl); color: var(--text-heading); margin-bottom: var(--space-1); }
.admin-header p { color: var(--text-muted); font-size: var(--text-sm); }

.admin-table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: var(--space-6);
}
.admin-table-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-4);
  flex-wrap: wrap;
}
.admin-table-header h2 { font-size: var(--text-lg); color: var(--text-heading); }
.admin-table-tools { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }

/* Explanatory line between a table header and its table — used by the
   orphaned-drafts section of the review queue to say what the buttons do. */
.admin-table-note {
  padding: 0 var(--space-6) var(--space-4);
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-body);
}

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table thead { background-color: var(--surface-2); }
.admin-table th {
  padding: var(--space-3) var(--space-6);
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  border-bottom: 1px solid var(--border);
}
.admin-table td { padding: var(--space-3) var(--space-6); border-bottom: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-body); }
.admin-table tbody tr { transition: background-color var(--dur) var(--ease); }
.admin-table tbody tr:hover { background-color: var(--surface-hover); }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table .cell-name { font-weight: var(--weight-bold); color: var(--text-heading); }
.admin-table .cell-muted { color: var(--text-muted); }
.admin-table .yes { color: var(--reviewed-fg); font-weight: var(--weight-bold); }
.admin-table .no { color: var(--text-faint); }

/* Admin stat value accents */
.stat-card .stat-value.is-amber { color: var(--certified-fg); }
.stat-card .stat-value.is-green { color: var(--reviewed-fg); }
.stat-card .stat-value.is-red { color: var(--draft-fg); }
.stat-card .stat-value.is-muted { color: var(--text-muted); }

/* ============================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .reminder-row { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .navbar { flex-direction: column; height: auto; gap: var(--space-3); padding: var(--space-4); }
  .navbar-nav { flex-wrap: wrap; justify-content: center; }
  .navbar-brand { text-align: center; }
  .nav-user-menu { padding-left: 0; margin-left: 0; border-left: none; }
  .page-wrap, .admin-content { padding: var(--space-5) var(--space-4); }
  .form-row { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar select.form-control { width: 100%; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { border-bottom: 1px solid var(--border); padding: var(--space-2) 0; }
  .data-table td { border: none; padding: var(--space-1) var(--space-5); }
  .admin-table-container { overflow-x: auto; }
}

/* ---- Visually hidden (screen-reader-only) text -------------------------
   For labels that a sighted user gets from context (the link-row controls)
   but assistive tech still needs. */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Item links (slides, paper PDF…) on the entry/edit forms ----------- */
.link-rows { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-2) 0; }
.link-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.link-row .link-kind { width: auto; flex: 0 0 auto; }
.link-row .link-url { flex: 1 1 16rem; min-width: 0; }
.link-row .link-file-input { flex: 1 1 14rem; min-width: 0; max-width: 100%; }
.link-row .link-file-name { flex: 1 1 auto; font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.link-status { flex-basis: 100%; font-size: var(--text-sm); }
.link-status:empty { display: none; }
.link-status.is-error { color: var(--danger-dark); }
.link-row[hidden] { display: none; }

/* Links list on the item page / preview */
.item-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.item-links a { overflow-wrap: anywhere; }
.link-row .link-or { font-size: var(--text-sm); }

/* ---- Admin override (item page) ----------------------------------------- */
.override-form { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); max-width: 40rem; }
.override-form .btn { align-self: flex-start; }
.override-history .override-title { font-size: var(--text-base); margin: 0 0 var(--space-2); }
.override-history ul { margin: 0; padding-left: var(--space-5, 20px); }

/* ---- Tag pickers (item forms) ------------------------------------------- */
.tag-add-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tag-add-row .form-control { flex: 1 1 16rem; min-width: 0; }

/* ---- Admin → Tags -------------------------------------------------------- */
/* Padded body for the non-table parts of an admin box (the add form, the
   empty state), matching the header's and table cells' side padding. */
.tag-admin-body { padding: var(--space-5) var(--space-6) var(--space-6); }
.tag-admin-help { margin: 0 0 var(--space-4); font-size: var(--text-sm); color: var(--text-body); }
.tag-admin-add { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: flex-end; }
.tag-admin-field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.tag-admin-field .form-label { margin: 0; }
.tag-admin-field-kind { flex: 0 1 14rem; }
.tag-admin-field-name { flex: 1 1 18rem; }
.tag-admin-submit { flex: 0 0 auto; }
.tag-admin-empty { padding: var(--space-5) var(--space-6); margin: 0; font-size: var(--text-sm); color: var(--text-body); font-style: italic; }

.tag-admin-table td { vertical-align: middle; }
.tag-admin-table .num { text-align: center; width: 6rem; }
.tag-admin-table .actions { text-align: right; width: 7rem; }
.tag-admin-table tbody tr:last-child td { border-bottom: 0; }
.tag-admin-rename { display: flex; gap: var(--space-2); align-items: center; max-width: 30rem; }
.tag-admin-rename .form-control { flex: 1 1 auto; min-width: 0; }
.tag-admin-rename .btn-admin, .tag-admin-table .actions .btn-admin { white-space: nowrap; }
/* Buttons beside a text box match its height (form controls are 34px). */
.tag-admin-submit, .tag-admin-rename .btn-admin { min-height: 34px; display: inline-flex; align-items: center; }

/* ---- Add Items: Import from ORCID panel + imported-row note -------------- */
.orcid-import { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: var(--space-4); margin: 0 0 var(--space-5); }
.orcid-import-title { font-size: var(--text-lg, 1.1rem); margin: 0 0 var(--space-2); }
.orcid-candidates { list-style: none; padding: 0; margin: var(--space-3) 0; display: flex; flex-direction: column; gap: var(--space-2); }
.orcid-candidate { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-2); }
.orcid-candidate .orcid-work { flex: 1 1 20rem; min-width: 0; }
.orcid-candidate .orcid-added { display: block; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--success-dark); }
.orcid-candidate .orcid-added[hidden] { display: none; }
/* An Add button that's been used (or is mid-fetch) greys out, so someone
   working down a long list can see where they are. */
.orcid-candidate [data-orcid-add]:disabled { background: var(--surface-inset); color: var(--text-muted);
  border-color: var(--border); box-shadow: none; cursor: default; }
.orcid-candidate .orcid-meta { display: block; font-size: var(--text-sm); }
.orcid-candidate form { margin: 0; }
.orcid-import-links { margin: var(--space-3) 0 var(--space-2); }
.orcid-hidden { margin-top: var(--space-3); }
.orcid-hidden li { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: var(--space-1) 0; }
.import-note { background: var(--certified-bg); color: var(--certified-fg); padding: var(--space-2) var(--space-3);
  border-radius: 6px; margin: 0 0 var(--space-3); font-size: var(--text-sm); }

/* "Working…" dialog for the per-work ORCID import. */
.import-dialog { border: 0; border-radius: 10px; padding: 0; max-width: min(26rem, calc(100vw - 32px));
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25); background: var(--surface); color: var(--text-body); }
.import-dialog::backdrop { background: rgba(20, 12, 10, .45); }
.import-dialog-body { padding: var(--space-5, 20px); text-align: center; }
.import-dialog-title { font-weight: var(--weight-semibold); margin: var(--space-3) 0 var(--space-1); }
.import-dialog-text { margin: 0 0 var(--space-3); font-size: var(--text-sm); }
.import-spinner { width: 44px; height: 44px; margin: 0 auto; border-radius: 50%;
  border: 4px solid var(--border-strong); border-top-color: var(--brand); animation: import-spin .8s linear infinite; }
.import-dialog [hidden] { display: none !important; } /* .btn's display would otherwise show the Close button */
@keyframes import-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .import-spinner { animation: import-pulse 1.6s ease-in-out infinite; border-top-color: var(--border-strong); background: var(--brand); }
  @keyframes import-pulse { 50% { opacity: .35; } }
}

/* ---- Add Items: OpenAlex review card ------------------------------------- */
.openalex-card { border: 1px solid var(--border-strong); border-radius: 8px; padding: var(--space-4); margin: var(--space-3) 0; }
.openalex-card-title { font-size: var(--text-base); margin: 0 0 var(--space-1); }
.openalex-authors { font-size: var(--text-sm); margin: var(--space-2) 0; }
.openalex-authors mark { background: var(--certified-bg); color: var(--certified-fg); font-weight: var(--weight-semibold); padding: 0 2px; }
.openalex-label { font-weight: var(--weight-semibold); }
.openalex-warning { background: #fdecea; color: var(--danger-dark); padding: var(--space-2) var(--space-3); border-radius: 6px; }
.openalex-flag { font-size: var(--text-sm); font-style: italic; margin: 0 0 var(--space-1); }
.openalex-abstract summary { cursor: pointer; font-weight: var(--weight-semibold); }
.openalex-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-3); }
.openalex-actions .form-label { margin: 0; }
.openalex-actions .openalex-category { width: auto; }
.openalex-actions form, .openalex-fetch form { margin: 0; }
.openalex-fetch { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }

/* "Last checked with ORCID / searched OpenAlex: …" lines on the import panels. */
.import-last-checked { font-size: var(--text-sm); margin: var(--space-2) 0 0; }

/* ---- Home: Admin Tasks box (groups the team-wide admin reminders) ------- */
.admin-tasks { border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface);
  padding: var(--space-4) var(--space-5); margin-bottom: var(--space-6); }
.admin-tasks-title { font-size: var(--text-base); text-transform: uppercase; letter-spacing: var(--tracking-wide);
  margin: 0 0 var(--space-3); }
.admin-tasks .reminder-row { margin-bottom: 0; }

/* ---- OpenAlex profile picker (shared partial: ORCID page + Admin → Users →
   Edit). Self-contained, so it looks the same on either host page. -------- */
.openalex-profiles .sec-sub { font-size: var(--text-sm); margin: 0 0 var(--space-4); max-width: 90ch; }
.openalex-profiles .muted-note { color: var(--text-muted); }
.openalex-profiles .form-hint { font-size: var(--text-xs); margin-top: var(--space-2); }
.openalex-profiles .orcid-id-row { display: flex; gap: var(--space-3); align-items: center; max-width: 560px; }
.openalex-profiles .orcid-id-row .form-control { flex: 1; min-width: 0; }
.openalex-linked, .openalex-results { list-style: none; padding: 0; margin: var(--space-3) 0 var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.openalex-linked li, .openalex-result { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); }
.openalex-linked li form, .openalex-result form { margin: 0; }
.openalex-result-main { flex: 1 1 24rem; min-width: 0; }
.orcid-meta-line { font-size: var(--text-sm); margin-top: 2px; overflow-wrap: anywhere; }
.openalex-search { margin-top: var(--space-3); }
.openalex-note { background: var(--certified-bg); color: var(--certified-fg); padding: var(--space-2) var(--space-3); border-radius: 6px; }
/* Admin → Users → Edit host: sits inside an admin box, so no card chrome. */
.openalex-profiles.is-embedded { padding: var(--space-5) var(--space-6) var(--space-6); margin: 0; }
.openalex-profiles.is-embedded > h2 { display: none; } /* the admin box header carries the title */
