:root {
  --brand: #303596;
  --brand-dark: #242a75;
  --page-bg: #F7F5EE;
  --surface: #ffffff;
  --text: #1e293b;        /* Softer slate 800 */
  --text-muted: #64748b;  /* Slate 500 */
  --line: #e2e8f0;        /* Softer subtle borders */
  --radius: 8px;          /* Larger border radius */
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05); /* Softer layered shadow */
  --sidebar-width: 248px;
  --topbar-height: 64px;
  --sheet-gap: 0.125rem; /* hairline gap between the sheet and the shell chrome */
  --shell-bg: #171a21;
  --action: #2563eb;
  --action-bg: #eff6ff;
  --action-border: #bfdbfe;
  --action-hover: #1d4ed8;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --warning-bg: #f59e0b;
  --table-head-bg: #f8fafc;
}

.navbar-logo {
  padding-left: 10px;
  padding-right: 10px;
}

html {
  font-size: 16px;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  /* Legacy 56px bottom margin removed: the footer is in normal flow, so it
     only left a long empty tail below the content sheet. */
  margin-bottom: 0.75rem;
  background-color: var(--page-bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.btn {
  border-radius: var(--radius);
}

.btn-primary {
  color: #fff;
  background-color: var(--brand);
  border-color: var(--brand);
  font-weight: 600;
  padding: 0.4rem 0.9rem;
}

.btn-primary:hover,
.btn-primary:focus {
  color: #fff;
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
}

.form-control,
.form-select {
  border-radius: var(--radius);
  border-color: #d8d3c6;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(48, 53, 150, 0.16);
}

a:focus-visible,
button:focus-visible,
.action-link:focus-visible,
.home-record-list a:focus-visible,
.nav-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.navbar-nav .nav-item:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
}

.navbar-nav .nav-item:active {
  background-color: rgba(255, 255, 255, 0.2);
}

::placeholder {
  font-style: italic;
}

.col-sm-3,
.col-sm-9 {
  margin-bottom: 10px;
}

tbody tr:nth-child(even) {
  background-color: #faf9f5;
}

.login-screen {
  background: url('/images/login.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  text-align: center;
}

/* Legacy fixed 700px dialog replaced with responsive card (was .centered-createbox/.centered-box). */
.centered-createbox,
.centered-box {
  width: min(700px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  margin: 2rem auto;
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

.col-md-4.centered-form {
  text-align: center;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.register-form-col {
  display: inline-block;
  width: 300px;
  padding: 3%;
}

.col-md-4.centered-form label {
  display: block;
  margin-bottom: 10px;
  margin-top: 10px;
}

.col-md-4.centered-form input[type="text"],
.col-md-4.centered-form input[type="password"] {
  width: 100%;
  padding: 5%;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-sizing: border-box;
}

.pie-charts-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 20px;
}

.pie-chart-wrapper {
  margin-top: 20px;
  flex: 1 1 330px;
  height: 330px;
  width: 330px;
  margin-bottom: 20px;
}

.pie-charts-container .pie-chart-wrapper:last-child {
  margin-bottom: 20px;
}

.legend-wrapper {
  margin-top: 20px;
  width: 100%;
}

.pie-chart-wrapper,
.legend-wrapper {
  display: inline-block;
  vertical-align: top;
}

.profile-panel {
  max-width: 52rem;
}

.profile-panel:has(.count-grid) {
  max-width: 100%;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.35rem;
  border-bottom: 1px solid var(--line);
}

.profile-hero__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.profile-hero__body {
  min-width: 0;
}

.profile-hero__name {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 650;
}

.profile-hero__meta {
  margin: 0.1rem 0 0.55rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.profile-hero__chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

@media (max-width: 575.98px) {
  .profile-hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

.profile-section + .profile-section {
  margin-top: 1.35rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.profile-section__title {
  font-size: 0.9rem;
  font-weight: 650;
  margin: 0 0 0.85rem;
}

.profile-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.5rem;
}

.profile-fields__label {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.profile-fields__value {
  word-break: break-word;
}

.profile-fields__value a {
  color: var(--brand);
  overflow-wrap: anywhere;
}

.count-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.65rem;
}

.count-tile {
  background: #f3f1ea;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
}

.count-tile__n {
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1.1;
}

.count-tile__l {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.scopus-search {
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
}

.scopus-title-cell {
  min-width: 12rem;
  overflow-wrap: anywhere;
}

.scopus-search__query {
  flex: 1 1 16rem;
  min-width: 0;
}

.scopus-search__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.scopus-search__filters .form-select {
  width: auto;
  min-width: 7.5rem;
}

.scopus-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin: 0.35rem 0 0.9rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.scopus-check-col {
  width: 2.5rem;
}

.scopus-pager .pagination {
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.bar-chart {
  max-width: 100%;
  overflow-x: auto;
}

.bar-chart canvas {
  max-width: 100%;
}

.admin-tabs {
  max-width: 100%;
}

img, svg, video, canvas {
  max-width: 100%;
}

#sidebar img {
  height: auto;
}

.register-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1.25rem;
}

.register-form__password {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.register-form__password .form-control {
  flex: 1;
}

.register-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

@media (max-width: 767.98px) {
  .register-form__grid {
    grid-template-columns: 1fr;
  }
}

.reminder-composer {
  display: block;
  max-width: 60rem;
}

.reminder-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.9rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}

.reminder-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.reminder-card__desc {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Numbered steps keep the flow obvious: When -> Who -> Message. */
.reminder-step {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 1rem 0;
  border-bottom: 1px dashed var(--line);
}

.reminder-step__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 7.5rem;
  margin: 0;
  padding-top: 0.15rem;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text);
}

.reminder-step__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

.reminder-step__body {
  flex: 1 1 auto;
  min-width: 0;
}

.reminder-step__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.reminder-step__body .form-label {
  margin-bottom: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.reminder-when__summary {
  margin: 0.85rem 0 0;
  padding: 0.7rem 0.8rem;
  background: #f3f1ea;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.reminder-step textarea.form-control {
  min-height: 9rem;
  resize: vertical;
}

.reminder-extra {
  margin-top: 1rem;
}

@media (max-width: 767.98px) {
  .reminder-step {
    flex-direction: column;
    gap: 0.6rem;
  }

  .reminder-step__title {
    flex: 0 0 auto;
  }
}

#tzTravellingBanner {
  background-color: #e7f1ff;
  color: #0c63e4;
  border-color: #b6d4fe;
  font-size: 0.75rem;
}

.notification-row {
  padding-top: 8px;
  border-bottom: thin solid black;
}

#alertPlaceholder {
  position: fixed;
  left: 150px;
  bottom: 10px;
  width: 80%;
  padding: 30px;
}

/* ----- App shell / top bar ----- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1050;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 0.9rem;
  background: var(--shell-bg);
  color: #fff;
  border-bottom: 0;
}

.topbar__icon-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.05rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.topbar__icon-btn:hover,
.topbar__icon-btn:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.topbar__brand {
  flex: 0 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.topbar__brand span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__brand:hover {
  color: #fff;
}

.topbar__search {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  min-width: 0;
  margin: 0 0.5rem;
}

/* YouTube-Music-style pill: a translucent fill that brightens on hover/
   focus instead of a solid dark box with borders. */
.topbar__search-field {
  display: flex;
  width: min(42rem, 100%);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid transparent;
  border-radius: 999px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.topbar__search-field:hover {
  background: rgba(255, 255, 255, 0.13);
}

.topbar__search-field:focus-within {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.25);
}

.topbar__search-field input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.62rem 1rem;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
}

.topbar__search-field input::placeholder {
  color: rgba(255, 255, 255, 0.55);
  font-style: normal;
}

.topbar__search-field button {
  flex: 0 0 auto;
  width: 3rem;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.topbar__search-field button:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

/* Hide the native clear (x) inside the search box; picking a result is
   driven by the suggestions dropdown below. */
.topbar__search-field input[type="search"]::-webkit-search-cancel-button,
.topbar__search-field input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.topbar__search-field input[type="search"]::-ms-clear {
  display: none;
  width: 0;
  height: 0;
}

/* YouTube-style live suggestions: anchored under the pill, scrollable. */
.topbar__search {
  position: relative;
}

.topbar-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: min(42rem, 100%);
  max-height: 320px;
  overflow-y: auto;
  padding: 0.35rem;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 1060;
}

.topbar-suggest__item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.topbar-suggest__item:hover,
.topbar-suggest__item--active {
  background: var(--action-bg);
}

.topbar-suggest__icon {
  flex: 0 0 auto;
  margin-top: 0.15rem;
  color: var(--text-muted);
}

.topbar-suggest__body {
  flex: 1 1 auto;
  min-width: 0;
}

.topbar-suggest__title,
.topbar-suggest__meta,
.topbar-suggest__match {
  display: block;
}

/* Show the full title (wrapping) rather than an ellipsis. */
.topbar-suggest__title {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: normal;
  overflow-wrap: anywhere;
}

.topbar-suggest__meta {
  color: var(--text-muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Full matched value from the field that actually matched the query. */
.topbar-suggest__match {
  margin-top: 0.15rem;
  color: var(--text);
  font-size: 0.8rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.topbar-suggest__match-label {
  color: var(--text-muted);
}

.topbar-suggest__title mark,
.topbar-suggest__match mark {
  background: rgba(48, 53, 150, 0.13);
  color: var(--brand);
  font-weight: 800;
  border-radius: 3px;
  padding: 0 0.12em;
}

.topbar-suggest__empty {
  padding: 0.55rem 0.6rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.topbar-suggest__more {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
  padding: 0.55rem 0.6rem;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--brand);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.topbar-suggest__more:hover {
  text-decoration: underline;
}

.topbar__actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}

.topbar__bell {
  position: relative;
}

.topbar__badge {
  position: absolute;
  top: 0.3rem;
  right: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
}

.topbar__avatar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.topbar__avatar:hover,
.topbar__avatar:focus-visible {
  border-color: #fff;
  background: var(--brand-dark);
}

/* Notification dropdown */
.topbar-notifications {
  width: min(23rem, calc(100vw - 2rem));
  padding: 0;
  overflow: hidden;
}

.topbar-notifications__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 700;
}

.topbar-notifications__head a {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}

.topbar-notifications__head a:hover {
  text-decoration: underline;
}

.topbar-notifications__list {
  max-height: 20rem;
  overflow-y: auto;
}

.topbar-notifications__item {
  display: block;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid #eef2f7;
  text-decoration: none;
  color: var(--text);
}

.topbar-notifications__item:last-child {
  border-bottom: 0;
}

.topbar-notifications__item:hover,
.topbar-notifications__item:focus-visible {
  background: #f8fafc;
  color: var(--text);
}

.topbar-notifications__sender {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.topbar-notifications__flag {
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
  font-size: 0.65rem;
  font-weight: 700;
}

.topbar-notifications__message {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.topbar-notifications__time {
  display: block;
  margin-top: 0.25rem;
  color: #94a3b8;
  font-size: 0.75rem;
}

.topbar-notifications__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.topbar-notifications__empty .fa {
  font-size: 1.4rem;
}

/* Account dropdown */
.topbar-account {
  min-width: 14rem;
  padding: 0;
}

.topbar-account__header {
  display: flex;
  flex-direction: column;
  padding: 0.7rem 0.9rem 0.4rem;
}

.topbar-account__name {
  font-weight: 700;
}

.topbar-account__role {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.topbar-account .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.9rem;
}

.topbar-account .dropdown-item .fa {
  width: 1rem;
  text-align: center;
  color: var(--text-muted);
}

.topbar-account .dropdown-item:hover .fa {
  color: inherit;
}

@media (max-width: 575.98px) {
  .topbar__search {
    margin: 0 0.25rem;
  }

  .topbar__search-field button {
    width: 2.5rem;
  }
}

#sidebar {
  width: var(--sidebar-width);
  height: calc(100vh - var(--topbar-height));
  position: fixed;
  left: 0;
  top: var(--topbar-height);
  z-index: 1048;
  overflow-y: auto;
  padding: 1.15rem 0.9rem 1.5rem;
  transition: transform 0.2s ease;
  background: var(--shell-bg);
  color: #fff;
  border-right: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

#sidebar::-webkit-scrollbar {
  width: 10px;
}

#sidebar::-webkit-scrollbar-track {
  background: transparent;
}

#sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: 999px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
  background-clip: padding-box;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem;
}

.sidebar-nav .nav-link {
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  margin-bottom: 0.2rem;
  font-size: 0.92rem;
  border: 0;
}

.sidebar-nav .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

/* YouTube-style selected pill: filled rounded background, no side rail. */
.sidebar-nav .nav-link.active {
  background-color: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 600;
}

.sidebar-nav .nav-link:active {
  background-color: rgba(255, 255, 255, 0.24);
}

#sidebarNotificationBadge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  background-color: #dc3545 !important;
  color: #fff !important;
  border-radius: 50rem;
  min-width: 1.35rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.sidebar-group-toggle {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  appearance: none;
}

.sidebar-group-toggle::after {
  content: "";
  float: right;
  margin-top: 0;
  border: 4px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.65);
}

.sidebar-group-toggle[aria-expanded="true"]::after {
  margin-top: 0;
  border-top-color: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.65);
}

.sidebar-group-toggle.active-group {
  background-color: rgba(255, 255, 255, 0.12);
}

.sidebar-sub {
  padding: 0.15rem 0 0.35rem;
}

.sidebar-section {
  list-style: none;
  margin: 0.35rem 0 0.1rem;
  padding: 0.45rem 0.8rem 0.1rem;
  line-height: 1.2;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.sidebar-sub .nav-link {
  font-size: 0.8rem;
  padding: 0.38rem 0.7rem 0.38rem 1.05rem;
  margin-bottom: 0.08rem;
  color: rgba(255, 255, 255, 0.86) !important;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1045;
  background: rgba(0, 0, 0, 0.45);
}

/* ----- Modern sidebar: icons + collapsible icon rail ----- */
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sidebar-nav .nav-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 1px;
}

.sidebar-icon {
  flex: 0 0 auto;
  width: 1.4rem;
  text-align: center;
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.82);
}

.sidebar-nav .nav-link.active .sidebar-icon {
  color: #fff;
}

.sidebar-label {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Long record names (e.g. Professional Development Activities) wrap to the
   next row instead of forcing a horizontal scrollbar. */
#sidebar {
  overflow-x: hidden;
}

.sidebar-sub .sidebar-label {
  white-space: normal;
  overflow-wrap: break-word;
}

.sidebar-group-toggle::after {
  margin-left: auto;
}

#sidebar {
  transition: transform 0.2s ease, width 0.2s ease, padding 0.2s ease;
}

body.has-sidebar #main-content,
body.has-sidebar .footer {
  transition: margin-left 0.2s ease, width 0.2s ease;
}

@media (min-width: 992px) {
  /* Slack-style shell: the dark sidebar runs the full viewport height
     (tucked under the fixed top bar, same dark surface), so the rounded
     content sheet sits beside it with an even gap. The extra top padding
     keeps the sidebar brand clear of the fixed top bar. */
  #sidebar {
    top: 0;
    height: 100vh;
    padding-top: calc(var(--topbar-height) + 1.15rem);
  }

  body.has-sidebar.sidebar-collapsed {
    --sidebar-width: 68px;
  }

  body.sidebar-collapsed #sidebar {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
    overflow-x: hidden;
  }

  body.sidebar-collapsed .sidebar-brand,
  body.sidebar-collapsed .sidebar-label,
  body.sidebar-collapsed .sidebar-section,
  body.sidebar-collapsed .sidebar-sub,
  body.sidebar-collapsed .sidebar-group-toggle::after {
    display: none;
  }

  body.sidebar-collapsed .sidebar-nav .nav-link {
    position: relative;
    justify-content: center !important;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  body.sidebar-collapsed .sidebar-icon {
    margin: 0;
    font-size: 1.3rem;
  }
}

/* ----- Sidebar hover flyout (Slack-style quick navigation) ----- */
.sidebar-flyout {
  position: fixed;
  z-index: 1060;
  min-width: 13rem;
  max-width: 18rem;
  padding: 0.45rem 0.5rem 0.5rem;
  background: var(--shell-bg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateX(-4px);
  visibility: hidden;
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
  pointer-events: none;
}

.sidebar-flyout.is-open {
  opacity: 1;
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

.sidebar-flyout__title {
  padding: 0.35rem 0.55rem 0.5rem;
  margin-bottom: 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-flyout__link {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-flyout__link:hover,
.sidebar-flyout__link:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

#main-content {
  margin-top: 0;
  width: 100%;
  max-width: 100%;
  padding: 0;
  box-sizing: border-box;
}

/* Slack-style shell: outside the content sheet is the same dark surface as
   the top bar and sidebar. The sheet and footer attach into one square
   panel in the original warm background. */
body.has-sidebar {
  background-color: var(--shell-bg);
  margin-bottom: var(--sheet-gap);
  /* Fixed viewport shell: the page itself never scrolls. The sheet below
     is the only scroll region, so the rounded panel and footer stay put. */
  display: flex;
  flex-direction: column;
  /* Leave room for the bottom gap margin so the box never overflows the
     viewport (an overflowing body is what gives the window a scrollbar). */
  height: calc(100vh - var(--sheet-gap));
  height: calc(100dvh - var(--sheet-gap));
  overflow: hidden;
}

/* Never scroll the window itself: only the content sheet (and inner
   regions) scroll. */
html:has(body.has-sidebar) {
  overflow: hidden;
  height: 100%;
}

body.has-sidebar #main-content {
  /* Inner scroll region: content scrolls under the panel's rounded top
     corners while the sheet and footer stay fixed in place. */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  /* Docked flush against the sidebar and top bar: zero gap there, so the
     touching corner stays square and no shell shows through. */
  margin-left: var(--sidebar-width);
  margin-right: var(--sheet-gap);
  margin-top: var(--topbar-height);
  margin-bottom: 0;
  width: calc(100% - var(--sidebar-width) - var(--sheet-gap));
  padding: 0;
  background: var(--page-bg);
  border: 1px solid var(--line);
  border-left: 0;
  border-top: 0;
  border-bottom: 0;
  border-radius: 0;
}

#main-content > main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.75rem 2.375rem;
}

/* Attached under the sheet: square corners, sharing the sheet
   background with a hairline divider. */
body.has-sidebar .footer {
  flex: 0 0 auto;
  margin-left: var(--sidebar-width);
  margin-top: 0;
  width: calc(100% - var(--sidebar-width) - var(--sheet-gap));
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

@media (max-width: 991.98px) {
  body.has-sidebar #main-content {
    margin-left: 0;
    margin-right: var(--sheet-gap);
    margin-top: var(--topbar-height);
    margin-bottom: 0;
    width: auto;
    border-left: 0;
    border-top: 0;
    border-radius: 0;
  }

  body.has-sidebar .footer {
    margin-left: 0;
    margin-top: 0;
    width: calc(100% - var(--sheet-gap));
    border-left: 0;
    border-radius: 0;
  }

  #sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-open #sidebar {
    transform: translateX(0);
  }

  body.sidebar-open {
    overflow: hidden;
  }
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.page-header__title,
h1.page-header__title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

/* Big linked trail replacing the small breadcrumb + title on form lists. */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.filter-bar > form {
  flex: 1 1 22rem;
  min-width: 0;
}

.filter-bar .dropdown .btn {
  white-space: nowrap;
}

/* Search control: one seamless pill (YouTube-Music style). Translucent
   fill that brightens on hover and goes solid on focus. */
.filter-bar .input-group {
  flex-wrap: nowrap;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: var(--radius-pill);
  box-shadow: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-bar .input-group:hover {
  background: rgba(255, 255, 255, 0.78);
}

.filter-bar .input-group:focus-within {
  background: var(--surface);
  border-color: rgba(48, 53, 150, 0.4);
  box-shadow: 0 0 0 3px rgba(48, 53, 150, 0.1);
}

.filter-bar .input-group > .form-select,
.filter-bar .input-group > .form-control {
  border: 0;
  background-color: transparent;
  box-shadow: none;
  min-height: 2.5rem;
}

.filter-bar .input-group > .form-select {
  flex: 0 1 auto;
  width: auto;
  max-width: 13rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.filter-bar .input-group > .form-control {
  font-size: 0.9rem;
}

.filter-bar .input-group > .form-select + .form-control {
  border-left: 1px solid rgba(15, 23, 42, 0.08);
}

.filter-bar .input-group > .btn-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--brand);
  font-size: 0.9rem;
}

.filter-bar .input-group > .btn-search:hover,
.filter-bar .input-group > .btn-search:focus-visible {
  background: rgba(48, 53, 150, 0.1);
  color: var(--brand-dark);
}

.sort-icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.sort-icon-btn:hover,
.sort-icon-btn:focus-visible {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--surface);
}

.sort-icon-btn.is-sorted {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

#sortDropdownMenu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#sortDropdownMenu .dropdown-item.is-active {
  font-weight: 700;
  color: var(--brand);
  background-color: var(--action-bg);
}

#sortDropdownMenu .dropdown-item.is-active::after {
  content: "\2713";
  margin-left: auto;
  font-weight: 700;
}

.results-count {
  margin: 0 0 0.65rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.live-search-empty {
  margin-top: 0.65rem;
}

/* Two-row list header: page title trail, then one controls row. */
.page-header.list-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.list-header .page-header__title {
  flex: 0 0 auto;
  min-width: 0;
}

/* Add New, More, search, filter and count always share one row. */
.list-header__controls {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.6rem 0.9rem;
  flex: 0 0 auto;
  min-width: 0;
}

.list-header__controls .filter-bar {
  flex: 0 1 28rem;
  min-width: 0;
  margin-bottom: 0;
  flex-wrap: nowrap;
}

.list-header__controls .filter-bar > form {
  flex: 1 1 auto;
  min-width: 0;
}

.list-header__controls .filter-bar .input-group {
  min-width: 0;
}

.list-header__controls .results-count {
  margin: 0 0 0 auto;
  white-space: nowrap;
}

.list-header__controls .module-toolbar {
  flex: 0 0 auto;
}

@media (max-width: 767.98px) {
  .list-header__controls {
    gap: 0.5rem 0.6rem;
  }

  .list-header__controls .filter-bar {
    flex: 1 1 auto;
  }
}

@media (max-width: 575.98px) {
  .list-header__controls .results-count {
    display: none;
  }

  .module-toolbar .module-toolbar__label {
    display: none;
  }
}

.form-note {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0.45rem 0 0.6rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.83rem;
  line-height: 1.45;
  color: #0d47a1;
  background-color: #e3f2fd;
  border: 1px solid #bbdefb;
  border-left: 3px solid #1976d2;
  border-radius: var(--radius);
}

.form-note .fa {
  margin-top: 0.15rem;
  color: #1976d2;
}

.form-note span {
  flex: 1 1 auto;
  min-width: 0;
}

.form-select.is-changed,
.form-control.is-changed {
  border-color: #d97706;
  background-color: #fffbeb;
}

.form-select.is-changed:focus,
.form-control.is-changed:focus {
  border-color: #d97706;
  box-shadow: 0 0 0 0.2rem rgba(217, 119, 6, 0.15);
}

.change-flag {
  display: inline-block;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #92400e;
  background-color: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 50rem;
  padding: 0.1rem 0.5rem;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.table-action-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted) !important;
  text-decoration: none !important;
  padding: 0.3rem 0.6rem;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: 8px;
  box-shadow: none !important;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  line-height: 1.3;
}

.table-action-link:hover,
.table-action-link:focus-visible {
  text-decoration: none !important;
  background: var(--action-bg) !important;
  color: var(--action-hover) !important;
  border-color: var(--action-border) !important;
}

.table-action-link--danger {
  color: var(--danger) !important;
}

.table-action-link--danger:hover,
.table-action-link--danger:focus-visible {
  background: var(--danger-bg) !important;
  color: #b91c1c !important;
  border-color: var(--danger-border) !important;
}

button.table-action-link {
  cursor: pointer;
  font-family: inherit;
}

.table-action-link--icon {
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 0.85rem;
}

.table-action-link--icon.table-action-link--danger {
  color: #94a3b8 !important;
  background: transparent !important;
  border-color: transparent !important;
}

.table-action-link--icon.table-action-link--danger:hover,
.table-action-link--icon.table-action-link--danger:focus-visible {
  color: #ffffff !important;
  background: #dc2626 !important;
  border-color: #dc2626 !important;
}

.admin-tabs {
  margin-bottom: 1.15rem;
}

.admin-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 1.15rem 1.2rem 1.3rem;
  box-shadow: var(--shadow);
}

#success-alert.alert {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1080;
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: min(24rem, calc(100vw - 2rem));
  margin: 0;
  padding: 0.7rem 0.9rem 0.7rem 1rem;
  border-left: 4px solid #15803d;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
  animation: toast-in 0.2s ease-out;
}

#success-alert.alert .btn-close {
  margin-left: auto;
  float: none !important;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-0.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

.delete-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.report-filter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow);
}

.report-filter > .row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem 1rem;
  margin: 0;
}

.report-filter > .row > [class*="col-"] {
  width: auto;
  max-width: none;
  padding: 0;
  flex: 0 1 auto;
  min-width: 9rem;
}

.report-filter > .row > [class*="col-"]:first-child {
  flex: 1 1 14rem;
  max-width: 20rem;
  min-width: 12rem;
}

.report-filter > .row > [class*="col-"]:last-child {
  flex: 0 0 auto;
  min-width: 0;
}

.report-filter .form-group {
  margin-bottom: 0;
}

.report-filter .form-control {
  width: 100%;
}

.report-filter .btn {
  white-space: nowrap;
}

.report-filter label {
  display: block;
  font-size: 0.8rem;
  font-weight: 650;
  margin-bottom: 0.3rem;
}

/* Tick-box form picker: full-width panel above the year filters. */
.report-filter > .row > .report-form-filter-col {
  flex: 1 1 100%;
  max-width: 100%;
  min-width: 100%;
}

.report-form-filter {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.35rem 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--page-bg);
}

.report-filter .report-form-filter__item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.report-filter .report-form-filter__item .form-check-input {
  flex-shrink: 0;
  margin: 0;
  cursor: pointer;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

/* ----- Faculty Report redesign (shared with My Report) ----- */
.report-filter--sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.6rem 0.8rem;
}

.report-filter__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.7rem;
}

.report-filter__field {
  min-width: 7rem;
}

.report-filter__field label {
  margin-bottom: 0.25rem;
}

.report-filter__field--years {
  min-width: 4.5rem;
}

.report-filter__field--years input {
  width: 4.5rem;
}

.report-filter__actions {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Same size for every control in the bar; buttons stay uniform. */
.report-filter__bar .form-control,
.report-filter__bar .btn {
  height: 34px;
  padding-top: 0;
  padding-bottom: 0;
  font-size: 0.85rem;
}

.report-filter__bar .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 8.5rem;
}

.report-record-link__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--action-bg);
  color: var(--action);
  font-size: 0.72rem;
  font-weight: 700;
}

.report-record-link:hover .report-record-link__count,
.report-record-link:focus .report-record-link__count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.report-forms-picker {
  margin-top: 0.75rem;
}

.report-forms-picker summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 650;
  margin-bottom: 0.5rem;
}

.report-forms-picker summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.report-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.report-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--action-border);
  border-radius: 999px;
  background: var(--action-bg);
  color: var(--action);
  font-size: 0.78rem;
  text-decoration: none;
}

.report-chip:hover,
.report-chip:focus {
  background: var(--action);
  border-color: var(--action);
  color: #fff;
}

.report-chip--reset {
  background: #fff;
  border-color: var(--line);
  color: var(--text-muted);
}

.report-chip--reset:hover,
.report-chip--reset:focus {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.report-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.report-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.report-kpi__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.report-kpi__label {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.report-category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.1rem;
  padding: 0;
  list-style: none;
}

.report-category-strip a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  text-decoration: none;
}

.report-category-strip a:hover,
.report-category-strip a:focus {
  border-color: var(--brand);
  color: var(--brand);
}

.report-category-strip__count {
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.report-tabs {
  gap: 0.35rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.report-tabs .nav-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
}

.report-tabs .nav-link.active,
.report-tabs .nav-link:hover,
.report-tabs .nav-link:focus {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.report-chart-card {
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.report-chart-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.report-chart-card__head h6 {
  margin: 0;
}

.report-chart-card__period {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.report-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.85rem;
}

.report-section__title {
  margin: 0;
  font-size: 1.15rem;
}

.report-section__period {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.report-print-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

@media print {
  body.has-sidebar {
    display: block;
    height: auto;
    overflow: visible;
  }

  body.has-sidebar #main-content {
    overflow: visible;
    height: auto;
    margin: 0;
    width: 100%;
    border: 0;
    background: #fff;
  }

  #sidebar,
  .topbar,
  .report-filter,
  .report-tabs,
  .report-print-actions,
  .footer,
  .undo-stack,
  .role-update-banner {
    display: none !important;
  }

  .report-kpi,
  .report-chart-card,
  .report-section,
  .report-summary {
    break-inside: avoid;
    box-shadow: none;
  }
}

#main-content:has(.report-filter) .page-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

#main-content:has(.report-filter) .page-header p {
  margin: 0;
}

#main-content:has(.report-filter) .page-header:has(> div) {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

#main-content:has(.report-filter) h5 {
  margin: 1.6rem 0 0.35rem;
  font-size: 1.05rem;
}

#main-content:has(.report-filter) h6 {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 0.65rem;
}

#main-content:has(.report-filter) .card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
  background: var(--surface);
}

#main-content:has(.report-filter) .pie-chart-wrapper {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: auto;
  width: min(100%, 15rem);
  max-width: 100%;
  flex: 0 0 auto;
  padding: 0.75rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

#main-content:has(.report-filter) .pie-charts-container > .row {
  flex: 1 1 100%;
  align-items: center;
}

#main-content:has(.report-filter) .pie-charts-container > .row > .col:first-child {
  flex: 0 0 auto;
  width: auto;
}

#main-content:has(.report-filter) .pie-charts-container .pie-chart-wrapper {
  width: 15rem;
}

#main-content:has(.report-filter) .legend-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#main-content:has(.report-filter) .legend-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
}

/* Chart.js default palette order, so swatches match pie slices. */
#main-content:has(.report-filter) .legend-list li::before {
  content: "";
  flex: 0 0 auto;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 2px;
  background: rgb(201, 203, 207);
}

#main-content:has(.report-filter) .legend-list li:nth-child(7n + 1)::before { background: rgb(54, 162, 235); }
#main-content:has(.report-filter) .legend-list li:nth-child(7n + 2)::before { background: rgb(255, 99, 132); }
#main-content:has(.report-filter) .legend-list li:nth-child(7n + 3)::before { background: rgb(255, 159, 64); }
#main-content:has(.report-filter) .legend-list li:nth-child(7n + 4)::before { background: rgb(255, 205, 86); }
#main-content:has(.report-filter) .legend-list li:nth-child(7n + 5)::before { background: rgb(75, 192, 192); }
#main-content:has(.report-filter) .legend-list li:nth-child(7n + 6)::before { background: rgb(153, 102, 255); }

#main-content:has(.report-filter) .legend-count {
  margin-left: auto;
  padding-left: 1rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

#main-content:has(.report-filter) .legend-wrapper {
  max-width: 18rem;
}

#main-content:has(.report-filter) div > canvas {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 1rem;
}

#main-content:has(.report-filter) .pie-chart-wrapper > canvas {
  border: 0;
  background: transparent;
  margin: 0;
  padding: 0;
}

#main-content:has(.report-filter) .chart > canvas,
#main-content:has(.report-filter) .card canvas {
  border: 0;
  background: transparent;
  margin: 0;
  padding: 0.65rem 0.85rem 0.85rem;
}

#downloadBttn {
  margin-bottom: 1rem;
}

/* Inside a flex button row both buttons must share identical box metrics. */
.d-flex > #downloadBttn {
  margin-bottom: 0;
}

/* ----- Shared module list chrome ----- */
.action-link {
  display: inline-block;
  border: 1px solid var(--brand);
  padding: 8px 12px;
  background-color: var(--page-bg);
  color: var(--brand);
  text-decoration: none;
  border-radius: 3px;
  font-size: 0.9rem;
  line-height: 1.2;
  cursor: pointer;
}

.action-link-2 {
  border: 1px solid var(--brand);
  padding: 8px 12px;
  background-color: var(--page-bg);
  color: var(--brand);
  text-decoration: none;
  border-radius: 3px;
}

.action-link:hover,
.action-link-2:hover,
.action-link:focus {
  border-color: var(--brand);
  background-color: var(--brand);
  color: #ffffff;
}

a.action-link.action-link-primary,
button.action-link.action-link-primary {
  background-color: var(--brand);
  color: #fff;
}

a.action-link.action-link-primary:hover,
a.action-link.action-link-primary:focus,
button.action-link.action-link-primary:hover,
button.action-link.action-link-primary:focus {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.module-toolbar .dropdown-toggle::after {
  margin-left: 0.4em;
}

.module-toolbar .more-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
}

.module-toolbar .more-icon-btn::after {
  display: none;
}

.module-toolbar .dropdown-item {
  color: #212529;
  font-size: 0.9rem;
}

.module-toolbar .dropdown-item .fa {
  width: 1rem;
  margin-right: 0.35rem;
  text-align: center;
}

.module-toolbar form {
  margin: 0;
}

.table-responsive-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

/* Module tables never scroll vertically inside their card: the whole
   content sheet scrolls instead, and the sticky header sticks to it.
   Narrower screens fall back to horizontal scrolling so wide tables stay
   reachable. */
.table-responsive-wrap:has(> #submissionTable) {
  overflow: visible;
}

@media (max-width: 1399.98px) {
  .table-responsive-wrap:has(> #submissionTable) {
    overflow-x: auto;
    overflow-y: hidden;
  }
}

/* With the wrap no longer clipping, round the table's own corners so it
   still matches the card's radius. */
#main-content #submissionTable thead th:first-child {
  border-top-left-radius: 11px;
}

#main-content #submissionTable thead th:last-child {
  border-top-right-radius: 11px;
}

#main-content #submissionTable tbody tr:last-child td:first-child {
  border-bottom-left-radius: 11px;
}

#main-content #submissionTable tbody tr:last-child td:last-child {
  border-bottom-right-radius: 11px;
}

/* ----- Global search results ----- */
.search-group {
  margin-bottom: 1.5rem;
}

.search-group__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.search-group__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.search-results__title {
  min-width: 12rem;
  font-weight: 600;
}

.search-results__match {
  max-width: 24rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}

@media (max-width: 767.98px) {
  .search-results__match {
    max-width: 12rem;
  }
}

/* ----- Cross-page shared components ----- */
.error-page {
  max-width: 34rem;
  margin: 3rem auto;
  padding: 2rem 1.5rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.error-page__icon {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 2.5rem;
  color: #d97706;
}

.error-page__title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 650;
}

.error-page__text {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.error-page__meta {
  margin: 0 0 1.1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.error-page__dev {
  max-width: 34rem;
  margin: 0 auto 2rem;
}

.report-section,
.chart-section {
  margin-bottom: 1.6rem;
}

.legend-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.text-value {
  padding: 0.4rem 0.6rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Form customisation */
.opt-vis-btn {
  min-width: 32px;
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

.order-btn {
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.order-btn + .order-btn {
  margin-left: 0.2rem;
}

.order-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.field-row--new td {
  background-color: #f2f7ff !important;
}

.form-custom__actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
}

.form-custom__actions-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

/* Duplicate .table-actions removed (kept canonical at top). */

#main-content .table {
  width: 100%;
  margin: 0;
  box-shadow: none;
  background: var(--surface);
}

#main-content .table th,
#main-content .table td {
  vertical-align: middle;
  padding: 0.7rem 0.9rem;
  border-color: var(--line);
  background-color: transparent;
}

#main-content .table thead th {
  background: #f3f1ea;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--line);
}

#main-content .table tbody tr:hover {
  background: #f6f4ee;
}

#main-content .pagination {
  margin: 1rem 0 0;
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: wrap;
}

#main-content .pagination a,
#main-content .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

#main-content .pagination a:hover,
#main-content .pagination a:focus-visible {
  border-color: var(--action-border);
  background: var(--action-bg);
  color: var(--action);
}

#main-content .pagination .active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

#main-content .pagination .disabled {
  color: #c3c9d4;
  border-color: var(--line);
  background: transparent;
  pointer-events: none;
}

/* ----- Cards / home hub ----- */
.card {
  border-radius: var(--radius);
  border-color: var(--line);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  background-color: var(--surface);
  box-shadow: var(--shadow);
}

.login-card:hover,
.signup-card:hover,
.forgetPassword-card:hover,
.bar-chart:hover {
  transform: none;
  background-color: #fff;
}

.password-toggle {
  padding: 0 0.25rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.125rem;
  line-height: 1;
}

.password-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.card-body {
  padding: 20px;
}

.stat-number {
  font-size: 2rem;
  font-weight: bold;
  color: var(--brand);
}

.home-overview {
  max-width: 64rem;
}

.home-overview__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .home-overview__grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.85rem;
  margin: 0 0 1.5rem;
}

@media (max-width: 900px) {
  .home-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

.home-action {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.home-action:hover,
.home-action:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 6px 16px rgba(48, 53, 150, 0.12);
  color: var(--text);
  transform: translateY(-1px);
}

.home-action__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9px;
  background: #eceaf6;
  color: var(--brand);
  font-size: 1.05rem;
}

.home-action__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.home-action__title {
  font-weight: 700;
  white-space: nowrap;
}

.home-action__hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.home-attention {
  margin: 0 0 1.5rem;
}

.home-attention__list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
}

.home-attention__list li {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.75rem 1rem;
}

.home-attention__list li + li {
  border-top: 1px solid #fdecb2;
}

.home-attention__list .fa {
  margin-top: 0.2rem;
  color: #b45309;
}

.home-attention__text {
  flex: 1 1 auto;
  min-width: 0;
}

.home-attention__label {
  font-weight: 700;
}

.home-attention__list a {
  flex: 0 0 auto;
  font-weight: 600;
}

.home-section-title {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.home-record-list li {
  display: flex;
  align-items: stretch;
}

.home-record-list a.home-record-list__open {
  flex: 1 1 auto;
  min-width: 0;
}

.home-record-list a.home-record-list__add {
  flex: 0 0 auto;
  justify-content: center;
  width: 2.375rem;
  padding: 0;
  color: var(--text-muted);
  border-left: 1px solid var(--line);
}

.home-record-list a.home-record-list__add:hover,
.home-record-list a.home-record-list__add:focus-visible {
  color: #ffffff;
  background: var(--brand);
}

.home-record-list li.is-empty .home-record-list__open {
  color: var(--text-muted);
}

.home-record-list li.is-empty .home-record-list__count {
  color: #b8b2a3;
  font-weight: 400;
}

.home-recent {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.home-recent li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 1rem;
}

.home-recent li + li {
  border-top: 1px solid var(--line);
}

.home-recent__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.home-recent__title:hover {
  color: var(--brand);
  text-decoration: underline;
}

.home-recent__meta {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.home-recent--empty {
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.home-overview__header {
  margin-bottom: 1.25rem;
}

.home-overview__title {
  margin: 0 0 0.3rem;
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.home-overview__lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.home-record-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.home-record-list li + li {
  border-top: 1px solid var(--line);
}

.home-record-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  color: var(--text);
  text-decoration: none;
}

.home-record-list a:hover {
  background: #f3f1ea;
  color: var(--text);
}

.home-record-list__count {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.auth-screen {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: calc(100vh - 140px);
  padding: 2rem 1rem;
}

/* Front-door pages: fill exactly one viewport, card vertically centred. Scoped
   to the signed-out shell so an in-app visit (sidebar visible) still scrolls. */
body:not(.has-sidebar):has(.auth-screen--fit) {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

body:not(.has-sidebar):has(.auth-screen--fit) > header,
body:not(.has-sidebar):has(.auth-screen--fit) > footer {
  flex: 0 0 auto;
}

body:not(.has-sidebar):has(.auth-screen--fit) #main-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body:not(.has-sidebar):has(.auth-screen--fit) main.content-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
}

.auth-screen--fit {
  flex: 1 1 auto;
  align-items: center;
  min-height: 0;
  padding: 1.5rem 1rem;
}

/* Signed-out top bar mirrors the dark app shell chrome. */
.auth-topbar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 3.5rem;
  padding: 0 1.1rem;
  background: var(--shell-bg);
  color: #fff;
}

.auth-topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.auth-topbar__brand:hover,
.auth-topbar__brand:focus-visible {
  color: #fff;
}

.auth-topbar__logo {
  height: 34px;
  width: auto;
}

.auth-topbar__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-topbar__meta {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Unified auth pages (login / verify / forgot / reset): one card, token-driven. */
.auth-card {
  width: 100%;
  max-width: 26.5rem;
  margin-inline: auto;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1.9rem;
}

.auth-head {
  text-align: center;
  margin-bottom: 1.4rem;
}

.auth-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.85rem;
  border-radius: 14px;
  background: #eceaf6;
  color: var(--brand);
  font-size: 1.3rem;
  line-height: 1;
}

.auth-icon--success {
  background: #ecfdf5;
  color: #047857;
}

.auth-icon--warn {
  background: #fffbeb;
  color: #b45309;
}

.auth-icon--danger {
  background: #fef2f2;
  color: #b91c1c;
}

.auth-title {
  text-align: center;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0 0 1.3rem;
}

.auth-subtitle:last-child {
  margin-bottom: 0;
}

/* Inputs with a leading icon; the password toggle keeps its own space. */
.auth-field {
  position: relative;
}

.auth-field__icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.auth-card .form-control {
  min-height: 2.9rem;
}

.auth-field .form-control {
  padding-left: 2.45rem;
}

.auth-card .form-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}

.auth-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.15rem;
  font-size: 0.85rem;
}

.auth-links--center {
  justify-content: center;
  margin: 1.1rem 0 0;
}

.auth-links a {
  font-weight: 600;
  text-decoration: none;
}

.auth-links a:hover,
.auth-links a:focus-visible {
  text-decoration: underline;
}

.auth-submit {
  width: 100%;
  padding: 0.7rem;
  font-weight: 700;
  font-size: 1rem;
}

.auth-footnote {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
}

.auth-footnote .fa {
  color: var(--brand);
}

/* Secondary block on the verify page (resend code). */
.auth-alt {
  margin-top: 1.35rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.auth-alt__title {
  font-size: 0.92rem;
  font-weight: 650;
  margin: 0 0 0.2rem;
}

.auth-alt__hint {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 0 0 0.8rem;
}

.auth-alt__form .btn {
  margin-top: 0.65rem;
}

/* 6-digit OTP input reads as a single code, not free text. */
.auth-otp {
  text-align: center;
  text-indent: 0.42em;
  letter-spacing: 0.42em;
  font-size: 1.2rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.auth-email {
  display: inline-block;
  max-width: 100%;
  margin: 0 0 0.85rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: #f1f5f9;
  font-size: 0.9rem;
  font-weight: 600;
  word-break: break-all;
}

.auth-rules {
  list-style: none;
  margin: 0.25rem 0 1.15rem;
  padding: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.auth-rules li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.2rem;
}

.auth-rules .fa {
  color: var(--brand);
  font-size: 0.7rem;
}

.module-empty {
  margin: 1.25rem 0;
  padding: 1.5rem 1.25rem;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.module-empty__title {
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.module-empty__hint {
  color: #555;
  font-size: 0.95rem;
}

.module-empty ~ .table-responsive-wrap,
.module-empty ~ .pagination {
  display: none;
}

.btn-outline-primary {
  color: var(--brand);
  border-color: var(--brand);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
  color: #fff;
  background-color: var(--brand);
  border-color: var(--brand);
}

#main-content > main {
  max-width: 1120px;
}

#main-content h1 {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 1.1rem;
  color: var(--text);
}

.entry-title {
  margin-bottom: 0.25rem !important;
}

.entry-subtitle {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.entry-required {
  color: #c0392b;
  font-weight: 700;
  margin-left: 0.15rem;
}

.entry-field {
  margin-bottom: 1rem;
}

.entry-field .control-label {
  display: block;
  margin-bottom: 0.35rem;
}

.entry-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  padding: 0.75rem 1.75rem calc(0.75rem + env(safe-area-inset-bottom));
  margin: 0;
  background: var(--page-bg);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(28, 28, 28, 0.08);
}

body.has-sidebar .entry-form__actions {
  left: var(--sidebar-width);
}

form:has(.entry-form__actions) {
  padding-bottom: 5rem;
}

@media (max-width: 991.98px) {
  body.has-sidebar .entry-form__actions {
    left: 0;
  }
}

.select2-container {
  width: 100% !important;
}

.idle-warning {
  position: fixed;
  bottom: 5rem;
  right: 20px;
  background-color: var(--warning-bg);
  color: black;
  padding: 10px 15px;
  border-radius: var(--radius);
  display: none;
  z-index: 9999;
  font-weight: bold;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

/* Don't clip sticky/focus; use clip (no scrollbar) instead of hidden. */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

#main-content,
.table-responsive-wrap,
.admin-panel,
.form-create,
.filter-bar,
.home-overview,
.profile-panel {
  min-width: 0;
  max-width: 100%;
}

#main-content .table th,
#main-content .table td {
  overflow-wrap: break-word;
}

#main-content .table td.col-actions {
  width: 1%;
  white-space: nowrap;
}

.form-create {
  width: 100%;
}

.display-4 {
  font-size: clamp(1.2rem, 4vw, 2.25rem);
}

.card.bar-chart {
  width: 100%;
}

body:not(.has-sidebar) > header .navbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0.75rem;
}

body:not(.has-sidebar) > header .navbar img {
  width: min(180px, 42vw) !important;
  height: auto;
  padding: 0 !important;
}

body:not(.has-sidebar) > header .navbar-brand {
  margin: 0;
  white-space: normal;
  font-size: 0.95rem;
  line-height: 1.25;
  max-width: 100%;
}

#alertPlaceholder {
  left: 1rem;
  right: 1rem;
  width: auto;
  max-width: 36rem;
  padding: 1rem;
}

@media (max-width: 767.98px) {
  .profile-fields {
    grid-template-columns: 1fr;
  }

  .scopus-search {
    align-items: stretch;
    flex-direction: column;
  }

  .scopus-search__filters {
    width: 100%;
  }

  .scopus-search__filters .form-select {
    flex: 1 1 8rem;
    min-width: 0;
  }

  .count-grid {
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  }

  .centered-box,
  .centered-createbox {
    width: calc(100% - 1.5rem);
    height: auto;
    max-height: 90vh;
    overflow: auto;
  }

  .idle-warning {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }
}

@media (max-width: 575.98px) {
  .module-toolbar {
    margin-top: 0;
    width: auto;
    justify-content: flex-start !important;
  }

  .page-header {
    flex-direction: column;
  }

  .page-header__title,
  h1.page-header__title,
  #main-content h1 {
    font-size: 1.2rem;
  }

  #main-content > main {
    padding: 1rem 1rem 2rem;
  }

  .admin-panel,
  .form-create {
    padding: 0.9rem;
  }

  .login-card.p-5 {
    padding: 1.25rem !important;
  }

  .auth-screen {
    padding: 1rem 0.75rem;
  }

  .entry-form__actions {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .entry-form__actions .btn {
    flex: 1 1 auto;
  }

  #main-content .table th,
  #main-content .table td {
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
  }

  #main-content #submissionTable thead th,
  #main-content #submissionTable tbody td {
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
  }

  .btn-addAuthor {
    width: 100%;
    min-width: 0;
  }
}

/* ----- Dynamic Forms & Details ----- */
.form-create {
  margin: 0 auto 1.5rem;
  padding: 1.35rem 1.5rem 0.25rem;
  max-width: 1100px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background-color: var(--surface);
}

.form-details {
  display: grid;
  justify-content: center;
  grid-template-columns: 1fr;
  margin: 0 auto 1.5rem;
  padding: 1.25rem 1.5rem;
  max-width: 1100px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background-color: var(--surface);
}

.field-value {
  width: 100%;
  max-width: 400px;
  padding: 0.4rem 0.6rem;
  box-sizing: border-box;
  background-color: #f8f9fa;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.textarea-value {
  width: 100%;
  max-width: 500px;
  min-height: 2.5rem;
  max-height: 12rem;
  padding: 0.4rem 0.6rem;
  box-sizing: border-box;
  background-color: #f8f9fa;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: auto;
  overflow-wrap: break-word;
  display: block;
}

.coauthor-list {
  margin-top: 0.35rem;
}

.coauthor-item {
  margin-bottom: 0.35rem;
}

.btn-addAuthor {
  margin-top: 10px;
  margin-bottom: 15px;
  width: auto;
  min-width: 12rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  cursor: pointer;
  background-color: var(--surface);
  color: var(--brand);
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-addAuthor:hover,
.btn-addAuthor:focus {
  background-color: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.btn-closeAuthor {
  width: auto;
  min-width: 2.25rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  cursor: pointer;
  background-color: var(--brand);
  color: #fff;
}

.btn-closeAuthor:hover {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
}

.btn-top {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  cursor: pointer;
  background-color: var(--page-bg);
  color: var(--brand);
  font-size: 0.875rem;
}

.btn-top:hover {
  background-color: var(--brand);
  color: #fff;
}

/* ----- Notifications ----- */
.notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 52rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  transition: background-color 0.15s ease;
}

.notification-item + .notification-item {
  border-top: 1px solid var(--line);
}

.notification-item.is-unread {
  background: #f5f6fc;
}

.notification-item:hover {
  background: #f6f4ee;
}

.notification-item__avatar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--brand);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
}

.notification-item.is-read .notification-item__avatar {
  background: #c9c4b6;
}

.notification-item__body {
  flex: 1 1 auto;
  min-width: 0;
}

.notification-item__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin-bottom: 0.2rem;
  font-size: 0.85rem;
}

.notification-item__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--brand);
}

.notification-item.is-read .notification-item__dot {
  display: none;
}

.notification-item__sender {
  font-weight: 700;
  color: var(--text);
}

.notification-item__time {
  color: var(--text-muted);
}

.notification-item__time::before {
  content: "ÃƒÆ’Ã¢â‚¬Å¡Ãƒâ€šÃ‚Â·";
  margin-right: 0.5rem;
}

.notification-item__message {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notification-item.is-unread .notification-item__message {
  font-weight: 600;
}

.notification-item.is-read .notification-item__message {
  color: var(--text-muted);
}

.notification-item__message.is-expanded {
  display: block;
  -webkit-line-clamp: unset;
}

.notification-item__more {
  margin-top: 0.3rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 600;
}

.notification-item__more:hover {
  text-decoration: underline;
}

.notification-item__actions {
  flex: 0 0 auto;
  display: flex;
  gap: 0.25rem;
}

.notification-item__actions form {
  margin: 0;
}

.notification-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.notification-action:hover,
.notification-action:focus-visible {
  background: #eceaf6;
  color: var(--brand);
}

.notification-action--dismiss:hover,
.notification-action--dismiss:focus-visible {
  background: #fdecec;
  color: #b91c1c;
}

.notification-empty {
  max-width: 52rem;
  text-align: center;
}

.notification-empty__icon {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Table & Record Display Enhancements
   ========================================================================== */

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  border-radius: 50rem;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
}

.status-badge--success {
  background-color: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.status-badge--info {
  background-color: #f0f9ff;
  color: #0369a1;
  border-color: #bae6fd;
}

.status-badge--warning {
  background-color: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.status-badge--danger {
  background-color: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.status-badge--neutral {
  background-color: #f8fafc;
  color: #64748b;
  border-color: #e2e8f0;
}

/* Title links and truncation */
.text-truncate-title {
  width: 45%;
  min-width: 9rem;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.title-link {
  color: #1e293b;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}

.title-link:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* Table Hover and Layout */
#main-content #submissionTable {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  vertical-align: middle;
}

#main-content #submissionTable thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background-color: #fafbfc;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 0;
  border-bottom: 1px solid var(--line);
  box-shadow: none;
  padding: 0.75rem 1rem;
  vertical-align: middle;
  white-space: nowrap;
}

#main-content #submissionTable tbody tr {
  transition: background-color 0.12s ease-in-out;
  cursor: pointer;
}

/* Keep the hover highlight after the zebra reset below (same specificity). */
#main-content #submissionTable tbody tr:nth-child(even) {
  background-color: transparent;
}

#main-content #submissionTable tbody tr:hover,
#main-content #submissionTable tbody tr:nth-child(even):hover {
  background-color: #f1f5f9;
}

#main-content #submissionTable tbody td {
  border: 0;
  border-bottom: 1px solid #eef2f7;
  padding: 0.8rem 1rem;
  background-color: transparent;
  vertical-align: middle;
}

#main-content #submissionTable tbody tr:last-child td {
  border-bottom: 0;
}

#submissionTable thead th:last-child,
#submissionTable tbody td:last-child,
.col-actions,
th.col-actions,
td.col-actions,
.table thead th.col-actions,
.table tbody td.col-actions,
td:has(> .table-actions) {
  text-align: center !important;
  vertical-align: middle !important;
}

/* Sticky Headers for Preview Tables */
.table-sticky-header table thead th {
  position: sticky;
  top: 0;
  background-color: #f8fafc;
  z-index: 2;
  box-shadow: inset 0 -1px 0 #e2e8f0;
}

/* Details View Card System */
.details-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.details-card-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.85rem 1.25rem;
}

.details-card-body {
  padding: 1.25rem;
}

.details-card dt {
  font-size: 0.88rem;
  font-weight: 600;
  color: #64748b;
}

.details-card dd {
  font-size: 0.92rem;
  color: #1e293b;
}

/* ----- Record view (Details page) ----- */
.record-view {
  max-width: 1100px;
  margin: 0 auto;
}

.record-view__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
}

#main-content .record-view__title {
  margin: 0 0 0.25rem;
  font-size: 1.6rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.record-view__meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.record-view__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.record-view__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.record-view__back:hover,
.record-view__back:focus-visible {
  color: var(--brand);
  border-color: var(--brand);
  text-decoration: none;
}

.record-view__jump {
  max-width: 24rem;
  margin: 0 0 1rem auto;
}

.record-view .details-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.record-view .details-card-header {
  padding: 0.8rem 1.25rem;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
}

.record-view .details-card-header h5 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.record-view .details-card-body {
  padding: 1.25rem;
}

.record-view .details-card-body:has(.details-grid) {
  padding: 0.35rem 1.25rem;
}

/* Definition grid: label column + value column, one row per field. */
.record-view .details-grid {
  display: grid;
  grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr);
  margin: 0;
}

.record-view .details-grid dt,
.record-view .details-grid dd {
  margin: 0;
  padding: 0.8rem 0;
  border-bottom: 1px solid #eef2f7;
}

.record-view .details-grid dt {
  padding-right: 1.25rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.record-view .details-grid dd {
  color: var(--text);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.record-view .details-grid > dt:nth-last-child(-n + 2),
.record-view .details-grid > dd:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.record-view .details-grid__text {
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 679.98px) {
  .record-view .details-grid {
    grid-template-columns: 1fr;
  }

  .record-view .details-grid dt {
    padding-bottom: 0.15rem;
    border-bottom: 0;
  }

  .record-view .details-grid dd {
    padding-top: 0;
  }
}

/* Collaborator & Author Chips */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 50rem;
  font-size: 0.83rem;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
  color: #1e293b;
}

.user-chip.internal-chip {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.user-chip.external-chip {
  background-color: #f5f3ff;
  border-color: #ddd6fe;
  color: #5b21b6;
}

.user-chip .chip-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.internal-chip .chip-badge {
  background-color: #2563eb;
  color: #ffffff;
}

.external-chip .chip-badge {
  background-color: #7c3aed;
  color: #ffffff;
}

.user-chip.deactivated-chip {
  background-color: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.deactivated-chip .chip-badge {
  background-color: #b91c1c;
  color: #ffffff;
}

/* Attachment Box */
.attachment-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.attachment-box:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

/* Duplicate entries table in Excel preview */
.table-duplicate-entries {
  border-color: #fde68a !important;
  background-color: #fffdf5;
}

.table-duplicate-entries thead th {
  background-color: #fef3c7 !important;
  color: #92400e !important;
}

/* ==========================================================================
   Calm, forgiving interactions
   ========================================================================== */

.btn-primary:disabled,
.btn-primary.disabled {
  background-color: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  opacity: 0.4;
}

.entry-optional {
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #f1efe7;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: 0.1em;
}

.entry-subtitle .entry-optional {
  margin-left: 0;
}

.form-error {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem;
  max-width: 52rem;
  background: #fdf3f2;
  border: 1px solid #f3c9c4;
  border-left: 4px solid #c0392b;
  border-radius: var(--radius);
}

.form-error__icon {
  margin-top: 0.1rem;
  color: #c0392b;
  font-size: 1.15rem;
}

.form-error p {
  margin: 0;
}

.form-error__title {
  font-weight: 700;
  color: #7f1d1d;
}

.form-error__text {
  color: var(--text);
}

.form-error__hint {
  margin-top: 0.2rem !important;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.has-error .control-label {
  color: #b42318;
}

.has-error .form-control,
.has-error .form-select,
.has-error .select2-selection {
  border-color: #d92d20 !important;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12) !important;
}

.draft-notice {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 52rem;
  margin: 0 0 1rem;
  padding: 0.55rem 0.85rem;
  background: #eef1fb;
  border: 1px solid #d5dbf3;
  border-radius: var(--radius);
  color: #2b327f;
  font-size: 0.92rem;
}

.draft-notice .btn-link {
  margin-left: auto;
  padding: 0;
  font-weight: 600;
}

#submissionTable tbody tr.is-just-saved > td {
  animation: just-saved 2.4s ease-out;
}

@keyframes just-saved {
  0%, 35% { background-color: #fff4c7; }
  100% { background-color: transparent; }
}

#submissionTable tbody tr.is-removing {
  opacity: 0;
  transition: opacity 0.18s ease;
}

.table-action-link--subtle {
  color: #9b3a32 !important;
  background: transparent !important;
  border-color: transparent !important;
}

/* Form tables: actions are icon-only; labels stay for screen readers.
   Calm ghost button: no border, neutral tint on hover instead of a
   blue outlined pill. */
#submissionTable .table-action-link {
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 0.9rem;
  border: 0 !important;
  border-radius: 8px;
  background: transparent !important;
  color: #94a3b8 !important;
  transition: background-color 0.12s ease, color 0.12s ease;
}

#submissionTable .table-action-link:hover,
#submissionTable .table-action-link:focus-visible {
  background: #eef2f7 !important;
  color: #334155 !important;
  border: 0 !important;
}

#submissionTable .table-action-link:active {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

#submissionTable .table-action-link > span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Kebab row menu (fixed strategy keeps it visible inside the scroll container). */
#submissionTable .table-actions.dropdown {
  gap: 0;
}

#submissionTable .dropdown-menu {
  min-width: 9.5rem;
  padding: 0.3rem;
  border-radius: 10px;
  border-color: var(--line);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
}

#submissionTable .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
}

#submissionTable .dropdown-item .fa {
  width: 1rem;
  text-align: center;
}

#submissionTable .dropdown-item.table-action-link--danger {
  color: #b91c1c !important;
}

#submissionTable .dropdown-item.table-action-link--danger:hover,
#submissionTable .dropdown-item.table-action-link--danger:focus-visible {
  background: var(--danger-bg) !important;
  color: #b91c1c !important;
}

.table-action-link--subtle:hover,
.table-action-link--subtle:focus-visible {
  color: #ffffff !important;
  background: #c0392b !important;
  border-color: #c0392b !important;
}

.module-empty .btn {
  margin-top: 0.85rem;
}

.undo-stack {
  position: fixed;
  left: 50%;
  bottom: 5rem;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transform: translateX(-50%);
  pointer-events: none;
}

body.has-sidebar .undo-stack {
  left: calc(50% + var(--sidebar-width) / 2);
}

.undo-toast {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 18rem;
  max-width: calc(100vw - 2rem);
  padding: 0.75rem 0.85rem 0.8rem 1.1rem;
  overflow: hidden;
  border-radius: 8px;
  background: #1f2233;
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.28);
  font-size: 0.95rem;
  pointer-events: auto;
  animation: undo-in 0.2s ease-out;
}

.undo-toast--error {
  background: #7f1d1d;
}

.undo-toast.is-leaving {
  opacity: 0;
  transform: translateY(0.4rem);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.undo-toast__button {
  margin-left: auto;
  padding: 0.3rem 0.8rem;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-weight: 700;
}

.undo-toast__button:hover,
.undo-toast__button:focus-visible {
  background: rgba(255, 255, 255, 0.26);
}

.undo-toast__timer {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: #8b93ff;
  transform-origin: left;
  animation-name: undo-timer;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes undo-in {
  from { opacity: 0; transform: translateY(0.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes undo-timer {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.form-error__text ul {
  margin: 0;
  padding-left: 1.1rem;
}

.upload-steps {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  max-width: 52rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.upload-step {
  display: flex;
  gap: 0.9rem;
  padding: 1rem 1.15rem;
}

.upload-step + .upload-step {
  border-top: 1px solid var(--line);
}

.upload-step__number {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: #eceaf6;
  color: var(--brand);
  font-weight: 700;
}

.upload-step__body {
  flex: 1 1 auto;
  min-width: 0;
}

.upload-step__title {
  margin: 0.2rem 0 0.2rem;
  font-size: 1rem;
  font-weight: 700;
}

.upload-step__text {
  margin: 0 0 0.6rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.upload-step__body form {
  margin: 0;
}

.upload-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 0.4rem !important;
}

.upload-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  padding: 1.4rem 1rem;
  border: 2px dashed #c9c4b6;
  border-radius: 8px;
  background: #fbfaf6;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.upload-drop:hover,
.upload-drop.is-dragging {
  border-color: var(--brand);
  background: #f3f4fd;
}

.upload-drop.has-file {
  border-style: solid;
  border-color: #16a34a;
  background: #f0fdf4;
}

.upload-drop__icon {
  font-size: 1.6rem;
  color: #15803d;
}

.upload-drop__text {
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.upload-drop__hint {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.upload-summary {
  max-width: 52rem;
  margin: 0 0 0.85rem;
  padding: 0.75rem 1rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 4px solid #16a34a;
  border-radius: var(--radius);
  font-weight: 600;
  color: #14532d;
}

.upload-section-title {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: #92400e;
}

.upload-preview-table {
  background: var(--surface);
  font-size: 0.88rem;
}

.upload-preview-table th {
  white-space: nowrap;
}

.report-summary {
  margin: 0 0 1.15rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.report-summary__headline {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 650;
  line-height: 1.45;
}

.report-summary__comparison {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
}

.report-summary__years {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
}

.report-summary__years li {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  background: #f6f4ee;
}

.report-summary__years li.is-current {
  background: #eceaf6;
}

.report-summary__count {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.report-summary__label {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.report-drilldown {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.report-drilldown .form-group {
  flex: 0 1 22rem;
  margin: 0;
}

/* The fixed sidebar sits at Bootstrap's backdrop level, so dialogs need to stack above it. */
.modal-backdrop {
  z-index: 1060;
}

.modal {
  z-index: 1065;
}

.doi-assist {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  max-width: 52rem;
  margin: 0 0 1.25rem;
  padding: 1rem 1.15rem;
  background: linear-gradient(135deg, #f3f4fd 0%, #fbfaf6 100%);
  border: 1px solid #d9ddf5;
  border-radius: 8px;
}

.doi-assist__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--brand);
  color: #ffffff;
}

.doi-assist__body {
  flex: 1 1 auto;
  min-width: 0;
}

.doi-assist__title {
  margin: 0 0 0.15rem;
  font-size: 1.02rem;
  font-weight: 700;
}

.doi-assist__hint {
  margin: 0 0 0.6rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.doi-assist__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.doi-assist__row .form-control {
  flex: 1 1 18rem;
  min-width: 0;
}

.doi-assist__status {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.doi-assist__status:empty {
  display: none;
}

.doi-assist__status[data-tone="success"] {
  color: #166534;
  font-weight: 600;
}

.doi-assist__status[data-tone="error"] {
  color: #b42318;
  font-weight: 600;
}

.is-prefilled .form-control,
.is-prefilled .form-select {
  animation: prefilled 2.2s ease-out;
}

@keyframes prefilled {
  0%, 30% { background-color: #fff4c7; }
  100% { background-color: #ffffff; }
}

@media (prefers-reduced-motion: reduce) {
  .is-prefilled .form-control,
  .undo-toast,
  #submissionTable tbody tr.is-just-saved > td {
    animation: none;
  }
}

/* ----- Real-time role synchronization banner ----- */
.role-update-banner {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10050;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.35rem;
  background-color: #303596;
  color: #ffffff;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
  font-size: 0.95rem;
  font-weight: 500;
  animation: banner-pop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.role-update-banner--danger {
  background-color: #991b1b;
}

.role-update-banner--warning {
  background-color: #92400e;
}

.role-update-banner .fa {
  font-size: 1.15rem;
}

@keyframes banner-pop {
  from {
    opacity: 0;
    transform: translate(-50%, -1rem) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}


/* Frontier-style overrides for forms and buttons */
.form-control, .form-select, .select2-selection {
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.5rem 0.75rem;
}

.form-control:focus, .form-select:focus, .btn:focus-visible, .select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--page-bg), 0 0 0 4px var(--brand);
  outline: none;
}

.form-create .control-label {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.btn-primary {
  background-color: var(--brand);
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
  box-shadow: var(--shadow);
}
/* Additional spacing override */
.entry-field {
  margin-bottom: 1.5rem !important;
}
/* Optional tag override */
.entry-optional {
  font-size: 0.75rem !important;
  color: var(--text-muted) !important;
  background-color: var(--page-bg) !important;
  border: 1px solid var(--line) !important;
  padding: 0.1rem 0.4rem !important;
  font-weight: 500 !important;
}
/* --- World-Class UI/UX Refinements --- */

/* 1. Simplify Layout: Force single column for less zig-zag cognitive load */
.form-create .row {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.form-create .col-md-6 {
  width: 100% !important;
  max-width: 680px !important; /* Perfect reading width */
  flex: none;
}

/* 2. Highlight Active Field (Focus-within) */
.entry-field {
  padding: 1rem 1.25rem;
  margin-bottom: 0.5rem !important;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all 0.2s ease-in-out;
}

/* When a user is focused on an input inside this field, subtly highlight the whole row */
.entry-field:focus-within {
  background-color: #f8fafc; /* Very light slate */
  border-color: #e2e8f0;
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.02);
}

/* 3. Larger, easier to click inputs */
.form-control, .form-select, .select2-selection {
  min-height: 2.375rem; /* Taller for touch/mouse ease */
  font-size: 0.95rem;
  background-color: #ffffff;
}

/* 4. Refine the Optional Tag to look like a pro badge */
.entry-optional {
  float: right;
  font-size: 0.7rem !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted) !important;
  background-color: #f1f5f9 !important;
  border: none !important;
  border-radius: 4px !important;
  padding: 0.2rem 0.5rem !important;
}

/* 5. Sticky Action Bar: Glassmorphism */
.entry-form__actions {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(226, 232, 240, 0.8) !important;
  box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.03) !important;
}

/* 6. Form Card clean up */
.form-create {
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding-top: 0 !important;
}

.entry-title {
  text-align: center;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  font-size: 2rem;
}
.entry-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}
/* Center the Scopus lookup assistant */
.doi-assist {
  margin: 0 auto 2rem !important;
  max-width: 680px !important; /* Match the form width */
}
/* Enhance form hints */
.form-note {
  background-color: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 6px !important;
  color: var(--text-muted) !important;
  font-size: 0.85rem !important;
  padding: 0.35rem 0.75rem !important;
}
.form-note .fa { color: var(--text-muted) !important; }
/* --- Smart Form Grid Layout --- */

/* Reset previous column override */
.form-create .row {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 1.25rem;
  max-width: 680px;
  margin: 0 auto;
  align-items: start;
}

.form-create .col-md-6 {
  width: 100% !important;
  max-width: none !important;
  flex: none;
  /* By default, everything is full width (span 2) */
  grid-column: span 2; 
}

/* 
  Intelligently shrink shorter fields (dates, numbers, simple dropdowns) 
  to 1 column (half width) so they sit side-by-side.
*/
.form-create .col-md-6:has(input[type="date"]),
.form-create .col-md-6:has(input[type="number"]),
.form-create .col-md-6:has(select:not(.searchable-select)) {
  grid-column: span 1;
}

/* Force specific fields to be full width even if they have a simple select */
.form-create .col-md-6:has(select[multiple]) {
  grid-column: span 2;
}

/* On mobile screens, force everything back to 1 column */
@media (max-width: 768px) {
  .form-create .row {
    grid-template-columns: 1fr;
  }
  .form-create .col-md-6 {
    grid-column: span 1 !important;
  }
}
/* Hide the BR tags inside the row so they don't break the CSS Grid */
.form-create .row > br {
  display: none !important;
}
/* --- Smart Form Grid Layout (Side-by-side short fields) --- */

/* Reset previous column override */
.form-create .row {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 1.25rem;
  max-width: 680px;
  margin: 0 auto;
  align-items: start;
}

.form-create .col-md-6 {
  width: 100% !important;
  max-width: none !important;
  flex: none;
  /* By default, everything is full width (span 2) */
  grid-column: span 2; 
}

/* 
  Intelligently shrink shorter fields (dates, numbers, simple dropdowns) 
  to 1 column (half width) so they sit side-by-side.
*/
.form-create .col-md-6:has(input[type="date"]),
.form-create .col-md-6:has(input[type="number"]),
.form-create .col-md-6:has(select:not(.searchable-select)) {
  grid-column: span 1;
}

/* Force specific fields to be full width even if they have a simple select */
.form-create .col-md-6:has(select[multiple]) {
  grid-column: span 2;
}

/* On mobile screens, force everything back to 1 column */
@media (max-width: 768px) {
  .form-create .row {
    grid-template-columns: 1fr !important;
  }
  .form-create .col-md-6 {
    grid-column: span 1 !important;
  }
}
/* Fix form wrapper width to keep Co-Author section aligned with grid */
.form-create {
  max-width: 680px !important;
  margin: 0 auto !important;
}
/* --- Google Form Format Override --- */

/* 1. Force single column for the classic Google Form stacked look */
.form-create .row {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important; /* Managed by card margins now */
}
.form-create .col-md-6 {
  width: 100% !important;
  max-width: none !important;
}

/* 2. Turn every field into a distinct Card */
.entry-field {
  background-color: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  padding: 1rem 1.25rem !important;
  margin-bottom: 1.25rem !important;
  box-shadow: var(--shadow-sm) !important;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* 3. The Google Form left-accent strip when active */
.entry-field::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 5px;
  background-color: transparent;
  transition: background-color 0.2s;
}

.entry-field:focus-within {
  box-shadow: var(--shadow) !important;
  transform: translateY(-1px);
}

.entry-field:focus-within::before {
  background-color: var(--brand) !important;
}

/* 4. Format the label to look like a Question Prompt */
.entry-field .control-label {
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  margin-bottom: 1rem !important;
  display: block;
}

/* 5. Hide the input borders for a cleaner look, or just style them softer */
/* Actually, Google Forms often uses an underline input (Material) but keeping the current style means keeping our offset inputs. 
   We will keep current input styles as requested ("not style (use current style)") */

/* 6. Fix Co-Author section to also look like a card */
#selectedUserContainer, .btn-addAuthor {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  width: 100%;
}
.btn-addAuthor {
  margin: 0 0 1rem 0 !important;
}

/* --- Dropdown, Calendar & Table Refinements --- */

/* 1. Ensure Table Titles are not truncated */
.text-truncate-title {
  max-width: none !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  width: auto !important;
}

/* 2. Refine Calendar (Date Input) Icon */
input[type="date"] {
  position: relative;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  background-color: transparent;
  padding: 0.3rem;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  background-color: var(--line);
}

/* 3. Modernize Select2 Dropdowns */
.select2-container--default .select2-selection--single {
  background-color: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  min-height: 2.375rem !important; 
  height: auto !important; 
  display: flex !important;
  align-items: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 1.4 !important;
  padding: 0.35rem 0.75rem !important;
  color: var(--text) !important;
  white-space: normal !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 2.375rem !important;
  top: 0 !important;
  right: 0.5rem !important;
}
/* 4. Modernize the Select2 Dropdown Panel (The popup list) */
.select2-dropdown {
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  overflow: hidden !important;
  margin-top: 4px !important;
}

.select2-container--default .select2-results__option {
  padding: 0.35rem 0.6rem !important;
  font-size: 0.95rem !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--brand) !important;
  color: white !important;
}
/* Add standard modern dropdown arrow to simple selects */
select.form-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 16px 12px !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  padding-right: 2.25rem !important;
}
/* General Dropdown values styling */
select.form-control option {
  padding: 0.75rem 1rem !important;
  font-size: 0.95rem;
  background-color: var(--surface);
  color: var(--text);
  min-height: 2rem;
}
select.form-control:focus option:checked {
  background-color: var(--brand) !important;
  color: white !important;
}
/* Hover hint styling */
.hover-hint {
  cursor: help;
  margin-left: 0.4rem;
  font-size: 0.95rem;
  line-height: 1;
}
.hover-hint .fa {
  color: var(--text-muted);
  transition: color 0.2s ease;
}
.hover-hint:hover .fa,
.hover-hint:focus-visible .fa {
  color: var(--brand);
}
/* Instant CSS Tooltip for hover-hint */
.hover-hint {
  position: relative;
  display: inline-block;
}
.hover-hint::after {
  content: attr(aria-label);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -10px);
  background: #1e293b;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: pre-wrap; /* allow wrapping for long text */
  width: max-content;
  max-width: 300px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
/* Small arrow for tooltip */
.hover-hint::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, 0);
  border: 5px solid transparent;
  border-top-color: #1e293b;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 9999;
}
.hover-hint:hover::after,
.hover-hint:hover::before,
.hover-hint:focus-visible::after,
.hover-hint:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -2px);
}
.hover-hint:hover::before,
.hover-hint:focus-visible::before {
  transform: translate(-50%, 8px);
}
/* --- Refined File Upload UI --- */

/* 1. Style the Input Container */
input[type="file"].form-control {
  background-color: #f8fafc !important;
  border: 1px dashed var(--brand) !important;
  padding: 0.5rem !important;
  min-min-height: 38px !important; height: auto !important; /* reset from earlier */
  min-height: 38px !important; height: auto !important;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

input[type="file"].form-control:hover {
  background-color: #eff6ff !important;
}

/* 2. Style the actual 'Choose File' button inside the input (Modern Browsers) */
input[type="file"].form-control::file-selector-button {
  background-color: var(--brand);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  margin-right: 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input[type="file"].form-control::file-selector-button:hover {
  background-color: var(--brand-dark);
}

/* 3. Style the current file display badge */
p[id^="file-name-"] {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  background-color: #f1f5f9;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  border: 1px solid #e2e8f0;
}
p[id^="file-name-"]:empty {
  display: none;
}
p[id^="file-name-"]::before {
  content: '\f0c6'; /* FontAwesome paperclip */
  font-family: FontAwesome;
  margin-right: 0.5rem;
  color: var(--brand);
}
/* --- Ultimate Dropzone File Upload --- */

/* 1. Make the input a massive dropzone block */
input[type="file"].form-control {
  position: relative !important;
  width: 100% !important;
  height: 80px !important; 
  background-color: #f8fafc !important;
  border: 2px dashed #cbd5e1 !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  /* Hide the ugly native text */
  color: transparent !important;
  padding: 0 !important;
}

/* 2. Inject a custom "Drag and Drop" prompt */
input[type="file"].form-control::before {
  content: '\f0ee   Drag & drop your PDF here, or click to browse' !important;
  font-family: 'FontAwesome', 'Inter', sans-serif !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #64748b !important;
  font-size: 1rem !important;
  font-weight: 500 !important;
  pointer-events: none !important;
  transition: color 0.2s ease !important;
}

/* 3. Completely destroy the native OS button */
input[type="file"].form-control::file-selector-button {
  display: none !important;
}

/* 4. Dropzone Hover State */
input[type="file"].form-control:hover {
  background-color: #eff6ff !important;
  border-color: var(--brand) !important;
}
input[type="file"].form-control:hover::before {
  color: var(--brand) !important;
}

/* 5. Make the file status badge larger to compensate for hiding the native text */
p[id^="file-name-"] {
  display: flex !important;
  align-items: center !important;
  margin-top: 1rem !important;
  padding: 0.75rem 1.25rem !important;
  background-color: #f1f5f9 !important;
  border-radius: 8px !important;
  font-size: 0.95rem !important;
  color: #0f172a !important;
  font-weight: 600 !important;
  border: 1px solid #cbd5e1 !important;
  width: 100% !important;
}
p[id^="file-name-"]::before {
  font-size: 1.25rem !important;
}

/* --- Compact Mode Overrides --- */
body.compact-mode .form-create {
  max-width: 800px !important;
}

body.compact-mode .form-create .row {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 1rem 1.5rem !important;
}

@media (max-width: 768px) {
  body.compact-mode .form-create .row {
    grid-template-columns: 1fr !important;
  }
}

body.compact-mode .form-create .col-md-6 {
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.compact-mode .entry-field {
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-bottom: 1rem !important;
}

body.compact-mode .form-control:not([type="file"]),
body.compact-mode .form-select,
body.compact-mode .select2-container .select2-selection--single,
body.compact-mode .select2-container .select2-selection--multiple {
  border: 1px solid #ced4da !important;
  border-radius: 4px !important;
  background-color: #fff !important;
}

body.compact-mode .has-error .form-control:not([type="file"]),
body.compact-mode .has-error .form-select,
body.compact-mode .has-error .select2-container .select2-selection--single,
body.compact-mode .has-error .select2-container .select2-selection--multiple {
  border-color: #d92d20 !important;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12) !important;
}

body.compact-mode .form-control:not([type="file"]):focus,
body.compact-mode .form-select:focus,
body.compact-mode .select2-container--default.select2-container--focus .select2-selection--single,
body.compact-mode .select2-container--default.select2-container--focus .select2-selection--multiple {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 2px rgba(48, 53, 150, 0.1) !important;
}

body.compact-mode .entry-field::before {
  display: none !important;
}

body.compact-mode .entry-field:focus-within {
  box-shadow: none !important;
  transform: none !important;
}

body.compact-mode .entry-field .control-label {
  font-size: 0.9rem !important;
  font-weight: 650 !important;
  margin-bottom: 0.35rem !important;
}

body.compact-mode #selectedUserContainer,
body.compact-mode .btn-addAuthor {
  background-color: transparent !important;
  border: 1px dashed var(--line) !important;
  box-shadow: none !important;
  padding: 1rem !important;
  margin-bottom: 1rem !important;
}

body.compact-mode input[type="file"].form-control {
  height: 60px !important;
}

body.compact-mode input[type="file"].form-control::before {
  content: '\f0ee   Click or drag to browse' !important;
  font-size: 0.9rem !important;
}
.select2-container .select2-selection--single { min-height: 38px !important; height: auto !important; } .select2-container .select2-selection--single .select2-selection__rendered { white-space: normal !important; padding-top: 0.2rem; padding-bottom: 0.2rem; } .select2-results__option { white-space: normal !important; }

/* Compact mode tweaks */
body.compact-mode .form-control, body.compact-mode .form-select { padding: 0.375rem 0.75rem !important; min-height: 38px !important; }
body.compact-mode .select2-container .select2-selection--single { height: 38px !important; padding: 2px !important; }
body.compact-mode .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 32px !important; padding-left: 0.5rem !important; }
body.compact-mode .select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px !important; }
body.compact-mode .entry-required { display: inline-block !important; color: #c0392b !important; opacity: 1 !important; visibility: visible !important; font-size: 1rem !important; }

/* ==========================================================================
   Admin dashboard ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â‚¬Å¡Ã‚Â¬ÃƒÂ¢Ã¢â€šÂ¬Ã‚Â visual polish pass
   Scope: Admin Dashboard only (.admin-*) + its reminder composer/settings.
   Goal: calm hierarchy, consistent chips/actions, modern tabs, quieter tables.
   ========================================================================== */

/* ----- Page header ----- */
.admin-page-subtitle {
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.admin-section-title {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

.admin-section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ----- Tabs: segmented control ----- */
.admin-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.3rem;
  margin: 0 0 1.15rem;
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.admin-tabs .nav-link {
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  transition: color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-tabs .nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.65);
}

.admin-tabs .nav-link.active {
  color: var(--brand);
  background: var(--surface);
  border: 0;
  box-shadow: var(--shadow-sm);
}

.admin-tabs .nav-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

/* ----- Panel ----- */
.admin-panel {
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem 1.4rem;
}

/* ----- Compact filter bar (user search) ----- */
.admin-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.admin-filterbar .admin-filterbar__search {
  position: relative;
  flex: 1 1 12rem;
  min-width: 9rem;
}

.admin-filterbar .admin-filterbar__search .fa {
  position: absolute;
  top: 50%;
  left: 0.8rem;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.admin-filterbar .admin-filterbar__search .form-control {
  padding-left: 2.1rem;
}

.admin-filterbar .form-control,
.admin-filterbar .form-select {
  min-height: 2.4rem;
}

.admin-filterbar .form-select {
  flex: 0 1 auto;
  width: auto;
  min-width: 8.5rem;
}

.admin-filterbar .btn {
  min-height: 2.4rem;
  white-space: nowrap;
}

.admin-filterbar .text-danger {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.82rem;
}

.admin-mini-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.admin-table .table-action-link {
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
}

/* Admin-table actions are icon-sized (2rem). Any text label inside the link
   is kept for screen readers but clipped, so "Edit"/"Remove" can no longer
   spill out of the box and overlap the table. */
.admin-table .table-action-link > span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.admin-table .dropdown-menu {
  min-width: 11rem;
  padding: 0.3rem;
  border-radius: 10px;
  border-color: var(--line);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
}

.admin-table .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
}

.admin-table .dropdown-item .fa {
  width: 1rem;
  text-align: center;
}

/* ----- Tables ----- */
.admin-table {
  --bs-table-border-color: #eef2f7;
  margin-bottom: 0;
}

.admin-table > :not(caption) > * > * {
  background-color: transparent;
  box-shadow: none;
  padding: 0.7rem 0.75rem;
  vertical-align: middle;
}

.admin-table thead th {
  padding: 0.55rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.admin-table tbody tr {
  transition: background-color 0.12s ease;
}

.admin-table tbody tr:hover > * {
  background-color: #f8fafc;
}

.admin-table td.col-actions {
  width: 1%;
  white-space: nowrap;
}

/* ----- Chips: one calm component for role/status/metadata ----- */
.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  vertical-align: middle;
}

.admin-chip + .admin-chip {
  margin-left: 0.25rem;
}

.admin-chip i {
  font-size: 0.72rem;
  opacity: 0.85;
}

.admin-chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.admin-chip--success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.admin-chip--warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}

.admin-chip--info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.admin-chip--accent {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #3730a3;
}

/* Account status badges get a subtle state dot inside the dashboard. */
.admin-panel .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.admin-panel .status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.85;
}

/* ----- Switch cards ----- */
.admin-switch {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.admin-switch:hover {
  border-color: #cbd5e1;
}

.admin-switch .form-check-input {
  flex-shrink: 0;
  margin-top: 0.15rem;
  cursor: pointer;
}

.admin-switch .form-check-input:checked {
  background-color: var(--brand);
  border-color: var(--brand);
}

.admin-switch .form-check-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.2rem rgba(48, 53, 150, 0.15);
}

.admin-switch--compact {
  align-items: center;
  padding: 0.4rem 0.75rem;
  background: transparent;
  border-color: transparent;
  min-height: 31px;
  gap: 0.5rem;
}

.admin-switch--compact:hover {
  border-color: var(--line);
  background: #f8fafc;
}

.admin-switch--compact .form-check-input {
  margin-top: 0;
}

/* ----- Settings card (yearly auto-reminders) ----- */
.admin-settings-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.admin-settings-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.admin-settings-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

.admin-settings-card__desc {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 52rem;
}

.admin-settings-card .form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

/* ----- Reminder composer cards ----- */
.reminder-when {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem 1.1rem;
}

.reminder-message {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem 1.1rem;
  background: var(--surface);
}

.reminder-when__summary {
  background: var(--surface);
}

.reminder-actions {
  margin-top: 0.25rem;
}

.reminder-actions .btn {
  min-width: 11rem;
}

.admin-reminder-message {
  font-size: 0.86rem;
  color: var(--text);
  max-height: 4.5rem;
  overflow-y: auto;
}

.admin-reminder-recipient {
  max-width: 200px;
}

/* ----- Modals (admin) ----- */
#editReminderModal .modal-content,
#editPresetTemplateModal .modal-content {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#editReminderModal .modal-header,
#editPresetTemplateModal .modal-header {
  border-bottom: 1px solid var(--line);
  padding: 0.9rem 1.15rem;
}

#editReminderModal .modal-body,
#editPresetTemplateModal .modal-body {
  padding: 1.05rem 1.15rem;
}

#editReminderModal .modal-footer,
#editPresetTemplateModal .modal-footer {
  border-top: 1px solid var(--line);
  padding: 0.75rem 1.15rem;
}

/* ----- Small screens ----- */
@media (max-width: 767.98px) {
  .admin-toolbar {
    padding: 0.75rem 0.75rem 0.25rem;
  }

  .admin-panel {
    padding: 1rem 0.9rem 1.1rem;
  }

  .reminder-actions .btn {
    width: 100%;
    min-width: 0;
  }
}

/* Attachment multi-file preview (Create/Edit forms) */
.attachment-preview {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.attachment-preview__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.attachment-preview__icon {
  flex-shrink: 0;
  color: #d9534f;
  font-size: 1rem;
}

.attachment-preview__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.attachment-preview__size {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.attachment-preview__action {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.attachment-preview__action:hover {
  color: var(--brand);
  border-color: var(--brand);
}

.attachment-preview__remove:hover {
  color: #d9534f;
  border-color: #d9534f;
}

.attachment-preview__existing {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ==========================================================================
   Team / co-author section (Create & Edit forms)
   ========================================================================== */
#main-content #teamTable {
  margin-bottom: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

#main-content #teamTable thead th {
  padding: 0.6rem 0.85rem;
  background: #fafbfc;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

#main-content #teamTable tbody td {
  padding: 0.5rem 0.85rem;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  background-color: transparent;
  vertical-align: middle;
}

#main-content #teamTable tbody tr:last-child td {
  border-bottom: 0;
}

#main-content #teamTable tbody tr:hover {
  background-color: #f8fafc;
}

#main-content #teamTable td.team-empty {
  padding: 1.1rem 0.85rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}

#main-content #teamTable .team-source {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
}

#main-content #teamTable .team-source:empty {
  display: none;
}

/* Ghost remove button, consistent with the record-table kebab. */
#main-content #teamTable .btn-closeAuthor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-size: 1.05rem;
  line-height: 1;
  transition: background-color 0.12s ease, color 0.12s ease;
}

#main-content #teamTable .btn-closeAuthor:hover,
#main-content #teamTable .btn-closeAuthor:focus-visible {
  background: var(--danger-bg);
  color: #b91c1c;
}

/* Add-member toolbar under the table. */
.team-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.team-toolbar .btn-addAuthor {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: auto !important;
  min-width: 0;
  margin: 0 !important;
  padding: 0.45rem 0.95rem !important;
  border: 1px dashed var(--action-border) !important;
  border-radius: 10px !important;
  background: var(--action-bg) !important;
  color: var(--action) !important;
  box-shadow: none !important;
  font-size: 0.85rem !important;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.team-toolbar .btn-addAuthor:hover,
.team-toolbar .btn-addAuthor:focus-visible {
  background: var(--action) !important;
  border-color: var(--action) !important;
  color: #fff !important;
}

.team-toolbar .btn-addAuthor--ghost {
  background: transparent !important;
  border-color: var(--line) !important;
  color: var(--text-muted) !important;
}

.team-toolbar .btn-addAuthor--ghost:hover,
.team-toolbar .btn-addAuthor--ghost:focus-visible {
  background: #eef2f7 !important;
  border-color: #cbd5e1 !important;
  color: var(--text) !important;
}

.team-toolbar__hint {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ----- Elegant dropdowns: selected state, search field, open animation ----- */
.select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: rgba(48, 53, 150, 0.12) !important;
  color: var(--text) !important;
  font-weight: 600 !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected="true"] {
  background-color: var(--brand) !important;
  color: #fff !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  border: 1px solid var(--line) !important;
  border-radius: calc(var(--radius) - 2px) !important;
  padding: 0.45rem 0.7rem !important;
  outline: none !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(48, 53, 150, 0.15) !important;
}

.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(48, 53, 150, 0.15) !important;
}

.select2-dropdown {
  animation: select2-pop 0.12s ease-out !important;
}

@keyframes select2-pop {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Native selects share the same focus ring as the rest of the theme. */
select.form-control:focus,
select.form-select:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(48, 53, 150, 0.15) !important;
  outline: none !important;
}

/* ----- Responsive safety net: unwrapped wide tables scroll on phones ----- */
@media (max-width: 767.98px) {
  #main-content .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #main-content .table-responsive-wrap .table {
    display: table;
    overflow: visible;
  }

  .module-toolbar {
    row-gap: 0.6rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   Form customisation Ã¢â‚¬â€ field editor (card layout)
   ========================================================================== */
.fc-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  margin-bottom: 0.9rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.fc-intro__text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.fc-intro__text i {
  color: var(--brand);
  margin-right: 0.3rem;
}

.fc-intro__meta {
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.fc-empty {
  padding: 2.5rem 1rem !important;
  text-align: center;
  color: var(--text-muted);
}

.fc-empty i {
  font-size: 1.4rem;
  margin-right: 0.4rem;
  opacity: 0.6;
}

#main-content .fc-table thead th {
  padding: 0.55rem 0.75rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
  white-space: nowrap;
}

#main-content .fc-table tbody td {
  padding: 0.6rem 0.75rem;
}

.fc-col-order {
  width: 9rem;
}

.fc-col-type {
  width: 11rem;
}

.fc-col-center {
  width: 6.5rem;
}

.fc-col-options {
  width: 32%;
}

.fc-col-action {
  width: 4.5rem;
}

.fc-cell-center,
.fc-cell-action {
  text-align: center;
}

.fc-row.is-hidden > td {
  background-color: #fafbfc !important;
}

.fc-row.is-hidden .fc-name {
  color: #94a3b8;
}

.fc-row.is-locked > td {
  background-color: #f8fafc !important;
}

.fc-order {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
}

.fc-order .order-btn {
  width: 1.75rem;
  height: 1.75rem;
  min-width: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.fc-order .order-btn:hover:not(:disabled) {
  background: #f1f5f9;
  color: var(--text);
}

.fc-order .order-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.fc-order__index {
  min-width: 1.5rem;
  text-align: center;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
}

.fc-name-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.fc-name {
  flex: 1 1 12rem;
  min-width: 9rem;
  border: 1px solid transparent;
  background: #f8fafc;
  font-weight: 600;
}

.fc-name:focus {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 0.2rem rgba(48, 53, 150, 0.12);
}

.fc-name[readonly] {
  background: #f1f5f9;
  color: #475569;
}

.fc-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.fc-badge--lock {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #c2410c;
}

.fc-badge--always {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
}

.fc-badge--new {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

.fc-vis {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.fc-vis.is-on {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.fc-vis.is-off {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.fc-vis:hover {
  filter: brightness(0.97);
}

.fc-icon-btn {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #94a3b8;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.fc-icon-btn:hover {
  background: #f1f5f9;
  color: var(--text);
}

.fc-icon-btn--danger:hover {
  background: var(--danger-bg);
  color: #b91c1c;
}

.fc-type {
  width: 100%;
  min-width: 8rem;
}

.fc-type-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #475569;
  font-size: 0.85rem;
  text-transform: capitalize;
}

.fc-switch {
  display: inline-block;
  margin: 0;
  min-height: 1.5rem;
  padding-top: 0;
  text-align: left;
}

.fc-switch .form-check-input {
  cursor: pointer;
}

.fc-options {
  min-width: 15rem;
}

.fc-options__none {
  color: #cbd5e1;
}

.fc-options__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.1rem;
}

.fc-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.25rem 0.15rem 0.55rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
}

.fc-opt input[type="text"] {
  width: 9rem;
  min-width: 6rem;
  padding: 0.25rem 0.3rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
}

.fc-opt.is-hidden {
  background: #fef2f2;
  border-color: #fecaca;
}

.fc-opt.is-hidden input[type="text"] {
  color: #9ca3af;
  text-decoration: line-through;
}

.fc-opt__btn {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.fc-opt__btn:hover {
  background: rgba(15, 23, 42, 0.08);
  color: var(--text);
}

.fc-opt__btn--remove:hover {
  background: var(--danger-bg);
  color: #b91c1c;
}

.fc-options__add {
  margin-top: 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.75rem;
  border: 1px dashed var(--action-border);
  border-radius: 999px;
  background: var(--action-bg);
  color: var(--action);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.fc-options__add:hover {
  background: var(--action);
  border-color: var(--action);
  color: #fff;
}

.fc-add {
  margin-top: 0.8rem;
}

.fc-add__btn {
  width: 100%;
  padding: 0.7rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.fc-add__btn:hover {
  border-color: var(--action-border);
  background: var(--action-bg);
  color: var(--action);
}
/* ----- Clickable rows (admin Verify records list) ----- */
table[data-row-nav] tbody tr {
  cursor: pointer;
}

table[data-row-nav] tbody tr:hover {
  background-color: rgba(48, 53, 150, 0.04);
}

/* ==========================================================================
   Team picker â€” inline external person create panel
   ========================================================================== */
.external-person-panel {
  margin-top: 0.75rem;
  padding: 0.9rem 1rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.external-person-panel[hidden] {
  display: none !important;
}

.external-person-panel__title {
  margin: 0 0 0.6rem;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 600;
}

.external-person-panel__title i {
  color: var(--action);
  margin-right: 0.3rem;
}

.external-person-panel__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 0.9rem;
}

.external-person-panel__field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
}

.external-person-panel__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
}

.external-person-panel__label em {
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: #b6c2d1;
}

.external-person-panel__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.external-person-panel__status {
  margin-right: auto;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.external-person-panel__status.is-error {
  color: #b91c1c;
}

.external-person-panel__status.is-success {
  color: #047857;
}

@media (max-width: 575.98px) {
  .external-person-panel__grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Import pages (Scopus / ORCID)
   ========================================================================== */
.import-header {
  align-items: flex-start;
  gap: 0.75rem;
}

.import-search-card {
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.import-search-card__query {
  position: relative;
  display: flex;
  align-items: center;
}

.import-search-card__query > i {
  position: absolute;
  left: 0.95rem;
  color: #94a3b8;
  font-size: 1rem;
  pointer-events: none;
}

.import-search-card__query .form-control {
  height: 2.9rem;
  padding-left: 2.5rem;
  font-size: 0.95rem;
}

.import-search-card__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 0.85rem;
  margin-top: 0.8rem;
}

.import-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
}

.import-field__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
}

.import-field .form-select {
  width: auto;
  min-width: 8rem;
}

.import-search-card__submit {
  margin-left: auto;
}

.import-search-card__hint {
  margin-right: auto;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.import-search-card__hint i {
  color: var(--action);
  margin-right: 0.2rem;
}

.import-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: 0.85rem 0 0.65rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.import-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 600;
}

.import-results .scopus-check-col .form-check-input {
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
}

.import-results tbody tr.is-duplicate {
  background-color: #fffbeb;
}

.import-results .import-year-col {
  width: 5rem;
}

.import-results .import-year {
  color: #475569;
  font-weight: 600;
  white-space: nowrap;
}

.import-results .import-publisher {
  color: #475569;
}

.import-results .import-authors {
  max-width: 20rem;
  color: #334155;
}

.import-badge {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.15rem 0.5rem;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 999px;
  color: #92400e;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: middle;
}

.import-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.import-empty i {
  font-size: 1.6rem;
  color: #cbd5e1;
}

.import-empty__title {
  margin: 0;
  color: var(--text);
  font-weight: 700;
}

.import-empty__hint {
  margin: 0;
  max-width: 32rem;
  font-size: 0.9rem;
}

.import-selection-bar {
  position: sticky;
  bottom: 0.85rem;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.85rem;
  margin-top: 1rem;
  padding: 0.65rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.08);
  opacity: 0;
  transform: translateY(130%);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.import-selection-bar.is-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.import-selection-bar__label {
  color: #475569;
  font-size: 0.9rem;
}

.import-selection-bar__label .js-selected-count {
  color: var(--text);
  font-weight: 700;
}

@media (max-width: 767.98px) {
  .import-search-card__submit {
    width: 100%;
    margin-left: 0;
  }

  .import-search-card__hint {
    width: 100%;
  }

  .import-field .form-select {
    flex: 1 1 8rem;
    min-width: 0;
  }
}