@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Syne:wght@700;800&display=swap');

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

:root {
  --bg0: #060b06;
  --bg1: #0d1410;
  --bg2: #111a13;
  --bg3: #162018;
  --bg4: #1c2a1e;
  --green: #2ecc8a;
  --green-dim: #1a7a52;
  --green-glow: #0d3d28;
  --green-text: #5dddaa;
  --gold: #D4A030;
  --gold-dim: #8a6520;
  --gold-light: #f0c060;
  --red: #e05050;
  --red-dim: #6a2020;
  --red-glow: #1e0808;
  --red-text: #e09090;
  --text: #e8edf5;
  --text2: #8a9ba8;
  --text3: #4a5a62;
  --border: #1e2e22;
  --border2: #2a3e2e;
  --r: 10px;
  --rm: 7px;
  --rs: 5px;
}

html, body {
  height: 100%;
  background: var(--bg0);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg1); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── LAYOUT ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--bg1);
  border-right: 0.5px solid var(--border2);
  display: flex; flex-direction: column;
  padding: 1.25rem 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.sidebar-logo {
  padding: 0 1.25rem 1.25rem;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 1rem;
}
.sidebar-logo svg { width: 100px; height: auto; display: block; }

.nav-section { padding: 0 0.75rem; margin-bottom: 0.5rem; }
.nav-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; padding: 0 0.5rem; margin-bottom: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--rm);
  cursor: pointer; color: var(--text2); font-size: 13px;
  transition: all 0.15s; text-decoration: none;
  border: 0.5px solid transparent;
}
.nav-item:hover { background: var(--bg2); color: var(--text); }
.nav-item.active { background: var(--green-glow); border-color: var(--green-dim); color: var(--green-text); }
.nav-item .nav-icon { font-size: 14px; width: 18px; text-align: center; }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-left: auto; }

.sidebar-footer { margin-top: auto; padding: 1rem 1.25rem 0; border-top: 0.5px solid var(--border); }
.sidebar-user { font-size: 12px; color: var(--text2); }
.sidebar-user strong { display: block; color: var(--text); font-size: 13px; }

.main-content { flex: 1; padding: 2rem; overflow-x: hidden; min-width: 0; }

/* ── TOPBAR ── */
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-title { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 800; color: var(--text); flex: 1; }
.page-sub { font-size: 12px; color: var(--text3); margin-top: 2px; letter-spacing: 0.04em; }

/* ── CARDS ── */
.card {
  background: var(--bg1); border: 0.5px solid var(--border2);
  border-radius: var(--r); padding: 1.25rem 1.5rem;
}
.card-title { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.card-sub { font-size: 12px; color: var(--text2); margin-bottom: 1rem; line-height: 1.5; }

/* ── METRIC CARDS ── */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 1.25rem; }
.mc { background: var(--bg1); border: 0.5px solid var(--border); border-radius: var(--rm); padding: 14px; }
.mc .mk { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 5px; }
.mc .mv { font-size: 22px; font-weight: 600; color: var(--text); }
.mc .ms { font-size: 11px; color: var(--text2); margin-top: 3px; }
.mc .mv.green { color: var(--green-text); }
.mc .mv.gold { color: var(--gold-light); }
.mc .mv.red { color: var(--red-text); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 500;
  padding: 8px 18px; border-radius: var(--rm); cursor: pointer;
  transition: all 0.15s; border: 0.5px solid var(--border2);
  background: var(--bg2); color: var(--text); text-decoration: none;
}
.btn:hover { background: var(--bg3); }
.btn-primary { background: var(--green-glow); border-color: var(--green-dim); color: var(--green-text); }
.btn-primary:hover { background: #0f4a33; }
.btn-gold { background: #1e1608; border-color: var(--gold-dim); color: var(--gold-light); }
.btn-gold:hover { background: #2a2010; }
.btn-danger { background: var(--red-glow); border-color: var(--red-dim); color: var(--red-text); }
.btn-sm { font-size: 11px; padding: 5px 12px; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── FORMS ── */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 11px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; font-family: 'Inter', sans-serif; font-size: 13px;
  background: var(--bg2); border: 0.5px solid var(--border2);
  border-radius: var(--rm); color: var(--text); padding: 9px 12px; outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--green-dim); }
.field textarea { min-height: 70px; resize: vertical; }
.field select option { background: var(--bg2); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── RADIO GROUP ── */
.radio-group { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.ropt {
  flex: 1; min-width: 80px;
  border: 0.5px solid var(--border2); border-radius: var(--rm);
  padding: 7px 10px; cursor: pointer; font-size: 12px;
  color: var(--text2); background: var(--bg2);
  transition: all 0.15s; text-align: center; user-select: none;
}
.ropt:hover { border-color: var(--border2); color: var(--text); }
.ropt.sel { border-color: var(--gold-dim); background: #1e1608; color: var(--gold-light); font-weight: 500; }
.ropt.sel-g { border-color: var(--green-dim); background: var(--green-glow); color: var(--green-text); font-weight: 500; }
.ropt.sel-r { border-color: var(--red-dim); background: var(--red-glow); color: var(--red-text); font-weight: 500; }

/* ── STATUS PILLS ── */
.sp { display: inline-block; font-size: 10px; padding: 3px 9px; border-radius: 20px; font-weight: 500; letter-spacing: 0.03em; border: 0.5px solid; }
.sp-diag { background: #1e1608; border-color: var(--gold-dim); color: var(--gold-light); }
.sp-ok { background: var(--green-glow); border-color: var(--green-dim); color: var(--green-text); }
.sp-acomp { background: #08101e; border-color: #1a2a4a; color: #80b0e0; }
.sp-novo { background: var(--bg3); border-color: var(--border2); color: var(--text3); }

/* ── PROGRESS BARS ── */
.bar-wrap { margin-bottom: 6px; }
.bar-label { display: flex; justify-content: space-between; font-size: 10px; color: var(--text3); margin-bottom: 3px; }
.bar-track { height: 3px; background: var(--border); border-radius: 2px; }
.bar-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }
.bf-green { background: var(--green); }
.bf-gold { background: var(--gold); }
.bf-red { background: var(--red); }

/* ── DIVIDER ── */
.divider { height: 0.5px; background: var(--border); margin: 1.25rem 0; }
.sec-label { font-size: 10px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }

/* ── AI STREAM BOX ── */
.ai-box {
  background: var(--bg2); border: 0.5px solid var(--border2);
  border-radius: var(--r); padding: 1.25rem 1.5rem;
  font-size: 13px; line-height: 1.8; color: var(--text2);
  white-space: pre-wrap; min-height: 70px;
}
.ai-label { font-size: 10px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.dot-anim { display: inline-flex; gap: 3px; }
.dot-anim span { width: 4px; height: 4px; border-radius: 50%; background: var(--green); animation: bnc 1.2s infinite; }
.dot-anim span:nth-child(2) { animation-delay: 0.2s; }
.dot-anim span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bnc { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg1); border: 0.5px solid var(--green-dim);
  border-radius: var(--rm); padding: 12px 18px;
  font-size: 13px; color: var(--green-text);
  opacity: 0; transform: translateY(8px);
  transition: all 0.3s; z-index: 999; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── MODAL OVERLAY ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 100;
  align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg1); border: 0.5px solid var(--border2);
  border-radius: var(--r); padding: 1.75rem; width: 100%; max-width: 460px;
}
.modal-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 1.25rem; }
.modal-btns { display: flex; gap: 8px; margin-top: 1.25rem; }

/* ── STEP NAV ── */
.steps-nav { display: flex; gap: 3px; margin-bottom: 1rem; overflow-x: auto; padding-bottom: 2px; }
.step-btn { flex: 1; min-width: 90px; background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--rm); padding: 8px 6px; cursor: pointer; text-align: center; transition: all 0.18s; font-family: 'Inter', sans-serif; }
.step-btn .sn { font-size: 10px; color: var(--text3); display: block; letter-spacing: 0.04em; }
.step-btn .sl { font-size: 11px; font-weight: 500; color: var(--text2); margin-top: 2px; display: block; }
.step-btn.done { border-color: var(--green-dim); background: var(--green-glow); }
.step-btn.done .sn, .step-btn.done .sl { color: var(--green-text); }
.step-btn.active { border-color: var(--gold-dim); background: #1e1608; }
.step-btn.active .sn, .step-btn.active .sl { color: var(--gold-light); }
.prog-bar { height: 2px; background: var(--border); border-radius: 1px; margin-bottom: 1.25rem; }
.prog-fill { height: 100%; background: var(--green); border-radius: 1px; transition: width 0.4s ease; }

/* ── SWOT ── */
.swot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 1rem 0; }
.swot-cell { border-radius: var(--rm); padding: 12px 14px; border: 0.5px solid; }
.swot-cell .swot-h { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.swot-cell ul { padding-left: 1rem; font-size: 12px; line-height: 1.8; }
.swot-s { background: #0a1e0f; border-color: #1a4a22; } .swot-s .swot-h { color: var(--green-text); } .swot-s ul { color: #8ad4aa; }
.swot-w { background: #1a0a08; border-color: #4a1a14; } .swot-w .swot-h { color: #e08080; } .swot-w ul { color: #c09090; }
.swot-o { background: #08101e; border-color: #1a2a4a; } .swot-o .swot-h { color: #80b0e0; } .swot-o ul { color: #8090b0; }
.swot-t { background: #1a1408; border-color: #4a3a14; } .swot-t .swot-h { color: var(--gold-light); } .swot-t ul { color: #b09060; }

/* ── ACTION TABLE ── */
.action-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.action-table th { background: var(--bg3); color: var(--text3); padding: 8px 10px; text-align: left; font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.action-table td { padding: 9px 10px; border-bottom: 0.5px solid var(--border); vertical-align: top; color: var(--text2); }
.action-table tr:last-child td { border-bottom: none; }
.action-table tr:hover td { background: var(--bg2); }
.td-acao { font-weight: 500; color: var(--text) !important; }
.prazo { display: inline-block; font-size: 10px; padding: 3px 8px; border-radius: 20px; font-weight: 500; border: 0.5px solid; }
.pr-i { background: #1e0808; border-color: var(--red-dim); color: var(--red-text); }
.pr-m { background: #1e1608; border-color: var(--gold-dim); color: var(--gold-light); }
.pr-l { background: var(--green-glow); border-color: var(--green-dim); color: var(--green-text); }

/* ── TIMELINE ── */
.tl { border-left: 1px solid var(--border2); padding-left: 1rem; margin: 0.5rem 0 1rem; }
.tl-item { position: relative; margin-bottom: 12px; }
.tl-dot { width: 7px; height: 7px; border-radius: 50%; position: absolute; left: -1.38rem; top: 4px; }
.tl-ok { background: var(--green); }
.tl-warn { background: var(--gold); }
.tl-info { background: #5090d0; }
.tl-lbl { font-size: 12px; font-weight: 500; color: var(--text); }
.tl-date { font-size: 10px; color: var(--text3); margin-top: 1px; }
.tl-note { font-size: 11px; color: var(--text2); margin-top: 3px; line-height: 1.5; }

/* ── AVATAR ── */
.av { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.av-g { background: var(--green-glow); color: var(--green-text); }
.av-a { background: #1e1608; color: var(--gold-light); }
.av-b { background: #08101e; color: #80b0e0; }
.av-p { background: #180a28; color: #b090e0; }
.av-r { background: #1a0808; color: #e08080; }

/* ── LOGIN PAGE ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg0); padding: 1rem; }
.login-box { background: var(--bg1); border: 0.5px solid var(--border2); border-radius: var(--r); padding: 2.5rem; width: 100%; max-width: 380px; }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo svg { width: 140px; height: auto; }
.login-title { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; color: var(--text); text-align: center; margin-bottom: 4px; }
.login-sub { font-size: 12px; color: var(--text3); text-align: center; margin-bottom: 1.5rem; letter-spacing: 0.04em; }
.login-err { background: var(--red-glow); border: 0.5px solid var(--red-dim); color: var(--red-text); border-radius: var(--rm); padding: 8px 12px; font-size: 12px; margin-bottom: 1rem; display: none; }

/* ── UTIL ── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.ml-auto { margin-left: auto; }
.mt-1 { margin-top: 1rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── PMF LOGO SVG INLINE ── */
.pmf-logo-svg { display: block; }

/* ── HAMBURGER BUTTON ── */
.hamburger {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 300;
  width: 38px; height: 38px;
  background: var(--bg1);
  border: 0.5px solid var(--border2);
  border-radius: var(--rm);
  align-items: center; justify-content: center;
  cursor: pointer; flex-direction: column; gap: 4px;
}
.hamburger span {
  display: block; width: 18px; height: 1.5px;
  background: var(--text2); border-radius: 2px;
  transition: all 0.2s;
}

/* ── SIDEBAR OVERLAY (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 199;
}
.sidebar-overlay.open { display: block; }

/* ── MOBILE NAV BAR (bottom) ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg1);
  border-top: 0.5px solid var(--border2);
  z-index: 200;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}
.mobile-nav-items {
  display: flex !important; justify-content: space-around; align-items: center;
}
.mobile-nav-item {
  display: flex !important; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 20px; cursor: pointer; text-decoration: none !important;
  color: var(--text3) !important; font-size: 11px; font-family: 'Inter', sans-serif;
  font-weight: 500; transition: color 0.15s; letter-spacing: 0.02em;
  border: none; background: none;
}
.mobile-nav-item:hover { color: var(--text2) !important; }
.mobile-nav-item.active { color: var(--green-text) !important; }
.mobile-nav-item .mni { font-size: 20px; line-height: 1; display: block; }
/* Override any browser default link styles inside mobile nav */
.mobile-nav a, .mobile-nav a:visited, .mobile-nav a:link {
  color: var(--text3); text-decoration: none;
}
.mobile-nav a.active, .mobile-nav a.active:visited {
  color: var(--green-text);
}

/* ── TABLET (≤ 900px) ── */
@media (max-width: 900px) {
  .sidebar { width: 180px; }
  .main-content { padding: 1.5rem; }
  .metrics-grid { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
}

/* ── MOBILE (≤ 660px) ── */
@media (max-width: 660px) {
  /* Layout */
  .app-shell { flex-direction: column; }
  .sidebar {
    position: fixed; top: 0; left: -240px;
    width: 240px; height: 100vh;
    z-index: 200; transition: left 0.25s ease;
  }
  .sidebar.open { left: 0; }
  .hamburger { display: flex; }
  .main-content {
    padding: 1rem; padding-top: 56px;
    padding-bottom: 72px; /* space for mobile nav */
    min-height: 100vh;
  }

  /* Mobile nav bar */
  .mobile-nav { display: block; }

  /* Page header */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-title { font-size: 18px; }

  /* Cards e grids */
  .grid2 { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .mc .mv { font-size: 18px; }

  /* Tabelas com scroll horizontal */
  .action-table { font-size: 11px; }
  .action-table th, .action-table td { padding: 7px 8px; }
  div[style*="overflow-x:auto"] { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* SWOT grid */
  .swot-grid { grid-template-columns: 1fr; }

  /* Steps nav */
  .steps-nav { gap: 2px; }
  .step-btn { min-width: 52px; padding: 6px 4px; }
  .step-btn .sl { font-size: 10px; }

  /* Botões */
  .btn { font-size: 12px; padding: 8px 14px; }
  .btn-row { flex-direction: column; }
  .btn-row .btn { justify-content: center; }

  /* Modal */
  .modal-overlay { padding: 0.5rem; align-items: flex-end; }
  .modal-box { border-radius: var(--r) var(--r) 0 0; max-width: 100%; }

  /* Cards de cliente */
  .client-grid { grid-template-columns: 1fr !important; }

  /* Login */
  .login-box { padding: 1.75rem 1.25rem; }

  /* KPI row em cliente */
  .kpi-row { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ── SMALL MOBILE (≤ 380px) ── */
@media (max-width: 380px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .steps-nav { overflow-x: auto; flex-wrap: nowrap; }
  .step-btn .sl { display: none; }
  .step-btn .sn { font-size: 11px; }
}
