/* Trello Power-Up theme — light/dark via html[data-color-mode] */

html[data-color-mode="light"] {
  color-scheme: light;
  --tp-bg: transparent;
  --tp-surface: #ffffff;
  --tp-surface-subtle: #f1f2f4;
  --tp-surface-hover: #091e420f;
  --tp-surface-active: #091e4224;
  --tp-text: #172b4d;
  --tp-text-subtle: #44546f;
  --tp-text-muted: #626f86;
  --tp-border: #091e4224;
  --tp-border-strong: #091e424f;
  --tp-primary: #0c66e4;
  --tp-primary-hover: #0055cc;
  --tp-primary-text: #ffffff;
  --tp-link: #0c66e4;
  --tp-success: #216e4e;
  --tp-success-bg: #dffcf0;
  --tp-danger-text: #ae2e24;
  --tp-shadow: none;
  --tp-input-bg: #ffffff;
}

html[data-color-mode="dark"] {
  color-scheme: dark;
  /* Elevation: dark canvas → lighter as layers rise toward the user */
  --tp-elev-0: #0d1117;
  --tp-elev-1: #161b22;
  --tp-elev-2: #21262d;
  --tp-elev-3: #2d333b;
  --tp-elev-4: #3d444d;
  --tp-bg: var(--tp-elev-0);
  --tp-surface-subtle: var(--tp-elev-1);
  --tp-surface: var(--tp-elev-2);
  --tp-surface-hover: #a6c5e729;
  --tp-surface-active: #a6c5e73d;
  --tp-text: #f7f8f9;
  --tp-text-subtle: #b6c2cf;
  --tp-text-muted: #8c9bab;
  --tp-border: #a6c5e75c;
  --tp-border-strong: #a6c5e799;
  --tp-primary: #579dff;
  --tp-primary-hover: #85b8ff;
  --tp-primary-text: var(--tp-elev-0);
  --tp-link: #579dff;
  --tp-success: #4bce97;
  --tp-success-bg: #1c3329;
  --tp-danger-text: #fd9891;
  --tp-shadow: none;
  --tp-input-bg: var(--tp-elev-3);
}

/* Standalone pages (landing) — no data-color-mode from Trello */
html:not([data-color-mode]) {
  --tp-bg: #f4f5f7;
  --tp-surface: #ffffff;
  --tp-surface-subtle: #f1f2f4;
  --tp-surface-hover: #091e420f;
  --tp-surface-active: #091e4224;
  --tp-text: #172b4d;
  --tp-text-subtle: #44546f;
  --tp-text-muted: #626f86;
  --tp-border: #091e4224;
  --tp-border-strong: #091e424f;
  --tp-primary: #0c66e4;
  --tp-primary-hover: #0055cc;
  --tp-primary-text: #ffffff;
  --tp-link: #0c66e4;
  --tp-success: #216e4e;
  --tp-success-bg: #dffcf0;
  --tp-danger-text: #ae2e24;
  --tp-shadow: 0 1px 2px #091e4214;
  --tp-input-bg: #ffffff;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 14px;
  line-height: 1.4286;
  background: var(--tp-bg);
  color: var(--tp-text);
}

.tp-page { padding: 12px; }
.tp-page--roomy { padding: 16px; }

/* Trello popup/modal chrome already insets content — drop redundant horizontal padding */
html[data-color-mode] .tp-page:not(.tp-page--priority) {
  padding: 8px 0 12px;
}

html[data-color-mode] .tp-page--roomy:not(.tp-page--priority) {
  padding: 12px 0 16px;
}

/* Keep the welcome guide comfortably inset inside Trello's modal. */
html[data-color-mode] .tp-page--welcome {
  padding: 16px 20px 20px;
}

.tp-heading {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tp-text-muted);
  margin-bottom: 12px;
}

.tp-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--tp-text);
  margin-bottom: 4px;
}

.tp-subtitle {
  font-size: 14px;
  color: var(--tp-text-subtle);
  margin-bottom: 16px;
}

.tp-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tp-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--tp-text);
  font-size: 14px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s ease;
}

.tp-list-item:hover { background: var(--tp-surface-hover); }
.tp-list-item:active { background: var(--tp-surface-active); }
.tp-list-item.is-active {
  background: var(--tp-surface-active);
  font-weight: 600;
}

.tp-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tp-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--tp-text-muted);
  font-variant-numeric: tabular-nums;
}

.tp-input {
  width: 100%;
  padding: 6px 8px;
  border: 2px solid var(--tp-border);
  border-radius: 3px;
  background: var(--tp-input-bg);
  color: var(--tp-text);
  font-size: 14px;
  transition: border-color 0.1s ease;
}

.tp-input:hover { background: var(--tp-surface-subtle); }
.tp-input:focus {
  outline: none;
  border-color: var(--tp-primary);
}

.tp-row {
  display: grid;
  grid-template-columns: 28px 1fr 44px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.tp-num-badge {
  width: 28px;
  height: 28px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.tp-color-swatch {
  display: block;
  flex-shrink: 0;
  width: 44px;
  height: 32px;
  border: 2px solid var(--tp-border);
  border-radius: 3px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  background: var(--tp-surface-subtle, #f1f2f4);
}

.tp-color-swatch:hover { border-color: var(--tp-border-strong); }

.tp-color-swatch input[type="color"] {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0;
}

/* Must be block — inline spans ignore width/height, so swatches looked empty. */
.tp-color-preview {
  display: block;
  width: 100%;
  height: 100%;
}

.tp-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.tp-btn {
  flex: 1;
  padding: 6px 12px;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.1s ease;
}

.tp-btn--primary {
  background: var(--tp-primary);
  color: var(--tp-primary-text);
}

.tp-btn--primary:hover { background: var(--tp-primary-hover); }

.tp-btn--secondary {
  background: var(--tp-surface-subtle);
  color: var(--tp-text);
  box-shadow: inset 0 0 0 1px var(--tp-border);
}

.tp-btn--secondary:hover { background: var(--tp-surface-hover); }

.tp-btn--ghost {
  margin-top: 8px;
  width: 100%;
  padding: 6px 12px;
  background: transparent;
  color: var(--tp-text-subtle);
  border: none;
  border-radius: 3px;
  font-size: 13px;
  cursor: pointer;
}

.tp-btn--ghost:hover {
  background: var(--tp-surface-hover);
  color: var(--tp-text);
}

.tp-link {
  display: inline-block;
  margin-top: 8px;
  padding: 0;
  border: none;
  background: none;
  color: var(--tp-link);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}

.tp-link:hover { text-decoration: underline; }

.tp-auto-sort {
  margin: 0;
}

.tp-auto-sort-status {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--tp-text-subtle, #44546f);
}

.tp-button {
  display: inline-block;
  padding: 6px 12px;
  border: none;
  border-radius: 3px;
  background: var(--tp-link);
  color: #fff;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

/* Author display overrides UA [hidden] without !important */
.tp-button[hidden] {
  display: none !important;
}

.tp-button:hover { filter: brightness(1.05); }

.tp-button--secondary {
  background: var(--tp-surface, #fff);
  color: var(--tp-text, #172b4d);
  border: none;
  box-shadow: inset 0 0 0 1px var(--tp-border, #091e4224);
  margin-top: 12px;
}

.tp-button--secondary:hover {
  filter: none;
  background: var(--tp-surface-hover);
  box-shadow: inset 0 0 0 1px var(--tp-border-strong, #091e424f);
}

.tp-page--settings .tp-button--secondary {
  box-shadow: none;
  background: var(--tp-surface, #fff);
}

.tp-page--settings .tp-button--secondary:hover {
  background: var(--tp-surface-hover, #091e420a);
}

.tp-select {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: var(--tp-surface, #fff);
  box-shadow: inset 0 0 0 1px var(--tp-border, #091e4224);
  color: var(--tp-text);
  font: inherit;
  font-size: 13px;
}

.tp-select:hover {
  box-shadow: inset 0 0 0 1px var(--tp-border-strong, #091e424f);
}

.tp-select:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--tp-primary, #0c66e4);
}

.tp-statut-settings {
  margin: 0 0 16px;
}

.tp-page--settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 16px;
}

html[data-color-mode] .tp-page--settings {
  padding: 14px 14px 16px;
}

.tp-settings-section {
  margin: 0;
  border: none;
  border-radius: 10px;
  background: var(--tp-surface-subtle, #f1f2f4);
  overflow: hidden;
}

.tp-settings-section[hidden] {
  display: none;
}

.tp-settings-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    'icon title chevron'
    'icon hint chevron';
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  padding: 12px 14px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.tp-settings-summary::-webkit-details-marker {
  display: none;
}

.tp-settings-summary::after {
  grid-area: chevron;
  content: '';
  width: 0.5em;
  height: 0.5em;
  margin-right: 2px;
  border-right: 2px solid var(--tp-text-subtle, #44546f);
  border-bottom: 2px solid var(--tp-text-subtle, #44546f);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.tp-settings-section[open] > .tp-settings-summary::after {
  transform: translateY(3px) rotate(225deg);
}

.tp-settings-summary:hover {
  background: var(--tp-surface-hover, #091e420a);
}

.tp-settings-summary:focus-visible {
  outline: 2px solid var(--tp-primary, #0c66e4);
  outline-offset: -2px;
}

.tp-settings-summary-icon {
  grid-area: icon;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--tp-surface, #fff);
  color: var(--tp-text-subtle, #44546f);
  font-size: 20px;
  line-height: 1;
}

.tp-settings-summary-icon .ti {
  font-size: inherit;
  line-height: 1;
}

.tp-settings-summary-title {
  grid-area: title;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--tp-text, #172b4d);
}

.tp-settings-summary-hint {
  grid-area: hint;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--tp-text-subtle, #44546f);
}

.tp-settings-body {
  padding: 2px 14px 14px;
  border-top: none;
}

.tp-settings-body > .tp-color-scheme-hint:first-child {
  margin-top: 2px;
}

.tp-settings-body .tp-link {
  display: inline-block;
  margin-top: 4px;
  padding: 0;
}

.tp-capabilities {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--tp-border, #dfe1e6);
}

.tp-capabilities-summary {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tp-text, #172b4d);
}

.tp-capabilities-summary[data-tone='ok'] {
  color: var(--tp-success, #216e4e);
}

.tp-capabilities-summary[data-tone='warn'] {
  color: var(--tp-warning, #974f0c);
}

.tp-capabilities-note {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--tp-text-subtle, #44546f);
}

.tp-capabilities-note .tp-link {
  margin-top: 0;
}

.tp-capabilities-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tp-capabilities-item {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--tp-border, #dfe1e6);
  background: var(--tp-surface, #f7f8f9);
}

.tp-capabilities-item--ok {
  border-color: color-mix(in srgb, #216e4e 35%, var(--tp-border, #dfe1e6));
}

.tp-capabilities-item--warn {
  border-color: color-mix(in srgb, #974f0c 40%, var(--tp-border, #dfe1e6));
}

.tp-capabilities-item--error {
  border-color: color-mix(in srgb, #c9372c 45%, var(--tp-border, #dfe1e6));
  background: color-mix(in srgb, #c9372c 6%, var(--tp-surface, #f7f8f9));
}

.tp-capabilities-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.tp-capabilities-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.tp-capabilities-badge--on {
  color: #164b35;
  background: #baf3db;
}

.tp-capabilities-badge--off {
  color: #5e4db2;
  background: #dfd8fd;
}

.tp-capabilities-id {
  font-size: 12px;
  font-weight: 600;
  color: var(--tp-text, #172b4d);
}

.tp-capabilities-status {
  margin-left: auto;
  font-size: 11px;
  color: var(--tp-text-subtle, #44546f);
}

.tp-capabilities-item--ok .tp-capabilities-status {
  color: #216e4e;
}

.tp-capabilities-item--warn .tp-capabilities-status {
  color: #974f0c;
}

.tp-capabilities-item--error .tp-capabilities-status {
  color: #ae2a19;
}

.tp-capabilities-meta {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--tp-text-subtle, #44546f);
}

.tp-capabilities-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tp-capabilities-copy-status {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--tp-text-subtle, #44546f);
}

.tp-settings-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: 6px;
  padding: 8px 2px 0;
}

.tp-settings-footer .tp-link {
  padding: 0;
}

.tp-settings-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.tp-settings-footer .tp-build-info {
  margin: 0;
  padding: 0;
  border: none;
}

.tp-statut-map {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
  padding: 6px;
  border-radius: 8px;
  background: var(--tp-surface, #fff);
}

.tp-statut-map-row {
  display: grid;
  grid-template-columns: 10px 1fr minmax(120px, 40%);
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
}

.tp-statut-map-row:hover {
  background: var(--tp-surface-hover, #091e420a);
}

.tp-statut-map-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(9, 30, 66, 0.18);
}

.tp-statut-map-swatch--empty {
  background: transparent !important;
  box-shadow: inset 0 0 0 1.5px var(--tp-border-strong, #091e424f);
}

.tp-statut-map-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--tp-text, #172b4d);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-member-roles-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.tp-member-roles-row {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
}

.tp-member-roles-icon {
  font-size: 16px;
  color: var(--tp-text-subtle, #626f86);
}

.tp-member-roles-label {
  width: 100%;
  min-width: 0;
}

.tp-member-roles-remove {
  white-space: nowrap;
}

.tp-member-roles-create {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.tp-member-roles-create .tp-input {
  flex: 1 1 auto;
  min-width: 0;
}

.tp-member-roles-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 12px;
  color: var(--tp-text-subtle, #626f86);
}

.tp-statut-map-select,
.tp-statut-roles .tp-select {
  background: var(--tp-surface-subtle, #f1f2f4);
}

.tp-select.tp-select--statut-colored {
  color: var(--statut-select-color);
  font-weight: 600;
  box-shadow:
    inset 3px 0 0 var(--statut-select-color),
    inset 0 0 0 1px var(--tp-border, #091e4224);
  padding-left: 12px;
}

.tp-select.tp-select--statut-colored:hover {
  box-shadow:
    inset 3px 0 0 var(--statut-select-color),
    inset 0 0 0 1px var(--tp-border-strong, #091e424f);
}

.tp-select.tp-select--statut-colored:focus {
  box-shadow:
    inset 3px 0 0 var(--statut-select-color),
    inset 0 0 0 2px var(--tp-primary, #0c66e4);
}

.tp-statut-roles {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 8px;
  background: var(--tp-surface, #fff);
}

.tp-statut-role {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tp-statut-role-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--tp-text-subtle, #44546f);
}

.tp-statut-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--tp-surface, #fff);
  font-size: 13px;
  line-height: 1.45;
  color: var(--tp-text, #172b4d);
  cursor: pointer;
}

.tp-statut-toggle input {
  margin-top: 2px;
  flex-shrink: 0;
}

.tp-statut-colors {
  margin: 14px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--tp-border, rgba(9, 30, 66, 0.14));
}

.tp-statut-color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.tp-statut-color {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  cursor: pointer;
}

.tp-statut-color-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--tp-text, #172b4d);
}

.tp-statut-color-hint {
  flex: 1 1 auto;
  font-size: 12px;
  color: var(--tp-text-muted, #626f86);
}

.tp-statut-color .tp-color-swatch {
  margin-left: auto;
}

.tp-color-scheme {
  margin: 0 0 16px;
}

.tp-color-scheme-hint {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--tp-text-subtle, #44546f);
}

.tp-color-scheme-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tp-color-scheme-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: var(--tp-surface, #fff);
  color: var(--tp-text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s ease, box-shadow 0.1s ease;
}

.tp-color-scheme-option:hover {
  background: var(--tp-surface-hover);
}

.tp-color-scheme-option.is-active {
  background: var(--tp-surface, #fff);
  box-shadow: inset 3px 0 0 var(--tp-primary);
  font-weight: 600;
}

html[data-color-mode="dark"] .tp-color-scheme-option.is-active {
  background: var(--tp-surface-active);
}

.tp-color-scheme-option:focus-visible {
  outline: 2px solid var(--tp-primary);
  outline-offset: 1px;
}

.tp-color-scheme-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}

.tp-color-scheme-icon {
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
  color: var(--tp-text-subtle, #44546f);
}

.tp-color-scheme-option.is-active .tp-color-scheme-icon {
  color: var(--tp-primary, #0c66e4);
}

.tp-color-scheme-option[data-scheme="fire"] .tp-color-scheme-icon {
  color: #c23b2a;
}

.tp-color-scheme-option[data-scheme="blue"] .tp-color-scheme-icon {
  color: #378add;
}

.tp-color-scheme-option.is-active[data-scheme="fire"] .tp-color-scheme-icon {
  color: #c23b2a;
}

.tp-color-scheme-option.is-active[data-scheme="blue"] .tp-color-scheme-icon {
  color: #0c66e4;
}

.tp-color-scheme-label-text {
  min-width: 0;
}

.tp-color-scheme-swatches {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.tp-color-scheme-swatch {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: none;
  box-shadow: inset 0 0 0 1px rgba(9, 30, 66, 0.16);
}

.tp-color-scheme-swatch--gradient {
  width: 36px;
}

.tp-color-scheme-swatch--start,
.tp-color-scheme-swatch--end {
  width: 18px;
}

.tp-progress-gradient {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tp-progress-gradient-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tp-progress-gradient-preset {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 72px;
  flex: 1 1 72px;
  max-width: 110px;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: var(--tp-surface, #fff);
  color: var(--tp-text);
  font: inherit;
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  transition: background 0.1s ease, box-shadow 0.1s ease;
}

.tp-progress-gradient-preset:hover {
  background: var(--tp-surface-hover);
}

.tp-progress-gradient-preset.is-active {
  box-shadow: inset 0 0 0 2px var(--tp-primary);
  background: var(--tp-surface, #fff);
  font-weight: 600;
}

.tp-progress-gradient-preset:focus-visible {
  outline: 2px solid var(--tp-primary);
  outline-offset: 1px;
}

.tp-progress-gradient-preset-swatch {
  display: block;
  height: 14px;
  border-radius: 3px;
  border: none;
  box-shadow: inset 0 0 0 1px rgba(9, 30, 66, 0.16);
}

.tp-progress-gradient-preset-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tp-progress-gradient-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: var(--tp-surface, #fff);
}

.tp-progress-gradient-track-wrap {
  position: relative;
  height: 36px;
  padding: 10px 0 14px;
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}

.tp-progress-gradient-track {
  height: 16px;
  border-radius: 8px;
  border: none;
  box-shadow: inset 0 0 0 1px rgba(9, 30, 66, 0.16);
}

.tp-progress-gradient-handles {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
}

.tp-progress-gradient-handle {
  position: absolute;
  top: 4px;
  width: 14px;
  height: 28px;
  margin-left: -7px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 2px;
  background: var(--stop-color, #b3bac5);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.2);
  cursor: grab;
  pointer-events: auto;
  transform: translateZ(0);
}

.tp-progress-gradient-handle.is-selected {
  box-shadow: 0 0 0 2px var(--tp-primary), 0 1px 3px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.tp-progress-gradient-handle:active {
  cursor: grabbing;
}

.tp-progress-gradient-handle:focus-visible {
  outline: 2px solid var(--tp-primary);
  outline-offset: 1px;
}

.tp-progress-gradient-scale {
  display: flex;
  justify-content: space-between;
  margin-top: -4px;
  font-size: 11px;
  color: var(--tp-text-muted, #5e6c84);
}

.tp-progress-gradient-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.tp-progress-gradient-color,
.tp-progress-gradient-pos {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--tp-text-muted, #5e6c84);
}

.tp-progress-gradient-color-input {
  width: 44px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--tp-border);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
}

.tp-progress-gradient-pos {
  position: relative;
}

.tp-progress-gradient-pos-input {
  width: 64px;
  height: 28px;
  padding: 0 22px 0 8px;
  border: 1px solid var(--tp-border);
  border-radius: 3px;
  background: var(--tp-surface);
  color: var(--tp-text);
  font: inherit;
  font-size: 13px;
}

.tp-progress-gradient-pos-suffix {
  position: absolute;
  right: 8px;
  bottom: 6px;
  font-size: 12px;
  color: var(--tp-text-muted, #5e6c84);
  pointer-events: none;
}

.tp-progress-gradient-delete {
  margin-left: auto;
}

.tp-progress-gradient-hint {
  margin: 0;
}

.tp-progress-gradient-preview {
  margin-top: 4px;
  padding: 12px;
  border-top: none;
  border-radius: 8px;
  background: var(--tp-surface, #fff);
}

.tp-progress-gradient-preview-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 10px;
}

.tp-progress-gradient-preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tp-progress-gradient-preview-label {
  flex: 0 0 36px;
  font-size: 11px;
  color: var(--tp-text-subtle, #44546f);
  text-align: right;
}

.tp-progress-gradient-preview-bar {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: var(--tp-border, #dfe1e6);
  overflow: hidden;
  position: relative;
}

.tp-progress-gradient-preview-fill {
  display: block;
  height: 100%;
  width: var(--completion-pct, 0%);
  background: var(--completion-fill, #0079bf);
  border-radius: inherit;
}

.tp-progress-gradient-preview-badges {
  margin-top: 0;
}

.tp-badge-preview {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: var(--tp-surface, #fff);
}

.tp-badge-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tp-badge-preview-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  color: #fff;
  white-space: nowrap;
}

/* Trello named badge colors (preview chips). Yellow/pink/sky/lime use darker text for contrast.
   Hex values mirror PriorityUI.TRELLO_BADGE_COLOR_HEX except yellow (darker for readability). */
.tp-badge-preview-chip[data-trello-color="blue"] { background: #0079BF; }
.tp-badge-preview-chip[data-trello-color="green"] { background: #61BD4F; }
.tp-badge-preview-chip[data-trello-color="orange"] { background: #FF9F1A; }
.tp-badge-preview-chip[data-trello-color="red"] { background: #EB5A46; }
.tp-badge-preview-chip[data-trello-color="yellow"] { background: #B58900; color: #172B4D; }
.tp-badge-preview-chip[data-trello-color="purple"] { background: #C377E0; }
.tp-badge-preview-chip[data-trello-color="pink"] { background: #FF78CB; color: #172B4D; }
.tp-badge-preview-chip[data-trello-color="sky"] { background: #00C2E0; color: #172B4D; }
.tp-badge-preview-chip[data-trello-color="lime"] { background: #51E898; color: #172B4D; }
.tp-badge-preview-chip[data-trello-color="light-gray"] { background: #B3BAC5; color: #172B4D; }

.tp-toast {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--tp-success-bg);
  color: var(--tp-success);
  padding: 6px 12px;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--tp-border);
}

.tp-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tp-build-info {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--tp-border);
  font-size: 12px;
  color: var(--tp-text-muted);
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
}

.tp-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.tp-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.tp-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--tp-surface-subtle);
  color: var(--tp-text-subtle);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px var(--tp-border);
}

.tp-step-body strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.tp-step-body p {
  font-size: 14px;
  color: var(--tp-text-subtle);
}

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

/* Landing page (standalone) */
.tp-landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--tp-bg);
}

.tp-landing-card {
  max-width: 400px;
  width: 100%;
  background: var(--tp-surface);
  border: 1px solid var(--tp-border);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  box-shadow: var(--tp-shadow);
}

.tp-landing-logo {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 16px;
}

.tp-welcome-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.tp-welcome-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
}

.tp-welcome-brand .tp-title {
  margin-bottom: 0;
}

.tp-version-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tp-text-muted);
  margin-bottom: 6px;
}

.tp-version-relative {
  font-size: 18px;
  font-weight: 600;
  color: var(--tp-text);
  margin-bottom: 6px;
}

.tp-version-utc {
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 12px;
  color: var(--tp-text-muted);
}

/* Priority editor — modal iframe (see index.html openPriorityPopup) */
html[data-color-mode]:has(body.tp-page--priority) {
  height: 100%;
  overflow: hidden;
}

body.tp-page--priority {
  background: var(--tp-bg);
  height: 100%;
  min-height: 0;
  color: var(--tp-text);
  overflow-x: hidden;
  overflow-y: auto;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.01em;
  --radius: 12px;
}

.tp-page--priority {
  box-sizing: border-box;
  width: 100%;
  max-width: 880px;
  min-height: auto;
  margin: 0 auto;
  padding: 0;
}

/* Fullscreen without Assistant rail: keep a readable centered column */
.tp-page--priority.is-cerveau-fullscreen:not(.is-split-assistant) {
  max-width: 880px;
  margin: 0 auto;
}

/* Without the Assistant split, let the document scroll normally in the modal. */
body.tp-page--priority.is-cerveau-fullscreen:not(.is-split-assistant) {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Fullscreen split: card form left, Assistant rail right */
body.tp-page--priority.is-split-assistant {
  overflow: hidden;
  height: 100%;
}

.tp-page--priority.is-split-assistant {
  /* Same readable column as collapsed (880) + splitter + default rail (380) */
  max-width: 1265px;
  width: 100%;
  height: 100%;
  margin: 0 auto;
}

.tp-page--priority .cerveau-shell {
  display: block;
  width: 100%;
}

.tp-page--priority.is-split-assistant .compare-page {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  padding: 8px 12px 12px;
  box-sizing: border-box;
  overflow: hidden;
}

.tp-page--priority.is-split-assistant .cerveau-shell {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  height: 100%;
  min-height: 0;
}

.tp-page--priority.is-split-assistant .cerveau-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0; /* required so overflow-y can scroll inside the flex row */
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.tp-page--priority.is-split-assistant .cerveau-splitter {
  flex: 0 0 5px;
  width: 5px;
  align-self: stretch;
  cursor: col-resize;
  touch-action: none;
  position: relative;
  z-index: 4;
  background: transparent;
  transition: background 0.12s ease;
}

.tp-page--priority.is-split-assistant .cerveau-splitter::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  right: -4px;
}

.tp-page--priority.is-split-assistant .cerveau-splitter:hover,
.tp-page--priority.is-split-assistant .cerveau-splitter.is-dragging {
  background: var(--tp-primary, #0c66e4);
}

.tp-page--priority.is-split-assistant .cerveau-splitter[hidden] {
  display: none;
}

.tp-page--priority.is-split-assistant .cerveau-shell.is-resizing,
.tp-page--priority.is-split-assistant .cerveau-shell.is-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.tp-page--priority.is-split-assistant .cerveau-assistant {
  flex: 0 0 380px;
  width: 380px;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tp-page--priority.is-split-assistant .cerveau-assistant[hidden] {
  display: none;
}

.tp-page--priority.is-split-assistant .tp-popup-build-info {
  display: none;
}

@media (max-width: 860px) {
  .tp-page--priority.is-split-assistant .cerveau-shell {
    flex-direction: column;
  }

  .tp-page--priority.is-split-assistant .cerveau-splitter {
    display: none;
  }

  .tp-page--priority.is-split-assistant .cerveau-assistant {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: none !important;
    min-height: min(48vh, 360px);
    max-height: min(55vh, 520px);
  }
}

.tp-priority-card-header {
  flex-shrink: 0;
  text-align: center;
  padding: 0 0 12px;
}

.tp-page--priority .variant-card > .tp-priority-card-header {
  padding: 0 0 8px;
}

.tp-page--priority .variant-overview-section {
  margin: 0 0 8px;
  padding: 0 8px;
}

.tp-page--priority .field--overview {
  padding: 10px 12px;
  border-radius: var(--radius, 12px);
  background: color-mix(in srgb, var(--surface-1, var(--tp-surface-subtle)) 72%, var(--surface-2, var(--tp-surface)));
}

.tp-page--priority .variant-info-section {
  margin: 8px 0 0;
  padding: 0 8px;
}

.tp-page--priority .field--info {
  padding: 10px 12px;
  border-radius: var(--radius, 12px);
  background: color-mix(in srgb, var(--surface-1, var(--tp-surface-subtle)) 72%, var(--surface-2, var(--tp-surface)));
}

/* Dark mode elevation stacking: canvas → card → sections → controls/modals */
html[data-color-mode='dark'] body.tp-page--priority {
  background: var(--tp-elev-0, #0d1117);
}

html[data-color-mode='dark'] .tp-page--priority .variant-card {
  background: color-mix(
    in srgb,
    var(--card-tier-tint, transparent) var(--card-tier-tint-mix, 6%),
    var(--tp-elev-2, #21262d)
  );
}

/* Collapsible section shells stay on Historique’s darker mix
   (surface-1 72% / surface-2) — do not lift them to elev-3. */

html[data-color-mode='dark'] .tp-page--priority.is-split-assistant .cerveau-assistant {
  background: var(--tp-elev-1, #161b22);
}

html[data-color-mode='dark'] .tp-page--priority .info-desc-input,
html[data-color-mode='dark'] .tp-page--priority .info-labels-picker {
  background: var(--tp-elev-3, #2d333b);
}

html[data-color-mode='dark'] .tp-page--priority .help-modal,
html[data-color-mode='dark'] .tp-page--priority .heat-score-tooltip {
  background: var(--tp-elev-4, #3d444d);
}

.tp-page--priority .variant-statut-section {
  margin-top: 8px;
  padding: 0 8px;
}

.tp-page--priority .field--statut {
  padding: 10px 12px;
  border-radius: var(--radius, 12px);
}

.tp-page--priority .field--statut-embedded {
  padding: 0;
}

.tp-page--priority .field--statut-embedded.has-section-glow {
  padding: 4px 10px 10px;
}

.tp-page--priority .field--info .info-row-label {
  color: var(--tp-text-muted, var(--text-muted));
}

.tp-page--priority .info-desc-input {
  background: var(--tp-surface, var(--surface-2));
  border-color: var(--tp-border, var(--border));
  color: var(--tp-text, var(--text-primary));
}

.tp-page--priority .info-member {
  background: var(--tp-surface-subtle, var(--surface-1));
}

.tp-page--priority .info-members-add-btn,
.tp-page--priority .info-labels-add-btn,
.tp-page--priority .info-task-types-add-btn,
.tp-page--priority .info-parent-pick-btn {
  border-color: color-mix(in srgb, var(--tp-text, var(--text-primary)) 22%, transparent);
  color: var(--tp-text-subtle, var(--text-secondary));
  background: var(--tp-surface-subtle, var(--surface-1));
}

.tp-page--priority .info-labels-picker {
  background: var(--tp-surface, var(--surface-1));
  border-color: var(--tp-border, var(--border));
}

.tp-priority-card-name {
  margin: 0;
  min-height: 1.4em;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--tp-text);
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.tp-priority-card-name.is-loading {
  font-weight: 400;
  font-size: 18px;
  color: var(--tp-text-muted);
}

.tp-page--priority .compare-page {
  /* priority-ui.css sets .compare-page { max-width: 420px } — override for editor shell */
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 4px 12px 12px;
  overflow-x: hidden;
  container-type: inline-size;
  container-name: priority-popup;
}

.tp-page--priority .tp-popup-build-info {
  margin: 0 12px 10px;
  padding-top: 10px;
  text-align: center;
}

.tp-page--priority .tp-popup-build-info[hidden] {
  display: none;
}

/* Boot overlay — skeleton silhouette + progress panel over empty mount */
.tp-popup-boot {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 20;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 280px;
  padding: 12px;
  text-align: center;
  opacity: 1;
  background: var(--tp-bg, #f4f5f7);
  transition: opacity 0.34s ease;
}

.tp-page--priority.is-booting,
.tp-page--priority.is-boot-leaving {
  position: relative;
  overflow: hidden;
  /* Match split layout width (form + assistant rail) while the skeleton is up */
  max-width: 1265px;
  width: 100%;
}

/* Collapsed Assistant: skeleton matches single-column form (no rail) */
.tp-page--priority.is-booting.is-boot-assistant-collapsed,
.tp-page--priority.is-boot-leaving.is-boot-assistant-collapsed {
  max-width: 880px;
}

.tp-popup-boot-skel-chat {
  display: none;
}

.tp-page--priority.is-boot-assistant-collapsed .tp-popup-boot-skel-rail {
  display: none;
}

.tp-page--priority.is-boot-assistant-collapsed .tp-popup-boot-skel-main {
  padding-right: 0;
}

.tp-page--priority.is-boot-assistant-collapsed .tp-popup-boot-skel-chat {
  display: flex;
}

.tp-page--priority.is-booting .tp-popup-boot,
.tp-page--priority.is-boot-leaving .tp-popup-boot {
  display: grid;
  grid-template: 1fr / 1fr;
  align-items: stretch;
  justify-items: stretch;
  min-height: max(100%, 480px);
  height: 100%;
  width: 100%;
  padding: 8px 12px 12px;
}

.tp-page--priority.is-boot-leaving .tp-popup-boot,
.tp-popup-boot.is-leaving {
  opacity: 0;
  pointer-events: none;
}

.tp-page--priority.is-booting #popupMain,
.tp-page--priority.is-booting .tp-popup-build-info {
  visibility: hidden;
}

.tp-page--priority.is-boot-leaving #popupMain {
  visibility: visible;
}

.tp-page--priority.is-boot-leaving .tp-popup-build-info {
  visibility: hidden;
}

.tp-popup-boot-skeleton {
  grid-area: 1 / 1;
  position: relative;
  z-index: 0;
  min-height: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  opacity: 0.92;
}

.tp-popup-boot-skel-shell {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 420px;
  padding: 4px 0 8px;
  box-sizing: border-box;
}

.tp-popup-boot-skel-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 8px;
}

.tp-popup-boot-skel-rail {
  flex: 0 0 380px;
  width: 380px;
  max-width: none;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--tp-text, #172b4d) 10%, var(--tp-bg, #f4f5f7));
  box-sizing: border-box;
}

.tp-popup-boot-skel-title {
  width: min(62%, 320px);
  height: 22px;
  border-radius: 8px;
  margin: 4px 8px 2px;
  background: color-mix(in srgb, var(--tp-text, #172b4d) 18%, var(--tp-bg, #f4f5f7));
}

.tp-popup-boot-skel-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 16px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--tp-text, #172b4d) 11%, var(--tp-bg, #f4f5f7));
}

.tp-popup-boot-skel-card.is-compact {
  padding: 12px 14px;
  gap: 8px;
}

.tp-popup-boot-skel-line,
.tp-popup-boot-skel-chip,
.tp-popup-boot-skel-track,
.tp-popup-boot-skel-bubble,
.tp-popup-boot-skel-compose,
.tp-popup-boot-skel-pills span {
  border-radius: 6px;
  background: color-mix(in srgb, var(--tp-text, #172b4d) 20%, var(--tp-bg, #f4f5f7));
  animation: tp-popup-boot-skel-pulse 1.35s ease-in-out infinite;
}

.tp-popup-boot-skel-line {
  height: 10px;
  width: 100%;
}

.tp-popup-boot-skel-line.is-short {
  width: 38%;
}

.tp-popup-boot-skel-line.is-mid {
  width: 68%;
}

.tp-popup-boot-skel-line.is-label {
  width: 28%;
  height: 9px;
  opacity: 0.85;
}

.tp-popup-boot-skel-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tp-popup-boot-skel-chip {
  flex: 0 0 72px;
  width: 72px;
  height: 10px;
}

.tp-popup-boot-skel-track {
  flex: 1 1 auto;
  height: 8px;
  border-radius: 999px;
  opacity: 0.9;
}

.tp-popup-boot-skel-pills {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.tp-popup-boot-skel-pills span {
  width: 52px;
  height: 18px;
  border-radius: 999px;
}

.tp-popup-boot-skel-pills span:nth-child(2) {
  width: 64px;
  animation-delay: 0.12s;
}

.tp-popup-boot-skel-pills span:nth-child(3) {
  width: 44px;
  animation-delay: 0.24s;
}

.tp-popup-boot-skel-bubble {
  height: 56px;
  width: 88%;
  border-radius: 12px;
  animation-delay: 0.08s;
}

.tp-popup-boot-skel-bubble.is-short {
  width: 64%;
  height: 40px;
  align-self: flex-end;
  animation-delay: 0.18s;
}

.tp-popup-boot-skel-compose {
  margin-top: auto;
  height: 36px;
  width: 100%;
  border-radius: 10px;
  animation-delay: 0.28s;
}

.tp-popup-boot-skel-card:nth-child(3) .tp-popup-boot-skel-line,
.tp-popup-boot-skel-card:nth-child(3) .tp-popup-boot-skel-chip,
.tp-popup-boot-skel-card:nth-child(3) .tp-popup-boot-skel-track {
  animation-delay: 0.1s;
}

.tp-popup-boot-skel-card:nth-child(4) .tp-popup-boot-skel-line,
.tp-popup-boot-skel-card:nth-child(4) .tp-popup-boot-skel-pills span {
  animation-delay: 0.18s;
}

@keyframes tp-popup-boot-skel-pulse {
  0%,
  100% {
    opacity: 0.72;
  }
  50% {
    opacity: 1;
  }
}

@media (max-width: 860px) {
  .tp-popup-boot-skel-rail {
    display: none;
  }

  .tp-popup-boot-skel-main {
    padding-right: 0;
  }

  .tp-page--priority.is-booting,
  .tp-page--priority.is-boot-leaving {
    max-width: 880px;
  }
}

.tp-popup-boot-inner {
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
  place-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 320px;
  width: calc(100% - 24px);
  padding: 18px 18px 16px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--tp-surface, #fff) 86%, transparent);
  border: 1px solid color-mix(in srgb, var(--tp-border, #091e4224) 80%, transparent);
  box-shadow: 0 8px 28px color-mix(in srgb, var(--tp-text, #172b4d) 14%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.tp-popup-boot.is-error .tp-popup-boot-skeleton {
  opacity: 0.35;
}

.tp-popup-boot-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--tp-primary);
  font-size: 28px;
  line-height: 1;
}

.tp-popup-boot-spinner .ti {
  display: block;
  animation: tp-popup-boot-spin 0.8s linear infinite;
}

.tp-popup-boot.is-error .tp-popup-boot-spinner,
.tp-page--priority.is-boot-error .tp-popup-boot-spinner {
  color: var(--tp-danger-text);
}

.tp-popup-boot.is-error .tp-popup-boot-spinner .ti,
.tp-page--priority.is-boot-error .tp-popup-boot-spinner .ti {
  animation: none;
}

.tp-popup-boot-msg {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--tp-text-subtle);
  max-width: 28em;
}

.tp-popup-boot.is-error .tp-popup-boot-msg,
.tp-page--priority.is-boot-error .tp-popup-boot-msg {
  color: var(--tp-danger-text);
}

.tp-popup-boot-bar {
  width: 100%;
  max-width: 240px;
  height: 4px;
  border-radius: 999px;
  background: var(--tp-border, rgba(9, 30, 66, 0.12));
  overflow: hidden;
}

.tp-popup-boot-bar-fill {
  height: 100%;
  width: 4%;
  border-radius: inherit;
  background: var(--tp-primary);
  transition: width 0.28s ease;
}

.tp-popup-boot-steps {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  width: 100%;
  max-width: 240px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  text-align: left;
}

.tp-popup-boot-step {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 11px;
  line-height: 1.25;
  color: var(--tp-text-subtle, #8993a4);
  transition: color 0.15s ease;
  opacity: 0.72;
}

.tp-popup-boot-step-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 12px;
  line-height: 1;
}

.tp-popup-boot-step-icon .ti {
  display: block;
}

.tp-popup-boot-step.is-active {
  color: var(--tp-text, #172b4d);
  font-weight: 600;
  opacity: 1;
}

.tp-popup-boot-step.is-active .tp-popup-boot-step-icon {
  color: var(--tp-primary);
}

.tp-popup-boot-step.is-active .tp-popup-boot-step-icon .ti {
  animation: tp-popup-boot-spin 0.8s linear infinite;
}

.tp-popup-boot-step.is-done {
  color: var(--tp-text-subtle, #626f86);
  opacity: 1;
}

.tp-popup-boot-step.is-done .tp-popup-boot-step-icon {
  color: var(--tp-success, #216e4e);
}

.tp-popup-boot-step.is-skipped {
  opacity: 0.45;
}

.tp-popup-boot-step-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes tp-popup-boot-spin {
  to {
    transform: rotate(360deg);
  }
}

.tp-page--priority .compare-grid {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.tp-page--priority .variant-card {
  max-width: none;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0.5rem 4px 0.75rem;
  box-shadow: none;
  border: none;
  overflow-x: hidden;
}

/* Soft surface language — heat, fields, blocked, due, graph share tint shells */
.tp-page--priority .heat-panel {
  padding: 12px;
  border-radius: var(--radius, 12px);
}

.tp-page--priority .heat-head {
  margin-bottom: 16px;
  gap: 10px;
}

.tp-page--priority .heat-badge {
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--radius, 12px);
  grid-template-columns: auto minmax(min-content, 1fr);
  box-shadow: none;
}

.tp-page--priority .heat-tier-desc {
  margin: 0;
  font-size: 15px;
  font-weight: 400;
}

.tp-page--priority .heat-top-label {
  font-size: 14px;
  font-weight: 500;
}

.tp-page--priority .heat-badge-num {
  font-size: 30px;
  font-weight: 500;
}

.tp-page--priority .heat-badge-label {
  font-size: 21px;
  font-weight: 500;
  flex-wrap: wrap;
}

.tp-page--priority .heat-score-info {
  width: 20px;
  height: 20px;
  font-size: 12px;
  font-weight: 500;
}

.tp-page--priority .heat-seg-labels {
  font-size: 12px;
  margin-top: 8px;
}

.tp-page--priority .field-lbl {
  font-size: 15px;
  font-weight: 500;
}

.tp-page--priority .field-lbl .ti {
  font-size: 18px;
}

.tp-page--priority .field-lbl-tooltip {
  font-size: 13px;
  border: none;
}

.tp-page--priority .variant-fields .field-head {
  gap: 8px 12px;
}

.tp-page--priority .field-val {
  font-size: 14px;
  font-weight: 500;
}

.tp-page--priority .variant-fields {
  padding-left: 8px;
  padding-right: 8px;
}

.tp-page--priority .field {
  margin-bottom: 12px;
  gap: 8px;
}

.tp-api-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: var(--tp-surface-subtle);
  color: var(--tp-danger-text);
  font-size: 14px;
  line-height: 1.45;
}

.tp-api-banner code {
  font-size: 13px;
}

.tp-page--priority .variant-blocked-section {
  margin-top: 0;
  padding: 0;
}

.tp-page--priority .variant-blocked-section > .field--en-attente,
.tp-page--priority .variant-blocked-section > .field--en-attente-embedded {
  margin-bottom: 0;
}

.tp-page--priority .statut-blocked-panel {
  border-top-color: color-mix(in srgb, var(--blocked-border, #c9372c) 40%, transparent);
}

.tp-page--priority .variant-due-section {
  margin-top: 8px;
  padding: 0 8px;
}

.tp-page--priority .field--due-date {
  margin-bottom: 0;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius, 12px);
}

.tp-page--priority .field--due-date.is-enabled,
.tp-page--priority .field--due-date.has-due-date,
.tp-page--priority .field--due-date.is-open {
  border: none;
  background: color-mix(in srgb, var(--surface-1, var(--tp-surface-subtle)) 72%, var(--surface-2, var(--tp-surface)));
}

.tp-page--priority .field.has-section-glow {
  background-color: color-mix(
    in srgb,
    var(--surface-1, var(--tp-surface-subtle)) 72%,
    var(--surface-2, var(--tp-surface))
  );
  background-image: radial-gradient(
    ellipse 140% 95% at 50% -5%,
    color-mix(in srgb, var(--section-glow, transparent) 46%, transparent) 0%,
    color-mix(in srgb, var(--section-glow, transparent) 18%, transparent) 42%,
    transparent 72%
  );
  background-repeat: no-repeat;
}

.tp-page--priority .field--due-date[data-due-band] .due-date-countdown-primary {
  color: color-mix(in srgb, var(--section-glow, var(--blocked-text)) 80%, var(--text-primary, var(--tp-text)));
}

.tp-page--priority .field--due-date[data-due-band] .due-date-countdown-secondary {
  color: color-mix(in srgb, var(--section-glow, var(--blocked-muted-text)) 55%, var(--text-muted, var(--tp-text-muted)));
}

.tp-page--priority .field--due-date[data-due-band='overdue'] .due-date-countdown {
  background: var(--due-band-overdue-fill, var(--blocked-fill, #fce8e8));
}

.tp-page--priority .field--due-date[data-due-band='imminent'] .due-date-countdown {
  background: var(--due-band-imminent-fill, #fff1e0);
}

.tp-page--priority .field--due-date[data-due-band='soon'] .due-date-countdown {
  background: var(--due-band-soon-fill, #fff8d6);
}

.tp-page--priority .field--due-date[data-due-band='weeks'] .due-date-countdown {
  background: var(--due-band-weeks-fill, #e3f5e8);
}

.tp-page--priority .field--due-date[data-due-band='month'] .due-date-countdown {
  background: var(--due-band-month-fill, #e6f0fb);
}

.tp-page--priority .field--due-date[data-due-band='far'] .due-date-countdown {
  background: var(--due-band-far-fill, #f0f1f4);
}

.tp-page--priority .due-date-title {
  font-size: 15px;
  font-weight: 600;
}

.tp-page--priority .due-date-mode-btn {
  font-size: 11px;
}

.tp-page--priority .due-date-vague-value {
  font-size: 13px;
}

.tp-page--priority .due-date-desc {
  font-size: 14px;
  font-weight: 400;
}

.tp-page--priority .due-date-countdown {
  font-size: 17px;
  font-weight: 600;
  border: none;
  background: transparent;
  padding: 8px 12px;
  width: 100%;
  align-self: stretch;
  border-radius: 10px;
}

.tp-page--priority .due-date-countdown-primary {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary, var(--tp-text));
}

.tp-page--priority .due-date-countdown-secondary {
  font-size: 13px;
  font-weight: 500;
  color: var(--due-accent, var(--tp-primary, #0c66e4));
}

.tp-page--priority .due-date-body {
  padding-left: 26px;
}

.tp-page--priority .due-date-trigger,
.tp-page--priority .due-date-time-trigger {
  font-size: 15px;
  font-weight: 400;
  border: none;
  padding-top: 10px;
  padding-bottom: 10px;
}

.tp-page--priority .due-date-suggestion {
  font-size: 12px;
  font-weight: 500;
  border: none;
}

.tp-page--priority .due-date-suggestion-label {
  font-size: 12px;
  font-weight: 500;
}

.tp-page--priority .due-date-suggestion-hint {
  font-size: 11px;
  font-weight: 400;
}

.tp-page--priority .due-date-trigger-icon,
.tp-page--priority .due-date-time-icon {
  font-size: 18px;
}

.tp-page--priority .due-date-trigger-title,
.tp-page--priority .due-date-time-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--due-accent, var(--tp-primary, #0c66e4));
}

.tp-page--priority .due-date-trigger-value,
.tp-page--priority .due-date-time-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, var(--tp-text));
}

.tp-page--priority .due-date-picker {
  border: none;
}

.tp-page--priority .due-date-time-popover,
.tp-page--priority .due-date-popover {
  max-width: none;
  width: 100%;
  border: none;
  background: transparent;
  box-shadow: none;
}

.tp-page--priority .due-date-time-chip--period {
  min-height: 32px;
  padding: 4px 6px;
}

.tp-page--priority .due-date-time-chip-label {
  font-size: 14px;
  font-weight: 500;
}

.tp-page--priority .due-date-time-select {
  font-size: 14px;
}

.tp-page--priority .due-date-month-label {
  font-size: 15px;
  font-weight: 500;
}

.tp-page--priority .due-date-month-pick,
.tp-page--priority .due-date-year-pick {
  font-size: 15px;
  font-weight: 500;
}

.tp-page--priority .due-date-month-option,
.tp-page--priority .due-date-year-option {
  font-size: 13px;
  font-weight: 500;
}

.tp-page--priority .due-date-day {
  font-size: 14px;
  font-weight: 500;
}

.tp-page--priority .blocked-reason-input {
  font-size: 15px;
  font-weight: 400;
  border: none;
  padding-top: 8px;
  padding-bottom: 8px;
}

.tp-page--priority .blocked-reason-suggestion {
  font-size: 13px;
  font-weight: 500;
  border: none;
}

.tp-page--priority .blocked-reason-chip {
  font-size: 13px;
  font-weight: 500;
}

.tp-page--priority .blocked-reason-suggestions-label {
  font-size: 12px;
  font-weight: 500;
}

.tp-page--priority .en-attente-title,
.tp-page--priority .section-enable-title,
.tp-page--priority .priority-enable-title {
  font-size: 15px;
  font-weight: 600;
}

.tp-page--priority .en-attente-desc {
  font-size: 14px;
  font-weight: 400;
}

.tp-page--priority .section-enable-checkbox {
  width: 15px;
  height: 15px;
}

.tp-page--priority .variant-fields-section {
  margin-top: 8px;
}

.tp-page--priority .calc-graph-panel {
  margin-top: 12px;
  border: none;
}

.tp-page--priority .calc-graph-panel.is-enabled {
  padding: 10px 12px;
  border: none;
  background: color-mix(in srgb, var(--surface-1, var(--tp-surface-subtle)) 72%, var(--surface-2, var(--tp-surface)));
}

.tp-page--priority .variant-priority-section {
  margin-top: 8px;
  padding: 0 8px;
}

.tp-page--priority .field--priority {
  border: none;
  padding: 10px 12px;
  border-radius: var(--radius, 12px);
}

.tp-page--priority .field--priority.is-enabled {
  border: none;
  background: color-mix(in srgb, var(--surface-1, var(--tp-surface-subtle)) 72%, var(--surface-2, var(--tp-surface)));
}

.tp-page--priority .section-toggle-summary {
  font-size: 13px;
  font-weight: 400;
}

.tp-page--priority .calc-rsm-wrap {
  width: 260px;
  max-width: 260px;
}

.tp-page--priority .help-modal-root {
  z-index: 1000;
  padding: 1.25rem 16px;
}

.tp-page--priority .help-modal {
  max-width: 560px;
  border: none;
}

.tp-page--priority .help-modal-header,
.tp-page--priority .help-modal-content,
.tp-page--priority .help-modal-footer {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.tp-page--priority .help-modal.help-modal--wizard {
  max-width: 680px;
  max-height: 92vh;
  min-height: 480px;
}

.tp-page--priority .help-modal-title {
  font-size: 17px;
  font-weight: 500;
}

.tp-page--priority .help-modal-body {
  font-size: 15px;
}

/* Bridge priority-ui tokens to Trello theme inside the popup */
html[data-color-mode="light"] .tp-page--priority,
html[data-color-mode="dark"] .tp-page--priority {
  --surface-0: var(--tp-bg);
  --surface-1: var(--tp-surface-subtle);
  --surface-2: var(--tp-surface);
  --border: var(--tp-border);
  --text-primary: var(--tp-text);
  --text-secondary: var(--tp-text-subtle);
  --text-muted: var(--tp-text-muted);
  --surface-hover: var(--tp-surface-hover);
  --due-accent: var(--tp-primary);
  --due-accent-text: var(--tp-primary-text);
}

html[data-color-mode="dark"] .tp-page--priority {
  --surface-0: var(--tp-elev-0);
  --surface-1: var(--tp-elev-1);
  --surface-2: var(--tp-elev-2);
}

/* Bridge the same tokens for memory align / board-bar pages */
html[data-color-mode="light"] .memory-page,
html[data-color-mode="dark"] .memory-page {
  --surface-0: var(--tp-bg);
  --surface-1: var(--tp-surface-subtle);
  --surface-2: var(--tp-surface);
  --border: var(--tp-border);
  --text-primary: var(--tp-text);
  --text-secondary: var(--tp-text-subtle);
  --text-muted: var(--tp-text-muted);
  --surface-hover: var(--tp-surface-hover);
}

html[data-color-mode="dark"] .memory-page {
  --surface-0: var(--tp-elev-0);
  --surface-1: var(--tp-elev-1);
  --surface-2: var(--tp-elev-2);
}

/* Completion editor — modal iframe (legacy) + embedded in priority popup */
body.tp-page--completion {
  background: var(--tp-bg);
  color: var(--tp-text);
  max-width: 520px;
  margin: 0 auto;
  padding: 4px 12px 14px;
  --completion-radius: 12px;
  --completion-track-master: 8px;
  --completion-track-item: 4px;
  --completion-thumb-master: 18px;
  --completion-thumb-item: 14px;
}

/* Bridge priority-ui slider tokens inside completion surfaces */
html[data-color-mode="light"] .tp-page--completion,
html[data-color-mode="dark"] .tp-page--completion,
html[data-color-mode="light"] .tp-page--priority .tp-completion,
html[data-color-mode="dark"] .tp-page--priority .tp-completion {
  --surface-0: var(--tp-bg);
  --surface-1: var(--tp-surface-subtle);
  --surface-2: var(--tp-surface);
  --border: var(--tp-border);
  --text-primary: var(--tp-text);
  --text-secondary: var(--tp-text-subtle);
  --text-muted: var(--tp-text-muted);
  --surface-hover: var(--tp-surface-hover);
  --slider-track: var(--tp-surface-subtle);
  --slider-thumb-bg: var(--tp-surface);
  --slider-thumb-border: var(--tp-border-strong);
  --slider-thumb-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  --slider-focus-ring: 0 0 0 3px rgba(12, 102, 228, 0.28);
  --completion-radius: 12px;
  --completion-control-radius: 8px;
  --completion-track-master: 8px;
  --completion-track-item: 4px;
  --completion-thumb-master: 18px;
  --completion-thumb-item: 14px;
}

html[data-color-mode="dark"] .tp-page--completion,
html[data-color-mode="dark"] .tp-page--priority .tp-completion {
  --surface-0: var(--tp-elev-0);
  --surface-1: var(--tp-elev-1);
  --surface-2: var(--tp-elev-2);
  --slider-track: #596773;
  --slider-thumb-bg: #f7f8f9;
  --slider-thumb-border: #8c9bab;
  --slider-thumb-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  --slider-focus-ring: 0 0 0 3px rgba(166, 197, 231, 0.35);
}

.tp-page--completion .tp-completion,
.tp-page--priority .tp-completion {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tp-page--completion .tp-priority-card-header {
  padding: 2px 0 0;
}

.tp-page--completion .tp-heading,
.tp-page--priority .tp-completion .tp-heading {
  margin-bottom: 0;
}

.tp-page--priority .variant-progress-section {
  margin-top: 8px;
  padding: 0 8px;
}

/* Soft enable shell — tint only, stable box (heat-panel vibe) */
.tp-page--priority .field--progress {
  margin-bottom: 0;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius, 12px);
  background: transparent;
  transition: background 0.2s ease;
}

.tp-page--priority .field--progress.is-enabled {
  background: color-mix(in srgb, var(--surface-1, var(--tp-surface-subtle)) 72%, var(--surface-2, var(--tp-surface)));
}

/* Keep progress glow while enabled (is-enabled's background shorthand would clear it). */
.tp-page--priority .field--progress.has-section-glow.is-enabled {
  background-color: color-mix(
    in srgb,
    var(--surface-1, var(--tp-surface-subtle)) 72%,
    var(--surface-2, var(--tp-surface))
  );
  background-image: radial-gradient(
    ellipse 140% 95% at 50% -5%,
    color-mix(in srgb, var(--section-glow, transparent) 46%, transparent) 0%,
    color-mix(in srgb, var(--section-glow, transparent) 18%, transparent) 42%,
    transparent 72%
  );
  background-repeat: no-repeat;
}

/* Stronger wash when all tasks are complete. */
.tp-page--priority .variant-progress-section.is-progress-complete > .field--progress.has-section-glow {
  background-image: radial-gradient(
    ellipse 140% 95% at 50% -5%,
    color-mix(in srgb, var(--section-glow, transparent) 58%, transparent) 0%,
    color-mix(in srgb, var(--section-glow, transparent) 24%, transparent) 45%,
    transparent 74%
  );
}

.tp-page--priority .progress-enable-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, var(--tp-text));
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.tp-page--priority .progress-enable-label:has(.progress-enable-checkbox:focus-visible) {
  outline: none;
  border-radius: 6px;
  box-shadow: 0 0 0 2px var(--surface-2, var(--tp-surface)), 0 0 0 4px var(--tp-primary, #0c66e4);
}

.tp-page--priority .progress-section-body {
  padding-top: 12px;
  padding-left: 26px;
}

.tp-page--priority .progress-section-body:has(.statut-in-progress-mount:not(:empty)) {
  padding-top: 4px;
}

.tp-page--priority .progress-section-body[hidden] {
  display: none;
}

.tp-completion-progress {
  margin: 0;
}

/* Hero — soft accent wash on a slightly darkened pad (lighter than subtasks) */
.tp-completion-progress-panel {
  --completion-hero-accent: var(--tp-border-strong);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 12px;
  border-radius: var(--completion-radius, 12px);
  background: color-mix(
    in srgb,
    var(--completion-hero-accent) 12%,
    color-mix(in srgb, #000 7%, var(--tp-surface-subtle))
  );
  transition: background 0.22s ease, padding 0.18s ease, gap 0.18s ease;
}

.tp-completion-progress-panel.has-progress {
  background: color-mix(
    in srgb,
    var(--completion-hero-accent) 18%,
    color-mix(in srgb, #000 7%, var(--tp-surface-subtle))
  );
}

.tp-completion-progress-panel.is-complete {
  background: color-mix(
    in srgb,
    var(--completion-hero-accent) 22%,
    color-mix(in srgb, #000 7%, var(--tp-surface-subtle))
  );
}

.tp-completion-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
}

.tp-completion-progress-head .tp-completion-master-title {
  flex: 1 1 auto;
  min-width: 0;
}

.tp-completion-progress-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tp-text-muted);
}

.tp-completion-progress-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.tp-completion-complete-all,
.tp-completion-reset-all {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--completion-control-radius, 8px);
  background: transparent;
  color: var(--tp-text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.tp-completion-progress-actions .tp-completion-blocked-btn,
.tp-completion-progress-actions .tp-completion-complete-all,
.tp-completion-progress-actions .tp-completion-reset-all {
  width: 28px;
  height: 28px;
  font-size: 16px;
  line-height: 1;
}

/* Keep Tabler glyphs on the same optical baseline (pause sits high by default).
   Scope to action buttons only — not estimate-chip icons inside the same row. */
.tp-completion-progress-actions > button .ti,
.tp-completion-blocked-btn .ti,
.tp-completion-complete-all .ti,
.tp-completion-reset-all .ti,
.tp-completion-item-complete .ti {
  display: block;
  line-height: 1;
  width: 1em;
  height: 1em;
  margin: 0;
}

.tp-completion-blocked-btn .ti-player-pause {
  transform: translateY(1px);
}

.tp-completion-complete-all:hover {
  background: color-mix(in srgb, var(--tp-success, #216e4e) 12%, transparent);
  color: var(--tp-success, #216e4e);
}

.tp-completion-reset-all:hover {
  background: color-mix(in srgb, var(--tp-danger-text, #ae2e24) 12%, transparent);
  color: var(--tp-danger-text, #ae2e24);
}

.tp-completion-reset-all.is-armed {
  color: var(--tp-danger-text, #ae2e24);
  background: color-mix(in srgb, var(--tp-danger-text, #ae2e24) 10%, transparent);
}

.tp-completion-complete-all:focus,
.tp-completion-reset-all:focus {
  outline: none;
}

.tp-completion-complete-all:focus-visible,
.tp-completion-reset-all:focus-visible {
  box-shadow: 0 0 0 2px var(--tp-surface), 0 0 0 4px var(--tp-focus, #0c66e4);
}

.tp-completion-complete-all:disabled,
.tp-completion-reset-all:disabled {
  opacity: 0.45;
  cursor: default;
}

.tp-completion-complete-all[hidden],
.tp-completion-reset-all[hidden] {
  display: none;
}

.tp-completion-master-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--tp-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input.tp-completion-master-title {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  padding: 2px 6px;
  margin: 0 0 2px -6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--tp-text);
  cursor: text;
  text-overflow: ellipsis;
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

input.tp-completion-master-title::placeholder {
  color: var(--tp-text-muted);
  font-weight: 500;
}

input.tp-completion-master-title:hover:not(:focus):not(.is-saving) {
  background: color-mix(in srgb, var(--tp-text) 5%, transparent);
}

input.tp-completion-master-title:focus {
  outline: none;
  overflow: visible;
  text-overflow: clip;
  border-color: color-mix(in srgb, var(--tp-primary, #0c66e4) 55%, var(--tp-border));
  background: var(--tp-surface-2, var(--surface-2, transparent));
  box-shadow: 0 0 0 3px var(--tp-focus-ring, var(--focus-ring, rgba(12, 102, 228, 0.25)));
}

input.tp-completion-master-title.is-saving {
  opacity: 0.72;
  cursor: progress;
}

input.tp-completion-master-title.is-empty:not(:focus) {
  color: var(--tp-text-muted);
  font-weight: 500;
}

.tp-completion-master-title[hidden] {
  display: none;
}

.tp-completion-percent {
  font-size: 34px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--tp-text);
  line-height: 1;
  letter-spacing: -0.03em;
}

.tp-completion-percent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.tp-estimate-scales-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tp-estimate-ticks-root {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tp-estimate-scale-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tp-estimate-scale-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tp-text-muted);
  padding: 0 2px;
}

/* Wrap is the single pill shell so the clear (×) sits inside the same border. */
.tp-estimate-chip-wrap {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--estimate-accent, var(--tp-border-strong)) 45%, var(--tp-border));
  border-radius: 999px;
  background: color-mix(
    in srgb,
    var(--estimate-accent, var(--tp-text-muted)) 10%,
    var(--tp-surface-2, var(--surface-2, transparent))
  );
  color: var(--tp-text);
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.tp-estimate-chip-wrap:has(.tp-estimate-chip.is-empty) {
  color: var(--tp-text-muted);
  border-style: dashed;
  opacity: 0.72;
}

.tp-estimate-chip-wrap:has(.tp-estimate-chip.is-set) {
  color: var(--estimate-accent, var(--tp-text-muted));
}

.tp-estimate-chip-wrap:has(.tp-estimate-chip.is-estimating) {
  color: color-mix(in srgb, var(--estimate-accent, var(--tp-text-muted)) 70%, var(--tp-text));
}

.tp-estimate-chip-wrap:has(.tp-estimate-chip.is-adjusted) {
  border-color: color-mix(in srgb, var(--estimate-accent, var(--tp-primary, #0c66e4)) 70%, var(--tp-border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--estimate-accent, var(--tp-primary, #0c66e4)) 28%, transparent);
}

.tp-estimate-chip-wrap:has(button.tp-estimate-chip:hover),
.tp-estimate-chip-wrap:has(.tp-estimate-chip-clear:hover) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--estimate-accent, var(--tp-text)) 16%, transparent);
}

.tp-estimate-chip-wrap:has(button.tp-estimate-chip:focus-visible),
.tp-estimate-chip-wrap:has(.tp-estimate-chip-clear:focus-visible) {
  outline: none;
  box-shadow: 0 0 0 3px var(--tp-focus-ring, rgba(12, 102, 228, 0.28));
}

.tp-estimate-chip-wrap.has-clear .tp-estimate-chip {
  padding-right: 4px;
}

.tp-estimate-chip-wrap.is-compact.has-clear .tp-estimate-chip {
  padding-right: 2px;
}

.tp-completion-progress-actions .tp-completion-master-estimate {
  margin-right: 2px;
}

.tp-completion-progress-panel.is-complete .tp-completion-master-estimate,
.tp-completion-master-estimate[hidden] {
  display: none !important;
}

.tp-estimate-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 5px 10px 5px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.2;
  cursor: pointer;
}

button.tp-estimate-chip:hover,
button.tp-estimate-chip:focus-visible {
  outline: none;
}

.tp-estimate-chip.is-empty {
  font-weight: 500;
}

.tp-estimate-chip.is-icon-only {
  padding: 5px 7px;
  gap: 0;
}

.tp-estimate-chip.is-icon-only .tp-estimate-chip-label {
  display: none;
}

.tp-estimate-chip-icon {
  flex: 0 0 auto;
  font-size: 15px;
  line-height: 1;
  color: inherit;
  opacity: 0.95;
  transition: color 0.18s ease, opacity 0.18s ease;
}

.tp-estimate-chip.is-empty .tp-estimate-chip-icon {
  opacity: 0.55;
}

.tp-estimate-chip.is-set .tp-estimate-chip-icon {
  opacity: 1;
}

.tp-estimate-chip.is-estimating .tp-estimate-chip-icon {
  opacity: 0.9;
  animation: tp-estimate-icon-spin 0.85s linear infinite;
}

@keyframes tp-estimate-icon-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.tp-estimate-chip-label {
  white-space: nowrap;
  color: inherit;
}

.tp-estimate-chip-clear {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: auto;
  min-width: 18px;
  min-height: 0;
  margin: 0;
  padding: 0 8px 0 2px;
  border: 0;
  /* Match the wrap’s right capsule edge so hover fill stays round. */
  border-radius: 0 999px 999px 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
  transition:
    opacity 0.12s ease,
    background-color 0.12s ease,
    color 0.12s ease;
}

.tp-estimate-chip-clear .ti {
  font-size: 11px;
  line-height: 1;
}

.tp-estimate-chip-clear:hover,
.tp-estimate-chip-clear:focus-visible {
  opacity: 0.95;
  background: color-mix(in srgb, currentColor 10%, transparent);
  outline: none;
}

.tp-estimate-chip-wrap.is-compact .tp-estimate-chip {
  padding: 3px 8px 3px 6px;
  font-size: 12px;
  gap: 5px;
}

.tp-estimate-chip-wrap.is-compact .tp-estimate-chip.is-icon-only {
  padding: 3px 5px;
  gap: 0;
}

.tp-estimate-chip-wrap.is-compact .tp-estimate-chip-icon {
  font-size: 13px;
}

.tp-estimate-chip-wrap.is-compact .tp-estimate-chip-clear {
  min-width: 16px;
  padding: 0 6px 0 1px;
}

.tp-estimate-chip-wrap.is-compact .tp-estimate-chip-clear .ti {
  font-size: 10px;
}

span.tp-estimate-chip {
  cursor: default;
}

.tp-estimate-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  min-width: 196px;
  padding: 8px;
  border: 1px solid var(--tp-border);
  border-radius: 12px;
  background: var(--tp-surface-1, var(--surface-1, #fff));
  box-shadow:
    0 10px 28px color-mix(in srgb, var(--tp-text) 14%, transparent),
    0 1px 0 color-mix(in srgb, var(--tp-text) 6%, transparent);
  animation: tp-estimate-pop 0.16s ease;
}

/* Viewport-clamped placement (set by JS) — escapes overflow:hidden ancestors. */
.tp-estimate-popover.is-fixed {
  position: fixed;
  right: auto;
  bottom: auto;
}

.tp-estimate-popover[hidden] {
  display: none !important;
}

@keyframes tp-estimate-pop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.tp-estimate-ticks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.tp-estimate-popover.is-scale-time .tp-estimate-ticks,
.tp-estimate-scale-section[data-estimate-scale='time'] .tp-estimate-ticks {
  grid-template-columns: 1fr;
}

.tp-estimate-popover.is-scale-time {
  min-width: 220px;
}

.tp-estimate-tick {
  --tick-color: var(--tp-text-muted, #6b778c);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--tick-color) 28%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--tick-color) 10%, transparent);
  color: color-mix(in srgb, var(--tick-color) 42%, var(--tp-text));
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease,
    opacity 0.12s ease;
}

.tp-estimate-tick-icon {
  flex: 0 0 auto;
  font-size: 15px;
  line-height: 1;
  color: var(--tick-color);
  opacity: 0.55;
}

.tp-estimate-tick-label {
  min-width: 0;
  flex: 1 1 auto;
}

.tp-estimate-tick:hover,
.tp-estimate-tick:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--tick-color) 18%, transparent);
  border-color: color-mix(in srgb, var(--tick-color) 48%, var(--tp-border));
  color: color-mix(in srgb, var(--tick-color) 28%, var(--tp-text));
}

.tp-estimate-tick:hover .tp-estimate-tick-icon,
.tp-estimate-tick:focus-visible .tp-estimate-tick-icon {
  opacity: 0.85;
}

.tp-estimate-tick.is-selected {
  background: color-mix(in srgb, var(--tick-color) 22%, transparent);
  border-color: color-mix(in srgb, var(--tick-color) 62%, var(--tp-border));
  color: color-mix(in srgb, var(--tick-color) 18%, var(--tp-text));
  font-weight: 700;
}

.tp-estimate-tick.is-selected .tp-estimate-tick-icon {
  opacity: 1;
}

.tp-estimate-popover.is-scale-discrete .tp-estimate-ticks {
  grid-template-columns: repeat(auto-fit, minmax(4.5rem, 1fr));
}

.tp-estimate-free {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--tp-border);
}

.tp-estimate-free-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 5px 8px;
  font-size: 12px;
}

.tp-estimate-free-apply {
  flex: 0 0 auto;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--tp-border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--tp-text) 5%, transparent);
  color: var(--tp-text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.tp-estimate-free-apply:hover {
  background: color-mix(in srgb, var(--tp-text) 10%, transparent);
}

.tp-completion-link-meta .tp-estimate-chip-wrap {
  margin-left: auto;
}

.tp-completion-encouragement-bubble {
  position: fixed;
  z-index: 10050;
  left: 0;
  top: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(220px, calc(100vw - 24px));
  padding: 7px 11px 8px;
  border: 1px solid var(--tp-border-strong, var(--tp-border));
  border-radius: 14px 14px 14px 4px;
  background: var(--tp-surface, #fff);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 8px 20px rgba(0, 0, 0, 0.12);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--tp-text-muted);
  pointer-events: none;
  transform: translate(0, -100%);
  transition: color 0.15s ease, opacity 0.12s ease;
}

html[data-color-mode='dark'] .tp-completion-encouragement-bubble {
  background: var(--tp-surface, #21262d);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.25),
    0 10px 24px rgba(0, 0, 0, 0.35);
}

.tp-completion-encouragement-bubble[hidden] {
  display: none !important;
}

.tp-completion-encouragement-bubble::after {
  content: '';
  position: absolute;
  left: 14px;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: inherit;
  border-right: 1px solid var(--tp-border-strong, var(--tp-border));
  border-bottom: 1px solid var(--tp-border-strong, var(--tp-border));
  transform: rotate(45deg);
  box-sizing: border-box;
}

.tp-completion-encouragement-bubble .tp-completion-stage-icon {
  width: 1.55em;
  height: 1.55em;
  font-size: 0.95em;
  border-width: 1.5px;
}

.tp-completion-encouragement-bubble .tp-completion-stage-icon .ti {
  font-size: 0.72em;
}

.tp-completion-encouragement-bubble.is-complete {
  font-weight: 600;
}

.tp-completion-stage-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4em;
  height: 1.4em;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  color: inherit;
  box-sizing: border-box;
}

.tp-completion-stage-icon .ti {
  font-size: 0.72em;
  line-height: 1;
}

.tp-completion-stage-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
}

.tp-completion-stage-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.tp-completion-stage-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tp-completion-encouragement-bubble[data-tone='idle'] {
  color: color-mix(in srgb, var(--tp-text-muted) 88%, #9aa3af);
}

.tp-completion-encouragement-bubble[data-tone='active'] {
  color: #b8892d;
}

html[data-color-mode='dark'] .tp-completion-encouragement-bubble[data-tone='active'] {
  color: #d4a94a;
}

.tp-completion-encouragement-bubble[data-tone='near'] {
  color: color-mix(in srgb, var(--tp-success) 72%, #6f9f3a);
}

.tp-completion-encouragement-bubble[data-tone='done'] {
  color: var(--tp-success);
}

.tp-completion-list-section {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tp-completion-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.tp-completion-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}

.tp-completion-tools[hidden] {
  display: none;
}

.tp-completion-select-all-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0;
  cursor: pointer;
  user-select: none;
  flex: 0 0 auto;
}

.tp-completion-select-all-label:has(input:disabled) {
  opacity: 0.7;
  cursor: not-allowed;
}

.tp-completion-select-box {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  flex: 0 0 auto;
  justify-self: center;
  accent-color: var(--tp-primary, #0c66e4);
}

.tp-completion-bulk {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 4px 6px;
  border-radius: var(--completion-radius, 10px);
  background: var(--tp-surface-subtle, #f1f2f4);
  border: 1px solid var(--tp-border, #091e4224);
  min-height: 36px;
  box-sizing: border-box;
}

.tp-completion-bulk.is-idle {
  opacity: 0.55;
}

.tp-completion-bulk.is-idle .tp-completion-bulk-count {
  color: var(--tp-text-muted, #626f86);
  font-weight: 500;
}

.tp-completion-bulk-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 28px;
  padding: 0 4px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--tp-text, #172b4d);
  margin-right: 2px;
}

.tp-completion-bulk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  flex: 0 0 auto;
}

.tp-completion-bulk-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.tp-completion-bulk-btn .ti {
  font-size: 16px;
  line-height: 1;
}

.tp-completion-bulk-btn--danger {
  color: var(--tp-danger-text, #ae2e24);
  border-color: color-mix(in srgb, var(--tp-danger-text, #ae2e24) 45%, transparent);
}

.tp-completion-bulk-btn--danger:disabled {
  color: var(--tp-text-muted, #626f86);
  border-color: var(--tp-border, #091e4224);
}

.tp-completion-item.is-selected {
  outline: 2px solid color-mix(in srgb, var(--tp-primary, #0c66e4) 55%, transparent);
  outline-offset: 1px;
  background: color-mix(in srgb, var(--tp-primary, #0c66e4) 8%, var(--tp-surface-subtle));
}

html[data-color-mode="dark"] .tp-completion-item.is-selected {
  background: color-mix(in srgb, var(--tp-primary, #579dff) 14%, var(--tp-elev-0, #0d1117));
}

.tp-completion-search {
  flex: 1 1 auto;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.tp-completion-filter {
  flex: 0 0 auto;
  width: auto;
  max-width: 8.5rem;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
}

.tp-completion-filter-empty {
  margin: 0;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--tp-text-muted);
}

.tp-completion-filter-empty[hidden] {
  display: none;
}

.tp-completion-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

/* Subtask rows — recessed well so each item reads as its own layer */
.tp-completion-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px;
  border-radius: var(--completion-radius, 12px);
  background: color-mix(in srgb, #000 12%, var(--tp-surface-subtle));
  transition: background 0.15s ease;
  position: relative;
}

.tp-completion-promote {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--tp-text-muted);
  cursor: pointer;
}

.tp-completion-promote:hover {
  color: var(--tp-text);
  background: color-mix(in srgb, #000 8%, transparent);
}

.tp-completion-promote.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

.tp-completion-checklist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 6px;
  padding: 6px 0 2px;
  border-top: 1px solid color-mix(in srgb, var(--tp-border) 70%, transparent);
}

.tp-completion-checklist:not(:has(.tp-completion-checklist-item)):not(:has(.tp-completion-checklist-add.is-open)) {
  display: none;
}

.tp-completion-checklist-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
}

.tp-completion-checklist-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  background: color-mix(in srgb, #000 6%, var(--tp-surface-subtle));
}

.tp-completion-item--depth2 {
  margin-left: 0;
}

.tp-completion-checklist-details-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--tp-text-muted);
  cursor: pointer;
}

.tp-completion-checklist-details-btn.is-open,
.tp-completion-checklist-details-btn:hover {
  color: var(--tp-text);
  background: color-mix(in srgb, #000 8%, transparent);
}

.tp-completion-checklist-details-btn.is-open .ti {
  transform: rotate(180deg);
}

.tp-completion-checklist-details {
  padding-left: 4px;
}

.tp-completion-checklist-add {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.tp-completion-checklist-add:not(.is-open) {
  display: none;
}

.tp-completion-checklist-add-input {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
}

.tp-completion-checklist-add-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--tp-text-muted);
  cursor: pointer;
}

.tp-completion-checklist-add-btn:hover,
.tp-completion-checklist-add-btn[aria-expanded='true'] {
  color: var(--tp-text);
  background: color-mix(in srgb, #000 8%, transparent);
}

.tp-completion-item--nested {
  margin-left: 14px;
  padding: 8px 10px;
  background: color-mix(in srgb, #000 8%, var(--tp-surface-subtle));
}

.tp-completion-item.is-linked {
  background: color-mix(in srgb, var(--tp-focus, #0c66e4) 8%, var(--tp-surface-subtle));
}

.tp-completion-item.is-cycle {
  opacity: 0.85;
}

.tp-completion-item:hover {
  background: color-mix(in srgb, #000 16%, var(--tp-surface-subtle));
}

.tp-completion-item.is-linked:hover {
  background: color-mix(in srgb, var(--tp-focus, #0c66e4) 12%, var(--tp-surface-subtle));
}

html[data-color-mode="dark"] .tp-completion-item {
  background: color-mix(in srgb, var(--tp-elev-0, #0d1117) 55%, var(--tp-surface-subtle));
}

html[data-color-mode="dark"] .tp-completion-item:hover {
  background: color-mix(in srgb, var(--tp-elev-0, #0d1117) 35%, var(--tp-surface-subtle));
}

html[data-color-mode="dark"] .tp-completion-item.is-linked {
  background: color-mix(in srgb, var(--tp-focus, #579dff) 14%, var(--tp-elev-0, #0d1117));
}

html[data-color-mode="dark"] .tp-completion-item--nested {
  background: color-mix(in srgb, var(--tp-elev-0, #0d1117) 70%, var(--tp-surface-subtle));
}

.tp-completion-item.is-flipping {
  position: relative;
  pointer-events: none;
}

.tp-completion-item-main {
  display: grid;
  /* select | check | title | details | estimate | blocked | complete | + | delete */
  grid-template-columns: 18px 28px minmax(0, 1fr) 26px auto 28px 28px 28px 28px;
  align-items: center;
  gap: 6px;
}

.tp-completion-item-main:has(.tp-completion-promote) {
  grid-template-columns: 18px 28px minmax(0, 1fr) 26px auto 28px 28px 28px 28px 28px;
}

.tp-completion-checklist-main {
  grid-template-columns: 18px 28px minmax(0, 1fr) 26px auto 28px;
}

.tp-completion-item.is-linked .tp-completion-item-main {
  grid-template-columns: 18px 28px minmax(0, 1fr) 28px 28px;
}

.tp-completion-item--nested .tp-completion-item-main {
  grid-template-columns: 28px minmax(0, 1fr) auto;
}

.tp-completion-item-main:has(.tp-completion-spell-spinner) {
  grid-template-columns: 18px 28px minmax(0, 1fr) 22px 26px auto 28px 28px 28px 28px;
}

.tp-completion-item-main:has(.tp-completion-spell-spinner):has(.tp-completion-promote) {
  grid-template-columns: 18px 28px minmax(0, 1fr) 22px 26px auto 28px 28px 28px 28px 28px;
}

.tp-completion-item.is-linked .tp-completion-item-main:has(.tp-completion-spell-spinner) {
  grid-template-columns: 18px 28px minmax(0, 1fr) 22px 28px 28px;
}

.tp-completion-item-main .tp-completion-item-estimate {
  justify-self: end;
}

.tp-completion-blocked-btn,
.tp-completion-item-complete {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--completion-control-radius, 8px);
  background: transparent;
  color: var(--tp-text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.tp-completion-blocked-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--blocked-accent, #ae2e24) 12%, transparent);
  color: var(--blocked-accent, #ae2e24);
}

.tp-completion-blocked-btn.is-blocked {
  color: var(--blocked-accent, #ae2e24);
  background: color-mix(in srgb, var(--blocked-accent, #ae2e24) 14%, transparent);
}

.tp-completion-blocked-btn:focus {
  outline: none;
}

.tp-completion-blocked-btn:focus-visible {
  box-shadow: 0 0 0 2px var(--tp-surface), 0 0 0 4px var(--blocked-accent, #ae2e24);
}

.tp-completion-blocked-btn:disabled,
.tp-completion-item-complete:disabled {
  opacity: 0.35;
  cursor: default;
}

.tp-completion-item-complete:hover:not(:disabled) {
  background: color-mix(in srgb, var(--tp-success, #216e4e) 12%, transparent);
  color: var(--tp-success, #216e4e);
}

.tp-completion-item-complete.is-complete {
  color: var(--tp-success, #216e4e);
  background: color-mix(in srgb, var(--tp-success, #216e4e) 10%, transparent);
}

.tp-completion-item-complete:focus {
  outline: none;
}

.tp-completion-item-complete:focus-visible {
  box-shadow: 0 0 0 2px var(--tp-surface), 0 0 0 4px var(--tp-focus, #0c66e4);
}

.tp-completion-progress-slider.is-blocked,
.tp-completion-item-slider.is-blocked {
  --completion-fill: color-mix(in srgb, var(--tp-text-muted) 35%, var(--tp-border));
  --completion-accent: color-mix(in srgb, var(--tp-text-muted) 45%, var(--tp-border));
  --completion-track: color-mix(in srgb, var(--tp-border) 55%, var(--tp-surface-subtle));
  opacity: 0.72;
}

.tp-completion-item.is-blocked {
  border-color: color-mix(in srgb, var(--blocked-accent, #ae2e24) 35%, var(--tp-border, #dcdfe4));
  background: color-mix(in srgb, var(--blocked-fill, #fce8e8) 55%, transparent);
}

.tp-completion-item-motif,
.tp-completion-master-motif {
  margin: 4px 0 0;
  padding: 0 2px;
}

.tp-completion-item-motif .field--en-attente-embedded,
.tp-completion-master-motif .field--en-attente-embedded {
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--blocked-fill, #fce8e8) 40%, transparent);
  border: 1px solid color-mix(in srgb, var(--blocked-accent, #ae2e24) 18%, transparent);
}

.tp-completion-master-check-wrap {
  flex: none;
  display: inline-flex;
  align-items: center;
}

.tp-completion-master-check {
  --completion-check-size: 28px;
}

.tp-completion-progress-panel.is-master-blocked {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blocked-accent, #ae2e24) 35%, transparent);
}

.tp-completion.has-blocked .tp-completion-progress-panel:not(.is-complete) {
  --completion-hero-accent: var(--blocked-accent, #ae2e24);
}

.tp-completion-text-link {
  appearance: none;
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 4px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--tp-focus, #0c66e4);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--tp-focus, #0c66e4) 35%, transparent);
  text-underline-offset: 2px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-completion-text-link:hover {
  background: color-mix(in srgb, var(--tp-focus, #0c66e4) 8%, transparent);
  text-decoration-color: var(--tp-focus, #0c66e4);
}

.tp-completion-text-link:focus {
  outline: none;
}

.tp-completion-text-link:focus-visible {
  box-shadow: 0 0 0 2px var(--tp-surface), 0 0 0 4px var(--tp-focus, #0c66e4);
}

.tp-completion-text--readonly {
  display: block;
  min-width: 0;
  padding: 4px 6px;
  font-size: 14px;
  color: var(--tp-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-completion-link-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px 0 34px;
  font-size: 12px;
}

.tp-completion-link-hint {
  color: var(--tp-text-muted);
}

.tp-completion-link-pct,
.tp-completion-nested-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13px;
}

.tp-completion-cycle-hint {
  margin: 0;
  padding: 0 2px 0 34px;
  font-size: 11px;
  color: var(--tp-text-muted);
  font-style: italic;
}

.tp-completion-field-head {
  display: grid;
  grid-template-columns: 4.75rem minmax(0, 1fr) 3rem;
  align-items: center;
  gap: 8px 10px;
}

/* slider | % (check on title row; + sits right of Terminer checkmark) */
.tp-completion-item-slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.75rem;
  align-items: center;
  gap: 8px 10px;
}

/* Nested checklist details: slider | % (estimate lives on the title row). */
.tp-completion-checklist-details .tp-completion-item-slider-row {
  grid-template-columns: minmax(0, 1fr) 2.75rem;
}

.tp-completion-item-slider-row .field-slider,
.tp-completion-field-head .field-slider {
  display: flex;
  align-items: center;
}

.tp-completion-field-head .field-slider {
  min-height: var(--completion-thumb-master, 18px);
}

.tp-completion-item-slider-row .field-slider {
  min-height: var(--completion-thumb-item, 14px);
}

.tp-completion-progress-slider,
.tp-completion-item-slider {
  --completion-track: color-mix(in srgb, var(--tp-border) 40%, var(--tp-surface-subtle));
  --completion-track-h: var(--completion-track-master, 8px);
  --completion-thumb-size: var(--completion-thumb-master, 18px);
  accent-color: var(--completion-accent, var(--tp-primary));
  background: transparent;
  height: var(--completion-thumb-size);
  border-radius: 0;
}

.tp-completion-item-slider {
  --completion-track-h: var(--completion-track-item, 4px);
  --completion-thumb-size: var(--completion-thumb-item, 14px);
}

.tp-completion-progress-slider::-webkit-slider-runnable-track,
.tp-completion-item-slider::-webkit-slider-runnable-track {
  /* Match thumb height so the whole control is clickable (WebKit: a short track +
     thumb margin-top only lets the handle receive pointer hits). */
  height: var(--completion-thumb-size);
  border-radius: calc(var(--completion-track-h) / 2);
  cursor: pointer;
  /* No background transition — animating the gradient stop lag the thumb while dragging. */
  background: linear-gradient(
    to right,
    var(--completion-fill, var(--tp-primary)) 0%,
    var(--completion-fill, var(--tp-primary)) var(--completion-pct, 0%),
    var(--completion-track) var(--completion-pct, 0%),
    var(--completion-track) 100%
  );
  background-size: 100% var(--completion-track-h);
  background-repeat: no-repeat;
  background-position: center;
}

.tp-completion-progress-slider::-webkit-slider-thumb,
.tp-completion-item-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--completion-thumb-size);
  height: var(--completion-thumb-size);
  margin-top: 0;
  border-radius: 50%;
  background: var(--slider-thumb-bg);
  border: 1.5px solid var(--completion-fill, var(--slider-thumb-border));
  box-shadow: var(--slider-thumb-shadow);
  cursor: pointer;
}

.tp-completion-progress-slider:focus {
  outline: none;
}

.tp-completion-progress-slider:focus-visible::-webkit-slider-thumb,
.tp-completion-item-slider:focus-visible::-webkit-slider-thumb {
  box-shadow: var(--slider-thumb-shadow), var(--slider-focus-ring);
}

.tp-completion-progress-slider::-moz-range-track,
.tp-completion-item-slider::-moz-range-track {
  height: var(--completion-track-h);
  border-radius: calc(var(--completion-track-h) / 2);
  background: var(--completion-track);
  cursor: pointer;
}

.tp-completion-progress-slider::-moz-range-progress,
.tp-completion-item-slider::-moz-range-progress {
  height: var(--completion-track-h);
  border-radius: calc(var(--completion-track-h) / 2) 0 0 calc(var(--completion-track-h) / 2);
  /* Instant fill/color so ramp + 100% snap stay locked to the handle. */
  background: var(--completion-fill, var(--tp-primary));
}

.tp-completion-progress-slider::-moz-range-thumb,
.tp-completion-item-slider::-moz-range-thumb {
  width: var(--completion-thumb-size);
  height: var(--completion-thumb-size);
  border-radius: 50%;
  background: var(--slider-thumb-bg);
  border: 1.5px solid var(--completion-fill, var(--slider-thumb-border));
  box-shadow: var(--slider-thumb-shadow);
  cursor: pointer;
}

.tp-completion-progress-slider:focus-visible::-moz-range-thumb,
.tp-completion-item-slider:focus-visible::-moz-range-thumb {
  box-shadow: var(--slider-thumb-shadow), var(--slider-focus-ring);
}

.tp-completion-master-slider {
  margin-top: 2px;
}

.tp-completion-master-slider .tp-completion-field-lbl {
  display: none;
}

/* check | slider | % */
.tp-completion-master-slider .tp-completion-field-head {
  grid-template-columns: 28px minmax(0, 1fr) 2.75rem;
}

.tp-completion-field-lbl {
  font-size: 13px;
  font-weight: 500;
  color: var(--tp-text-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-completion-field-val,
.tp-completion-item-val {
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--tp-text);
  text-align: right;
}

.tp-completion-item.is-done .tp-completion-text {
  text-decoration: line-through;
  color: var(--tp-text-muted);
}

/* Completed items are always 100% — hide redundant slider/%; check stays on the title row. */
.tp-completion-item.is-done .tp-completion-item-slider-row {
  display: none;
}

.tp-completion-check-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: 0 0 auto;
}

/* Preview checkmark on wrap hover (unchecked only). */
.tp-completion-check-wrap:hover .tp-completion-check:not(.is-checked) {
  border-color: var(--completion-check-fill);
  background: color-mix(in srgb, var(--completion-check-fill) 8%, transparent);
  color: var(--completion-check-fill);
}

.tp-completion-check-wrap:hover .tp-completion-check:not(.is-checked) .tp-completion-check-icon {
  opacity: 0.45;
}

.tp-completion-fader-hud {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  z-index: 5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  color: var(--tp-text, #172b4d);
  background: var(--tp-surface, #fff);
  border: 1px solid color-mix(in srgb, var(--tp-border, #dfe1e6) 80%, transparent);
  box-shadow: 0 2px 8px color-mix(in srgb, #000 12%, transparent);
}

.tp-completion-fader-hud[hidden] {
  display: none !important;
}

.tp-completion-check {
  --completion-check-size: 22px;
  --completion-check-green: #2a9b82;
  --completion-check-fill: var(--completion-check-green);
  --completion-progress: 0;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  width: var(--completion-check-size);
  height: var(--completion-check-size);
  padding: 0;
  border: 1.5px solid color-mix(in srgb, var(--tp-border-strong) 55%, var(--tp-text-muted));
  border-radius: 50%;
  background: transparent;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}

/* Clock-style pie: CSS conic 0deg is 12 o'clock; fills clockwise. */
.tp-completion-check::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    var(--completion-check-fill) calc(var(--completion-progress) * 1%),
    transparent 0
  );
  pointer-events: none;
  transition: background 0.15s ease;
}

.tp-completion-check:hover {
  border-color: var(--completion-check-fill);
  background: color-mix(in srgb, var(--completion-check-fill) 8%, transparent);
}

.tp-completion-check.has-progress {
  border-color: var(--completion-check-fill);
}

.tp-completion-check:focus {
  outline: none;
}

.tp-completion-check:focus-visible {
  outline: none;
  box-shadow: var(--slider-focus-ring, 0 0 0 3px rgba(12, 102, 228, 0.28));
}

.tp-completion-check.is-checked {
  background: var(--completion-check-fill);
  border-color: var(--completion-check-fill);
  color: #fff;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--completion-check-fill) 35%, transparent);
}

.tp-completion-check.is-checked::before {
  background: transparent;
}

.tp-completion-check.is-checked:hover {
  background: color-mix(in srgb, var(--completion-check-fill) 88%, #000);
  border-color: color-mix(in srgb, var(--completion-check-fill) 88%, #000);
  color: #fff;
}

.tp-completion-check:active {
  transform: scale(0.94);
}

.tp-completion-check.is-fading,
.tp-completion-item-complete.is-fading {
  cursor: ns-resize;
  transform: scale(1.12);
  z-index: 2;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--completion-check-fill, #2a9b82) 28%, transparent);
}

.tp-completion-check.is-fading {
  overflow: visible;
}

.tp-completion-check.is-fading:active,
.tp-completion-item-complete.is-fading:active {
  transform: scale(1.12);
}

.tp-completion-check-icon {
  position: relative;
  z-index: 1;
  display: block;
  flex: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.tp-completion-check.is-checked .tp-completion-check-icon {
  opacity: 1;
}

.tp-completion-check.is-pop {
  animation: tp-completion-check-pop 0.45s cubic-bezier(0.2, 1.35, 0.4, 1);
}

@keyframes tp-completion-check-pop {
  0% { transform: scale(0.88); }
  55% { transform: scale(1.14); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .tp-completion-check.is-pop {
    animation: none;
  }
}

.tp-completion-check.is-blocked:not(.is-checked) {
  --completion-check-fill: var(--blocked-accent, #ae2e24);
  border-color: var(--blocked-accent, #ae2e24);
  color: var(--blocked-accent, #ae2e24);
  background: color-mix(in srgb, var(--blocked-accent, #ae2e24) 10%, transparent);
}

.tp-completion-check.is-blocked:not(.is-checked) .tp-completion-check-icon {
  opacity: 1;
}

/* Progress pie uses the same red as the II bars — switch to white so pause pops. */
.tp-completion-check.is-blocked.has-progress:not(.is-checked) {
  background: transparent;
  color: #fff;
}

.tp-completion-check.is-blocked.has-progress:not(.is-checked) .tp-completion-pause-icon {
  filter:
    drop-shadow(0 0 1px color-mix(in srgb, var(--blocked-accent, #ae2e24) 70%, #000))
    drop-shadow(0 0 0.5px rgba(0, 0, 0, 0.55));
}

.tp-completion-check-wrap:hover .tp-completion-check.is-blocked.has-progress:not(.is-checked),
.tp-completion-check.is-blocked.has-progress:not(.is-checked):hover {
  color: #fff;
  background: transparent;
}

.tp-completion-done-section {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 2px;
  transition: opacity 0.2s ease;
}

.tp-completion-done-section.is-empty {
  display: none;
}

/* Afficher les tâches terminées — quiet checkbox row */
.tp-completion-show-done {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 6px 8px;
  border-radius: var(--completion-control-radius, 8px);
  color: var(--tp-text-subtle);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.tp-completion-show-done[hidden] {
  display: none;
}

.tp-completion-show-done:hover {
  background: color-mix(in srgb, var(--tp-surface-subtle) 90%, transparent);
  color: var(--tp-text);
}

.tp-completion-show-done:has(.tp-completion-show-done-checkbox:focus-visible) {
  box-shadow: var(--slider-focus-ring, 0 0 0 3px rgba(12, 102, 228, 0.28));
}

.tp-completion-show-done-checkbox {
  width: 14px;
  height: 14px;
  margin: 0;
  flex: none;
  accent-color: var(--tp-primary, #0c66e4);
  cursor: pointer;
}

.tp-completion-show-done-checkbox:disabled {
  cursor: default;
}

.tp-completion-show-done-text {
  min-width: 0;
  line-height: 1.3;
}

.tp-completion-done-list {
  margin: 0;
}

/* Author display:flex on .tp-completion-list overrides UA [hidden] otherwise */
.tp-completion-done-list[hidden] {
  display: none;
}

.tp-completion-done-section:not(.is-showing) .tp-completion-done-list {
  display: none;
}

.tp-completion-done-list .tp-completion-item {
  opacity: 0.88;
}

html[data-color-mode="dark"] .tp-completion-check {
  --completion-check-green: #5dd4b1;
  --completion-check-fill: var(--completion-check-green);
  border-color: color-mix(in srgb, var(--tp-border-strong) 55%, var(--tp-text-muted));
  background: transparent;
  color: transparent;
}

html[data-color-mode="dark"] .tp-completion-check-wrap:hover .tp-completion-check:not(.is-checked),
html[data-color-mode="dark"] .tp-completion-check:hover:not(.is-checked) {
  border-color: var(--completion-check-fill);
  background: color-mix(in srgb, var(--completion-check-fill) 12%, transparent);
  color: var(--completion-check-fill);
}

html[data-color-mode="dark"] .tp-completion-check-wrap:hover .tp-completion-check.is-blocked.has-progress:not(.is-checked),
html[data-color-mode="dark"] .tp-completion-check.is-blocked.has-progress:not(.is-checked):hover {
  color: #fff;
  background: transparent;
}

html[data-color-mode="dark"] .tp-completion-check.is-checked,
html[data-color-mode="dark"] .tp-completion-check.is-checked:hover {
  background: var(--completion-check-fill);
  border-color: var(--completion-check-fill);
  color: #fff;
}

html[data-color-mode="dark"] .tp-completion-check.is-checked::before {
  background: transparent;
}

html[data-color-mode="dark"] .tp-completion-check.is-checked:hover {
  background: color-mix(in srgb, var(--completion-check-fill) 88%, #fff);
  border-color: color-mix(in srgb, var(--completion-check-fill) 88%, #fff);
}

/* Soft inputs inside completion — kill 2px gray cages from .tp-input */
.tp-completion .tp-input,
.tp-completion-add-input,
.tp-completion-text {
  border: 1.5px solid transparent;
  border-radius: var(--completion-control-radius, 8px);
  background: color-mix(in srgb, var(--tp-surface-subtle) 85%, var(--tp-input-bg, var(--tp-surface)));
  transition: background 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.tp-completion .tp-input:hover,
.tp-completion-add-input:hover,
.tp-completion-text:hover {
  background: var(--tp-surface-hover, var(--tp-surface-subtle));
}

.tp-completion .tp-input:focus,
.tp-completion-add-input:focus,
.tp-completion-text:focus {
  outline: none;
  border-color: transparent;
}

.tp-completion .tp-input:focus-visible,
.tp-completion-add-input:focus-visible,
.tp-completion-text:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--tp-primary) 55%, transparent);
  background: var(--tp-surface, var(--tp-input-bg));
  box-shadow: var(--slider-focus-ring, 0 0 0 3px rgba(12, 102, 228, 0.28));
}

.tp-completion-text {
  min-width: 0;
  padding: 6px 10px;
  font-size: 14px;
}

.tp-completion-text.is-spellchecking {
  opacity: 0.78;
  cursor: progress;
}

.tp-completion-spell-spinner {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin: 0 2px;
  color: var(--tp-text-muted);
}

.tp-completion-spell-spinner .ti {
  font-size: 15px;
  line-height: 1;
  animation: tp-completion-spell-spin 0.8s linear infinite;
}

@keyframes tp-completion-spell-spin {
  to {
    transform: rotate(360deg);
  }
}

.tp-completion-spell-revert {
  width: 32px;
  height: 32px;
  border-radius: var(--completion-control-radius, 8px);
}

.tp-completion-spell-revert .ti {
  font-size: 16px;
}

.tp-completion-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--completion-control-radius, 8px);
  background: transparent;
  color: var(--tp-text-muted);
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.tp-completion-delete-icon {
  display: block;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.tp-completion-delete:hover {
  background: color-mix(in srgb, var(--tp-danger-text, #ae2e24) 10%, transparent);
  color: var(--tp-danger-text);
}

.tp-completion-delete:focus {
  outline: none;
}

.tp-completion-delete:focus-visible {
  outline: none;
  box-shadow: var(--slider-focus-ring, 0 0 0 3px rgba(12, 102, 228, 0.28));
}

.tp-completion-add {
  margin-top: 0;
}

.tp-completion-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.tp-completion-link-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  border-radius: var(--completion-control-radius, 8px);
  padding: 8px 14px;
}

.tp-completion-link-btn .ti {
  font-size: 16px;
  line-height: 1;
}

.tp-completion-link-btn:focus {
  outline: none;
}

.tp-completion-link-btn:focus-visible {
  outline: none;
  box-shadow: var(--slider-focus-ring, 0 0 0 3px rgba(12, 102, 228, 0.28));
}

.tp-completion-link-btn[aria-expanded='true'] {
  background: color-mix(in srgb, var(--tp-focus, #0c66e4) 12%, var(--tp-surface));
  color: var(--tp-focus, #0c66e4);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tp-focus, #0c66e4) 35%, var(--tp-border));
}

.tp-completion-link-btn[hidden] {
  display: none;
}

.tp-completion-link-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border-radius: var(--completion-radius, 12px);
  background: color-mix(in srgb, #000 10%, var(--tp-surface-subtle));
}

.tp-completion-link-picker[hidden] {
  display: none;
}

.tp-completion-link-status {
  margin: 0;
  font-size: 12px;
  color: var(--tp-text-muted);
}

.tp-completion-link-status[hidden] {
  display: none;
}

.tp-completion-link-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
}

.tp-completion-link-option {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--tp-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tp-completion-link-option:hover {
  background: color-mix(in srgb, var(--tp-focus, #0c66e4) 10%, transparent);
}

.tp-completion-link-option:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--tp-surface), 0 0 0 4px var(--tp-focus, #0c66e4);
}

.tp-completion-link-option-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}

.tp-completion-link-option-list {
  font-size: 11px;
  color: var(--tp-text-muted);
}

.tp-completion-add-row .tp-tab-complete-wrap {
  min-width: 0;
  border: 1px solid var(--tp-border);
  border-radius: var(--completion-control-radius, 8px);
  background: var(--tp-surface-subtle, var(--surface-1));
  box-shadow: inset 0 1px 1px color-mix(in srgb, var(--tp-text) 5%, transparent);
}

.tp-completion-add-row .tp-tab-complete-wrap:focus-within {
  border-color: color-mix(in srgb, var(--tp-primary) 55%, transparent);
  background: var(--tp-surface, var(--tp-input-bg));
  box-shadow: var(--slider-focus-ring, 0 0 0 3px rgba(12, 102, 228, 0.28));
}

.tp-completion-add-row .tp-tab-complete-ghost {
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.4;
}

.tp-completion-add-row .tp-tab-complete-wrap .tp-completion-add-input {
  width: 100%;
  border: none;
  background: transparent;
  box-shadow: none;
}

.tp-completion-add-input {
  padding: 8px 12px;
  font-size: 14px;
  /* Distinct from transparent page bg — soft fill + light edge, not a heavy cage */
  border-color: var(--tp-border);
  background: var(--tp-surface-subtle, var(--surface-1));
  box-shadow: inset 0 1px 1px color-mix(in srgb, var(--tp-text) 5%, transparent);
}

.tp-completion-add-input::placeholder {
  color: var(--tp-text-muted);
  opacity: 1;
}

.tp-completion-add-input:hover {
  background: color-mix(in srgb, var(--tp-surface-subtle) 75%, var(--tp-surface, var(--tp-input-bg)));
  border-color: var(--tp-border-strong);
}

.tp-completion-add-input:focus,
.tp-completion-add-input:focus-visible {
  border-color: color-mix(in srgb, var(--tp-primary) 55%, transparent);
  background: var(--tp-surface, var(--tp-input-bg));
}

.tp-completion-add-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  border-radius: var(--completion-control-radius, 8px);
  padding: 8px 14px;
}

.tp-completion-add-btn .ti {
  font-size: 16px;
  line-height: 1;
}

.tp-completion-add-btn:focus {
  outline: none;
}

.tp-completion-add-btn:focus-visible {
  outline: none;
  box-shadow: var(--slider-focus-ring, 0 0 0 3px rgba(12, 102, 228, 0.28));
}

.tp-completion-suggestions {
  margin: 4px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tp-completion-suggestions[hidden] {
  display: none;
}

.tp-completion-suggestions-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 2px;
}

.tp-completion-suggestions-refresh {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted, var(--tp-text-muted));
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.tp-completion-suggestions-refresh:hover {
  background: var(--surface-hover, rgba(0, 0, 0, 0.06));
  color: var(--text-primary, var(--tp-text));
}

.tp-completion-suggestions-status {
  margin: 0;
  padding: 0 2px;
  font-size: 13px;
  color: var(--text-muted, var(--tp-text-muted));
  text-align: center;
}

.tp-completion-suggestions-status[hidden] {
  display: none;
}

.tp-completion-suggestions-list {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.tp-completion-suggestion {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  width: max-content;
  padding: 7px 10px;
  border: 1px dotted color-mix(in srgb, var(--tp-text-muted, #626f86) 65%, transparent);
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary, var(--tp-text));
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, border-style 0.15s ease;
}

.tp-completion-suggestion.is-link {
  gap: 6px;
  border-color: color-mix(in srgb, var(--tp-focus, #0c66e4) 55%, transparent);
  background: color-mix(in srgb, var(--tp-focus, #0c66e4) 8%, transparent);
  color: var(--tp-focus, #0c66e4);
}

.tp-completion-suggestion.is-link .ti {
  font-size: 14px;
  line-height: 1;
  flex: 0 0 auto;
}

.tp-completion-suggestion-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-completion-suggestion-list {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.75;
  max-width: 9em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-color-mode='dark'] .tp-completion-suggestion.is-link {
  border-color: color-mix(in srgb, var(--tp-focus, #579dff) 50%, transparent);
  background: color-mix(in srgb, var(--tp-focus, #579dff) 12%, transparent);
  color: var(--tp-focus, #579dff);
}

.tp-completion-suggestion:hover {
  border-style: solid;
  background: var(--surface-hover, #e2e4e9);
}

.tp-completion-suggestion.is-link:hover {
  border-style: solid;
  background: color-mix(in srgb, var(--tp-focus, #0c66e4) 16%, var(--surface-1, var(--surface-2, #f1f2f4)));
}

html[data-color-mode='dark'] .tp-completion-suggestion.is-link:hover {
  background: color-mix(in srgb, var(--tp-focus, #579dff) 22%, var(--tp-elev-0, #0d1117));
}

.tp-completion-suggestion:focus-visible {
  outline: 2px solid var(--tp-primary, #0c66e4);
  outline-offset: 1px;
}

.tp-completion-suggestion:disabled {
  opacity: 0.55;
  cursor: progress;
}

@media (max-width: 400px) {
  .tp-completion-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .tp-completion-filter {
    max-width: none;
    width: 100%;
  }

  .tp-completion-item-main {
    grid-template-columns: 18px 28px minmax(0, 1fr) 26px auto 28px 28px 28px 28px;
  }

  .tp-completion-item-main:has(.tp-completion-promote) {
    grid-template-columns: 18px 28px minmax(0, 1fr) 26px auto 28px 28px 28px 28px 28px;
  }

  .tp-completion-item.is-linked .tp-completion-item-main {
    grid-template-columns: 18px 28px minmax(0, 1fr) 28px 28px;
  }

  .tp-completion-item-main:has(.tp-completion-spell-spinner) {
    grid-template-columns: 18px 28px minmax(0, 1fr) 22px 26px auto 28px 28px 28px 28px;
  }

  .tp-completion-item-main:has(.tp-completion-spell-spinner):has(.tp-completion-promote) {
    grid-template-columns: 18px 28px minmax(0, 1fr) 22px 26px auto 28px 28px 28px 28px 28px;
  }

  .tp-completion-item.is-linked .tp-completion-item-main:has(.tp-completion-spell-spinner) {
    grid-template-columns: 18px 28px minmax(0, 1fr) 22px 28px 28px;
  }

  .tp-completion-field-head {
    grid-template-columns: 4rem minmax(0, 1fr) 2.5rem;
    gap: 6px 8px;
  }

  .tp-completion-master-slider .tp-completion-field-head {
    grid-template-columns: 28px minmax(0, 1fr) 2.5rem;
  }

  .tp-completion-item-slider-row {
    grid-template-columns: minmax(0, 1fr) 2.5rem;
    gap: 6px 8px;
  }

  .tp-completion-checklist-details .tp-completion-item-slider-row {
    grid-template-columns: minmax(0, 1fr) 2.5rem;
  }
}

/* Very narrow iframe only — stack label rows (modal/popup shell is wider than 340px) */
@container priority-popup (max-width: 300px) {
  .tp-page--priority .heat-badge {
    grid-template-columns: 1fr;
    row-gap: 4px;
  }

  .tp-page--priority .heat-badge-num {
    grid-column: 1;
    grid-row: 1;
  }

  .tp-page--priority .heat-badge-label {
    grid-column: 1;
    grid-row: 2;
  }

  .tp-page--priority .heat-badge-meta {
    grid-column: 1;
    grid-row: 2;
  }

  .tp-page--priority .field {
    flex-direction: column;
    gap: 6px;
  }

  .tp-page--priority .variant-fields .field-head {
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: 6px 8px;
  }

  .tp-page--priority .heat-seg-labels {
    font-size: 11px;
    gap: 2px;
  }
}

/* 100%-complete fireworks overlay (brief edge-triggered celebration). */
.tp-completion-fireworks {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
}

.tp-completion-firework-burst {
  position: absolute;
  left: var(--burst-x, 50%);
  top: var(--burst-y, 40%);
  width: 0;
  height: 0;
}

.tp-completion-firework-spark {
  position: absolute;
  left: 0;
  top: 0;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--spark-color, #22a06b);
  box-shadow:
    0 0 10px color-mix(in srgb, var(--spark-color, #22a06b) 90%, transparent),
    0 0 18px color-mix(in srgb, var(--spark-color, #22a06b) 55%, transparent),
    0 0 2px rgba(255, 255, 255, 0.95);
  opacity: 0;
  transform: rotate(var(--spark-angle, 0deg)) translateY(0) scale(0.4);
  animation: tp-firework-spark 1.15s cubic-bezier(0.16, 0.84, 0.28, 1) forwards;
  animation-delay: var(--spark-delay, 0s);
}

.tp-completion-firework-burst::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, color-mix(in srgb, #4bce97 85%, transparent) 45%, transparent 70%);
  opacity: 0;
  animation: tp-firework-flash 0.55s ease-out forwards;
  animation-delay: var(--burst-delay, 0s);
}

@keyframes tp-firework-flash {
  0% { opacity: 0; transform: scale(0.2); }
  35% { opacity: 1; transform: scale(1.35); }
  100% { opacity: 0; transform: scale(2.2); }
}

@keyframes tp-firework-spark {
  0% {
    opacity: 0;
    transform: rotate(var(--spark-angle, 0deg)) translateY(0) scale(0.35);
  }
  12% {
    opacity: 1;
  }
  70% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--spark-angle, 0deg)) translateY(calc(var(--spark-dist, 48px) * -1)) scale(0.15);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tp-completion-fireworks {
    display: none;
  }
}

/* ── Profile (member preferences) ───────────────────────────────────────── */

.tp-page--profile {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tp-profile-intro {
  margin: 0 2px 4px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--tp-text-subtle, #44546f);
}

.tp-profile-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.tp-profile-field:last-child {
  margin-bottom: 0;
}

.tp-profile-field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tp-text-subtle, #44546f);
}

.tp-profile-field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tp-profile-field-dice {
  appearance: none;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--tp-border, #091e4224);
  border-radius: 6px;
  background: var(--tp-surface, #fff);
  color: var(--tp-text-muted, #626f86);
  cursor: pointer;
}

.tp-profile-field-dice:hover {
  border-color: color-mix(in srgb, var(--tp-primary, #0c66e4) 45%, var(--tp-border, #091e4224));
  color: var(--tp-primary, #0c66e4);
}

.tp-profile-field-dice .ti {
  font-size: 15px;
  line-height: 1;
}

/* Agent identity color picker (presets + custom) */
.tp-agent-color-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  width: auto;
  max-width: 100%;
}

.tp-agent-color-swatch {
  appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 1.5px solid transparent;
  border-radius: 999px;
  box-shadow:
    inset 0 0 0 1px rgba(9, 30, 66, 0.14),
    0 1px 1px rgba(9, 30, 66, 0.06);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.tp-agent-color-swatch:hover {
  transform: scale(1.12);
  box-shadow:
    inset 0 0 0 1px rgba(9, 30, 66, 0.18),
    0 1px 3px rgba(9, 30, 66, 0.12);
}

.tp-agent-color-swatch.is-selected {
  border-color: var(--tp-primary, #0c66e4);
  box-shadow:
    0 0 0 1.5px color-mix(in srgb, var(--tp-primary, #0c66e4) 40%, transparent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.tp-agent-color-swatch:focus-visible {
  outline: 2px solid var(--tp-primary, #0c66e4);
  outline-offset: 1px;
}

.tp-agent-color-custom {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: auto;
  height: 18px;
  margin: 0;
  padding: 0 4px 0 1px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  min-height: 0;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.tp-agent-color-custom.is-selected {
  border-color: var(--tp-primary, #0c66e4);
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--tp-primary, #0c66e4) 40%, transparent);
  background: color-mix(in srgb, var(--tp-primary, #0c66e4) 8%, transparent);
}

.tp-agent-color-custom-face {
  display: block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  min-height: 0;
  aspect-ratio: auto;
  border-radius: 999px;
  background:
    conic-gradient(
      from 210deg,
      #ff6b6b,
      #f5d76e,
      #8fd86a,
      #7eb2f0,
      #b48ae0,
      #f095b8,
      #ff6b6b
    );
  box-shadow: inset 0 0 0 1px rgba(9, 30, 66, 0.14);
  pointer-events: none;
}

.tp-agent-color-custom-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border: 0;
  padding: 0;
}

.tp-agent-color-custom-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--tp-text-muted, #626f86);
  pointer-events: none;
}

.tp-agent-color-custom.is-selected .tp-agent-color-custom-label {
  color: var(--tp-text, #172b4d);
}

.tp-textarea {
  min-height: 72px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.4;
}

.tp-profile-features {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tp-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.tp-profile-status {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--tp-text-subtle, #44546f);
}

.tp-profile-status.is-error {
  color: #c9372c;
}

html[data-color-mode="dark"] .tp-profile-status.is-error {
  color: #f87462;
}

/* —— People directory (profile) —— */
.tp-people-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.tp-people-hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--tp-text-subtle, #44546f);
}

.tp-people-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tp-people-empty {
  margin: 4px 0 0;
  padding: 14px 12px;
  border-radius: 10px;
  border: 1px dashed var(--tp-border, #dfe1e6);
  background: var(--tp-surface-raised, rgba(9, 30, 66, 0.03));
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--tp-text-subtle, #44546f);
  text-align: center;
}

.tp-people-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid var(--tp-border, #dfe1e6);
  background: var(--tp-surface, #fff);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tp-people-card:hover {
  border-color: var(--tp-border-strong, #c1c7d0);
}

.tp-people-card.is-editing {
  border-color: var(--ds-border-focused, #388bff);
  box-shadow: 0 0 0 1px var(--ds-border-focused, #388bff);
}

.tp-people-avatar {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #172b4d;
  background: linear-gradient(145deg, #e9f2ff 0%, #cce0ff 55%, #b3d4ff 100%);
  user-select: none;
}

html[data-color-mode="dark"] .tp-people-avatar {
  color: #deebff;
  background: linear-gradient(145deg, #1c2b41 0%, #243447 55%, #2c3e50 100%);
}

.tp-people-body {
  flex: 1 1 auto;
  min-width: 0;
}

.tp-people-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.tp-people-name {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--tp-text, #172b4d);
  line-height: 1.3;
}

.tp-people-role-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  color: #164b35;
  background: #d3f1a7;
}

html[data-color-mode="dark"] .tp-people-role-chip {
  color: #baF3db;
  background: #216e4e;
}

.tp-people-meta {
  font-size: 12px;
  line-height: 1.4;
  color: var(--tp-text-subtle, #44546f);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-people-aliases {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tp-people-alias-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--tp-text-subtle, #44546f);
  background: var(--tp-surface-raised, rgba(9, 30, 66, 0.06));
}

.tp-people-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tp-people-icon-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--tp-text-subtle, #44546f);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.tp-people-icon-btn:hover {
  background: var(--tp-surface-raised, rgba(9, 30, 66, 0.08));
  color: var(--tp-text, #172b4d);
}

.tp-people-icon-btn.is-danger:hover {
  color: #c9372c;
  background: rgba(201, 55, 44, 0.1);
}

.tp-people-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.tp-people-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.tp-people-chip-input-hint {
  margin: 0;
  font-size: 11px;
  color: var(--tp-text-subtle, #44546f);
}

/* Shared Tab autocomplete (ghost + field wrap) */
.tp-tab-complete-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: block;
}

.tp-tab-complete-ghost {
  position: absolute;
  inset: 0;
  padding: inherit;
  color: var(--tp-text-muted, #626f86);
  opacity: 0;
  font: inherit;
  line-height: inherit;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.tp-tab-complete-wrap.has-ghost .tp-tab-complete-ghost {
  opacity: 0.5;
}

.tp-tab-complete-field {
  position: relative;
  z-index: 1;
}

.tp-tab-hint {
  margin-left: 4px;
  padding: 1px 5px;
  border: 1px solid var(--tp-border-strong, rgba(9, 30, 66, 0.31));
  border-radius: 4px;
  background: var(--tp-surface-subtle, #f1f2f4);
  color: var(--tp-text-muted, #626f86);
  font: inherit;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.2;
  vertical-align: middle;
}

.is-tab-target {
  outline: 1px solid color-mix(in srgb, var(--tp-primary, #0c66e4) 55%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--tp-primary, #0c66e4) 22%, transparent);
}

/* —— Goals / Objectifs settings —— */
.tp-goals-settings {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tp-goals-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tp-goals-panel {
  border: 1px solid var(--tp-border, rgba(9, 30, 66, 0.14));
  border-radius: 10px;
  background: var(--tp-surface, #fff);
  overflow: hidden;
}

.tp-goals-panel.is-disabled {
  opacity: 0.72;
}

.tp-goals-panel-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  background: var(--tp-surface-subtle, #f7f8f9);
}

.tp-goals-panel-summary::-webkit-details-marker {
  display: none;
}

.tp-goals-panel-summary::after {
  content: '';
  width: 0.45em;
  height: 0.45em;
  margin-left: auto;
  border-right: 2px solid var(--tp-text-muted, #626f86);
  border-bottom: 2px solid var(--tp-text-muted, #626f86);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.tp-goals-panel[open] > .tp-goals-panel-summary::after {
  transform: rotate(-135deg);
  margin-top: 4px;
}

.tp-goals-panel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--tp-primary, #0c66e4) 12%, transparent);
  color: var(--tp-primary, #0c66e4);
  font-size: 15px;
  flex-shrink: 0;
}

.tp-goals-panel-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--tp-text, #172b4d);
}

.tp-goals-panel-selected {
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tp-primary, #0c66e4) 14%, transparent);
  color: var(--tp-primary, #0c66e4);
  font-size: 11px;
  font-weight: 600;
}

.tp-goals-panel-selected[hidden] {
  display: none;
}

.tp-goals-panel-count {
  min-width: 1.5rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--tp-surface, #fff);
  border: 1px solid var(--tp-border, rgba(9, 30, 66, 0.14));
  color: var(--tp-text-muted, #626f86);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.tp-goals-panel-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--tp-border, rgba(9, 30, 66, 0.1));
}

.tp-goals-col-title {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--tp-text, #172b4d);
}

.tp-goals-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 40px;
  max-height: 160px;
  overflow: auto;
  padding: 2px;
}

.tp-goals-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 7px 8px 7px 10px;
  border-radius: 8px;
  background: var(--tp-surface-subtle, #f1f2f4);
  color: var(--tp-text, #172b4d);
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

.tp-goals-item:hover {
  background: var(--tp-surface-hover, #e9ebef);
}

.tp-goals-item.is-selected {
  background: color-mix(in srgb, var(--tp-primary, #0c66e4) 10%, var(--tp-surface, #fff));
  box-shadow: inset 0 0 0 2px var(--tp-primary, #0c66e4);
}

.tp-goals-item.is-retired {
  opacity: 0.72;
}

.tp-goals-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-goals-item-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.tp-goals-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--tp-text-muted, #626f86);
  cursor: pointer;
}

.tp-goals-icon-btn:hover {
  background: var(--tp-surface, #fff);
  color: var(--tp-text, #172b4d);
}

.tp-goals-retired-tag,
.tp-goals-primary-tag {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tp-goals-retired-tag {
  background: var(--tp-surface, #fff);
  color: var(--tp-text-muted, #626f86);
}

.tp-goals-primary-tag {
  background: color-mix(in srgb, var(--tp-primary, #0c66e4) 16%, transparent);
  color: var(--tp-primary, #0c66e4);
}

.tp-goals-add-row {
  display: flex;
  gap: 6px;
}

.tp-goals-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--tp-border, rgba(9, 30, 66, 0.14));
  border-radius: 6px;
  background: var(--tp-surface, #fff);
  color: var(--tp-text, #172b4d);
  font: inherit;
  font-size: 13px;
}

.tp-goals-input:focus {
  outline: none;
  border-color: var(--tp-primary, #0c66e4);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--tp-primary, #0c66e4) 22%, transparent);
}

.tp-goals-add-btn {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 12px;
}

.tp-goals-empty {
  margin: 4px 2px;
  font-size: 12px;
  color: var(--tp-text-muted, #626f86);
}

.tp-goals-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 2px;
}

.tp-goals-suggestions[hidden] {
  display: none;
}

.tp-goals-suggestions-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.tp-goals-suggestions-refresh {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--tp-text-muted, #626f86);
  font-size: 15px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.tp-goals-suggestions-refresh:hover {
  background: var(--tp-surface-subtle, #f1f2f4);
  color: var(--tp-text, #172b4d);
}

.tp-goals-suggestions-status {
  margin: 0;
  font-size: 12px;
  color: var(--tp-text-muted, #626f86);
}

.tp-goals-suggestions-status[hidden] {
  display: none;
}

.tp-goals-suggestions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tp-goals-suggestion {
  appearance: none;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 6px 10px;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tp-primary, #0c66e4) 10%, var(--tp-surface-subtle, #f1f2f4));
  color: var(--tp-text, #172b4d);
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.tp-goals-suggestion:hover {
  background: color-mix(in srgb, var(--tp-primary, #0c66e4) 18%, var(--tp-surface-subtle, #f1f2f4));
}

.tp-goals-suggestion:focus-visible {
  outline: 2px solid var(--tp-primary, #0c66e4);
  outline-offset: 1px;
}

.tp-goals-suggestion:disabled {
  opacity: 0.55;
  cursor: progress;
}

.tp-goals-metrics {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--tp-border, rgba(9, 30, 66, 0.14));
}

.tp-goals-metrics-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tp-goals-metric-card {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--tp-surface-subtle, #f1f2f4);
}

.tp-goals-metric-card.is-primary {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--tp-primary, #0c66e4) 45%, transparent);
}

.tp-goals-metric-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 4px;
}

.tp-goals-metric-name {
  font-size: 13px;
}

.tp-goals-metric-meta {
  font-size: 11px;
  color: var(--tp-text-muted, #626f86);
}

.tp-goals-metric-value {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.tp-goals-metric-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tp-goals-metric-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: var(--tp-surface, #fff);
  border: 1px solid var(--tp-border, rgba(9, 30, 66, 0.14));
}

.tp-goals-form-title {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 12px;
  font-weight: 650;
}

.tp-goals-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.tp-goals-field-label {
  color: var(--tp-text-muted, #626f86);
}

.tp-goals-toggle {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.tp-goals-deps-select {
  min-height: 64px;
}

.tp-goals-metric-form .tp-button {
  grid-column: 1 / -1;
  justify-self: start;
}

/* Temporary undo after AI spellcheck applied a correction */
.tp-spell-revert {
  appearance: none;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--tp-text-muted, #626f86);
  line-height: 1;
  cursor: pointer;
  transition: color 0.12s ease, background-color 0.12s ease, opacity 0.2s ease;
  animation: tp-spell-revert-in 0.18s ease-out;
}

.tp-spell-revert .ti {
  font-size: 14px;
  line-height: 1;
}

.tp-spell-revert:hover {
  color: var(--tp-text, #172b4d);
  background: var(--tp-surface-hover, #091e420f);
}

.tp-spell-revert:focus {
  outline: none;
}

.tp-spell-revert:focus-visible {
  outline: 2px solid var(--tp-primary, #0c66e4);
  outline-offset: 1px;
}

@keyframes tp-spell-revert-in {
  from {
    opacity: 0;
    transform: translateX(4px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

