/* Styling for the (app) route group only: the reports dashboard and (later)
   library/users/settings pages. Loaded only by src/app/(app)/layout.tsx. */

/* Report-types modal (opened from dashboard's "Check Plagiarism" button). */
.report-type-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 901;
  width: calc(100% - var(--space-5) * 2);
  max-width: 920px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--color-surface);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
  animation: drawer-fade-in 0.15s ease;
}

.report-type-modal__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
}
.report-type-modal__close:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.report-type-modal h2 {
  font-size: 20px;
  text-align: center;
  margin-bottom: var(--space-5);
}

/* 6-track grid: first two types take half a row each, the rest a third each */
.report-type-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-3);
}
.report-type-grid > * {
  grid-column: span 2;
}
.report-type-grid > :nth-child(-n + 2) {
  grid-column: span 3;
}

.report-type-pill {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.report-type-pill:hover {
  background: var(--color-primary-light);
}
.report-type-pill[data-locked="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}
.report-type-pill[data-locked="true"]:hover {
  border-color: var(--color-border);
  background: none;
}

.report-type-pill__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.report-type-pill:hover .report-type-pill__icon {
  background: var(--color-surface);
}

.report-type-pill__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.report-type-pill__label {
  font-size: var(--font-size-sm);
  font-weight: 600;
}
.report-type-pill__desc {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.report-type-pill__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-text-muted);
}
.report-type-pill:hover .report-type-pill__arrow {
  color: var(--color-primary);
}

@media (max-width: 560px) {
  .report-type-grid {
    grid-template-columns: 1fr;
  }
  .report-type-grid > *,
  .report-type-grid > :nth-child(-n + 2) {
    grid-column: auto;
  }
}

.report-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.report-stats__card {
  position: relative;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-4);
}
.report-stats__card--empty {
  min-height: 96px;
  background: var(--color-bg);
  box-shadow: none;
}

.report-stats__label {
  position: relative;
  display: block;
  font-size: 12px;
  font-weight:550;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.report-stats__value {
  position: relative;
  font-size: 22px;
  font-weight: 700;
}

.page-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.page-header__icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
}
.page-header__icon-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.page-header__icon-btn[data-active="true"] {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* Shared toolbar (filters + search) — used by Reports, Users, Notifications.
   Kept generic (not "reports-*") since it's reused across pages. */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  height: 50px;
}
@media (max-width: 700px) {
  .toolbar {
    flex-wrap: wrap;
  }
}

.reports-tabs {
  display: inline-flex;
  align-items: center;
  gap: var(--space-5);
  border-bottom: 1px solid var(--color-border);
}
.reports-tabs__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: var(--space-2) 0 var(--space-3);
  border: none;
  background: none;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
}
.reports-tabs__btn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-primary);
  opacity: 0;
  transform: scaleX(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.reports-tabs__btn[data-active="true"] {
  color: var(--color-text);
  font-weight: 600;
}
.reports-tabs__btn[data-active="true"]::after {
  opacity: 1;
  transform: scaleX(1);
}

.toolbar-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-width: 0;
}

.users-bulkbar {
  flex-shrink: 0;
  margin-left: auto;
}

.toolbar-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 9px 32px 9px var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.toolbar-select:hover {
  border-color: var(--color-primary);
}
.toolbar-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.search-box {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 9px var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-box:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.search-box input {
  border: none;
  background: none;
  font: inherit;
  color: var(--color-text);
  width: 170px;
}
.search-box input:focus {
  outline: none;
}

.reports-table {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  /* No overflow:hidden here — it would clip the row action dropdown whenever
     it extends past the table's box. Rounded corners come from the first/last
     row instead. */
}

/* Shared "everything in one card" shell — tabs/toolbar, table, pagination —
   reused by Reports, Library, Users, Notifications and Invoices so every
   list page in the app reads as the same design. The inner table goes
   borderless/edge-to-edge since the card itself supplies the border/shadow. */
.list-card {
  background: var(--color-surface);
}
.list-card .reports-table,
.list-card .users-table-wrap,
.list-card .invoice-table {
  border: none;
  border-radius: 0;
}
.list-card .reports-table__row {
  grid-template-columns: 2fr 0.7fr 0.8fr 0.9fr 1fr 1fr 40px;
}

.reports-table__type {
  text-transform: capitalize;
}
.list-card .reports-table__row--head,
.list-card .users-table thead th,
.list-card .invoice-row--head {
  background: var(--color-bg);
  border-radius: 0;
}
.list-card .reports-pagination {
  margin-top: var(--space-4);
}

.reports-tabs__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.reports-table__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  color: var(--color-primary); */
}

.filter-dropdown {
  position: relative;
}
.filter-dropdown__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
}
.filter-dropdown__btn:hover,
.filter-dropdown__btn[data-active="true"] {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.filter-dropdown__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 10;
  min-width: 160px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
}
.filter-dropdown__panel button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  font-size: var(--font-size-sm);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
}
.filter-dropdown__panel button:hover {
  background: var(--color-bg);
}
.filter-dropdown__panel button[data-active="true"] {
  color: var(--color-primary);
  font-weight: 600;
}

.reports-pagination__arrow--text {
  width: auto;
  gap: 6px;
  padding: 0 var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
}

.reports-table__row {
  position: relative;
  display: grid;
  grid-template-columns: 2fr 0.7fr 0.8fr 0.9fr 1fr 1fr 40px;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
}
.reports-table__row:last-child {
  border-bottom: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.reports-table__row--head {
  background: var(--color-bg);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.reports-table__row--head button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  text-align: left;
}
.reports-table__row--head button:hover {
  color: var(--color-text);
}
.reports-table__sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.reports-table__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.reports-table__title-link {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: capitalize;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
}
.reports-table__title-link:hover {
  color: var(--color-primary);
}
.reports-table__count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
}

.reports-table__title input {
  flex: 1;
  font: inherit;
  padding: 4px 6px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
}

.reports-table__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
}
.reports-table__icon-btn:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.report-badge {
  display: inline-flex;
  flex-direction: column;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  width: fit-content;
}
.report-badge small {
  font-weight: 400;
  font-size: 11px;
}
.report-badge--processed {
  background: var(--color-success-light, #d1fae5);
  color: #000;
}
.report-badge--processing,
.report-badge--queued {
  background: var(--color-warning-light, #fef0c7);
  color: #000;
}
.report-badge--failed {
  background: var(--color-danger-light, #fee4e2);
  color: #000;
}

.status-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  width: fit-content;
}
.status-badge--active {
  background: var(--color-success-light, #d1fae5);
  color: var(--color-success);
}
.status-badge--inactive {
  background: var(--color-danger-light, #fee4e2);
  color: var(--color-danger);
}

.reports-table__actions {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.reports-table__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 10;
  min-width: 140px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
}
.reports-table__menu button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  font-size: var(--font-size-sm);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
}
.reports-table__menu button:hover {
  background: var(--color-bg);
}
.reports-table__menu-danger {
  color: var(--color-danger) !important;
}

.reports-table__empty {
  padding: var(--space-6);
  text-align: center;
  color: var(--color-text-muted);
}

.reports-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
}

.reports-pagination__nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reports-pagination__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
}
.reports-pagination__arrow--text {
  gap: 6px;
}
.reports-pagination__arrow:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.reports-pagination__arrow:disabled {
  opacity: 0.4;
  cursor: default;
}

.reports-pagination__page {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
}
.reports-pagination__page:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.reports-pagination__page[data-active="true"] {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 700;
}

.reports-pagination__gap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 36px;
  color: var(--color-text-muted);
}

.reports-pagination__size {
  height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

@media (max-width: 860px) {
  .report-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .reports-table__row {
    grid-template-columns: 1fr 40px;
  }
  .reports-table__row > *:not(.reports-table__title):not(.reports-table__actions) {
    display: none;
  }
}

/* Report creation (online plagiarism / group / cross / side-by-side). */

.report-create__name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  background: none;
  padding: var(--space-1) var(--space-2);
  margin-left: calc(var(--space-2) * -1);
  font: inherit;
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
}
.report-create__name svg {
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.report-create__name:hover svg {
  color: var(--color-primary);
}
.report-create__name-edit {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.report-create__name-input {
  font: inherit;
  font-size: var(--font-size-xl);
  font-weight: 600;
  padding: var(--space-1) var(--space-2);
  margin-left: calc(var(--space-2) * -1);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  min-width: 200px;
  max-width: 100%;
}
.report-create__name-mirror {
  position: absolute;
  visibility: hidden;
  white-space: pre;
  font: inherit;
  font-size: var(--font-size-xl);
  font-weight: 600;
  padding: var(--space-1) var(--space-2);
  border: 1px solid transparent;
}
.report-create__name-input:focus {
  outline: none;
}
.report-create__name-confirm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-primary);
  stroke-width: 3;
  cursor: pointer;
}
.report-create__name-confirm:hover {
  color: var(--color-primary-dark);
}

/* Report create forms: no card chrome (padding, border, shadow, background).
   The textarea / upload zone inside keep their own borders. */
.report-create.card,
.report-create__column.card {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* AI Detection: buttons + Clear left, word count right, in one row */
.report-create__actions.ai-input-bar {
  justify-content: space-between;
  flex-wrap: wrap;
}
.ai-input-bar__side {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.report-create__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Fixed to the taller sibling (.report-create__clear, 13px) so the row's
     height doesn't shift when Clear appears/disappears as text is typed. */
  min-height: var(--font-size-sm);
  margin-bottom: var(--space-2);
}
.report-create__panel-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text);
}
.report-create__panel-foot {
  display: flex;
  justify-content: flex-end;
  margin: var(--space-2) 0 var(--space-4);
}
.report-create__word-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 3px 12px;
  border-radius: 999px;
}

.report-create__actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-3);
  margin-top: var(--space-5);
}
.report-create__actions .btn {
  min-width: 140px;
  height: 44px;
}

.report-create__columns {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-5);
  align-items: start;
}

.report-create__link-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  flex-shrink: 0;
}

.report-create__column {
  min-width: 0;
  padding: var(--space-4);
}
/* Fixed-height dropzone/file-list area — stays the same size whether it's
   empty, has 1 file, or 30, so the Load Document button/size meter below it
   never jump around. Scrolls internally (independently per source/target
   column) once the file list outgrows it, instead of growing the card. */
.report-create__column-body {
  min-height: 300px;
  max-height: 300px;
  overflow-y: auto;
}
.report-create__column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.report-create__column-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  gap:7px;
  display: inline-flex;
  line-height: 2;
}
.report-create__column-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
}
.report-create__clear {
  border: none;
  background: none;
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}
/* Keep Clear on the right even when it's the only item in the head row */
.report-create__panel-head > .report-create__clear {
  margin-left: auto;
}
.report-create__clear:hover {
  color: var(--color-primary-dark);
}

.report-create__textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 300px;
  resize: vertical;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font: inherit;
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}
.report-create__textarea::placeholder {
  color: var(--color-text-muted);
}
.report-create__textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.report-create__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.report-create__footer-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.report-create__footer-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-left: auto;
}
.size-meter {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}
.size-meter svg {
  color: var(--color-primary);
  flex-shrink: 0;
}
.size-meter__label {
  white-space: nowrap;
}
.size-meter__sep {
  opacity: 0.5;
  margin: 0 1px;
}
.size-meter__bar {
  display: inline-block;
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
  flex-shrink: 0;
}
.size-meter__fill {
  display: block;
  height: 100%;
  background: var(--color-primary);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.load-document-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 7px var(--space-5);
  border-radius: 999px;
  color: #8A92A7;
  border: 1px solid #8A92A7;
  background-color: #fff;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.load-document-btn:hover {
  color: #fff;
  background-color: #8A92A7;
  transform: translateY(-1px);
}
.load-document-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.report-create__switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  cursor: pointer;
}
.report-create__switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.report-create__switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--color-border);
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}
.report-create__switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}
.report-create__switch input:checked + .report-create__switch-track {
  background: var(--color-primary);
}
.report-create__switch input:checked + .report-create__switch-track::after {
  transform: translateX(16px);
}
.report-create__switch input:disabled + .report-create__switch-track {
  opacity: 0.5;
}

.upload-zone {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  text-align: center;
  width: 100%;
  min-height: 300px;
  padding: var(--space-5);
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.upload-zone:hover,
.upload-zone[data-drag="true"] {
  border-color: var(--color-primary-light);
  background: color-mix(in srgb, var(--color-primary) 4%, var(--color-surface));
}
.upload-zone[data-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}
.upload-zone svg {
  color: var(--color-primary);
}
.upload-zone p {
  font-size: var(--font-size-sm);
  margin-top: var(--space-1);
}
.upload-zone p span {
  color: var(--color-primary);
  font-weight: 600;
}
.upload-zone__hint {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* Selected-file hero — fills the same 300px box as the dropzone/textarea it
   replaces, instead of a thin list row surrounded by empty space. */
.side-file-selected {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  height: 100%;
  min-height: 300px;
  box-sizing: border-box;
  padding: var(--space-5);
  text-align: center;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-primary) 5%, var(--color-surface));
}
.side-file-selected__icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  color: var(--color-primary);
  background: var(--color-primary-light);
}
.side-file-selected__check {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: flex;
  color: var(--color-primary);
  background: var(--color-surface);
  border-radius: 50%;
}
.side-file-selected__name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--color-text);
}
.side-file-selected__size {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-bg);
  padding: 3px 10px;
  border-radius: 999px;
}
.side-file-selected__remove {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.side-file-selected__remove:hover {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.upload-filelist {
  margin-bottom: var(--space-4);
}
.upload-filelist__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.upload-filelist__count {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
}
.upload-filelist__count svg {
  color: var(--color-primary);
}
.upload-filelist__grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.upload-filelist__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.upload-filelist__row:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(1px);
}
.upload-filelist__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  color: var(--color-primary);
  flex-shrink: 0;
}
.upload-filelist__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
}
.upload-filelist__badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-text-muted);
}
.upload-filelist__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: none;
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.upload-filelist__remove:hover {
  background: #fee4e2;
  color: var(--color-danger);
}

@media (max-width: 720px) {
  .report-create__columns {
    grid-template-columns: 1fr;
  }
  .report-create__link-icon {
    margin: 0 auto;
    transform: rotate(90deg);
  }
}

/* Profile page. */

.profile-card {
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.profile-avatar {
  display: flex;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-primary-light);
}
.profile-avatar--fallback {
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f97316, #ec4899);
  color: #fff;
  font-size: 34px;
  font-weight: 600;
}
.profile-avatar-edit {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--color-surface);
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease;
}
.profile-avatar-edit:hover {
  background: var(--color-primary-dark);
}
.profile-avatar-edit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.profile-avatar-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.profile-avatar-name {
  font-size: var(--font-size-lg);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-avatar-email {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-avatar-remove {
  align-self: flex-start;
  margin-top: 4px;
  border: none;
  background: none;
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.profile-avatar-remove:hover {
  color: var(--color-danger);
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.profile-grid__full {
  grid-column: 1 / -1;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profile-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
}
.profile-field input,
.profile-field textarea,
.profile-field select {
  font: inherit;
  padding: 10px var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--font-size-sm);
}
.profile-field textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}
.profile-field input:focus,
.profile-field textarea:focus,
.profile-field select:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.profile-field input:disabled {
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.profile-field__password {
  position: relative;
}
.profile-field__password input {
  width: 100%;
  padding-right: 40px;
}
.profile-field__toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 50%;
}
.profile-field__toggle:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.profile-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
}
.profile-pref-row + .profile-pref-row {
  margin-top: var(--space-3);
}
.profile-pref-title {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
}
.profile-pref-desc {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.profile-danger {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-5);
  border-radius: 16px;
  border-color: #fecdca;
  background: #fef4f3;
}
.profile-danger__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fee4e2;
  color: var(--color-danger);
  flex-shrink: 0;
}
.profile-danger__body {
  flex: 1;
  min-width: 200px;
}
.profile-danger__title {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin-bottom: 4px;
}
.profile-danger__desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  max-width: 480px;
}

@media (max-width: 560px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

/* Settings shell: sidebar nav + a capped-width content column, shared by all
   settings pages (Profile first; Password/General/etc. join the sidebar as
   they ship). */

.settings-shell {
  display: flex;
  align-items: flex-start;
  gap: var(--space-6);
}

.settings-sidebar {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: sticky;
  top: calc(var(--header-height) + var(--space-4));
}

.settings-sidebar__group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-sidebar__heading {
  padding: 0 var(--space-3) var(--space-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.settings-sidebar__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.settings-sidebar__link svg {
  flex-shrink: 0;
  color: var(--color-text-muted);
  transition: color 0.15s ease;
}
.settings-sidebar__link:hover {
  background: var(--color-bg);
  color: var(--color-text);
}
.settings-sidebar__link[data-active="true"] {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}
.settings-sidebar__link[data-active="true"] svg {
  color: var(--color-primary);
}
.settings-sidebar__link[data-active="true"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: var(--color-primary);
}

.settings-content {
  flex: 1;
  min-width: 0;
  max-width: 640px;
}
.settings-content--full {
  max-width: none;
}

@media (max-width: 780px) {
  .settings-shell {
    flex-direction: column;
  }
  .settings-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    position: static;
    gap: var(--space-4);
  }
  .settings-sidebar__group {
    flex-direction: row;
    gap: var(--space-2);
  }
  .settings-sidebar__heading {
    display: none;
  }
  .settings-sidebar__link {
    flex-shrink: 0;
  }
  .settings-sidebar__link[data-active="true"]::before {
    left: 8px;
    right: 8px;
    top: auto;
    bottom: 2px;
    width: auto;
    height: 3px;
  }
  .settings-content {
    max-width: 100%;
  }
}

/* Notifications page — an activity feed, not a preferences form (the only
   email preference is Profile's email_notification toggle). */

.notif-search {
  max-width: 280px;
  margin-bottom: var(--space-4);
}
.notif-search input {
  width: 100%;
}

.notif-table .reports-table__row {
  grid-template-columns: 2fr 1fr 1fr 1fr;
}

.group-reports-table .reports-table__row {
  grid-template-columns: 2fr 0.8fr 0.9fr 1fr 1fr 40px;
}
.group-reports__title {
  text-transform: capitalize;
}
.notif-table__title {
  text-transform: capitalize;
}

.notif-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-2);
  margin-bottom: var(--space-2);
  border-left: 2.5px solid transparent;
  color: inherit;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.notif-row:last-child {
  margin-bottom: 0;
}
a.notif-row:hover {
  background: var(--color-bg);
}
.notif-row[data-variant="processed"] {
  border-left-color: #29cb97;
}
.notif-row[data-variant="failed"] {
  border-left-color: #ff6060;
}
.notif-row[data-variant="processing"] {
  border-left-color: #ffd460;
}

.notif-row__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.notif-row__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  text-transform: capitalize;
  white-space: normal;
}
.notif-row__title-suffix {
  font-weight: 400;
  text-transform: none;
  color: var(--color-text-muted);
}
.notif-row__time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--color-text-muted);
}

.notif-row__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.notif-row__badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  white-space: nowrap;
  color: var(--color-primary);
  background: var(--color-primary-light);
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
}

.notif-table__badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-primary-light);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  white-space: nowrap;
  color: var(--color-primary);
}

/* General (workspace) settings. */

.general-logo-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}
.general-logo-wrap {
  position: relative;
  flex-shrink: 0;
}

/* Plan Details. */

.plan-details-layout {
  display: flex;
  align-items: flex-start;
  gap: var(--space-5);
}
.plan-details-main {
  flex: 1;
  min-width: 0;
  max-width: 640px;
}
.plan-details-stats {
  flex: 1;
  min-width: 420px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  align-content: start;
}

@media (max-width: 900px) {
  .plan-details-layout {
    flex-direction: column;
  }
  .plan-details-main {
    max-width: 100%;
  }
  .plan-details-stats {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .plan-details-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

.plan-summary {
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.plan-summary__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.plan-summary__badge {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  font-weight: 700;
}
.plan-summary__expiry {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  font-weight:600;
}
.plan-summary__credits {
  margin-top:var(--space-6);
}
.plan-summary__credits-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}
.plan-summary__credits-row span:last-child {
  font-weight: 600;
  color: var(--color-text);
}
.plan-summary__bar {
  width: 100%;
  height: 8px;
}

/* Upgrade Plan (/upgrade-plan) — fresh pricing-card grid, distinct from the
   bare-bones /choose-plan onboarding screen (different audience: an already
   signed-in user picking their next tier, inside the app shell/sidebar). */
.pricing-duration {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  margin-bottom: var(--space-6);
}
.pricing-duration button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: var(--space-2) var(--space-5);
  border: none;
  border-radius: 999px;
  background: none;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.pricing-duration button[data-active="true"] {
  background: var(--color-primary);
  color: #fff;
}
.pricing-duration__badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  font-size: 11px;
  font-weight: 700;
}
.pricing-duration button:not([data-active="true"]) .pricing-duration__badge {
  background: var(--color-success-light, #d1fae5);
  color: var(--color-success);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  align-items: stretch;
}
@media (max-width: 900px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
}

.pricing-intro {
  color: var(--color-text-muted);
  margin-top: calc(var(--space-3) * -1);
  margin-bottom: var(--space-5);
}

.pricing-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: var(--space-6) var(--space-5);
  border: 1.5px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.pricing-card[data-popular="true"] {
  border-color: var(--color-primary);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.14);
}
.pricing-card[data-current="true"] {
  border-color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 4%, var(--color-surface));
}
.pricing-card__badge {
  position: absolute;
  top: -13px;
  left: var(--space-5);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pricing-card__badge--current {
  background: var(--color-success);
}
.pricing-card__head {
  margin-bottom: var(--space-4);
}
.pricing-card__title {
  font-size: var(--font-size-lg, 18px);
  font-weight: 700;
  margin-bottom: 4px;
}
.pricing-card__blurb {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  min-height: 36px;
}
.pricing-card__price {
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.pricing-card__currency {
  font-size: var(--font-size-lg, 18px);
  font-weight: 700;
  color: var(--color-text);
}
.pricing-card__amount {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  color: var(--color-text);
}
.pricing-card__period {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}
.pricing-card__yearly {
  min-height: 18px;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  visibility: hidden;
  margin-top:10px;
}
.pricing-card__yearly[data-visible="true"] {
  visibility: visible;
}
.pricing-card__yearly del {
  opacity: 0.75;
  margin-right: 4px;
  color: red;
  letter-spacing: 0.5px;
  font-weight: 550;
}
.pricing-card__credits {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}
.pricing-card .btn-block {
  width: 100%;
  margin-bottom: var(--space-4);
}
.pricing-card__features-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: var(--space-2) 0;
  border: none;
  background: none;
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
}
.pricing-card__features-toggle svg {
  transition: transform 0.15s ease;
}
.pricing-card__features-toggle svg.is-open {
  transform: rotate(180deg);
}
.pricing-card__features {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  list-style: none;
  padding: var(--space-4) 0 0;
  margin: var(--space-2) 0 0;
  border-top: 1px solid var(--color-border);
}
.pricing-card__features li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text);
}
.pricing-card__features li svg {
  flex-shrink: 0;
  color: var(--color-primary);
}

.pricing-footnote {
  margin-top: var(--space-5);
  font-size: 12px;
  text-align:center;
  color: var(--color-text-muted);
}

.coupon-slide {
  overflow: hidden;
  animation: coupon-slide-down 0.2s ease;
}
@keyframes coupon-slide-down {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    max-height: 160px;
    transform: translateY(0);
  }
}

/* Invoices. */

.invoice-table {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}
.invoice-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr 1fr;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
}
.invoice-row:last-child {
  border-bottom: none;
}
.invoice-row--head {
  background: var(--color-bg);
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.invoice-row__link {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-primary);
  font-weight: 550;
}
.invoice-row__link:hover {
  color: var(--color-primary-dark);
}

.eclipse {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden !important;
    text-overflow: ellipsis;
    width: 75%;
}

@media (max-width: 720px) {
  .invoice-row {
    grid-template-columns: 1fr 1fr;
  }
  .invoice-row > *:nth-child(3) {
    display: none;
  }
}

/* API Integrations. */

.api-key-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  margin-bottom: var(--space-3);
}
.api-key-row code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--color-text);
}
.api-key-row__label {
  flex-shrink: 0;
  width: 90px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}
.api-key-row__copy {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 50%;
}
.api-key-row__copy:hover {
  background: var(--color-surface);
  color: var(--color-primary);
}

.api-unavailable {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-5);
}
.api-unavailable__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}
.api-unavailable__title {
  font-size: var(--font-size-base);
  font-weight: 600;
}
.api-unavailable__desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  max-width: 320px;
  margin-bottom: var(--space-2);
}

/* Users (workspace members). */

.invite-modal {
  max-width: 520px;
  text-align: left;
}
.invite-modal h2 {
  margin-bottom: var(--space-5);
}
.invite-modal .profile-field + .profile-field {
  margin-top: var(--space-4);
}
.invite-modal .profile-field input,
.invite-modal .profile-field select {
  height: 44px;
  padding: 0 var(--space-4);
}
.invite-modal .confirm-dialog__actions {
  margin-top: var(--space-5);
}
.invite-modal__close {
  color: var(--color-text-muted);
}

.invite-modal__header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  padding-right: var(--space-5);
}
.invite-modal__header h2 {
  font-size: 18px;
  margin-bottom: 4px;
}
.invite-modal__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.invite-modal__subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: 1.4;
}

.invite-modal__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}
.invite-modal__section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.invite-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 220px;
  overflow-y: auto;
  padding: 2px;
}
.invite-row-fields {
  display: grid;
  grid-template-columns: auto 1fr 1.3fr 24px;
  align-items: center;
  gap: var(--space-2);
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.invite-row-fields__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-text-muted);
}
.invite-row-fields input {
  font: inherit;
  padding: 8px var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  min-width: 0;
}
.invite-row-fields input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.invite-row-fields__remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 50%;
}
.invite-row-fields__remove:hover {
  background: #fee4e2;
  color: var(--color-danger);
}
.invite-row-fields__remove:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.invite-modal__toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}
.invite-modal__toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.invite-modal__toolbar-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.invite-modal__template-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-primary);
}
.invite-modal__template-link:hover {
  color: var(--color-primary-dark);
}

.invite-modal__role {
  margin-top: var(--space-4);
}
.invite-modal__role-desc {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: var(--space-3);
  margin-bottom: var(--space-3);
  line-height: 1.4;
}

@media (max-width: 480px) {
  .invite-row-fields {
    grid-template-columns: auto 1fr 24px;
  }
  .invite-row-fields input:first-of-type {
    grid-column: 2 / -1;
  }
  .invite-modal__template-link {
    margin-left: 0;
  }
}

.users-bulkbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 60px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.users-table-wrap {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  /* No overflow-x:auto here — setting overflow on one axis forces the other
     to "auto" too per spec, which clipped/scrolled the row action dropdown
     since it's positioned absolutely inside this wrap. */
}
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}
.users-table th,
.users-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.users-table tbody tr:last-child td {
  border-bottom: none;
}
.users-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: var(--radius-md);
}
.users-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: var(--radius-md);
}
.users-table thead th {
  background: var(--color-bg);
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.users-table thead th button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  color: inherit;
  cursor: pointer;
}
.users-table thead th button:hover {
  color: var(--color-text);
}
.users-table thead th button[data-active="true"] {
  color: var(--color-text);
}
.users-table thead tr:first-child th:first-child {
  border-top-left-radius: var(--radius-md);
}
.users-table thead tr:first-child th:last-child {
  border-top-right-radius: var(--radius-md);
}
.users-table__checkbox {
  width: 20px;
}

/* Drop the least-critical columns on narrow screens instead of scrolling —
   .users-table-wrap deliberately has no overflow-x, since setting overflow
   on one axis forces the other to "auto" too, which clipped the absolutely
   positioned row-action menu. */
@media (max-width: 720px) {
  .users-table__col-role,
  .users-table__col-lastlogin {
    display: none;
  }
}
@media (max-width: 480px) {
  .users-table__col-status {
    display: none;
  }
}
.users-table__name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 260px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.users-table__email {
  font-size: 12px;
  color: var(--color-text-muted);
}

.role-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 600;
}
.role-badge--owner {
  background: var(--color-bg);
  color: var(--color-text-muted);
}

.users-table__actions {
  position: relative;
}
.users-table__icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 50%;
}
.users-table__icon-btn:hover {
  background: var(--color-bg);
  color: var(--color-text);
}
/* Rendered as position:fixed via inline style (see UsersList.tsx) — kept
   completely outside the <table> so it can never be clipped or obscured by
   table cell/row stacking and painting order. */
.users-table__menu {
  z-index: 60;
  min-width: 180px;
  max-height: 340px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
}
.users-table__menu button {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.users-table__menu button:hover {
  background: var(--color-bg);
}
.users-table__menu-danger {
  color: var(--color-danger) !important;
}

/* Library page — reuses .users-table/.users-table-wrap/.reports-pagination
   layout, with its own icon-button/menu/tag-badge styling. */
.library-table__file {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  text-decoration: none;
}
.library-table__file:hover strong {
  text-decoration: underline;
}
.library-table__file svg {
  flex-shrink: 0;
  color: var(--color-text-muted);
}
.library-table__tag-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border: none;
  cursor: pointer;
  font: inherit;
}
.library-table__icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 50%;
}
.library-table__icon-btn:hover {
  background: var(--color-bg);
  color: var(--color-text);
}
/* Rendered as position:fixed via inline style — see the .users-table__menu
   comment above; the same table paint-order issue applies here. */
.library-table__menu {
  z-index: 60;
  min-width: 170px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
}
.library-table__menu button,
.library-table__menu a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.library-table__menu button:hover,
.library-table__menu a:hover {
  background: var(--color-bg);
}
.library-table__menu button[data-active="true"] {
  color: var(--color-primary);
  font-weight: var(--font-weight-medium, 600);
}
.library-table__menu-danger {
  color: var(--color-danger) !important;
}

/* Check Plagiarism modal — creates a report from selected library documents. */
.check-plag-modal {
  max-width: 780px;
}
.check-plag-modal__name {
  margin-top: var(--space-5);
}
.check-plag-modal__types {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin: var(--space-5) 0;
}
@media (max-width: 640px) {
  .check-plag-modal__types {
    grid-template-columns: repeat(2, 1fr);
  }
}
.check-plag-modal__type {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.check-plag-modal__type svg {
  flex-shrink: 0;
  color: var(--color-text-muted);
  transition: color 0.15s ease;
}
.check-plag-modal__type:hover {
  border-color: var(--color-primary);
}
.check-plag-modal__type[data-active="true"] {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.check-plag-modal__type[data-active="true"] svg {
  color: var(--color-primary);
}
.check-plag-modal__type[data-disabled="true"] {
  color: var(--color-text-muted);
  cursor: not-allowed;
}
.check-plag-modal__type[data-disabled="true"]:hover {
  border-color: var(--color-border);
}
.check-plag-modal__type[data-disabled="true"] svg {
  color: var(--color-text-muted);
  opacity: 0.5;
}
.check-plag-modal__size {
  font-size: 10px;
  font-weight: bold;
  padding: 5px 10px;
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 5px;
}
.check-plag-modal__size[data-over="true"] {
  color: var(--color-danger);
  font-weight: 600;
}
.check-plag-modal__files {
  max-height: 200px;
}
.check-plag-modal__file-row {
  grid-template-columns: auto 1fr auto auto;
}
.check-plag-modal__file-row--grouped {
  grid-template-columns: auto auto 1fr auto auto auto;
}
.check-plag-modal__file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--font-size-sm);
}
.check-plag-modal__file-size {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
}
/* Source/Target badge for Bulk Comparison — click to move a file between
   groups; color + label both flip so the split is obvious at a glance. */
.check-plag-modal__group-badge {
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.check-plag-modal__group-badge[data-group="source"] {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary-light);
}
.check-plag-modal__group-badge[data-group="target"] {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

/* Online plagiarism report detail (/online-report/{id}). Highlight-match
   colors (.highlighted.color-N / .side-color-N / .count-label) come from
   theme.css's ported legacy palette — nothing here should override them. */
.online-report__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.online-report__header h1 {
  font-size: var(--font-size-xl);
  word-break: break-word;
}
.online-report__header h1::first-letter {
  text-transform: uppercase;
}
.online-report__header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
/* Share is a <button>, View PDF Report is an <a> — anchors don't inherit a
   button's box-sizing/line-height reset, so without this the two end up a
   couple pixels off despite identical padding. */
.online-report__header-actions .btn {
  height: 40px;
  line-height: 1;
}

/* Top row: similarity summary (left) paired with the remarks card (right) —
   align-items: stretch makes the shorter remarks card match the summary
   card's height instead of the two floating at different heights. */
.online-report__top {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-5);
  align-items: stretch;
  margin-bottom: var(--space-5);
}
@media (max-width: 900px) {
  .online-report__top {
    grid-template-columns: 1fr;
  }
}

.online-report__layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-5);
  align-items: start;
}
@media (max-width: 900px) {
  .online-report__layout {
    grid-template-columns: 1fr;
  }
}

.online-report__main {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

/* Side-by-side report — two parallel document panels (/side-report/{id}). */
.side-report__columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  align-items: start;
}
@media (max-width: 900px) {
  .side-report__columns {
    grid-template-columns: 1fr;
  }
}
.side-report__column {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}
.side-report__column-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: var(--font-size-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Source/Target "S"/"T" badge — shared by the side-report heading and every
   source-vs-target upload column (SideColumn, UploadColumn), so the same
   visual identity carries from report creation through to the report itself. */
.doc-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.doc-badge--source {
  background: var(--color-primary);
}
.doc-badge--target {
  background: var(--color-primary);
}

/* Group/cross-comparison matrix (/group/{id}) — document x document similarity grid. */
.group-report__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.group-report__toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.group-report__views {
  position: relative;
}
.group-report__views-menu {
  min-width: 170px;
}
.group-report__views-menu button.is-active {
  background: var(--color-bg);
  color: var(--color-primary);
  font-weight: 600;
}
.group-report__filters-menu {
  min-width: 220px;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
}
.group-report__filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
}
.group-report__filter-range {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.group-report__filter-range input[type="range"] {
  flex: 1;
  accent-color: var(--color-primary);
}
.group-report__filter-range span {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.group-report__sortable {
  cursor: pointer;
  user-select: none;
}
.group-report__sortable span {
  margin-right: 4px;
}
.group-report__sortable svg {
  vertical-align: middle;
  color: var(--color-text-muted);
}
.group-report__sortable svg.is-active {
  color: var(--color-primary);
}
.group-report__sortable:hover {
  background: var(--color-bg);
}

/* Heat View — flattened, value-sorted tile list of every unique document pair. */
.group-report__heatmap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.group-report__heat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 140px;
  flex-basis: 140px;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
}
.group-report__heat-tile strong {
  font-size: 18px;
}
.group-report__heat-tile span {
  font-size: 12px;
  color: inherit;
  opacity: 0.9;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-report__heatmap-empty {
  color: var(--color-text-muted);
  padding: var(--space-6);
}

/* Full Screen — CSS overlay covering the viewport, no native Fullscreen API. */
.group-report__fs {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--color-bg);
  padding: var(--space-6);
  overflow: auto;
}

/* Group View — accordion of one row per document, expandable into its own
   similarity-vs-every-other-document panel (mirrors legacy's Group View list). */
.group-report__accordion {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}
.group-report__accordion-grid {
  display: grid;
  grid-template-columns: 55% 15% 1fr 32px;
  align-items: center;
  gap: var(--space-4);
}
.group-report__accordion-head {
  padding: var(--space-3) var(--space-4);
  background: #f9fafb;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.group-report__accordion-head span:nth-child(2) {
  text-align: center;
}
.group-report__accordion-item {
  border-top: 1px solid var(--color-border);
}
.group-report__accordion-row {
  width: 100%;
  padding: var(--space-4);
}
.group-report__accordion-name {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--color-text);
}
.group-report__accordion-name small {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 10px;
}
.group-report__accordion-pct {
  font-weight: 600;
  font-size: var(--font-size-sm);
  min-width: 48px;
  text-align: center;
}
.group-report__accordion-link {
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.group-report__accordion-caret {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
}
.group-report__accordion-caret:hover {
  background: var(--color-bg);
}
.group-report__accordion-caret svg {
  transition: transform 0.15s ease;
}
.group-report__accordion-caret svg.is-open {
  transform: rotate(180deg);
}
.group-report__accordion-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--color-border);
  border-top: 1px solid var(--color-border);
}
.group-report__accordion-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--space-4);
  background: var(--color-surface);
  cursor: pointer;
  text-align: center;
}
.group-report__accordion-cell span {
  font-size: 12px;
  color: inherit;
  opacity: 0.85;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-report__accordion-cell strong {
  font-size: var(--font-size-sm);
}
.group-report__accordion-cell.group-report__cell--self {
  cursor: default;
}
.group-report__search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-muted);
  min-width: 240px;
}
.group-report__search input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--color-text);
  font-size: var(--font-size-sm);
  width: 100%;
}
.group-report__matrix-wrap {
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.group-report__matrix {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: var(--font-size-sm);
}
.group-report__matrix th,
.group-report__matrix td {
  padding: var(--space-5) var(--space-5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
}
.group-report__matrix thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f9fafb;
  font-weight: 600;
  text-align: left;
}
.group-report__matrix tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #f9fafb;
  font-weight: 600;
  text-align: left;
}
.group-report__corner {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 3;
  background: #f9fafb;
}
.group-report__matrix tbody tr:last-child td,
.group-report__matrix tbody tr:last-child th {
  border-bottom: none;
}
.group-report__matrix thead th:last-child,
.group-report__matrix tbody td:last-child {
  border-right: none;
}
.group-report__cell {
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.group-report__cell:hover {
  filter: brightness(0.95);
}
.group-report__cell--self {
  cursor: default;
  color: var(--color-text-muted);
  background: #f9fafb;
}
.group-report__cell--none {
  color: var(--color-text-muted);
}
.group-report__cell--low {
  background: #29cb97;
  color: #fff;
}
.group-report__cell--mid {
  background: #ffd460;
  color: #fff;
}
.group-report__cell--high {
  background: #ff6060;
  color: #fff;
}

.online-report__summary {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5) var(--space-6);
}

.online-report__gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.online-report__checked-on {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.online-report__gauge {
  position: relative;
  width: 128px;
  height: 128px;
  flex-shrink: 0;
}
.online-report__gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.online-report__gauge-track,
.online-report__gauge-value {
  fill: none;
  stroke-width: 9;
}
.online-report__gauge-track {
  stroke: var(--color-bg);
}
.online-report__gauge-value {
  stroke-linecap: butt;
  transition: stroke-dasharray 0.4s ease;
}
.online-report__gauge[data-variant="processed"] .online-report__gauge-value {
  stroke: var(--color-success);
}
.online-report__gauge[data-variant="queued"] .online-report__gauge-value {
  stroke: var(--color-warning);
}
.online-report__gauge[data-variant="failed"] .online-report__gauge-value {
  stroke: var(--color-danger);
}
.online-report__gauge-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.online-report__gauge-text strong {
  font-size: 26px;
  letter-spacing: -0.02em;
}
.online-report__gauge-text span {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.online-report__stats {
  display: flex;
  gap: var(--space-3);
  flex: 1;
  flex-wrap: wrap;
}
.online-report__stat-card {
  flex: 1;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.online-report__stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.online-report__stat-card strong {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.online-report__stat-card small {
  color: var(--color-text-muted);
  font-size: 14px;
}

.online-report__content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  line-height: 1.9;
  font-size: var(--font-size-sm);
  white-space: pre-wrap;
  word-break: break-word;
}
.online-report__content .highlighted {
  border-radius: 4px;
  cursor: pointer;
}
.online-report__content .excluded-content {
  background: none !important;
}
.online-report__content .excluded-content .count-label {
  display: none;
}

.online-report__side {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.online-report__remarks {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-text-muted);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}
.online-report__remarks-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.online-report__remarks-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-text-muted);
}
.online-report__remarks-tag {
  display: inline-flex;
  align-self: flex-start;
  padding: 3px var(--space-3);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--color-bg);
  margin-top:10px;
}
.online-report__remarks p {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}
.online-report__remarks-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--color-bg);
  overflow: hidden;
}
.online-report__remarks-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--color-text-muted);
  transition: width 0.3s ease;
}
.online-report__remarks-foot {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-muted);
}
.online-report__remarks-foot strong {
  color: var(--color-text);
}
.online-report__remarks[data-variant="processed"] {
  border-left-color: var(--color-success);
}
.online-report__remarks[data-variant="processed"] .online-report__remarks-tag,
.online-report__remarks[data-variant="processed"] .online-report__remarks-icon {
  background: #ecfdf3;
  color: var(--color-success);
}
.online-report__remarks[data-variant="processed"] .online-report__remarks-bar span {
  background: var(--color-success);
}
.online-report__remarks[data-variant="queued"] {
  border-left-color: var(--color-warning);
}
.online-report__remarks[data-variant="queued"] .online-report__remarks-tag,
.online-report__remarks[data-variant="queued"] .online-report__remarks-icon {
  background: #fffaeb;
  color: var(--color-warning);
}
.online-report__remarks[data-variant="queued"] .online-report__remarks-bar span {
  background: var(--color-warning);
}
.online-report__remarks[data-variant="failed"] {
  border-left-color: var(--color-danger);
}
.online-report__remarks[data-variant="failed"] .online-report__remarks-tag,
.online-report__remarks[data-variant="failed"] .online-report__remarks-icon {
  background: #fef3f2;
  color: var(--color-danger);
}
.online-report__remarks[data-variant="failed"] .online-report__remarks-bar span {
  background: var(--color-danger);
}

.online-report__tabs {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 3px;
  background: var(--color-surface);
}
.online-report__tabs button {
  flex: 1;
  padding: var(--space-2) 0;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.online-report__tabs button[data-active="true"] {
  background: var(--color-primary);
  color: #fff;
}

.online-report__sources {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.online-report__source {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.online-report__source:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.online-report__source[data-excluded="true"] {
  opacity: 0.5;
}
.online-report__source-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.online-report__source-num {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.online-report__source-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  border: none;
  background: none;
  padding: 0;
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
}
.online-report__source-name:hover {
  color: var(--color-primary);
}
.online-report__source-pct {
  flex-shrink: 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--color-primary-light);
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
}
.online-report__source-actions {
  display: flex;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}
.online-report__source-actions button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: none;
  padding: 7px var(--space-3);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.online-report__source-actions button:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}
.online-report__source-actions button[data-danger="true"]:hover {
  border-color: var(--color-danger);
  color: var(--color-danger);
  background: #fef3f2;
}
.online-report__include-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  border: none;
  background: none;
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  padding: var(--space-2) 0;
}

.online-report__ai {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: center;
  text-align: center;
}
.online-report__ai-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin-bottom: var(--space-1);
  background: var(--color-bg);
  color: var(--color-text-muted);
}
.online-report__ai-icon[data-variant="processed"] {
  background: #ecfdf3;
  color: var(--color-success);
}
.online-report__ai-icon[data-variant="queued"] {
  background: #fffaeb;
  color: var(--color-warning);
}
.online-report__ai-icon[data-variant="failed"] {
  background: #fef3f2;
  color: var(--color-danger);
}
.online-report__ai-score {
  font-size: 20px;
  font-weight: 700;
}
.online-report__ai-disclaimer {
  font-size: 12px;
  color: var(--color-text-muted);
}

.online-report__feedback {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.online-report__feedback textarea {
  width: 100%;
  resize: vertical;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: var(--font-size-sm);
  background: var(--color-surface);
  color: var(--color-text);
}
.online-report__feedback textarea:disabled {
  background: var(--color-bg);
  color: var(--color-text-muted);
}
.online-report__feedback .btn {
  align-self: flex-end;
}

.online-report__empty {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  text-align: center;
  padding: var(--space-4) 0;
}

.report-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-2);
  max-width: 380px;
  min-height: calc(100vh - var(--header-height));
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}
.report-error__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}
.report-error h2 {
  font-size: var(--font-size-xl);
  color: var(--color-text);
}
.report-error p {
  color: var(--color-text-muted);
}

.online-report__key-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  max-width: 380px;
  margin: var(--space-6) auto;
}
.online-report__key-modal .profile-field,
.online-report__key-modal .confirm-dialog__actions {
  width: 100%;
}

/* Standard centered modal (not a side drawer) — reuses .confirm-dialog's
   fixed-centered shell + .invite-modal's header pattern. */
.online-report__share-modal {
  max-width: 420px;
  text-align: left;
}

.online-report__share-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
  font-weight: 500;
}
.online-report__share-toggle:first-of-type {
  border-top: none;
  padding-top: var(--space-2);
}

.online-report__share-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-bottom: var(--space-4);
}
.online-report__share-row input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  overflow: hidden;
  text-overflow: ellipsis;
}
.online-report__share-row button[aria-label^="Copy"] {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
}
.online-report__share-row button[aria-label^="Copy"]:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.online-report__share-reset {
  flex-shrink: 0;
  height: 42px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: none;
  padding: 0 var(--space-4);
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.online-report__share-reset:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

/* ---------------------------------------------------------------------------
   AI Detection (live, report-types/ai-detection)
   --------------------------------------------------------------------------- */
.ai-result {
  --ai-high: #d92d20;
  --ai-high-bg: #fee4e2;
  --ai-medium: #dc6803;
  --ai-medium-bg: #fef0c7;
  --ai-low: #079455;
  --ai-low-bg: #dcfae6;

  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Right sidebar: verdict + passages, stays in view while the document scrolls */
.ai-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-4));
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

/* Verdict (compact for the sidebar): small ring left, text right */
.ai-verdict {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
}
.ai-verdict__body {
  flex: 1;
  min-width: 0;
}
.ai-verdict .ai-ring {
  flex-basis: 112px;
  width: 112px;
  height: 112px;
}
.ai-verdict .ai-ring__track,
.ai-verdict .ai-ring__value {
  stroke-width: 9;
}
.ai-verdict .ai-ring__percent {
  font-size: 20px;
}
.ai-verdict .ai-ring__caption {
  margin-top: 3px;
  font-size: 10px;
}
.ai-verdict__eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.ai-verdict__title {
  margin: 0 0 var(--space-3);
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--color-text);
}
.ai-verdict[data-label="ai"] .ai-verdict__title {
  color: var(--ai-high);
}
.ai-verdict[data-label="human"] .ai-verdict__title {
  color: var(--ai-low);
}
.ai-verdict__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-3);
}
.ai-verdict__meta span {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* Score ring */
.ai-ring {
  position: relative;
  flex: 0 0 160px;
  width: 160px;
  height: 160px;
}
.ai-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.ai-ring__track,
.ai-ring__value {
  fill: none;
  stroke-width: 10;
}
.ai-ring__track {
  stroke: var(--color-bg);
}
.ai-ring__value {
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease;
}
.ai-ring[data-label="ai"] .ai-ring__value {
  stroke: var(--ai-high);
}
.ai-ring[data-label="human"] .ai-ring__value {
  stroke: var(--ai-low);
}
.ai-ring__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ai-ring__percent {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.ai-ring__caption {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* AI vs human share of words */
.ai-composition {
  height: 8px;
  border-radius: 999px;
  background: var(--ai-low);
  overflow: hidden;
}
.ai-composition__ai {
  display: block;
  height: 100%;
  background: var(--ai-high);
}

/* Document + passages */
.ai-review {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  gap: var(--space-4);
  align-items: start;
}
.ai-doc {
  padding: 0px 20px 0px 0px;
}
.ai-passages {
  padding: var(--space-3);
}
.ai-doc__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-3);
}
.ai-doc__head h3 {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text);
}
.ai-doc__tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.ai-legend {
  display: flex;
  gap: var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}
.ai-legend__item::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 3px;
  vertical-align: -2px;
}
.ai-legend__item[data-level="high"]::before {
  background: var(--ai-high-bg);
}
.ai-legend__item[data-level="medium"]::before {
  background: var(--ai-medium-bg);
}
.ai-legend__item[data-level="low"]::before {
  background: var(--ai-low-bg);
}

.ai-doc__text {
  max-height: 560px;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  font-size: 15px;
  line-height: 1.85;
  color: var(--color-text);
  white-space: pre-wrap;
}
/* Square corners, no hover: neighbouring parts of the same level read as one run of text */
.ai-doc__section {
  padding: 1px 0;
  transition: opacity 0.15s ease, background-color 0.3s ease;
}
.ai-doc__section::after {
  content: " ";
}
.ai-doc__section[data-level="high"] {
  background: var(--ai-high-bg);
}
.ai-doc__section[data-level="medium"] {
  background: var(--ai-medium-bg);
}
.ai-doc__section[data-level="low"] {
  background: var(--ai-low-bg);
}
.ai-doc__text[data-ai-only="true"] .ai-doc__section[data-level="low"] {
  opacity: 0.3;
}
/* Passage picked from the list: deeper shade for a moment, no border */
.ai-doc__section[data-focused="true"][data-level="high"] {
  background: #fda29b;
}
.ai-doc__section[data-focused="true"][data-level="medium"] {
  background: #fedf89;
}
.ai-doc__section[data-focused="true"][data-level="low"] {
  background: #a6f4c5;
  opacity: 1;
}

.ai-passages__hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}
.ai-passages__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  /* keeps the sticky sidebar within the screen */
  max-height: calc(100vh - var(--header-height) - 420px);
  min-height: 160px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}
.ai-passages__item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.ai-passages__item:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.ai-passages__num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: var(--font-size-sm);
  font-weight: 700;
}
.ai-passages__item[data-level="high"] .ai-passages__num {
  color: var(--ai-high);
  background: var(--ai-high-bg);
}
.ai-passages__item[data-level="medium"] .ai-passages__num {
  color: var(--ai-medium);
  background: var(--ai-medium-bg);
}
.ai-passages__item[data-level="low"] .ai-passages__num {
  color: var(--ai-low);
  background: var(--ai-low-bg);
}
.ai-passages__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ai-passages__label {
  overflow: hidden;
  font-weight: 600;
  color: var(--color-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-passages__words {
  font-size: 12px;
  color: var(--color-text-muted);
}
.ai-passages__score {
  min-width: 58px;
  text-align: right;
  font-weight: 600;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
  .ai-review {
    grid-template-columns: 1fr;
  }
  /* stacked: verdict first, no sticky */
  .ai-sidebar {
    position: static;
    order: -1;
  }
  .ai-passages__list {
    max-height: none;
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .ai-verdict {
    padding: var(--space-4);
  }
  .ai-doc,
  .ai-passages {
    padding: var(--space-4);
  }
  .ai-doc__text {
    padding: var(--space-3);
  }
}
