/* Parte partilhada com o site (mapa-decisao.css). */
/* SRIS · Mapa da decisão. Vista partilhada; as cores vêm de variáveis em .dmap. */

.dmap {
  --dm-bg: #141e18;
  --dm-card: rgba(249, 245, 232, .055);
  --dm-card-strong: rgba(249, 245, 232, .09);
  --dm-line: rgba(249, 245, 232, .16);
  --dm-ink: #f9f5e8;
  --dm-muted: #c3cdbf;
  --dm-soft: #9fae9d;
  --dm-accent: #f8b96c;
  --dm-hit: #ff8a6e;
  --dm-hit-bg: rgba(255, 138, 110, .13);
  --dm-ok: #a4cca0;
  --dm-path: rgba(249, 245, 232, .22);
  --dm-serif: var(--serif, Georgia, 'Times New Roman', serif);
  position: relative;
  color: var(--dm-ink);
  font-family: var(--sans, system-ui, sans-serif);
}

.dmap [hidden] { display: none !important; }

/* ---------- cabeçalho */
.dmap-head { max-width: 920px; }
.dmap-kicker {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 12px; color: var(--dm-accent);
  font-size: .72rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase;
}
.dmap-kicker::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--dm-accent); box-shadow: 0 0 0 5px rgba(248, 185, 108, .18);
  animation: dmap-beat 2.4s ease-in-out infinite;
}
.dmap-decision {
  margin: 0; color: var(--dm-ink); outline: none;
  font-family: var(--dm-serif); font-weight: 400;
  font-size: clamp(1.75rem, 3.4vw, 2.9rem); line-height: 1.08; letter-spacing: -.04em;
}
.dmap-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 16px 0 0; color: var(--dm-muted); font-size: .86rem; }
.dmap-meta span { display: inline-flex; align-items: center; gap: 8px; }
.dmap-deadline::before { content: "◷"; color: var(--dm-accent); }

/* ---------- veredicto */
.dmap-verdict {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: clamp(16px, 3vw, 34px);
  margin: 28px 0 6px; padding: 20px clamp(18px, 3vw, 30px);
  border: 1px solid rgba(255, 138, 110, .42); border-radius: 14px;
  background: linear-gradient(115deg, rgba(255, 138, 110, .16), rgba(248, 185, 108, .06) 60%, transparent);
  animation: dmap-rise .45s cubic-bezier(.2, .8, .2, 1) both;
}
.dmap-count { display: flex; align-items: baseline; gap: 8px; }
.dmap-count b {
  font-family: var(--dm-serif); font-weight: 400; color: var(--dm-hit);
  font-size: clamp(3.2rem, 6vw, 4.6rem); line-height: .9; letter-spacing: -.05em; font-variant-numeric: tabular-nums;
}
.dmap-count span { color: var(--dm-muted); font-size: .9rem; }
.dmap-verdict-body { min-width: 0; }
.dmap-verdict-kicker { margin: 0 0 4px; color: var(--dm-accent); font-size: .7rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.dmap-verdict-body strong { display: block; font-size: clamp(1rem, 1.6vw, 1.18rem); font-weight: 650; line-height: 1.4; }
.dmap-verdict-body p:not(.dmap-verdict-kicker) { margin: 6px 0 0; color: var(--dm-muted); font-size: .88rem; line-height: 1.5; }
.dmap-reset {
  align-self: start; border: 1px solid var(--dm-line); border-radius: 999px; background: transparent;
  color: var(--dm-ink); padding: 8px 14px; font-size: .8rem; font-weight: 650; white-space: nowrap;
}
.dmap-reset:hover { border-color: var(--dm-ink); }

/* ---------- tabuleiro */
.dmap-board {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) clamp(70px, 10vw, 150px) minmax(0, 1.18fr);
  margin-top: 30px; align-items: start;
}
.dmap-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 0; }
.dmap-col { position: relative; z-index: 1; display: grid; gap: 12px; min-width: 0; }
.dmap-col-title { margin: 0 0 4px; color: var(--dm-soft); font-size: .7rem; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
.dmap-spine { position: relative; align-self: stretch; }
.dmap-spine::before {
  content: ""; position: absolute; left: 50%; top: 30px; bottom: 0; width: 1px;
  background: linear-gradient(var(--dm-line), transparent); opacity: .5;
}

.dmap-path {
  fill: none; stroke: var(--dm-path); stroke-width: 1.4; stroke-linecap: round;
  stroke-dasharray: 2000; stroke-dashoffset: 2000;
  transition: stroke .25s, stroke-width .25s, opacity .25s;
}
.dmap.is-drawn .dmap-path { animation: dmap-draw 1.1s cubic-bezier(.4, 0, .2, 1) .25s forwards; }
.dmap .dmap-path.is-static { animation: none; stroke-dashoffset: 0; }
.dmap .dmap-path.is-hot { stroke: var(--dm-hit); stroke-width: 2.4; stroke-dasharray: 7 7; stroke-dashoffset: 0; animation: dmap-flow .7s linear infinite; filter: drop-shadow(0 0 6px rgba(255, 138, 110, .55)); }
.dmap .dmap-path.is-dim { opacity: .18; }

/* ---------- nós */
.dmap-node {
  position: relative; padding: 15px 16px 14px; border: 1px solid var(--dm-line); border-radius: 12px;
  background: var(--dm-card); backdrop-filter: blur(6px);
  transition: border-color .3s, background .3s, opacity .3s, transform .3s, box-shadow .3s;
  animation: dmap-rise .55s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--i, 0) * 70ms + 80ms);
}
.dmap-node[data-stated="false"] { border-style: dashed; }
.dmap-tag { display: block; margin-bottom: 6px; color: var(--dm-soft); font-size: .66rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.dmap-label { display: block; font-size: 1rem; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; }
.dmap-value, .dmap-owner, .dmap-why, .dmap-deps { margin: 6px 0 0; color: var(--dm-muted); font-size: .84rem; line-height: 1.45; }
.dmap-owner { color: var(--dm-ink); opacity: .82; font-size: .8rem; }
.dmap-deps { color: var(--dm-soft); font-size: .74rem; }
.dmap-state:empty { display: none; }
.dmap-state {
  display: inline-flex; align-items: center; gap: 7px; margin: 10px 0 0; padding: 4px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 750;
}

.dmap-whatif {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; padding: 9px 12px; border: 1px solid rgba(248, 185, 108, .45); border-radius: 9px;
  background: rgba(248, 185, 108, .08); color: var(--dm-accent); text-align: left;
  font-size: .84rem; font-weight: 700; line-height: 1.3; transition: background .2s, color .2s, transform .15s;
}
.dmap-whatif small { color: var(--dm-soft); font-size: .7rem; font-weight: 650; white-space: nowrap; }
.dmap-whatif:hover { background: rgba(248, 185, 108, .18); transform: translateY(-1px); }
.dmap-whatif[aria-pressed="true"] { background: var(--dm-accent); color: #1a1408; }
.dmap-whatif[aria-pressed="true"] small { color: #3b2c12; }

/* estados da cascata */
.dmap-cond.is-changed {
  border-color: var(--dm-accent); background: rgba(248, 185, 108, .1);
  box-shadow: 0 0 0 1px var(--dm-accent), 0 0 32px rgba(248, 185, 108, .28); animation: dmap-shake .5s ease;
}
.dmap-cond.is-quiet { opacity: .42; }
.dmap-item.is-hit {
  border-color: var(--dm-hit); background: var(--dm-hit-bg); transform: translateX(4px);
  box-shadow: inset 3px 0 0 var(--dm-hit), 0 10px 34px rgba(255, 138, 110, .16);
}
.dmap-item.is-hit .dmap-state { background: var(--dm-hit); color: #23100b; }
.dmap-item.is-hit .dmap-why { color: var(--dm-ink); }
.dmap-item.is-clear { opacity: .5; }
.dmap-item.is-clear .dmap-state { border: 1px solid var(--dm-line); color: var(--dm-muted); }
.dmap-item.is-new { border-style: solid; border-color: var(--dm-accent); }
.dmap-item.is-new .dmap-tag { color: var(--dm-accent); }

/* ---------- rodapé */
.dmap-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 34px; }
.dmap-foot section { padding: 18px 20px; border: 1px solid var(--dm-line); border-radius: 12px; background: var(--dm-card); }
.dmap-foot h3 { margin: 0 0 8px; color: var(--dm-soft); font-size: .7rem; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
.dmap-foot p { margin: 0; color: var(--dm-ink); font-size: .95rem; line-height: 1.5; }
.dmap-missing { border-color: rgba(248, 185, 108, .4) !important; }
.dmap-impact { grid-column: 1 / -1; }
.dmap-impact dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; }
.dmap-impact dt { color: var(--dm-accent); font-size: .74rem; font-weight: 800; letter-spacing: .08em; }
.dmap-impact dd { margin: 5px 0 0; color: var(--dm-muted); font-size: .86rem; line-height: 1.5; }

/* ---------- formulários dentro do mapa */
.dmap form label { display: block; margin: 0; }
.dmap textarea {
  width: 100%; min-width: 0; min-height: 52px; padding: 11px 13px; border: 1px solid var(--dm-line); border-radius: 10px;
  background: rgba(0, 0, 0, .18); color: var(--dm-ink); font: inherit; font-size: .92rem; line-height: 1.45; resize: vertical;
}
.dmap textarea::placeholder { color: var(--dm-soft); }
.dmap textarea:focus { outline: 2px solid var(--dm-accent); outline-offset: 1px; border-color: transparent; }
.dmap-answer { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.dmap-primary, .dmap-ghost {
  border-radius: 10px; padding: 11px 16px; font-size: .88rem; font-weight: 750; white-space: nowrap; align-self: stretch;
}
.dmap-primary { border: 0; background: var(--dm-accent); color: #1a1408; }
.dmap-primary:hover { filter: brightness(1.08); }
.dmap-ghost { border: 1px solid var(--dm-line); background: transparent; color: var(--dm-ink); }
.dmap-ghost:hover { border-color: var(--dm-ink); }
.dmap-actions { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-top: 24px; }
.dmap-actions.is-single { grid-template-columns: minmax(0, 1fr); }
.dmap-change, .dmap-save { padding: 18px 20px; border: 1px solid var(--dm-line); border-radius: 12px; background: var(--dm-card-strong); }
.dmap-change-label { color: var(--dm-ink) !important; font-size: 1.05rem !important; font-weight: 700; }
.dmap-change-hint, .dmap-save p { margin: 4px 0 12px; color: var(--dm-muted); font-size: .85rem; line-height: 1.5; }
.dmap-change-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.dmap-save { display: flex; flex-direction: column; justify-content: space-between; }
.dmap-save .dmap-primary { align-self: flex-start; }

/* ---------- palco no site */
.dmap-stage { position: relative; padding: clamp(10px, 2vw, 24px) 0 clamp(48px, 6vw, 84px); border-top: 1px solid rgba(249, 245, 232, .08); scroll-margin-top: 80px; }
.dmap-stage[hidden] { display: none !important; }
.dmap-wrap { padding-top: clamp(26px, 3.4vw, 44px); }
.dmap-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.dmap-origin { margin: 0; color: #c3cdbf; font-size: .82rem; line-height: 1.5; }
.dmap-badge { display: inline-block; margin-right: 6px; padding: 3px 9px; border: 1px solid rgba(248, 185, 108, .45); border-radius: 999px; color: #f8b96c; font-size: .7rem; font-weight: 750; }
.dmap-quiet { border: 1px solid rgba(249, 245, 232, .2); border-radius: 999px; background: transparent; color: #f9f5e8; padding: 8px 14px; font-size: .8rem; font-weight: 650; white-space: nowrap; }
.dmap-quiet:hover { border-color: #f9f5e8; }

.dmap-building { display: grid; justify-items: center; gap: 14px; padding: clamp(40px, 7vw, 90px) 0; text-align: center; color: #f9f5e8; }
.dmap-orbit { position: relative; width: 120px; height: 120px; }
.dmap-orbit::before {
  content: ""; position: absolute; inset: 42px; border-radius: 50%; background: #f8b96c;
  box-shadow: 0 0 40px rgba(248, 185, 108, .6); animation: dmap-beat 1.6s ease-in-out infinite;
}
.dmap-orbit span {
  position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4.5px; border-radius: 50%; background: #a4cca0;
  transform: rotate(calc(var(--i) * 51.4deg)) translateX(54px);
  animation: dmap-orbit 3.2s linear infinite; animation-delay: calc(var(--i) * -.45s);
}
.dmap-building-step { margin: 8px 0 0; font-family: var(--serif, Georgia, serif); font-size: clamp(1.25rem, 2.4vw, 1.7rem); letter-spacing: -.02em; }
.dmap-building-quote { max-width: 640px; margin: 0; color: #9fae9d; font-size: .9rem; font-style: italic; line-height: 1.5; }

/* ---------- animações */
@keyframes dmap-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes dmap-draw { to { stroke-dashoffset: 0; } }
@keyframes dmap-flow { to { stroke-dashoffset: -28; } }
@keyframes dmap-beat { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.82); opacity: .75; } }
@keyframes dmap-orbit { from { transform: rotate(0deg) translateX(54px); } to { transform: rotate(360deg) translateX(54px); } }
@keyframes dmap-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-3px); } 50% { transform: translateX(3px); } 75% { transform: translateX(-2px); } }

@media (prefers-reduced-motion: reduce) {
  .dmap *, .dmap-building * { animation: none !important; transition: none !important; }
  .dmap-path { stroke-dashoffset: 0; }
}

/* ---------- ecrãs estreitos: uma coluna, dependências escritas */
@media (max-width: 860px) {
  .dmap-board { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .dmap-spine, .dmap-links { display: none; }
  .dmap-verdict { grid-template-columns: auto 1fr; }
  .dmap-reset { grid-column: 1 / -1; justify-self: start; }
  .dmap-foot, .dmap-actions { grid-template-columns: minmax(0, 1fr); }
  .dmap-impact dl { grid-template-columns: minmax(0, 1fr); }
  .dmap-item.is-hit { transform: none; }
  .dmap-toolbar { flex-direction: column; align-items: flex-start; }
}
@media (min-width: 861px) {
  .dmap-deps { display: none; }
}
@media (max-width: 480px) {
  .dmap-answer, .dmap-change-row { grid-template-columns: minmax(0, 1fr); }
  .dmap-verdict { padding: 16px; }
}

/* ---------- estado do trabalho e edição */
.dmap-status { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: .62rem; letter-spacing: .06em; }
.dmap-item[data-status="a_rever"] { border-color: var(--dm-hit); box-shadow: inset 3px 0 0 var(--dm-hit); }
.dmap-item[data-status="a_rever"] .dmap-status { background: var(--dm-hit); color: #23100b; }
.dmap-item[data-status="feito"] { opacity: .66; }
.dmap-item[data-status="feito"] .dmap-label { text-decoration: line-through; text-decoration-thickness: 1px; }
.dmap-item[data-status="feito"] .dmap-status { background: var(--dm-ok); color: #102414; }
.dmap-empty { margin: 0; padding: 16px; border: 1px dashed var(--dm-line); border-radius: 12px; color: var(--dm-soft); font-size: .86rem; line-height: 1.5; }
.dmap-add { padding: 11px 14px; border: 1px dashed var(--dm-line); border-radius: 12px; background: transparent; color: var(--dm-muted); font-size: .86rem; font-weight: 700; text-align: left; }
.dmap-add:hover { border-color: var(--dm-accent); color: var(--dm-accent); }

/* Mapa da decisão dentro da aplicação: um palco escuro, igual ao do site. */
.dmap-app-panel { margin: 14px 0 18px; }
.dmap-app-panel[hidden] { display: none !important; }
.dmap-app-stage {
  position: relative;
  padding: clamp(20px, 3vw, 36px);
  border-radius: 18px;
  background: radial-gradient(ellipse at 85% 0%, #2c3f33, transparent 60%), #141e18;
  color: #f9f5e8;
  overflow: hidden;
}
.dmap-app-stage .dmap-decision, .dmap-app-stage h2, .dmap-app-stage h3 { color: #f9f5e8; }
.dmap-app-stage button { box-shadow: none; text-transform: none; letter-spacing: normal; }
.dmap-app-stage .dmap-col-title, .dmap-app-stage .dmap-foot h3, .dmap-app-stage .dmap-history h3 { color: #9fae9d; }
.dmap-app-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; justify-content: space-between; margin-bottom: 22px; }
.dmap-app-top .dmap-origin { flex: 1 1 260px; }
.dmap-stale { margin: 0; padding: 5px 10px; border-radius: 999px; background: rgba(248, 185, 108, .14); color: #f8b96c; font-size: .78rem; font-weight: 700; }
.dmap-app-loading { margin: 0; color: #c3cdbf; }
.dmap-app-empty { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; }
.dmap-app-empty .dmap-kicker { color: #f8b96c; margin-bottom: 6px; }
.dmap-app-empty .dmap-primary { padding: 12px 20px; font-size: .92rem; }
.dmap-app-panel:has(.dmap-app-empty) .dmap-app-stage { padding: 18px 22px; }
.dmap-app-lead { margin: 0; color: #c3cdbf; font-size: 1rem; line-height: 1.6; }
.dmap-app-note { margin: 0; color: #9fae9d; font-size: .82rem; }
.dmap-app-status { margin: 10px 2px 0; font-size: .85rem; color: #45604b; }
.dmap-app-status:empty { display: none; }
.dmap-app-status[data-error="true"] { color: #9a3a2c; }

.dmap-history { margin-top: 18px; padding: 18px 20px; border: 1px solid rgba(249, 245, 232, .16); border-radius: 12px; }
.dmap-history h3 { margin: 0 0 10px; font-size: .7rem; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
.dmap-history ol { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.dmap-history li { display: grid; gap: 3px; padding-left: 14px; border-left: 2px solid #ff8a6e; }
.dmap-history-when { color: #9fae9d; font-size: .72rem; }
.dmap-history strong { font-size: .95rem; }
.dmap-history p { margin: 0; color: #c3cdbf; font-size: .86rem; line-height: 1.5; }
.dmap-history small { color: #f8b96c; font-size: .74rem; font-weight: 700; }
.dmap-history-empty { color: #9fae9d !important; }

/* Ligação para a app essencial, na navegação da app avançada. */
.nav .nav-essential {
  display: flex; min-height: 44px; align-items: center; gap: 11px; margin-top: 6px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(248, 185, 108, .35); color: #f8b96c; font-size: 13px; font-weight: 700; text-decoration: none;
}
.nav .nav-essential:hover { background: rgba(248, 185, 108, .1); }
