.hide-sticky-footer {
  visibility: hidden !important;
  pointer-events: none !important;
}
:root {
  --bg: #f7f8f5;
  --panel: #ffffff;
  --ink: #18201d;
  --muted: #61706a;
  --line: #dfe5df;
  --accent: #256f5c;
  --accent-2: #8a5c20;
  --danger: #b42318;
  --warn: #b76e00;
  --ok: #1f7a43;
  --soft: #edf4ef;
  --shadow: 0 14px 40px rgba(25, 36, 31, 0.08);
}

body.dark {
  --bg: #0f1513;
  --panel: #17211d;
  --ink: #edf5f0;
  --muted: #a7b7af;
  --line: #2b3a34;
  --accent: #5bb99e;
  --accent-2: #d5a45c;
  --danger: #ff8a80;
  --warn: #f0b44d;
  --ok: #6fd08d;
  --soft: #1f2c27;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.is-saving {
  opacity: 0.82;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #10231d;
  color: #f7fbf8;
}

body.dark .sidebar {
  background: #09100d;
}

.brand {
  display: grid;
  gap: 4px;
  margin-bottom: 26px;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  color: #bfd2ca;
  font-size: 13px;
}

.sidebar-controls {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.sidebar-controls label {
  display: grid;
  gap: 5px;
  color: #bfd2ca;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar-controls select {
  width: 86px;
  min-height: 32px;
  padding: 4px 8px;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: #f7fbf8;
}

.sidebar-controls select option {
  color: #18201d;
}

.switch-row {
  align-items: start;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-height: 32px;
  padding: 0;
  background: transparent;
  color: #f7fbf8;
  font-size: 12px;
  font-weight: 800;
}

.theme-track {
  position: relative;
  width: 42px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.18s ease;
}

.theme-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f7fbf8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}

.theme-toggle[aria-pressed="true"] .theme-track {
  background: #256f5c;
}

.theme-toggle[aria-pressed="true"] .theme-thumb {
  transform: translateX(18px);
  background: #9fd49d;
}

.theme-label {
  min-width: 42px;
  text-align: left;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  border-radius: 8px;
  color: #e9f1ed;
  background: transparent;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.userbox {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  display: grid;
  gap: 8px;
  color: #dce8e2;
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

.subtle {
  color: var(--muted);
  font-size: 14px;
}

.grid {
  display: grid;
  gap: 16px;
}

.metrics {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.dashboard-metrics {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.dashboard-metrics + .dashboard-metrics {
  margin-top: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 112px;
  padding: 24px;
  display: grid;
  align-content: center;
}

.metric b {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.progress-pie-wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.dashboard-pie-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 28px;
  align-items: center;
}

.progress-pie {
  width: 190px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--panel) 0 52%, transparent 53%),
    conic-gradient(
      #f2c94c 0 var(--pending-deg),
      #2f80ed var(--completed-start) var(--reviewed-start),
      #27ae60 var(--reviewed-start) var(--reviewed-end),
      #e8ede9 var(--reviewed-end) 360deg
    );
  box-shadow: inset 0 0 0 1px var(--line);
}

.assignment-pie {
  width: 190px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--panel) 0 52%, transparent 53%),
    conic-gradient(
      #eb5757 0 var(--unassigned-deg),
      #f2994a var(--unassigned-deg) var(--assigned-end),
      #e8ede9 var(--assigned-end) 360deg
    );
  box-shadow: inset 0 0 0 1px var(--line);
}

body.dark .assignment-pie {
  background:
    radial-gradient(circle at center, var(--panel) 0 52%, transparent 53%),
    conic-gradient(
      #ff7b7b 0 var(--unassigned-deg),
      #ffb15c var(--unassigned-deg) var(--assigned-end),
      #26342f var(--assigned-end) 360deg
    );
}

body.dark .progress-pie {
  background:
    radial-gradient(circle at center, var(--panel) 0 52%, transparent 53%),
    conic-gradient(
      #f2c94c 0 var(--pending-deg),
      #5aa7ff var(--completed-start) var(--reviewed-start),
      #5bd982 var(--reviewed-start) var(--reviewed-end),
      #26342f var(--reviewed-end) 360deg
    );
}

.progress-pie strong,
.assignment-pie strong {
  font-size: 30px;
  line-height: 1;
}

.progress-pie span,
.assignment-pie span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.progress-legend {
  min-width: 220px;
  display: grid;
  gap: 10px;
}

.progress-legend div {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.progress-legend strong {
  text-align: right;
}

.legend-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
}

.legend-dot.pending {
  background: #f2c94c;
}

.legend-dot.completed {
  background: #2f80ed;
}

.legend-dot.reviewed {
  background: #27ae60;
}

.legend-dot.unassigned {
  background: #eb5757;
}

.legend-dot.assigned {
  background: #f2994a;
}

@media (max-width: 900px) {
  .dashboard-pie-row {
    grid-template-columns: 1fr;
  }
}

.section {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select,
textarea {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

body.dark input,
body.dark select,
body.dark textarea {
  background: #111916;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.btn {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.btn.secondary {
  background: #e7eee9;
  color: var(--ink);
}

body.dark .btn.secondary {
  background: #25342e;
}

.btn.warn {
  background: var(--warn);
}

.btn.danger {
  background: var(--danger);
}

.btn.edit-btn {
  background: #2f80ed;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.genus-progress-table tbody tr {
  cursor: pointer;
}

.genus-progress-table {
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
}

.genus-progress-table table {
  min-width: 0;
}

.genus-progress-table::-webkit-scrollbar {
  width: 6px;
}

.genus-progress-table::-webkit-scrollbar-track {
  background: transparent;
}

.genus-progress-table::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 10px;
}

.genus-progress-table::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.genus-progress-table tbody tr:hover {
  background: var(--soft);
}

.genus-progress-table tbody tr.selected {
  background: #fff3df;
  box-shadow: inset 4px 0 0 #f2994a;
}

body.dark .genus-progress-table tbody tr.selected {
  background: #332411;
}

body.dark .table-wrap {
  background: #111916;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f0f4f1;
  color: #40524b;
  font-size: 12px;
  text-transform: uppercase;
}

body.dark th {
  background: #1f2c27;
  color: #c8d8d0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #eef2f0;
  color: #34463f;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

body.dark .badge {
  background: #26342f;
  color: #d7e5df;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 900;
  padding: 0 6px;
  border-radius: 999px;
  vertical-align: middle;
  min-width: 24px;
  height: 24px;
  line-height: 1;
}

.badge.ok {
  background: #e5f6eb;
  color: var(--ok);
}

.status-badge {
  gap: 6px;
}

.status-badge.status-pending {
  background: #fff2db;
  color: #8c5200;
}

.status-badge.status-completed {
  background: #e6f0ff;
  color: #2458a6;
}

.status-badge.status-reviewed {
  background: #e5f6eb;
  color: #1f7a43;
}

.status-actor-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.status-actor.completed {
  background: #e6f0ff;
  color: #2458a6;
}

.status-actor.reviewed {
  background: #e5f6eb;
  color: #1f7a43;
}

body.dark .status-badge.status-pending {
  background: #3a2a10;
  color: #ffd58a;
}

body.dark .status-badge.status-completed {
  background: #1d2f4f;
  color: #9fc4ff;
}

body.dark .status-badge.status-reviewed {
  background: #153321;
  color: #8de2a7;
}

body.dark .status-actor.completed {
  background: #1d2f4f;
  color: #9fc4ff;
}

body.dark .status-actor.reviewed {
  background: #153321;
  color: #8de2a7;
}

.status-icon {
  display: inline-block;
  color: currentColor;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.review-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef2f0;
  color: var(--ink);
  font-weight: 800;
}

body.dark .review-switch {
  background: #25342e;
}

.review-switch:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.review-track {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #d8dfdb;
  transition: background 0.18s ease;
}

.review-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}

.review-switch[aria-pressed="true"] {
  background: #e5f6eb;
  color: #1f7a43;
}

.review-switch[aria-pressed="true"] .review-track {
  background: #1f7a43;
}

.review-switch[aria-pressed="true"] .review-thumb {
  transform: translateX(18px);
}

body.dark .review-switch[aria-pressed="true"] {
  background: #153321;
  color: #8de2a7;
}

.review-label {
  min-width: 92px;
  text-align: left;
}

.assign-responsible-switch .review-label {
  min-width: 48px;
}

.assign-responsible-head {
  min-width: 220px;
}

.assign-head-actions {
  display: inline-flex;
  gap: 10px;
  margin-left: 10px;
}

.assign-head-actions .link-btn {
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
}

.assign-head-actions .link-btn:disabled {
  color: var(--muted);
}

.badge.warn {
  background: #fff2db;
  color: #8c5200;
}

.badge.danger {
  background: #ffe8e5;
  color: var(--danger);
}

.pill-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 12px 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f0f5f1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.filter-pill input[type="checkbox"] {
  appearance: none;
  position: relative;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  cursor: pointer;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid #bfcac4;
  border-radius: 50%;
  background: var(--panel);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.filter-pill input[type="checkbox"]::after {
  content: "✓";
  position: static;
  color: transparent;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  transition: color 0.15s ease;
}

.filter-pill input[type="checkbox"]:checked {
  border-color: #27ae60;
  background: #27ae60;
}

.filter-pill input[type="checkbox"]:checked::after {
  color: #fff;
}

.filter-pill:has(input:checked) {
  border-color: #1f7a43;
  background: #e5f6eb;
  color: #1f7a43;
}

body.dark .filter-pill {
  background: #18231f;
  color: var(--muted);
}

body.dark .filter-pill input[type="checkbox"] {
  background: #111916;
  border-color: #5f6d67;
}

body.dark .filter-pill input[type="checkbox"]:checked {
  border-color: #8de2a7;
  background: #8de2a7;
}

body.dark .filter-pill input[type="checkbox"]:checked::after {
  color: #153321;
}

body.dark .filter-pill:has(input:checked) {
  border-color: #8de2a7;
  background: #153321;
  color: #8de2a7;
}

body.dark .filter-pill input[type="checkbox"] {
  background: #111916;
}

body.dark .filter-pill input[type="checkbox"]:checked {
  border-color: #8de2a7;
  background: #8de2a7;
}

body.dark .filter-pill input[type="checkbox"]:checked::after {
  background: #153321;
}

.collab-progress-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.collab-progress-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px 50px 50px;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  border-radius: 6px;
  transition: background 0.15s;
}

.collab-progress-row.selected {
  background: var(--soft);
  box-shadow: inset 4px 0 0 var(--accent);
}

.collab-progress-row:hover:not(.collab-progress-head) {
  background: var(--soft);
  cursor: pointer;
}

.collab-progress-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

/*  */.collab-progress-head span:not(:first-child) {
  text-align: right;
}

.collab-progress-row:last-child {
  border-bottom: 0;
}

.collab-progress-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collab-progress-number {
  text-align: center;
  color: var(--accent);
  font-weight: 800;
}

.collab-progress-number.done {
  color: var(--ok);
}

.collab-progress-number.reviewed {
  color: #27ae60;
}

body.dark .collab-progress-number.reviewed {
  color: #5bd982;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 16px;
  position: relative;
}

.divergence-badge-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.divergence-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 12px 6px 8px;
  border: 1px solid #d7e3da;
  border-radius: 999px;
  background: #eef6f1;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.divergence-badge-index {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1f7a43;
  color: #fff;
  font-size: 11px;
  flex: 0 0 auto;
}

.divergence-badge-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.dark .divergence-badge {
  border-color: #2a4635;
  background: #182520;
  color: var(--ink);
}

body.dark .divergence-badge-index {
  background: #ff9b18;
  color: #153321;
}

.pulse-focus {
  animation: pulse-focus 1.4s ease;
}

@keyframes pulse-focus {
  0% { box-shadow: 0 0 0 0 rgba(31, 122, 67, 0.0); }
  20% { box-shadow: 0 0 0 6px rgba(31, 122, 67, 0.22); }
  100% { box-shadow: 0 0 0 0 rgba(31, 122, 67, 0.0); }
}

.species-sticky-header {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: -16px -16px 12px;
  padding: 16px 26px 16px 30px; /* Alinhamento: 16px do card + 14px da linha */
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px 8px 0 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
}

.species-title-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.species-title-line h2 {
  min-width: 0;
}

.species-meta-badges {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.species-header-status {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.species-sticky-footer {
  position: -webkit-sticky;
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 8px -16px -16px !important;
  padding: 8px 16px !important;
  border-top: 1px solid var(--line);
  background-color: var(--panel) !important;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.15);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  width: calc(100% + 32px); /* Compensa as margens negativas laterais */
}

@media (max-width: 760px) {
  .species-sticky-header {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 8px;
  }
  .habit-container,
  .species-meta-badges,
  .species-header-status {
    grid-column: 1;
    justify-content: flex-start;
    align-items: flex-start;
  }
}

.badge.habit {
  background: var(--soft);
  color: var(--accent);
  border: 1px solid #ffffff !important;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  min-height: 28px;
  padding: 3px 11px;
}

.badge.biome {
  background: #eef8f1;
  color: #25603a;
  border: 1px solid #c8ead3;
  font-size: 11px;
  font-weight: 700;
  min-height: 28px;
  padding: 3px 10px;
}

body.dark .badge.biome {
  background: #173323;
  color: #aee2bf;
  border-color: #2d6b45;
}

.badge.veg {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 500;
  min-height: 28px;
  padding: 3px 10px;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(16, 35, 29, 0.76), rgba(16, 35, 29, 0.78)),
    url("https://images.unsplash.com/photo-1511497584788-876760111969?auto=format&fit=crop&w=1800&q=80")
      center/cover;
}

.auth-card {
  width: min(440px, 100%);
  padding: 24px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

body.dark .auth-card {
  background: rgba(23, 33, 29, 0.96);
}

.auth-card form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.link-btn {
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.double-check {
  letter-spacing: -6px;
}

.notice {
  padding: 12px 14px;
  border: 1px solid #f0d394;
  border-radius: 8px;
  background: #fff7e5;
  color: #704600;
}

body.dark .notice {
  border-color: #6e5627;
  background: #2b2315;
  color: #ffd993;
}

.notice.error {
  border-color: #f2b8b5;
  background: #fff0ef;
  color: var(--danger);
}

.class-list {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr);
}

.class-row {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto auto auto minmax(200px, 0.6fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 8px 10px 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  box-shadow: 0 8px 22px rgba(25, 36, 31, 0.06);
}

.class-row.selected {
  border-color: #27ae60;
  background: #eaf8ef;
}

.class-row.divergence-diff {
  border-color: #d97706;
  background: #fff3df;
  box-shadow: 0 10px 28px rgba(217, 119, 6, 0.16);
}

body.dark .class-row {
  background: transparent;
  box-shadow: none;
}

body.dark .class-row.selected {
  background: #153321;
}

body.dark .class-row.divergence-diff {
  background: #3a2a10;
}

.class-main,
.uncertain-pill,
.certainty-pill,
.preference-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.class-main .class-label-text {
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.class-main input {
  appearance: none;
  position: relative;
  width: 24px;
  height: 24px;
  min-height: 24px;
  display: inline-block;
  flex: 0 0 auto;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
}

.class-main input:checked {
  border-color: #27ae60;
  background: #27ae60;
}

.class-main input:checked::after {
  content: "✓";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -53%);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.uncertain-pill {
  min-height: 34px;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef2f0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.uncertain-pill[aria-pressed="true"] {
  border-color: #d97706;
  background: #fff3df;
  color: #a15c00;
}

body.dark .uncertain-pill {
  background: #25342e;
}

body.dark .uncertain-pill[aria-pressed="true"] {
  background: #3a2a10;
  color: #ffd58a;
}

.certainty-pill {
  min-height: 36px;
  padding: 4px 5px 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef2f0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

body.dark .certainty-pill {
  background: #111916;
}

.certainty-options {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: #dde6e0;
}

body.dark .certainty-options {
  background: #25342e;
}

.certainty-options button {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.certainty-options button.certainty-1[aria-pressed="true"] {
  background: #d64545;
  color: #fff;
}

.certainty-options button.certainty-2[aria-pressed="true"] {
  background: #e6862f;
  color: #fff;
}

.certainty-options button.certainty-3[aria-pressed="true"] {
  background: #f2c94c;
  color: #3a2a00;
}

.certainty-options button.certainty-4[aria-pressed="true"] {
  background: #9bd67a;
  color: #143d1d;
}

.certainty-options button.certainty-5[aria-pressed="true"] {
  background: #27ae60;
  color: #fff;
}

.preference-pill {
  min-height: 36px;
  padding: 4px 5px 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef2f0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

body.dark .preference-pill {
  background: #111916;
}

.preference-options {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: #dde6e0;
}

body.dark .preference-options {
  background: #25342e;
}

.preference-options button {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.preference-options button.preference-1[aria-pressed="true"] {
  background: #9ca3af;
  color: #fff;
}

.preference-options button.preference-2[aria-pressed="true"] {
  background: #60a5fa;
  color: #fff;
}

.preference-options button.preference-3[aria-pressed="true"] {
  background: #3b82f6;
  color: #fff;
}

.preference-options button.preference-4[aria-pressed="true"] {
  background: #6366f1;
  color: #fff;
}

.preference-options button.preference-5[aria-pressed="true"] {
  background: #7c3aed;
  color: #fff;
}

@media (max-width: 760px) {
  .class-row {
    grid-template-columns: 1fr;
    width: 100%;
    border-radius: 18px;
    align-items: stretch;
  }

  .uncertain-pill,
  .certainty-pill,
  .preference-pill {
    justify-content: space-between;
  }

  .class-divergence-note textarea {
    border-radius: 14px;
  }

  .class-open-divergence {
    border-radius: 14px;
  }
}

.divergence-btn {
  background: #d97706;
}

.divergence-toolbar {
  margin: 10px 0 12px;
}

.divergence-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.class-divergence-note {
  min-width: 0;
}

.class-open-divergence {
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid #d97706;
  border-radius: 14px;
  background: rgba(217, 119, 6, 0.05);
}

.class-open-divergence p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.class-open-divergence .subtle {
  font-size: 12px;
}

.divergence-compare-grid {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.divergence-compare-row {
  display: grid;
  grid-template-columns: 92px minmax(44px, auto) 18px minmax(44px, auto);
  gap: 8px;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.divergence-compare-row.changed {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.divergence-compare-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.divergence-compare-old,
.divergence-compare-new {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
}

.divergence-compare-old {
  background: transparent;
  color: #3f5248;
}

.divergence-compare-new {
  background: transparent;
  color: #1f7a43;
}

.divergence-compare-row.changed .divergence-compare-old {
  border: 3px solid #dc2626;
  color: #dc2626;
  background: transparent;
}

.divergence-compare-row.changed .divergence-compare-new {
  border: 3px solid #16a34a;
  color: #16a34a;
  background: transparent;
}

.divergence-compare-arrow {
  text-align: center;
  color: var(--muted);
  font-weight: 900;
}

.divergence-removed {
  outline: 3px solid #ff5c5c;
  box-shadow: 0 0 0 3px rgba(255, 92, 92, 0.18);
}

.divergence-added {
  outline: 3px solid #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.divergence-changed {
  outline: 3px solid #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

body.dark .class-open-divergence {
  background: rgba(217, 119, 6, 0.12);
}

body.dark .divergence-compare-row {
  background: transparent;
}

body.dark .divergence-compare-row.changed {
  background: transparent;
  border-color: transparent;
}

body.dark .divergence-compare-old {
  background: transparent;
  color: #d4e2dc;
}

body.dark .divergence-compare-new {
  background: transparent;
  color: #8de2a7;
}

body.dark .divergence-compare-row.changed .divergence-compare-old {
  border-color: #ef4444;
  color: #fca5a5;
}

body.dark .divergence-compare-row.changed .divergence-compare-new {
  border-color: #22c55e;
  color: #86efac;
}

.class-divergence-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.class-divergence-note textarea {
  width: 100%;
  min-height: 42px;
  max-height: 84px;
  padding: 10px 14px;
  border-radius: 999px;
  background: transparent;
}

body.dark .class-divergence-note textarea {
  background: transparent;
}

.divergence-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.divergence-item {
  padding: 12px;
  border: 1px solid #f2c078;
  border-radius: 8px;
  background: #fff7e8;
}

body.dark .divergence-item {
  border-color: #754c16;
  background: #24190d;
}

.log-json {
  max-width: 360px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #44554f;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

:root {
  --divergence-green: #8cff66;
  --divergence-red: #ff4d5a;
}

/* deixa só os checkboxes com divergência um pouco maiores */
.class-main input.divergence-added,
.class-main input.divergence-removed {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
}

/* inclusão: círculo verde claro em volta */
.class-main input.divergence-added {
  border: 3px solid var(--divergence-green) !important;
  background: #27ae60 !important;
  box-shadow:
    0 0 0 5px rgba(140, 255, 102, 0.18),
    0 0 14px rgba(140, 255, 102, 0.45);
}

/* mantém o check padrão */
.class-main input.divergence-added::after {
  content: "✓" !important;
  color: #fff !important;
}

/* remoção: bolinha continua marcada, só ganha aro vermelho */
.class-main input.divergence-removed {
  border: 3px solid var(--divergence-red) !important;
  background: #27ae60 !important;
  box-shadow:
    0 0 0 5px rgba(255, 77, 90, 0.18),
    0 0 14px rgba(255, 77, 90, 0.42);
}

/* mantém o check branco por baixo */
.class-main input.divergence-removed::after {
  content: "✓" !important;
  color: #fff !important;
}

/* desenha o X vermelho por cima, centralizado */
.class-main input.divergence-removed::before {
  content: "×";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%);
  color: var(--divergence-red);
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  z-index: 2;
  pointer-events: none;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .metrics,
  .split {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }
}

.class-label {
  position: relative;
  display: inline-block;
  min-width: 0;
  max-width: 100%;
}

.class-label.has-tooltip {
  cursor: help;
  border-bottom: 1px dotted currentColor;
}

.class-tooltip {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 9999;
  width: min(900px, calc(100vw - 32px));
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  border-radius: 12px;
  background: #10251d;
  color: white;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  white-space: normal;
  font-weight: 500;
}

.class-label.has-tooltip:hover .class-tooltip {
  display: block;
}

.class-tooltip table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 12px;
}

.class-tooltip th,
.class-tooltip td {
  border: 1px solid rgba(255,255,255,0.25);
  padding: 6px;
  vertical-align: top;
}

.class-tooltip th {
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}
