:root {
  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-stronger: rgba(255, 255, 255, 0.24);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.7);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --topbar-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.04));
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --inset: rgba(0, 0, 0, 0.14);
  --code-bg: rgba(0, 0, 0, 0.25);
  --overlay-bg: rgba(0, 0, 0, 0.52);
  --modal-overlay-bg: rgba(0, 0, 0, 0.62);
  --toast-bg: rgba(6, 12, 28, 0.94);
  --toast-color: rgba(255, 255, 255, 0.96);
  --toast-shadow: 0 16px 42px rgba(0, 0, 0, 0.44);
  --persist-overlay-bg: rgba(5, 9, 20, 0.48);
  --sheet-bg: rgba(10, 16, 30, 0.92);
  --modal-bg: rgba(10, 16, 30, 0.94);
  --canvas-bg: rgba(0, 0, 0, 0.22);
  --radius: 16px;
  --pink: #ff3d8d;
  --blue: #3b82f6;
  --green: #22c55e;
  --yellow: #f59e0b;
  --gray: #9ca3af;
}

html[data-theme="light"] {
  --bg: #f6f7fb;
  --panel: rgba(12, 18, 32, 0.04);
  --panel-2: rgba(12, 18, 32, 0.06);
  --border: rgba(12, 18, 32, 0.12);
  --border-strong: rgba(12, 18, 32, 0.18);
  --border-stronger: rgba(12, 18, 32, 0.26);
  --text: rgba(12, 18, 32, 0.92);
  --muted: rgba(12, 18, 32, 0.64);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
  --topbar-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.82));
  --surface: rgba(255, 255, 255, 0.78);
  --surface-hover: rgba(255, 255, 255, 0.92);
  --inset: rgba(12, 18, 32, 0.03);
  --code-bg: rgba(12, 18, 32, 0.05);
  --overlay-bg: rgba(0, 0, 0, 0.38);
  --modal-overlay-bg: rgba(0, 0, 0, 0.38);
  --toast-bg: rgba(255, 255, 255, 0.98);
  --toast-color: rgba(12, 18, 32, 0.96);
  --toast-shadow: 0 14px 34px rgba(12, 18, 32, 0.18);
  --persist-overlay-bg: rgba(4, 10, 24, 0.3);
  --sheet-bg: rgba(255, 255, 255, 0.92);
  --modal-bg: rgba(255, 255, 255, 0.94);
  --canvas-bg: rgba(12, 18, 32, 0.05);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 10% 0%, rgba(59, 130, 246, 0.22), transparent 55%),
    radial-gradient(900px 700px at 95% 10%, rgba(255, 61, 141, 0.2), transparent 60%),
    radial-gradient(1000px 800px at 70% 100%, rgba(34, 197, 94, 0.16), transparent 55%),
    var(--bg);
}

html[data-theme="light"] body {
  background:
    radial-gradient(1200px 800px at 10% 0%, rgba(59, 130, 246, 0.16), transparent 55%),
    radial-gradient(900px 700px at 95% 10%, rgba(255, 61, 141, 0.12), transparent 60%),
    radial-gradient(1000px 800px at 70% 100%, rgba(34, 197, 94, 0.12), transparent 55%),
    var(--bg);
}

.app {
  max-width: 1220px;
  margin: 0 auto;
  padding: 22px 18px 36px;
}

.topbar {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 16px;
  border: 1px solid var(--border);
  background: var(--topbar-bg);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  position: sticky;
  top: 14px;
  z-index: 20;
}

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

.topbar__logo-wrap {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  display: grid;
  place-items: center;
  padding: 8px 10px;
}

.topbar__logo {
  display: block;
  height: 65px;
  width: auto;
}

.topbar__kicker {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar__h1 {
  margin: 6px 0 6px;
  font-size: 22px;
  font-weight: 700;
}

.topbar__sub {
  color: var(--muted);
  font-size: 13px;
}

.topbar__actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  position: relative;
}

.readonly-banner {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.18);
  color: var(--text);
  font-weight: 700;
  box-shadow: var(--shadow);
}

.user-menu {
  position: relative;
}

.user-menu__toggle {
  border-radius: 999px;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.user-menu__glyph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--text);
}

.user-menu__initial {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--border-stronger);
  background: var(--sheet-bg);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 10px;
  letter-spacing: 0.02em;
}

.user-menu__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  z-index: 30;
  border: 1px solid var(--border-stronger);
  border-radius: 14px;
  background: var(--sheet-bg);
  box-shadow: var(--shadow);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-menu__dropdown[hidden] {
  display: none;
}

.user-menu__header {
  padding: 4px 6px 10px;
  border-bottom: 1px solid var(--border);
}

.user-menu__label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.user-menu__name {
  margin-top: 6px;
  font-weight: 800;
  font-size: 13px;
  word-break: break-word;
}

.user-menu__role {
  margin-top: 4px;
  font-size: 12px;
}

.user-menu__item {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 9px 10px;
  min-height: 36px;
  cursor: pointer;
  font-weight: 650;
}

.user-menu__item:hover {
  background: var(--panel);
}

.user-menu__item--danger {
  color: var(--pink);
}

.user-menu__item--danger:hover {
  background: rgba(255, 61, 141, 0.14);
}

.security-form {
  display: grid;
  gap: 12px;
}

.security-form__card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: var(--surface);
}

.security-form__title {
  font-weight: 800;
  margin-bottom: 6px;
}

.security-form__hint {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.security-form__row {
  display: grid;
  gap: 8px;
}

.security-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.security-form__error {
  min-height: 16px;
  font-size: 12px;
  color: #ff7a7a;
}

.security-form__error--success {
  color: #22c55e;
}

.input--error {
  border-color: rgba(255, 122, 122, 0.9);
  box-shadow: 0 0 0 2px rgba(255, 122, 122, 0.15);
}

.user-menu__sep {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

.pillars {
  margin-top: 14px;
}

.pillars__grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 12px;
}

.pillar-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 14px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
  min-height: 112px;
}

.pillar-card--all {
  border-style: dashed;
}

.pillar-card:hover {
  transform: translateY(-2px);
  background: var(--surface-hover);
  border-color: var(--border-stronger);
}

.pillar-card__row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.pillar-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
}

.pillar-card__title {
  font-weight: 700;
  font-size: 16px;
  margin: 0;
}

.pillar-card__meta {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 12px;
  color: var(--text);
  cursor: default;
  user-select: none;
}

.badge--muted {
  color: var(--muted);
}

.badge--clickable {
  cursor: pointer;
}

.badge--active {
  outline: 2px solid var(--border-stronger);
  outline-offset: 2px;
}

.badge--pink {
  border-color: rgba(255, 61, 141, 0.35);
  background: rgba(255, 61, 141, 0.14);
}

.badge--blue {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.14);
}

.badge--green {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.14);
}

.badge--yellow {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.14);
}

.badge--gray {
  border-color: rgba(156, 163, 175, 0.35);
  background: rgba(156, 163, 175, 0.14);
}

.docs__list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.doc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}

.doc-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.doc-card__title {
  font-weight: 800;
}

.doc-card__path {
  font-size: 12px;
}

.doc-card__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.doc-card__status {
  margin-top: 10px;
  font-size: 12px;
}

.value-section {
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(59, 130, 246, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.value-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.value-row--compact {
  margin-top: 6px;
  gap: 6px;
}

.value-stars {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: #f5c451;
  text-shadow: 0 1px 8px rgba(245, 196, 81, 0.35);
}

.value-score {
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 999px;
}

.value-effort {
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 999px;
}

.value-effort--compact {
  font-size: 11px;
  padding: 3px 8px;
}

.value-pillars {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.value-pillars__badge {
  padding: 4px 8px;
  font-size: 11px;
  border-color: var(--border-strong);
}

.value-detail {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.value-detail__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.value-detail__item {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.value-detail__label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.value-detail__value {
  margin-top: 6px;
  font-weight: 700;
  font-size: 15px;
}

.value-detail__pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}

.value-detail__row {
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.value-detail__metrics {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
}

.value-detail__notes {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
}

.value-detail__notes .markdown {
  margin-top: 8px;
  font-size: 12px;
}

.value-detail__metrics ul {
  margin: 8px 0 0 18px;
  padding: 0;
  display: grid;
  gap: 4px;
}

.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 40px;
  font-weight: 600;
  cursor: pointer;
}

.btn--ghost {
  background: transparent;
}

.btn--small {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.btn:hover {
  border-color: var(--border-stronger);
  background: var(--panel-2);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 0;
}

.icon-btn:hover {
  background: var(--panel-2);
}

.sync-bell {
  position: relative;
}

.sync-bell__badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  padding: 0 4px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.2);
  color: var(--text);
}

.sync-bell__badge[hidden] {
  display: none !important;
}

.sync-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--inset);
  padding: 8px 10px;
}

.sync-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
  max-height: min(60vh, 420px);
  overflow: auto;
  padding-right: 2px;
}

.sync-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px 12px;
}

.sync-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sync-item__message {
  margin-top: 6px;
  font-size: 13px;
}

.sync-item--live {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.08);
}

.sync-live-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #60a5fa;
  box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.8);
  animation: syncPulse 1.2s infinite;
}

@keyframes syncPulse {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(96, 165, 250, 0);
  }
  100% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(96, 165, 250, 0);
  }
}

.sync-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(460px, 92vw);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--sheet-bg);
  box-shadow: var(--shadow);
  padding: 10px;
  z-index: 40;
  backdrop-filter: blur(8px);
}

.sync-popover--open {
  display: block;
}

.sync-popover__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sync-popover__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.main {
  margin-top: 14px;
  display: grid;
  /* Prioridades agora ocupam toda a largura disponível */
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
  min-width: 0;
}

/* When details are moved to the fullscreen modal we hide the details pane
   and make the priorities list occupy the full content area. */
.main--single {
  grid-template-columns: 1fr;
}

.details--hidden {
  display: none;
}

.favorites,
.details,
.execution {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 320px;
  min-width: 0;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-title__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

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

.favorites__filters select.input {
  flex: 1 1 200px;
  min-width: 180px;
}

@media (max-width: 720px) {
  .section-title {
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  .favorites__filters {
    flex-direction: column;
    align-items: stretch;
  }

  .favorites__filters select.input {
    min-width: 0;
  }

  .sync-popover {
    width: min(360px, calc(100vw - 24px));
  }

  .sync-popover__header {
    flex-direction: column;
    align-items: stretch;
  }

  .sync-popover__actions {
    justify-content: flex-end;
  }
}

.section-title h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
}

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

.favorites__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.favorites__list--dragging .favorite-item {
  transition: margin 120ms ease, transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.favorite-item {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--inset);
  cursor: grab;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  position: relative;
}

.favorite-item--dragging {
  opacity: 0.55;
}

.favorite-item--insert-before {
  margin-top: 18px;
}

.favorite-item--insert-after {
  margin-bottom: 18px;
}

.favorite-item--insert-before::before,
.favorite-item--insert-after::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 3px;
  border-radius: 999px;
  background: var(--border-stronger);
}

.favorite-item--insert-before::before {
  top: -11px;
}

.favorite-item--insert-after::after {
  bottom: -11px;
}

.favorite-item:active {
  cursor: grabbing;
}

.favorite-item__rank {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.favorite-item__main {
  min-width: 0;
}

.favorite-item__id {
  font-weight: 800;
  font-size: 13px;
}

.favorite-item__title {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.focus-areas {
  margin-top: 6px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.focus-areas__label {
  color: var(--muted);
  font-size: 12px;
}

.favorite-item__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.execution-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.execution-lane {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--inset);
  padding: 10px;
  min-height: 220px;
  transition: border-color 120ms ease, background 120ms ease;
}

.execution-lane--hover {
  border-color: var(--border-stronger);
  background: var(--surface);
}

.execution-lane__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.execution-lane__header h3 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.execution-lane__hint {
  margin-top: 4px;
}

.execution-lane__sort {
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.execution-lane__sort .input {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.execution-lane__list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.execution-lane__stack {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.execution-zone {
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--panel);
  padding: 8px;
  transition: border-color 120ms ease, background 120ms ease;
}

.execution-zone--hover {
  border-color: var(--border-stronger);
  background: var(--surface);
}

.execution-zone__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.execution-zone__head h4 {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.execution-zone__list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.execution-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px;
  padding-right: 56px;
  padding-bottom: 58px;
  cursor: grab;
  position: relative;
}

.execution-item--dragging {
  opacity: 0.55;
}

.execution-item--insert-before {
  margin-top: 16px;
}

.execution-item--insert-after {
  margin-bottom: 16px;
}

.execution-item--insert-before::before,
.execution-item--insert-after::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  height: 3px;
  border-radius: 999px;
  background: var(--border-stronger);
}

.execution-item--insert-before::before {
  top: -10px;
}

.execution-item--insert-after::after {
  bottom: -10px;
}

.execution-item__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding-right: 6px;
}

.execution-item__rank {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}

.execution-item__id {
  font-size: 12px;
  font-weight: 800;
}

.execution-item__title {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text);
}

.execution-item__meta {
  margin-top: 5px;
}

.execution-item__actions {
  margin-top: 0;
}

.execution-item__menu-wrap {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 4;
}

.execution-item__move-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
}

.execution-item__open-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
}

.execution-item__history-btn {
  position: absolute;
  right: 92px;
  bottom: 10px;
  z-index: 3;
}

.execution-item__fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
}

.execution-item__move-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  z-index: 4;
  border: 1px solid var(--border-stronger);
  border-radius: 10px;
  background: var(--sheet-bg);
  box-shadow: var(--shadow);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.execution-item__move-menu[hidden] {
  display: none;
}

.star-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
}

.star-btn--on {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.16);
}

.details__panel {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--inset);
  padding: 14px;
  min-height: 260px;
  min-width: 0;
  overflow-x: hidden;
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
  padding: 12px;
}

.details__head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.details__title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.details__id {
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.details__meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.details__meta--trace {
  margin-top: 10px;
}

.details__pillar {
  margin-top: 10px;
}

.pillar-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-stronger);
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.pillar-chip__kicker {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.pillar-chip__value {
  font-weight: 900;
  font-size: 12px;
  color: var(--text);
}

.pillar-chip--pink {
  border-color: rgba(255, 61, 141, 0.42);
  background: rgba(255, 61, 141, 0.08);
}

.pillar-chip--blue {
  border-color: rgba(59, 130, 246, 0.42);
  background: rgba(59, 130, 246, 0.08);
}

.pillar-chip--green {
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(34, 197, 94, 0.08);
}

.pillar-chip--yellow {
  border-color: rgba(245, 158, 11, 0.42);
  background: rgba(245, 158, 11, 0.08);
}

.markdown {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.markdown h1,
.markdown h2,
.markdown h3 {
  margin: 18px 0 10px;
}

.markdown h1 {
  font-size: 22px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.markdown h2 {
  font-size: 18px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.markdown h3 {
  font-size: 16px;
}

.markdown h4 {
  margin: 14px 0 8px;
  font-size: 14px;
}

.markdown p {
  margin: 10px 0;
}

.markdown ul,
.markdown ol {
  margin: 10px 0;
  padding-left: 22px;
}

.markdown li {
  margin: 6px 0;
}

.markdown li.task-list-item {
  list-style: none;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.markdown .task-checkbox {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex: 0 0 auto;
  accent-color: var(--blue);
}

.markdown a {
  color: var(--blue);
  text-decoration: none;
}

.markdown a:hover {
  text-decoration: underline;
}

.markdown blockquote {
  margin: 12px 0;
  padding: 8px 12px;
  border-left: 4px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--muted);
}

.markdown hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.markdown img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.markdown code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 10px;
}

.markdown pre {
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--code-bg);
  border-radius: 14px;
  overflow: auto;
}

.markdown pre code {
  padding: 0;
  border: none;
  background: transparent;
}

.markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  display: block;
  overflow-x: auto;
}

.markdown th,
.markdown td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  vertical-align: top;
}

.markdown th {
  background: var(--panel-2);
  font-weight: 600;
}

.markdown tr:nth-child(even) td {
  background: var(--panel);
}

.trace {
  margin-top: 14px;
}

.trace h3 {
  margin: 10px 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text);
}

.trace-kind__hint {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.trace-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.trace-list .dep {
  margin-top: 0;
}

.dep {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 10px 10px;
  margin-top: 10px;
  min-width: 0;
  overflow: hidden;
}

.dep summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dep__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dep--link {
  cursor: pointer;
}

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

.dep__left {
  min-width: 0;
}

.dep__id {
  font-weight: 800;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dep__title {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dep__right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.dep__body {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.dep__body .markdown {
  max-height: 240px;
  overflow: auto;
  padding-right: 6px;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 40;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(520px, 92vw);
  background: var(--sheet-bg);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 220ms ease;
  z-index: 50;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
}

.drawer--open {
  transform: translateX(0);
}

.drawer-overlay--open {
  opacity: 1;
  pointer-events: auto;
}

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.drawer__title {
  font-weight: 800;
}

.drawer__controls {
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.drawer__filters {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.drawer__filters select.input {
  flex: 1 1 200px;
  min-width: 180px;
}

@media (max-width: 520px) {
  .drawer__filters {
    flex-direction: column;
    align-items: stretch;
  }

  .drawer__filters select.input {
    min-width: 0;
  }
}

.input {
  width: 100%;
  padding: 10px 12px;
  min-height: 40px;
  height: 40px;
  line-height: 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  outline: none;
}

select.input {
  padding-right: 34px;
}

.input:focus {
  border-color: rgba(59, 130, 246, 0.5);
}

.drawer__list {
  padding: 12px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-item {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}

.drawer-item:hover {
  background: var(--surface-hover);
}

.drawer-item__id {
  font-weight: 900;
  font-size: 13px;
}

.drawer-item__title {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.drawer-item__meta {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.drawer-item__summary {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
  line-height: 1.35;
}

.persist-overlay {
  position: fixed;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  background: var(--persist-overlay-bg);
  backdrop-filter: blur(2px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.persist-overlay--show {
  opacity: 1;
  pointer-events: auto;
}

.persist-overlay__card {
  min-width: min(420px, 100%);
  max-width: min(560px, 100%);
  border-radius: 14px;
  border: 1px solid var(--border-stronger);
  background: var(--sheet-bg);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.persist-overlay__spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-top-color: var(--blue);
  animation: persist-spin 0.9s linear infinite;
  flex: 0 0 auto;
}

.persist-overlay__text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

@keyframes persist-spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translate(-50%, -12px);
  width: min(560px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-stronger);
  background: var(--toast-bg);
  color: var(--toast-color);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--toast-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 160;
}

.toast--info {
  border-color: rgba(59, 130, 246, 0.5);
}

.toast--success {
  border-color: rgba(34, 197, 94, 0.58);
}

.toast--error {
  border-color: rgba(255, 61, 141, 0.62);
}

.toast--show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.login-screen {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 120;
  backdrop-filter: blur(6px);
}

.login-screen--open {
  display: flex;
}

.login-card {
  width: min(420px, 90vw);
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--modal-bg);
  box-shadow: var(--shadow);
  padding: 20px;
}

.login-card__title {
  font-size: 18px;
  font-weight: 800;
}

.login-card__subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.login-form {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.login-label {
  font-size: 12px;
  color: var(--muted);
}

.login-error {
  min-height: 16px;
  font-size: 12px;
  color: #ff7a7a;
}

.login-btn {
  width: 100%;
}

.footer {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 6px;
}

.footer__link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 2px;
}

.footer__link:hover {
  border-bottom-color: var(--border-stronger);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay-bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 80;
}

#artifactOverlay {
  z-index: 74;
}

.modal-overlay--open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.98);
  width: min(980px, 92vw);
  max-height: min(86vh, 880px);
  background: var(--modal-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 90;
  display: flex;
  flex-direction: column;
}

#artifactModal {
  z-index: 75;
}

.modal--open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

/* Make the artifact modal slide in from the right as a lateral panel (less disruptive) */
#artifactModal {
  left: auto;
  right: 0;
  top: 0;
  transform: translateX(100%);
  width: min(920px, 92vw);
  height: 100vh;
  max-height: none;
  border-radius: 0;
  border-left: 1px solid var(--border);
}

/* When opened, slide into view */
#artifactModal.modal--open {
  transform: translateX(0);
}

/* Side panel (separate from drawer/modal) */
.sidepanel {
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  width: min(920px, 92vw);
  background: var(--sheet-bg);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 220ms ease;
  z-index: 85;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(8px);
}

.sidepanel--open {
  transform: translateX(0);
}

.sidepanel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.sidepanel__body {
  padding: 14px;
  overflow: auto;
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.modal__title {
  font-weight: 900;
}

.modal__sub {
  margin-top: 4px;
}

.modal__body {
  padding: 14px;
  overflow: auto;
}

.user-admin__card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
}

.user-admin__row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 0.9fr auto auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.user-admin__error {
  margin-top: 10px;
}

.user-admin__list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 2px;
}

.user-admin__list {
  display: grid;
  gap: 8px;
}

.user-admin__item {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-admin__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.user-admin__name {
  font-weight: 800;
}

.user-admin__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filelist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  min-width: 0;
}

.file-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}

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

.file-chip .badge {
  flex: 0 0 auto;
}

.file-chip:hover {
  border-color: var(--border-stronger);
  background: var(--panel-2);
}

.file-chip--main {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.12);
}

.file-chip--off {
  opacity: 0.75;
  border-style: dashed;
}

.support-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px;
}

.support-card__title {
  font-weight: 900;
  margin-bottom: 6px;
}

.support-card__text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.help-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 12px;
}

.help-item__title {
  font-weight: 900;
  color: var(--text);
}

.help-item__desc {
  margin-top: 6px;
}

.help-pillars {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.help-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.help-list li {
  margin: 6px 0;
}

.help-list--dense {
  margin-top: 0;
}

.help-list--dense li {
  margin: 8px 0;
}

.help-note {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  padding: 10px 12px;
}

.help-note--warn {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
}

.history-modal {
  display: grid;
  gap: 10px;
}

.history-modal__toolbar {
  display: grid;
  grid-template-columns: minmax(200px, 1.8fr) minmax(170px, 1fr) minmax(190px, 1fr);
  gap: 8px;
  align-items: center;
}

.history-modal__summary {
  padding: 4px 2px;
}

.history-modal__list {
  display: grid;
  gap: 8px;
}

.history-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px 12px;
}

.history-item__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.history-item__head-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.history-item__initiative {
  font-size: 12px;
  font-weight: 800;
}

.history-item__desc {
  margin-top: 8px;
  font-size: 13px;
}

.history-item__meta {
  margin-top: 6px;
}

.modal-pre {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--code-bg);
  border-radius: 14px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre;
}

.img-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.img-controls__left {
  display: flex;
  gap: 8px;
  align-items: center;
}

.img-canvas {
  position: relative;
  height: min(64vh, 560px);
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--canvas-bg);
  overflow: hidden;
  user-select: none;
  touch-action: none;
}

.img-canvas img {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) translate(var(--tx, 0px), var(--ty, 0px)) scale(var(--scale, 1));
  transform-origin: center center;
  max-width: 100%;
  max-height: 100%;
  cursor: grab;
}

.img-canvas img:active {
  cursor: grabbing;
}

@media (max-width: 1080px) {
  .pillars__grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
  .main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 840px) {
  .favorite-item {
    grid-template-columns: 36px 1fr;
  }

  .favorite-item__actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .execution-board {
    grid-template-columns: 1fr;
  }

  .execution-lane__sort {
    grid-template-columns: 1fr;
  }

  .execution-lane__sort .btn {
    width: 100%;
  }

  .history-modal__toolbar {
    grid-template-columns: 1fr;
  }

  .execution-item__history-btn {
    right: 82px;
  }
}

@media (min-width: 841px) and (max-width: 1280px) {
  .execution-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
