:root {
  color-scheme: dark;
  /* Paleta dark + dourado RR Engenharia (alinhada com /css/topbar.css) */
  --bg:            #050507;
  --ink:           #ededeb;
  --muted:         rgba(237, 237, 235, 0.55);
  --line:          rgba(255, 255, 255, 0.07);
  --panel:         #121214;
  --panel-strong:  #1a1a1d;
  --accent:        #c9a24f;
  --accent-strong: #dfb66a;
  --accent-soft:   rgba(201, 162, 79, 0.12);
  --orange:        #f5b450;
  --rose:          #d97c7c;
  --blue:          #6fb1ff;
  --green:         #6fc784;
  --shadow:        0 24px 60px rgba(0, 0, 0, 0.55);
  --radius:        10px;
  --font:          Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #0d0d0f;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0 4px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(201, 162, 79, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(201, 162, 79, 0.16), rgba(198, 95, 37, 0.12)),
    #121214;
  box-shadow: inset 0 0 0 5px rgba(0, 0, 0, 0.3);
}

.brand-mark svg {
  display: block;
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(201, 162, 79, 0.25));
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.28rem, 1rem + 1vw, 1.85rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.15;
}

.panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.05);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  background: #121214;
}

.stat span {
  display: block;
  font-size: 1.55rem;
  font-weight: 850;
  line-height: 1;
}

.stat small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.field-label {
  display: block;
  margin: 12px 0 6px;
  color: rgba(237,237,235,0.55);
  font-size: 0.78rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 7px;
  background: #121214;
  color: var(--ink);
  outline: none;
}

input,
select {
  padding: 0 11px;
}

textarea {
  padding: 10px 11px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 162, 79, 0.14);
}

.search-wrap {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 7px;
  background: #121214;
}

.search-wrap span {
  color: var(--muted);
  text-align: center;
  font-size: 1.2rem;
}

.search-wrap input {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.primary-button,
.text-button,
.danger-button,
.icon-button {
  min-height: 40px;
  border-radius: 7px;
  font-weight: 850;
  letter-spacing: 0;
}

.primary-button {
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--accent-strong);
  background: var(--accent);
  color: white;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,0.10);
  background: #121214;
  color: var(--ink);
  text-decoration: none;
}

.text-button:hover {
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.04);
}

.text-button.ghost {
  min-height: 34px;
  padding: 0 10px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.danger-button {
  padding: 0 14px;
  border: 1px solid rgba(217, 124, 124, 0.35);
  background: rgba(217,124,124,0.08);
  color: var(--rose);
}

.icon-button {
  display: inline-grid;
  width: 38px;
  min-width: 38px;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.10);
  background: #121214;
  color: var(--ink);
}

.icon-button:hover {
  background: rgba(255,255,255,0.04);
}

.main-area {
  min-width: 0;
  padding: 22px;
  overflow-x: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 860px;
  margin-bottom: 16px;
}

.topbar h2 {
  font-size: clamp(1.5rem, 1rem + 1.5vw, 2.3rem);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.export-status {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 7px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.export-status.error {
  border-color: rgba(217, 124, 124, 0.35);
  background: rgba(217,124,124,0.08);
  color: var(--rose);
}

#importJson {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.focus-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 860px;
  margin-bottom: 16px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.focus-strip > div {
  display: grid;
  grid-template-columns: 10px minmax(0, auto);
  gap: 7px 10px;
  align-items: center;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.focus-strip strong,
.focus-strip small {
  min-width: 0;
}

.focus-strip small {
  grid-column: 2;
  color: var(--muted);
}

.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(248px, 1fr));
  gap: 14px;
  min-width: 1180px;
  align-items: start;
}

.column {
  display: flex;
  flex-direction: column;
  min-height: 620px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius);
  /* Fundo levemente distinto do app pra coluna ser visivel mesmo vazia */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.012), rgba(255, 255, 255, 0)),
    var(--bg);
  position: relative;
  overflow: hidden;
}

/* Faixa colorida fina no topo de cada coluna (indica status visualmente) */
.column::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--muted);
  opacity: 0.5;
}
.column[data-status="mapeado"]::before        { background: rgba(255,255,255,0.20); }
.column[data-status="priorizado"]::before     { background: var(--accent); }
.column[data-status="desenvolvimento"]::before{ background: var(--blue); }
.column[data-status="revisao"]::before        { background: var(--orange); }
.column[data-status="concluido"]::before      { background: var(--green); }

.column.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 162, 79, 0.12);
}

.column-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 13px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  backdrop-filter: blur(10px);
}

/* Cor do titulo da coluna acompanha o status */
.column[data-status="priorizado"] .column-title h3      { color: var(--accent); }
.column[data-status="desenvolvimento"] .column-title h3 { color: var(--blue); }
.column[data-status="revisao"] .column-title h3         { color: var(--orange); }
.column[data-status="concluido"] .column-title h3       { color: var(--green); }

.column-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-title h3 {
  margin-bottom: 0;
  flex: 1;
  font-size: 0.95rem;
}

/* Icone do status (renderizado antes do titulo da coluna) */
.column-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(237, 237, 235, 0.55);
  flex: 0 0 auto;
}

.column[data-status="priorizado"]      .column-icon { color: var(--accent); background: rgba(201, 162, 79, 0.10); }
.column[data-status="desenvolvimento"] .column-icon { color: var(--blue);   background: rgba(111, 177, 255, 0.10); }
.column[data-status="revisao"]         .column-icon { color: var(--orange); background: rgba(245, 180, 80, 0.10); }
.column[data-status="concluido"]       .column-icon { color: var(--green);  background: rgba(111, 199, 132, 0.10); }

.count-pill {
  display: inline-flex;
  min-width: 28px;
  height: 25px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 900;
  font-size: 0.78rem;
}

/* ─── Member picker (dropdown customizado com foto + nome) ─────── */
.member-picker {
  position: relative;
}
.member-picker input {
  padding-right: 42px; /* espaço para o indicator */
}
.member-picker-indicator {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
}
.member-picker-indicator:empty::before {
  content: '▾';
  color: var(--muted);
  font-size: 12px;
}
.member-picker-indicator .single-avatar,
.member-picker-indicator .multi-avatar {
  border-radius: 50%;
  overflow: hidden;
}

.member-picker-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(201, 162, 79, 0.05);
  max-height: 280px;
  overflow-y: auto;
  z-index: 30;
  padding: 4px;
}
.member-picker-menu[hidden] { display: none; }

.member-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.12s;
}
.member-picker-item:hover { background: rgba(255, 255, 255, 0.05); }

.member-picker-item .single-avatar,
.member-picker-item .multi-avatar {
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

/* Single avatar (foto unica) */
.single-avatar {
  object-fit: cover;
}
.single-avatar.initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #b58a3f);
  color: #0a0a0b;
  font-weight: 800;
  font-size: 10px;
}

/* Multi avatar (3 fotos lado a lado pra "Renan, Gabriel e Rafael") */
.multi-avatar {
  display: inline-flex !important;
  align-items: center;
  gap: 3px;
  width: auto !important;
  background: transparent !important;
  border-radius: 0 !important;
  overflow: visible !important;
}
.multi-avatar img {
  width: 22px !important;
  height: 22px !important;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel);
}

.column-head p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.column-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

.empty-state {
  display: grid;
  flex: 1;
  min-height: 160px;
  place-items: center;
  padding: 18px 14px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: rgba(237, 237, 235, 0.42);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.012);
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}

.column.drag-over .empty-state {
  border-color: rgba(201, 162, 79, 0.45);
  color: var(--accent);
  background: rgba(201, 162, 79, 0.05);
}

.task-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  /* Safety: clipa qualquer conteudo que escape (long unbroken strings, etc.) */
  overflow: hidden;
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025) 0%, rgba(255,255,255,0.005) 100%),
    #0d0d0f;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.025) inset,
    0 8px 20px rgba(0,0,0,0.35);
  transition:
    transform 0.18s cubic-bezier(0.16,1,0.3,1),
    border-color 0.18s,
    box-shadow 0.18s,
    background 0.18s;
}
.task-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  border-radius: 11px 11px 0 0;
  background: linear-gradient(90deg, transparent 0%, rgba(201,162,79,0.45) 50%, transparent 100%);
  opacity: 0;
  transition: opacity 0.18s;
}
.task-card:hover {
  transform: translateY(-2px);
  border-color: rgba(201,162,79,0.30);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035) 0%, rgba(255,255,255,0.008) 100%),
    #111114;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 18px 36px -10px rgba(0,0,0,0.55),
    0 0 0 1px rgba(201,162,79,0.06);
}
.task-card:hover::before { opacity: 1; }

.task-card[aria-selected="true"] {
  border-color: rgba(201,162,79,0.45);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 0 0 1px rgba(201,162,79,0.20),
    0 12px 28px -8px rgba(0,0,0,0.55);
}

.task-card[draggable="true"] { cursor: grab; }
.task-card[draggable="true"]:active { cursor: grabbing; }

.task-card.dragging {
  opacity: 0.55;
  transform: rotate(1.5deg) scale(1.01);
}

/* Indicador de posicao de insercao durante drag-and-drop */
.task-card.drop-before {
  box-shadow: 0 -2px 0 0 var(--accent), 0 0 0 1px rgba(201, 162, 79, 0.35);
}
.task-card.drop-after {
  box-shadow: 0 2px 0 0 var(--accent), 0 0 0 1px rgba(201, 162, 79, 0.35);
}

/* Indicador de prioridade: pequena flag colorida ao lado do titulo.
   Renderizada via mask de um SVG (rod + flag triangular). */
.task-card::after {
  content: "";
  position: absolute;
  top: 14px; left: 12px;
  width: 12px; height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14'%3E%3Cpath d='M2.4 1.2v11.6' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3Cpath d='M2.4 2.4 L10.6 4.8 L2.4 7.2 Z' fill='black' stroke='black' stroke-width='0.5' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14'%3E%3Cpath d='M2.4 1.2v11.6' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3Cpath d='M2.4 2.4 L10.6 4.8 L2.4 7.2 Z' fill='black' stroke='black' stroke-width='0.5' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
  color: var(--orange);
  filter: drop-shadow(0 0 4px currentColor);
}
.task-card.priority-Alta::after  { color: var(--rose); }
.task-card.priority-Media::after { color: var(--orange); }
.task-card.priority-Baixa::after { color: var(--blue); }

.task-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: start;
  padding-left: 20px; /* compensa a flag ::after */
}

.task-card h4 {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--ink);
  /* Forca quebra mesmo em string longa sem espacos */
  overflow-wrap: anywhere;
  word-break: break-word;
  /* Truncate em 2 linhas com ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  /* Tooltip mostra o título completo no hover */
}

.mini-action {
  display: grid;
  width: 26px;
  height: 26px;
  min-height: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.15s;
}
.mini-action:hover {
  color: var(--accent);
  border-color: rgba(201,162,79,0.45);
  background: rgba(201,162,79,0.05);
}

/* ── Menu de acoes do card (chevron > dropdown) ─────────────────── */
.card-menu-toggle svg {
  display: block;
  transition: transform 0.15s ease;
}

.card-menu-toggle.active {
  color: var(--accent);
  border-color: rgba(201, 162, 79, 0.45);
  background: rgba(201, 162, 79, 0.05);
}
.card-menu-toggle.active svg {
  transform: rotate(-180deg);
}

.card-menu {
  position: fixed;
  z-index: 100;
  min-width: 158px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  background: #121214;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.02);
  animation: card-menu-pop 140ms cubic-bezier(0.2, 0.8, 0.25, 1);
}

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

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

.card-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(237, 237, 235, 0.85);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.card-menu-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
}

.card-menu-item.danger {
  color: var(--rose);
}
.card-menu-item.danger:hover {
  background: rgba(217, 124, 124, 0.10);
}

.card-menu-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  font-size: 0.85rem;
  color: var(--muted);
}
.card-menu-item.danger .card-menu-icon {
  color: var(--rose);
}

.meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-left: 20px;
}

.chip {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.5;
  text-transform: lowercase;
  /* Trunca textos muito longos pra nao quebrar o chip */
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}

.chip.owner::before {
  background: var(--blue);
}

.chip.front::before {
  background: var(--green);
}

.chip.priority::before {
  background: var(--orange);
}

.chip.priority.Alta::before {
  background: var(--rose);
}

.chip.priority.Baixa::before {
  background: var(--blue);
}

.notes {
  margin: 0;
  padding-left: 20px;
  color: rgba(237,237,235,0.62);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-line;
  /* Forca quebra mesmo em string longa sem espacos (ex: aaaa...) */
  overflow-wrap: anywhere;
  word-break: break-word;
  /* Truncate em 3 linhas com ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.next-action {
  margin-left: 20px;
  padding: 8px 11px;
  border-radius: 7px;
  border-left: 2px solid var(--accent);
  background: rgba(201, 162, 79, 0.06);
  color: rgba(237, 237, 235, 0.88);
  font-size: 0.8rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
  /* Trava em 2 linhas pra nao estourar a altura do card */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.next-action strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding: 8px 0 0 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* Quick-move antigo (botoes < e >) removido: agora o card-footer
   mostra avatares do responsavel. */

.card-owners {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.card-owner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--bg);
}
.card-owner-single {
  width: 26px; height: 26px;
  object-fit: cover;
  background: var(--panel);
}
.card-owner-initials {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, var(--accent), #b58a3f);
  color: #0a0a0b;
  font-weight: 800;
  font-size: 10px;
}
.card-owner-multi {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: none;
}
.card-owner-multi img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--bg);
}

/* ────────────────────────────────────────────────────────────────
   Modal de edicao do card
   ──────────────────────────────────────────────────────────────── */

dialog {
  width: min(640px, calc(100vw - 28px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.edit-dialog[open] {
  animation: modal-pop 180ms cubic-bezier(0.2, 0.8, 0.25, 1);
}
.edit-dialog[open]::backdrop {
  animation: modal-fade 180ms ease-out;
}

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  padding: 22px 24px 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(201, 162, 79, 0.06), transparent 55%),
    var(--panel);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.02);
}

/* ── Cabecalho do modal ─────────────────────────────────────────── */
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-head-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(237, 237, 235, 0.85);
}

.modal-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.30);
  box-shadow: 0 0 8px currentColor;
}
.modal-status-badge[data-status="mapeado"]         { color: rgba(237, 237, 235, 0.75); }
.modal-status-badge[data-status="mapeado"] .modal-status-dot         { background: rgba(255, 255, 255, 0.55); }
.modal-status-badge[data-status="priorizado"]      { color: var(--accent); border-color: rgba(201, 162, 79, 0.30); background: rgba(201, 162, 79, 0.08); }
.modal-status-badge[data-status="priorizado"] .modal-status-dot      { background: var(--accent); }
.modal-status-badge[data-status="desenvolvimento"] { color: var(--blue);   border-color: rgba(111, 177, 255, 0.25); background: rgba(111, 177, 255, 0.06); }
.modal-status-badge[data-status="desenvolvimento"] .modal-status-dot { background: var(--blue); }
.modal-status-badge[data-status="revisao"]         { color: var(--orange); border-color: rgba(245, 180, 80, 0.25); background: rgba(245, 180, 80, 0.06); }
.modal-status-badge[data-status="revisao"] .modal-status-dot         { background: var(--orange); }
.modal-status-badge[data-status="concluido"]       { color: var(--green);  border-color: rgba(111, 199, 132, 0.25); background: rgba(111, 199, 132, 0.06); }
.modal-status-badge[data-status="concluido"] .modal-status-dot       { background: var(--green); }

.modal-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-close {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 10px;
  font-size: 1.1rem;
}

/* ── Botao + painel de log de edicoes ──────────────────────────── */
.modal-log-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: transparent;
  color: rgba(237, 237, 235, 0.62);
  font-size: 0.82rem;
  font-weight: 750;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.modal-log-toggle:hover {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
}
.modal-log-toggle[aria-expanded="true"] {
  color: var(--accent);
  border-color: rgba(201, 162, 79, 0.32);
  background: rgba(201, 162, 79, 0.06);
}
.modal-log-toggle svg {
  flex: 0 0 13px;
}

.modal-log-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}
.modal-log-panel[hidden] {
  display: none;
}

.modal-log-avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  object-fit: cover;
  flex: 0 0 36px;
}
img.modal-log-avatar {
  object-fit: cover;
}

.modal-log-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.modal-log-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ink);
}
.modal-log-meta {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
}
.modal-log-email {
  font-size: 0.72rem;
  color: rgba(237, 237, 235, 0.42);
}
.modal-log-empty {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Titulo grande inline ───────────────────────────────────────── */
.modal-title-input {
  width: 100%;
  min-height: auto;
  margin-bottom: 4px;
  padding: 4px 0 10px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
  transition: border-color 160ms ease;
}

.modal-title-input::placeholder {
  color: rgba(237, 237, 235, 0.25);
  font-weight: 700;
}

.modal-title-input:focus {
  border-bottom-color: var(--accent);
  box-shadow: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Corpo do modal (scroll quando necessario) ──────────────────── */
.modal-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 14px;
  padding-right: 4px;
  overflow-y: auto;
}

.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.14);
}

.modal-section .field-label {
  margin: 0 0 8px;
}

.modal-section .form-row {
  gap: 12px;
}

/* ── Pill segmented control (status + prioridade) ───────────────── */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.pill {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: rgba(237, 237, 235, 0.55);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  white-space: nowrap;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 80ms ease;
}

.pill:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.03);
}

.pill:active {
  transform: translateY(0.5px);
}

.pill.active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

/* Pontinhos coloridos ── */
.pill .pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  flex: 0 0 7px;
}

/* Status pills ── cor do dot por status, com cor reforcada no ativo */
.status-pill[data-status="mapeado"] .pill-dot         { color: rgba(255, 255, 255, 0.55); }
.status-pill[data-status="priorizado"] .pill-dot      { color: var(--accent); }
.status-pill[data-status="desenvolvimento"] .pill-dot { color: var(--blue); }
.status-pill[data-status="revisao"] .pill-dot         { color: var(--orange); }
.status-pill[data-status="concluido"] .pill-dot       { color: var(--green); }

.status-pill[data-status="priorizado"].active      { color: var(--accent); background: rgba(201, 162, 79, 0.10); border-color: rgba(201, 162, 79, 0.32); }
.status-pill[data-status="desenvolvimento"].active { color: var(--blue);   background: rgba(111, 177, 255, 0.10); border-color: rgba(111, 177, 255, 0.30); }
.status-pill[data-status="revisao"].active         { color: var(--orange); background: rgba(245, 180, 80, 0.10); border-color: rgba(245, 180, 80, 0.30); }
.status-pill[data-status="concluido"].active       { color: var(--green);  background: rgba(111, 199, 132, 0.10); border-color: rgba(111, 199, 132, 0.30); }

/* Priority pills - bolinha vira flag colorida */
.priority-pill .pill-dot {
  width: 10px;
  height: 12px;
  border-radius: 0;
  background: currentColor;
  box-shadow: none;
  flex: 0 0 10px;
  -webkit-mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14'%3E%3Cpath d='M2.4 1.2v11.6' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3Cpath d='M2.4 2.4 L10.6 4.8 L2.4 7.2 Z' fill='black' stroke='black' stroke-width='0.5' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14'%3E%3Cpath d='M2.4 1.2v11.6' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3Cpath d='M2.4 2.4 L10.6 4.8 L2.4 7.2 Z' fill='black' stroke='black' stroke-width='0.5' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
  filter: drop-shadow(0 0 3px currentColor);
}
.pill-dot-alta  { color: var(--rose); }
.pill-dot-media { color: var(--orange); }
.pill-dot-baixa { color: var(--blue); }

.priority-pill[data-value="Alta"].active  { color: var(--rose);   background: rgba(217, 124, 124, 0.10); border-color: rgba(217, 124, 124, 0.30); }
.priority-pill[data-value="Media"].active { color: var(--orange); background: rgba(245, 180, 80, 0.10);  border-color: rgba(245, 180, 80, 0.30); }
.priority-pill[data-value="Baixa"].active { color: var(--blue);   background: rgba(111, 177, 255, 0.10); border-color: rgba(111, 177, 255, 0.30); }

/* ── Proxima acao com borda de destaque ─────────────────────────── */
.next-action-input {
  position: relative;
  border-left: 2px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: rgba(201, 162, 79, 0.06);
}

.next-action-input input {
  border: 1px solid transparent;
  border-radius: 0 8px 8px 0;
  background: transparent;
}

.next-action-input input:focus {
  border-color: var(--accent);
  background: rgba(201, 162, 79, 0.10);
}

/* ── Rodape de acoes ────────────────────────────────────────────── */
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-actions-left,
.modal-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Botao Salvar (primary com brilho dourado e icone) ─────────── */
.modal-actions .primary-button,
.modal-save {
  width: auto;
  margin-top: 0;
  padding: 0 18px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--accent-strong);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(0,0,0,0)),
    linear-gradient(135deg, var(--accent), #b88a3c);
  color: #1a1208;
  font-weight: 850;
  letter-spacing: -0.005em;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 8px 22px -8px rgba(201, 162, 79, 0.45);
  transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.15s ease;
}
.modal-save:hover {
  filter: brightness(1.05);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 10px 26px -8px rgba(201, 162, 79, 0.55);
}
.modal-save:active {
  transform: translateY(0.5px);
}
.modal-save svg {
  flex: 0 0 14px;
}

/* ── Botao Cancelar (ghost minimalista) ─────────────────────────── */
.modal-actions .text-button.ghost {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(237, 237, 235, 0.62);
  font-weight: 700;
}
.modal-actions .text-button.ghost:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

/* ── Botao Excluir (icone + texto, danger sutil) ────────────────── */
.modal-delete {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(217, 124, 124, 0.20);
  border-radius: 9px;
  background: transparent;
  color: rgba(217, 124, 124, 0.78);
  font-weight: 750;
}
.modal-delete:hover {
  color: var(--rose);
  background: rgba(217, 124, 124, 0.08);
  border-color: rgba(217, 124, 124, 0.45);
}
.modal-delete svg {
  flex: 0 0 14px;
}

/* ── Botao "Abrir quadro branco" dentro do modal de edicao ────── */
.whiteboard-open {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 11px;
  background:
    linear-gradient(135deg, rgba(201, 162, 79, 0.04), rgba(255, 255, 255, 0.01));
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.12s;
}
.whiteboard-open:hover {
  border-color: rgba(201, 162, 79, 0.40);
  background:
    linear-gradient(135deg, rgba(201, 162, 79, 0.10), rgba(201, 162, 79, 0.02));
}
.whiteboard-open:active {
  transform: translateY(0.5px);
}

.whiteboard-open-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(201, 162, 79, 0.10);
  color: var(--accent);
  flex: 0 0 34px;
}

.whiteboard-open-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.whiteboard-open-text strong {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.whiteboard-open-hint {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
}

.whiteboard-open-arrow {
  font-size: 1rem;
  font-weight: 800;
  color: var(--muted);
  transition: transform 0.18s ease, color 0.18s ease;
}
.whiteboard-open:hover .whiteboard-open-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ── Dialog do quadro branco (Excalidraw) ───────────────────────── */
.whiteboard-dialog {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.whiteboard-dialog::backdrop {
  background: rgba(0, 0, 0, 0.85);
}

.whiteboard-shell {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  background: #0d0d0f;
  color: var(--ink);
}

.whiteboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--panel);
}

.whiteboard-head-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.whiteboard-head-meta strong {
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.005em;
}

.whiteboard-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.whiteboard-save-status {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.whiteboard-root {
  flex: 1;
  position: relative;
  min-height: 0;
  background: #0d0d0f;
}

.whiteboard-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

/* Excalidraw container - ocupa todo o espaco do root */
.whiteboard-root .excalidraw,
.whiteboard-root > div:not(.whiteboard-loading) {
  width: 100%;
  height: 100%;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(201, 162, 79, 0.22);
  border-radius: 8px;
  background: #0a0a0b;
  color: white;
  box-shadow: var(--shadow);
  font-weight: 800;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main-area {
    padding: 16px;
  }

  .topbar,
  .focus-strip {
    min-width: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    justify-content: flex-start;
  }

  .board {
    display: flex;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
  }

  .column {
    min-width: 280px;
    scroll-snap-align: start;
  }
}

@media (max-width: 560px) {
  .sidebar,
  .main-area {
    padding: 14px;
  }

  .form-row,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .focus-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .focus-strip .text-button {
    width: 100%;
  }

  .modal-card {
    padding: 18px;
  }

  .modal-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .modal-actions > div,
  .danger-button,
  .modal-actions .primary-button,
  .modal-actions .text-button {
    width: 100%;
  }

  .modal-actions > div {
    flex-direction: column;
  }

  .pill {
    flex: 1 1 calc(50% - 6px);
  }
}
