:root {
  --bg: #0A0B0D;
  --teal: #22A6B4;
  --teal-bright: #46C9D6;
  --teal-light: #6FE0EA;
  --ink: #F1EFE9;
  --muted: #8C9A9B;
  --divider: #23292B;
  --tile: #101316;
  --tile-line: rgba(34,166,180,0.55);
  --panel: #0E1114;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.45;
  min-height: 100vh;
}
a { color: inherit; }

.page {
  max-width: 1480px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 56px) clamp(20px, 4vw, 72px) clamp(24px, 3vw, 48px);
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 24px);
}
.topbar .logo {
  width: clamp(52px, 5.5vw, 78px);
  height: clamp(52px, 5.5vw, 78px);
  border-radius: 22%;
  flex: 0 0 auto;
  display: block;
  border: 1px solid var(--divider);
}
.topbar .title {
  font-size: clamp(24px, 4.4vw, 54px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.04;
  margin: 0;
  text-wrap: balance;
}
.topbar .title .brand { color: var(--teal-bright); }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.btn:hover { border-color: var(--tile-line); }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  color: #06262b;
  background: var(--teal-bright);
  border-color: var(--teal-bright);
}
.btn-primary:hover { background: var(--teal-light); border-color: var(--teal-light); }
.btn-ghost { color: var(--muted); border-color: transparent; padding-left: 8px; padding-right: 8px; }
.btn-ghost:hover { color: var(--ink); border-color: transparent; }
body.is-editing .when-view { display: none !important; }
body:not(.is-editing) .when-edit { display: none !important; }

.rule { height: 1px; background: var(--divider); border: 0; margin: clamp(20px, 3vw, 36px) 0 0; }

/* ===========================================================================
   TIMELINE
   =========================================================================== */
.timeline {
  position: relative;
  display: flex;
  align-items: center;
  /* fixed clearance so the up/down labels never collide with the header/strategy */
  margin: 340px 0;
}
.node {
  position: relative;
  flex: 0 0 auto;
  width: clamp(64px, 6vw, 86px);
  height: clamp(64px, 6vw, 86px);
  cursor: pointer;
}
.tile {
  width: 100%;
  height: 100%;
  border-radius: 22%;
  background: var(--tile);
  border: 1.5px solid var(--tile-line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal-bright);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.node:hover .tile {
  border-color: var(--teal-light);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -12px rgba(70,201,214,0.45);
}
.tile svg { width: 52%; height: 52%; display: block; }

.connector {
  flex: 1 1 auto;
  height: 1.5px;
  background: var(--teal);
  position: relative;
  align-self: center;
}
.connector::after {
  content: "";
  position: absolute;
  right: 0; top: 50%;
  width: 9px; height: 9px;
  border-top: 1.5px solid var(--teal);
  border-right: 1.5px solid var(--teal);
  transform: translate(0, -50%) rotate(45deg);
}
.timeline > .connector:last-child { flex: 0 0 clamp(180px, 17vw, 260px); }

.lead {
  position: absolute;
  left: 50%;
  width: 1.5px;
  background: var(--teal);
  transform: translateX(-50%);
}
.lead::before {
  content: "";
  position: absolute;
  left: 50%;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--teal-bright);
  transform: translateX(-50%);
}
.node.up .lead { bottom: 100%; height: clamp(74px, 8vw, 104px); }
.node.up .lead::before { top: -4px; }
.node.down .lead { top: 100%; height: clamp(74px, 8vw, 104px); }
.node.down .lead::before { bottom: -4px; }

.label {
  position: absolute;
  left: -4px;
  width: clamp(200px, 16vw, 248px);
  text-align: left;
}
.node.up .label { bottom: calc(100% + clamp(86px, 9.4vw, 122px)); }
.node.down .label { top: calc(100% + clamp(86px, 9.4vw, 122px)); }
.label .lbl-title { font-size: clamp(15px, 1.18vw, 18px); font-weight: 700; letter-spacing: 0.03em; color: var(--ink); margin: 0 0 8px; }
.label .lbl-desc { font-size: clamp(13px, 1vw, 15px); color: var(--muted); margin: 0 0 8px; text-wrap: pretty; }
.label .lbl-tool { font-size: clamp(13px, 1vw, 15px); font-weight: 700; color: var(--teal-bright); margin: 0; }
.label .lbl-tool.accent { color: var(--teal-light); }
.label .lbl-extra { font-size: clamp(12px, 0.95vw, 14px); color: var(--muted); margin: 6px 0 0; }
.label .lbl-more { font-size: 12px; color: var(--muted); margin: 10px 0 0; opacity: 0; transition: opacity .18s; }
.node:hover .lbl-more { opacity: 1; color: var(--teal-bright); }

/* ---------- Strategic decisions ---------- */
.strategy { margin-top: clamp(40px, 5vw, 70px); border-top: 1px solid var(--divider); padding-top: clamp(28px, 4vw, 48px); }
.strategy h2 { text-align: center; font-size: clamp(16px, 1.5vw, 20px); font-weight: 700; letter-spacing: 0.16em; color: var(--ink); margin: 0 0 clamp(26px, 3.5vw, 44px); }
.strategy-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(24px, 3vw, 48px); }
.strat-item { display: flex; gap: 16px; align-items: flex-start; }
.strat-item .ico { flex: 0 0 auto; width: 30px; height: 30px; color: var(--teal-bright); margin-top: 2px; }
.strat-item .ico svg { width: 100%; height: 100%; display: block; }
.strat-item .term { font-size: clamp(14px, 1.05vw, 16px); font-weight: 700; letter-spacing: 0.05em; color: var(--ink); margin: 0 0 6px; }
.strat-item .copy { font-size: clamp(13px, 1vw, 14.5px); color: var(--muted); margin: 0; text-wrap: pretty; }

/* ---------- Footer ---------- */
.foot {
  margin-top: clamp(36px, 4.5vw, 64px);
  border-top: 1px solid var(--divider);
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: clamp(12px, 0.95vw, 14px);
  color: var(--muted);
}
.foot .prop { letter-spacing: 0.02em; }
.foot .prop b { color: var(--teal-bright); font-weight: 700; }

/* ===========================================================================
   MODAL
   =========================================================================== */
.mo-modal {
  position: fixed; inset: 0;
  background: rgba(5,6,8,0.78);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.mo-modal.open { opacity: 1; pointer-events: auto; }
.mo-modal-card {
  background: var(--panel);
  border: 1px solid var(--divider);
  border-radius: 18px;
  width: min(560px, 100%);
  padding: clamp(24px, 3vw, 38px);
  transform: translateY(8px); transition: transform .2s;
}
.mo-modal.open .mo-modal-card { transform: none; }
.mo-modal-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.mo-modal-head .tile { width: 56px; height: 56px; flex: 0 0 auto; }
.mo-modal-head .num { font-size: 13px; font-weight: 700; letter-spacing: 0.14em; color: var(--teal-bright); margin: 0 0 4px; }
.mo-modal-head .ttl { font-size: clamp(18px, 2vw, 24px); font-weight: 800; letter-spacing: 0.01em; margin: 0; }
.mo-modal .resumo { font-size: 16px; color: var(--ink); margin: 0 0 14px; }
.mo-modal .tool { font-size: 15px; font-weight: 700; color: var(--teal-bright); margin: 0 0 4px; }
.mo-modal .tool.accent { color: var(--teal-light); }
.mo-modal .extra { font-size: 14px; color: var(--muted); margin: 0; }
.mo-modal-foot { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.mo-close {
  position: absolute; top: 18px; right: 18px;
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--divider); background: transparent; color: var(--muted);
  cursor: pointer; font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.mo-close:hover { color: var(--ink); border-color: var(--tile-line); }
.mo-modal-card { position: relative; }

/* editable fields inside modal & detail */
[contenteditable="true"] {
  outline: none;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--divider);
  padding: 8px 11px;
  background: rgba(34,166,180,0.04);
  transition: box-shadow .15s;
}
[contenteditable="true"]:focus { box-shadow: inset 0 0 0 1.5px var(--teal); }
[contenteditable="true"]:empty::before { content: attr(data-ph); color: var(--muted); opacity: .7; }

/* ===========================================================================
   DETAIL PAGE
   =========================================================================== */
.detail-head { display: flex; align-items: flex-start; gap: clamp(16px, 2vw, 24px); }
.detail-head .tile { width: clamp(60px, 6vw, 80px); height: clamp(60px, 6vw, 80px); flex: 0 0 auto; }
.detail-head .num { font-size: 14px; font-weight: 700; letter-spacing: 0.16em; color: var(--teal-bright); margin: 4px 0 6px; }
.detail-head h1 { font-size: clamp(28px, 4vw, 46px); font-weight: 800; letter-spacing: -0.01em; margin: 0; line-height: 1.05; }
.detail-head .tool { font-size: 15px; font-weight: 700; color: var(--teal-bright); margin: 12px 0 0; }
.detail-head .tool.accent { color: var(--teal-light); }

.detail-body { max-width: 820px; margin-top: clamp(28px, 4vw, 48px); }
.detail-intro { font-size: clamp(16px, 1.4vw, 19px); color: var(--ink); margin: 0 0 30px; }
.detail-intro p { margin: 0 0 12px; }
.sec { margin-bottom: 30px; }
.sec h3 { font-size: clamp(15px, 1.3vw, 18px); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); margin: 0 0 10px; }
.sec .body { font-size: clamp(14px, 1.1vw, 16px); color: var(--muted); }
.sec .body p { margin: 0 0 10px; }
.sec .body:empty::before { content: "— a preencher —"; color: var(--muted); opacity: .5; }
.sec-row { display: flex; align-items: center; gap: 10px; }
.sec-row h3 { flex: 1 1 auto; min-width: 0; }
.sec-row .sec-del { flex: 0 0 auto; }
.sec-del, .sub-del {
  border: 1px solid var(--divider); background: transparent; color: var(--muted);
  border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.sec-del:hover, .sub-del:hover { color: #e7a3a3; border-color: #5a3a3a; }

/* subpages */
.subs { margin-top: clamp(36px, 5vw, 58px); border-top: 1px solid var(--divider); padding-top: 28px; }
.subs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.subs-head h2 { font-size: clamp(15px, 1.4vw, 19px); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin: 0; }
.subs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.sub-card {
  display: block; text-decoration: none;
  background: var(--panel); border: 1px solid var(--divider); border-radius: 14px;
  padding: 18px 20px; transition: border-color .15s, transform .15s;
}
.sub-card:hover { border-color: var(--tile-line); transform: translateY(-2px); }
.sub-card .sc-title { font-size: 16px; font-weight: 700; color: var(--ink); margin: 0 0 6px; }
.sub-card .sc-meta { font-size: 13px; color: var(--muted); margin: 0; display: flex; align-items: center; gap: 6px; }
.sub-card .sc-arrow { color: var(--teal-bright); }
.subs-empty { color: var(--muted); font-size: 14px; }

/* subpage view */
.subview h1 { font-size: clamp(24px, 3.4vw, 38px); font-weight: 800; margin: 0 0 8px; }
.subview .crumb { font-size: 13px; color: var(--muted); letter-spacing: 0.04em; margin: 0 0 20px; }
.subview .crumb a { color: var(--teal-bright); text-decoration: none; }
.subview .sv-body { max-width: 760px; font-size: clamp(15px, 1.2vw, 17px); color: var(--muted); }
.subview .sv-body p { margin: 0 0 12px; }

/* ---------- toast ---------- */
.mo-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(12px);
  background: var(--teal-bright); color: #06262b; font-weight: 700; font-size: 14px;
  padding: 11px 20px; border-radius: 10px; z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.mo-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- login ---------- */
.mo-login {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(120% 80% at 50% 0%, #0d1417 0%, var(--bg) 60%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.mo-login-card {
  width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px;
  background: var(--panel); border: 1px solid var(--divider);
  border-radius: 18px; padding: 34px 30px; text-align: center;
}
.mo-login-logo { width: 64px; height: 64px; border-radius: 22%; align-self: center; margin-bottom: 6px; border: 1px solid var(--divider); }
.mo-login-card h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: 0.01em; }
.mo-login-sub { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.mo-login-card input {
  font: inherit; font-size: 15px; color: var(--ink);
  background: rgba(34,166,180,0.05); border: 1px solid var(--divider);
  border-radius: 10px; padding: 12px 14px; outline: none;
}
.mo-login-card input:focus { border-color: var(--teal); }
.mo-login-card button {
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 4px;
  color: #06262b; background: var(--teal-bright); border: 0; border-radius: 10px; padding: 12px;
}
.mo-login-card button:hover { background: var(--teal-light); }
.mo-login-card button:disabled { opacity: .6; cursor: default; }
.mo-login-err { margin: 2px 0 0; font-size: 13px; color: #e7a3a3; }

/* ===========================================================================
   RESPONSIVE
   =========================================================================== */
@media (max-width: 1280px) {
  .timeline { flex-direction: column; align-items: stretch; margin: 36px 0; padding-left: 8px; }
  .timeline::before {
    content: ""; position: absolute;
    left: calc(8px + clamp(28px, 9vw, 36px)); top: 12px; bottom: 12px;
    width: 1.5px; background: var(--teal);
  }
  .connector { display: none; }
  .lead { display: none; }
  .node {
    width: 100%; height: auto;
    display: grid; grid-template-columns: clamp(56px, 18vw, 72px) 1fr;
    gap: clamp(16px, 4vw, 24px); align-items: start;
    padding: clamp(16px, 4vw, 24px) 0;
  }
  .node .tile { width: clamp(56px, 18vw, 72px); height: clamp(56px, 18vw, 72px); position: relative; z-index: 1; }
  .label { position: static; width: auto; left: auto; top: auto; bottom: auto; padding-top: 4px; }
  .node.up .label, .node.down .label { top: auto; bottom: auto; }
  .label .lbl-more { opacity: 1; color: var(--teal-bright); }
}
@media (max-width: 720px) {
  .strategy-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .topbar { flex-wrap: wrap; }
  .topbar-actions { width: 100%; margin-left: 0; }
}
@media (max-width: 480px) {
  .strategy-grid { grid-template-columns: 1fr; }
  .foot { flex-direction: column; align-items: flex-start; gap: 6px; }
  .topbar .title { font-size: clamp(22px, 8vw, 32px); }
}
